mirror of
https://github.com/Jguer/yay
synced 2024-10-31 04:12:51 +00:00
By default yay uses Package Version for updates. Use --timeupdates to set updates based on modification time. Closes #9
This commit is contained in:
parent
22f8dcf150
commit
3905dd86a4
3 changed files with 17 additions and 2 deletions
15
aur/aur.go
15
aur/aur.go
|
@ -167,7 +167,8 @@ func Upgrade(flags []string) error {
|
||||||
|
|
||||||
if _, ok := foreign[res.Name]; ok {
|
if _, ok := foreign[res.Name]; ok {
|
||||||
// Leaving this here for now, warn about downgrades later
|
// Leaving this here for now, warn about downgrades later
|
||||||
if int64(res.LastModified) > foreign[res.Name].BuildDate().Unix() {
|
if (!config.YayConf.TimeUpdate && (int64(res.LastModified) > foreign[res.Name].BuildDate().Unix())) ||
|
||||||
|
alpm.VerCmp(foreign[res.Name].Version(), res.Version) < 0 {
|
||||||
buffer.WriteString(fmt.Sprintf("\x1b[1m\x1b[32m==>\x1b[33;1m %s: \x1b[0m%s \x1b[33;1m-> \x1b[0m%s\n",
|
buffer.WriteString(fmt.Sprintf("\x1b[1m\x1b[32m==>\x1b[33;1m %s: \x1b[0m%s \x1b[33;1m-> \x1b[0m%s\n",
|
||||||
res.Name, foreign[res.Name].Version(), res.Version))
|
res.Name, foreign[res.Name].Version(), res.Version))
|
||||||
outdated = append(outdated, res)
|
outdated = append(outdated, res)
|
||||||
|
@ -187,8 +188,18 @@ func Upgrade(flags []string) error {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var finalmdeps []string
|
||||||
for _, pkgi := range outdated {
|
for _, pkgi := range outdated {
|
||||||
PkgInstall(&pkgi, flags)
|
mdeps, err := PkgInstall(&pkgi, flags)
|
||||||
|
finalmdeps = append(finalmdeps, mdeps...)
|
||||||
|
if err != nil {
|
||||||
|
fmt.Println(err)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
err = pacman.CleanRemove(finalmdeps)
|
||||||
|
if err != nil {
|
||||||
|
fmt.Println(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
|
|
|
@ -38,6 +38,7 @@ type Configuration struct {
|
||||||
SearchMode int `json:"-"`
|
SearchMode int `json:"-"`
|
||||||
SortMode int `json:"sortmode"`
|
SortMode int `json:"sortmode"`
|
||||||
TarBin string `json:"tarbin"`
|
TarBin string `json:"tarbin"`
|
||||||
|
TimeUpdate bool `json:"versionupdate"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// YayConf holds the current config values for yay.
|
// YayConf holds the current config values for yay.
|
||||||
|
@ -123,6 +124,7 @@ func defaultSettings(config *Configuration) {
|
||||||
config.PacmanConf = "/etc/pacman.conf"
|
config.PacmanConf = "/etc/pacman.conf"
|
||||||
config.SortMode = BottomUp
|
config.SortMode = BottomUp
|
||||||
config.TarBin = "/usr/bin/bsdtar"
|
config.TarBin = "/usr/bin/bsdtar"
|
||||||
|
config.TimeUpdate = false
|
||||||
}
|
}
|
||||||
|
|
||||||
// Editor returns the preferred system editor.
|
// Editor returns the preferred system editor.
|
||||||
|
|
2
yay.go
2
yay.go
|
@ -68,6 +68,8 @@ func parser() (op string, options []string, packages []string, changedConfig boo
|
||||||
config.YayConf.Devel = true
|
config.YayConf.Devel = true
|
||||||
case "--nodevel":
|
case "--nodevel":
|
||||||
config.YayConf.Devel = false
|
config.YayConf.Devel = false
|
||||||
|
case "--timeupdates":
|
||||||
|
config.YayConf.TimeUpdate = true
|
||||||
case "--topdown":
|
case "--topdown":
|
||||||
config.YayConf.SortMode = config.TopDown
|
config.YayConf.SortMode = config.TopDown
|
||||||
case "--complete":
|
case "--complete":
|
||||||
|
|
Loading…
Reference in a new issue