Skip to content

Commit

Permalink
Merge pull request hpcugent#1 from lmejas/fix-build
Browse files Browse the repository at this point in the history
Fix the RPM building.
  • Loading branch information
Jens Timmerman committed Mar 1, 2013
2 parents a3720c2 + 13531e4 commit 05c47b2
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 13 deletions.
31 changes: 31 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
*.py[co]

# Packages
*.egg
*.egg-info
dist
build
eggs
parts
var
sdist
develop-eggs
.installed.cfg

# Installer logs
pip-log.txt

# Unit test / coverage reports
.coverage
.tox

#Translations
*.mo

#Mr Developer
.mr.developer.cfg

html
test-reports

setup.cfg
27 changes: 15 additions & 12 deletions bdist_rpm.sh
Original file line number Diff line number Diff line change
Expand Up @@ -29,16 +29,22 @@
# to indicate their contents in a more appropriate way. We do not do this for the packages when shipped to
# PyPi, since it is pretty obvious these are Python packages in any case.

all_packages=
all_packages=vsc-utils
edit=
release=

which rpmrebuild >& /dev/null
if [ $? -gt 0 ]
then
echo "Missing rpmrebuild"
exit 1
fi

while getopts er:p:h name
do
case $name in
e) edit="-e";;
r) release="$OPTARG";;
p) all_packages="$OPTARG";;
h) printf "Usage: %s [-e] [-r RELEASE] [-p PACKAGE]" $0
echo
echo " -e Edit the generated spec file before rebuilding the RPM"
Expand All @@ -48,21 +54,17 @@ do
esac
done

if [ -z "$all_packages" ]; then
ALL_PACKAGES=`python ./setup.py --name 2>/dev/null | grep -v "removing 'build'" | tr "\n" " "`
else
ALL_PACKAGES=$all_packages
fi
ALL_PACKAGES=$all_packages

for package in $ALL_PACKAGES; do

echo $package
python ./setup.py bdist_rpm
rpm_target=`ls dist/${package}*noarch.rpm`
echo "Building RPM for $package"
python ./setup.py bdist_rpm
# get latest one (name-version syntax)
rpm_target=`ls -t dist/${package}-[0-9]*noarch.rpm | head -1`
rpm_target_name=`basename ${rpm_target}`

# user specified requirements can be found in setup.cfg
requirements=`grep "requires" setup.cfg | cut -d" " -f3- | tr "," "|"`
requirements=`grep "requires" setup.cfg | cut -d" " -f3- | tr "," "\n" | grep -v "^python-" | tr "\n" "|" | sed -e 's/|$//'`
if [ -z "$requirements" ]; then
requirements="no-match-etc-etc-etc"
fi
Expand All @@ -77,4 +79,5 @@ for package in $ALL_PACKAGES; do
--change-spec-requires="sed -r 's/^Requires:(\s\s*)(${requirements})/Requires:\1python-\2/'" \
--change-spec-preamble="sed -e 's/^\(Release:\s\s*\)\(.*\)\s*$/\1${release}.ug/'" \
${edit} -n -p ${rpm_target}
echo "Finished building RPM for $package"
done
1 change: 0 additions & 1 deletion shared_setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,6 @@ def action_target(target, setupfn=setup, extra_sdist=[]):
x = parse_target(target)

setupfn(**x)
cleanup()

if __name__ == '__main__':
# print all supported packages
Expand Down

0 comments on commit 05c47b2

Please sign in to comment.