On Fri, Jan 18, 2013 at 08:42:22PM -0500, Andrew Gregory wrote:
Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com> ---
I'm not very familiar with awk, so there is probably a better way to do this.
contrib/paclog-pkglist.sh.in | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-)
diff --git a/contrib/paclog-pkglist.sh.in b/contrib/paclog-pkglist.sh.in index 222bbc4..e1bd58e 100644 --- a/contrib/paclog-pkglist.sh.in +++ b/contrib/paclog-pkglist.sh.in @@ -50,25 +50,34 @@ fi
<"$logfile" awk ' { - action = $3 - pkgname = $4 - pkgver = $5 - upgver = $7 + if ($3 ~ /^\[.*\]$/) { + # new style with caller name + action = $4 + pkgname = $5 + pkgver = $6 + upgver = $8 + } else { + action = $3 + pkgname = $4 + pkgver = $5 + upgver = $7 + NF = (NF + 1)
Would prefer using a different varname over modifying/lying about the value of an internal var. This seems fine otherwise.
+ } }
-NF == 5 && action == "installed" { +NF == 6 && action == "installed" { gsub(/[()]/, "", pkgver) pkg[pkgname] = pkgver next }
-NF == 7 && action == "upgraded" { +NF == 8 && action == "upgraded" { sub(/\)/, "", upgver) pkg[pkgname] = upgver next }
-NF == 5 && action == "removed" { +NF == 6 && action == "removed" { pkg[pkgname] = -1 }
-- 1.8.1.1