Skip to content

Commit

Permalink
Add sos, ovis split build for v4 rhel
Browse files Browse the repository at this point in the history
  • Loading branch information
baallan committed Jun 22, 2019
1 parent f394e44 commit ff7c083
Show file tree
Hide file tree
Showing 10 changed files with 416 additions and 90 deletions.
82 changes: 79 additions & 3 deletions support/package-functions
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,21 @@ function pack_checkfiles {
return $bad
}

# fail none of the files is found
function pack_checkfiles_none {
local bad=1
for i in $*; do
if test -f $i; then
echo File $i found.
bad=0
break
else
echo " No file $i"
fi
done
return $bad
}

# fail and warn if any dir given is missing or not dir.
function pack_checkdirs {
local bad=0
Expand All @@ -41,6 +56,21 @@ function pack_checkdirs {
return $bad
}

# fail and warn if none of the directories is found.
function pack_checkdirs_none {
local bad=1
for i in $*; do
if test -d $i; then
bad=0
echo Directory $i found.
break
else
echo " No directory $i"
fi
done
return $bad
}

# cray gpcd check
function pack_ck_gpcd {
if ! test -f gpcd-support/configure.ac; then
Expand Down Expand Up @@ -159,15 +189,29 @@ function pack_ck_pydev {

# python numeric check
function pack_ck_numpy {
pack_checkdirs /usr/include/numpy
pack_checkdirs_none /opt/numpy /usr/include/numpy
x=$?
echo missing package numpy or equivalent
if test "$x" != "0"; then
echo missing package numpy or equivalent
fi
return $?
}

# sosdb check
function pack_ck_sosdb {
# need to extract with value here from options and check there instead of /usr
pack_checkdirs_none /usr/include/sos
x=$?
if test "$x" != "0"; then
echo missing package sosdb
echo may need to firerpms.sos and install sosdb.
fi
return $?
}

# cython check
function pack_ck_cython {
pack_checkfiles /usr/bin/cython
pack_checkfiles_none /opt/cython/0.28.5/bin/cython /usr/bin/cython
x=$?
if test "$x" != "0"; then
echo missing package Cython or equivalent
Expand Down Expand Up @@ -299,6 +343,38 @@ function pack_prechecks {
x=$?
bad=$(( $bad + $x))
fi
if echo "$*" | grep with-sos >/dev/null; then
echo Checking some for sosdb install
pack_ck_sosdb
x=$?
bad=$(( $bad + $x))
fi
fi
if test "$bad" = "0"; then
echo "Looks ok, but configure may still fail for advanced plugins."
fi
return $bad
}

# We do these to short circuit wasting make dist and configure time on
# things that rpm Requires/BuildRequires will ultimately catch.
function pack_prechecks_sos {
echo Making cheap checks for prerequisites based on configure options.
local bad=0
pack_ck_rpmbuild
x=$?
bad=$(( $bad + $x))
pack_ck_rpath
x=$?
bad=$(( $bad + $x))
if echo "$*" | grep enable-python >/dev/null; then
echo Checking some sos python ui dependencies
pack_ck_cython
x=$?
bad=$(( $bad + $x))
pack_ck_numpy
x=$?
bad=$(( $bad + $x))
fi
if test "$bad" = "0"; then
echo "Looks ok, but configure may still fail for advanced plugins."
Expand Down
6 changes: 6 additions & 0 deletions v41.rhel7.unstable/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,9 @@ sos
*.spec
*.tar
*.gz
firerpms.orig
ovisdeps
ovisfiles
sosdeps
sosfiles
sos-*.unstable.spec
74 changes: 28 additions & 46 deletions v41.rhel7.unstable/firerpms
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,22 @@
#
#
packing=v41.rhel7.unstable
ovis_branch=gender_scripts_upport_v3bugfixes
sos_branch=master
NetworkRequires=gitlab.opengridcomputing.com
[email protected].com:tom/SOS.git
OVISREPO=[email protected].com:baallan/ovis.git
ovis_branch=OVIS-4.2.3
sospkg= ; # if set empty, disable sos in ldms
sospkg=sosdb-4.2.1
NetworkRequires=github.com
OVISREPO=git@github.com:ovis-hpc/ovis.git

. ../support/package-functions

if test -n "$sospkg"; then
USESOS="--enable-sos"
SOS_OPTS="--with-sos=/usr"
else
USESOS="--disable-sos"
SOS_OPTS=""
fi

prefix=/usr
PACK_OPTS="
--disable-rpath
Expand Down Expand Up @@ -42,16 +50,13 @@ IFACE_OPTS="
--enable-libgenders
--enable-genderssystemd
"
BALER_OPTS="
--disable-baler
"
STORE_OPTS="
--disable-sos
$USESOS
--enable-flatfile
--enable-csv
--enable-store
--disable-rabbitv3
--enable-rabbitkw
--disable-rabbitkw
"
SAMPLER_OPTS="
--disable-cray_power_sampler
Expand Down Expand Up @@ -86,7 +91,7 @@ SAMPLER_OPTS="
--enable-slurmtest
--enable-filesingle
"
allconfig="$PACK_OPTS $SECURITY_OPTS $NETWORK_OPTS $IFACE_OPTS $STORE_OPTS $SAMPLER_OPTS $CRAY_LOCATIONS"
allconfig="$PACK_OPTS $SECURITY_OPTS $NETWORK_OPTS $IFACE_OPTS $STORE_OPTS $SAMPLER_OPTS $CRAY_LOCATIONS $SOS_OPTS"

if ! pack_prechecks "$allconfig"; then
echo "Check dependencies listed above, install needed packages, and try again"
Expand All @@ -103,7 +108,6 @@ else
fi

specdir=$dn
SOSTAR=sos.tar

/bin/rm -rf ovis
if ! git clone $OVISREPO ovis; then
Expand All @@ -116,32 +120,15 @@ if ! git checkout $ovis_branch; then
echo cannot checkout ovis branch $ovis_branch.
exit 1
fi
if test -n "$SOSREPO"; then
(cd .. ; /bin/rm -rf sos ;
if ! git clone $SOSREPO sos; then
echo cannot checkout SOS.
exit 1
else
(cd sos; if ! git checkout $sos_branch; then
echo "cannot checkout sos branch $sos_branch";
exit 1
fi )
tar cf $SOSTAR sos
fi
/bin/rm -rf sos
if ! test -f ../$SOSTAR; then
echo archive $SOSTAR must be next to source tree.
exit 1
fi
)
else
git submodule init sos && git submodule update sos && tar cf ../$SOSTAR sos
fi
cd ..

if ! test -f ../$SOSTAR; then
echo failed to download sos
exit 1
fi

cd ovis
patches="lib-sos-incdir ldms-sos-incdir lib-python-touch"
for i in $patches; do
patch -p1 < ../patches/$i
git commit -a -m "add $packing distribution patches: $i"
done
VERSION=$(pack_get_ac_version configure.ac)
PACKAGE=$(pack_get_ac_name configure.ac)
# Find SHA of latest checkin someone tagged
Expand All @@ -157,17 +144,16 @@ OUTPUT_DIR=`pwd`/Tars
mkdir -p $OUTPUT_DIR
# populate outdir inputs
git archive --prefix=${PACKAGE=}-${VERSION}/ $COMMIT_ID --format=tar --output=${OUTPUT_DIR}/$TARGET
cd ..

sleep 0.1
cp ../$SOSTAR $OUTPUT_DIR

cd $OUTPUT_DIR

# Untar archive
echo "Untarring archive"
tar xf $TARGET && \
(cd ${PACKAGE}-${VERSION} && \
tar xf ../$SOSTAR && \
mkdir -p gpcd-support/m4 && \
./autogen.sh)
if ! test -f ${PACKAGE}-${VERSION}/configure; then
echo "unable to generate ovis build files"
Expand All @@ -183,7 +169,7 @@ tar czf $TARGET.gz $TAR_OPTS ${PACKAGE}-${VERSION}
echo "Relocating cruft"
rm -rf old
mkdir old
mv -f ${PACKAGE}-${VERSION} $TARGET $SOSTARGET old
mv -f ${PACKAGE}-${VERSION} $TARGET old
specfile=tmp-ovis-${packing}.spec
tar zxf $TARGET.gz && \
cd ${PACKAGE}-${VERSION} && \
Expand All @@ -195,11 +181,7 @@ mkdir -p $packing/{BUILD,RPMS,SOURCES,SPECS,SRPMS} && \
cp $TARGET.gz $packing/SOURCES && \
./config.status --file=-:$specdir/ovis.spec.in | \
./ldms/config.status --file=-:- | \
./lib/config.status --file=$specdir/tmp-ovis-${packing}.spec:- && \
if test -f sos/config.status; then
./sos/config.status --file=$specdir/ovis-${packing}.spec:$specdir/$specfile
specfile=ovis-${packing}.spec
fi && \
./lib/config.status --file=$specdir/$specfile:- && \
rpmbuild -v --define "_topdir `pwd`/$packing" -ba $specdir/$specfile && \
touch completed
if ! test -f completed; then
Expand Down
112 changes: 112 additions & 0 deletions v41.rhel7.unstable/firerpms.sos
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
#!/bin/bash
#
#
packing=v41.rhel7.unstable
sos_branch=ovis-4.2.3
NetworkRequires=github.com
[email protected]:ovis-hpc/sos.git

. ../support/package-functions

prefix=/usr
PACK_OPTS="
--disable-static
--prefix=$prefix
"
DOC_OPTS="
--enable-doc
--enable-doc-html
--enable-doc-man
--enable-doc-graph
"

IFACE_OPTS="
--enable-python
"

allconfig="$PACK_OPTS $IFACE_OPTS $DOC_OPTS"

if ! pack_prechecks_sos "$allconfig"; then
echo "Check dependencies listed above, install needed packages, and try again"
exit 1
fi

dn=$(pwd)
bn=$(basename $dn)
if test "$bn" = "$packing" -a -f sos.spec.in; then
: in the right place
else
echo This must be run from $packing, which should be clean and at any rate will be overwritten.
exit 1
fi

specdir=$dn
SOSTAR=sos.tar

/bin/rm -rf sos
if ! git clone $SOSREPO sos; then
echo cannot checkout sos
exit 1
fi

cd sos
if ! git checkout $sos_branch; then
echo cannot checkout sos branch $sos_branch
exit 1
fi

VERSION=$(pack_get_ac_version configure.ac)
PACKAGE=$(pack_get_ac_name configure.ac)
# Find SHA of latest checkin someone tagged
COMMIT_ID="$(git log -1 --pretty="%H")"
BASE_COMMIT_ID="$(git rev-parse $ovis_branch)"

# Get most recent tag id for this branch
TAG_ID="$(git describe --tags --abbrev=0)"
TARGET=${PACKAGE}-${VERSION}.tar
REPO_DIR=`pwd`
OUTPUT_DIR=`pwd`/Tars
# Create output dir
mkdir -p $OUTPUT_DIR
# populate outdir inputs
git archive --prefix=${PACKAGE=}-${VERSION}/ $COMMIT_ID --format=tar --output=${OUTPUT_DIR}/$TARGET
cd ..

cd $OUTPUT_DIR

# Untar archive and generate build files
echo "Untarring archive"
tar xf $TARGET && \
(cd ${PACKAGE}-${VERSION} && \
./autogen.sh)
if ! test -f ${PACKAGE}-${VERSION}/configure; then
echo "unable to generate sos build files"
exit 1
fi

tar czf $TARGET.gz ${PACKAGE}-${VERSION}

echo "Relocating cruft"
rm -rf old
mkdir old
mv -f ${PACKAGE}-${VERSION} $TARGET old
specfile=sos-${packing}.spec
tar zxf $TARGET.gz && \
cd ${PACKAGE}-${VERSION} && \
echo "================ configure for $packing rpms =============" && \
./configure CC=gcc CXX=g++ $allconfig && \
echo "============================= make $packing rpms =============" && \
make dist-gzip && \
mkdir -p $packing/{BUILD,RPMS,SOURCES,SPECS,SRPMS} && \
cp $TARGET.gz $packing/SOURCES && \
./config.status --file=$specdir/$specfile:$specdir/sos.spec.in && \
rpmbuild -v --define "_topdir `pwd`/$packing" -ba $specdir/$specfile && \
touch completed
if ! test -f completed; then
echo FAIL
else
echo PASS
cd $dn
echo the droids you seek may be:
find . -name '*.rpm'
fi
6 changes: 4 additions & 2 deletions v41.rhel7.unstable/inventory.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
# this dumps the file lists and dependency lists
# for the generated rpms
for i in ./ovis/Tars/ovis-4.*/v41.rhel7.unstable/RPMS/x86_64/*rpm; do echo $i; echo $i; rpm -qp --requires $i; echo; done > plist
for i in ./ovis/Tars/ovis-4.*/v41.rhel7.unstable/RPMS/x86_64/*rpm; do echo $i; echo $i; rpm -qpl $i; echo; done > rlist
for i in ./sos/Tars/sosdb-4.*/v41.rhel7.unstable/RPMS/x86_64/*rpm; do echo $i; echo $i; rpm -qp --requires $i; echo; done > sosdeps
for i in ./sos/Tars/sosdb-4.*/v41.rhel7.unstable/RPMS/x86_64/*rpm; do echo $i; echo $i; rpm -qpl $i; echo; done > sosfiles
for i in ./ovis/Tars/ovis-4.*/v41.rhel7.unstable/RPMS/x86_64/*rpm; do echo $i; echo $i; rpm -qp --requires $i; echo; done > ovisdeps
for i in ./ovis/Tars/ovis-4.*/v41.rhel7.unstable/RPMS/x86_64/*rpm; do echo $i; echo $i; rpm -qpl $i; echo; done > ovisfiles
Loading

0 comments on commit ff7c083

Please sign in to comment.