mirror of
https://github.com/Jguer/yay
synced 2024-10-31 04:12:51 +00:00
232edc64a6
Argument parsing now works mostly as expected for repo packages. AUR packages are a little tricky becauce makepkg cant handle args such as '--dbpath'. Also out alpm handle does not read the commandline options so any arguments relient on alpm will be ignored. For now though it seems yay has gained back the functionality it once had. While also having improved argument handling which should also be expandable and make it easier to handle anything new that might have been missed.
63 lines
1.4 KiB
Go
63 lines
1.4 KiB
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.
|
|
|
|
// RemoveMakeDeps receives a make dependency list and removes those
|
|
// that are no longer necessary.
|
|
func removeMakeDeps(depS []string) (err error) {
|
|
hanging := sliceHangingPackages(depS)
|
|
|
|
if len(hanging) != 0 {
|
|
if !continueTask("Confirm Removal?", "nN") {
|
|
return nil
|
|
}
|
|
err = cleanRemove(hanging)
|
|
}
|
|
|
|
return
|
|
}
|
|
|
|
// RemovePackage removes package from VCS information
|
|
func removeVCSPackage(pkgs []string) {
|
|
for _, pkgName := range pkgs {
|
|
for i, e := range savedInfo {
|
|
if e.Package == pkgName {
|
|
savedInfo[i] = savedInfo[len(savedInfo)-1]
|
|
savedInfo = savedInfo[:len(savedInfo)-1]
|
|
}
|
|
}
|
|
}
|
|
|
|
_ = saveVCSInfo()
|
|
}
|
|
|
|
// CleanDependencies removes all dangling dependencies in system
|
|
func cleanDependencies() error {
|
|
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
|
|
func cleanRemove(pkgNames []string) (err error) {
|
|
if len(pkgNames) == 0 {
|
|
return nil
|
|
}
|
|
|
|
arguments := makeArguments()
|
|
arguments.addArg("R", "noconfirm")
|
|
arguments.addTarget(pkgNames...)
|
|
|
|
err = passToPacman(arguments)
|
|
return err
|
|
}
|