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

Argparsing again #44

Merged
merged 7 commits into from
May 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion bin/bootstrap
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ default_fermi_spack_tools_repo=https://github.com/FNALssi/fermi-spack-tools.git

parse_args() {
with_padding=""
if x=$(getopt --longoptions with_padding,help,query-packages,fermi_spack_tools_release:,spack_release:,spack_repo:,fermi_spack_tools_repo: -- x "$@")
if x=$(getopt --options "" --longoptions with_padding,help,query-packages,fermi_spack_tools_release:,spack_release:,spack_repo:,fermi_spack_tools_repo: -- "$@")
then
eval set : $x
shift
Expand Down
4 changes: 2 additions & 2 deletions bin/make_packages_yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ usage() {

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

while :
while : "$1"
do
case "x$1" in
x--help|x)
Expand Down
12 changes: 11 additions & 1 deletion bin/make_spack
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,14 @@ add_recipe_repos() {
git clone https://github.com/marcmengel/scd_recipes.git $SPACK_ROOT/var/spack/repos/scd_recipes
spack repo add --scope=site $SPACK_ROOT/var/spack/repos/scd_recipes

for rv in $repovers
do
IFS=":$IFS" set $rv
r=$1; v=$2
echo "checking out version $v in repository $r"
(cd $SPACK_ROOT/var/spack/repos/$r && git checkout $v)
done

# spack repo create $SPACK_ROOT/var/spack/repos/ups_to_spack
# spack repo add --scope=site $SPACK_ROOT/var/spack/repos/ups_to_spack
}
Expand Down Expand Up @@ -234,10 +242,11 @@ parse_args() {
padding=false
layout=unified
query_packages=false
repovers=""
verbose=false

origargs="$*"
if x=$(getopt --longoptions help,depth,with_padding,upgrade,spack_release:,minimal,no_buildcache,spack_repo:,query-packages --options mptuv -- : "$@")
if x=$(getopt --longoptions help,depth,with_padding,upgrade,spack_release:,minimal,no_buildcache,repover,spack_repo:,query-packages --options mptuv -- "$@")
then
eval set : $x
shift
Expand All @@ -256,6 +265,7 @@ parse_args() {
x--query-packages) query_packages=true; shift ;;
x--help) usage; exit;;
x--no_buildcache) use_buildcache=false; shift;;
x--repover) repovers="$repovers $2"; shift; shift;;
x-u) layout=unified; shift;;
x-t) layout=traditional; shift;;
x-p) layout=plain; shift;;
Expand Down
48 changes: 43 additions & 5 deletions bin/update_spack
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,50 @@ cat ${pkglist} |
do
echo "doing: $what $spec"
case $what in
i) spack find "$spec" || python $SPACK_ROOT/bin/spack buildcache install -a -o -m "$spec" ;;
t) cd $SPACK_ROOT/../../.. && tar xzf $spec; spack reindex;;
u) spack uninstall "$spec";;
U) un_ups_to_spack;;
i)
# install a spec by name/hash
spack find "$spec" || python $SPACK_ROOT/bin/spack buildcache install -o -m "$spec" ;;
e)
# install an environment by .../envname.spack.lock file or URL
ename=$(basename $spec | sed -e 's/.spack.lock$//')
case "x$spec" in
xhttps:*)
d=/tmp/d$$
mdkir $d
localf=$d/$(basename $spec)
wget -o $localf "$spec"
;;
*) localf="$spec"
;;
esac
spack env create $ename $localf
spack --env=$ename install
;;
r)
# remove a directory tree
case "x$spec" in
x|x/*) echo "skipping empty or absolute r entry" >&2 ;;
x*) cd $SPACK_ROOT/../../.. && rm -rf "$spec";;
esac
;;

t)
# unpack a tarfile
cd $SPACK_ROOT/../../.. && tar xzf $spec; spack reindex;;
u)
# uninstall something
spack uninstall "$spec";;

U)
# run un_ups_to_spack
un_ups_to_spack;;
*)
# who knows?
echo "unknown entry: $what $spec" >&2;;
esac

[ $? == 0 ] && echo "$what $spec" >> ${pkglist}.done || echo "$what $spec" >> ${pkglist}.failed

done

rm -f ${pkglist}
rm -f ${pkglist} /tmp/d$$
3 changes: 3 additions & 0 deletions bin/update_ups_to_spack
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
#!/bin/sh

#stubbed out for now
exit 0

spackbindir=`echo $0 | sed -e 's;update_ups_to_spack;;' `
case x$spackbindir in
x/*) ;;
Expand Down