-
Notifications
You must be signed in to change notification settings - Fork 1
/
Create-PkgList
executable file
·95 lines (83 loc) · 2.03 KB
/
Create-PkgList
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
#!/bin/bash
# --- T2-COPYRIGHT-NOTE-BEGIN ---
# This copyright note is auto-generated by ./scripts/Create-CopyPatch.
#
# T2 SDE: scripts/Create-PkgList
# Copyright (C) 2004 - 2007 The T2 SDE Project
# Copyright (C) 1998 - 2003 ROCK Linux Project
#
# More information can be found in the files COPYING and README.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; version 2 of the License. A copy of the
# GNU General Public License can be found in the file COPYING.
# --- T2-COPYRIGHT-NOTE-END ---
if [ $# -ne 1 -o ! -d architecture/"$1" ] ; then
echo "Usage: $0 [ <arch-name> ]"
[ $# -eq 0 ] ||
echo " '$1' is not a valid architecture"
exit 1
fi 1>&2
echo 'BEGIN {
arch="'$1'";
}
function print_package() {
print defset, stages, pri, pkgtree,
package, ver, "/" categories flags, 0;
}
END {
if ( pkgtree ) print_package();
}
( FNR == 1 && pkgtree ) {
print_package();
}
FNR == 1 {
split(FILENAME, a, /\//);
pkgtree=a[1]; package=a[2];
defset="X"; pri="999.999";
stages="-----------";
ver="0000"; categories=""
ver_dup=0; flags=""
}
/^\[(P|PRI|PRIORITY)\]/ {
split($0, a, /[ \t]+/);
defset=a[2]; stages=a[3]; pri=a[4];
}
/^\[(V|VER|VERSION)\]/ {
split($0, a, /[ \t]+/);
if ( ver_dup == 0 ) ver=a[2];
ver_dup = 1;
}
/^\[(C|CATEGORY)\]/ {
split($0, a, /[ \t]+/);
for (c=2; a[c]; c++) categories = categories " " a[c];
}
/^\[(F|FLAGS)\]/ {
split($0, a, /[ \t]+/);
for (c=2; a[c]; c++) flags = flags " " a[c];
}
/^\[(R|ARCH|ARCHITECTURE)\]/ {
n=split($0, a, /[ \t]+/);
#if (arch == "")
# next;
# search for an architecture match
if ( a[2] == "-" ) {
for ( i = 3; i<= n; ++i) {
if ( arch == a[i] ) {
pkgtree=""
next;
}
}
# fall thru: keep it
}
else { # intentionally start at index 2: implicit exlusive selection
for ( i = 2; i<= n; ++i) {
if ( arch == a[i] ) {
next;
}
}
# not found: remove it
pkgtree="";
}
}' | (cd package ; gawk -f - */*/*.desc ) | sort -k3