pkgsrc-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[pkgsrc/trunk]: pkgsrc/pkgtools/pkg_rolling-replace pkg_rolling-replace-0.10:



details:   https://anonhg.NetBSD.org/pkgsrc/rev/6eb75e901b80
branches:  trunk
changeset: 531883:6eb75e901b80
user:      tnn <tnn%pkgsrc.org@localhost>
date:      Wed Aug 08 11:28:04 2007 +0000

description:
pkg_rolling-replace-0.10:
- Abort if any of rebuild, unsafe_depends, unsafe_depends_strict are still
  set after "make replace".
- Following changes in pkgsrc, does not replace by default if the
  dependencies' ABI is still compatible.
- Add option -s that retains the old behaviour of always replacing.
- Add option -r for "replace only", this supresses creation of binary pkgs.
- The -n option has not been fully updated for these changes.
- versions 0.[7-9] were skipped to avoid any ambiguity from the 0.04 -> 0.5
  transition.

diffstat:

 pkgtools/pkg_rolling-replace/Makefile                     |   6 +-
 pkgtools/pkg_rolling-replace/files/pkg_rolling-replace.8  |  34 +++++--
 pkgtools/pkg_rolling-replace/files/pkg_rolling-replace.sh |  71 +++++++++-----
 3 files changed, 74 insertions(+), 37 deletions(-)

diffs (248 lines):

diff -r 5d1ee7835bf0 -r 6eb75e901b80 pkgtools/pkg_rolling-replace/Makefile
--- a/pkgtools/pkg_rolling-replace/Makefile     Wed Aug 08 08:12:12 2007 +0000
+++ b/pkgtools/pkg_rolling-replace/Makefile     Wed Aug 08 11:28:04 2007 +0000
@@ -1,6 +1,6 @@
-# $NetBSD: Makefile,v 1.12 2007/08/06 15:07:56 tnn Exp $
+# $NetBSD: Makefile,v 1.13 2007/08/08 11:28:04 tnn Exp $
 
-DISTNAME=      pkg_rolling-replace-0.6
+DISTNAME=      pkg_rolling-replace-0.10
 CATEGORIES=    pkgtools
 MASTER_SITES=  # empty
 DISTFILES=     # empty
@@ -28,7 +28,7 @@
 SUBST_STAGE.tools=     pre-configure
 SUBST_MESSAGE.tools=   Substituting tool locations.
 SUBST_FILES.tools=     pkg_rolling-replace.sh
-SUBST_VARS.tools=      PKG_INFO_CMD PKG_ADMIN MAKE PKG_CHK
+SUBST_VARS.tools=      PKG_INFO_CMD MAKE PKG_CHK
 
 SUBST_CLASSES+=                makeconf
 SUBST_STAGE.makeconf=  pre-configure
diff -r 5d1ee7835bf0 -r 6eb75e901b80 pkgtools/pkg_rolling-replace/files/pkg_rolling-replace.8
--- a/pkgtools/pkg_rolling-replace/files/pkg_rolling-replace.8  Wed Aug 08 08:12:12 2007 +0000
+++ b/pkgtools/pkg_rolling-replace/files/pkg_rolling-replace.8  Wed Aug 08 11:28:04 2007 +0000
@@ -1,5 +1,5 @@
-.\" $NetBSD: pkg_rolling-replace.8,v 1.6 2007/08/07 20:46:43 wiz Exp $
-.Dd May 11, 2007
+.\" $NetBSD: pkg_rolling-replace.8,v 1.7 2007/08/08 11:28:04 tnn Exp $
+.Dd August 8, 2007
 .Dt PKG_ROLLING-REPLACE 8
 .Os
 .Sh NAME
@@ -7,17 +7,15 @@
 .Nd rebuild or update packages using 'make replace' in tsorted order
 .Sh SYNOPSIS
 .Nm
-.Op Fl hnuv
+.Op Fl hnrsuv
 .Op Fl x Ar pkgs
 .Sh DESCRIPTION
 .Nm
 runs
 .Dq make replace
