summaryrefslogtreecommitdiff
path: root/pkgtools/pkg_rolling-replace
diff options
context:
space:
mode:
authortnn <tnn@pkgsrc.org>2007-08-08 11:28:04 +0000
committertnn <tnn@pkgsrc.org>2007-08-08 11:28:04 +0000
commitf32a62ac9eac024c50fac0c27bf59b5adf33ee2d (patch)
tree82f3db1a021a78b8998a2c6e7041a4d11d46adbb /pkgtools/pkg_rolling-replace
parent2e3ae84d55cbfea75b44124bbbeb31046d5cee46 (diff)
downloadpkgsrc-f32a62ac9eac024c50fac0c27bf59b5adf33ee2d.tar.gz
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 (limited to 'pkgtools/pkg_rolling-replace')
-rw-r--r--pkgtools/pkg_rolling-replace/Makefile6
-rw-r--r--pkgtools/pkg_rolling-replace/files/pkg_rolling-replace.834
-rwxr-xr-xpkgtools/pkg_rolling-replace/files/pkg_rolling-replace.sh71
3 files changed, 74 insertions, 37 deletions
diff --git a/pkgtools/pkg_rolling-replace/Makefile b/pkgtools/pkg_rolling-replace/Makefile
index 55ce902aa91..fd7e01098c7 100644
--- a/pkgtools/pkg_rolling-replace/Makefile
+++ b/pkgtools/pkg_rolling-replace/Makefile
@@ -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_CLASSES+= tools
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 --git a/pkgtools/pkg_rolling-replace/files/pkg_rolling-replace.8 b/pkgtools/pkg_rolling-replace/files/pkg_rolling-replace.8
index 4cfcd7d0582..14310629baf 100644
--- a/pkgtools/pkg_rolling-replace/files/pkg_rolling-replace.8
+++ b/pkgtools/pkg_rolling-replace/files/pkg_rolling-replace.8
@@ -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 @@ Whenever
.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 @@ or change any flags on installed packages.
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 @@ If not set in environment then defaults to
with initial idea and many suggestions from
.An Greg Troxel
.Aq gdt@ir.bbn.com .
+The options -s and -r were added by
+.An Tobias Nygren
+.Aq tnn@NetBSD.org .
.Sh BUGS
.Nm
does not run fully automatically when any significant number of
diff --git a/pkgtools/pkg_rolling-replace/files/pkg_rolling-replace.sh b/pkgtools/pkg_rolling-replace/files/pkg_rolling-replace.sh
index 6fff134a115..3aa765cc732 100755
--- a/pkgtools/pkg_rolling-replace/files/pkg_rolling-replace.sh
+++ b/pkgtools/pkg_rolling-replace/files/pkg_rolling-replace.sh
@@ -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 -f "$MAKECONF" && test -z "$PKGSRCDIR" && PKGSRCDIR="` \
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 @@ usage()
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 @@ vsleep()
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 @@ vsleep()
EXCLUDE=
-args=$(getopt hnuvx: $*)
+args=$(getopt hnursvx: $*)
if [ $? -ne 0 ]; then
opt_h=1
fi
@@ -243,6 +252,8 @@ while [ $# -gt 0 ]; do
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 @@ if [ -n "$opt_h" ]; then
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 @@ fi
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 @@ while [ -n "$REPLACE_TODO" ]; do
# 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"
- if [ -z "$opt_n" ]; then
- eval "$cmd"
+ fail=
+ cmd="cd \"$PKGSRCDIR/$pkgdir\" && ${MAKE} clean && ${MAKE} replace || fail=1"
+ if [ -n "$opt_n" ]; then
+ echo "${OPI} Would run: $cmd"
else
- echo "$cmd"
+ eval "$cmd"
+ [ -z "$fail" ] || abort "'make replace' failed for package $pkg."
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_n" ]; then
+ [ -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 [ -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 @@ while [ -n "$REPLACE_TODO" ]; do
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 @@ while [ -n "$REPLACE_TODO" ]; do
$(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:"