tdawson / centos / centpkg

Forked from centos/centpkg 3 years ago
Clone
James Antill 8f33dd
#! /bin/sh -e
James Antill 8f33dd
James Antill 8f33dd
if [ "x$1" = "x" ]; then
James Antill 8f33dd
  echo "Building this way needs a devrel."
James Antill 8f33dd
  exit 1
James Antill 8f33dd
fi
James Antill 8f33dd
James Antill 8f33dd
c=centpkg
James Antill 8f33dd
p=$(pwd)
James Antill 8f33dd
James Antill 8f33dd
echo "%define devrel $1" > c.spec
James Antill 8f33dd
echo "%define devsnap $(date +'%Y%m%d')git.$(git show -q --format='%h')" >> c.spec
James Antill 8f33dd
cat centpkg.spec >> c.spec
James Antill 8f33dd
James Antill 8f33dd
ver=$(rpmspec -q \
James Antill 8f33dd
       --qf '%{name} %{version}\n' \
James Antill 8f33dd
       c.spec | \
James Antill 8f33dd
      fgrep "centpkg " | awk '{ print $2 }')
James Antill 8f33dd
James Antill 8f33dd
cd ..
James Antill 8f33dd
mkdir $c-$ver
James Antill 8f33dd
cp -a \
James Antill 8f33dd
  $p/COPYING \
James Antill 8f33dd
  $p/README.md \
James Antill 8f33dd
  $p/requirements.txt \
James Antill 8f33dd
  $p/setup.py \
James Antill 8f33dd
  $p/src \
James Antill 8f33dd
  $c-$ver
James Antill 8f33dd
tar --exclude='*~' -cvf $c-$ver.tar $c-$ver
James Antill 8f33dd
rm -rf $c-$ver
James Antill 8f33dd
cd $p
James Antill 8f33dd
mv ../$c-$ver.tar .
James Antill 8f33dd
gzip -9 $c-$ver.tar
James Antill 8f33dd
James Antill 8f33dd
rpmbuild \
James Antill 8f33dd
         --define="_sourcedir $(pwd)" \
James Antill 8f33dd
         --define="_srcrpmdir $(pwd)" \
James Antill 8f33dd
         -bs c.spec
James Antill 8f33dd
James Antill 8f33dd
rm $c-$ver.tar.gz c.spec