2017-08-02 19:24:03 +02:00
|
|
|
package main
|
|
|
|
|
|
|
|
// GetPkgbuild gets the pkgbuild of the package 'pkg' trying the ABS first and then the AUR trying the ABS first and then the AUR.
|
|
|
|
|
|
|
|
// RemovePackage removes package from VCS information
|
|
|
|
func removeVCSPackage(pkgs []string) {
|
2018-03-05 23:15:34 +01:00
|
|
|
updated := false
|
|
|
|
|
2017-08-02 19:24:03 +02:00
|
|
|
for _, pkgName := range pkgs {
|
2018-03-05 23:15:34 +01:00
|
|
|
_, ok := savedInfo[pkgName]
|
|
|
|
if ok {
|
|
|
|
delete(savedInfo, pkgName)
|
|
|
|
updated = true
|
2017-08-02 19:24:03 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-03-05 23:15:34 +01:00
|
|
|
if updated {
|
|
|
|
saveVCSInfo()
|
|
|
|
}
|
2017-08-02 19:24:03 +02:00
|
|
|
}
|
|
|
|
|
2017-10-14 18:11:47 +02:00
|
|
|
// CleanDependencies removes all dangling dependencies in system
|
2018-01-04 01:59:57 +01:00
|
|
|
func cleanDependencies() error {
|
2017-08-02 19:24:03 +02:00
|
|
|
hanging, err := hangingPackages()
|
|
|
|
if err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
|
|
|
|
if len(hanging) != 0 {
|
|
|
|
if !continueTask("Confirm Removal?", "nN") {
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
err = cleanRemove(hanging)
|
|
|
|
}
|
|
|
|
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
|
|
|
|
// CleanRemove sends a full removal command to pacman with the pkgName slice
|
2018-01-04 01:59:57 +01:00
|
|
|
func cleanRemove(pkgNames []string) (err error) {
|
|
|
|
if len(pkgNames) == 0 {
|
2017-08-02 19:24:03 +02:00
|
|
|
return nil
|
|
|
|
}
|
2018-01-19 15:51:18 +01:00
|
|
|
|
2018-02-08 23:51:43 +01:00
|
|
|
oldvalue := config.NoConfirm
|
|
|
|
config.NoConfirm = true
|
2018-01-04 01:59:57 +01:00
|
|
|
arguments := makeArguments()
|
2018-02-08 23:51:43 +01:00
|
|
|
arguments.addArg("R")
|
2018-01-04 01:59:57 +01:00
|
|
|
arguments.addTarget(pkgNames...)
|
|
|
|
err = passToPacman(arguments)
|
2018-02-08 23:51:43 +01:00
|
|
|
config.NoConfirm = oldvalue
|
2017-08-02 19:24:03 +02:00
|
|
|
return err
|
|
|
|
}
|