Add --redownloadall option and fix manpage descs

This commit is contained in:
morganamilo 2018-03-07 21:32:55 +00:00
parent d5fc1e0de5
commit a6cab60888
No known key found for this signature in database
GPG key ID: 6FE9E7996B0B082E
4 changed files with 21 additions and 11 deletions

10
cmd.go
View file

@ -46,7 +46,8 @@ Permanent configuration options:
--noafterclean Do not remove package sources after successful build
--timeupdate Check package's AUR page for changes during sysupgrade
--notimeupdate Do not checking of AUR page changes
--redownload Always download pkgbuilds
--redownload Always download pkgbuilds of targets
--redownloadall Always download pkgbuilds of all AUR packages
--noredownload Skip pkgbuild download if in cache and up to date
Print specific options:
@ -358,9 +359,11 @@ func handleConfig(option string) bool {
case "noconfirm":
config.NoConfirm = true
case "redownload":
config.ReDownload = true
config.ReDownload = "yes"
case "redownloadall":
config.ReDownload = "all"
case "noredownload":
config.ReDownload = false
config.ReDownload = "no"
default:
return false
}
@ -370,6 +373,7 @@ func handleConfig(option string) bool {
}
func handleVersion() {
fmt.Print(config.ReDownload)
fmt.Printf("yay v%s\n", version)
}

View file

@ -31,6 +31,7 @@ type Configuration struct {
PacmanBin string `json:"pacmanbin"`
PacmanConf string `json:"pacmanconf"`
TarBin string `json:"tarbin"`
ReDownload string `json:"redownload"`
RequestSplitN int `json:"requestsplitn"`
SearchMode int `json:"-"`
SortMode int `json:"sortmode"`
@ -39,7 +40,6 @@ type Configuration struct {
NoConfirm bool `json:"-"`
Devel bool `json:"devel"`
CleanAfter bool `json:"cleanAfter"`
ReDownload bool `json:"redownload"`
}
var version = "3.373"
@ -113,7 +113,7 @@ func defaultSettings(config *Configuration) {
config.TarBin = "/usr/bin/bsdtar"
config.TimeUpdate = false
config.RequestSplitN = 150
config.ReDownload = false
config.ReDownload = "no"
}
// Editor returns the preferred system editor.

View file

@ -164,7 +164,7 @@ func install(parser *arguments) error {
return fmt.Errorf("Aborting due to user")
}
err = dowloadPkgBuilds(dc.Aur, dc.Bases)
err = downloadPkgBuilds(dc.Aur, parser.targets, dc.Bases)
if err != nil {
return err
}
@ -399,9 +399,9 @@ func parsesrcinfosGenerate(pkgs []*rpc.Pkg, srcinfos map[string]*gopkg.PKGBUILD,
return nil
}
func dowloadPkgBuilds(pkgs []*rpc.Pkg, bases map[string][]*rpc.Pkg) error {
func downloadPkgBuilds(pkgs []*rpc.Pkg, targets stringSet, bases map[string][]*rpc.Pkg) error {
for k, pkg := range pkgs {
if !config.ReDownload {
if config.ReDownload == "no" || (config.ReDownload == "yes" && !targets.get(pkg.Name)) {
dir := config.BuildDir + pkg.PackageBase + "/.SRCINFO"
pkgbuild, err := gopkg.ParseSRCINFO(dir)

12
yay.8
View file

@ -154,13 +154,19 @@ Do not consider build times during sysupgrade\&.
.PP
\fB\-\-redownload\fR
.RS 4
When downloading pkgbuilds if the pkgbuild is found in cache and is equal or
newer than the AUR's version use that instead of downloading a new one\&.
Always download pkgbuilds of targets even when a copy is avaliable in cache\&.
.RE
.PP
\fB\-\-redownloadall\fR
.RS 4
Always download pkgbuilds of all AUR packages even when a copy is avaliable
in cache\&.
.RE
.PP
\fB\-\-noredownload\fR
.RS 4
Always download pkgbuilds even when a copy is avaliable in cache\&.
When downloading pkgbuilds if the pkgbuild is found in cache and is equal or
newer than the AUR's version use that instead of downloading a new one\&.
.RE
.SH "EXAMPLES"
.PP