diff mbox

[PATCHv5,4/4] scripts: add builddeb to create deb packages

Message ID 1422016461-28976-5-git-send-email-anders.roxell@linaro.org
State New
Headers show

Commit Message

Anders Roxell Jan. 23, 2015, 12:34 p.m. UTC
Signed-off-by: Anders Roxell <anders.roxell@linaro.org>
---
 scripts/builddeb | 30 ++++++++++++++++++++++++++++++
 1 file changed, 30 insertions(+)
 create mode 100755 scripts/builddeb

Comments

Steve McIntyre Jan. 23, 2015, 2:10 p.m. UTC | #1
On Fri, Jan 23, 2015 at 01:34:21PM +0100, Anders Roxell wrote:
>Signed-off-by: Anders Roxell <anders.roxell@linaro.org>

Reviewed-by: Steve McIntyre <steve.mcintyre@linaro.org>

Minor nits again:

>+ROOT_DIR=$(readlink -e $(dirname $0) | sed 's|/scripts||')
>+version=$(echo $(${ROOT_DIR}/scripts/odp_version.sh))

why the echo here? Surely just

+version=$(${ROOT_DIR}/scripts/odp_version.sh)

would suffice? I'm sorry I missed this earlier...

>+for file in debian/*odp* ; do
>+	mv $file $(dirname $file)/$(echo $(basename $file) | sed "s:\([^-\.]*\)\(.*\):\1$current\2:g")
>+done

This works, but is a little ugly. I'd be more tempted to use rename:

rename <regex> debian/*odp*

but it's not important right now.

Cheers,
Anders Roxell Jan. 23, 2015, 2:13 p.m. UTC | #2
On 23 January 2015 at 15:10, Steve McIntyre <steve.mcintyre@linaro.org> wrote:
> On Fri, Jan 23, 2015 at 01:34:21PM +0100, Anders Roxell wrote:
>>Signed-off-by: Anders Roxell <anders.roxell@linaro.org>
>
> Reviewed-by: Steve McIntyre <steve.mcintyre@linaro.org>
>
> Minor nits again:
>
>>+ROOT_DIR=$(readlink -e $(dirname $0) | sed 's|/scripts||')
>>+version=$(echo $(${ROOT_DIR}/scripts/odp_version.sh))
>
> why the echo here? Surely just
>
> +version=$(${ROOT_DIR}/scripts/odp_version.sh)
>
> would suffice? I'm sorry I missed this earlier...

Thats correct, thanks.

that wad there when we passed in a value to odp_version.sh... I forgot
to remove the echo... =(

>
>>+for file in debian/*odp* ; do
>>+      mv $file $(dirname $file)/$(echo $(basename $file) | sed "s:\([^-\.]*\)\(.*\):\1$current\2:g")
>>+done
>
> This works, but is a little ugly. I'd be more tempted to use rename:

agree... looking into that.

>
> rename <regex> debian/*odp*
>
> but it's not important right now.
>
> Cheers,
> --
> Steve McIntyre                                steve.mcintyre@linaro.org
> <http://www.linaro.org/> Linaro.org | Open source software for ARM SoCs
>
diff mbox

Patch

diff --git a/scripts/builddeb b/scripts/builddeb
new file mode 100755
index 0000000..9e93639
--- /dev/null
+++ b/scripts/builddeb
@@ -0,0 +1,30 @@ 
+#!/bin/bash
+
+set -e
+
+ROOT_DIR=$(readlink -e $(dirname $0) | sed 's|/scripts||')
+version=$(echo $(${ROOT_DIR}/scripts/odp_version.sh))
+
+pushd ${ROOT_DIR}
+./bootstrap
+./configure
+make dist
+
+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 .
+
+current=$(echo $version | awk -F . '{printf("%d\n", (($1 * 100) + $2))}')
+
+for file in debian/*odp* ; do
+	mv $file $(dirname $file)/$(echo $(basename $file) | sed "s:\([^-\.]*\)\(.*\):\1$current\2:g")
+done
+
+sed -i "s:\(.*odp\)\([^\.]\|$\):\1$current\2:g" debian/control
+sed -i "s:\(.*odp\)\(.*\):\1$current\2:g" debian/rules
+
+debuild -us -uc
+popd
+popd