mirror of the now-defunct rocklinux.org
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

197 lines
5.1 KiB

  1. #!/bin/bash
  2. #
  3. # --- ROCK-COPYRIGHT-NOTE-BEGIN ---
  4. #
  5. # This copyright note is auto-generated by ./scripts/Create-CopyPatch.
  6. # Please add additional copyright information _after_ the line containing
  7. # the ROCK-COPYRIGHT-NOTE-END tag. Otherwise it might get removed by
  8. # the ./scripts/Create-CopyPatch script. Do not edit this copyright text!
  9. #
  10. # ROCK Linux: rock-src/scripts/Create-PkgQueue
  11. # ROCK Linux is Copyright (C) 1998 - 2003 Clifford Wolf
  12. #
  13. # This program is free software; you can redistribute it and/or modify
  14. # it under the terms of the GNU General Public License as published by
  15. # the Free Software Foundation; either version 2 of the License, or
  16. # (at your option) any later version. A copy of the GNU General Public
  17. # License can be found at Documentation/COPYING.
  18. #
  19. # Many people helped and are helping developing ROCK Linux. Please
  20. # have a look at http://www.rocklinux.org/ and the Documentation/TEAM
  21. # file for details.
  22. #
  23. # --- ROCK-COPYRIGHT-NOTE-END ---
  24. config=default
  25. logdir=""
  26. single=0
  27. debug=0
  28. nobrokendeps=0
  29. while [ "$1" ] ; do
  30. case "$1" in
  31. -cfg)
  32. config=$2 ; shift ; shift ;;
  33. -single)
  34. single=1 ; shift ;;
  35. -logdir)
  36. logdir=$2 ; shift ; shift ;;
  37. -debug)
  38. debug=1 ; shift ;;
  39. -nobrokendeps)
  40. nobrokendeps=1 ; shift ;;
  41. *)
  42. echo "Usage: $0 [ -cfg config ] [ -single ] \\"
  43. echo " ${0//?/ } [ -logdir logdir ] [ -debug ]"
  44. exit 1 ;;
  45. esac
  46. done
  47. . ./scripts/parse-config
  48. gawk '
  49. function check_package() {
  50. split(pkgline, a); dep=a[2];
  51. if ( a[1] != "X" || ! index(a[2], stagelevel) ) return;
  52. repository = a[4];
  53. package = a[5];
  54. logfile = logfile_tpl;
  55. gsub("<stagelevel>", stagelevel, logfile);
  56. gsub("<repository>", repository, logfile);
  57. gsub("<package>", package, logfile);
  58. errfile = logfile; outfile = logfile;
  59. gsub("<log>", "log", logfile);
  60. gsub("<log>", "err", errfile);
  61. gsub("<log>", "out", outfile);
  62. if ( (getline dummy < logfile == -1) &&
  63. (getline dummy < errfile == -1) ) {
  64. build_this_package = 1;
  65. found_dependencies = 0;
  66. buildtime = 60;
  67. priority = 0;
  68. if ( getline dummy < outfile != -1 )
  69. build_this_package = 0;
  70. if ( index(not_present, " " package " ") ) {
  71. if (debug && build_this_package)
  72. print "DEBUG: Not building " stagelevel "-" \
  73. package ": earlier stages not done " \
  74. "for this package."
  75. build_this_package = 0;
  76. }
  77. if ( build_this_package && (package in database) ) {
  78. split(database[package], a);
  79. buildtime = a[2];
  80. priority = a[3];
  81. for (c in a) {
  82. # if ( a[c] == package ) continue;
  83. # if ( strtonum(c) <= 3 ) continue;
  84. if (debug && 0)
  85. print "DEBUG: Checking " stagelevel \
  86. "-" package ": needs " a[c];
  87. if ( index(not_present, " " a[c] " ") &&
  88. stagelevel != stage9_no_deps ) {
  89. if (debug && build_this_package)
  90. print "DEBUG: Not building " \
  91. stagelevel "-" package \
  92. ": " a[c] " is missing";
  93. build_this_package=0;
  94. }
  95. found_dependencies = 1;
  96. }
  97. }
  98. # Do not build packages parallel in stage 0
  99. #
  100. if ( stagelevel == 0 && not_present != "")
  101. build_this_package = 0;
  102. # Do not build packages from stages > 0 if packages
  103. # from stage 0 are still missing
  104. #
  105. if ( stagelevel == 0 )
  106. stage0_not_present=1;
  107. if ( stagelevel > 0 && stage0_not_present )
  108. build_this_package = 0;
  109. # Do not build packages from stages >= 2 if packages
  110. # from stages <= 1 are not build already.
  111. #
  112. if ( stagelevel <= 1 )
  113. stage01_not_present=1;
  114. if ( stagelevel >= 2 && stage01_not_present )
  115. build_this_package = 0;
  116. # Only ignore deps in stage 9 if everything < stage 9
  117. # is already there
  118. if ( stagelevel < 9 )
  119. stage9_no_deps = "x";
  120. # A packages without dependencies automatically depend
  121. # on all packages build before it
  122. if (found_dependencies == 0 && not_present != "" &&
  123. stagelevel != stage9_no_deps)
  124. build_this_package = 0;
  125. # rock-debug must be build _after_ all other packages
  126. if (package == "rock-debug" && not_present != "")
  127. build_this_package = 0;
  128. if (build_this_package) {
  129. sub("^X ", priority " ", pkgline);
  130. sub(" 0$", " " buildtime, pkgline);
  131. print stagelevel, pkgline;
  132. if (single) exit 0;
  133. }
  134. not_present = not_present " " package " ";
  135. }
  136. else
  137. if ( nobrokendeps )
  138. {
  139. close(errfile);
  140. if ( (getline dummy < errfile != -1) ) {
  141. not_present = not_present " " package " ";
  142. }
  143. }
  144. close(logfile); # ignore errors here if we
  145. close(errfile); # did not open this files
  146. close(outfile);
  147. close(depfile);
  148. }
  149. BEGIN {
  150. not_present="";
  151. stage0_not_present=0;
  152. stage01_not_present=0;
  153. stage9_no_deps=9;
  154. nobrokendeps='$nobrokendeps';
  155. config="'$config'"; single='$single'; debug='$debug';
  156. logdir="'"${logdir:-build/$ROCKCFG_ID/root/var/adm/logs}"'";
  157. logfile_tpl = logdir "/<stagelevel>-<package>.<log>";
  158. depdb_file = "scripts/dep_db.txt";
  159. packages_file = "config/" config "/packages";
  160. while ( (getline depline < depdb_file) > 0 )
  161. { $0 = depline; sub(/:/, "", $1); database[$1]=$0; }
  162. close(depdb_file);
  163. for (stagelevel=0; stagelevel<=9; stagelevel++) {
  164. while ( (getline pkgline < packages_file) > 0 ) {
  165. check_package();
  166. }
  167. close(packages_file);
  168. }
  169. }
  170. '