diff mbox

[PATCHv2,7/8] scripts: make rpm packages

Message ID 1446238668-15200-8-git-send-email-anders.roxell@linaro.org
State New
Headers show

Commit Message

Anders Roxell Oct. 30, 2015, 8:57 p.m. UTC
Signed-off-by: Anders Roxell <anders.roxell@linaro.org>
Reviewed-by: Fathi Boudra <fathi.boudra@linaro.org>
---
 {debian => pkg/debian}/README.Debian            |  0
 {debian => pkg/debian}/changelog                |  0
 {debian => pkg/debian}/compat                   |  0
 {debian => pkg/debian}/control                  |  0
 {debian => pkg/debian}/copyright                |  0
 {debian => pkg/debian}/docs                     |  0
 {debian => pkg/debian}/libodp-dev.dirs          |  0
 {debian => pkg/debian}/libodp-dev.install       |  0
 {debian => pkg/debian}/libodp.dirs              |  0
 {debian => pkg/debian}/libodp.install           |  0
 {debian => pkg/debian}/libodphelper-dev.dirs    |  0
 {debian => pkg/debian}/libodphelper-dev.install |  0
 {debian => pkg/debian}/libodphelper.dirs        |  0
 {debian => pkg/debian}/libodphelper.install     |  0
 {debian => pkg/debian}/odp-bin.dirs             |  0
 {debian => pkg/debian}/odp-bin.install          |  0
 {debian => pkg/debian}/rules                    |  0
 {debian => pkg/debian}/source/format            |  0
 scripts/builddeb                                | 16 +++++--------
 scripts/buildrpm                                | 30 +++++++++++++++++++++++++
 scripts/common_pkg_build.sh                     | 17 ++++++++++++++
 21 files changed, 52 insertions(+), 11 deletions(-)
 rename {debian => pkg/debian}/README.Debian (100%)
 rename {debian => pkg/debian}/changelog (100%)
 rename {debian => pkg/debian}/compat (100%)
 rename {debian => pkg/debian}/control (100%)
 rename {debian => pkg/debian}/copyright (100%)
 rename {debian => pkg/debian}/docs (100%)
 rename {debian => pkg/debian}/libodp-dev.dirs (100%)
 rename {debian => pkg/debian}/libodp-dev.install (100%)
 rename {debian => pkg/debian}/libodp.dirs (100%)
 rename {debian => pkg/debian}/libodp.install (100%)
 rename {debian => pkg/debian}/libodphelper-dev.dirs (100%)
 rename {debian => pkg/debian}/libodphelper-dev.install (100%)
 rename {debian => pkg/debian}/libodphelper.dirs (100%)
 rename {debian => pkg/debian}/libodphelper.install (100%)
 rename {debian => pkg/debian}/odp-bin.dirs (100%)
 rename {debian => pkg/debian}/odp-bin.install (100%)
 rename {debian => pkg/debian}/rules (100%)
 rename {debian => pkg/debian}/source/format (100%)
 create mode 100755 scripts/buildrpm
 create mode 100644 scripts/common_pkg_build.sh
diff mbox

Patch

diff --git a/debian/README.Debian b/pkg/debian/README.Debian
similarity index 100%
rename from debian/README.Debian
rename to pkg/debian/README.Debian
diff --git a/debian/changelog b/pkg/debian/changelog
similarity index 100%
rename from debian/changelog
rename to pkg/debian/changelog
diff --git a/debian/compat b/pkg/debian/compat
similarity index 100%
rename from debian/compat
rename to pkg/debian/compat
diff --git a/debian/control b/pkg/debian/control
similarity index 100%
rename from debian/control
rename to pkg/debian/control
diff --git a/debian/copyright b/pkg/debian/copyright
similarity index 100%
rename from debian/copyright
rename to pkg/debian/copyright
diff --git a/debian/docs b/pkg/debian/docs
similarity index 100%
rename from debian/docs
rename to pkg/debian/docs
diff --git a/debian/libodp-dev.dirs b/pkg/debian/libodp-dev.dirs
similarity index 100%
rename from debian/libodp-dev.dirs
rename to pkg/debian/libodp-dev.dirs
diff --git a/debian/libodp-dev.install b/pkg/debian/libodp-dev.install
similarity index 100%
rename from debian/libodp-dev.install
rename to pkg/debian/libodp-dev.install
diff --git a/debian/libodp.dirs b/pkg/debian/libodp.dirs
similarity index 100%
rename from debian/libodp.dirs
rename to pkg/debian/libodp.dirs
diff --git a/debian/libodp.install b/pkg/debian/libodp.install
similarity index 100%
rename from debian/libodp.install
rename to pkg/debian/libodp.install
diff --git a/debian/libodphelper-dev.dirs b/pkg/debian/libodphelper-dev.dirs
similarity index 100%
rename from debian/libodphelper-dev.dirs
rename to pkg/debian/libodphelper-dev.dirs
diff --git a/debian/libodphelper-dev.install b/pkg/debian/libodphelper-dev.install
similarity index 100%
rename from debian/libodphelper-dev.install
rename to pkg/debian/libodphelper-dev.install
diff --git a/debian/libodphelper.dirs b/pkg/debian/libodphelper.dirs
similarity index 100%
rename from debian/libodphelper.dirs
rename to pkg/debian/libodphelper.dirs
diff --git a/debian/libodphelper.install b/pkg/debian/libodphelper.install
similarity index 100%
rename from debian/libodphelper.install
rename to pkg/debian/libodphelper.install
diff --git a/debian/odp-bin.dirs b/pkg/debian/odp-bin.dirs
similarity index 100%
rename from debian/odp-bin.dirs
rename to pkg/debian/odp-bin.dirs
diff --git a/debian/odp-bin.install b/pkg/debian/odp-bin.install
similarity index 100%
rename from debian/odp-bin.install
rename to pkg/debian/odp-bin.install
diff --git a/debian/rules b/pkg/debian/rules
similarity index 100%
rename from debian/rules
rename to pkg/debian/rules
diff --git a/debian/source/format b/pkg/debian/source/format
similarity index 100%
rename from debian/source/format
rename to pkg/debian/source/format
diff --git a/scripts/builddeb b/scripts/builddeb
index 8a52044..829fd1d 100755
--- a/scripts/builddeb
+++ b/scripts/builddeb
@@ -2,20 +2,14 @@ 
 
 set -e
 
