Commit 79e8652bb6a317fbd5c90ac081176f67a8ea903b
1 parent
c08d7999
Adapt CentOS package check
Showing
3 changed files
with
45 additions
and
191 deletions
Makefile.am
| 1 | ############################################################################# | 1 | ############################################################################# |
| 2 | # Makefile.am for GammaLib package # | 2 | # Makefile.am for GammaLib package # |
| 3 | # ------------------------------------------------------------------------- # | 3 | # ------------------------------------------------------------------------- # |
| 4 | -# Copyright (C) 2016 Juergen Knoedlseder # | 4 | +# Copyright (C) 2016-2017 Juergen Knoedlseder # |
| 5 | # ------------------------------------------------------------------------- # | 5 | # ------------------------------------------------------------------------- # |
| 6 | # # | 6 | # # |
| 7 | # This program is free software: you can redistribute it and/or modify # | 7 | # This program is free software: you can redistribute it and/or modify # |
| @@ -149,8 +149,7 @@ pkgcheck: | @@ -149,8 +149,7 @@ pkgcheck: | ||
| 149 | case `lsb_release -irs` in \ | 149 | case `lsb_release -irs` in \ |
| 150 | CentOS*) \ | 150 | CentOS*) \ |
| 151 | echo "CentOS supported"; \ | 151 | echo "CentOS supported"; \ |
| 152 | - dev/pkgcheck-centos.sh $(PACKAGE_NAME) $(PACKAGE_VERSION) x86_64 NA ; \ | ||
| 153 | - dev/pkgcheck-centos.sh $(PACKAGE_NAME) $(PACKAGE_VERSION) i386 NA ; \ | 152 | + dev/pkgcheck-centos.sh $(PACKAGE_VERSION); \ |
| 154 | ;; \ | 153 | ;; \ |
| 155 | Fedora*) \ | 154 | Fedora*) \ |
| 156 | echo "Fedora supported"; \ | 155 | echo "Fedora supported"; \ |
dev/pkgbuild-centos.sh
| @@ -2,7 +2,7 @@ | @@ -2,7 +2,7 @@ | ||
| 2 | # ========================================================================== | 2 | # ========================================================================== |
| 3 | # gammalib CentOS package creation | 3 | # gammalib CentOS package creation |
| 4 | # | 4 | # |
| 5 | -# Copyright (C) 2017 Sylvie Brau-Nogué | 5 | +# Copyright (C) 2017 Sylvie Brau-Nogue |
| 6 | # | 6 | # |
| 7 | # This program is free software: you can redistribute it and/or modify | 7 | # This program is free software: you can redistribute it and/or modify |
| 8 | # it under the terms of the GNU General Public License as published by | 8 | # it under the terms of the GNU General Public License as published by |
| @@ -17,14 +17,6 @@ | @@ -17,14 +17,6 @@ | ||
| 17 | # You should have received a copy of the GNU General Public License | 17 | # You should have received a copy of the GNU General Public License |
| 18 | # along with this program. If not, see <http://www.gnu.org/licenses/>. | 18 | # along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 19 | # | 19 | # |
| 20 | -# ------------------------------------------------------------------------- | ||
| 21 | -# | ||
| 22 | -# This script installs the ctools and GammaLib packages in the location | ||
| 23 | -# /usr/local/gamma and then builds a CentOS rpm package. | ||
| 24 | -# Any existing content in /usr/local/gamma will be | ||
| 25 | -# destroyed. The script needs the priviledges to create a folder in | ||
| 26 | -# /usr/local. | ||
| 27 | -# | ||
| 28 | # ========================================================================== | 20 | # ========================================================================== |
| 29 | 21 | ||
| 30 | # ====================================== # | 22 | # ====================================== # |
| @@ -38,6 +30,14 @@ VERSION=$1 | @@ -38,6 +30,14 @@ VERSION=$1 | ||
| 38 | PLATFORM=`uname -m` | 30 | PLATFORM=`uname -m` |
| 39 | 31 | ||
| 40 | 32 | ||
| 33 | +# =============================== # | ||
| 34 | +# Set software component versions # | ||
| 35 | +# =============================== # | ||
| 36 | +PACKNAME=gammalib | ||
| 37 | +PACKAGE=$PACKNAME-$VERSION | ||
| 38 | +RELEASE=1 | ||
| 39 | + | ||
| 40 | + | ||
| 41 | # ====== # | 41 | # ====== # |
| 42 | # Header # | 42 | # Header # |
| 43 | # ====== # | 43 | # ====== # |
| @@ -46,13 +46,6 @@ echo "Build $PACKNAME rpm package, Version $VERSION, Platform $PLATFORM" | @@ -46,13 +46,6 @@ echo "Build $PACKNAME rpm package, Version $VERSION, Platform $PLATFORM" | ||
| 46 | echo "=================================================================" | 46 | echo "=================================================================" |
| 47 | 47 | ||
| 48 | 48 | ||
| 49 | -# =============================== # | ||
| 50 | -# Set software component versions # | ||
| 51 | -# =============================== # | ||
| 52 | -PACKNAME=gammalib | ||
| 53 | -PACKAGE=$PACKNAME-$VERSION | ||
| 54 | -RELEASE=1 | ||
| 55 | - | ||
| 56 | # ============== # | 49 | # ============== # |
| 57 | # Set parameters # | 50 | # Set parameters # |
| 58 | # ============== # | 51 | # ============== # |
| @@ -105,7 +98,7 @@ echo "====================================================" | @@ -105,7 +98,7 @@ echo "====================================================" | ||
| 105 | echo "Packaging DONE" | 98 | echo "Packaging DONE" |
| 106 | echo " " | 99 | echo " " |
| 107 | echo "New binary packages are located in $PRODDIR" | 100 | echo "New binary packages are located in $PRODDIR" |
| 108 | -for package in $(find $PRODDIR -iname '*.rpm' ); do | 101 | +for package in $(find $PRODDIR -iname '*.rpm' ); do |
| 109 | echo "rpm file : $package" | 102 | echo "rpm file : $package" |
| 110 | echo "====================================================" | 103 | echo "====================================================" |
| 111 | rpm -qip $package | 104 | rpm -qip $package |
dev/pkgcheck-centos.sh
| @@ -2,7 +2,7 @@ | @@ -2,7 +2,7 @@ | ||
| 2 | # ========================================================================== | 2 | # ========================================================================== |
| 3 | # gammalib CentOS package validation | 3 | # gammalib CentOS package validation |
| 4 | # | 4 | # |
| 5 | -# Copyright (C) 2017 Sylvie Brau-Nogué | 5 | +# Copyright (C) 2017 Sylvie Brau-Nogue |
| 6 | # | 6 | # |
| 7 | # This program is free software: you can redistribute it and/or modify | 7 | # This program is free software: you can redistribute it and/or modify |
| 8 | # it under the tesudo rms of the GNU General Public License as published by | 8 | # it under the tesudo rms of the GNU General Public License as published by |
| @@ -17,201 +17,63 @@ | @@ -17,201 +17,63 @@ | ||
| 17 | # You should have received a copy of the GNU General Public License | 17 | # You should have received a copy of the GNU General Public License |
| 18 | # along with this program. If not, see <http://www.gnu.org/licenses/>. | 18 | # along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 19 | # | 19 | # |
| 20 | -# ------------------------------------------------------------------------- | ||
| 21 | -# | ||
| 22 | -# This script tests a CentOS package prior to release. It is assumed that | ||
| 23 | -# the package has been installed in a local directory $LOCALINSTALL/gammalib. | ||
| 24 | # ========================================================================== | 20 | # ========================================================================== |
| 25 | 21 | ||
| 26 | -# ============================================= # | ||
| 27 | -# Get ctools/GammaLib version from command line # | ||
| 28 | -# ============================================= # | ||
| 29 | -if [ $# -ne 4 ] ; then | ||
| 30 | -echo "Please specify package name version platform in the form 'package x.y.z platform '" | ||
| 31 | -exit 1 | 22 | +# ====================================== # |
| 23 | +# Get GammaLib version from command line # | ||
| 24 | +# ====================================== # | ||
| 25 | +if [ $# -ne 1 ] ; then | ||
| 26 | + echo "Please specify GammaLib in the form 'x.y.z'" | ||
| 27 | + exit 1 | ||
| 32 | fi | 28 | fi |
| 33 | -PACKNAME=$1 | ||
| 34 | -VERSION=$2 | ||
| 35 | -PLATFORM=$3 | ||
| 36 | -GVERSION=$4 | 29 | +VERSION=$1 |
| 30 | +PLATFORM=`uname -m` | ||
| 37 | 31 | ||
| 38 | -echo " ================================================================= " | ||
| 39 | -echo " Check $PACKNAME rpm package, Version $VERSION, Platform $PLATFORM " | ||
| 40 | -echo " ================================================================= " | ||
| 41 | 32 | ||
| 42 | # =============================== # | 33 | # =============================== # |
| 43 | # Set software component versions # | 34 | # Set software component versions # |
| 44 | # =============================== # | 35 | # =============================== # |
| 45 | -#CFITSIO=cfitsio3410 | ||
| 46 | -#NCURSES=ncurses-5.9 | ||
| 47 | -#READLINE=readline-6.3 | ||
| 48 | -CFITSIO=cfitsio | ||
| 49 | -NCURSES=ncurses | ||
| 50 | -READLINE=readline | ||
| 51 | -# | 36 | +PACKNAME=gammalib |
| 52 | PACKAGE=$PACKNAME-$VERSION | 37 | PACKAGE=$PACKNAME-$VERSION |
| 53 | -# TODO : next step to fix RELEASE is not updated for now | ||
| 54 | RELEASE=1 | 38 | RELEASE=1 |
| 55 | 39 | ||
| 56 | -# ==================================================== # | ||
| 57 | -# TODO : Create a secure RPM repository | ||
| 58 | -# Temporary solution, to be fixed | ||
| 59 | -# ==================================================== # | ||
| 60 | -YUMREPO=$HOME/YUM-REPO | 40 | + |
| 41 | +# ====== # | ||
| 42 | +# Header # | ||
| 43 | +# ====== # | ||
| 44 | +echo "=================================================================" | ||
| 45 | +echo "Check $PACKNAME rpm package, Version $VERSION, Platform $PLATFORM" | ||
| 46 | +echo "=================================================================" | ||
| 47 | + | ||
| 61 | 48 | ||
| 62 | # ============== # | 49 | # ============== # |
| 63 | # Set parameters # | 50 | # Set parameters # |
| 64 | # ============== # | 51 | # ============== # |
| 65 | -# | ||
| 66 | -# System Configuration Hypothesis with file ~/.rpmmacros. | ||
| 67 | -# This file must contain at least the follwing lines : | ||
| 68 | -# %packager KNODLSEDER | ||
| 69 | -# %_topdir %(echo $HOME)/rpmbuild | ||
| 70 | -# %_tmppath %(echo $HOME)/rpmbuild/tmp | ||
| 71 | -# %_smp_mflags -j3 | ||
| 72 | -# %__arch_install_post /usr/lib/rpm/check-rpaths /usr/lib/rpm/check-buildroot | ||
| 73 | -# | ||
| 74 | -# | ||
| 75 | -# SBN : Liste à fixer. | ||
| 76 | -TMPDIR=$HOME/usr | ||
| 77 | -WRKDIR=$HOME/pkg_check | ||
| 78 | -SRCDIR=$WRKDIR/SOURCES | ||
| 79 | -PKGDIR=$WRKDIR/RPMS | 52 | +WRKDIR=$PWD/rpm_check |
| 53 | +RPMDB=$WRKDIR/rpmdb | ||
| 54 | +RPMFILE=$PACKAGE-$RELEASE.*$PLATFORM.rpm | ||
| 80 | 55 | ||
| 81 | -# ========================================================================= # | ||
| 82 | -# Fix packages directory # | ||
| 83 | -# ========================================================================= # | ||
| 84 | -# If 'make pkg' produce multi-platform rpm, rpm files will be archived in $YUMREPO directory | ||
| 85 | -#PRODDIR=$WRKDIR/RPMS/$PLATFORM | ||
| 86 | -PRODIR=$YUMREPO | ||
| 87 | -# | ||
| 88 | -RPMFILE=$PRODIR/$PACKAGE-$RELEASE.*$PLATFORM.rpm | ||
| 89 | -# | ||
| 90 | -# ========================================================================= # | ||
| 91 | -# Install package in local directory # | ||
| 92 | -# ========================================================================= # | ||
| 93 | -# 2 options with rpm # | ||
| 94 | -# --relocate <old>=<new> relocate files from path <old> to <new> # | ||
| 95 | -#sudo rpm -U --relocate=$INSTALLDIR=$LOCALINSTALL $RPMFILE &> $LOGRPMFILE # | ||
| 96 | -# or # | ||
| 97 | -# --prefix=<dir> relocate the package to <dir>, if relocatable # | ||
| 98 | -# ========================================================================= # | ||
| 99 | -INSTALLDIR=/usr/local/gamma | ||
| 100 | -# LOCALINSTALL=$WRKDIR$INSTALLDIR # <= another option, not selected for the moment | ||
| 101 | -LOCALINSTALL=$HOME/$INSTALLDIR | ||
| 102 | -# | ||
| 103 | -LOGFILE=$WRKDIR/pkg_check.log | ||
| 104 | -LOGRPMFILE=$WRKDIR/pkg_check_rpm.log | ||
| 105 | 56 | ||
| 106 | # ========================= # | 57 | # ========================= # |
| 107 | -# Clean temporary directory # | 58 | +# Create local rpm database # |
| 108 | # ========================= # | 59 | # ========================= # |
| 109 | -rm -rf $TMPDIR | 60 | +rpm --initdb --root $RPMDB |
| 110 | 61 | ||
| 111 | -# ============================= # | ||
| 112 | -# Secure installation directory # | ||
| 113 | -# ============================= # | ||
| 114 | -if [ -d "$LOCALINSTALL/$PACKNAME" ]; then | ||
| 115 | - mv $LOCALINSTALL/$PACKNAME $LOCALINSTALL/$PACKNAME.backup | ||
| 116 | -fi | ||
| 117 | 62 | ||
| 118 | -# ======================= # | ||
| 119 | -# Clean working directory # | ||
| 120 | -# ======================= # | ||
| 121 | -sudo rm -rf $WRKDIR | 63 | +# ======================== # |
| 64 | +# Install GammaLib package # | ||
| 65 | +# ======================== # | ||
| 66 | +rpm --dbpath $RPMDB --nodeps --prefix=$WRKDIR -i $RPMFILE | ||
| 122 | 67 | ||
| 123 | -# ====================================== # | ||
| 124 | -# Create and step into working directory # | ||
| 125 | -# ====================================== # | ||
| 126 | -mkdir -p $WRKDIR | ||
| 127 | -cd $WRKDIR | ||
| 128 | - | ||
| 129 | -if ! rpm -qa | grep -q ncurses; then | ||
| 130 | - echo "ncurses need to be installed" | ||
| 131 | - sudo yum install ncurses | ||
| 132 | - if ! rpm -qa | grep -q ncurses; then | ||
| 133 | - echo "=================================================================================================" | ||
| 134 | - echo "ERROR : ncurses need to be installed manually" | ||
| 135 | - echo "=================================================================================================" | ||
| 136 | - exit | ||
| 137 | - fi | ||
| 138 | -fi | ||
| 139 | -v=$(rpm --qf '%{VERSION}\n' -q ncurses) | ||
| 140 | -echo "ncurses $v checked" | ||
| 141 | 68 | ||
| 142 | -if ! rpm -qa | grep -q readline; then | ||
| 143 | - echo "readline need to be installed" | ||
| 144 | - sudo yum install readline | ||
| 145 | - if ! rpm -qa | grep -q readline; then | ||
| 146 | - echo "=================================================================================================" | ||
| 147 | - echo "ERROR : readline need to be installed manually" | ||
| 148 | - echo "=================================================================================================" | ||
| 149 | - exit | ||
| 150 | - fi | ||
| 151 | -fi | ||
| 152 | -v=$(rpm --qf '%{VERSION}\n' -q readline) | ||
| 153 | -echo "readline $v checked" | 69 | +# ========================== # |
| 70 | +# Configure GammaLib package # | ||
| 71 | +# ========================== # | ||
| 72 | +export LD_LIBRARY_PATH=$WRKDIR/lib:$LD_LIBRARY_PATH | ||
| 73 | +export PYTHONPATH=$WRKDIR/lib64/python2.7/site-packages:$PYTHONPATH | ||
| 154 | 74 | ||
| 155 | -if ! rpm -qa | grep -q cfitsio; then | ||
| 156 | - echo "cfitsio need to be installed" | ||
| 157 | - sudo yum install cfitsio-devel | ||
| 158 | - if ! rpm -qa | grep -q cfitsio; then | ||
| 159 | - echo "=================================================================================================" | ||
| 160 | - echo " ERROR : cfitsio need to be installed" | ||
| 161 | - echo "=================================================================================================" | ||
| 162 | - echo "You can download the latest version of CFITSIO on http://heasarc.gsfc.nasa.gov/fitsio/fitsio.html" | ||
| 163 | - echo " " | ||
| 164 | - echo "or " | ||
| 165 | - echo " " | ||
| 166 | - echo "cfitsio rpm can be found in the epel-release repository ; Try : sudo yum install cfitsio-devel" | ||
| 167 | - echo " " | ||
| 168 | - echo "=================================================================================================" | ||
| 169 | - exit | ||
| 170 | - fi | ||
| 171 | -fi | ||
| 172 | -v=$(rpm --qf '%{VERSION}\n' -q cfitsio) | ||
| 173 | -echo "cfitsio $v checked" | ||
| 174 | - | ||
| 175 | -# ======================================================================= # | ||
| 176 | -# Finally install package $HOME/$YUMREPO/$PACKAGE-$RELEASE-*$PLATFORM.rpm # | ||
| 177 | -# ======================================================================= # | ||
| 178 | -if ! sudo rpm -U --prefix=/$LOCALINSTALL $RPMFILE &> $LOGRPMFILE ; then | ||
| 179 | - echo "=================================================================================================" | ||
| 180 | - echo "ERROR : Cannot install $PACKAGE package" | ||
| 181 | - echo "=================================================================================================" | ||
| 182 | - cat $LOGRPMFILE | ||
| 183 | - echo " " | ||
| 184 | - echo "=================================================================================================" | ||
| 185 | - exit | ||
| 186 | -fi | ||
| 187 | - | ||
| 188 | -# ================= # | ||
| 189 | -# Configure package # | ||
| 190 | -# ================= # | ||
| 191 | -export GAMMALIB=$LOCALINSTALL/$PACKNAME | ||
| 192 | -source $GAMMALIB/bin/$PACKNAME-init.sh | ||
| 193 | -ARCH=`lsb_release -irs` | ||
| 194 | 75 | ||
| 195 | # ============ # | 76 | # ============ # |
| 196 | # Test package # | 77 | # Test package # |
| 197 | # ============ # | 78 | # ============ # |
| 198 | -# TODO : update following section with consistent set of tests | ||
| 199 | -python -c 'import gammalib; gammalib.test()' | tee -a $LOGFILE | ||
| 200 | - | ||
| 201 | -# ======================= # | ||
| 202 | -# Uninstall package # | ||
| 203 | -# ======================= # | ||
| 204 | -sudo yum remove $PACKNAME | ||
| 205 | - | ||
| 206 | -# ======================= # | ||
| 207 | -# Clean package directory # | ||
| 208 | -# ======================= # | ||
| 209 | -sudo rm -rf $TMPDIR | ||
| 210 | - | ||
| 211 | -# ============================== # | ||
| 212 | -# Recover installation directory # | ||
| 213 | -# ============================== # | ||
| 214 | -if [ -d "$LOCALINSTALL/$PACKNAME.backup" ]; then | ||
| 215 | - mv $LOCALINSTALL/$PACKNAME.backup $LOCALINSTALL/$PACKNAME | ||
| 216 | -fi | ||
| 217 | - | 79 | +python -c 'import gammalib; gammalib.test()' |