diff options
author | Riku Voipio <riku.voipio@linaro.org> | 2014-05-09 15:03:56 +0300 |
---|---|---|
committer | Riku Voipio <riku.voipio@linaro.org> | 2014-05-09 16:45:37 +0300 |
commit | c6bee83daf84746f5264bb862d2575b5667d16fa (patch) | |
tree | f5a9cbf79fc69fae4e2e3ac77b94bffeff14b27e | |
parent | ad3a3fb3ff04156a525afced39652cfa6e43801f (diff) |
separate source smashing
-rwxr-xr-x | jenkins-makesources | 77 |
1 files changed, 77 insertions, 0 deletions
diff --git a/jenkins-makesources b/jenkins-makesources new file mode 100755 index 0000000..c8b0425 --- /dev/null +++ b/jenkins-makesources @@ -0,0 +1,77 @@ +#!/bin/bash + +# makes a source package out of a git tree and packaging git tree +# usage: +# jenkins-makesources conffile +# +# conffile: +# +# upstream_source = source package name +# upstream_repo = git url to upstream +# +# packaging_dir = directory of the debian/ contents +# packaging_repo = git url to packaging +# base_version = base version for package +# distribution = target distro +# +# variables may already by set, in that case just call this with +# ./jenkins-makesources +# + +set -e + +if [ -r $1 ]; +then + source $1 +fi + +if [ -d $upstream_source ] +then + (cd $upstream_source; git pull ) +else + git clone $upstream_repo $upstream_source +fi + +if [ -d $packaging_dir ] +then + (cd $packaging_dir; git pull ) +else + git clone $packaging_repo +fi + +packaging_commit=`cd $packaging_dir && git log -n1 --pretty=format:%h` +upstream_commit=`cd $upstream_source && git log -n1 --pretty=format:%h` + +[ -z $base_version ] && base_version=0.1.2014.05 +[ -z $BUILD_NUMBER ] && BUILD_NUMBER=1 + +currentdate=`date -R` +pkg_version=${base_version}+git${BUILD_NUMBER}+`date +%Y%m%d`+${upstream_commit} +pkg_dir=${upstream_source}-${pkg_version} + +cp -a $upstream_source "${pkg_dir}.orig" +rm -rf "${pkg_dir}.orig/.git" +cp -a "${pkg_dir}.orig" "${pkg_dir}" +cp -a $packaging_dir "${pkg_dir}" + +echo "Preparing ${pkg_version} for ${distribution}" + +cat > ${pkg_dir}/debian/changelog << EOF +${upstream_source} (${pkg_version}-1linaro${distribution}1) ${distribution}; urgency=low + + * CI - ${upstream_source} snapshot: + - repository: ${upstream_repo} + - commit: ${upstream_commit} + - build: ${BUILD_URL} + + - debian/ repository: ${packaging_repo} + - debian/ commit: ${packaging_commit} + + -- Linaro Packagers <linaro-pkg@lists.launchpad.net> ${currentdate} + +EOF + +cd ${pkg_dir} +dpkg-buildpackage -nc -us -uc -rfakeroot -S +cd .. +rm -rf ${pkg_dir} |