first commit
This commit is contained in:
commit
1354db6c39
90 files changed
+13123
No files matched your search
@@ -0,0 +1,29 @@
|
||||
# SPDX-License-Identifier: GPL-2.0-or-later
|
||||
# Copyright (C) 2026 Bryan Joshua Pedini
|
||||
|
||||
# parse-inst.awk - parse the "Inst" lines of `LC_ALL=C apt-get -s <verb>` into TSV.
|
||||
# usage: LC_ALL=C apt-get -s --with-new-pkgs upgrade | awk -f parse-inst.awk
|
||||
# output: name<TAB>oldversion<TAB>newversion<TAB>repo
|
||||
# oldversion is "-" for packages that are newly installed (no previous version);
|
||||
# repo is the raw origin list, e.g. "Ubuntu:24.04/noble-updates, Ubuntu:24.04/noble-security"
|
||||
# (may be empty for packages coming from a local .deb). POSIX awk, tested with mawk 1.3.4.
|
||||
/^Inst / {
|
||||
name = $2
|
||||
rest = $0
|
||||
sub(/^Inst [^ ]+ /, "", rest)
|
||||
old = "-"
|
||||
if (substr(rest, 1, 1) == "[") { # "[old] (new origins [arch])"
|
||||
old = rest
|
||||
sub(/^\[/, "", old)
|
||||
sub(/\].*$/, "", old)
|
||||
sub(/^\[[^]]*\] /, "", rest)
|
||||
}
|
||||
sub(/^\(/, "", rest) # "new origins [arch]) ..."
|
||||
new = rest
|
||||
sub(/ .*$/, "", new)
|
||||
sub(/^[^ ]+ ?/, "", rest) # "origins [arch]) ..."
|
||||
i = index(rest, "])")
|
||||
repo = substr(rest, 1, i - 1) # "origins [arch"
|
||||
sub(/ ?\[[^[]*$/, "", repo) # drop " [arch"
|
||||
printf "%s\t%s\t%s\t%s\n", name, old, new, repo
|
||||
}
|
||||
Reference in new issue
Block a user