* updated x264 (4121277 -> 4613ac3c)
[t2sde.git] / scripts / Create-PkgQueue
blob9acfa3beaf7f916c08f01415c03b2c7b3cb18bb8
1 #!/usr/bin/env bash
3 # --- T2-COPYRIGHT-NOTE-BEGIN ---
4 # T2 SDE: scripts/Create-PkgQueue
5 # Copyright (C) 2004 - 2023 The T2 SDE Project
6 # Copyright (C) 1998 - 2003 ROCK Linux Project
7 #
8 # This Copyright note is generated by scripts/Create-CopyPatch,
9 # more information can be found in the files COPYING and README.
11 # This program is free software; you can redistribute it and/or modify
12 # it under the terms of the GNU General Public License version 2.
13 # --- T2-COPYRIGHT-NOTE-END ---
15 config=default
16 logdir=""
17 single=0
18 debug=0
19 nobrokendeps=0
21 while [ "$1" ]; do
22 case "$1" in
23 -cfg)
24 config=$2; shift; shift ;;
25 -single)
26 single=1 ; shift ;;
27 -logdir)
28 logdir=$2; shift; shift ;;
29 -debug)
30 debug=1 ; shift ;;
31 -nobrokendeps)
32 nobrokendeps=1; shift ;;
34 echo "Usage: $0 [ -cfg config ] [ -single ] \\"
35 echo " ${0//?/ } [ -logdir logdir ] [ -debug ]"
36 exit 1 ;;
37 esac
38 done
40 . scripts/parse-config
42 gawk '
43 function check_package() {
44 split(pkgline, a); dep=a[2];
45 if (a[1] != "X" || ! index(a[2], stagelevel)) return;
47 repository = a[4];
48 package = a[5];
50 logfile = logfile_tpl;
51 gsub("<stagelevel>", stagelevel, logfile);
52 gsub("<repository>", repository, logfile);
53 gsub("<package>", package, logfile);
55 errfile = logfile; outfile = logfile;
56 gsub("<log>", "log", logfile);
57 gsub("<log>", "err", errfile);
58 gsub("<log>", "out", outfile);
61 if ((getline dummy < logfile == -1) &&
62 (getline dummy < errfile == -1)) {
63 build_this_package = 1;
64 found_dependencies = 0;
65 buildtime = 60;
66 priority = 0;
68 if (getline dummy < outfile != -1)
69 build_this_package = 0;
71 if (index(not_present, " " package " ")) {
72 if (debug && build_this_package)
73 print "DEBUG: Not building " stagelevel "-" \
74 package ": earlier stages not done " \
75 "for this package."
76 build_this_package = 0;
79 if (build_this_package && (package in database)) {
80 split(database[package], a);
81 buildtime = a[2];
82 priority = a[3];
84 for (c in a) {
85 # if (a[c] == package) continue;
86 # if (strtonum(c) <= 3) continue;
87 if (debug && 0)
88 print "DEBUG: Checking " stagelevel \
89 "-" package ": needs " a[c];
90 if (index(not_present, " " a[c] " ") &&
91 stagelevel != stage9_no_deps) {
92 if (debug && build_this_package)
93 print "DEBUG: Not building " \
94 stagelevel "-" package \
95 ": " a[c] " is missing";
96 build_this_package=0;
98 found_dependencies = 1;
102 # Do not build packages parallel in stage 0
104 if (stagelevel == 0 && not_present != "")
105 build_this_package = 0;
107 # Do not build packages from stages > 0 if packages
108 # from stage 0 are still missing
110 if (stagelevel == 0)
111 stage0_not_present=1;
112 if (stagelevel > 0 && stage0_not_present)
113 build_this_package = 0;
115 # Do not build packages from stages >= 2 if packages
116 # from stages <= 1 are not build already.
118 if (stagelevel <= 1)
119 stage01_not_present=1;
120 if (stagelevel >= 2 && stage01_not_present)
121 build_this_package = 0;
123 # Only ignore deps in stage 9 if everything < stage 9
124 # is already there
125 if (stagelevel < 9)
126 stage9_no_deps = "x";
128 # A packages without dependencies automatically depend
129 # on all packages build before it
130 if (found_dependencies == 0 && not_present != "" &&
131 stagelevel != stage9_no_deps)
132 build_this_package = 0;
134 # t2-debug must be build _after_ all other packages
135 if (package == "t2-debug" && not_present != "")
136 build_this_package = 0;
138 if (build_this_package) {
139 sub("^X ", priority " ", pkgline);
140 sub(" 0$", " " buildtime, pkgline);
141 print stagelevel, pkgline;
142 if (single) exit 0;
145 not_present = not_present " " package " ";
147 else
148 if (nobrokendeps) {
149 close(errfile);
150 if ((getline dummy < errfile != -1)) {
151 not_present = not_present " " package " ";
155 close(logfile); # ignore errors here if we
156 close(errfile); # did not open this files
157 close(outfile);
158 close(depfile);
161 BEGIN {
162 not_present="";
163 stage0_not_present=0;
164 stage01_not_present=0;
165 stage9_no_deps=9;
167 nobrokendeps='$nobrokendeps';
168 config="'$config'"; single='$single'; debug='$debug';
169 logdir="'"${logdir:-build/$SDECFG_ID/var/adm/logs}"'";
171 logfile_tpl = logdir "/<stagelevel>-<package>.<log>";
172 #depdb_file = "scripts/dep_db.txt";
173 packages_file = "config/" config "/packages";
175 #while ((getline depline < depdb_file) > 0)
176 # { $0 = depline; sub(/:/, "", $1); database[$1]=$0; }
177 #close(depdb_file);
179 for (stagelevel=0; stagelevel<=9; stagelevel++) {
180 while ((getline pkgline < packages_file) > 0) {
181 check_package();
183 close(packages_file);