|
@@ -12,14 +12,6 @@ import (
|
|
|
// Checks a single conflict against every other to be installed package's
|
|
|
// name and its provides.
|
|
|
func checkInnerConflict(name string, conflict string, conflicts map[string]stringSet, dc *depCatagories) {
|
|
|
- add := func(h map[string]stringSet, n string, v string) {
|
|
|
- _, ok := h[n]
|
|
|
- if !ok {
|
|
|
- h[n] = make(stringSet)
|
|
|
- }
|
|
|
- h[n].set(v)
|
|
|
- }
|
|
|
-
|
|
|
deps, err := gopkg.ParseDeps([]string{conflict})
|
|
|
if err != nil {
|
|
|
return
|
|
@@ -36,7 +28,7 @@ func checkInnerConflict(name string, conflict string, conflicts map[string]strin
|
|
|
return
|
|
|
}
|
|
|
if dep.Name == pkg.Name && version.Satisfies(dep) {
|
|
|
- add(conflicts, name, pkg.Name)
|
|
|
+ addMapStringSet(conflicts, name, pkg.Name)
|
|
|
continue
|
|
|
}
|
|
|
|
|
@@ -65,7 +57,7 @@ func checkInnerConflict(name string, conflict string, conflicts map[string]strin
|
|
|
}
|
|
|
|
|
|
if version != nil && version.Satisfies(dep) {
|
|
|
- add(conflicts, name, pkg.Name)
|
|
|
+ addMapStringSet(conflicts, name, pkg.Name)
|
|
|
break
|
|
|
}
|
|
|
|
|
@@ -83,7 +75,7 @@ func checkInnerConflict(name string, conflict string, conflicts map[string]strin
|
|
|
}
|
|
|
|
|
|
if dep.Name == pkg.Name() && version.Satisfies(dep) {
|
|
|
- add(conflicts, name, pkg.Name())
|
|
|
+ addMapStringSet(conflicts, name, pkg.Name())
|
|
|
continue
|
|
|
}
|
|
|
|
|
@@ -100,7 +92,7 @@ func checkInnerConflict(name string, conflict string, conflicts map[string]strin
|
|
|
}
|
|
|
|
|
|
if provide.Mod == alpm.DepModAny {
|
|
|
- add(conflicts, name, pkg.Name())
|
|
|
+ addMapStringSet(conflicts, name, pkg.Name())
|
|
|
return fmt.Errorf("")
|
|
|
}
|
|
|
|
|
@@ -109,8 +101,8 @@ func checkInnerConflict(name string, conflict string, conflicts map[string]strin
|
|
|
return nil
|
|
|
}
|
|
|
|
|
|
- if version.Satisfies(dep) {
|
|
|
- add(conflicts, name, pkg.Name())
|
|
|
+ if version.Satisfies(dep) {
|
|
|
+ addMapStringSet(conflicts, name, pkg.Name())
|
|
|
return fmt.Errorf("")
|
|
|
}
|
|
|
|
|
@@ -121,7 +113,7 @@ func checkInnerConflict(name string, conflict string, conflicts map[string]strin
|
|
|
|
|
|
// Checks every to be installed package's conflicts against every other to be
|
|
|
// installed package and its provides.
|
|
|
-func checkForInnerConflicts(dc *depCatagories) (map[string]stringSet) {
|
|
|
+func checkForInnerConflicts(dc *depCatagories) map[string]stringSet {
|
|
|
conflicts := make(map[string]stringSet)
|
|
|
|
|
|
for _, pkg := range dc.Aur {
|
|
@@ -143,14 +135,6 @@ func checkForInnerConflicts(dc *depCatagories) (map[string]stringSet) {
|
|
|
// Checks a provide or packagename from a to be installed package
|
|
|
// against every already installed package's conflicts
|
|
|
func checkReverseConflict(name string, provide string, conflicts map[string]stringSet) error {
|
|
|
- add := func(h map[string]stringSet, n string, v string) {
|
|
|
- _, ok := h[n]
|
|
|
- if !ok {
|
|
|
- h[n] = make(stringSet)
|
|
|
- }
|
|
|
- h[n].set(v)
|
|
|
- }
|
|
|
-
|
|
|
var version *gopkg.CompleteVersion
|
|
|
var err error
|
|
|
|
|
@@ -167,7 +151,6 @@ func checkReverseConflict(name string, provide string, conflicts map[string]stri
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-
|
|
|
localDb.PkgCache().ForEach(func(pkg alpm.Package) error {
|
|
|
if name == pkg.Name() {
|
|
|
return nil
|
|
@@ -191,9 +174,9 @@ func checkReverseConflict(name string, provide string, conflicts map[string]stri
|
|
|
return nil
|
|
|
}
|
|
|
|
|
|
- if version == nil || version.Satisfies(dep) {
|
|
|
+ if version == nil || version.Satisfies(dep) {
|
|
|
// Todo
|
|
|
- add(conflicts, name, pkg.Name() + " (" + provide + ")")
|
|
|
+ addMapStringSet(conflicts, name, pkg.Name()+" ("+provide+")")
|
|
|
return fmt.Errorf("")
|
|
|
}
|
|
|
|
|
@@ -209,14 +192,6 @@ func checkReverseConflict(name string, provide string, conflicts map[string]stri
|
|
|
// Checks the conflict of a to be installed package against the package name and
|
|
|
// provides of every installed package.
|
|
|
func checkConflict(name string, conflict string, conflicts map[string]stringSet) error {
|
|
|
- add := func(h map[string]stringSet, n string, v string) {
|
|
|
- _, ok := h[n]
|
|
|
- if !ok {
|
|
|
- h[n] = make(stringSet)
|
|
|
- }
|
|
|
- h[n].set(v)
|
|
|
- }
|
|
|
-
|
|
|
localDb, err := alpmHandle.LocalDb()
|
|
|
if err != nil {
|
|
|
return err
|
|
@@ -240,7 +215,7 @@ func checkConflict(name string, conflict string, conflicts map[string]stringSet)
|
|
|
}
|
|
|
|
|
|
if dep.Name == pkg.Name() && version.Satisfies(dep) {
|
|
|
- add(conflicts, name, pkg.Name())
|
|
|
+ addMapStringSet(conflicts, name, pkg.Name())
|
|
|
return nil
|
|
|
}
|
|
|
|
|
@@ -257,7 +232,7 @@ func checkConflict(name string, conflict string, conflicts map[string]stringSet)
|
|
|
}
|
|
|
|
|
|
if provide.Mod == alpm.DepModAny {
|
|
|
- add(conflicts, name, pkg.Name() + " (" + provide.Name + ")")
|
|
|
+ addMapStringSet(conflicts, name, pkg.Name()+" ("+provide.Name+")")
|
|
|
return fmt.Errorf("")
|
|
|
}
|
|
|
|
|
@@ -267,7 +242,7 @@ func checkConflict(name string, conflict string, conflicts map[string]stringSet)
|
|
|
}
|
|
|
|
|
|
if version.Satisfies(dep) {
|
|
|
- add(conflicts, name, pkg.Name() + " (" + provide.Name + ")")
|
|
|
+ addMapStringSet(conflicts, name, pkg.Name()+" ("+provide.Name+")")
|
|
|
return fmt.Errorf("")
|
|
|
}
|
|
|
|
|
@@ -283,7 +258,7 @@ func checkConflict(name string, conflict string, conflicts map[string]stringSet)
|
|
|
// Checks every to be installed package's conflicts against the names and
|
|
|
// provides of every already installed package and checks every to be installed
|
|
|
// package's name and provides against every already installed package.
|
|
|
-func checkForConflicts(dc *depCatagories) (map[string]stringSet, error) {
|
|
|
+func checkForConflicts(dc *depCatagories) (map[string]stringSet, error) {
|
|
|
conflicts := make(map[string]stringSet)
|
|
|
|
|
|
for _, pkg := range dc.Aur {
|
|
@@ -326,13 +301,13 @@ func checkForAllConflicts(dc *depCatagories) error {
|
|
|
var wg sync.WaitGroup
|
|
|
wg.Add(2)
|
|
|
|
|
|
- fmt.Println(bold(cyan("::")+ " Checking for conflicts..."))
|
|
|
+ fmt.Println(bold(cyan("::") + " Checking for conflicts..."))
|
|
|
go func() {
|
|
|
conflicts, err = checkForConflicts(dc)
|
|
|
wg.Done()
|
|
|
}()
|
|
|
|
|
|
- fmt.Println(bold(cyan("::")+ " Checking for inner conflicts..."))
|
|
|
+ fmt.Println(bold(cyan("::") + " Checking for inner conflicts..."))
|
|
|
go func() {
|
|
|
innerConflicts = checkForInnerConflicts(dc)
|
|
|
wg.Done()
|