* removed musl and openssl from btrfs-progs.cache
[t2sde.git] / scripts / Create-PkgList
blob477da508e8c260b2bc42a3aaad6dfc434b4f574e
1 #!/usr/bin/env bash
2 # --- T2-COPYRIGHT-NOTE-BEGIN ---
3 # T2 SDE: scripts/Create-PkgList
4 # Copyright (C) 2004 - 2023 The T2 SDE Project
5 # Copyright (C) 1998 - 2003 ROCK Linux Project
6 #
7 # This Copyright note is generated by scripts/Create-CopyPatch,
8 # more information can be found in the files COPYING and README.
9 #
10 # This program is free software; you can redistribute it and/or modify
11 # it under the terms of the GNU General Public License version 2.
12 # --- T2-COPYRIGHT-NOTE-END ---
14 if [ $# -lt 1 -o ! -d "architecture/$1" ]; then
15 echo "Usage: $0 [ <arch-name> ] [ <kernel> ]"
16 [ $# -eq 0 ] || echo " '$1' is not a valid architecture"
17 exit 1
18 fi 1>&2
20 if [ $# -lt 2 -o ! -d "kernel/$2" ]; then
21 echo "Usage: $0 [ <arch-name> ] [ <kernel> ]"
22 [ $# -eq 0 ] || echo " '$2' is not a valid kernel"
23 exit 1
24 fi 1>&2
26 echo 'BEGIN {
27 arch="'$1'";
28 kernel="'$2'";
31 function print_package() {
32 print defset, stages, pri, pkgtree,
33 package, ver, "/" categories flags, 0;
36 END {
37 if (pkgtree) print_package();
40 (FNR == 1 && pkgtree) {
41 print_package();
44 FNR == 1 {
45 split(FILENAME, a, /\//);
46 pkgtree=a[1]; package=a[2];
47 defset="X"; pri="999.999";
48 stages="-----------";
49 ver="0000"; categories=""
50 ver_dup=0; flags=""
53 /^\[(P|PRI|PRIORITY)\]/ {
54 split($0, a, /[ \t]+/);
55 defset=a[2]; stages=a[3]; pri=a[4];
58 /^\[(V|VER|VERSION)\]/ {
59 split($0, a, /[ \t]+/);
60 if (ver_dup == 0) ver=a[2];
61 ver_dup = 1;
64 /^\[(C|CATEGORY)\]/ {
65 split($0, a, /[ \t]+/);
66 for (c=2; a[c]; c++) categories = categories " " a[c];
69 /^\[(F|FLAGS)\]/ {
70 split($0, a, /[ \t]+/);
71 for (c=2; a[c]; c++) flags = flags " " a[c];
74 /^\[(R|ARCH|ARCHITECTURE)\]/ {
75 n=split($0, a, /[ \t]+/);
76 #if (arch == "")
77 # next;
79 # search for an architecture match
80 if (a[2] == "-") {
81 for (i = 3; i<= n; ++i) {
82 if (arch == a[i]) {
83 pkgtree=""
84 next;
87 # fall thru: keep it
89 else { # intentionally start at index 2: implicit exlusive selection
90 for (i = 2; i<= n; ++i) {
91 if (arch == a[i]) {
92 next;
95 # not found: remove it
96 pkgtree="";
100 /^\[(K|KERN|KERNEL)\]/ {
101 n=split($0, k, /[ \t]+/);
103 # search for an kernel match
104 if (k[2] == "-") {
105 for (i = 3; i<= n; ++i) {
106 if (kernel == k[i]) {
107 pkgtree=""
108 next;
111 # fall thru: keep it
113 else { # intentionally start at index 2: implicit exlusive selection
114 for (i = 2; i<= n; ++i) {
115 if (kernel == k[i]) {
116 next;
119 # not found: remove it
120 pkgtree="";
122 }' | (cd package; gawk -f - */*/*.desc) | sort -k3