mirror of
https://github.com/Jguer/yay.git
synced 2025-08-11 17:17:12 +02:00
commit
6ee14d44b8
36
clean.go
36
clean.go
@ -187,9 +187,8 @@ func cleanUntracked() error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
dir := filepath.Join(config.BuildDir, file.Name())
|
dir := filepath.Join(config.BuildDir, file.Name())
|
||||||
|
|
||||||
if shouldUseGit(dir) {
|
if shouldUseGit(dir) {
|
||||||
if err = show(passToGit(dir, "clean", "-fx")); err != nil {
|
if err := show(passToGit(dir, "clean", "-fx")); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -197,3 +196,36 @@ func cleanUntracked() error {
|
|||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func cleanAfter(bases []Base) {
|
||||||
|
fmt.Println("removing Untracked AUR files from cache...")
|
||||||
|
|
||||||
|
for i, base := range bases {
|
||||||
|
dir := filepath.Join(config.BuildDir, base.Pkgbase())
|
||||||
|
|
||||||
|
if shouldUseGit(dir) {
|
||||||
|
fmt.Printf(bold(cyan("::")+" Cleaning (%d/%d): %s\n"), i+1, len(bases), cyan(dir))
|
||||||
|
_, stderr, err := capture(passToGit(dir, "reset", "--hard", "HEAD"))
|
||||||
|
if err != nil {
|
||||||
|
fmt.Printf("error resetting %s: %s", base.String(), stderr)
|
||||||
|
}
|
||||||
|
|
||||||
|
show(passToGit(dir, "clean", "-fx"))
|
||||||
|
} else {
|
||||||
|
fmt.Printf(bold(cyan("::")+" Deleting (%d/%d): %s\n"), i+1, len(bases), cyan(dir))
|
||||||
|
if err := os.RemoveAll(dir); err != nil {
|
||||||
|
fmt.Println(err)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func cleanBuilds(bases []Base) {
|
||||||
|
for i, base := range bases {
|
||||||
|
dir := filepath.Join(config.BuildDir, base.Pkgbase())
|
||||||
|
fmt.Printf(bold(cyan("::")+" Deleting (%d/%d): %s\n"), i+1, len(bases), cyan(dir))
|
||||||
|
if err := os.RemoveAll(dir); err != nil {
|
||||||
|
fmt.Println(err)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
4
cmd.go
4
cmd.go
@ -79,8 +79,8 @@ Permanent configuration options:
|
|||||||
--removemake Remove makedepends after install
|
--removemake Remove makedepends after install
|
||||||
--noremovemake Don't remove makedepends after install
|
--noremovemake Don't remove makedepends after install
|
||||||
|
|
||||||
--afterclean Remove package sources after successful install
|
--cleanafter Remove package sources after successful install
|
||||||
--noafterclean Do not remove package sources after successful build
|
--nocleanafter Do not remove package sources after successful build
|
||||||
--bottomup Shows AUR's packages first and then repository's
|
--bottomup Shows AUR's packages first and then repository's
|
||||||
--topdown Shows repository's packages first and then AUR's
|
--topdown Shows repository's packages first and then AUR's
|
||||||
|
|
||||||
|
@ -66,7 +66,7 @@ _yay() {
|
|||||||
makepkg pacman tar git gpg gpgflags config requestsplitn sudoloop nosudoloop
|
makepkg pacman tar git gpg gpgflags config requestsplitn sudoloop nosudoloop
|
||||||
redownload noredownload redownloadall rebuild rebuildall rebuildtree norebuild
|
redownload noredownload redownloadall rebuild rebuildall rebuildtree norebuild
|
||||||
sortby answerclean answerdiff answeredit answerupgrade noanswerclean noanswerdiff
|
sortby answerclean answerdiff answeredit answerupgrade noanswerclean noanswerdiff
|
||||||
noansweredit noanswerupgrade cleanmenu diffmenu editmenu upgrademenu
|
noansweredit noanswerupgrade cleanmenu diffmenu editmenu upgrademenu cleanafter nocleanafter
|
||||||
nocleanmenu nodiffmenu noupgrademenu provides noprovides pgpfetch nopgpfetch
|
nocleanmenu nodiffmenu noupgrademenu provides noprovides pgpfetch nopgpfetch
|
||||||
useask nouseask combinedupgrade nocombinedupgrade aur repo makepkgconf
|
useask nouseask combinedupgrade nocombinedupgrade aur repo makepkgconf
|
||||||
nomakepkgconf askremovemake removemake noremovemake completioninterval aururl'
|
nomakepkgconf askremovemake removemake noremovemake completioninterval aururl'
|
||||||
|
@ -65,8 +65,8 @@ complete -c $progname -n "not $noopt" -l topdown -d 'Shows repository packages f
|
|||||||
complete -c $progname -n "not $noopt" -l bottomup -d 'Shows aur packages first and then repository' -f
|
complete -c $progname -n "not $noopt" -l bottomup -d 'Shows aur packages first and then repository' -f
|
||||||
complete -c $progname -n "not $noopt" -l devel -d 'Check -git/-svn/-hg development version' -f
|
complete -c $progname -n "not $noopt" -l devel -d 'Check -git/-svn/-hg development version' -f
|
||||||
complete -c $progname -n "not $noopt" -l nodevel -d 'Disable development version checking' -f
|
complete -c $progname -n "not $noopt" -l nodevel -d 'Disable development version checking' -f
|
||||||
complete -c $progname -n "not $noopt" -l afterclean -d 'Clean package sources after successful build' -f
|
complete -c $progname -n "not $noopt" -l cleanafter -d 'Clean package sources after successful build' -f
|
||||||
complete -c $progname -n "not $noopt" -l noafterclean -d 'Disable package sources cleaning' -f
|
complete -c $progname -n "not $noopt" -l nocleanafter -d 'Disable package sources cleaning' -f
|
||||||
complete -c $progname -n "not $noopt" -l timeupdate -d 'Check package modification date and version' -f
|
complete -c $progname -n "not $noopt" -l timeupdate -d 'Check package modification date and version' -f
|
||||||
complete -c $progname -n "not $noopt" -l notimeupdate -d 'Check only package version change' -f
|
complete -c $progname -n "not $noopt" -l notimeupdate -d 'Check only package version change' -f
|
||||||
|
|
||||||
|
@ -80,8 +80,8 @@ _pacman_opts_common=(
|
|||||||
'--topdown[Show repository packages first]'
|
'--topdown[Show repository packages first]'
|
||||||
'--devel[Check -git/-svn/-hg development version]'
|
'--devel[Check -git/-svn/-hg development version]'
|
||||||
'--nodevel[Disable development version checking]'
|
'--nodevel[Disable development version checking]'
|
||||||
'--afterclean[Clean package sources after successful build]'
|
'--cleanafter[Clean package sources after successful build]'
|
||||||
'--noafterclean[Disable package sources cleaning after successful build]'
|
'--nocleanafter[Disable package sources cleaning after successful build]'
|
||||||
'--timeupdate[Check packages modification date and version]'
|
'--timeupdate[Check packages modification date and version]'
|
||||||
'--notimeupdate[Check only package version change]'
|
'--notimeupdate[Check only package version change]'
|
||||||
'--redownload[Always download pkgbuilds of targets]'
|
'--redownload[Always download pkgbuilds of targets]'
|
||||||
|
10
doc/yay.8
10
doc/yay.8
@ -359,11 +359,17 @@ Download and update PKGBUILDs using tarballs. The above conditions about
|
|||||||
previously installed packages still apply.
|
previously installed packages still apply.
|
||||||
|
|
||||||
.TP
|
.TP
|
||||||
.B \-\-afterclean
|
.B \-\-cleanafter
|
||||||
Remove package sources after successful Install.
|
Remove package sources after successful Install.
|
||||||
|
|
||||||
|
For packages downloaded through git, untracked files are removed with the
|
||||||
|
exception of directories. This allows VCS packages to ealily pull an update
|
||||||
|
instead of having to re clone the entire repo.
|
||||||
|
|
||||||
|
For packages downloaded via tarball, The entire directory is deleted.
|
||||||
|
|
||||||
.TP
|
.TP
|
||||||
.B \-\-noafterclean
|
.B \-\-nocleanafter
|
||||||
Do not remove package sources after successful Install.
|
Do not remove package sources after successful Install.
|
||||||
|
|
||||||
.TP
|
.TP
|
||||||
|
12
install.go
12
install.go
@ -341,7 +341,7 @@ func install(parser *arguments) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if config.CleanAfter {
|
if config.CleanAfter {
|
||||||
cleanBuilds(do.Aur)
|
cleanAfter(do.Aur)
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
@ -680,14 +680,6 @@ func editDiffNumberMenu(bases []Base, installed stringSet, diff bool) ([]Base, e
|
|||||||
return toEdit, nil
|
return toEdit, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func cleanBuilds(bases []Base) {
|
|
||||||
for i, base := range bases {
|
|
||||||
dir := filepath.Join(config.BuildDir, base.Pkgbase())
|
|
||||||
fmt.Printf(bold(cyan("::")+" Deleting (%d/%d): %s\n"), i+1, len(bases), cyan(dir))
|
|
||||||
os.RemoveAll(dir)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func showPkgbuildDiffs(bases []Base, cloned stringSet) error {
|
func showPkgbuildDiffs(bases []Base, cloned stringSet) error {
|
||||||
for _, base := range bases {
|
for _, base := range bases {
|
||||||
pkg := base.Pkgbase()
|
pkg := base.Pkgbase()
|
||||||
@ -962,12 +954,14 @@ func buildInstallPkgbuilds(dp *depPool, do *depOrder, srcinfos map[string]*gosrc
|
|||||||
}
|
}
|
||||||
|
|
||||||
if installed {
|
if installed {
|
||||||
|
show(passToMakepkg(dir, "-c", "--nobuild", "--noextract", "--ignorearch"))
|
||||||
fmt.Println(cyan(pkg+"-"+version) + bold(" is up to date -- skipping"))
|
fmt.Println(cyan(pkg+"-"+version) + bold(" is up to date -- skipping"))
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if built {
|
if built {
|
||||||
|
show(passToMakepkg(dir, "-c", "--nobuild", "--noextract", "--ignorearch"))
|
||||||
fmt.Println(bold(yellow(arrow)),
|
fmt.Println(bold(yellow(arrow)),
|
||||||
cyan(pkg+"-"+version)+bold(" already made -- skipping build"))
|
cyan(pkg+"-"+version)+bold(" already made -- skipping build"))
|
||||||
} else {
|
} else {
|
||||||
|
@ -419,8 +419,8 @@ func isArg(arg string) bool {
|
|||||||
//yay options
|
//yay options
|
||||||
case "aururl":
|
case "aururl":
|
||||||
case "save":
|
case "save":
|
||||||
case "afterclean":
|
case "afterclean", "cleanafter":
|
||||||
case "noafterclean":
|
case "noafterclean", "nocleanafter":
|
||||||
case "devel":
|
case "devel":
|
||||||
case "nodevel":
|
case "nodevel":
|
||||||
case "timeupdate":
|
case "timeupdate":
|
||||||
@ -501,9 +501,9 @@ func handleConfig(option, value string) bool {
|
|||||||
config.AURURL = value
|
config.AURURL = value
|
||||||
case "save":
|
case "save":
|
||||||
shouldSaveConfig = true
|
shouldSaveConfig = true
|
||||||
case "afterclean":
|
case "afterclean", "cleanafter":
|
||||||
config.CleanAfter = true
|
config.CleanAfter = true
|
||||||
case "noafterclean":
|
case "noafterclean", "nocleanafter":
|
||||||
config.CleanAfter = false
|
config.CleanAfter = false
|
||||||
case "devel":
|
case "devel":
|
||||||
config.Devel = true
|
config.Devel = true
|
||||||
|
Loading…
Reference in New Issue
Block a user