mirror of
https://github.com/Jguer/yay
synced 2024-10-04 15:19:08 +00:00
96f499ff44
This reimplemens all operations yay previously supported: '-S' 'Syu' 'Si' ect. Currently the argument objects are not fully implemented with the code. Theres alot of funky conversion from argument object -> pkg, flags -> argument object This is to just get back to the functionally we had before (almost). I have not looked into it yet but alot of the time pacman flags get passed to makepkg. this cases an error for most commands now because the new system Passes all flags: `yay -Syu` -> flags = '-S' '-y' '-u' while the old system would have done: `yay -Syu` -> op = '-Suy', flags = '' So extra flags are no longer passed at all currently. This means: 'yay -S aic94xx-firmware --noconfirm -b /tmp/pacutilesu2q6hw/tmp-pacman -d' will no longer error and 'aic94xx-firmware' will be installed but the database path change will not apply and the dep checking will not be skipped.
64 lines
1.4 KiB
Go
64 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", "s", "n", "s", "noconfirm")
|
|
arguments.addTarget(pkgNames...)
|
|
|
|
err = passToPacman(arguments)
|
|
return err
|
|
}
|