buildroot.busybox.net archive mirror
 help / color / mirror / Atom feed
* [Buildroot] [PATCH] package/pcm-tools: fix github-download
@ 2023-08-29 12:09 Yann E. MORIN
  2023-08-30 19:43 ` Arnout Vandecappelle via buildroot
  2023-09-13 20:12 ` Peter Korsgaard
  0 siblings, 2 replies; 3+ messages in thread
From: Yann E. MORIN @ 2023-08-29 12:09 UTC (permalink / raw)
  To: buildroot; +Cc: Woody Douglass, Yann E. MORIN, Thomas Petazzoni

The pcm-tools package contains a version.h with git attributes:

    $ cat version.h
    #define PCM_VERSION " ($Format:%ci ID=%h$)"

    $ man 5 gitattributes
       Creating an archive
         export-subst
           If the attribute export-subst is set for a file then Git
           will expand several placeholders when adding this file to
           an archive. The expansion depends on the availability of
           a commit ID, i.e., if git-archive(1) has been given a tree
           instead of a commit or a tag then no replacement will be
           done. The placeholders are the same as those for the option
           --pretty=format: of git-log(1), except that they need to be
           wrapped like this: $Format:PLACEHOLDERS$ in the file. E.g.
           the string $Format:%H$ will be replaced by the commit hash.

So, the archive generated by github has changed since we updated
pcm-tools in 2021-12-08 with commit d1d93d488c76 (package/pcm-tools:
bump to version 202110). The downlad was still OK in 2022-01-04 [0]
but has been failing at least since 202-08-25 [1].

Since the archive is generated on the github side, there is not much we
can do to fix this up.

We switch over to using git to do the download, and we generate the
archive localy, which we know is reproducible.

We fix the version.h so that it contains the same string as the backup
tarball we host on s.b.o.

There are three other files in pcm-tools that have git attributes, to
exclude them from the generated archive, all pertaining to CI/CD stuff:
    .cirrus.yml export-ignore
    .gitlab-ci.yml export-ignore
    .travis.yml export-ignore

We don't remove them, because they have no impact on the build, and they
are anyway already present in the archive by the time we could act on it
anyway...

[0] http://autobuild.buildroot.org/results/127/1276a3d49c8848039f034e7f03632df365097e94/
[1] http://autobuild.buildroot.org/results/8bb/8bbf9c36af332bbf5e7c1abcbb594a0b231ef97e/

Reported-by: Woody Douglass <wdouglass@carnegierobotics.com>
Reported-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
Signed-off-by: Yann E. MORIN <yann.morin.1998@free.fr>
---
 package/pcm-tools/pcm-tools.hash |  2 +-
 package/pcm-tools/pcm-tools.mk   | 16 ++++++++++++++--
 2 files changed, 15 insertions(+), 3 deletions(-)

diff --git a/package/pcm-tools/pcm-tools.hash b/package/pcm-tools/pcm-tools.hash
index 1853dcebb5..cfa3faeff7 100644
--- a/package/pcm-tools/pcm-tools.hash
+++ b/package/pcm-tools/pcm-tools.hash
@@ -1,3 +1,3 @@
 # Locally calculated
-sha256  aa48ab1473720aeb7837b67bfc612100f484748720a8b8034daff00419709057  pcm-tools-202110.tar.gz
+sha256  29416f83d1de95594d225f63af34f8f074ee4822010ce2e05b1fabc66933472a  pcm-tools-93fc9193a70e2f1f054be554c48f4a4791be5032-br1.tar.gz
 sha256  0f476c77009f982dcc4bdff41e692ddd456a9862908e99f2ae3d57296decc649  LICENSE
diff --git a/package/pcm-tools/pcm-tools.mk b/package/pcm-tools/pcm-tools.mk
index d676df57f9..c530492696 100644
--- a/package/pcm-tools/pcm-tools.mk
+++ b/package/pcm-tools/pcm-tools.mk
@@ -4,8 +4,12 @@
 #
 ################################################################################
 
