With git archive the bootstrap steps are not required when creating the
orig tarball, allowing the user to create a source package without
having the build-deps available at the host machine.

As debian/rules is also calling autoreconf now, it's not required to
have the cached autoconf/automake files in order to produce the build.

To create the source package simply call 'scripts/builddeb source'.

Signed-off-by: Ricardo Salveti <ricardo.salv...@linaro.org>
---
 scripts/builddeb            | 13 +++++++++++--
 scripts/common_pkg_build.sh | 22 +++++++++++++++++++---
 2 files changed, 30 insertions(+), 5 deletions(-)

diff --git a/scripts/builddeb b/scripts/builddeb
index 829fd1d..bce74cb 100755
--- a/scripts/builddeb
+++ b/scripts/builddeb
@@ -6,7 +6,16 @@ export ROOT_DIR=$(readlink -e $(dirname $0) | sed 
's|/scripts||')
 
 source ${ROOT_DIR}/scripts/common_pkg_build.sh
 
-prepare_tarball
+# debuild default options
+DEB_OPTS="-us -uc"
+
+# Also allow the user to create just the source package (skip build process)
+if [ "$1" == source ]; then
+       prepare_tarball archive
+       DEB_OPTS="-S $DEB_OPTS"
+else
+       prepare_tarball
+fi
 
 pushd ${ROOT_DIR}/${package}-${version}
 cp -r ${ROOT_DIR}/pkg/debian .
@@ -23,6 +32,6 @@ if [ $(egrep "\.([a-z0-9]{8}\>|dirty)" .scmversion |wc -l) 
-gt 0 ]; then
        dch --newversion ${version}-1 --urgency low "not a official release!"
 fi
 
-debuild -us -uc
+debuild $DEB_OPTS
 popd
 popd
diff --git a/scripts/common_pkg_build.sh b/scripts/common_pkg_build.sh
index eefc07d..fbb2511 100644
--- a/scripts/common_pkg_build.sh
+++ b/scripts/common_pkg_build.sh
@@ -6,11 +6,9 @@ prepare_tarball() {
        export package=opendataplane
 
        pushd ${ROOT_DIR}
-       ./bootstrap
-       ./configure
-       make dist
 
        if [[ -d ${ROOT_DIR}/.git ]]; then
+               . scripts/git_hash.sh ${ROOT_DIR}
                version=$(cat ${ROOT_DIR}/.scmversion)
        else
                echo "This script isn't expected to be used without"
@@ -18,6 +16,24 @@ prepare_tarball() {
                exit 1
        fi
 
+       if [ "$1" == archive ]; then
+               git archive --format=tar --prefix=${package}-${version}/ HEAD > 
${package}-${version}.tar
+
+               # append .scmversion, otherwise bootstrap fails
+               SCMTMP=`mktemp -d`
+               pushd $SCMTMP
+               mkdir ${package}-${version}
+               cp ${ROOT_DIR}/.scmversion ${package}-${version}
+               tar --update -v -f ${ROOT_DIR}/${package}-${version}.tar 
${package}-${version}
+               popd
+               rm -rf $SCMTMP
+               gzip ${package}-${version}.tar
+       else
+               ./bootstrap
+               ./configure
+               make dist
+       fi
+
        cp ${package}-${version}.tar.gz ${package}_${version}.orig.tar.gz
        tar xzf ${package}_${version}.orig.tar.gz
 }
-- 
2.5.0

_______________________________________________
lng-odp mailing list
lng-odp@lists.linaro.org
https://lists.linaro.org/mailman/listinfo/lng-odp

Reply via email to