Skip to content

Commit

Permalink
First attempt at AL9 support (#27)
Browse files Browse the repository at this point in the history
* First attempt at AL9 support

* More tweaks to packages.yaml generation
  • Loading branch information
greenc-FNAL authored Apr 28, 2023
1 parent dd91ffb commit eaa452b
Show file tree
Hide file tree
Showing 2 changed files with 70 additions and 64 deletions.
118 changes: 62 additions & 56 deletions bin/make_packages_yaml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ optf=$dir/templates/package_opts
dst=$1/etc/spack/$os/packages.yaml

# packages to make not buildable
force_system='^(bdftopcf|damageproto|diffutils|expat|findutils|font-util|gdbm|gettext|libc|libfontenc|libice|libx11|libxau|libxcb|libxdamage|libxdmcp|libxext|libxfixes|libxfont|libxxmu|libxpm|libxrandr|libxrender|libxshmfence|libxt|libxv|libxvmc|libxxf86vm|mesa-glu|mkfontdir|mkfontscale|openssl|pkg-config|tar|tcl|tk|xextproto|xorg-server|xproto|xproxymanagementprotocol|xrandr|xtrans|zlib)$'
force_system='^(bdftopcf|damageproto|diffutils|expat|findutils|font-util|gdbm|gettext|libc|libfontenc|libice|libx11|libxau|libxcb|libxdamage|libxdmcp|libxext|libxfixes|libxfont|libxxmu|libxpm|libxrandr|libxrender|libxshmfence|libxt|libxv|libxvmc|libxxf86vm|mesa-glu|mkfontdir|mkfontscale|openssl|pkg-config|pkgconf|tar|tcl|tk|xextproto|xorg-server|xproto|xproxymanagementprotocol|xrandr|xtrans|zlib)$'

# packages to force target (instead of merely preferred)
force_x86_64='^(hwloc|libpciaccess|libsigsegv)$'
Expand All @@ -72,72 +72,77 @@ runversion() {
then
cmd=`ls /usr/bin/python* | grep -v config | tail -1`
fi
(PATH=/bin:/usr/bin; $cmd --version || $cmd -v) < /dev/null 2>&1 |
strings |
sed -e 's/\+*//' -e 's/64.bit//' |
grep -i $1 |
(PATH=/bin:/usr/bin; $cmd --version || $cmd -v) < /dev/null 2>&1 |
strings |
sed -e 's/\+*//' -e 's/64.bit//' |
grep -i $1 |
egrep -iv 'error:|for help|not found|illegal|invalid|usage:|--version|-v' |
head -1 | $teeit |
perl -pe 's{(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec|/).*}{};' |
sed -e "s/$1//ig" -e 's/-[0-9].*//' | $teeit |
sed -e "s/$1//ig" -e 's/-[0-9].*//' | $teeit |
sed -e 's/^.*[^0-9.]\([0-9][0-9]*\.[0-9.kp]*\).*$/\1/' | $teeit
fi
}

# define getv depending on platform
# for linux distros, prefer the apt/rpm version...
case `uname -s` in
Linux)
case `lsb_release -i` in
*Ubuntu)
: ubuntu case
getv() {
apt list $1 2>/dev/null | grep '\[installed\]'| sed -e 's/[^ ]* //' -e 's/.*://' -e 's/[+-].*//' || runversion $1
}
;;
*Scientific*|*Centos*|*CentOS*|*RedHat*|*Alma*)
if [ x$RPMCACHE != x ]
then
maybe_define_getv() {
case $1 in
ubuntu)
: ubuntu case
getv() {
apt list $1 2>/dev/null | grep '\[installed\]'| sed -e 's/[^ ]* //' -e 's/.*://' -e 's/[+-].*//' || runversion $1
}
;;
almalinux|centos|fedora|rhel|scientific)
if [ x$RPMCACHE != x ]
then
getv() {
grep "^$1-[0-9]" $RPMCACHE | tail -1 | grep -v 'is not installed' |
sed -e 's/.*-\([0-9][0-9.kp]*\)-[0-9][0-9.]*\..*/\1/' ||
runversion $1
grep -Ee "^$1-[0-9]" $RPMCACHE | tail -1 | grep -v 'is not installed' |
sed -e 's/.*-\([0-9][0-9.kp]*\)-[0-9][0-9.]*\..*/\1/' ||
runversion $1
}
else
else
getv() {
rpm -q $1 | tail -1 | grep -v 'is not installed' |
sed -e 's/.*-\([0-9][0-9.kp]*\)-[0-9][0-9.]*\..*/\1/' ||
runversion $1
rpm -q "$1" | tail -1 | grep -v 'is not installed' |
sed -e 's/.*-\([0-9][0-9.kp]*\)-[0-9][0-9.]*\..*/\1/' ||
runversion $1
}
fi
fi
;;
esac
}

