#!/bin/bash # # --- ROCK-COPYRIGHT-NOTE-BEGIN --- # # This copyright note is auto-generated by ./scripts/Create-CopyPatch. # Please add additional copyright information _after_ the line containing # the ROCK-COPYRIGHT-NOTE-END tag. Otherwise it might get removed by # the ./scripts/Create-CopyPatch script. Do not edit this copyright text! # # ROCK Linux: rock-src/scripts/Create-PkgQueue # ROCK Linux is Copyright (C) 1998 - 2006 Clifford Wolf # # 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; either version 2 of the License, or # (at your option) any later version. A copy of the GNU General Public # License can be found at Documentation/COPYING. # # Many people helped and are helping developing ROCK Linux. Please # have a look at https://www.rocklinux.org/ and the Documentation/TEAM # file for details. # # --- ROCK-COPYRIGHT-NOTE-END --- config=default logdir="" single=0 debug=0 stages=0123456789 nobrokendeps=0 while [ "$1" ] ; do case "$1" in -cfg) config=$2 ; shift ; shift ;; -stages) stages=$2 ; shift ; shift ;; -single) single=1 ; shift ;; -logdir) logdir=$2 ; shift ; shift ;; -debug) debug=1 ; shift ;; -nobrokendeps) nobrokendeps=1 ; shift ;; *) echo "Usage: $0 [ -cfg config ] [ -stages ] [ -single ] \\" echo " ${0//?/ } [ -logdir ] [ -debug ]" exit 1 ;; esac done . ./scripts/parse-config gawk ' function check_package() { split(pkgline, a); dep=a[2]; if ( a[1] != "X" || !index(a[2], stagelevel) ) return; repository = a[4]; package = a[5]; xpackage = a[5]; gsub(".*=", "", xpackage); logfile = logfile_tpl; gsub("", stagelevel, logfile); gsub("", repository, logfile); gsub("", xpackage, logfile); errfile = logfile; outfile = logfile; gsub("", "log", logfile); gsub("", "err", errfile); gsub("", "out", outfile); if ( (getline dummy < logfile == -1) && (getline dummy < errfile == -1) ) { build_this_package = 1; found_dependencies = 0; buildtime = 60; priority = 0; if ( getline dummy < outfile != -1 ) build_this_package = 0; if ( index(not_present, " " xpackage " ") ) { if (debug && build_this_package) print "DEBUG: Not building " stagelevel "-" \ package ": earlier stages not done " \ "for this package." build_this_package = 0; } if ( build_this_package && (xpackage in database) ) { split(database[xpackage], a); buildtime = a[2]; priority = a[3]; for (c in a) { # if ( a[c] == xpackage ) continue; # if ( strtonum(c) <= 3 ) continue; if (debug && 0) print "DEBUG: Checking " stagelevel \ "-" package ": needs " a[c]; if ( index(not_present, " " a[c] " ") && stagelevel != stage9_no_deps ) { if (debug && build_this_package) print "DEBUG: Not building " \ stagelevel "-" package \ ": " a[c] " is missing"; build_this_package=0; } found_dependencies = 1; } } # Do not build packages parallel in stage 0 # if ( stagelevel == 0 && not_present != "") build_this_package = 0; # Do not build packages from stages > 0 if packages # from stage 0 are still missing # if ( stagelevel == 0 ) stage0_not_present=1; if ( stagelevel > 0 && stage0_not_present ) build_this_package = 0; # Do not build packages from stages >= 2 if packages # from stages <= 1 are not build already. # if ( stagelevel <= 1 ) stage01_not_present=1; if ( stagelevel >= 2 && stage01_not_present ) build_this_package = 0; # Only ignore deps in stage 9 if everything < stage 9 # is already there if ( stagelevel < 9 ) stage9_no_deps = "x"; # Packages without dependencies automatically depend # on all packages build before it if (found_dependencies == 0 && not_present != "" && stagelevel != stage9_no_deps) build_this_package = 0; # rock-debug must be build _after_ all other packages if (package == "rock-debug" && not_present != "") build_this_package = 0; if (build_this_package) { sub("^X ", priority " ", pkgline); sub(" 0$", " " buildtime, pkgline); print stagelevel, pkgline; if (single) exit 0; } not_present = not_present " " xpackage " "; } else if ( nobrokendeps ) { close(errfile); if ( (getline dummy < errfile != -1) ) { not_present = not_present " " xpackage " "; } } close(logfile); # ignore errors here if we close(errfile); # did not open this files close(outfile); close(depfile); } BEGIN { not_present=""; stage0_not_present=0; stage01_not_present=0; stage9_no_deps=9; nobrokendeps='$nobrokendeps'; stages="'$stages'"; config="'$config'"; single='$single'; debug='$debug'; logdir="'"${logdir:-build/$ROCKCFG_ID/var/adm/logs}"'"; logfile_tpl = logdir "/-."; depdb_file = "scripts/dep_db.txt"; packages_file = "config/" config "/packages"; while ( (getline depline < depdb_file) > 0 ) { $0 = depline; sub(/:/, "", $1); database[$1]=$0; } close(depdb_file); for (stagelevel=0; stagelevel<=9; stagelevel++) { if ( !index(stages, stagelevel) ) continue; while ( (getline pkgline < packages_file) > 0 ) { check_package(); } close(packages_file); } } '