aboutsummaryrefslogtreecommitdiff
path: root/release
diff options
context:
space:
mode:
authorBaptiste Daroussin <bapt@FreeBSD.org>2015-03-04 23:45:39 +0000
committerBaptiste Daroussin <bapt@FreeBSD.org>2015-03-04 23:45:39 +0000
commitf4da3de6474425919918a841a09ef17ce0adc09c (patch)
tree6ed53cf7684aaf5c37aa386987003aa921f4c9fa /release
parentef3290ce8b6f3b9a6bcb017badcbde4375617605 (diff)
downloadsrc-f4da3de6474425919918a841a09ef17ce0adc09c.tar.gz
src-f4da3de6474425919918a841a09ef17ce0adc09c.zip
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
Notes
Notes: svn path=/projects/release-pkg/; revision=279605
Diffstat (limited to 'release')
-rw-r--r--release/scripts/mtree-to-plist.awk44
1 files changed, 34 insertions, 10 deletions
diff --git a/release/scripts/mtree-to-plist.awk b/release/scripts/mtree-to-plist.awk
index 21dd7840af01..152b977f0204 100644
--- a/release/scripts/mtree-to-plist.awk
+++ b/release/scripts/mtree-to-plist.awk
@@ -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
}