mailarchive of the ptxdist mailing list
 help / color / mirror / Atom feed
* [ptxdist] [PATCH v2 1/2] ptxd_make_vcs_version: add script to determine vcs hash
@ 2021-04-01  4:52 Steffen Trumtrar
  2021-04-01  4:52 ` [ptxdist] [PATCH v2 2/2] rules: barebox: support barebox buildsystem_version Steffen Trumtrar
  2021-04-01  5:46 ` [ptxdist] [PATCH v2 1/2] ptxd_make_vcs_version: add script to determine vcs hash Michael Olbrich
  0 siblings, 2 replies; 4+ messages in thread
From: Steffen Trumtrar @ 2021-04-01  4:52 UTC (permalink / raw)
  To: ptxdist

Add a script to determine a uniquely abbreviated commit object of the
current bsp state. The information is exported to the variable
PTXDIST_VCS_VERSION so it can be used from other scripts and rules.

Signed-off-by: Steffen Trumtrar <s.trumtrar@pengutronix.de>
---
changes in v2:
    - use "--tags" in git describe

 scripts/lib/ptxd_make_vcs_version.sh | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)
 create mode 100644 scripts/lib/ptxd_make_vcs_version.sh

diff --git a/scripts/lib/ptxd_make_vcs_version.sh b/scripts/lib/ptxd_make_vcs_version.sh
new file mode 100644
index 000000000000..07856db967b4
--- /dev/null
+++ b/scripts/lib/ptxd_make_vcs_version.sh
@@ -0,0 +1,20 @@
+#!/bin/bash
+#
+# Copyright (C) 2020 by Steffen Trumtrar <s.trumtrar@pengutronix.de>
+#
+# For further information about the PTXdist project and license conditions
+# see the README file.
+#
+
+ptxd_make_vcs_version() {
+    PTXDIST_VCS_VERSION="$(echo $(git describe 2>/dev/null || git describe --always --tags))"
+
+    if [ -z "${PTXDIST_VCS_VERSION}" ]; then
+       PTXDIST_BUILD_VERSION_VCS="unknown"
+    fi
+
+    export PTXDIST_VCS_VERSION
+}
+export -f ptxd_make_vcs_version
+
+ptxd_make_vcs_version
-- 
2.29.2


_______________________________________________
ptxdist mailing list
ptxdist@pengutronix.de
To unsubscribe, send a mail with subject "unsubscribe" to ptxdist-request@pengutronix.de

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [ptxdist] [PATCH v2 2/2] rules: barebox: support barebox buildsystem_version
  2021-04-01  4:52 [ptxdist] [PATCH v2 1/2] ptxd_make_vcs_version: add script to determine vcs hash Steffen Trumtrar
@ 2021-04-01  4:52 ` Steffen Trumtrar
  2021-04-01  5:46 ` [ptxdist] [PATCH v2 1/2] ptxd_make_vcs_version: add script to determine vcs hash Michael Olbrich
  1 sibling, 0 replies; 4+ messages in thread
From: Steffen Trumtrar @ 2021-04-01  4:52 UTC (permalink / raw)
  To: ptxdist

barebox supports setting a buildsystem version. This is useful to have
an exact buildsystem version like a commit hash accessible from barebox.

Signed-off-by: Steffen Trumtrar <s.trumtrar@pengutronix.de>
---
 platforms/barebox.in | 13 +++++++++++++
 rules/barebox.make   |  5 +++++
 2 files changed, 18 insertions(+)

diff --git a/platforms/barebox.in b/platforms/barebox.in
index 70d175fb5a03..d35d165011b9 100644
--- a/platforms/barebox.in
+++ b/platforms/barebox.in
@@ -27,6 +27,19 @@ config BAREBOX_VERSION
 	string
 	default "2016.08.0"
 
