From patchwork Tue Nov 10 21:32:11 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anders Roxell X-Patchwork-Id: 56347 Delivered-To: patch@linaro.org Received: by 10.112.155.196 with SMTP id vy4csp1014389lbb; Tue, 10 Nov 2015 13:40:16 -0800 (PST) X-Received: by 10.55.20.4 with SMTP id e4mr7296366qkh.61.1447191616254; Tue, 10 Nov 2015 13:40:16 -0800 (PST) Return-Path: Received: from lists.linaro.org (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTP id j73si4778014qhc.31.2015.11.10.13.40.15; Tue, 10 Nov 2015 13:40:16 -0800 (PST) Received-SPF: pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.225.227.206 as permitted sender) client-ip=54.225.227.206; Authentication-Results: mx.google.com; spf=pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.225.227.206 as permitted sender) smtp.mailfrom=lng-odp-bounces@lists.linaro.org; dkim=neutral (body hash did not verify) header.i=@linaro_org.20150623.gappssmtp.com Received: by lists.linaro.org (Postfix, from userid 109) id BFB6861B3F; Tue, 10 Nov 2015 21:40:15 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on ip-10-142-244-252 X-Spam-Level: X-Spam-Status: No, score=-1.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, T_DKIM_INVALID, T_FRT_SLUT, URIBL_BLOCKED autolearn=disabled version=3.4.0 Received: from [127.0.0.1] (localhost [127.0.0.1]) by lists.linaro.org (Postfix) with ESMTP id B775E61D3D; Tue, 10 Nov 2015 21:37:04 +0000 (UTC) X-Original-To: lng-odp@lists.linaro.org Delivered-To: lng-odp@lists.linaro.org Received: by lists.linaro.org (Postfix, from userid 109) id 3EADC61817; Tue, 10 Nov 2015 21:36:50 +0000 (UTC) Received: from mail-lb0-f180.google.com (mail-lb0-f180.google.com [209.85.217.180]) by lists.linaro.org (Postfix) with ESMTPS id 9FF6761817 for ; Tue, 10 Nov 2015 21:36:44 +0000 (UTC) Received: by lbbcs9 with SMTP id cs9so6245890lbb.1 for ; Tue, 10 Nov 2015 13:36:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro_org.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=stpZTX2tEDR9Kjkx3ZAkGFlxD1P2xEdXhawXQNh+TFg=; b=ZhiOI0H6O2kyVye7CV+eQV7fqdX1xBRoCzfx0TDMKIH+njvmm9msUXmpMTuUl7rGDO 9HhlWzIk+O6OlD258warmudoqXTaFFzNE6w9lFF/ZMYyUqM4F4dvD4JR905AaKe56WOR O4ylv4uCj2/nHxgjViTO1CyhgwVX3RcbcPLXOH98uM90DysB9q1o+EUHga6Id9z4vlmo a1NnRrPgU0wb+sbXzxnONAnhmvIyx2maqqj8yjCB/oERgiRLbQ2Jx3nYGXsJ3+wxn2EE f6gMiK/I0hJIAXMWbSfra/P2qUKcMDyLYdqA+Hia36XJeooVlDOXMdw02AfhW1/A9i8H LGzg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=stpZTX2tEDR9Kjkx3ZAkGFlxD1P2xEdXhawXQNh+TFg=; b=WvNm821O3LLsY/RN8YSm75VeNCkMCK31VsBHJgh+WHn0tGny1AIyItjqDrfFwn7lRu LAKg2XMp6Z+py5UXxENkQwHvoMEvw/SinSpCeGHiUZVbZMvYv9W6U9obGVSjFuJkSZs2 CGnpNI6iPgNcHNVsl2pahuqR5sJ+SMf/hkty5O57b5i9sDNeNhDgHINlpVc3Qdvt0FW6 wlPIsKD2j8wf2biM4N0AEtvUzZAzfFjReZCfhiE6PLPJXTh2KmwPkrDk5lBuL7TpsnC2 PrnYFUowD21c0cm1e3fQZOQ1E6ow1HWkM7Bd2Te2JBnSmHLTBkVAIFJfqfzKXX5kXknw p83A== X-Gm-Message-State: ALoCoQnZM/YEE4D0+FQu26W0sNSW++n5QkVALpvP/NIC65oYKvuyZg2zULdXRBAgeCsCjyBk63HO X-Received: by 10.112.204.101 with SMTP id kx5mr2827470lbc.93.1447191403520; Tue, 10 Nov 2015 13:36:43 -0800 (PST) Received: from localhost (c-aa3470d5.07-21-73746f28.cust.bredbandsbolaget.se. [213.112.52.170]) by smtp.gmail.com with ESMTPSA id br10sm868034lbb.4.2015.11.10.13.36.42 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 10 Nov 2015 13:36:42 -0800 (PST) From: Anders Roxell To: lng-odp@lists.linaro.org Date: Tue, 10 Nov 2015 22:32:11 +0100 Message-Id: <1447191136-21213-5-git-send-email-anders.roxell@linaro.org> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1447191136-21213-1-git-send-email-anders.roxell@linaro.org> References: <1447191136-21213-1-git-send-email-anders.roxell@linaro.org> X-Topics: patch Subject: [lng-odp] [PATCHv3 4/9] scripts: cleanup git_hash and use it instead of odp_version. X-BeenThere: lng-odp@lists.linaro.org X-Mailman-Version: 2.1.16 Precedence: list List-Id: "The OpenDataPlane \(ODP\) List" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: lng-odp-bounces@lists.linaro.org Sender: "lng-odp" This makes the version depend on git describe so there will be new deb packages names. Signed-off-by: Anders Roxell --- configure.ac | 2 +- platform/Makefile.inc | 2 +- scripts/Makefile.am | 2 +- scripts/builddeb | 9 ++++++++- scripts/get_impl_str.sh | 11 +++++++++++ scripts/git_hash.sh | 14 +++++++++++--- scripts/odp_version.sh | 12 ------------ 7 files changed, 33 insertions(+), 19 deletions(-) create mode 100755 scripts/get_impl_str.sh delete mode 100755 scripts/odp_version.sh diff --git a/configure.ac b/configure.ac index b4fae43..abbcf6e 100644 --- a/configure.ac +++ b/configure.ac @@ -1,5 +1,5 @@ AC_PREREQ([2.5]) -AC_INIT([OpenDataPlane], m4_esyscmd(./scripts/odp_version.sh), [lng-odp@lists.linaro.org]) +AC_INIT([OpenDataPlane], m4_esyscmd(./scripts/git_hash.sh .), [lng-odp@lists.linaro.org]) AM_INIT_AUTOMAKE([1.9 tar-pax subdir-objects]) AC_CONFIG_SRCDIR([helper/config.h.in]) AM_CONFIG_HEADER([helper/config.h]) diff --git a/platform/Makefile.inc b/platform/Makefile.inc index 8e8e97b..db241f9 100644 --- a/platform/Makefile.inc +++ b/platform/Makefile.inc @@ -12,6 +12,6 @@ lib_LTLIBRARIES = $(LIB)/libodp.la AM_LDFLAGS += -version-number '$(ODP_LIBSO_VERSION)' -GIT_DESC = `$(top_srcdir)/scripts/git_hash.sh $(top_srcdir)` +GIT_DESC = `$(top_srcdir)/scripts/get_impl_str.sh $(top_srcdir)` AM_CFLAGS += "-DGIT_HASH=$(GIT_DESC)" AM_CFLAGS += -DPLATFORM=${with_platform} diff --git a/scripts/Makefile.am b/scripts/Makefile.am index 617eadc..189b3ef 100644 --- a/scripts/Makefile.am +++ b/scripts/Makefile.am @@ -1 +1 @@ -EXTRA_DIST = git_hash.sh odp_version.sh +EXTRA_DIST = get_impl_str.sh git_hash.sh diff --git a/scripts/builddeb b/scripts/builddeb index ddca129..8a52044 100755 --- a/scripts/builddeb +++ b/scripts/builddeb @@ -3,13 +3,14 @@ set -e ROOT_DIR=$(readlink -e $(dirname $0) | sed 's|/scripts||') -version=$(${ROOT_DIR}/scripts/odp_version.sh) pushd ${ROOT_DIR} ./bootstrap ./configure make dist +version=$(cat ${ROOT_DIR}/.scmversion) + cp opendataplane-${version}.tar.gz opendataplane_${version}.orig.tar.gz tar xzf opendataplane_${version}.orig.tar.gz @@ -22,6 +23,12 @@ rename 's,([^-\.]*)(.*),${1}'"${current}"'${2},' debian/*odp* sed -i "s:\(.*odp\)\([^\.]\|$\):\1${current}\2:g" debian/control sed -i "s:\(.*odp\)\(.*\):\1${current}\2:g" debian/rules +if [ $(egrep "\.([a-z0-9]{8}\>|dirty)" .scmversion |wc -l) -gt 0 ]; then + export DEBFULLNAME="Donald Duck" + export DEBEMAIL="donald.duck@linaro.org" + dch --newversion ${version}-1 --urgency low "not a official release!" +fi + debuild -us -uc popd popd diff --git a/scripts/get_impl_str.sh b/scripts/get_impl_str.sh new file mode 100755 index 0000000..d765a53 --- /dev/null +++ b/scripts/get_impl_str.sh @@ -0,0 +1,11 @@ +#!/bin/bash + +if [ -z ${1} ]; then + echo "should be called with a path" + exit +fi +ROOTDIR=${1} + +CUSTOM_STR=${CUSTOM_STR:-https://git.linaro.org/lng/odp.git} + +echo -n "'${CUSTOM_STR}' ($(cat ${ROOTDIR}/.scmversion))" diff --git a/scripts/git_hash.sh b/scripts/git_hash.sh index fc0b057..ccd62ab 100755 --- a/scripts/git_hash.sh +++ b/scripts/git_hash.sh @@ -6,15 +6,23 @@ if [ -z ${1} ]; then fi ROOTDIR=${1} -CUSTOM_STR=${CUSTOM_STR:-https://git.linaro.org/lng/odp.git} if [ -d ${ROOTDIR}/.git ]; then hash=$(git --git-dir=${ROOTDIR}/.git describe | tr -d "\n") if [[ $(git --git-dir=${ROOTDIR}/.git diff --shortstat 2> /dev/null \ | tail -n1) != "" ]]; then - dirty=-dirty + dirty=.dirty fi - echo -n "'${CUSTOM_STR}' (${hash}${dirty})">${ROOTDIR}/.scmversion + echo -n "${hash}${dirty}">${ROOTDIR}/.scmversion + + sed -i "s|-|.git|" ${ROOTDIR}/.scmversion + sed -i "s|-|.|g" ${ROOTDIR}/.scmversion + sed -i "s|^v||g" ${ROOTDIR}/.scmversion +elif [ ! -d ${ROOTDIR}/.git -a ! -f ${ROOTDIR}/.scmversion ]; then + echo -n "File ROOTDIR/.scmversion not found, " + echo "and not inside a git repository" + echo "Bailing out! Not recoverable!" + exit 1 fi cat ${ROOTDIR}/.scmversion diff --git a/scripts/odp_version.sh b/scripts/odp_version.sh deleted file mode 100755 index 2487b7f..0000000 --- a/scripts/odp_version.sh +++ /dev/null @@ -1,12 +0,0 @@ -#!/bin/bash - -VFILE="include/odp/api/version.h" - -GEN=`grep "define ODP_VERSION_API_GENERATION" ${VFILE} | cut -d ' ' -f 3` -MAJ=`grep "define ODP_VERSION_API_MAJOR" ${VFILE} | cut -d ' ' -f 3` -MIN=`grep "define ODP_VERSION_API_MINOR" ${VFILE} | cut -d ' ' -f 3` - -IMPL_FILE="platform/linux-generic/odp_impl.c" -IMPL=`grep "define ODP_VERSION_IMPL " ${IMPL_FILE} | cut -d ' ' -f 3` - -echo -n $GEN.$MAJ.$MIN.$IMPL