mirror of
https://github.com/Jguer/yay
synced 2024-10-04 15:19:08 +00:00
48 lines
995 B
Go
48 lines
995 B
Go
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) {
|
|
updated := false
|
|
|
|
for _, pkgName := range pkgs {
|
|
_, ok := savedInfo[pkgName]
|
|
if ok {
|
|
delete(savedInfo, pkgName)
|
|
updated = true
|
|
}
|
|
}
|
|
|
|
if updated {
|
|
saveVCSInfo()
|
|
}
|
|
}
|
|
|
|
// CleanDependencies removes all dangling dependencies in system
|
|
func cleanDependencies(removeOptional bool) error {
|
|
hanging, err := hangingPackages(removeOptional)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
if len(hanging) != 0 {
|
|
err = cleanRemove(hanging)
|
|
}
|
|
|
|
return err
|
|
}
|
|
|
|
// CleanRemove sends a full removal command to pacman with the pkgName slice
|
|
func cleanRemove(pkgNames []string) (err error) {
|
|
if len(pkgNames) == 0 {
|
|
return nil
|
|
}
|
|
|
|
arguments := makeArguments()
|
|
arguments.addArg("R")
|
|
arguments.addTarget(pkgNames...)
|
|
err = passToPacman(arguments)
|
|
return err
|
|
}
|