From 28d285c0c13ef11535e98f1ef4b2285ade403b58 Mon Sep 17 00:00:00 2001 From: Dan Callaghan Date: Apr 12 2017 07:29:46 +0000 Subject: use `python setup.py sdist` to produce tarballs in development RPM builds Currently the rpmbuild.sh script is producing tarballs by just using `git archive`, which means the tarballs include everything committed to git. But our release tarballs are created by `python setup.py sdist` which uses different rules to decide what to include. To keep things consistent, we should use `python setup.py sdist` for the development builds too. This will help catch missing entries in MANIFEST.in, for example #33. --- diff --git a/rpmbuild.sh b/rpmbuild.sh index fadeddf..99e39e6 100755 --- a/rpmbuild.sh +++ b/rpmbuild.sh @@ -53,9 +53,7 @@ trap "rm -rf $workdir" EXIT outdir="$(readlink -f ./rpmbuild-output)" mkdir -p "$outdir" -git archive --format=tar --prefix="${name}-${version}/" HEAD | gzip >"$workdir/${name}-${version}.tar.gz" -git show HEAD:${name}.spec >"$workdir/${name}.spec" - +git archive --format=tar HEAD | tar -C "$workdir" -xf - if [ -n "$rpmrel" ] ; then # need to hack the version in the spec sed --regexp-extended --in-place \ @@ -63,17 +61,13 @@ if [ -n "$rpmrel" ] ; then -e "/^Version:/cVersion: ${rpmver}" \ -e "/^Release:/cRelease: ${rpmrel}%{?dist}" \ "$workdir/${name}.spec" - # inject %prep commands to also hack the Python module versions - # (beware the precarious quoting here...) - commands=$(cat <"$workdir/${name}.spec.injected" - mv "$workdir/${name}.spec.injected" "$workdir/${name}.spec" + # also hack the Python module version + sed --regexp-extended --in-place \ + -e "/^version = /c\\version = '$version'" \ + "$workdir/setup.py" fi +( cd "$workdir" && python setup.py sdist ) +mv "$workdir"/dist/*.tar.gz "$workdir" rpmbuild \ --define "_topdir $workdir" \