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
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 ---
24 config
=$2; shift; shift ;;
28 logdir
=$2; shift; shift ;;
32 nobrokendeps
=1; shift ;;
34 echo "Usage: $0 [ -cfg config ] [ -single ] \\"
35 echo " ${0//?/ } [ -logdir logdir ] [ -debug ]"
40 .
scripts
/parse-config
43 function check_package() {
44 split(pkgline, a); dep=a[2];
45 if (a[1] != "X" || ! index(a[2], stagelevel)) return;
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;
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 " \
76 build_this_package = 0;
79 if (build_this_package && (package in database)) {
80 split(database[package], a);
85 # if (a[c] == package) continue;
86 # if (strtonum(c) <= 3) continue;
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";
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
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.
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
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;
145 not_present = not_present " " package " ";
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
163 stage0_not_present=0;
164 stage01_not_present=0;
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; }
179 for (stagelevel=0; stagelevel<=9; stagelevel++) {
180 while ((getline pkgline < packages_file) > 0) {
183 close(packages_file);