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.

184 lines
4.8 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. while [ "$1" ] ; do
  29. case "$1" in
  30. -cfg)
  31. config=$2 ; shift ; shift ;;
  32. -single)
  33. single=1 ; shift ;;
  34. -logdir)
  35. logdir=$2 ; shift ; shift ;;
  36. -debug)
  37. debug=1 ; shift ;;
  38. *)
  39. echo "Usage: $0 [ -cfg config ] [ -single ] \\"
  40. echo " ${0//?/ } [ -logdir logdir ] [ -debug ]"
  41. exit 1 ;;
  42. esac
  43. done
  44. . ./scripts/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;
  49. repository = a[4];
  50. package = a[5];
  51. logfile = logfile_tpl;
  52. gsub("<stagelevel>", stagelevel, logfile);
  53. gsub("<repository>", repository, logfile);
  54. gsub("<package>", package, logfile);
  55. errfile = logfile; outfile = logfile;
  56. gsub("<log>", "log", logfile);
  57. gsub("<log>", "err", errfile);
  58. gsub("<log>", "out", outfile);
  59. if ( (getline dummy < logfile == -1) &&
  60. (getline dummy < errfile == -1) ) {
  61. build_this_package = 1;
  62. found_dependencies = 0;
  63. buildtime = 60;
  64. priority = 0;
  65. if ( getline dummy < outfile != -1 )
  66. build_this_package = 0;
  67. if ( index(not_present, " " package " ") ) {
  68. if (debug && build_this_package)
  69. print "DEBUG: Not building " stagelevel "-" \
  70. package ": earlier stages not done " \
  71. "for this package."
  72. build_this_package = 0;
  73. }
  74. if ( build_this_package && (package in database) ) {
  75. split(database[package], a);
  76. buildtime = a[2];
  77. priority = a[3];
  78. for (c in a) {
  79. # if ( a[c] == package ) continue;
  80. # if ( strtonum(c) <= 3 ) continue;
  81. if (debug && 0)
  82. print "DEBUG: Checking " stagelevel \
  83. "-" package ": needs " a[c];
  84. if ( index(not_present, " " a[c] " ") &&
  85. stagelevel != stage9_no_deps ) {
  86. if (debug && build_this_package)
  87. print "DEBUG: Not building " \
  88. stagelevel "-" package \
  89. ": " a[c] " is missing";
  90. build_this_package=0;
  91. }
  92. found_dependencies = 1;
  93. }
  94. }
  95. # Do not build packages parallel in stage 0
  96. #
  97. if ( stagelevel == 0 && not_present != "")
  98. build_this_package = 0;
  99. # Do not build packages from stages > 0 if packages
  100. # from stage 0 are still missing
  101. #
  102. if ( stagelevel == 0 )
  103. stage0_not_present=1;
  104. if ( stagelevel > 0 && stage0_not_present )
  105. build_this_package = 0;
  106. # Do not build packages from stages >= 2 if packages
  107. # from stages <= 1 are not build already.
  108. #
  109. if ( stagelevel <= 1 )
  110. stage01_not_present=1;
  111. if ( stagelevel >= 2 && stage01_not_present )
  112. build_this_package = 0;
  113. # Only ignore deps in stage 9 if everything < stage 9
  114. # is already there
  115. if ( stagelevel < 9 )
  116. stage9_no_deps = "x";
  117. # A packages without dependencies automatically depend
  118. # on all packages build before it
  119. if (found_dependencies == 0 && not_present != "" &&
  120. stagelevel != stage9_no_deps)
  121. build_this_package = 0;
  122. # rock-debug must be build _after_ all other packages
  123. if (package == "rock-debug" && not_present != "")
  124. build_this_package = 0;
  125. if (build_this_package) {
  126. sub("^X ", priority " ", pkgline);
  127. sub(" 0$", " " buildtime, pkgline);
  128. print stagelevel, pkgline;
  129. if (single) exit 0;
  130. }
  131. not_present = not_present " " package " ";
  132. }
  133. close(logfile); # ignore errors here if we
  134. close(errfile); # did not open this files
  135. close(outfile);
  136. close(depfile);
  137. }
  138. BEGIN {
  139. not_present="";
  140. stage0_not_present=0;
  141. stage01_not_present=0;
  142. stage9_no_deps=9;
  143. config="'$config'"; single='$single'; debug='$debug';
  144. logdir="'"${logdir:-build/$ROCKCFG_ID/root/var/adm/logs}"'";
  145. logfile_tpl = logdir "/<stagelevel>-<package>.<log>";
  146. depdb_file = "scripts/dep_db.txt";
  147. packages_file = "config/" config "/packages";
  148. while ( (getline depline < depdb_file) > 0 )
  149. { $0 = depline; sub(/:/, "", $1); database[$1]=$0; }
  150. close(depdb_file);
  151. for (stagelevel=0; stagelevel<=9; stagelevel++) {
  152. while ( (getline pkgline < packages_file) > 0 ) {
  153. check_package();
  154. }
  155. close(packages_file);
  156. }
  157. }
  158. '