Annotation of pkgsrc/pkgtools/pkg_rolling-replace/files/pkg_rolling-replace.sh, revision 1.26
1.1 gdt 1: #!/bin/sh
2:
1.26 ! tnn 3: # $NetBSD: pkg_rolling-replace.sh,v 1.25 2010/02/01 19:06:43 sno Exp $
1.1 gdt 4: #<license>
5: # Copyright (c) 2006 BBN Technologies Corp. All rights reserved.
6: #
7: # Redistribution and use in source and binary forms, with or without
8: # modification, are permitted provided that the following conditions
9: # are met:
10: # 1. Redistributions of source code must retain the above copyright
11: # notice, this list of conditions and the following disclaimer.
12: # 2. Redistributions in binary form must reproduce the above copyright
13: # notice, this list of conditions and the following disclaimer in the
14: # documentation and/or other materials provided with the distribution.
15: # 3. Neither the name of BBN Technologies nor the names of its contributors
16: # may be used to endorse or promote products derived from this software
17: # without specific prior written permission.
18: #
19: # THIS SOFTWARE IS PROVIDED BY BBN TECHNOLOGIES AND CONTRIBUTORS ``AS IS''
20: # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21: # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22: # ARE DISCLAIMED. IN NO EVENT SHALL BBN TECHNOLOGIES OR CONTRIBUTORS BE
23: # LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24: # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25: # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26: # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27: # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28: # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29: # POSSIBILITY OF SUCH DAMAGE.
30: #
31: # Effort sponsored in part by the Defense Advanced Research Projects
32: # Agency (DARPA) and the Department of the Interior National Business
33: # Center under agreement number NBCHC050166.
34: #</license>
35:
36: # REVIEW NOTATION LEGEND
37: # XXX marks things that are broken/kludgy
38: # TODO marks things that need to be done
39: # FIXED marks items fixed, needs review and deletion of FIXED comment
40:
41: # Items to be completed for initial release:
42:
43: # TODO: move bulk of help into a real man page.
44:
45: # Items for future work (some imply changes in pkgsrc, not necessarily here)
46: #
47: # Make a pass over all packages for build depends, and rememeber
48: # which packages have been so checked. Check newly unsafe packages.
49: # The current lazy evaluation can perhaps fail to do things in the
50: # right order. Alternatively, explain why the current scheme is safe
51: # and preferred.
52: #
53: # Consider expansion to update via binary packages. This raises
54: # interesting questions about ABIs and binary builds
55: #
56: # Deal with conflicts in a smarter way, perhaps more automatically.
57: # This is hard because just removing packages is not ok.
58: #
59: # Handle foo being split into foo and foo-share. Now, make replace
60: # of foo pulls in foo-share which conflicts with foo. This needlessly
61: # loses.
62: #
63:
1.3 tnn 64: # Substituted by pkgsrc at pre-configure time.
1.4 tnn 65: MAKE="@MAKE@"
1.15 tnn 66: AWK="@AWK@"
1.3 tnn 67:
1.19 apb 68: if [ -z "$MAKECONF" ] ; then
69: for mkconf in "@MAKECONF@" "@PREFIX@/etc/mk.conf" /etc/mk.conf ; do
70: if [ -f "$mkconf" ] ; then
71: MAKECONF="$mkconf"
72: break
73: fi
74: done
75: fi
76: if [ -z "$MAKECONF" -o ! -f "$MAKECONF" ] ; then
77: MAKECONF=/dev/null
78: fi
1.7 tnn 79: test -f "$MAKECONF" && test -z "$PKGSRCDIR" && PKGSRCDIR="` \
80: printf '.include "%s"\n_print_pkgsrcdir:\n\t@echo "${PKGSRCDIR}"\n' \
1.8 tnn 81: "$MAKECONF" | "$MAKE" -f - BSD_PKG_MK=1 _print_pkgsrcdir`"
1.19 apb 82: if [ -z "$PKGSRCDIR" ] ; then
83: for dir in . .. ../.. /usr/pkgsrc ; do
84: if [ -f "${dir}/mk/bsd.pkg.mk" ]; then
85: case "${dir}" in
86: /*) PKGSRCDIR="${dir}" ;;
87: *) PKGSRCDIR="$( cd "${dir}" >/dev/null 2>&1 && pwd )" ;;
88: esac
89: break
90: fi
91: done
92: fi
93: test -z "$PKGSRCDIR" && echo >&2 "Please set PKGSRCDIR" && exit 1
1.12 tnn 94: test -z "$PKG_CHK" && PKG_CHK="@PKG_CHK@"
95: test -z "$PKG_INFO" && PKG_INFO="@PKG_INFO_CMD@"
1.1 gdt 96:
1.19 apb 97: export PKGSRCDIR
98:
1.1 gdt 99: unset PKG_PATH || true #or pkgsrc makefiles will complain
100:
101: usage()
102: {
103: echo "Usage: pkg_rolling-replace [opts]
104: -h This help
1.22 sno 105: -F Fetch sources (including depends) only, don't build
106: -k Keep running, even on error
1.1 gdt 107: -n Don't actually do make replace
1.13 tnn 108: -r Just replace, don't create binary packages
109: -s Replace even if the ABIs are still compatible ("strict")
1.17 apb 110: -u Update outdated packages
1.1 gdt 111: -v Verbose
1.25 sno 112: -D VAR=VAL Passes given variables and values to make
1.22 sno 113: -L <path> Log to path (<path>/pkgdir/pkg)
1.20 wiz 114: -X <pkg> exclude <pkg> from being rebuilt
1.17 apb 115: -x <pkg> exclude <pkg> from outdated check
1.1 gdt 116:
117: pkg_rolling-replace does 'make replace' on one package at a time,
118: tsorting the packages being replaced according to their
119: interdependencies, which avoids most duplicate rebuilds.
120:
121: pkg_rolling-replace can be used in one of two ways:
122:
123: - 'make replace' is unsafe in that, if the replaced package's ABI
124: changes, its dependent packages may break. If this happens, run
125: 'pkg_rolling-replace' (no arguments) to rebuild them against the
126: new version.
127:
128: - 'pkg_chk -u' will delete all your mismatched (outdated)
129: packages, then reinstall them one at a time, leaving you without
130: those packages in the meantime. 'pkg_rolling-replace -u' will
131: instead upgrade them in place, allowing you to keep using your
132: system in the meantime (maybe...if you're lucky...because
133: pkg_rolling-replace replaces the \"deepest\" dependency first,
134: things could still break if that happens to be a fundamental
135: library whose ABI has changed).
136: "
137: exit 1
138: }
139:
140: # pkg_rolling-replace's output is intermingled with pkgsrc make
141: # output. Thus, we use a different prefix. pkgsrc uses '===>' for
142: # major steps, and '=>' for minor ones. Thus, we use 'RR>'.
143:
144: OPI='RR>'
145: OPC='rr>' # continuation
146:
147:
148: # Echo the names of packages needing updates, versions stripped. This
149: # has been tested with pkg_chk 1.76. Older versions are not
150: # supported. Newer versions may or may not work (patches welcome).
151: check_packages_mismatched()
152: {
1.12 tnn 153: ${PKG_CHK} -u -q | while read line; do
1.1 gdt 154: # duplicate output of pkg_chk to stderr (bypass $(...) or `...`)
1.11 tnn 155: echo "${OPC} $line" 1>&2
1.1 gdt 156: # Look for the first thing that looks like pkg-version rather
157: # than category/pkg and remove the version.
158: for word in $line; do
1.5 tnn 159: if [ "$(echo $word | egrep '^[^/]+-[0-9][^-/]*$')" ]; then
160: echo $word | sed 's/-[0-9][^-]*$//'
1.1 gdt 161: break #done with this line
162: fi
163: done
164: done
165: }
166:
167: # usage: check_packages_w_flag flag
168: # echo packages with flag=YES
169: check_packages_w_flag()
170: {
171: _flag=$1; shift
1.12 tnn 172: for pkgver in $(${PKG_INFO} -e '*'); do
173: if ${PKG_INFO} -Bq $pkgver \
1.1 gdt 174: | egrep "^$_flag=[Yy][Ee][Ss]" > /dev/null; then
1.5 tnn 175: echo $pkgver | sed 's/-[0-9][^-]*$//'
1.1 gdt 176: fi
177: done
178: }
179:
180: # echo dep->pkg edges for all installed packages
181: depgraph_installed()
182: {
1.15 tnn 183: ${PKG_INFO} -N '*' | ${AWK} ' \
184: /^Information for/ { \
185: pkg=$3; sub("-[0-9][^-]*:$", "", pkg); \
186: print pkg" "pkg; \
187: state=1; \
188: } \
1.16 gdt 189: /^\** PACKAGE MAY NOT BE DELETED \**$/ { state=3; } \
1.15 tnn 190: /^./ { \
191: if (state == 2) { \
192: dep=$1; sub("-[0-9][^-]*$", "", dep); \
193: print dep" "pkg; \
194: } \
195: } \
196: /^Built using/ { \
197: state=2 \
198: } \
199: '
1.1 gdt 200: }
201:
202: # usage: who_requires pkg --in-graph DEPGRAPH
203: who_requires()
204: {
205: _target=$1; shift
206: test "$1" = '--in-graph' && shift || return $((false))
207:
208: while [ $# -gt 0 ]; do
209: _dep=$1; _pkg=$2; shift 2;
210: if [ $_dep = $_target -a $_dep != $_pkg ]; then
211: echo $_pkg
212: fi
213: done
214: }
215:
216: # usage: is_member x list
217: # return true (0) if x appears in list, false (1) otherwise
218: is_member()
219: {
220: _x="$1"; shift;
221: while [ $# -gt 0 -a "$1" != "$_x" ]; do
222: shift
223: done
224:
225: test $# -gt 0
226: }
227:
228: # usage: exclude list1 --from list2
229: # echo list2 with items from list1 excluded
230: exclude()
231: {
232: _excl=
233: while [ $# -gt 0 -a $1 != "--from" ]; do
234: _excl="$_excl $1"
235: shift
236: done
237: if [ $# -gt 0 ]; then
238: shift #discard '--from'
239: fi
240: while [ $# -gt 0 ]; do
241: is_member $1 $_excl || echo $1
242: shift
243: done
244: }
245:
246: # usage: uniquify list
247: # just does sort -u on list (equiv. to sort | uniq)
248: # CAUTION: reorders list
249: uniqify()
250: {
251: for _x in $*; do echo $_x; done | sort -u
252: }
253:
254: verbose()
255: {
256: if [ -n "$opt_v" ]; then
257: echo "$@"
258: fi
259: }
260:
261: vsleep()
262: {
263: if [ -n "$opt_v" ]; then
264: sleep $1
265: fi
266: }
267:
1.22 sno 268: report()
269: {
1.26 ! tnn 270: for a in $SUCCEEDED; do
1.22 sno 271: verbose "+ $a"
272: done
273:
274: for a in $FAILED; do
275: verbose "- $a"
276: done
277: }
278:
1.13 tnn 279: abort()
280: {
1.26 ! tnn 281: echo "*** $1"
! 282: echo "*** Please read the errors listed above, fix the problem,"
! 283: echo "*** then re-run pkg_rolling-replace to continue."
! 284: report
! 285: exit 1
! 286: }
! 287:
! 288: error()
! 289: {
! 290: if [ -n "$opt_k" ]; then
! 291: abort "$1"
! 292: fi
! 293: echo "*** $1"
! 294: }
! 295:
! 296: mark_as_succeeded()
! 297: {
! 298: if [ -n "$SUCCEEDED" ]; then
! 299: SUCCEEDED="$SUCCEEDED $1"
! 300: else
! 301: SUCCEEDED="$1"
! 302: fi
! 303: }
! 304:
! 305: mark_as_failed()
! 306: {
! 307: if [ -n "$FAILED" ]; then
! 308: FAILED="$FAILED $1"
! 309: else
! 310: FAILED="$1"
! 311: fi
1.13 tnn 312: }
313:
1.22 sno 314: todo()
315: {
316: if [ -z "$opt_F" ]; then
317: verbose "${OPI} Packages to rebuild:"
318: verbose "${OPC} MISMATCH_TODO=[$(echo $MISMATCH_TODO)]" #strip newlines
319: verbose "${OPC} REBUILD_TODO=[$(echo $REBUILD_TODO)]"
320: verbose "${OPC} UNSAFE_TODO=[$(echo $UNSAFE_TODO)]"
321: REPLACE_TODO=$(uniqify $MISMATCH_TODO $REBUILD_TODO $UNSAFE_TODO)
322: else
323: REPLACE_TODO=$(uniqify $MISMATCH_TODO)
324: verbose "${OPI} Packages to fetch:"
325: verbose "${OPC} MISMATCH_TODO=[$(echo $MISMATCH_TODO)]" #strip newlines
326: fi
327: REPLACE_TODO=$(exclude $REALLYEXCLUDE --from $REPLACE_TODO)
328: if [ -n "$FAILED" ]; then
329: REPLACE_TODO=$(exclude $FAILED --from $REPLACE_TODO)
330: fi
331: vsleep 2
332: }
333:
1.1 gdt 334: ######################################################################
335: ##
336: ## main()
337: ##
338:
339: EXCLUDE=
1.25 sno 340: MAKE_VAR="IN_PKG_ROLLING_REPLACE=1"
341: MAKE_VAR_SEP=" "
1.1 gdt 342:
1.25 sno 343: args=$(getopt FhknursvD:x:X:L: $*)
1.1 gdt 344: if [ $? -ne 0 ]; then
345: opt_h=1
346: fi
347: set -- $args
348: while [ $# -gt 0 ]; do
349: case "$1" in
1.22 sno 350: -F) opt_F=1 ;;
1.1 gdt 351: -h) opt_h=1 ;;
1.22 sno 352: -k) opt_k=1 ;;
1.1 gdt 353: -n) opt_n=1 ;;
1.13 tnn 354: -r) opt_r=1 ;;
355: -s) opt_s=1 ;;
1.1 gdt 356: -u) opt_u=1 ;;
357: -v) opt_v=1 ;;
1.25 sno 358: -D) MAKE_VAR="${MAKE_VAR}${MAKE_VAR_SEP}$2"; MAKE_VAR_SEP=" "; shift ;;
1.1 gdt 359: -x) EXCLUDE="$EXCLUDE $(echo $2 | sed 's/,/ /g')" ; shift ;;
1.17 apb 360: -X) REALLYEXCLUDE="$REALLYEXCLUDE $(echo $2 | sed 's/,/ /g')" ; shift ;;
1.22 sno 361: -L) LOGPATH="$2"; shift ;;
1.1 gdt 362: --) shift; break ;;
363: esac
364: shift
365: done
366:
367: if [ -n "$opt_h" ]; then
368: usage
369: fi
370:
1.13 tnn 371: if [ -n "$opt_s" ]; then
372: UNSAFE_VAR=unsafe_depends_strict
373: else
374: UNSAFE_VAR=unsafe_depends
375: fi
376:
1.25 sno 377: MAKE="${MAKE}${MAKE_VAR_SEP}${MAKE_VAR}"
378:
1.26 ! tnn 379: SUCCEEDED=""
1.22 sno 380: FAILED=""
381:
1.1 gdt 382: MISMATCH_TODO=
1.22 sno 383: if [ -n "$opt_u" -o -n "$opt_F" ]; then
1.1 gdt 384: echo "${OPI} Checking for mismatched installed packages using pkg_chk"
385: MISMATCH_TODO=$(check_packages_mismatched)
386: echo "${OPI} Excluding the following mismatched packages:"
387: echo "${OPC} EXCLUDE=[$EXCLUDE]"
388: MISMATCH_TODO=$(exclude $EXCLUDE --from $MISMATCH_TODO)
389: fi
390:
1.22 sno 391: if [ -z "$opt_F" ]; then
392: echo "${OPI} Checking for rebuild-requested installed packages (rebuild=YES)"
393: REBUILD_TODO=$(check_packages_w_flag 'rebuild')
1.1 gdt 394:
1.22 sno 395: echo "${OPI} Checking for unsafe installed packages (${UNSAFE_VAR}=YES)"
396: UNSAFE_TODO=$(check_packages_w_flag ${UNSAFE_VAR})
397: fi
1.1 gdt 398:
399: # DEPGRAPH_INSTALLED is rebuilt each round. DEPGRAPH_SRC will collect
400: # edges that we discover using 'make show-depends', but that weren't
401: # listed as depends by the installed version of a package, and
402: # DEPENDS_CHECKED lists packages for which we've already done that
403: # check.
404: DEPGRAPH_INSTALLED=
405: DEPGRAPH_SRC=
406: DEPENDS_CHECKED=
407:
1.22 sno 408: todo
1.1 gdt 409:
410: depgraph_built=0
411:
412: while [ -n "$REPLACE_TODO" ]; do
1.22 sno 413: fail=
414:
1.1 gdt 415: # don't rebuild depgraph if we continued from new-depends step below
416: if [ "$depgraph_built" -eq 0 ]; then
417: echo "${OPI} Building dependency graph for installed packages"
418: DEPGRAPH_INSTALLED=$(depgraph_installed)
419: depgraph_built=1
420: fi
421:
422: echo "${OPI} Tsorting dependency graph"
423: TSORTED=$(echo $DEPGRAPH_INSTALLED $DEPGRAPH_SRC | tsort)
424: for pkg in $TSORTED; do
425: if is_member $pkg $REPLACE_TODO; then
426: break;
427: fi
428: done
1.21 tnn 429: pkgdir=$(${PKG_INFO} -Q PKGPATH $pkg)
1.26 ! tnn 430: [ -n "$pkgdir" ] || abort "Couldn't extract PKGPATH from installed package $pkg"
! 431:
1.1 gdt 432: echo "${OPI} Selecting $pkg ($pkgdir) as next package to replace"
433: sleep 1
434:
435: # Newer versions in pkgsrc sometimes have more depends than are
436: # recorded for the installed version (this is entirely to be
437: # expected as packages are split, renamed, and add new features).
438: # When this happens, add the new edges to the graph and re-tsort.
439: # Don't re-tsort if the new edges were already installed once
440: # (otherwise we'll go into a loop).
441:
442: # XXX I'm not sure that DEPENDS_CHECKED is necessary, or whether
443: # simply ignoring new deps that aren't in $REPLACE_TODO would have
444: # been sufficient. The DEPENDS_CHECKED approach causes one extra
445: # tsort in some cases, which isn't overly expensive.
446:
447: # XXX After tsorting and choosing what to 'make replace', we
448: # filter out packages that aren't already installed and marked for
449: # replacement. This is safe, since uninstalled depends will be
450: # pulled in automatically by 'make replace'; but in rare cases it
451: # might be non-optimal, leading to a duplicate rebuild that we
452: # would have avoided had we selected the uninstalled package in
453: # tsorted order and run 'make install' on it. This seems like
454: # such a rare case that the added complexity isn't worth it.
455:
456: if ! is_member $pkg $DEPENDS_CHECKED; then
457: echo "${OPI} Checking if $pkg has new depends..."
1.12 tnn 458: OLD_DEPENDS=$(${PKG_INFO} -Nq $pkg | sed 's/-[0-9][^-]*$//')
1.1 gdt 459: NEW_DEPENDS=
460: cd "$PKGSRCDIR/$pkgdir"
461: bdeps=$(${MAKE} show-depends VARNAME=BUILD_DEPENDS)
462: rdeps=$(${MAKE} show-depends)
463: for depver in $bdeps $rdeps; do
1.10 tnn 464: dep=$(echo $depver | sed -e 's/[:[].*$/0/' -e 's/[<>]=/-/' \
465: -e 's/-[0-9][^-]*$//')
1.1 gdt 466: if ! is_member $dep $OLD_DEPENDS $NEW_DEPENDS; then
467: NEW_DEPENDS="$NEW_DEPENDS $dep"
468: DEPGRAPH_SRC="$DEPGRAPH_SRC $dep $pkg"
469: fi
470: done
471: DEPENDS_CHECKED="$DEPENDS_CHECKED $pkg"
472: if [ -n "$NEW_DEPENDS" ]; then
473: echo "${OPI} $pkg has the following new depends (need to re-tsort):"
474: echo "${OPC} [$(echo $NEW_DEPENDS)]"
475: sleep 2
476: continue
477: fi
478: fi
479:
1.22 sno 480: pkgname=$(${PKG_INFO} -e $pkg)
481: if [ -n "$LOGPATH" ]; then
482: logdir="$LOGPATH/`dirname $pkgdir`"
483: logfile="$logdir/$pkgname"
484: @MKDIR@ "$logdir" || abort "mkdir -p '$logdir' failed"
485: exec 3>"$logfile"
486: tail -f "$logfile" &
487: TAILPID=$!
488: fi
489:
1.1 gdt 490: # Do make replace, with clean before, and package and clean afterwards.
1.13 tnn 491: fail=
1.23 sno 492: if [ -d "$PKGSRCDIR/$pkgdir" ]; then
493: cd "$PKGSRCDIR/$pkgdir";
1.22 sno 494: else
1.26 ! tnn 495: mark_as_failed $pkg
! 496: error "No package directory '$pkgdir' for $pkg."
1.22 sno 497: fi
1.23 sno 498:
499: if [ -z "$fail" ]; then
500: if [ -z "$opt_F" ]; then
501: echo "${OPI} Replacing $pkgname"
502: cmd="${MAKE} clean || fail=1"
503: if [ -n "$opt_n" ]; then
504: echo "${OPI} Would run: $cmd"
505: else
506: if [ -n "$logfile" ]; then
507: eval "$cmd" >&3 2>&3
508: else
509: eval "$cmd"
510: fi
511: if [ -n "$fail" ]; then
1.26 ! tnn 512: mark_as_failed $pkg
! 513: error "'make clean' failed for package $pkg."
1.23 sno 514: fi
515: fi
1.25 sno 516: cmd="${MAKE} replace || fail=1" # XXX OLDNAME= support? xmlrpc-c -> xmlrpc-c-ss
1.23 sno 517: else
518: echo "${OPI} Fetching $pkgname"
519: cmd="${MAKE} fetch depends-fetch || fail=1"
520: fi
521: fi
522:
1.22 sno 523: if [ -n "$opt_n" -a -z "$fail" ]; then
1.13 tnn 524: echo "${OPI} Would run: $cmd"
1.22 sno 525: elif [ -z "$fail" ]; then
526: if [ -n "$logfile" ]; then
527: eval "$cmd" >&3 2>&3
528: else
529: eval "$cmd"
530: fi
531: if [ -n "$fail" ]; then
1.26 ! tnn 532: mark_as_failed $pkg
! 533: error "'make replace' failed for package $pkg."
1.22 sno 534: fi
1.13 tnn 535: fi
1.22 sno 536: if [ -z "$opt_n" -a -z "$opt_k" -a -z "$opt_F" ]; then
1.13 tnn 537: [ -z "$(${PKG_INFO} -Q unsafe_depends_strict $pkg)" ] || \
538: abort "package $pkg still has unsafe_depends_strict."
539: [ -z "$(${PKG_INFO} -Q unsafe_depends $pkg)" ] || \
540: abort "package $pkg still has unsafe_depends."
541: [ -z "$(${PKG_INFO} -Q rebuild $pkg)" ] || \
542: abort "package $pkg is still requested to be rebuilt."
1.1 gdt 543: fi
1.18 gdt 544: # If -r not given, make a binary package.
1.22 sno 545: if [ -z "$opt_r" -a -z "$fail" -a -z "$opt_F" ]; then
1.13 tnn 546: echo "${OPI} Packaging $(${PKG_INFO} -e $pkg)"
1.22 sno 547: cmd="${MAKE} package || fail=1"
548: if [ -n "$opt_n" -a -z "$fail" ]; then
1.13 tnn 549: echo "${OPI} Would run: $cmd"
1.22 sno 550: elif [ -z "$fail" ]; then
551: if [ -n "$logfile" ]; then
552: eval "$cmd" >&3 2>&3
553: else
554: eval "$cmd"
555: fi
556: if [ -n "$fail" ]; then
1.26 ! tnn 557: mark_as_failed $pkg
! 558: error "'make package' failed for package $pkg."
1.22 sno 559: fi
1.13 tnn 560: fi
1.1 gdt 561: fi
1.18 gdt 562: # Clean
1.22 sno 563: if [ -z "$opt_n" -a -z "$fail" -a -z "$opt_F" ]; then
564: cmd="${MAKE} clean || fail=1"
565: if [ -n "$logfile" ]; then
566: eval "$cmd" >&3 2>&3
567: else
568: eval "$cmd"
569: fi
570: if [ -n "$fail" ]; then
1.26 ! tnn 571: mark_as_failed $pkg
! 572: error "'make clean' failed for package $pkg."
1.22 sno 573: fi
574: fi
575:
576: if [ -z "$fail" ]; then
1.26 ! tnn 577: mark_as_succeeded $pkg
1.18 gdt 578: fi
579:
1.1 gdt 580: sleep 1
581:
582: # remove just-replaced package from all *_TODO lists
583: MISMATCH_TODO=$(exclude $pkg --from $MISMATCH_TODO)
584: REBUILD_TODO=$(exclude $pkg --from $REBUILD_TODO)
585: UNSAFE_TODO=$(exclude $pkg --from $UNSAFE_TODO)
586:
1.13 tnn 587: echo "${OPI} Re-checking for unsafe installed packages (${UNSAFE_VAR}=YES)"
1.1 gdt 588: if [ -n "$opt_n" ]; then
589: # With -n, the replace didn't happen, and thus the packages that would
590: # have been marked unsafe_depends=YES were not. Add the set that
591: # would have been marked so we can watch what pkg_rolling-replace
592: # would have done (approximately).
593: UNSAFE_TODO=$(uniqify $UNSAFE_TODO \
594: $(who_requires $pkg --in-graph $DEPGRAPH_INSTALLED))
595: sleep 1
596: else
1.13 tnn 597: UNSAFE_TODO=$(check_packages_w_flag ${UNSAFE_VAR})
1.1 gdt 598: fi
599:
1.22 sno 600: depgraph_built=0
601:
602: todo
603: vsleep 2
1.1 gdt 604:
1.22 sno 605: if [ -n "$logfile" ]; then
606: exec 3>&-
607: kill $TAILPID
608: fi
1.1 gdt 609: done
610:
611: echo "${OPI} No more packages to replace; done."
1.22 sno 612:
613: report
CVSweb <webmaster@jp.NetBSD.org>