Patchwork [6/9] scripts: add buildhistory-tag script

login
register
mail settings
Submitter Paul Eggleton
Date Aug. 2, 2012, 9:23 a.m.
Message ID <db2dd38ac0b16d55f729f63010e38dda4dcfced5.1343899228.git.paul.eggleton@linux.intel.com>
Download mbox | patch
Permalink /patch/33649/
State New
Headers show

Comments

Paul Eggleton - Aug. 2, 2012, 9:23 a.m.
This trivial script determines BUILDHISTORY_DIR using bitbake and then
passes the command line options to "git tag" on the buildhistory
repository. This is useful for setting a tag before making some changes;
even if the build takes a number of executions of bitbake (resulting in
multiple commits to the buildhistory repository) you can still do the
overall comparison easily.

Suggested by Ross Burton <ross.burton@intel.com>.

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
---
 scripts/buildhistory-tag |   42 ++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 42 insertions(+)
 create mode 100755 scripts/buildhistory-tag
Ross Burton - Aug. 2, 2012, 10:18 a.m.
On 2 August 2012 10:23, Paul Eggleton <paul.eggleton@linux.intel.com> wrote:
> This trivial script determines BUILDHISTORY_DIR using bitbake and then
> passes the command line options to "git tag" on the buildhistory
> repository. This is useful for setting a tag before making some changes;
> even if the build takes a number of executions of bitbake (resulting in
> multiple commits to the buildhistory repository) you can still do the
> overall comparison easily.
>
> Suggested by Ross Burton <ross.burton@intel.com>.

I've since changed my local script to be "buildhistory" that just runs
git "$@", so "buildhistory log" etc work nicely.

Ross
Paul Eggleton - Aug. 2, 2012, 10:49 a.m.
On Thursday 02 August 2012 11:18:20 Burton, Ross wrote:
> On 2 August 2012 10:23, Paul Eggleton <paul.eggleton@linux.intel.com> wrote:
> > This trivial script determines BUILDHISTORY_DIR using bitbake and then
> > passes the command line options to "git tag" on the buildhistory
> > repository. This is useful for setting a tag before making some changes;
> > even if the build takes a number of executions of bitbake (resulting in
> > multiple commits to the buildhistory repository) you can still do the
> > overall comparison easily.
> > 
> > Suggested by Ross Burton <ross.burton@intel.com>.
> 
> I've since changed my local script to be "buildhistory" that just runs
> git "$@", so "buildhistory log" etc work nicely.

Interesting - sounds like it would be useful, but I wonder how it would then 
fit in with buildhistory-diff as a separate script (particularly with diff as a 
valid option to "buildhistory")...

Cheers,
Paul
Ross Burton - Aug. 2, 2012, 11:12 a.m.
On 2 August 2012 11:49, Paul Eggleton <paul.eggleton@linux.intel.com> wrote:
> Interesting - sounds like it would be useful, but I wonder how it would then
> fit in with buildhistory-diff as a separate script (particularly with diff as a
> valid option to "buildhistory")...

Rename it to -compare?

Ross

Patch

diff --git a/scripts/buildhistory-tag b/scripts/buildhistory-tag
new file mode 100755
index 0000000..da90bcf
--- /dev/null
+++ b/scripts/buildhistory-tag
@@ -0,0 +1,42 @@ 
+#!/bin/sh
+
+# buildhistory-tag
+#
+# Copyright (C) 2012 Intel Corporation
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License version 2 as
+# published by the Free Software Foundation.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License along
+# with this program; if not, write to the Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+#
+
+if [ -z $1 ] ; then
+    echo "Please specify at least the name of the tag to set"
+    exit 1
+fi
+
+BUILDHISTORY_DIR=`bitbake -e | grep '^BUILDHISTORY_DIR=' | sed -e 's/^[A-Z_]*=//' -e 's/"//g'`
+if [ -z "$BUILDHISTORY_DIR" ]; then
+    echo "Unable to determine BUILDHISTORY_DIR"
+    exit 1
+fi
+
+if [ ! -d "$BUILDHISTORY_DIR" ]; then
+    echo "BUILDHISTORY_DIR $BUILDHISTORY_DIR does not exist"
+    exit 1
+fi
+
+if [ ! -d "$BUILDHISTORY_DIR/.git" ]; then
+    echo "BUILDHISTORY_DIR $BUILDHISTORY_DIR exists but is not a git repository"
+    exit 1
+fi
+
+(cd $BUILDHISTORY_DIR; git tag $@)