mirror of
https://github.com/Jguer/yay
synced 2024-10-05 23:59:13 +00:00
Add support to skip pkgbuild downloads.
If a pkgbuild is already in cache and matches the version on the aur skip the download. The version we check comes from the .SRCINFO file on disk which is never updated. (updates through pkgver() edit the pkgbuild but do not effect the .SRCINFO). Therefore if the the version of the .SRCINFO matches the AUR's version there must not be an update. In the case of the on disk version being newer than the AUR version we can assume user interaction and they probably do not want it overwitten so in that case also skip the download.
This commit is contained in:
parent
01afc61f0d
commit
f66349696e
20
cmd.go
20
cmd.go
|
@ -341,16 +341,6 @@ func handleConfig(option string) bool {
|
|||
config.CleanAfter = true
|
||||
case "noafterclean":
|
||||
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":
|
||||
config.Devel = true
|
||||
case "nodevel":
|
||||
|
@ -363,14 +353,12 @@ func handleConfig(option string) bool {
|
|||
config.SortMode = TopDown
|
||||
case "bottomup":
|
||||
config.SortMode = BottomUp
|
||||
// case "help":
|
||||
// usage()
|
||||
// os.Exit(0)
|
||||
// case "version":
|
||||
// fmt.Printf("yay v%s\n", version)
|
||||
// os.Exit(0)
|
||||
case "noconfirm":
|
||||
config.NoConfirm = true
|
||||
case "redownload":
|
||||
config.ReDownload = true
|
||||
case "noredownload":
|
||||
config.ReDownload = false
|
||||
default:
|
||||
return false
|
||||
}
|
||||
|
|
|
@ -39,6 +39,7 @@ type Configuration struct {
|
|||
NoConfirm bool `json:"-"`
|
||||
Devel bool `json:"devel"`
|
||||
CleanAfter bool `json:"cleanAfter"`
|
||||
ReDownload bool `json:"redownload"`
|
||||
}
|
||||
|
||||
var version = "3.373"
|
||||
|
@ -112,6 +113,7 @@ func defaultSettings(config *Configuration) {
|
|||
config.TarBin = "/usr/bin/bsdtar"
|
||||
config.TimeUpdate = false
|
||||
config.RequestSplitN = 150
|
||||
config.ReDownload = false
|
||||
}
|
||||
|
||||
// Editor returns the preferred system editor.
|
||||
|
|
27
install.go
27
install.go
|
@ -399,20 +399,35 @@ func parsesrcinfosGenerate(pkgs []*rpc.Pkg, srcinfos map[string]*gopkg.PKGBUILD,
|
|||
return nil
|
||||
}
|
||||
|
||||
func dowloadPkgBuilds(pkgs []*rpc.Pkg, bases map[string][]*rpc.Pkg) (err error) {
|
||||
func dowloadPkgBuilds(pkgs []*rpc.Pkg, bases map[string][]*rpc.Pkg) error {
|
||||
for k, pkg := range pkgs {
|
||||
//todo make pretty
|
||||
str := bold(cyan("::") + " Downloading (%d/%d): %s\n")
|
||||
if !config.ReDownload {
|
||||
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))
|
||||
|
||||
err = downloadAndUnpack(baseURL+pkg.URLPath, config.BuildDir, false)
|
||||
err := downloadAndUnpack(baseURL+pkg.URLPath, config.BuildDir, false)
|
||||
if err != nil {
|
||||
return
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
return
|
||||
return nil
|
||||
}
|
||||
|
||||
func downloadPkgBuildsSources(pkgs []*rpc.Pkg, bases map[string][]*rpc.Pkg) (err error) {
|
||||
|
|
Loading…
Reference in a new issue