early: fixed modprobe
[opensde-nopast.git] / scripts / Create-PkgQueue
blob6cacdbe5b9a067ae7c44971fbd7949a6bb7304ed
1 #!/bin/bash
2 # --- SDE-COPYRIGHT-NOTE-BEGIN ---
3 # This copyright note is auto-generated by ./scripts/Create-CopyPatch.
5 # Filename: scripts/Create-PkgQueue
6 # Copyright (C) 2006 - 2008 The OpenSDE Project
7 # Copyright (C) 2004 - 2006 The T2 SDE Project
8 # Copyright (C) 1998 - 2003 Clifford Wolf
10 # More information can be found in the files COPYING and README.
12 # This program is free software; you can redistribute it and/or modify
13 # it under the terms of the GNU General Public License as published by
14 # the Free Software Foundation; version 2 of the License. A copy of the
15 # GNU General Public License can be found in the file COPYING.
16 # --- SDE-COPYRIGHT-NOTE-END ---
18 config=default
19 logdir=
20 single=0
21 debug=0
22 nobrokendeps=0
24 while [ "$1" ] ; do
25 case "$1" in
26 -cfg)
27 config=$2 ; shift ; shift ;;
28 -single)
29 single=1 ; shift ;;
30 -logdir)
31 logdir=$2 ; shift ; shift ;;
32 -debug)
33 debug=1 ; shift ;;
34 -nobrokendeps)
35 nobrokendeps=1 ; shift ;;
37 echo "Usage: $0 [ -cfg config ] [ -single ] \\"
38 echo " ${0//?/ } [ -logdir logdir ] [ -debug ]"
39 exit 1 ;;
40 esac
41 done
43 . ./lib/parse-config
45 gawk '
46 function check_package() {
47 split(pkgline, a); dep=a[2];
48 if ( a[1] != "X" || ! index(a[2], stagelevel) ) return;
50 repository = a[4];
51 package = a[5];
53 logfile = logfile_tpl;
54 gsub("<stagelevel>", stagelevel, logfile);
55 gsub("<repository>", repository, logfile);
56 gsub("<package>", package, logfile);
58 errfile = logfile; outfile = logfile;
59 gsub("<log>", "log", logfile);
60 gsub("<log>", "err", errfile);
61 gsub("<log>", "out", outfile);
64 if ( (getline dummy < logfile == -1) &&
65 (getline dummy < errfile == -1) ) {
66 build_this_package = 1;
67 found_dependencies = 0;
68 buildtime = 60;
69 priority = 0;
71 if ( getline dummy < outfile != -1 )
72 build_this_package = 0;
74 if ( index(not_present, " " package " ") ) {
75 if (debug && build_this_package)
76 print "DEBUG: Not building " stagelevel "-" \
77 package ": earlier stages not done " \
78 "for this package."
79 build_this_package = 0;
82 if ( build_this_package && (package in database) ) {
83 split(database[package], a);
84 buildtime = a[2];
85 priority = a[3];
87 for (c in a) {
88 # if ( a[c] == package ) continue;
89 # if ( strtonum(c) <= 3 ) continue;
90 if (debug && 0)
91 print "DEBUG: Checking " stagelevel \
92 "-" package ": needs " a[c];
93 if ( index(not_present, " " a[c] " ") &&
94 stagelevel != stage9_no_deps ) {
95 if (debug && build_this_package)
96 print "DEBUG: Not building " \
97 stagelevel "-" package \
98 ": " a[c] " is missing";
99 build_this_package=0;
101 found_dependencies = 1;
105 # Do not build packages parallel in stage 0
107 if ( stagelevel == 0 && not_present != "")
108 build_this_package = 0;
110 # Do not build packages from stages > 0 if packages
111 # from stage 0 are still missing
113 if ( stagelevel == 0 )
114 stage0_not_present=1;
115 if ( stagelevel > 0 && stage0_not_present )
116 build_this_package = 0;
118 # Do not build packages from stages >= 2 if packages
119 # from stages <= 1 are not build already.
121 if ( stagelevel <= 1 )
122 stage01_not_present=1;
123 if ( stagelevel >= 2 && stage01_not_present )
124 build_this_package = 0;
126 # Only ignore deps in stage 9 if everything < stage 9
127 # is already there
128 if ( stagelevel < 9 )
129 stage9_no_deps = "x";
131 # A packages without dependencies automatically depend
132 # on all packages build before it
133 if (found_dependencies == 0 && not_present != "" &&
134 stagelevel != stage9_no_deps)
135 build_this_package = 0;
137 # sde-debug must be build _after_ all other packages
138 if (package == "sde-debug" && not_present != "")
139 build_this_package = 0;
141 if (build_this_package) {
142 sub("^X ", priority " ", pkgline);
143 sub(" 0$", " " buildtime, pkgline);
144 print stagelevel, pkgline;
145 if (single) exit 0;
148 not_present = not_present " " package " ";
150 else
151 if ( nobrokendeps )
153 close(errfile);
154 if ( (getline dummy < errfile != -1) ) {
155 not_present = not_present " " package " ";
159 close(logfile); # ignore errors here if we
160 close(errfile); # did not open this files
161 close(outfile);
162 close(depfile);
165 BEGIN {
166 not_present="";
167 stage0_not_present=0;
168 stage01_not_present=0;
169 stage9_no_deps=9;
171 nobrokendeps='$nobrokendeps';
172 config="'$config'"; single='$single'; debug='$debug';
173 logdir="'"${logdir:-build/$SDECFG_ID/var/adm/logs}"'";
175 logfile_tpl = logdir "/<stagelevel>-<package>.<log>";
176 #depdb_file = "scripts/dep_db.txt";
177 packages_file = "config/" config "/packages";
179 #while ( (getline depline < depdb_file) > 0 )
180 # { $0 = depline; sub(/:/, "", $1); database[$1]=$0; }
181 #close(depdb_file);
183 for (stagelevel=0; stagelevel<=9; stagelevel++) {
184 while ( (getline pkgline < packages_file) > 0 ) {
185 check_package();
187 close(packages_file);