-PCM_TOOLS_VERSION = 202110
-PCM_TOOLS_SITE = $(call github,opcm,pcm,$(PCM_TOOLS_VERSION))
+# Don't use the github helper, as pcm-tools uses git attributes that are
+# replaced when gnerating the archive.
+# 93fc9193a70e2f1f054be554c48f4a4791be5032 is the hash of the 202110 tag.
+PCM_TOOLS_VERSION = 93fc9193a70e2f1f054be554c48f4a4791be5032
+PCM_TOOLS_SITE = https://github.com/opcm/pcm
+PCM_TOOLS_SITE_METHOD = git
 PCM_TOOLS_LICENSE = BSD-3-Clause
 PCM_TOOLS_LICENSE_FILES = LICENSE
 
@@ -13,6 +17,14 @@ PCM_TOOLS_EXE_FILES = \
 	pcm-core pcm-iio pcm-lspci pcm-memory pcm-msr pcm-numa \
 	pcm-pcicfg pcm-pcie pcm-power pcm-sensor pcm-tsx pcm
 
+# version.h contains git attributes; replace them with the previously-known
+# value.
+define PCM_TOOLS_FIXUP_VERSION_H
+	$(SED) 's/\$$Format:%ci ID=%h\$$/2021-10-25 16:07:54 +0200 ID=93fc9193/' \
+		$(@D)/version.h
+endef
+PCM_TOOLS_POST_EXTRACT_HOOKS += PCM_TOOLS_FIXUP_VERSION_H
+
 define PCM_TOOLS_BUILD_CMDS
 	touch $(@D)/daemon-binaries
 	$(TARGET_MAKE_ENV) $(MAKE) $(TARGET_CONFIGURE_OPTS) -C $(@D) \
-- 
2.25.1

_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

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

* Re: [Buildroot] [PATCH] package/pcm-tools: fix github-download
  2023-08-29 12:09 [Buildroot] [PATCH] package/pcm-tools: fix github-download Yann E. MORIN
@ 2023-08-30 19:43 ` Arnout Vandecappelle via buildroot
  2023-09-13 20:12 ` Peter Korsgaard
  1 sibling, 0 replies; 3+ messages in thread
From: Arnout Vandecappelle via buildroot @ 2023-08-30 19:43 UTC (permalink / raw)
  To: Yann E. MORIN, buildroot; +Cc: Woody Douglass, Thomas Petazzoni