-on packages that have been marked with the
-.Dq unsafe_depends=YES
-flag or the
-.Dq rebuild=YES
-flag, optionally replacing any outdated packages (as reported by
+on packages that have been marked to have unsafe dependencies or have
+been marked to be rebuilt.
+Optionally it can replace any outdated packages (as reported by
 .Xr pkg_chk 8 )
 as well.
 .Pp
@@ -25,9 +23,11 @@
 .Dq make replace
 is run on a package, all installed packages
 that depend on it are marked with the
+.Dq unsafe_depends_strict=YES
+flag. If the version of the replaced package has changed, this indicates
+that it may no longer be ABI-compatible so
 .Dq unsafe_depends=YES
-flag, which indicates that they may no longer be ABI-compatible
-with the replaced package.
+is also set for all packages that depend on it.
 Running
 .Nm
 with no arguments will restore such packages to a safe state by
@@ -70,6 +70,17 @@
 This option attempts to calculate the new packages that would be
 marked unsafe after each
 .Dq make replace .
+.It Fl r
+Just replace packages, do not build binary packages.
+.It Fl s
+Enable strict mode. This makes
+.Nm
+Look at 
+.Dq unsafe_depends_strict
+tags instead of
+.Dq unsafe_depends
+tags. This will replace packages more aggressively and can be used to solve
+shared library problems.
 .It Fl u
 Use
 .Xl pkg_chk 8
@@ -111,6 +122,9 @@
 with initial idea and many suggestions from
 .An Greg Troxel
 .Aq gdt%ir.bbn.com@localhost .
+The options -s and -r were added by
+.An Tobias Nygren
+.Aq tnn%NetBSD.org@localhost .
 .Sh BUGS
 .Nm
 does not run fully automatically when any significant number of
diff -r 5d1ee7835bf0 -r 6eb75e901b80 pkgtools/pkg_rolling-replace/files/pkg_rolling-replace.sh
--- a/pkgtools/pkg_rolling-replace/files/pkg_rolling-replace.sh Wed Aug 08 08:12:12 2007 +0000
+++ b/pkgtools/pkg_rolling-replace/files/pkg_rolling-replace.sh Wed Aug 08 11:28:04 2007 +0000
@@ -1,6 +1,6 @@
 #!/bin/sh
 
-# $NetBSD: pkg_rolling-replace.sh,v 1.12 2007/08/06 15:07:56 tnn Exp $
+# $NetBSD: pkg_rolling-replace.sh,v 1.13 2007/08/08 11:28:04 tnn Exp $
 #<license>
 # Copyright (c) 2006 BBN Technologies Corp.  All rights reserved.
 #
@@ -71,7 +71,6 @@
 test -z "$PKGSRCDIR" && PKGSRCDIR=/usr/pkgsrc
 test -z "$PKG_CHK" && PKG_CHK="@PKG_CHK@"
 test -z "$PKG_INFO" && PKG_INFO="@PKG_INFO_CMD@"
-test -z "$PKG_ADMIN" && PKG_ADMIN="@PKG_ADMIN@"
 
 unset PKG_PATH || true  #or pkgsrc makefiles will complain
 
@@ -80,6 +79,8 @@
     echo "Usage: pkg_rolling-replace [opts]
         -h         This help
         -n         Don't actually do make replace
+        -r         Just replace, don't create binary packages
+        -s         Replace even if the ABIs are still compatible ("strict")
         -u         Update mismatched packages
         -v         Verbose
         -x <pkg>   exclude <pkg> from update check
@@ -227,6 +228,14 @@
     fi
 }
 
+abort()
+{
+       echo "*** $1"
+       echo "*** Please read the errors listed above, fix the problem,"
+       echo "*** then re-run pkg_rolling-replace to continue."
+       exit 1
+}
+
 ######################################################################
 ##
 ## main()
@@ -234,7 +243,7 @@
 
 EXCLUDE=
 
-args=$(getopt hnuvx: $*)
+args=$(getopt hnursvx: $*)
 if [ $? -ne 0 ]; then
     opt_h=1
 fi
@@ -243,6 +252,8 @@
     case "$1" in
         -h) opt_h=1 ;;
         -n) opt_n=1 ;;
+        -r) opt_r=1 ;;
+        -s) opt_s=1 ;;
         -u) opt_u=1 ;;
         -v) opt_v=1 ;;
         -x) EXCLUDE="$EXCLUDE $(echo $2 | sed 's/,/ /g')" ; shift ;;
@@ -255,6 +266,12 @@
     usage
 fi
 
+if [ -n "$opt_s" ]; then
+    UNSAFE_VAR=unsafe_depends_strict
+else
+    UNSAFE_VAR=unsafe_depends
+fi
+
 MISMATCH_TODO=
 if [ -n "$opt_u" ]; then
     echo "${OPI} Checking for mismatched installed packages using pkg_chk"
