pkgsrc-Changes-HG archive

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

[pkgsrc/trunk]: pkgsrc/pkgtools/pkgclean pkgclean: check that PKGSRCDIR is a ...



details:   https://anonhg.NetBSD.org/pkgsrc/rev/2a76b28b1339
branches:  trunk
changeset: 421900:2a76b28b1339
user:      gutteridge <gutteridge%pkgsrc.org@localhost>
date:      Sun Jan 19 03:31:30 2020 +0000

description:
pkgclean: check that PKGSRCDIR is a valid directory

For those of us who have multiple pkgsrc trees, or move them around,
and forget the path gets hard-coded into the shell script, or make a
typo when supplying an alternate PKGSRCDIR, and then wonder why nothing
gets cleaned.

diffstat:

 pkgtools/pkgclean/Makefile          |   4 ++--
 pkgtools/pkgclean/files/pkgclean.sh |  10 ++++++++--
 2 files changed, 10 insertions(+), 4 deletions(-)

diffs (44 lines):

diff -r 2c01f900222a -r 2a76b28b1339 pkgtools/pkgclean/Makefile
--- a/pkgtools/pkgclean/Makefile        Sun Jan 19 02:37:38 2020 +0000
+++ b/pkgtools/pkgclean/Makefile        Sun Jan 19 03:31:30 2020 +0000
@@ -1,6 +1,6 @@
-# $NetBSD: Makefile,v 1.22 2019/05/23 19:23:13 rillig Exp $
+# $NetBSD: Makefile,v 1.23 2020/01/19 03:31:30 gutteridge Exp $
 
-PKGNAME=       pkgclean-20051116
+PKGNAME=       pkgclean-20200119
 CATEGORIES=    pkgtools
 
 MAINTAINER=    pkgsrc-users%NetBSD.org@localhost
diff -r 2c01f900222a -r 2a76b28b1339 pkgtools/pkgclean/files/pkgclean.sh
--- a/pkgtools/pkgclean/files/pkgclean.sh       Sun Jan 19 02:37:38 2020 +0000
+++ b/pkgtools/pkgclean/files/pkgclean.sh       Sun Jan 19 03:31:30 2020 +0000
@@ -1,8 +1,8 @@
 #! @SH@
-# $NetBSD: pkgclean.sh,v 1.3 2008/04/29 05:46:08 martin Exp $
+# $NetBSD: pkgclean.sh,v 1.4 2020/01/19 03:31:30 gutteridge Exp $
 #
 
-# Copyright (c) 2005 The NetBSD Foundation, Inc.
+# Copyright (c) 2005, 2020 The NetBSD Foundation, Inc.
 # All rights reserved.
 #
 # This code is derived from software contributed to The NetBSD Foundation
@@ -45,11 +45,17 @@
 # Sanity checks
 #
 
+if [ ! -d "$pkgsrcdir" ]; then
+       echo "$0: error: PKGSRCDIR is not valid." 1>&2
+       exit 1
+fi
+
 case $pkgsrcdir in
 /*)    ;;
 *)     echo "$0: error: PKGSRCDIR must be an absolute path." 1>&2
        exit 1;;
 esac
+
 case $wrkdir_basename in
 */*)   echo "$0: error: wrkdir_basename must not contain slashes." 1>&2
        exit 1;;



Home | Main Index | Thread Index | Old Index