make-deb 2.54 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64
#!/bin/bash 

set -e

NAME="beegfs-meta"

source ../../beegfs-version

CONCURRENCY=${MAKE_CONCURRENCY:-4}

BEEGFS_OPENTK_PATH=${BEEGFS_OPENTK_PATH:-`readlink -f ../../beegfs_opentk_lib`}
BEEGFS_COMMON_PATH=${BEEGFS_COMMON_PATH:-`readlink -f ../../beegfs_common`}
BEEGFS_COMMON_PACKAGE_PATH=${BEEGFS_COMMON_PACKAGE_PATH:-`readlink -f ../../beegfs_common_package`}
BEEGFS_THIRDPARTY_PATH=${BEEGFS_THIRDPARTY_PATH:-`readlink -f ../../beegfs_thirdparty`}

CHANGELOG="debian/changelog"
RULES="debian/rules"
CONTROL="debian/control"

CURRENT_TIME=`date "+%a, %d %b %Y %H:%M:%S %z"`

# parse BeeGFS version for debian versioning
BEEGFS_DEB_MAJOR=`echo ${BEEGFS_VERSION} | cut -d . -f 1`
BEEGFS_DEB_MINOR=`echo ${BEEGFS_VERSION} | cut -d - -f 1 | cut -d . -f 2`
BEEGFS_DEB_REL_SUFFIX=`echo ${BEEGFS_VERSION}- | cut -d - -f 2`
EPOCH=${BEEGFS_DEB_MAJOR}

if [ ! -z ${BEEGFS_DEB_REL_SUFFIX} ]; then
   # prepend "~" to the suffix, so final version will look like this:
   # "beegfs-XXX-6.0-debian8~beta1"
   BEEGFS_DEB_REL_SUFFIX="~${BEEGFS_DEB_REL_SUFFIX}"
fi

BEEGFS_DEB_FULLVERSION=${EPOCH}:${BEEGFS_DEB_MAJOR}.${BEEGFS_DEB_MINOR}${BEEGFS_DEB_REL_SUFFIX}-debian${DEBIAN_VERSION}

sed \
	-e "s/__NAME__/$NAME/g" 			              \
	-e "s/__BEEGFS_DEB_FULLVERSION__/${BEEGFS_DEB_FULLVERSION}/g" \
	-e "s/__CURRENT_TIME__/${CURRENT_TIME}/g"                     \
	${CHANGELOG}.in > ${CHANGELOG}

sed \
	-e "s#__BEEGFS_OPENTK_PATH__#$BEEGFS_OPENTK_PATH#g"			\
	-e "s#__BEEGFS_COMMON_PATH__#$BEEGFS_COMMON_PATH#g" 			\
	-e "s#__BEEGFS_COMMON_PACKAGE_PATH__#$BEEGFS_COMMON_PACKAGE_PATH#g" 	\
	-e "s#__BEEGFS_THIRDPARTY_PATH__#$BEEGFS_THIRDPARTY_PATH#g" 	        \
	-e "s/__BEEGFS_VERSION__/$BEEGFS_VERSION/g"   				\
	-e "s/__NAME__/$NAME/g"							\
	-e "s/__USER_CXXFLAGS__/$USER_CXXFLAGS/g"				\
	-e "s/__USER_LDFLAGS__/$USER_LDFLAGS/g"					\
	-e "s/__BEEGFS_DEBUG__/$BEEGFS_DEBUG/g"					\
	-e "s/__MAKE_CONCURRENCY__/$CONCURRENCY/g"				\
	${RULES}.in > ${RULES}

sed \
	-e "s/__BEEGFS_DEB_FULLVERSION__/${BEEGFS_DEB_FULLVERSION}/g" \
	${CONTROL}.in > ${CONTROL}

chmod +x debian/rules

# build the package and supress lintian warnings. Lintian in Lenny cannot
# do that itself yet
# NOTE: package not signed yet! (-us -uc)
yes | debuild -us -uc 2>&1 | egrep -v "dir-or-file-in-opt | file-in-unusual-dir"
65
[ "${DEBIAN_VERSION}" = "9" ] && yes | debuild -- clean || debuild clean
66 67 68 69 70 71 72

if [ -z "$DEBIAN_ARCHIVE_DIR" ]; then
	DEBIAN_ARCHIVE_DIR=`mktemp -d /tmp/debian_archive.XXXXXXXXX`
fi

mv ../*.build ../*.changes ../*.deb ../*.dsc ../*.tar.gz $DEBIAN_ARCHIVE_DIR/
echo "Wrote package files to $DEBIAN_ARCHIVE_DIR"