[pacman-dev] [PATCH v4] paclog-pkglist: parse entries with caller info

Andrew Gregory andrew.gregory.8 at gmail.com
Wed Jan 23 19:28:58 EST 2013


Signed-off-by: Andrew Gregory <andrew.gregory.8 at gmail.com>
---

Let's try that again without the sneaky permission change this time...

 contrib/paclog-pkglist.sh.in | 24 +++++++++++++++++-------
 1 file changed, 17 insertions(+), 7 deletions(-)

diff --git a/contrib/paclog-pkglist.sh.in b/contrib/paclog-pkglist.sh.in
index 222bbc4..908bd4a 100644
--- a/contrib/paclog-pkglist.sh.in
+++ b/contrib/paclog-pkglist.sh.in
@@ -50,25 +50,35 @@ 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
+		nfields = NF
+	} else {
+		action  = $3
+		pkgname = $4
+		pkgver  = $5
+		upgver  = $7
+		nfields = (NF + 1)    # compensate for missing caller field
+	}
 }
 
-NF == 5 && action == "installed" {
+nfields == 6 && action == "installed" {
 	gsub(/[()]/, "", pkgver)
 	pkg[pkgname] = pkgver
 	next
 }
 
-NF == 7 && action == "upgraded" {
+nfields == 8 && action == "upgraded" {
 	sub(/\)/, "", upgver)
 	pkg[pkgname] = upgver
 	next
 }
 
-NF == 5 && action == "removed" {
+nfields == 6 && action == "removed" {
 	pkg[pkgname] = -1
 }
 
-- 
1.8.1.1



More information about the pacman-dev mailing list