Date: Wed, 4 Mar 2015 23:45:39 +0000 (UTC) From: Baptiste Daroussin <bapt@FreeBSD.org> To: src-committers@freebsd.org, svn-src-projects@freebsd.org Subject: svn commit: r279605 - projects/release-pkg/release/scripts Message-ID: <201503042345.t24NjdPo060574@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: bapt Date: Wed Mar 4 23:45:39 2015 New Revision: 279605 URL: https://svnweb.freebsd.org/changeset/base/279605 Log: Improve mtree to plist converter 1/ Analyse the fields from mtree lines to extract: - owner, - group, - mode, - flags, - tags, 2/ Ignore non tagged entries 3/ For now concat tags to form a futur package name 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 Wed Mar 4 23:01:03 2015 (r279604) +++ projects/release-pkg/release/scripts/mtree-to-plist.awk Wed Mar 4 23:45:39 2015 (r279605) @@ -1,15 +1,39 @@ #!/usr/bin/awk /^[^#]/ { gsub(/^\./,"", $1) - tags=$NF - gsub(/tags=/,"", tags) - output=tags".plist" - uname=$3 - gname=$4 - mode=$5 - gsub(/uname=/, "", uname); - gsub(/gname=/, "", gname); - gsub(/mode=/, "", mode); + uname="" + gname="" + mode="" + flags="" + tags="" + for (i=2; i<=NF; i++) { + if ($i ~ /^uname=/) { + uname=$i + gsub(/uname=/, "", uname); + } else if ($i ~ /^gname=/) { + gname=$i + gsub(/gname=/, "", gname); + } else if ($i ~ /^mode=/) { + mode=$i + gsub(/mode=/,"", mode); + } else if ($i ~ /^flags=/) { + flags=$i + gsub(/flags=/, "", flags); + } else if ($i ~ /^tags=/) { + tags=$i + gsub(/tags=/, "", tags); + } + } + if (length(tags) == 0) + next + if (tags ~ /package=/) { + gsub(/package=/,"",tags); + gsub(/,/, "-", tags); + pkg=tags + } else { + pkg=tags + } + output=pkg".plist" - print "@("uname","gname","mode") " $1 > output + print "@("uname","gname","mode","flags") " $1 > output }
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201503042345.t24NjdPo060574>