Skip to content

Commit be0d400

Browse files
committed
fix upgradeall to also run update first
Apply the same update+upgrade merge to upgradeall methods that was done for upgrade in dd08970. Affects Apt, Brew (also fixes incomplete merge in upgrade), Opkg. Also fixes Pakku upgradeAll to refresh DBs (-Sua → -Syua) and Apk upgrade to run apk update first.
1 parent f179c53 commit be0d400

1 file changed

Lines changed: 15 additions & 6 deletions

File tree

targets.nim

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,9 @@ def(Apt, where, "apt-file", "search")
9494
method upgrade(this:Apt, args:seq[string]): void =
9595
discard exec(sudo() & "apt-get", "update", @[])
9696
discard exec(sudo() & "apt-get", "upgrade", args)
97-
def(Apt, upgradeall, sudo() & "apt-get", "dist-upgrade")
97+
method upgradeall(this:Apt, args:seq[string]): void =
98+
discard exec(sudo() & "apt-get", "update", @[])
99+
discard exec(sudo() & "apt-get", "dist-upgrade", args)
98100
def(Apt, passthrough, sudo() & "apt-get", "")
99101

100102
def(Brew, info, "brew", "info")
@@ -104,8 +106,12 @@ def(Brew, list, "brew", "list")
104106
def(Brew, remove, "brew", "uninstall")
105107
def(Brew, search, "brew", "search")
106108
def(Brew, where, "brew", "search")
107-
def(Brew, upgrade, "brew", "upgrade")
108-
def(Brew, upgradeAll, "brew", "upgrade")
109+
method upgrade(this:Brew, args:seq[string]): void =
110+
discard exec("brew", "update", @[])
111+
discard exec("brew", "upgrade", args)
112+
method upgradeAll(this:Brew, args:seq[string]): void =
113+
discard exec("brew", "update", @[])
114+
discard exec("brew", "upgrade", args)
109115
def(Brew, passthrough, "brew", "")
110116

111117
def(Choco, info, "choco", "info")
@@ -182,7 +188,7 @@ def(Pakku, install, "pakku", "-S")
182188
def(Pakku, search, "pakku", "-Ss")
183189
method upgrade(this:Pakku, args:seq[string]): void =
184190
discard exec("pakku", "-Syu", args)
185-
def(Pakku, upgradeAll, "pakku", "-Sua")
191+
def(Pakku, upgradeAll, "pakku", "-Syua")
186192
def(Pakku, passthrough, "pakku", "")
187193

188194
def(Opkg, info, "opkg", "info")
@@ -197,7 +203,8 @@ method upgrade(this:Opkg, args:seq[string]): void =
197203
discard exec("opkg", "upgrade", args)
198204
ns(Opkg, orphan)
199205
method upgradeAll(this:Opkg, args:seq[string]): void =
200-
let packages = execCmdEx("opkg list-upgradable").output.splitLines.map( proc (it:string): string =
206+
discard exec("opkg", "update", @[])
207+
let packages = execCmdEx("opkg list-upgradable").output.splitLines.map( proc (it:string): string =
201208
let slash = it.find(" - ")
202209
if slash < 0: return ""
203210
return " " & it.substr(0, slash-1).strip
@@ -212,5 +219,7 @@ def(Apk, list, "apk", "info")
212219
def(Apk, remove, "apk", "del")
213220
def(Apk, search, "apk", "search")
214221
def(Apk, where, "apk info", "--who-owns")
215-
def(Apk, upgrade, "apk", "upgrade")
222+
method upgrade(this:Apk, args:seq[string]): void =
223+
discard exec("apk", "update", @[])
224+
discard exec("apk", "upgrade", args)
216225
def(Opkg, passthrough, "apk", "")

0 commit comments

Comments
 (0)