bugfix...

Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
Alex A. Naanou 2017-06-23 23:59:43 +03:00
parent 6a240ef261
commit 6221f56bd4
2 changed files with 30 additions and 4 deletions

View File

@ -330,8 +330,16 @@ var FeatureSetProto = {
// // ignores tags from .suggested... // // ignores tags from .suggested...
// missing: [ .. ], // missing: [ .. ],
// //
// // XXX // // exclusive feature conflicts...
// conflicts: conflicts, // // This will include the explicitly required conflicting
// // exclusive features.
// // NOTE: this is not an error, but indicates that the
// // system tried to fix the state by disabling all
// // but the first feature.
// conflicts: {
// exclusive-tag: [ feature-tag, .. ],
// ..
// },
// //
// // detected dependency loops (if .length > 0 sets fatal)... // // detected dependency loops (if .length > 0 sets fatal)...
// loops: [ .. ], // loops: [ .. ],
@ -559,6 +567,7 @@ var FeatureSetProto = {
: []) : [])
// build exclusive groups... // build exclusive groups...
// XXX need to sort the values to the same order as given features...
var exclusive = {} var exclusive = {}
var rev_exclusive = {} var rev_exclusive = {}
all all
@ -577,9 +586,26 @@ var FeatureSetProto = {
//-------------------------------- Exclusive groups/aliases --- //-------------------------------- Exclusive groups/aliases ---
// Handle exclusive feature groups and aliases... // Handle exclusive feature groups and aliases...
// //
// pre-sort exclusive feature by their occurrence in dependency
// tree...
// XXX is this the correct approach???
var loaded = Object.keys(features)
Object.keys(exclusive)
.forEach(function(k){
exclusive[k] = exclusive[k]
.map(function(e, i){ return [e, i] })
.sort(function(a, b){
var i = loaded.indexOf(a[0])
var j = loaded.indexOf(b[0])
return (i > 0 && j > 0) ?
i - j
: a[1] - b[1]
})
.map(function(e){ return e[0] }) })
// do the actual handling...
var conflicts = {} var conflicts = {}
var done = [] var done = []
Object.keys(features) loaded
.forEach(function(f){ .forEach(function(f){
// alias... // alias...
while(f in exclusive && done.indexOf(f) < 0){ while(f in exclusive && done.indexOf(f) < 0){

View File

@ -1,6 +1,6 @@
{ {
"name": "ig-features", "name": "ig-features",
"version": "3.1.3", "version": "3.1.4",
"description": "", "description": "",
"main": "features.js", "main": "features.js",
"scripts": { "scripts": {