On 29/08/2023 14:09, Yann E. MORIN wrote:
> The pcm-tools package contains a version.h with git attributes:
> 
>      $ cat version.h
>      #define PCM_VERSION " ($Format:%ci ID=%h$)"
> 
>      $ man 5 gitattributes
>         Creating an archive
>           export-subst
>             If the attribute export-subst is set for a file then Git
>             will expand several placeholders when adding this file to
>             an archive. The expansion depends on the availability of
>             a commit ID, i.e., if git-archive(1) has been given a tree
>             instead of a commit or a tag then no replacement will be
>             done. The placeholders are the same as those for the option
>             --pretty=format: of git-log(1), except that they need to be
>             wrapped like this: $Format:PLACEHOLDERS$ in the file. E.g.
>             the string $Format:%H$ will be replaced by the commit hash.
> 
> So, the archive generated by github has changed since we updated
> pcm-tools in 2021-12-08 with commit d1d93d488c76 (package/pcm-tools:
> bump to version 202110). The downlad was still OK in 2022-01-04 [0]
> but has been failing at least since 202-08-25 [1].
> 
> Since the archive is generated on the github side, there is not much we
> can do to fix this up.
> 
> We switch over to using git to do the download, and we generate the
> archive localy, which we know is reproducible.
> 
> We fix the version.h so that it contains the same string as the backup
> tarball we host on s.b.o.
> 
> There are three other files in pcm-tools that have git attributes, to
> exclude them from the generated archive, all pertaining to CI/CD stuff:
>      .cirrus.yml export-ignore
>      .gitlab-ci.yml export-ignore
>      .travis.yml export-ignore
> 
> We don't remove them, because they have no impact on the build, and they
> are anyway already present in the archive by the time we could act on it
> anyway...
> 
> [0] http://autobuild.buildroot.org/results/127/1276a3d49c8848039f034e7f03632df365097e94/
> [1] http://autobuild.buildroot.org/results/8bb/8bbf9c36af332bbf5e7c1abcbb594a0b231ef97e/
> 
> Reported-by: Woody Douglass <wdouglass@carnegierobotics.com>
> Reported-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
> Signed-off-by: Yann E. MORIN <yann.morin.1998@free.fr>
> ---
>   package/pcm-tools/pcm-tools.hash |  2 +-
>   package/pcm-tools/pcm-tools.mk   | 16 ++++++++++++++--
>   2 files changed, 15 insertions(+), 3 deletions(-)
> 
> diff --git a/package/pcm-tools/pcm-tools.hash b/package/pcm-tools/pcm-tools.hash
> index 1853dcebb5..cfa3faeff7 100644
> --- a/package/pcm-tools/pcm-tools.hash
> +++ b/package/pcm-tools/pcm-tools.hash
> @@ -1,3 +1,3 @@
>   # Locally calculated
> -sha256  aa48ab1473720aeb7837b67bfc612100f484748720a8b8034daff00419709057  pcm-tools-202110.tar.gz
> +sha256  29416f83d1de95594d225f63af34f8f074ee4822010ce2e05b1fabc66933472a  pcm-tools-93fc9193a70e2f1f054be554c48f4a4791be5032-br1.tar.gz
>   sha256  0f476c77009f982dcc4bdff41e692ddd456a9862908e99f2ae3d57296decc649  LICENSE
> diff --git a/package/pcm-tools/pcm-tools.mk b/package/pcm-tools/pcm-tools.mk
> index d676df57f9..c530492696 100644
> --- a/package/pcm-tools/pcm-tools.mk
> +++ b/package/pcm-tools/pcm-tools.mk
> @@ -4,8 +4,12 @@
>   #
>   ################################################################################
>   
> -PCM_TOOLS_VERSION = 202110
> -PCM_TOOLS_SITE = $(call github,opcm,pcm,$(PCM_TOOLS_VERSION))
> +# Don't use the github helper, as pcm-tools uses git attributes that are
> +# replaced when gnerating the archive.
> +# 93fc9193a70e2f1f054be554c48f4a4791be5032 is the hash of the 202110 tag.
> +PCM_TOOLS_VERSION = 93fc9193a70e2f1f054be554c48f4a4791be5032

  We did not, in fact, need to change to a hash, because the filename anyway 
changes due to the -br1 suffix. Keeping an actual version has the advantage that 
it's still possible to do version comparisons for CVE and release-monitoring.

  On the other hand, you never know if upstream changes the tag. And this 
package anyway doesn't have a valid CPE.

  Therefore, applied to master as is, thanks.

  Regards,
  Arnout

> +PCM_TOOLS_SITE = https://github.com/opcm/pcm
> +PCM_TOOLS_SITE_METHOD = git
>   PCM_TOOLS_LICENSE = BSD-3-Clause
>   PCM_TOOLS_LICENSE_FILES = LICENSE
>   
> @@ -13,6 +17,14 @@ PCM_TOOLS_EXE_FILES = \
>   	pcm-core pcm-iio pcm-lspci pcm-memory pcm-msr pcm-numa \
>   	pcm-pcicfg pcm-pcie pcm-power pcm-sensor pcm-tsx pcm
>   
> +# version.h contains git attributes; replace them with the previously-known
> +# value.
> +define PCM_TOOLS_FIXUP_VERSION_H
> +	$(SED) 's/\$$Format:%ci ID=%h\$$/2021-10-25 16:07:54 +0200 ID=93fc9193/' \
> +		$(@D)/version.h
> +endef
> +PCM_TOOLS_POST_EXTRACT_HOOKS += PCM_TOOLS_FIXUP_VERSION_H
> +
>   define PCM_TOOLS_BUILD_CMDS
>   	touch $(@D)/daemon-binaries
>   	$(TARGET_MAKE_ENV) $(MAKE) $(TARGET_CONFIGURE_OPTS) -C $(@D) \
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

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

