diff --git a/pkgtools/pkg_rolling-replace/Makefile b/pkgtools/pkg_rolling-replace/Makefile index f5b24aa1daa4..c54b0b0d4dbc 100644 --- a/pkgtools/pkg_rolling-replace/Makefile +++ b/pkgtools/pkg_rolling-replace/Makefile @@ -1,6 +1,6 @@ -# $NetBSD: Makefile,v 1.45 2019/08/27 19:30:36 gdt Exp $ +# $NetBSD: Makefile,v 1.46 2021/01/09 19:12:46 rhialto Exp $ -PKGNAME= pkg_rolling-replace-0.24.8 +PKGNAME= pkg_rolling-replace-0.24.9 CATEGORIES= pkgtools MAINTAINER= gdt@NetBSD.org diff --git a/pkgtools/pkg_rolling-replace/files/pkg_rolling-replace.8 b/pkgtools/pkg_rolling-replace/files/pkg_rolling-replace.8 index dcc4cb29de39..fd815ba63d91 100644 --- a/pkgtools/pkg_rolling-replace/files/pkg_rolling-replace.8 +++ b/pkgtools/pkg_rolling-replace/files/pkg_rolling-replace.8 @@ -1,4 +1,4 @@ -.\" $NetBSD: pkg_rolling-replace.8,v 1.20 2015/02/12 08:22:16 abs Exp $ +.\" $NetBSD: pkg_rolling-replace.8,v 1.21 2021/01/09 19:12:46 rhialto Exp $ .Dd February 1, 2010 .Dt PKG_ROLLING-REPLACE 8 .Os @@ -16,9 +16,10 @@ .Nm runs .Dq make replace -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 +on packages that have been marked to have unsafe dependencies, +to be mismatched, or marked to be rebuilt. +Optionally it can discover, mark and replace any mismatched packages +(as reported by .Xr pkg_chk 8 ) as well. .Pp @@ -68,13 +69,19 @@ packages). (Usually this results in packages being upgraded to newer versions, assuming the pkgsrc tree is more recent than the currently installed packages.) +The packages discovered this way will be marked as mismatched, so that +in a re-run of +.Nm +you don't need to repeat the +.Fl u +flag. .Ss Options .Bl -tag -width xxxxxxxx .It Fl B Pass .Dq -B to -.Xl pkg_chk 8 +.Xr pkg_chk 8 to also mark any packages with any change in build version data. .It Fl D Ar VARIABLE=VALUE Passes VARIABLE=VALUE to each make call. @@ -122,8 +129,10 @@ This will replace packages more aggressively and can be used to solve shared library problems. .It Fl u Use -.Xl pkg_chk 8 -to check for outdated packages, and replace those too. +.Xr pkg_chk 8 +to check for mismatched packages, mark them with 'mismatch=YES', +and replace those too. +Otherwise, consider packages marked 'mismatch=YES' to be mismatched. .It Fl v Verbose output. .It Fl X Ar pkgs @@ -131,11 +140,8 @@ Exclude the comma-separated list of package base names from being rebuilt for any reason. .It Fl x Ar pkgs Exclude the comma-separated list of package base names -from the check for outdated packages. -This has no effect if the -.Fl u -flag is not given, -and does not prevent packages from being rebuilt for any other reason +from the check for mismatched packages. +This does not prevent packages from being rebuilt for any other reason (such as being a dependency of another package that is also rebuilt, or having any of the .Xr pkg_admin 1 diff --git a/pkgtools/pkg_rolling-replace/files/pkg_rolling-replace.sh b/pkgtools/pkg_rolling-replace/files/pkg_rolling-replace.sh index 11a21e226cc6..b038ac18649a 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.40 2019/08/27 19:30:36 gdt Exp $ +# $NetBSD: pkg_rolling-replace.sh,v 1.41 2021/01/09 19:12:46 rhialto Exp $ # # Copyright (c) 2006 BBN Technologies Corp. All rights reserved. # @@ -108,12 +108,12 @@ usage() -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 outdated packages + -u Update mismatched packages -v Verbose -D VAR=VAL Passes given variables and values to make -L Log to path (/pkgdir/pkg) -X exclude from being rebuilt - -x exclude from outdated check + -x exclude from mismatch check pkg_rolling-replace does 'make replace' on one package at a time, tsorting the packages being replaced according to their @@ -126,14 +126,14 @@ pkg_rolling-replace can be used in one of two ways: 'pkg_rolling-replace' (no arguments) to rebuild them against the new version. - - 'pkg_chk -u' will delete all your mismatched (outdated) - packages, then reinstall them one at a time, leaving you without - those packages in the meantime. 'pkg_rolling-replace -u' will - instead upgrade them in place, allowing you to keep using your - system in the meantime (maybe...if you're lucky...because - pkg_rolling-replace replaces the \"deepest\" dependency first, - things could still break if that happens to be a fundamental - library whose ABI has changed). + - 'pkg_chk -u' will delete all your mismatched packages (where the + package version does not match the pkgsrc version), then reinstall + them one at a time, leaving you without those packages in the + meantime. 'pkg_rolling-replace -u' will instead upgrade them in + place, allowing you to keep using your system in the meantime + (maybe...if you're lucky...because pkg_rolling-replace replaces + the \"deepest\" dependency first, things could still break if that + happens to be a fundamental library whose ABI has changed). " exit 1 } @@ -158,6 +158,9 @@ check_packages_mismatched() # than category/pkg and remove the version. for word in $line; do if [ "$(echo $word | egrep '^[^/]+-[0-9][^-/]*$')" ]; then + if [ -z "$opt_F" ]; then + pkg_admin set mismatch=YES "$word" 1>&2 + fi echo $word | sed 's/-[0-9][^-]*$//' break #done with this line fi @@ -374,14 +377,18 @@ SUCCEEDED="" FAILED="" MISMATCH_TODO= -if [ -n "$opt_u" -o -n "$opt_F" ]; then +if [ -n "$opt_u" ]; then echo "${OPI} Checking for mismatched installed packages using pkg_chk" MISMATCH_TODO=$(check_packages_mismatched) - echo "${OPI} Excluding the following mismatched packages:" - echo "${OPC} EXCLUDE=[$EXCLUDE]" - MISMATCH_TODO=$(exclude $EXCLUDE --from $MISMATCH_TODO) +else + echo "${OPI} Checking for mismatched installed packages (mismatch=YES)" + MISMATCH_TODO=$(check_packages_w_flag 'mismatch') fi +echo "${OPI} Excluding the following mismatched packages:" +echo "${OPC} EXCLUDE=[$EXCLUDE]" +MISMATCH_TODO=$(exclude $EXCLUDE --from $MISMATCH_TODO) + if [ -z "$opt_F" ]; then echo "${OPI} Checking for rebuild-requested installed packages (rebuild=YES)" REBUILD_TODO=$(check_packages_w_flag 'rebuild') @@ -549,6 +556,8 @@ while [ -n "$REPLACE_TODO" ]; do abort "package $pkg still has unsafe_depends." [ -z "$(${PKG_INFO} -Q rebuild $pkg)" ] || \ abort "package $pkg is still requested to be rebuilt." + [ -z "$(${PKG_INFO} -Q mismatch $pkg)" ] || \ + abort "package $pkg is still a mismatched version." fi # If -r not given, make a binary package. if [ -z "$opt_r" -a -z "$fail" -a -z "$opt_F" ]; then