# define getv depending on platform
# for linux distros, prefer the apt/rpm version...
. /etc/os-release 2>/dev/null
[ -n "$ID" ] || ID=`lsb_release -i 2>/dev/null | cut -f 2- | tr '[A-Z]' '[a-z]'`
for os_id in $ID $ID_LIKE; do
maybe_define_getv $os_id
[ "`type -t getv`" == "function" ] && break
done
if [ "`type -t getv`" != "function" ]; then
: generic / darwin case
getv() {
case x$1 in
xautotools)
runversion automake
;;
xlibtool)
# looks like a library, but its not...
runversion $1
;;
xtcl)
# it's tclsh not tcl, AND it doesn't take --version...
echo info patchlevel | tclsh
;;
xlib*)
otool -L /usr/lib/$1 | grep "$1.*current version" | sed -e 's/.*version//' -e 's/)//'
;;
x*)
runversion $1
;;
esac
;;
*)
: generic / darwin case
getv() {
case x$1 in
xautotools)
runversion automake
;;
xlibtool)
# looks like a library, but its not...
runversion $1
;;
xtcl)
# its tclsh not tcl, AND it doesn't take --version...
echo info patchlevel | tclsh
;;
xlib*)
otool -L /usr/lib/$1 | grep "$1.*current version" | sed -e 's/.*version//' -e 's/)//'
;;
x*)
runversion $1
;;
esac
}
;;
esac
}
fi

getv2() {
# more robust getv that does the generic getv, but also tries runversion
Expand All @@ -148,10 +153,10 @@ getv2() {

# some xyzproto packages are rolled up into the xorgproto RPM, but have documented versions...
case "$2" in
*proto*)
*proto*)
ff=/usr/share/doc/xorgproto/$2.txt
[ -r $ff ] && x=`grep Version $ff | head -1 | sed -e 's/.*Version //'`
;;
;;
esac
if [ "$x" = "" ]
then
Expand Down Expand Up @@ -232,6 +237,7 @@ cat <<EOF >&3
- torque
pkgconfig:
- pkg-config
- pkgconf
blas:
require: openblas
fftw-api:
Expand Down
16 changes: 8 additions & 8 deletions templates/packagelist
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ asciidoc:asciidoc:$0
autoconf:autoconf:$0
autogen:autogen:$0
automake:automake:$0
xorg-x11-font-utils:bdftopcf:$0
(xorg-x11-font-utils|bdftopcf):bdftopcf:$0
libdb:berkeley-db:$0-devel
binutils:binutils:$0
bison:bison:$0
Expand All @@ -31,7 +31,7 @@ diffutils:diffutils:$0
expat:expat:$0-devel
findutils:findutils:$0
flex:flex:$0
xorg-x11-font-utils:font-util:$0
xorg-x11-(font-)?utils:font-util:$0
fontconfig:fontconfig:$0-devel
freetype:freetype:$0-devel
gawk:gawk:$0
Expand All @@ -41,7 +41,7 @@ gettext:gettext:$0-devel
git:git:$0
make:gmake:$0
gperf:gperf:$0
groff-base:groff:$0
groff:groff:$0
help2man:help2man:$0
condor:htcondor:$0
htgettoken:htgettoken:$0
Expand Down Expand Up @@ -76,8 +76,8 @@ m4:m4:$0
mesa-libGLU:mesa-glu:$0-devel
mesa-libGL:mesa:$0-devel
meson:meson:$0
xorg-x11-font-utils:mkfontdir:$0
xorg-x11-font-utils:mkfontscale:$0
(xorg-x11-font-utils|mkfontscale):mkfontdir:$0
(xorg-x11-font-utils|mkfontscale):mkfontscale:$0
mpich(-[0-9.]+)?:mpich:$0-devel
nasm:nasm:$0
ninja-build:ninja:$0
Expand All @@ -86,9 +86,9 @@ openssh-clients:openssh:$0
(openssl[0-9a-z]*)-libs:openssl:\1-devel
patchelf:patchelf:$0
perl:perl:$0-devel
pkgconf-pkg-config:pkg-config:$0
pkgconfig:pkg-config:$0
python3[0-9]*:python:$0-devel
(pkg-config|pkgconf-pkg-config):pkg-config:$0
pkgconf:pkgconf:$0
python[0-9]*:python:$0-devel
readline:readline:$0-devel
tar:tar:$0
tcl:tcl:$0-devel
Expand Down

0 comments on commit eaa452b

Please sign in to comment.