svn commit: r279608 - projects/release-pkg/release/scripts
Baptiste Daroussin
bapt at FreeBSD.org
Thu Mar 5 00:18:33 UTC 2015
Author: bapt
Date: Thu Mar 5 00:18:32 2015
New Revision: 279608
URL: https://svnweb.freebsd.org/changeset/base/279608
Log:
Simplify and clean awk script
Suggested by: dteske
Modified:
projects/release-pkg/release/scripts/mtree-to-plist.awk
Modified: projects/release-pkg/release/scripts/mtree-to-plist.awk
==============================================================================
--- projects/release-pkg/release/scripts/mtree-to-plist.awk Thu Mar 5 00:13:42 2015 (r279607)
+++ projects/release-pkg/release/scripts/mtree-to-plist.awk Thu Mar 5 00:18:32 2015 (r279608)
@@ -1,35 +1,31 @@
#!/usr/bin/awk
/^[^#]/ {
gsub(/^\./,"", $1)
- uname=""
- gname=""
- mode=""
- flags=""
- tags=""
+ uname = gname = mode = flags = tags = ""
for (i=2; i<=NF; i++) {
if ($i ~ /^uname=/) {
uname=$i
- gsub(/uname=/, "", uname);
+ gsub(/uname=/, "", uname)
} else if ($i ~ /^gname=/) {
gname=$i
- gsub(/gname=/, "", gname);
+ gsub(/gname=/, "", gname)
} else if ($i ~ /^mode=/) {
mode=$i
- gsub(/mode=/,"", mode);
+ gsub(/mode=/,"", mode)
} else if ($i ~ /^flags=/) {
flags=$i
- gsub(/flags=/, "", flags);
+ gsub(/flags=/, "", flags)
} else if ($i ~ /^tags=/) {
tags=$i
- gsub(/tags=/, "", tags);
+ gsub(/tags=/, "", tags)
}
}
if (length(tags) == 0)
next
if (tags ~ /package=/) {
- gsub(/package=/,"",tags);
- gsub(/,/, "-", tags);
- gsub(/runtime-/, "", tags);
+ gsub(/package=/,"",tags)
+ gsub(/,/, "-", tags)
+ gsub(/runtime-/, "", tags)
pkg=tags
} else {
pkg=tags
More information about the svn-src-projects
mailing list