diff options
author | Narayan Desai <desai@mcs.anl.gov> | 2006-08-24 02:38:18 +0000 |
---|---|---|
committer | Narayan Desai <desai@mcs.anl.gov> | 2006-08-24 02:38:18 +0000 |
commit | 0079453227dbcdd5f4b8c3077a82be658c046337 (patch) | |
tree | 1c5528bc0c64d4684542c8796a6ba1460ba4d9af /encap/bcfg2-0.8.3pre3.ep | |
parent | 2a6de07dddb40e1799322879a047a4b42490d16b (diff) | |
download | bcfg2-0079453227dbcdd5f4b8c3077a82be658c046337.tar.gz bcfg2-0079453227dbcdd5f4b8c3077a82be658c046337.tar.bz2 bcfg2-0079453227dbcdd5f4b8c3077a82be658c046337.zip |
Version bump to 0.8.3pre3
git-svn-id: https://svn.mcs.anl.gov/repos/bcfg/trunk/bcfg2@2098 ce84e21b-d406-0410-9b95-82705330c041
Diffstat (limited to 'encap/bcfg2-0.8.3pre3.ep')
-rw-r--r-- | encap/bcfg2-0.8.3pre3.ep | 343 |
1 files changed, 343 insertions, 0 deletions
diff --git a/encap/bcfg2-0.8.3pre3.ep b/encap/bcfg2-0.8.3pre3.ep new file mode 100644 index 000000000..1b804ef45 --- /dev/null +++ b/encap/bcfg2-0.8.3pre3.ep @@ -0,0 +1,343 @@ +<?xml version="1.0"?> + +<!-- $Id$ --> + +<encap_profile + profile_ver="1.0" + pkgspec="bcfg2-0.8.3pre3" +> + +<environment + variable="CC" + value="gcc" + type="set" +/> + +<environment + variable="PATH" +PLATFORM_IF_MATCH(solaris) + value="/usr/local/lib/bcfg2/bin:/usr/local/bin:/usr/sfw/bin:/usr/ccs/bin:" +PLATFORM_ELSE + value="/usr/local/lib/bcfg2/bin:/usr/local/bin:" +PLATFORM_ENDIF + type="prepend" +/> + +PLATFORM_IF_MATCH(linux) +PLATFORM_ELSE +<environment + variable="MAKE" + value="gmake" + type="set" +/> +PLATFORM_ENDIF + +<environment + variable="LDFLAGS" +PLATFORM_IF_MATCH(linux) + value="-L/usr/local/lib/bcfg2/lib -Wl,-rpath,/usr/local/lib/bcfg2/lib" +PLATFORM_ELSE_IF_MATCH(aix) + value="-L/usr/local/lib/bcfg2/lib -Wl,-blibpath:/usr/local/lib/bcfg2/lib:/usr/lib" +PLATFORM_ELSE_IF_MATCH(solaris) + value="-L/usr/local/lib/bcfg2/lib -R/usr/local/lib/bcfg2/lib:/usr/lib -YP,/usr/local/lib/bcfg2/lib:/usr/lib" +PLATFORM_ELSE +PLATFORM_ENDIF + type="set" +/> + +<environment + variable="CPPFLAGS" + value="-I/usr/local/lib/bcfg2/include" + type="set" +/> + +<source +url="ftp://ftp.mcs.anl.gov/pub/bcfg/bcfg2-0.8.3pre3.tar.gz" +> + +<configure> +: +</configure> + +<build> +/usr/local/lib/bcfg2/bin/python setup.py build \ +--build-base=${builddir}/build +</build> + +<install> +/usr/local/lib/bcfg2/bin/python setup.py install \ +--prefix=${ENCAP_SOURCE}/${ENCAP_PKGNAME}/lib/bcfg2 +</install> + +<clean> +/usr/local/lib/bcfg2/bin/python setup.py clean +</clean> + +</source> + +<prepackage type="set"><![CDATA[ +# Make binaries available from /usr/local/bin +mkdir bin 2>/dev/null || exit 1 +for FILE in `ls lib/bcfg2/bin`; do \ + ln -sf ../lib/bcfg2/bin/${FILE} bin/${FILE}; \ + if [ ! "`printf "${FILE}" | cut -c 1-5`x" = "bcfg2x" ]; then \ + ln -sf ../lib/bcfg2/bin/${FILE} bin/b2-${FILE}; \ + fi; \ +done +# Make doc available from /usr/local/share/doc/bcfg2 +mkdir share 2>/dev/null || exit 1 +mkdir share/doc 2>/dev/null || exit 1 +mkdir share/doc/bcfg2 2>/dev/null || exit 1 +(cp ${builddir}/doc/manual.pdf share/doc/bcfg2/ || true) +cp -r ${builddir}/examples share/doc/bcfg2/ +# Make man pages available from /usr/local/man +mv lib/bcfg2/share/man . +# Make tools dirs and copy over tools +mkdir lib/bcfg2/tools || exit 1 +cp ${builddir}/tools/* lib/bcfg2/tools/ +mkdir sbin 2>/dev/null || exit 1 +mkdir share/doc/bcfg2/tools 2>/dev/null || exit 1 +# Makes tools with #! line executable +for FILE in `ls lib/bcfg2/tools`; do \ + F="lib/bcfg2/tools/${FILE}"; \ + if [ "`head -1 ${F} | grep ^#\!/`x" != "x" ]; then \ + chmod 755 ${F} ; \ + fi; \ +done +# Make executable tools available from /usr/local/sbin, and nonexecutable +# tools/tools doc available from /usr/local/share/doc/bcfg2/tools +for FILE in `ls lib/bcfg2/tools`; do \ + F="lib/bcfg2/tools/${FILE}"; \ + if [ -x ${F} ]; then \ + ln -sf ../lib/bcfg2/tools/${FILE} sbin/b2-example-tool-${FILE}; \ + else \ + ln -sf ../../../../lib/bcfg2/tools/${FILE} share/doc/bcfg2/tools/${FILE}; \ + fi; \ +done +# Make "this encap is installed" sentinal file available in /usr/local/var/encap +mkdir var 2>/dev/null || exit 1 +mkdir var/encap 2>/dev/null || exit 1 +touch var/encap/${ENCAP_PKGNAME} +]]></prepackage> + +<include_file name="b2-regexplace.py" mode="0755"><![CDATA[ +#!/usr/local/lib/bcfg2/bin/python + +# regexplace: regular expression search and replace +# Stefano Spinucci +# 2006-02-07 (rev 4) +# Daniel Clark +# 2006-08-03 (modified for bcfg2 encap use) +# thanks to roadrunner.py +# http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/52553 +# for some ideas and some code +# tested with python 2.4.3 + +import sys, os, re, string + +# pupulate and return 'fileslist[]' with all files inside 'dir' matching 'regx' +def make_files_list(dir, regx): + + # if dir is not a directory, exit with error + if not os.path.isdir(dir): + sys.exit(dir + ' is not a valid dir to walk !!!') + + # compile the search regexp + cregex=re.compile(regx) + + # initialize the file list + fileslist = [] + + # loop on all files and select files matching 'regx' + # don't include symbolic links + for root, dirs, files in os.walk(dir): + for name in files: + if cregex.search(name) and name not in ("b2-regexplace.sh", "b2-regexplace.py", "postinstall", "postinstall.log", "bcfg2-0.8.3pre3.ep"): + path = os.path.join(root, name) + if not os.path.islink(path): + fileslist.append(path) + + # return the file list + return fileslist[:] + +# in all files in 'fileslist' search the regexp 'searchregx' and replace +# with 'replacestring'; real substitution in files only if 'simulation' = 0 +def replace_in_files(fileslist, searchregx, replacestring, simulation): + + # compile regexp + cregex=re.compile(searchregx) + + # loop on all files + for xfile in fileslist: + + # initialize the replace flag + replaceflag=0 + + # open file for read + readlines=open(xfile,'r').readlines() + # intialize the list counter + listindex = -1 + + # search and replace in current file printing to the user changed lines + for currentline in readlines: + + # increment the list counter + listindex = listindex + 1 + + # if the regexp is found + if cregex.search(currentline): + + # make the substitution + f=re.sub(searchregx,replacestring,currentline) + + # print the current filename, the old string and the new string + print '\n' + xfile + print '- ' + currentline , + if currentline[-1:]!='\n': print '\n' , + print '+ ' + f , + if f[-1:]!='\n': print '\n' , + + # if substitution is real + if simulation == 0: + + # update the whole file variable ('readlines') + readlines[listindex] = f + replaceflag=1 + + # if some text was replaced + # overwrite the original file + if replaceflag==1: + + # open the file for writting + write_file=open(xfile,'w') + + # overwrite the file + for line in readlines: + write_file.write(line) + + # close the file + write_file.close() + +# main function +def main(): + + # if parameters are wrong, exit with error + if len(sys.argv) < 5: + + print 'Usage: regexplace.py dirname files-regexp search-regexp replace-string' + + sys.exit(1) + + # make the file list + fileslist = make_files_list(sys.argv[1], sys.argv[2]) + + # real execution + replace_in_files(fileslist, sys.argv[3], sys.argv[4], 0) + + # simulated execution + #replace_in_files(fileslist, sys.argv[3], sys.argv[4], 1) + + +if __name__ == '__main__': + main() +]]></include_file> + +<include_file name="b2-regexplace.sh" mode="0755"><![CDATA[ +#!/bin/sh + +# This fixes paths for the bcfg2 encap packaging. + +BASEDIR="`echo ${0} | xargs -n1 dirname`" +REGEXPLACE="${BASEDIR}/b2-regexplace.py" +PYTHON="/usr/local/lib/bcfg2/bin/python" +BINARIES="${REGEXPLACE} ${PYTHON}" +COMPILEALL="/usr/local/lib/bcfg2/lib/python2.4/compileall.py" + +printf "**** Running postinstall with BASEDIR=|${BASEDIR}|...\n" +for BINARY in ${BINARIES}; do + if [ ! -x ${BINARY} ]; then + printf "\nERROR: ${BINARY} is not executable, exiting...\n" + exit 1 + fi +done + +for FILE in ${COMPILEALL}; do + if [ ! -f ${FILE} ]; then + printf "\nERROR: ${FILE} does not exist, exiting...\n" + exit 1 + fi +done + +# Do not run more than once; it does not converge. +# (/usr/local/usr/local/bcfg2.conf bug) +if [ "${1}x" != "firstx" ]; then + printf "\nb2-regexplace.sh: Already ran\n\t${BASEDIR}/b2-regexplace.sh, not running again...\n" + exit 0 +fi + +printf "\nRemoving bcfg2 .pyc files...\n" +find ${BASEDIR} -type f | grep "\.pyc$" | xargs -n1 rm + +printf "\nFixing bcfg2 paths...\n" + +printf "\nReplacing \"/etc/bcfg2.conf\" with \"/usr/local/etc/bcfg2.conf\"...\n" +${REGEXPLACE} ${BASEDIR} .\* \/etc\/bcfg2.conf \/usr\/local\/etc\/bcfg2.conf + +printf "\nReplacing \"/local/sbin/epkg\" with \"/usr/local/bin/epkg\"...\n" +${REGEXPLACE} ${BASEDIR} .\* \/local\/sbin\/epkg \/usr\/local\/bin\/epkg + +printf "\nReplacing \"/usr/share/bcfg2\" with \"/usr/local/lib/bcfg2/share/bcfg2\"...\n" +${REGEXPLACE} ${BASEDIR} .\* \/usr\/share\/bcfg2\/ \/usr\/local\/lib\/bcfg2\/share\/bcfg2\/ + +printf "\nReplacing \"prefix = '/usr'\" with \"prefix = '/usr/local/lib/bcfg2'\"...\n" +${REGEXPLACE} ${BASEDIR} .\* prefix\ =\ \'\/usr\' prefix\ =\ \'/usr/local/lib/bcfg2\' + +printf "\nReplacing \"xmllint\" with \"/usr/local/bin/b2-xmllint\"...\n" +${REGEXPLACE} ${BASEDIR} .\* xmllint \/usr\/local\/bin\/b2-xmllint + +printf "\nReplacing \"#!/usr/bin/env python\" with " +printf "\"#!/usr/local/lib/bcfg2/bin/python\"...\n" +${REGEXPLACE} ${BASEDIR} .\* \#\!\/usr\/bin\/env\ python \#\!\/usr\/local\/lib\/bcfg2\/bin\/python + +printf "\nReplacing \"#!/usr/bin/perl\" with \"#!/usr/bin/env perl\"...\n" +${REGEXPLACE} ${BASEDIR} .\* \#\!\/usr\/bin\/perl \#\!\/usr\/bin\/env\ perl + +printf "\nReplacing \"#!/usr/bin/python\" with " +printf "\"#!/usr/local/lib/bcfg2/bin/python\"...\n" +${REGEXPLACE} ${BASEDIR} .\* \#\!\/usr\/bin\/python \#\!\/usr\/local\/lib\/bcfg2\/bin\/python + +printf "\nCreating bcfg2 .pyc files...\n" +${PYTHON} ${COMPILEALL} ${BASEDIR} + +exit 0 +]]></include_file> + +<include_file name="postinstall" mode="0755"><![CDATA[ +#!/bin/sh +BASEDIR="`echo ${0} | xargs -n1 dirname`" + +if [ ! -f ${BASEDIR}/postinstall.log ]; then + test -x ${BASEDIR}/b2-regexplace.sh || exit 1 + ${BASEDIR}/b2-regexplace.sh first > ${BASEDIR}/postinstall.log 2>&1 3>&1 +else + printf "\npostinstall: already ran\n\t${BASEDIR}/b2-regexplace.sh, not running again...\n" >> ${BASEDIR}/postinstall.log +fi +]]></include_file> + + +<encapinfo> +description Bcfg2 - Provides a declarative interface to system configuration +prereq pkgspec >= bcfg2-zlib-1.2.3 +prereq pkgspec >= bcfg2-libiconv-1.9.2 +prereq pkgspec >= bcfg2-gettext-0.14.5 +prereq pkgspec >= bcfg2-openssl-0.9.8b +prereq pkgspec >= bcfg2-libstdc++-0.1 +prereq pkgspec >= bcfg2-libgcc-0.1 +prereq pkgspec >= bcfg2-python-2.4.3 +prereq pkgspec >= bcfg2-pyopenssl-0.6 +prereq pkgspec >= bcfg2-libxml2-2.6.26 +prereq pkgspec >= bcfg2-libxslt-1.1.17 +prereq pkgspec >= bcfg2-lxml-1.0.1 +</encapinfo> + +</encap_profile> |