* Re: [Buildroot] [PATCH] package/pcm-tools: fix github-download
  2023-08-29 12:09 [Buildroot] [PATCH] package/pcm-tools: fix github-download Yann E. MORIN
  2023-08-30 19:43 ` Arnout Vandecappelle via buildroot
@ 2023-09-13 20:12 ` Peter Korsgaard
  1 sibling, 0 replies; 3+ messages in thread
From: Peter Korsgaard @ 2023-09-13 20:12 UTC (permalink / raw)
  To: Yann E. MORIN; +Cc: Woody Douglass, Thomas Petazzoni, buildroot

>>>>> "Yann" == Yann E MORIN <yann.morin.1998@free.fr> writes:

 > The pcm-tools package contains a version.h with git attributes:
 >     $ cat version.h
 >     #define PCM_VERSION " ($Format:%ci ID=%h$)"

 >     $ man 5 gitattributes
 >        Creating an archive
 >          export-subst
 >            If the attribute export-subst is set for a file then Git
 >            will expand several placeholders when adding this file to
 >            an archive. The expansion depends on the availability of
 >            a commit ID, i.e., if git-archive(1) has been given a tree
 >            instead of a commit or a tag then no replacement will be
 >            done. The placeholders are the same as those for the option
 >            --pretty=format: of git-log(1), except that they need to be
 >            wrapped like this: $Format:PLACEHOLDERS$ in the file. E.g.
 >            the string $Format:%H$ will be replaced by the commit hash.

 > So, the archive generated by github has changed since we updated
 > pcm-tools in 2021-12-08 with commit d1d93d488c76 (package/pcm-tools:
 > bump to version 202110). The downlad was still OK in 2022-01-04 [0]
 > but has been failing at least since 202-08-25 [1].

 > Since the archive is generated on the github side, there is not much we
 > can do to fix this up.

 > We switch over to using git to do the download, and we generate the
 > archive localy, which we know is reproducible.

 > We fix the version.h so that it contains the same string as the backup
 > tarball we host on s.b.o.

 > There are three other files in pcm-tools that have git attributes, to
 > exclude them from the generated archive, all pertaining to CI/CD stuff:
 >     .cirrus.yml export-ignore
 >     .gitlab-ci.yml export-ignore
 >     .travis.yml export-ignore

 > We don't remove them, because they have no impact on the build, and they
 > are anyway already present in the archive by the time we could act on it
 > anyway...

 > [0] http://autobuild.buildroot.org/results/127/1276a3d49c8848039f034e7f03632df365097e94/
 > [1] http://autobuild.buildroot.org/results/8bb/8bbf9c36af332bbf5e7c1abcbb594a0b231ef97e/

 > Reported-by: Woody Douglass <wdouglass@carnegierobotics.com>
 > Reported-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
 > Signed-off-by: Yann E. MORIN <yann.morin.1998@free.fr>

Committed to 2023.02.x and 2023.05.x, thanks.

-- 
Bye, Peter Korsgaard
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

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

end of thread, other threads:[~2023-09-13 20:12 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-08-29 12:09 [Buildroot] [PATCH] package/pcm-tools: fix github-download Yann E. MORIN
2023-08-30 19:43 ` Arnout Vandecappelle via buildroot
2023-09-13 20:12 ` Peter Korsgaard

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).