mirror of
https://github.com/Jguer/yay
synced 2024-10-31 04:12:51 +00:00
Merge pull request #208 from Morganamilo/redownload
Add support to skip pkgbuild downloads.
This commit is contained in:
commit
a7be7a839d
4 changed files with 51 additions and 23 deletions
26
cmd.go
26
cmd.go
|
@ -46,6 +46,9 @@ Permanent configuration options:
|
||||||
--noafterclean Do not remove package sources after successful build
|
--noafterclean Do not remove package sources after successful build
|
||||||
--timeupdate Check package's AUR page for changes during sysupgrade
|
--timeupdate Check package's AUR page for changes during sysupgrade
|
||||||
--notimeupdate Do not checking of AUR page changes
|
--notimeupdate Do not checking of AUR page changes
|
||||||
|
--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:
|
Print specific options:
|
||||||
-c --complete Used for completions
|
-c --complete Used for completions
|
||||||
|
@ -351,16 +354,6 @@ func handleConfig(option string) bool {
|
||||||
config.CleanAfter = true
|
config.CleanAfter = true
|
||||||
case "noafterclean":
|
case "noafterclean":
|
||||||
config.CleanAfter = false
|
config.CleanAfter = false
|
||||||
// case "gendb":
|
|
||||||
// err = createDevelDB()
|
|
||||||
// if err != nil {
|
|
||||||
// fmt.Println(err)
|
|
||||||
// }
|
|
||||||
// err = saveVCSInfo()
|
|
||||||
// if err != nil {
|
|
||||||
// fmt.Println(err)
|
|
||||||
// }
|
|
||||||
// os.Exit(0)
|
|
||||||
case "devel":
|
case "devel":
|
||||||
config.Devel = true
|
config.Devel = true
|
||||||
case "nodevel":
|
case "nodevel":
|
||||||
|
@ -373,14 +366,14 @@ func handleConfig(option string) bool {
|
||||||
config.SortMode = TopDown
|
config.SortMode = TopDown
|
||||||
case "bottomup":
|
case "bottomup":
|
||||||
config.SortMode = BottomUp
|
config.SortMode = BottomUp
|
||||||
// case "help":
|
|
||||||
// usage()
|
|
||||||
// os.Exit(0)
|
|
||||||
// case "version":
|
|
||||||
// fmt.Printf("yay v%s\n", version)
|
|
||||||
// os.Exit(0)
|
|
||||||
case "noconfirm":
|
case "noconfirm":
|
||||||
config.NoConfirm = true
|
config.NoConfirm = true
|
||||||
|
case "redownload":
|
||||||
|
config.ReDownload = "yes"
|
||||||
|
case "redownloadall":
|
||||||
|
config.ReDownload = "all"
|
||||||
|
case "noredownload":
|
||||||
|
config.ReDownload = "no"
|
||||||
default:
|
default:
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
@ -390,6 +383,7 @@ func handleConfig(option string) bool {
|
||||||
}
|
}
|
||||||
|
|
||||||
func handleVersion() {
|
func handleVersion() {
|
||||||
|
fmt.Print(config.ReDownload)
|
||||||
fmt.Printf("yay v%s\n", version)
|
fmt.Printf("yay v%s\n", version)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -31,6 +31,7 @@ type Configuration struct {
|
||||||
PacmanBin string `json:"pacmanbin"`
|
PacmanBin string `json:"pacmanbin"`
|
||||||
PacmanConf string `json:"pacmanconf"`
|
PacmanConf string `json:"pacmanconf"`
|
||||||
TarBin string `json:"tarbin"`
|
TarBin string `json:"tarbin"`
|
||||||
|
ReDownload string `json:"redownload"`
|
||||||
RequestSplitN int `json:"requestsplitn"`
|
RequestSplitN int `json:"requestsplitn"`
|
||||||
SearchMode int `json:"-"`
|
SearchMode int `json:"-"`
|
||||||
SortMode int `json:"sortmode"`
|
SortMode int `json:"sortmode"`
|
||||||
|
@ -128,6 +129,7 @@ func defaultSettings(config *Configuration) {
|
||||||
config.TarBin = "/usr/bin/bsdtar"
|
config.TarBin = "/usr/bin/bsdtar"
|
||||||
config.TimeUpdate = false
|
config.TimeUpdate = false
|
||||||
config.RequestSplitN = 150
|
config.RequestSplitN = 150
|
||||||
|
config.ReDownload = "no"
|
||||||
}
|
}
|
||||||
|
|
||||||
// Editor returns the preferred system editor.
|
// Editor returns the preferred system editor.
|
||||||
|
|
29
install.go
29
install.go
|
@ -164,7 +164,7 @@ func install(parser *arguments) error {
|
||||||
return fmt.Errorf("Aborting due to user")
|
return fmt.Errorf("Aborting due to user")
|
||||||
}
|
}
|
||||||
|
|
||||||
err = dowloadPkgBuilds(dc.Aur, dc.Bases)
|
err = downloadPkgBuilds(dc.Aur, parser.targets, dc.Bases)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
@ -389,20 +389,35 @@ func parsesrcinfosGenerate(pkgs []*rpc.Pkg, srcinfos map[string]*gopkg.PKGBUILD,
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func dowloadPkgBuilds(pkgs []*rpc.Pkg, bases map[string][]*rpc.Pkg) (err error) {
|
func downloadPkgBuilds(pkgs []*rpc.Pkg, targets stringSet, bases map[string][]*rpc.Pkg) error {
|
||||||
for k, pkg := range pkgs {
|
for k, pkg := range pkgs {
|
||||||
//todo make pretty
|
if config.ReDownload == "no" || (config.ReDownload == "yes" && !targets.get(pkg.Name)) {
|
||||||
str := bold(cyan("::") + " Downloading (%d/%d): %s\n")
|
dir := config.BuildDir + pkg.PackageBase + "/.SRCINFO"
|
||||||
|
pkgbuild, err := gopkg.ParseSRCINFO(dir)
|
||||||
|
|
||||||
|
if err == nil {
|
||||||
|
version, err := gopkg.NewCompleteVersion(pkg.Version)
|
||||||
|
if err == nil {
|
||||||
|
if !version.Newer(pkgbuild.Version()) {
|
||||||
|
str := bold(cyan("::") + " PKGBUILD up to date, Skipping (%d/%d): %s\n")
|
||||||
|
fmt.Printf(str, k+1, len(pkgs), formatPkgbase(pkg, bases))
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
str := bold(cyan("::") + " Downloading PKGBUILD (%d/%d): %s\n")
|
||||||
|
|
||||||
fmt.Printf(str, k+1, len(pkgs), formatPkgbase(pkg, bases))
|
fmt.Printf(str, k+1, len(pkgs), formatPkgbase(pkg, bases))
|
||||||
|
|
||||||
err = downloadAndUnpack(baseURL+pkg.URLPath, config.BuildDir, false)
|
err := downloadAndUnpack(baseURL+pkg.URLPath, config.BuildDir, false)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func downloadPkgBuildsSources(pkgs []*rpc.Pkg, bases map[string][]*rpc.Pkg) (err error) {
|
func downloadPkgBuildsSources(pkgs []*rpc.Pkg, bases map[string][]*rpc.Pkg) (err error) {
|
||||||
|
|
17
yay.8
17
yay.8
|
@ -151,6 +151,23 @@ the last modification time of each package's AUR page\&.
|
||||||
.RS 4
|
.RS 4
|
||||||
Do not consider build times during sysupgrade\&.
|
Do not consider build times during sysupgrade\&.
|
||||||
.RE
|
.RE
|
||||||
|
.PP
|
||||||
|
\fB\-\-redownload\fR
|
||||||
|
.RS 4
|
||||||
|
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
|
||||||
|
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"
|
.SH "EXAMPLES"
|
||||||
.PP
|
.PP
|
||||||
yay \fIfoo\fR
|
yay \fIfoo\fR
|
||||||
|
|
Loading…
Reference in a new issue