-ROOT_DIR=$(readlink -e $(dirname $0) | sed 's|/scripts||')
+export ROOT_DIR=$(readlink -e $(dirname $0) | sed 's|/scripts||')
 
-pushd ${ROOT_DIR}
-./bootstrap
-./configure
-make dist
+source ${ROOT_DIR}/scripts/common_pkg_build.sh
 
-version=$(cat ${ROOT_DIR}/.scmversion)
+prepare_tarball
 
-cp opendataplane-${version}.tar.gz opendataplane_${version}.orig.tar.gz
-tar xzf opendataplane_${version}.orig.tar.gz
-
-pushd ${ROOT_DIR}/opendataplane-${version}
-cp -r ${ROOT_DIR}/debian .
+pushd ${ROOT_DIR}/${package}-${version}
+cp -r ${ROOT_DIR}/pkg/debian .
 
 current=$(echo ${version} | awk -F . '{printf("%d\n", (($1 * 100) + $2))}')
 rename 's,([^-\.]*)(.*),${1}'"${current}"'${2},' debian/*odp*
diff --git a/scripts/buildrpm b/scripts/buildrpm
new file mode 100755
index 0000000..8568592
--- /dev/null
+++ b/scripts/buildrpm
@@ -0,0 +1,30 @@ 
+#!/bin/bash
+
+set -e
+
+export ROOT_DIR=$(readlink -e $(dirname $0) | sed 's|/scripts||')
+
+source ${ROOT_DIR}/scripts/common_pkg_build.sh
+
+prepare_tarball
+
+mkdir -p ${ROOT_DIR}/rpm/RPMS
+mkdir -p ${ROOT_DIR}/rpm/SRPMS
+mkdir -p ${ROOT_DIR}/rpm/BUILD
+mkdir -p ${ROOT_DIR}/rpm/SOURCES
+mkdir -p ${ROOT_DIR}/rpm/tmp
+rm -rf ${ROOT_DIR}/rpm/BUILD/${package}-root
+rm -rf ${ROOT_DIR}/rpm/RPMS/${package}*
+rm -rf ${ROOT_DIR}/rpm/SRPMS/${package}*
+rm -rf ${ROOT_DIR}/rpm/SOURCES/${package}*
+cp ${ROOT_DIR}/${package}-${version}.tar.gz ${ROOT_DIR}/rpm/SOURCES/
+cp ${ROOT_DIR}/pkg/rpm/odp.spec ${ROOT_DIR}/rpm/odp.spec
+if [ $(egrep "\.([a-z0-9]{8}\>|dirty)" .scmversion |wc -l) -gt 0 ]; then
+	creation_date=$(date '+%a %b %e %G')
+	RPMEMAIL="donald.duck (at) linaro.org"
+	sed -i -e "s/changelog/changelog\n* ${creation_date} - ${RPMEMAIL}\n- not a official release\!/g" ${ROOT_DIR}/rpm/odp.spec
+fi
+sed -i "s|^Version: .*$|Version: ${version}|g" ${ROOT_DIR}/rpm/odp.spec
+rpmbuild --quiet --nodeps --define="_topdir ${ROOT_DIR}/rpm" -ba ${ROOT_DIR}/rpm/odp.spec
+cp ${ROOT_DIR}/rpm/RPMS/*/* ${ROOT_DIR}/
+popd
diff --git a/scripts/common_pkg_build.sh b/scripts/common_pkg_build.sh
new file mode 100644
index 0000000..cf4f6e3
--- /dev/null
+++ b/scripts/common_pkg_build.sh
@@ -0,0 +1,17 @@ 
+#!/bin/bash
+
+set -e
+
+prepare_tarball() {
+	export package=opendataplane
+
+	pushd ${ROOT_DIR}
+	./bootstrap
+	./configure
+	make dist
+
+	version=$(cat ${ROOT_DIR}/.scmversion)
+
+	cp ${package}-${version}.tar.gz ${package}_${version}.orig.tar.gz
+	tar xzf ${package}_${version}.orig.tar.gz
+}