+config BAREBOX_CONFIG_BUILDSYSTEM_VERSION
+        prompt "add a buildsystem version to the barebox binary"
+        bool
+        help
+          When this option is enabled, the nv variable "nv.buildsystem_version"
+          in barebox is set to PTXCONF_BAREBOX_BUILDSYSTEM_VERSION.
+
+config BAREBOX_BUILDSYSTEM_VERSION
+        prompt "barebox buildsystem version"
+        depends on BAREBOX_CONFIG_BUILDSYSTEM_VERSION
+        string
+        default "${PTXDIST_VCS_VERSION}"
+
 config BAREBOX_MD5
 	prompt "barebox source md5sum"
 	string
diff --git a/rules/barebox.make b/rules/barebox.make
index 23c948408ab3..bea9f3adcbf8 100644
--- a/rules/barebox.make
+++ b/rules/barebox.make
@@ -46,6 +46,11 @@ BAREBOX_CONF_OPT	:= \
 	O=$(BAREBOX_BUILD_DIR) \
 	$(call barebox-opts, BAREBOX)
 
+ifdef PTXCONF_BAREBOX_CONFIG_BUILDSYSTEM_VERSION
+BAREBOX_CONF_OPT += \
+        BUILDSYSTEM_VERSION=$(PTXCONF_BAREBOX_BUILDSYSTEM_VERSION)
+endif
+
 BAREBOX_MAKE_OPT	:= $(BAREBOX_CONF_OPT)
 
 BAREBOX_TAGS_OPT	:= TAGS tags cscope
-- 
2.29.2


_______________________________________________
ptxdist mailing list
ptxdist@pengutronix.de
To unsubscribe, send a mail with subject "unsubscribe" to ptxdist-request@pengutronix.de

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [ptxdist] [PATCH v2 1/2] ptxd_make_vcs_version: add script to determine vcs hash
  2021-04-01  4:52 [ptxdist] [PATCH v2 1/2] ptxd_make_vcs_version: add script to determine vcs hash Steffen Trumtrar
  2021-04-01  4:52 ` [ptxdist] [PATCH v2 2/2] rules: barebox: support barebox buildsystem_version Steffen Trumtrar
@ 2021-04-01  5:46 ` Michael Olbrich
  2021-04-01  6:43   ` Steffen Trumtrar
  1 sibling, 1 reply; 4+ messages in thread
From: Michael Olbrich @ 2021-04-01  5:46 UTC (permalink / raw)
  To: ptxdist

On Thu, Apr 01, 2021 at 06:52:51AM +0200, Steffen Trumtrar wrote:
> Add a script to determine a uniquely abbreviated commit object of the
> current bsp state. The information is exported to the variable
> PTXDIST_VCS_VERSION so it can be used from other scripts and rules.
> 
> Signed-off-by: Steffen Trumtrar <s.trumtrar@pengutronix.de>
> ---
> changes in v2:
>     - use "--tags" in git describe
> 
>  scripts/lib/ptxd_make_vcs_version.sh | 20 ++++++++++++++++++++
>  1 file changed, 20 insertions(+)
>  create mode 100644 scripts/lib/ptxd_make_vcs_version.sh
> 
> diff --git a/scripts/lib/ptxd_make_vcs_version.sh b/scripts/lib/ptxd_make_vcs_version.sh
> new file mode 100644
> index 000000000000..07856db967b4
> --- /dev/null
> +++ b/scripts/lib/ptxd_make_vcs_version.sh
> @@ -0,0 +1,20 @@
> +#!/bin/bash
> +#
> +# Copyright (C) 2020 by Steffen Trumtrar <s.trumtrar@pengutronix.de>
> +#
> +# For further information about the PTXdist project and license conditions
> +# see the README file.
> +#
> +
> +ptxd_make_vcs_version() {
> +    PTXDIST_VCS_VERSION="$(echo $(git describe 2>/dev/null || git describe --always --tags))"

We should probably redirect stderr for the second git command as well.

> +
> +    if [ -z "${PTXDIST_VCS_VERSION}" ]; then
> +       PTXDIST_BUILD_VERSION_VCS="unknown"

Wrong indention (on tab here). And this should be:

	PTXDIST_VCS_VERSION="unknown"

right?

Michael

> +    fi
> +
> +    export PTXDIST_VCS_VERSION
> +}
> +export -f ptxd_make_vcs_version
> +
> +ptxd_make_vcs_version
> -- 
> 2.29.2
> 
> 
> _______________________________________________
> ptxdist mailing list
> ptxdist@pengutronix.de
> To unsubscribe, send a mail with subject "unsubscribe" to ptxdist-request@pengutronix.de
> 

-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
ptxdist mailing list
ptxdist@pengutronix.de
To unsubscribe, send a mail with subject "unsubscribe" to ptxdist-request@pengutronix.de

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [ptxdist] [PATCH v2 1/2] ptxd_make_vcs_version: add script to determine vcs hash
  2021-04-01  5:46 ` [ptxdist] [PATCH v2 1/2] ptxd_make_vcs_version: add script to determine vcs hash Michael Olbrich
