On 8 July 2015 at 14:18, Leif Lindholm <leif.lindholm@linaro.org> wrote:
On Tue, Jun 30, 2015 at 05:22:18PM +0100, Ryan Harkin wrote:
> Hello UEFI builders!

Hello UEFI builder!

:-)
 

> I'd like your feedback on this patch.
>
> I often look at boot logs from LAVA and other people and don't quite know
> where the UEFI binary came from.  With ones that I've provided, I can often
> recognise the build date stamp.  But at other times, I'm simply trying to
> work out if someone is building the code they say they are, or some other
> code.
>
> As the commit message says, rather than leaving the version string blank,
> my patch will append the git commit id of the current commit, with "dirty"
> appended if the user is building with uncommited mods.
>
> I considered including the code from linux scripts/setlocalversion, but
> apart from giving me a "-" at the front, I thought it was overkill.
>
> Comments?

I really like the idea, but we should be able to break it out to the top level,
and only perform the logic once per run of the script - like so:

diff --git a/uefi-build.sh b/uefi-build.sh
index 486cf86..228b885 100755
--- a/uefi-build.sh
+++ b/uefi-build.sh
@@ -219,6 +219,16 @@ fi

 EDK2_DIR="$PWD"

+if [[ "${EXTRA_OPTIONS[@]}" != *"FIRMWARE_VER"* ]]; then
+       if test -d .git && head=`git rev-parse --verify --short HEAD
2>/dev/null`; then
+               FIRMWARE_VER=`git rev-parse --short HEAD`
+               if ! git diff-index --quiet HEAD --; then
+                       FIRMWARE_VER="${FIRMWARE_VER}-dirty"
+               fi
+               EXTRA_OPTIONS=( $EXTRA_OPTIONS "-D" FIRMWARE_VER=$FIRMWARE_VER )
+       fi
+fi
+
 uefishell

 for board in "${builds[@]}" ; do


Would you have any objections to that modification?

Good point, well spotted.  I'm happy for you to submit it like that, but let me know if you prefer me to post an updated patch.