pkgsrc-Changes archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
CVS commit: pkgsrc/bootstrap
Module Name: pkgsrc
Committed By: cjep
Date: Mon Feb 15 12:56:53 UTC 2021
Modified Files:
pkgsrc/bootstrap: bootstrap
Log Message:
In the process of looking at PR#55952, we discovered something that
can catch users out with the two --prefer options. Make the parsing
of these better by checking their argument exists and is not another
command line option.
Addresses PR#55952. Reviewed with jperkin@
To generate a diff of this commit:
cvs rdiff -u -r1.296 -r1.297 pkgsrc/bootstrap/bootstrap
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: pkgsrc/bootstrap/bootstrap
diff -u pkgsrc/bootstrap/bootstrap:1.296 pkgsrc/bootstrap/bootstrap:1.297
--- pkgsrc/bootstrap/bootstrap:1.296 Sat Dec 5 16:50:52 2020
+++ pkgsrc/bootstrap/bootstrap Mon Feb 15 12:56:53 2021
@@ -1,6 +1,6 @@
#! /bin/sh
-# $NetBSD: bootstrap,v 1.296 2020/12/05 16:50:52 js Exp $
+# $NetBSD: bootstrap,v 1.297 2021/02/15 12:56:53 cjep Exp $
#
# Copyright (c) 2001-2011 Alistair Crooks <agc%NetBSD.org@localhost>
# All rights reserved.
@@ -323,6 +323,20 @@ get_optarg()
expr "x$1" : "x[^=]*=\\(.*\\)"
}
+# The --prefer-pkgsrc and --prefer native options require an argument,
+# but our manual getopt parser is unable to detect the difference
+# between a valid argument and the next getopt option (or no option
+# at all if it's the last). Ensure that the argument does not begin
+# with "-" or is empty in case the user forgets to provide one.
+checkarg_missing()
+{
+ case $1 in
+ -*|"")
+ die "ERROR: $2 takes yes, no or a list"
+ ;;
+ esac
+}
+
checkarg_sane_absolute_path()
{
case "$1" in
@@ -422,6 +436,11 @@ make_jobs=1
mk_fragment=
quiet=no
+# Set these variables so that we can test whether they have been
+# correctly enabled by the user and not left empty
+prefer_native=unset
+prefer_pkgsrc=unset
+
while [ $# -gt 0 ]; do
case $1 in
--workdir=*) wrkdir=`get_optarg "$1"` ;;
@@ -484,6 +503,9 @@ checkarg_sane_absolute_path "$varbase" "
checkarg_sane_relative_path "$pkginfodir" "--pkginfodir"
checkarg_sane_relative_path "$pkgmandir" "--pkgmandir"
checkarg_sane_absolute_path "$wrkdir" "--workdir"
+checkarg_missing "$prefer_pkgsrc" "--prefer-pkgsrc"
+checkarg_missing "$prefer_native" "--prefer-native"
+
# set defaults for system locations if not already set by the user
wrkobjdir=${wrkdir}/pkgsrc
@@ -513,6 +535,14 @@ if [ "x$preserve_path" != "xyes" ]; then
PATH="$PATH:/sbin:/usr/sbin"
fi
+if [ "$prefer_native" = "unset" ]; then
+ prefer_native=
+fi
+if [ "$prefer_pkgsrc" = "unset" ]; then
+ prefer_pkgsrc=
+fi
+
+
overpath=""
root_user=root
bmakexargs=
Home |
Main Index |
Thread Index |
Old Index