@@ -267,8 +284,8 @@
 echo "${OPI} Checking for rebuild-requested installed packages (rebuild=YES)"
 REBUILD_TODO=$(check_packages_w_flag 'rebuild')
 
-echo "${OPI} Checking for unsafe installed packages (unsafe_depends=YES)"
-UNSAFE_TODO=$(check_packages_w_flag 'unsafe_depends')
+echo "${OPI} Checking for unsafe installed packages (${UNSAFE_VAR}=YES)"
+UNSAFE_TODO=$(check_packages_w_flag ${UNSAFE_VAR})
 
 # DEPGRAPH_INSTALLED is rebuilt each round.  DEPGRAPH_SRC will collect
 # edges that we discover using 'make show-depends', but that weren't
@@ -354,25 +371,31 @@
 
     # Do make replace, with clean before, and package and clean afterwards.
     echo "${OPI} Replacing $(${PKG_INFO} -e $pkg)"
-    FAIL=
-    cmd="cd \"$PKGSRCDIR/$pkgdir\" \
-           && ${MAKE} clean && ${MAKE} replace \
-           && ([ -z \"$(${PKG_INFO} -Q unsafe_depends $pkg)\" ] \
-               || ${PKG_ADMIN} unset unsafe_depends $pkg) \
-           && ([ -z \"$(${PKG_INFO} -Q rebuild $pkg)\" ] \
-               || ${PKG_ADMIN} unset rebuild $pkg) \
-           && ${MAKE} package && ${MAKE} clean \
-           || FAIL=1"
+    fail=
+    cmd="cd \"$PKGSRCDIR/$pkgdir\" && ${MAKE} clean && ${MAKE} replace || fail=1"
+    if [ -n "$opt_n" ]; then
+       echo "${OPI} Would run: $cmd"
+    else
+       eval "$cmd"
+       [ -z "$fail" ] || abort "'make replace' failed for package $pkg."
+    fi
     if [ -z "$opt_n" ]; then
-       eval "$cmd"
-    else
-       echo "$cmd"
+       [ -z "$(${PKG_INFO} -Q unsafe_depends_strict $pkg)" ] || \
+           abort "package $pkg still has unsafe_depends_strict."
+       [ -z "$(${PKG_INFO} -Q unsafe_depends $pkg)" ] || \
+           abort "package $pkg still has unsafe_depends."
+       [ -z "$(${PKG_INFO} -Q rebuild $pkg)" ] || \
+           abort "package $pkg is still requested to be rebuilt."
     fi
-    if [ -n "$FAIL" ]; then
-        echo "*** 'make replace' failed for package $pkg."
-        echo "*** Please read the errors listed above, fix the problem,"
-        echo "*** then re-run pkg_rolling-replace to continue."
-        exit 1
+    if [ -z "$opt_r" ]; then
+       echo "${OPI} Packaging $(${PKG_INFO} -e $pkg)"
+           cmd="${MAKE} package && ${MAKE} clean || fail=1"
+       if [ -n "$opt_n" ]; then
+           echo "${OPI} Would run: $cmd"
+       else
+           eval "$cmd"
+           [ -z "$fail" ] || abort "'make package' failed for package $pkg."
+       fi
     fi
     sleep 1
 
@@ -381,7 +404,7 @@
     REBUILD_TODO=$(exclude $pkg --from $REBUILD_TODO)
     UNSAFE_TODO=$(exclude $pkg --from $UNSAFE_TODO)
 
-    echo "${OPI} Re-checking for unsafe installed packages (unsafe_depends=YES)"
+    echo "${OPI} Re-checking for unsafe installed packages (${UNSAFE_VAR}=YES)"
     if [ -n "$opt_n" ]; then
        # With -n, the replace didn't happen, and thus the packages that would
        # have been marked unsafe_depends=YES were not.  Add the set that
@@ -391,7 +414,7 @@
             $(who_requires $pkg --in-graph $DEPGRAPH_INSTALLED))
         sleep 1
     else
-        UNSAFE_TODO=$(check_packages_w_flag 'unsafe_depends')
+        UNSAFE_TODO=$(check_packages_w_flag ${UNSAFE_VAR})
     fi
 
     verbose "${OPI} Packages to rebuild:"



Home | Main Index | Thread Index | Old Index