Improve tarball script.

This commit is contained in:
Felix Kauselmann 2014-09-23 21:10:22 +02:00
parent c897efb08a
commit e2361d6e56

View File

@ -1,19 +1,22 @@
#! /bin/bash
#script to create a source tarball for YACReader distribution and packaging
#Script to create a source tarball for YACReader distribution and packaging
#This should be run from YACReaders top source directory
YACVERSION=7.2.0
if [ -f Makefile ]
then
make distclean
fi
if [ ! -f "yacreader_${YACVERSION}-src.tar.xz" ]
if [ ! -f "yacreader-${YACVERSION}-src.tar.xz" ]
then
echo "Building source tarball"
else
echo "Updating source tarball"
rm yacreader_${YACVERSION}-src.tar* #delete old tarball, since tar can't update compressed archives
rm yacreader-${YACVERSION}-src.tar* #delete old tarball, since tar can't update compressed archives
fi
#use --exclude to make sure we get a pristine tar
#might not work out of the box with bsdtar!
tar cfJ yacreader_${YACVERSION}-src.tar.xz --exclude '*.rej' --exclude '*.orig' --exclude '*.gch' --exclude 'dependencies' \
--exclude 'yacreader*tar*' --exclude '.hg*' --exclude 'libp7zip' --exclude 'lib7zip' ./* --transform s/./yacreader_${YACVERSION}/
md5sum yacreader_${YACVERSION}-src.tar.xz > yacreader_${YACVERSION}-src.tar.xz.md5sum
#Use tar's --exclude feature to make sure we get a pristine tar for distribution.
#Exclude all version control system related files and rename the top directory in the tarball using --transform.
tar cfJ yacreader-${YACVERSION}-src.tar.xz --exclude '*.rej' --exclude '*.orig' --exclude '*.gch' --exclude 'dependencies' --exclude '*.o' \
--exclude 'yacreader*tar*' --exclude '.hg*' --exclude 'lib7zip' --exclude 'libp7zip' --exclude-vcs ./* --transform s/./yacreader-${YACVERSION}/
#Calculate checksum to enable packagers to verify whether they are using the original tarball.
md5sum yacreader-${YACVERSION}-src.tar.xz > yacreader-${YACVERSION}-src.tar.xz.md5sum