On Sat 19 Sep 2020 at 12:35:05 -0400, Greg Troxel wrote: > Rhialto <rhialto%falu.nl@localhost> writes: > > > For now I wanted to stay away from this, but if this is considered the > > way to go, I can do it. > > I think I like your patch, but I don't want to rock the boat for the > branch. I will consider it post freeze, and please bug me by private > mail if I dont'. > > Basically, the notion that -u sets mismatch, and that's carried forward > to runs without, seems good, as a minimal change. I have done some testing in the mean time. I adjusted my changes to use a different variable ("mismatch") like you suggested. That works fine of course, with one snag: "make replace" doesn't unset this variable, because it doesn't know about it. It seems inappropriate that "make replace" (and potentially other tools) learn about "mismatch", so pkg_rr must reset this variable itself. That has then as slight disadvantage that the user may interrupt pkg_rr after it has replaced the package but before it has removed mismatch. Let me know what you think... Here is the current state of my changes: Index: pkg_rolling-replace.8 =================================================================== RCS file: /cvsroot/pkgsrc/pkgtools/pkg_rolling-replace/files/pkg_rolling-replace.8,v retrieving revision 1.20 diff -u -r1.20 pkg_rolling-replace.8 --- pkg_rolling-replace.8 12 Feb 2015 08:22:16 -0000 1.20 +++ pkg_rolling-replace.8 8 Jan 2021 17:27:31 -0000 @@ -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 outdated, or marked to be rebuilt. +Optionally it can discover, mark and replace any outdated packages +(as reported by .Xr pkg_chk 8 ) as well. .Pp @@ -68,13 +69,19 @@ (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 outdated, 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 @@ 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 outdated packages, mark them with 'mismatch=YES', +and replace those too. +Otherwise, consider packages marked mismatch=YES to be outdated. .It Fl v Verbose output. .It Fl X Ar pkgs @@ -132,10 +141,7 @@ .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 +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 Index: pkg_rolling-replace.sh =================================================================== RCS file: /cvsroot/pkgsrc/pkgtools/pkg_rolling-replace/files/pkg_rolling-replace.sh,v retrieving revision 1.40 diff -u -r1.40 pkg_rolling-replace.sh --- pkg_rolling-replace.sh 27 Aug 2019 19:30:36 -0000 1.40 +++ pkg_rolling-replace.sh 8 Jan 2021 17:27:31 -0000 @@ -158,6 +158,7 @@ # than category/pkg and remove the version. for word in $line; do if [ "$(echo $word | egrep '^[^/]+-[0-9][^-/]*$')" ]; then + pkg_admin set mismatch=YES "$word" echo $word | sed 's/-[0-9][^-]*$//' break #done with this line fi @@ -374,14 +375,19 @@ 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') @@ -522,7 +528,7 @@ error "'make clean' failed for package $pkg." fi fi - cmd="@SETENV@ ${MAKE_SET_VARS} ${MAKE} replace || fail=1" # XXX OLDNAME= support? xmlrpc-c -> xmlrpc-c-ss + cmd="@SETENV@ ${MAKE_SET_VARS} ${MAKE} replace && pkg_admin unset mismatch $pkg || fail=1" # XXX OLDNAME= support? xmlrpc-c -> xmlrpc-c-ss else echo "${OPI} Fetching $pkgname" cmd="@SETENV@ ${MAKE_SET_VARS} ${MAKE} fetch depends-fetch || fail=1" @@ -549,6 +555,8 @@ 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 -Olaf. -- Olaf 'Rhialto' Seibert -- rhialto at falu dot nl ___ Anyone who is capable of getting themselves made President should on \X/ no account be allowed to do the job. --Douglas Adams, "THGTTG"
Attachment:
signature.asc
Description: PGP signature