| @@ -1,15 +1,15 @@ | | | @@ -1,15 +1,15 @@ |
1 | #!/bin/sh | | 1 | #!/bin/sh |
2 | # $NetBSD: build,v 1.105 2008/06/13 21:52:16 sketch Exp $ | | 2 | # $NetBSD: build,v 1.105.14.1 2009/07/09 20:10:39 tron Exp $ |
3 | | | 3 | |
4 | # | | 4 | # |
5 | # Copyright (c) 1999, 2000 Hubert Feyrer <hubertf@NetBSD.org> | | 5 | # Copyright (c) 1999, 2000 Hubert Feyrer <hubertf@NetBSD.org> |
6 | # All rights reserved. | | 6 | # All rights reserved. |
7 | # | | 7 | # |
8 | # Redistribution and use in source and binary forms, with or without | | 8 | # Redistribution and use in source and binary forms, with or without |
9 | # modification, are permitted provided that the following conditions | | 9 | # modification, are permitted provided that the following conditions |
10 | # are met: | | 10 | # are met: |
11 | # 1. Redistributions of source code must retain the above copyright | | 11 | # 1. Redistributions of source code must retain the above copyright |
12 | # notice, this list of conditions and the following disclaimer. | | 12 | # notice, this list of conditions and the following disclaimer. |
13 | # 2. Redistributions in binary form must reproduce the above copyright | | 13 | # 2. Redistributions in binary form must reproduce the above copyright |
14 | # notice, this list of conditions and the following disclaimer in the | | 14 | # notice, this list of conditions and the following disclaimer in the |
15 | # documentation and/or other materials provided with the distribution. | | 15 | # documentation and/or other materials provided with the distribution. |
| @@ -250,26 +250,27 @@ run_pre_build () { | | | @@ -250,26 +250,27 @@ run_pre_build () { |
250 | | | 250 | |
251 | # Load pkgsrc variables that affect the build process. | | 251 | # Load pkgsrc variables that affect the build process. |
252 | load_vars () { | | 252 | load_vars () { |
253 | echo "+----------------------------------------+" | | 253 | echo "+----------------------------------------+" |
254 | echo "| Some variables used in the bulk build: |" | | 254 | echo "| Some variables used in the bulk build: |" |
255 | echo "+----------------------------------------+" | | 255 | echo "+----------------------------------------+" |
256 | | | 256 | |
257 | vars=" OPSYS OS_VERSION MACHINE_ARCH | | 257 | vars=" OPSYS OS_VERSION MACHINE_ARCH |
258 | BULK_PREREQ | | 258 | BULK_PREREQ |
259 | BULKFILESDIR | | 259 | BULKFILESDIR |
260 | BULK_DBFILE DEPENDSFILE INDEXFILE ORDERFILE STARTFILE | | 260 | BULK_DBFILE DEPENDSFILE INDEXFILE ORDERFILE STARTFILE |
261 | SUPPORTSFILE BULK_BUILD_ID_FILE BUILDLOG BROKENFILE | | 261 | SUPPORTSFILE BULK_BUILD_ID_FILE BUILDLOG BROKENFILE |
262 | BROKENWRKLOG | | 262 | BROKENWRKLOG |
| | | 263 | PREFIX |
263 | AWK GREP MAIL_CMD MKDIR PAX PERL5 SED | | 264 | AWK GREP MAIL_CMD MKDIR PAX PERL5 SED |
264 | PKG_DELETE PKG_INFO PKGBASE" | | 265 | PKG_DELETE PKG_INFO PKGBASE" |
265 | | | 266 | |
266 | values=`cd "$lintpkgsrc_dir" && $BMAKE show-vars VARNAMES="$vars" USE_TOOLS="awk grep mail mkdir pax perl sed"` | | 267 | values=`cd "$lintpkgsrc_dir" && $BMAKE show-vars VARNAMES="$vars" USE_TOOLS="awk grep mail mkdir pax perl sed"` |
267 | | | 268 | |
268 | for v in $vars; do | | 269 | for v in $vars; do |
269 | eval "read $v" || die "Could not read value for $v" | | 270 | eval "read $v" || die "Could not read value for $v" |
270 | eval "value=\$$v" | | 271 | eval "value=\$$v" |
271 | if [ "$v" != "BULK_PREREQ" ] && [ ! "$value" ]; then | | 272 | if [ "$v" != "BULK_PREREQ" ] && [ ! "$value" ]; then |
272 | die "$v must not be empty." | | 273 | die "$v must not be empty." |
273 | fi | | 274 | fi |
274 | printf "%-15s = %s\\n" "$v" "$value" | | 275 | printf "%-15s = %s\\n" "$v" "$value" |
275 | done <<EOF | | 276 | done <<EOF |
| @@ -323,32 +324,42 @@ do_real_bulk_build () { | | | @@ -323,32 +324,42 @@ do_real_bulk_build () { |
323 | do | | 324 | do |
324 | if ${GREP} -q "^${pkgdir}\$" "${main_buildlog}"; then | | 325 | if ${GREP} -q "^${pkgdir}\$" "${main_buildlog}"; then |
325 | : "skip this package" | | 326 | : "skip this package" |
326 | else | | 327 | else |
327 | percent=`${AWK} -v tot="${tot}" ' | | 328 | percent=`${AWK} -v tot="${tot}" ' |
328 | END { | | 329 | END { |
329 | printf("%d/%d=%4.1f%%", NR, tot, NR*100/tot); | | 330 | printf("%d/%d=%4.1f%%", NR, tot, NR*100/tot); |
330 | }' "${main_buildlog}"` | | 331 | }' "${main_buildlog}"` |
331 | ( cd "${pkgsrc_dir}/${pkgdir}" \ | | 332 | ( cd "${pkgsrc_dir}/${pkgdir}" \ |
332 | && ${NICE_LEVEL} ${BMAKE} USE_BULK_CACHE=yes "${target}" \ | | 333 | && ${NICE_LEVEL} ${BMAKE} USE_BULK_CACHE=yes "${target}" \ |
333 | $makeargs </dev/null | post_filter_cmd | | 334 | $makeargs </dev/null | post_filter_cmd |
334 | ) || true | | 335 | ) || true |
335 | echo "$pkgdir" >> "${main_buildlog}" | | 336 | echo "$pkgdir" >> "${main_buildlog}" |
| | | 337 | check_pkg_dirs |
336 | fi | | 338 | fi |
337 | done | | 339 | done |
338 | | | 340 | |
339 | echo "build> Build finished." | | 341 | echo "build> Build finished." |
340 | } | | 342 | } |
341 | | | 343 | |
| | | 344 | check_pkg_dirs () { |
| | | 345 | for d in bin etc include info lib libexec man sbin share; do |
| | | 346 | if [ -f $PREFIX/$d ]; then |
| | | 347 | echo "Removing file, should be dir: $PREFIX/$d" >&2 |
| | | 348 | rm -f $PREFIX/$d |
| | | 349 | fi |
| | | 350 | done |
| | | 351 | } |
| | | 352 | |
342 | # clean up installed packages left over | | 353 | # clean up installed packages left over |
343 | do_bulk_cleanup () { | | 354 | do_bulk_cleanup () { |
344 | | | 355 | |
345 | echo "build> Removing all installed packages left over from build..." | | 356 | echo "build> Removing all installed packages left over from build..." |
346 | for pkgname in `${PKG_INFO} -e \*` | | 357 | for pkgname in `${PKG_INFO} -e \*` |
347 | do | | 358 | do |
348 | if ${PKG_INFO} -qe "${pkgname}"; then | | 359 | if ${PKG_INFO} -qe "${pkgname}"; then |
349 | pkgdir=`${AWK} '$2 == "'"$pkgname"'" { print $1; }' "$INDEXFILE"` | | 360 | pkgdir=`${AWK} '$2 == "'"$pkgname"'" { print $1; }' "$INDEXFILE"` |
350 | case "${BULK_PREREQ}" in | | 361 | case "${BULK_PREREQ}" in |
351 | *"${pkgdir}"* ) | | 362 | *"${pkgdir}"* ) |
352 | echo "build> Keeping BULK_PREREQ: $pkgname ($pkgdir)" ; | | 363 | echo "build> Keeping BULK_PREREQ: $pkgname ($pkgdir)" ; |
353 | ;; | | 364 | ;; |
354 | * ) | | 365 | * ) |