pkgsrc-Users archive

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

Re: pkg_rr and pkg_admin set rebuild=YES



On Fri 18 Sep 2020 at 19:24:13 -0400, Greg Troxel wrote:
> 
> Rhialto <rhialto%falu.nl@localhost> writes:
> 
> > Is there a reason why pkg_rr doesn't remember which packages it wants to
> > build, for instance using "pkg_admin set rebuild=YES pkgname"?
> 
> No, there is no good reason.
> 
> I would use the variable "mismatch", and have 'pkg_rr -u' set that (and
> perhaps do nothing else), and pkg_rr without -u also treat mismatch=yes
> packages as being in the replaceent set along with unsafe_depends and
> rebuild.

After I sent my first mail, I realised that maybe the task of setting
the rebuild flag on a package is better given to pkg_chk. With your
proposed name "mismatch" that may even be more so.

If 'pkg_rr -u' only marks packages, that would change the way of working
I guess; after a 'pkg_rr -u' you'd need to do an extra 'pkg_rr' to do
the actual rebuilding.

But I'm not taking those two things into the exploratory patch below,
for the moment.

I wasn't quite sure about the interaction with the -F flag, but it seems
that in the changed version there is no need to assume -u if you specify
-F (you can always specify -F -u if you want).

I'm still doing a run which has set "rebuild=YES" so I haven't tested
this exact version, but for this run the effects should be close enough.

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	19 Sep 2020 13:08:27 -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')

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	19 Sep 2020 13:08:27 -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

-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



Home | Main Index | Thread Index | Old Index