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: catc...



details:   https://anonhg.NetBSD.org/pkgsrc/rev/3fcc80044154
branches:  trunk
changeset: 450304:3fcc80044154
user:      rhialto <rhialto%pkgsrc.org@localhost>
date:      Tue Apr 13 17:51:21 2021 +0000

description:
pkg_rolling-replace: catch permission errors from pkg_admin

and print a friendlier warning message instead (only once).
Document that the mismatch state may not persist if permissions are
insufficient.

diffstat:

 pkgtools/pkg_rolling-replace/Makefile                     |   4 ++--
 pkgtools/pkg_rolling-replace/files/pkg_rolling-replace.8  |   5 ++++-
 pkgtools/pkg_rolling-replace/files/pkg_rolling-replace.sh |  12 ++++++++++--
 3 files changed, 16 insertions(+), 5 deletions(-)

diffs (66 lines):

diff -r 6dea29c0041e -r 3fcc80044154 pkgtools/pkg_rolling-replace/Makefile
--- a/pkgtools/pkg_rolling-replace/Makefile     Tue Apr 13 17:38:12 2021 +0000
+++ b/pkgtools/pkg_rolling-replace/Makefile     Tue Apr 13 17:51:21 2021 +0000
@@ -1,6 +1,6 @@
-# $NetBSD: Makefile,v 1.47 2021/01/15 10:56:52 tnn Exp $
+# $NetBSD: Makefile,v 1.48 2021/04/13 17:51:21 rhialto Exp $
 
-PKGNAME=       pkg_rolling-replace-0.24.10
+PKGNAME=       pkg_rolling-replace-0.24.11
 CATEGORIES=    pkgtools
 
 MAINTAINER=    gdt%NetBSD.org@localhost
diff -r 6dea29c0041e -r 3fcc80044154 pkgtools/pkg_rolling-replace/files/pkg_rolling-replace.8
--- a/pkgtools/pkg_rolling-replace/files/pkg_rolling-replace.8  Tue Apr 13 17:38:12 2021 +0000
+++ b/pkgtools/pkg_rolling-replace/files/pkg_rolling-replace.8  Tue Apr 13 17:51:21 2021 +0000
@@ -1,4 +1,4 @@
-.\" $NetBSD: pkg_rolling-replace.8,v 1.21 2021/01/09 19:12:46 rhialto Exp $
+.\" $NetBSD: pkg_rolling-replace.8,v 1.22 2021/04/13 17:51:21 rhialto Exp $
 .Dd February 1, 2010
 .Dt PKG_ROLLING-REPLACE 8
 .Os
@@ -133,6 +133,9 @@
 to check for mismatched packages, mark them with 'mismatch=YES',
 and replace those too.
 Otherwise, consider packages marked 'mismatch=YES' to be mismatched.
+Marking with 'mismatch=YES' only occurs if the calling user can write
+to the package database. It is not an error if this fails; it just does not
+persist the status.
 .It Fl v
 Verbose output.
 .It Fl X Ar pkgs
diff -r 6dea29c0041e -r 3fcc80044154 pkgtools/pkg_rolling-replace/files/pkg_rolling-replace.sh
--- a/pkgtools/pkg_rolling-replace/files/pkg_rolling-replace.sh Tue Apr 13 17:38:12 2021 +0000
+++ b/pkgtools/pkg_rolling-replace/files/pkg_rolling-replace.sh Tue Apr 13 17:51:21 2021 +0000
@@ -1,6 +1,6 @@
 #!/bin/sh
 
-# $NetBSD: pkg_rolling-replace.sh,v 1.42 2021/01/15 10:56:52 tnn Exp $
+# $NetBSD: pkg_rolling-replace.sh,v 1.43 2021/04/13 17:51:21 rhialto Exp $
 #<license>
 # Copyright (c) 2006 BBN Technologies Corp.  All rights reserved.
 #
@@ -152,6 +152,8 @@
 # supported.  Newer versions may or may not work (patches welcome).
 check_packages_mismatched()
 {
+    warned_once=""
+
     ${PKG_CHK} -u -q $opt_B | egrep -v missing | while read line; do
         # duplicate output of pkg_chk to stderr (bypass $(...) or `...`)
         echo "${OPC} $line" 1>&2
@@ -160,7 +162,13 @@
         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
+                   ${PKG_ADMIN} set mismatch=YES "$word" 2>&1 >/dev/null || {
+                       if [ -z "$warned_once" ]; then
+                           echo 1>&2 "$OPC WARNING: mismatch variable not set due to permissions;"
+                           echo 1>&2 "$OPC          mismatch status will not persist."
+                           warned_once=1
+                       fi
+                   }
                fi
                 echo $word | sed 's/-[0-9][^-]*$//'
                 break  #done with this line



Home | Main Index | Thread Index | Old Index