@ 2021-04-01  6:43   ` Steffen Trumtrar
  0 siblings, 0 replies; 4+ messages in thread
From: Steffen Trumtrar @ 2021-04-01  6:43 UTC (permalink / raw)
  To: ptxdist


Michael Olbrich <m.olbrich@pengutronix.de> writes:

> On Thu, Apr 01, 2021 at 06:52:51AM +0200, Steffen Trumtrar wrote:
>> Add a script to determine a uniquely abbreviated commit object of the
>> current bsp state. The information is exported to the variable
>> PTXDIST_VCS_VERSION so it can be used from other scripts and rules.
>>
>> Signed-off-by: Steffen Trumtrar <s.trumtrar@pengutronix.de>
>> ---
>> changes in v2:
>>     - use "--tags" in git describe
>>
>>  scripts/lib/ptxd_make_vcs_version.sh | 20 ++++++++++++++++++++
>>  1 file changed, 20 insertions(+)
>>  create mode 100644 scripts/lib/ptxd_make_vcs_version.sh
>>
>> diff --git a/scripts/lib/ptxd_make_vcs_version.sh b/scripts/lib/ptxd_make_vcs_version.sh
>> new file mode 100644
>> index 000000000000..07856db967b4
>> --- /dev/null
>> +++ b/scripts/lib/ptxd_make_vcs_version.sh
>> @@ -0,0 +1,20 @@
>> +#!/bin/bash
>> +#
>> +# Copyright (C) 2020 by Steffen Trumtrar <s.trumtrar@pengutronix.de>
>> +#
>> +# For further information about the PTXdist project and license conditions
>> +# see the README file.
>> +#
>> +
>> +ptxd_make_vcs_version() {
>> +    PTXDIST_VCS_VERSION="$(echo $(git describe 2>/dev/null || git describe --always --tags))"
>
> We should probably redirect stderr for the second git command as well.
>

Ok.

>> +
>> +    if [ -z "${PTXDIST_VCS_VERSION}" ]; then
>> +       PTXDIST_BUILD_VERSION_VCS="unknown"
>
> Wrong indention (on tab here). And this should be:
>
> 	PTXDIST_VCS_VERSION="unknown"
>
> right?
>

Right, of course.


Best regards,
Steffen

--
Pengutronix e.K.                | Dipl.-Inform. Steffen Trumtrar |
Steuerwalder Str. 21            | https://www.pengutronix.de/    |
31137 Hildesheim, Germany       | Phone: +49-5121-206917-0       |
Amtsgericht Hildesheim, HRA 2686| Fax:   +49-5121-206917-5555    |

_______________________________________________
ptxdist mailing list
ptxdist@pengutronix.de
To unsubscribe, send a mail with subject "unsubscribe" to ptxdist-request@pengutronix.de

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2021-04-01  6:43 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-01  4:52 [ptxdist] [PATCH v2 1/2] ptxd_make_vcs_version: add script to determine vcs hash Steffen Trumtrar
2021-04-01  4:52 ` [ptxdist] [PATCH v2 2/2] rules: barebox: support barebox buildsystem_version Steffen Trumtrar
2021-04-01  5:46 ` [ptxdist] [PATCH v2 1/2] ptxd_make_vcs_version: add script to determine vcs hash Michael Olbrich
2021-04-01  6:43   ` Steffen Trumtrar

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox