diff --git a/Makefile.am b/Makefile.am index e899718..57f4e15 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,7 +1,7 @@ ############################################################################# # Makefile.am for GammaLib package # # ------------------------------------------------------------------------- # -# Copyright (C) 2016 Juergen Knoedlseder # +# Copyright (C) 2016-2017 Juergen Knoedlseder # # ------------------------------------------------------------------------- # # # # This program is free software: you can redistribute it and/or modify # @@ -149,8 +149,7 @@ pkgcheck: case `lsb_release -irs` in \ CentOS*) \ echo "CentOS supported"; \ - dev/pkgcheck-centos.sh $(PACKAGE_NAME) $(PACKAGE_VERSION) x86_64 NA ; \ - dev/pkgcheck-centos.sh $(PACKAGE_NAME) $(PACKAGE_VERSION) i386 NA ; \ + dev/pkgcheck-centos.sh $(PACKAGE_VERSION); \ ;; \ Fedora*) \ echo "Fedora supported"; \ diff --git a/dev/pkgbuild-centos.sh b/dev/pkgbuild-centos.sh index 756d45e..73b5801 100755 --- a/dev/pkgbuild-centos.sh +++ b/dev/pkgbuild-centos.sh @@ -2,7 +2,7 @@ # ========================================================================== # gammalib CentOS package creation # -# Copyright (C) 2017 Sylvie Brau-Nogué +# Copyright (C) 2017 Sylvie Brau-Nogue # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -17,14 +17,6 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . # -# ------------------------------------------------------------------------- -# -# This script installs the ctools and GammaLib packages in the location -# /usr/local/gamma and then builds a CentOS rpm package. -# Any existing content in /usr/local/gamma will be -# destroyed. The script needs the priviledges to create a folder in -# /usr/local. -# # ========================================================================== # ====================================== # @@ -38,6 +30,14 @@ VERSION=$1 PLATFORM=`uname -m` +# =============================== # +# Set software component versions # +# =============================== # +PACKNAME=gammalib +PACKAGE=$PACKNAME-$VERSION +RELEASE=1 + + # ====== # # Header # # ====== # @@ -46,13 +46,6 @@ echo "Build $PACKNAME rpm package, Version $VERSION, Platform $PLATFORM" echo "=================================================================" -# =============================== # -# Set software component versions # -# =============================== # -PACKNAME=gammalib -PACKAGE=$PACKNAME-$VERSION -RELEASE=1 - # ============== # # Set parameters # # ============== # @@ -105,7 +98,7 @@ echo "====================================================" echo "Packaging DONE" echo " " echo "New binary packages are located in $PRODDIR" -for package in $(find $PRODDIR -iname '*.rpm' ); do +for package in $(find $PRODDIR -iname '*.rpm' ); do echo "rpm file : $package" echo "====================================================" rpm -qip $package diff --git a/dev/pkgcheck-centos.sh b/dev/pkgcheck-centos.sh index 5375df2..b1566b4 100755 --- a/dev/pkgcheck-centos.sh +++ b/dev/pkgcheck-centos.sh @@ -2,7 +2,7 @@ # ========================================================================== # gammalib CentOS package validation # -# Copyright (C) 2017 Sylvie Brau-Nogué +# Copyright (C) 2017 Sylvie Brau-Nogue # # This program is free software: you can redistribute it and/or modify # it under the tesudo rms of the GNU General Public License as published by @@ -17,201 +17,63 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . # -# ------------------------------------------------------------------------- -# -# This script tests a CentOS package prior to release. It is assumed that -# the package has been installed in a local directory $LOCALINSTALL/gammalib. # ========================================================================== -# ============================================= # -# Get ctools/GammaLib version from command line # -# ============================================= # -if [ $# -ne 4 ] ; then -echo "Please specify package name version platform in the form 'package x.y.z platform '" -exit 1 +# ====================================== # +# Get GammaLib version from command line # +# ====================================== # +if [ $# -ne 1 ] ; then + echo "Please specify GammaLib in the form 'x.y.z'" + exit 1 fi -PACKNAME=$1 -VERSION=$2 -PLATFORM=$3 -GVERSION=$4 +VERSION=$1 +PLATFORM=`uname -m` -echo " ================================================================= " -echo " Check $PACKNAME rpm package, Version $VERSION, Platform $PLATFORM " -echo " ================================================================= " # =============================== # # Set software component versions # # =============================== # -#CFITSIO=cfitsio3410 -#NCURSES=ncurses-5.9 -#READLINE=readline-6.3 -CFITSIO=cfitsio -NCURSES=ncurses -READLINE=readline -# +PACKNAME=gammalib PACKAGE=$PACKNAME-$VERSION -# TODO : next step to fix RELEASE is not updated for now RELEASE=1 -# ==================================================== # -# TODO : Create a secure RPM repository -# Temporary solution, to be fixed -# ==================================================== # -YUMREPO=$HOME/YUM-REPO + +# ====== # +# Header # +# ====== # +echo "=================================================================" +echo "Check $PACKNAME rpm package, Version $VERSION, Platform $PLATFORM" +echo "=================================================================" + # ============== # # Set parameters # # ============== # -# -# System Configuration Hypothesis with file ~/.rpmmacros. -# This file must contain at least the follwing lines : -# %packager KNODLSEDER -# %_topdir %(echo $HOME)/rpmbuild -# %_tmppath %(echo $HOME)/rpmbuild/tmp -# %_smp_mflags -j3 -# %__arch_install_post /usr/lib/rpm/check-rpaths /usr/lib/rpm/check-buildroot -# -# -# SBN : Liste à fixer. -TMPDIR=$HOME/usr -WRKDIR=$HOME/pkg_check -SRCDIR=$WRKDIR/SOURCES -PKGDIR=$WRKDIR/RPMS +WRKDIR=$PWD/rpm_check +RPMDB=$WRKDIR/rpmdb +RPMFILE=$PACKAGE-$RELEASE.*$PLATFORM.rpm -# ========================================================================= # -# Fix packages directory # -# ========================================================================= # -# If 'make pkg' produce multi-platform rpm, rpm files will be archived in $YUMREPO directory -#PRODDIR=$WRKDIR/RPMS/$PLATFORM -PRODIR=$YUMREPO -# -RPMFILE=$PRODIR/$PACKAGE-$RELEASE.*$PLATFORM.rpm -# -# ========================================================================= # -# Install package in local directory # -# ========================================================================= # -# 2 options with rpm # -# --relocate = relocate files from path to # -#sudo rpm -U --relocate=$INSTALLDIR=$LOCALINSTALL $RPMFILE &> $LOGRPMFILE # -# or # -# --prefix= relocate the package to , if relocatable # -# ========================================================================= # -INSTALLDIR=/usr/local/gamma -# LOCALINSTALL=$WRKDIR$INSTALLDIR # <= another option, not selected for the moment -LOCALINSTALL=$HOME/$INSTALLDIR -# -LOGFILE=$WRKDIR/pkg_check.log -LOGRPMFILE=$WRKDIR/pkg_check_rpm.log # ========================= # -# Clean temporary directory # +# Create local rpm database # # ========================= # -rm -rf $TMPDIR +rpm --initdb --root $RPMDB -# ============================= # -# Secure installation directory # -# ============================= # -if [ -d "$LOCALINSTALL/$PACKNAME" ]; then - mv $LOCALINSTALL/$PACKNAME $LOCALINSTALL/$PACKNAME.backup -fi -# ======================= # -# Clean working directory # -# ======================= # -sudo rm -rf $WRKDIR +# ======================== # +# Install GammaLib package # +# ======================== # +rpm --dbpath $RPMDB --nodeps --prefix=$WRKDIR -i $RPMFILE -# ====================================== # -# Create and step into working directory # -# ====================================== # -mkdir -p $WRKDIR -cd $WRKDIR - -if ! rpm -qa | grep -q ncurses; then - echo "ncurses need to be installed" - sudo yum install ncurses - if ! rpm -qa | grep -q ncurses; then - echo "=================================================================================================" - echo "ERROR : ncurses need to be installed manually" - echo "=================================================================================================" - exit - fi -fi -v=$(rpm --qf '%{VERSION}\n' -q ncurses) -echo "ncurses $v checked" -if ! rpm -qa | grep -q readline; then - echo "readline need to be installed" - sudo yum install readline - if ! rpm -qa | grep -q readline; then - echo "=================================================================================================" - echo "ERROR : readline need to be installed manually" - echo "=================================================================================================" - exit - fi -fi -v=$(rpm --qf '%{VERSION}\n' -q readline) -echo "readline $v checked" +# ========================== # +# Configure GammaLib package # +# ========================== # +export LD_LIBRARY_PATH=$WRKDIR/lib:$LD_LIBRARY_PATH +export PYTHONPATH=$WRKDIR/lib64/python2.7/site-packages:$PYTHONPATH -if ! rpm -qa | grep -q cfitsio; then - echo "cfitsio need to be installed" - sudo yum install cfitsio-devel - if ! rpm -qa | grep -q cfitsio; then - echo "=================================================================================================" - echo " ERROR : cfitsio need to be installed" - echo "=================================================================================================" - echo "You can download the latest version of CFITSIO on http://heasarc.gsfc.nasa.gov/fitsio/fitsio.html" - echo " " - echo "or " - echo " " - echo "cfitsio rpm can be found in the epel-release repository ; Try : sudo yum install cfitsio-devel" - echo " " - echo "=================================================================================================" - exit - fi -fi -v=$(rpm --qf '%{VERSION}\n' -q cfitsio) -echo "cfitsio $v checked" - -# ======================================================================= # -# Finally install package $HOME/$YUMREPO/$PACKAGE-$RELEASE-*$PLATFORM.rpm # -# ======================================================================= # -if ! sudo rpm -U --prefix=/$LOCALINSTALL $RPMFILE &> $LOGRPMFILE ; then - echo "=================================================================================================" - echo "ERROR : Cannot install $PACKAGE package" - echo "=================================================================================================" - cat $LOGRPMFILE - echo " " - echo "=================================================================================================" - exit -fi - -# ================= # -# Configure package # -# ================= # -export GAMMALIB=$LOCALINSTALL/$PACKNAME -source $GAMMALIB/bin/$PACKNAME-init.sh -ARCH=`lsb_release -irs` # ============ # # Test package # # ============ # -# TODO : update following section with consistent set of tests -python -c 'import gammalib; gammalib.test()' | tee -a $LOGFILE - -# ======================= # -# Uninstall package # -# ======================= # -sudo yum remove $PACKNAME - -# ======================= # -# Clean package directory # -# ======================= # -sudo rm -rf $TMPDIR - -# ============================== # -# Recover installation directory # -# ============================== # -if [ -d "$LOCALINSTALL/$PACKNAME.backup" ]; then - mv $LOCALINSTALL/$PACKNAME.backup $LOCALINSTALL/$PACKNAME -fi - +python -c 'import gammalib; gammalib.test()'