Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fail on unknown args #39

Merged
merged 12 commits into from
May 14, 2024
11 changes: 9 additions & 2 deletions bin/bootstrap
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,15 @@ default_fermi_spack_tools_repo=https://github.com/FNALssi/fermi-spack-tools.git

parse_args() {
with_padding=""
eval set : $(getopt --longoptions with_padding,help,query-packages,fermi_spack_tools_release:,spack_release:,spack_repo:,fermi_spack_tools_repo: -- x "$@")
shift
if x=$(getopt --longoptions with_padding,help,query-packages,fermi_spack_tools_release:,spack_release:,spack_repo:,fermi_spack_tools_repo: -- x "$@")
then
eval set : $x
shift
else
usage
exit 1
fi

spack_repo=$default_spack_repo
fermi_spack_tools_repo=$default_fermi_spack_tools_repo
ver=$default_fermi_spack_tools_version
Expand Down
25 changes: 19 additions & 6 deletions bin/make_packages_yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,32 @@ x*/*) dir=`echo $0 | sed -e 's;\(.*\)/\([^/]*\);\1/..;'` ;;
x*) dir=.. ;;
esac

src=$dir/templates/packagelist
want_cvmfs=false
while :
do
case "x$1" in
x--help|x)
usage() {
echo "Usage: make_packages_yaml [options] spack_root [os]"
echo " options:"
echo " --help print this message"
echo " --with-externals include /cvmfs/fermilab.opensciencegrid.org/packages/external packages"
echo " --with-cvmfs=/a/b/c include other cvmfs externals"
echo " --debug turn on debugging messages"
echo " --packagelist=/a/b/c use custom package list"
}

src=$dir/templates/packagelist
want_cvmfs=false
if x=$(getopt --longoptions --long-options help,with-externals,with-cvmfs,debug,packagelist: -- "$@")
then
eval set : $x
shift
else
usage
exit 1
fi

while :
do
case "x$1" in
x--help|x)
usage
exit 0
;;
x--with-externals)
Expand Down
10 changes: 8 additions & 2 deletions bin/make_spack
Original file line number Diff line number Diff line change
Expand Up @@ -234,8 +234,14 @@ parse_args() {
verbose=false

origargs="$*"
eval set : $(getopt --longoptions help,depth,with_padding,upgrade,spack_release:,minimal,no_buildcache,spack_repo:,query-packages --options mptuv -- : "$@")
shift
if x=$(getopt --longoptions help,depth,with_padding,upgrade,spack_release:,minimal,no_buildcache,spack_repo:,query-packages --options mptuv -- : "$@")
then
eval set : $x
shift
else
usage
exit 1
fi
while echo x$1 | grep x- > /dev/null
do
case "x$1" in
Expand Down
10 changes: 8 additions & 2 deletions bin/make_subspack
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,14 @@ parse_args() {
verbose=false
plain=false

eval set : $(getopt --longoptions with_padding,spack_release:,spack_repo,local_env:,dev_pkgs: --options vtup -- "$@")
shift
if x=$(getopt --longoptions with_padding,spack_release:,spack_repo,local_env:,dev_pkgs: --options vtup -- "$@")
then
eval set : $x
shift
else
usage
exit 1
fi

while echo x$1 | grep x- > /dev/null
do
Expand Down
6 changes: 4 additions & 2 deletions bin/ups_to_spack
Original file line number Diff line number Diff line change
Expand Up @@ -1913,7 +1913,7 @@ use_spack = []
# just pick off any leading "--" options
#
while sys.argv[1][:2] == "--":
print("parsing: %s" % repr(sys.argv))
#print("parsing: %s" % repr(sys.argv))
if sys.argv[1][:6] == "--pdr=" :
pdr = sys.argv[1][6:]
#print("pdr=%s" % pdr)
Expand All @@ -1930,14 +1930,16 @@ while sys.argv[1][:2] == "--":

else:
print("Unknown flag %s" % sys.argv[1])
usage()
exit(1)

sys.argv = sys.argv[:1] + sys.argv[2:]

uts = ups_to_spack(pdr=pdr)

if not os.path.exists("/tmp/empty.tar"):
d = os.path.dirname(os.path.dirname(__file__))
os.system("cp {0}/templates/emtpy.tar /tmp/empty.tar".format(d))
os.system("cp {0}/templates/empty.tar /tmp/empty.tar".format(d))

# handle --use_spack args: prepopulate conversion cache
for us in use_spack:
Expand Down