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.

200 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. xpackage = a[5];
  55. gsub(".*=", "", xpackage);
  56. logfile = logfile_tpl;
  57. gsub("<stagelevel>", stagelevel, logfile);
  58. gsub("<repository>", repository, logfile);
  59. gsub("<package>", xpackage, logfile);
  60. errfile = logfile; outfile = logfile;
  61. gsub("<log>", "log", logfile);
  62. gsub("<log>", "err", errfile);
  63. 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;
  70. if ( getline dummy < outfile != -1 )
  71. build_this_package = 0;
  72. if ( index(not_present, " " package " ") ) {
  73. if (debug && build_this_package)
  74. print "DEBUG: Not building " stagelevel "-" \
  75. package ": earlier stages not done " \
  76. "for this package."
  77. build_this_package = 0;
  78. }
  79. if ( build_this_package && (package in database) ) {
  80. split(database[package], a);
  81. buildtime = a[2];
  82. priority = a[3];
  83. for (c in a) {
  84. # if ( a[c] == package ) continue;
  85. # if ( strtonum(c) <= 3 ) continue;
  86. if (debug && 0)
  87. print "DEBUG: Checking " stagelevel \
  88. "-" package ": needs " a[c];
  89. if ( index(not_present, " " a[c] " ") &&
  90. stagelevel != stage9_no_deps ) {
  91. if (debug && build_this_package)
  92. print "DEBUG: Not building " \
  93. stagelevel "-" package \
  94. ": " a[c] " is missing";
  95. build_this_package=0;
  96. }
  97. found_dependencies = 1;
  98. }
  99. }
  100. # Do not build packages parallel in stage 0
  101. #
  102. if ( stagelevel == 0 && not_present != "")
  103. build_this_package = 0;
  104. # Do not build packages from stages > 0 if packages
  105. # from stage 0 are still missing
  106. #
  107. if ( stagelevel == 0 )
  108. stage0_not_present=1;
  109. if ( stagelevel > 0 && stage0_not_present )
  110. build_this_package = 0;
  111. # Do not build packages from stages >= 2 if packages
  112. # from stages <= 1 are not build already.
  113. #
  114. if ( stagelevel <= 1 )
  115. stage01_not_present=1;
  116. if ( stagelevel >= 2 && stage01_not_present )
  117. build_this_package = 0;
  118. # Only ignore deps in stage 9 if everything < stage 9
  119. # is already there
  120. if ( stagelevel < 9 )
  121. stage9_no_deps = "x";
  122. # A packages without dependencies automatically depend
  123. # on all packages build before it
  124. if (found_dependencies == 0 && not_present != "" &&
  125. stagelevel != stage9_no_deps)
  126. build_this_package = 0;
  127. # rock-debug must be build _after_ all other packages
  128. if (package == "rock-debug" && not_present != "")
  129. build_this_package = 0;
  130. if (build_this_package) {
  131. sub("^X ", priority " ", pkgline);
  132. sub(" 0$", " " buildtime, pkgline);
  133. print stagelevel, pkgline;
  134. if (single) exit 0;
  135. }
  136. not_present = not_present " " package " ";
  137. }
  138. else
  139. if ( nobrokendeps )
  140. {
  141. close(errfile);
  142. if ( (getline dummy < errfile != -1) ) {
  143. not_present = not_present " " package " ";
  144. }
  145. }
  146. close(logfile); # ignore errors here if we
  147. close(errfile); # did not open this files
  148. close(outfile);
  149. close(depfile);
  150. }
  151. BEGIN {
  152. not_present="";
  153. stage0_not_present=0;
  154. stage01_not_present=0;
  155. stage9_no_deps=9;
  156. nobrokendeps='$nobrokendeps';
  157. config="'$config'"; single='$single'; debug='$debug';
  158. logdir="'"${logdir:-build/$ROCKCFG_ID/var/adm/logs}"'";
  159. logfile_tpl = logdir "/<stagelevel>-<package>.<log>";
  160. depdb_file = "scripts/dep_db.txt";
  161. packages_file = "config/" config "/packages";
  162. while ( (getline depline < depdb_file) > 0 )
  163. { $0 = depline; sub(/:/, "", $1); database[$1]=$0; }
  164. close(depdb_file);
  165. for (stagelevel=0; stagelevel<=9; stagelevel++) {
  166. while ( (getline pkgline < packages_file) > 0 ) {
  167. check_package();
  168. }
  169. close(packages_file);
  170. }
  171. }
  172. '