Skip to contentSkip to conversation

Restore .git directory in git package downloads

PATCH New James Balean 7 participants 10 messages Apr 19, 2017 – Apr 27, 2017 1 message not in the archive

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Restore .git directory in git package downloads

Removing the .git directory during package download and caching prevents Builroot users from making and testing changes to external software packages using Buildroot. This patch enables users to commit locally, make patches and contribute back to the projects they are using.

Cc Yann E. MORIN <[email protected]>
Cc Thomas Petazzoni <[email protected]>
---
 support/download/git | 4 ----
 1 file changed, 4 deletions(-)
support/download/git +0 -4
index 056057c..a7f307c 100755
@@ -85,10 +85,6 @@ if [ ${recurse} -eq 1 ]; then
     _git submodule update --init --recursive
 fi
 
-# We do not need the .git dir; we keep other .git files, in case they
-# are the only files in their directory.
-rm -rf .git
-
 popd >/dev/null
 
 # Generate the archive, sort with the C locale so that it is reproducible
Signature · 1 line
2.7.4
#1 lore raw

PATCH 1/1 Restore .git directory in git package downloads

Hi James,

Quoted 4 lines · James Balean

Removing the .git directory during package download and caching prevents Builroot users from making and testing changes to external software packages using Buildroot. This patch enables users to commit locally, make patches and contribute back to the projects they are using.

The OVERRIDE_SRCDIR mechanism is meant to cover this use case. See section 8.12.6 "Using Buildroot during development" in the manual[1]. Is there anything missing for your use case?

[1] http://nightly.buildroot.org/manual.html

baruch

Signature · 3 lines
     http://baruch.siach.name/blog/                  ~. .~   Tk Open Systems
=}------------------------------------------------ooO--U--Ooo------------{=
   - baruch at tkos.co.il - tel: +972.2.679.5364, http://www.tkos.co.il -
#2 lore raw

PATCH 1/1 Restore .git directory in git package downloads

Quoted 1 line · Baruch Siach

Is there anything missing for your use case?

This is largely hypothetical (I don't know if any of these are packaged for Buldroot), but I know several projects which try to look at the output of git describe to create a pretty version string at build time (such as "v0.7-220-g270d875").

With kind regards,
Jan

#3 lore raw

PATCH 1/1 Restore .git directory in git package downloads

Hi,

Am 19.04.2017 um 15:01 schrieb Jan Kundr?t:

Quoted 7 lines · Baruch Siach
Quoted 1 line

Is there anything missing for your use case?

This is largely hypothetical (I don't know if any of these are packaged for Buldroot), but I know several projects which try to look at the output of git describe to create a pretty version string at build time (such as "v0.7-220-g270d875").

For me, a custom kernel from private git repo being is one such project. Right now I have a hack to append the shortened contents of BR2_LINUX_KERNEL_CUSTOM_REPO_VERSION via .scmversion. But of course this is not the same/as nice as what git describe or setlocalversion reports.

regards,
Andreas

Quoted 8 lines

With kind regards,
Jan

_______________________________________________
buildroot mailing list
buildroot at busybox.net
http://lists.busybox.net/mailman/listinfo/buildroot

#4 lore raw

PATCH 1/1 Restore .git directory in git package downloads

Quoted 11 lines · Andreas Naumann

Hi,

Am 19.04.2017 um 15:01 schrieb Jan Kundr?t:

Quoted 7 lines · Baruch Siach
Quoted 1 line

Is there anything missing for your use case?

This is largely hypothetical (I don't know if any of these are packaged for Buldroot), but I know several projects which try to look at the output of git describe to create a pretty version string at build time (such as "v0.7-220-g270d875").

Quoted 4 lines

For me, a custom kernel from private git repo being is one such project. Right now I have a hack to append the shortened contents of BR2_LINUX_KERNEL_CUSTOM_REPO_VERSION via .scmversion. But of course this is not the same/as nice as what git describe or setlocalversion reports.

Cfr. http://patchwork.ozlabs.org/patch/732304/ and subsequent discussion.

Regards,
Arnout

Signature · 6 lines
Arnout Vandecappelle                          arnout at mind be
Senior Embedded Software Architect            +32-16-286500
Essensium/Mind                                http://www.mind.be
G.Geenslaan 9, 3001 Leuven, Belgium           BE 872 984 063 RPR Leuven
LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle
GPG fingerprint:  7493 020B C7E3 8618 8DEC 222C 82EB F404 F9AC 0DDF
#5 lore raw

PATCH 1/1 Restore .git directory in git package downloads

In reply to James Balean

James,

[Either I or my mail client did something stupid and the e-mail did not reach the mailing list and the patchwork. Resending to the list]

support/download/git if [ ${recurse} -eq 1 ]; then · line 90

Quoted 8 lines · James Balean

+++ b/support/download/git

support/download/git +0 -3
@@ -85,10 +85,6 @@ if [ ${recurse} -eq 1 ]; then
     _git submodule update --init --recursive
 fi
 
-# We do not need the .git dir; we keep other .git files, in case they
-# are the only files in their directory.
-rm -rf .git

This patch cannot be applied as-is because:

- it would make the tarballs for git packages not reproducible as the contents now depend on the state of the remote server (i.e. in some cases a full clone is needed; assume a tarball is generated, then a new commit is created in the remote server in any branch, a new full clone with the same reference as version would include that new commit and therefore the tarball is different);

- it would make the tarballs for git packages much larger (gigabytes for some linux trees) as they now include the .git directory;

Of course I am not against the discussion looking for another solution.

Regards,
Ricardo

A message that is not in the archive (sent off-list or not yet received): [email protected]

#7 lore raw

PATCH 1/1 Restore .git directory in git package downloads

Hi Ricardo,

Quoted 12 lines · Ricardo Martincoski

support/download/git if [ ${recurse} -eq 1 ]; then · line 90

Quoted 8 lines · James Balean

+++ b/support/download/git

support/download/git +0 -3
@@ -85,10 +85,6 @@ if [ ${recurse} -eq 1 ]; then
     _git submodule update --init --recursive
 fi
 
-# We do not need the .git dir; we keep other .git files, in case they
-# are the only files in their directory.
-rm -rf .git

This patch cannot be applied as-is because:

Quoted 5 lines

- it would make the tarballs for git packages not reproducible as the contents now depend on the state of the remote server (i.e. in some cases a full clone is needed; assume a tarball is generated, then a new commit is created in the remote server in any branch, a new full clone with the same reference as version would include that new commit and therefore the tarball is different);

Interesting. I think it is worth a mention in the comment. Removing .git is not just an optimization as the comment implies. It is necessary in order to verify the generated tarball.

baruch

Signature · 3 lines
     http://baruch.siach.name/blog/                  ~. .~   Tk Open Systems
=}------------------------------------------------ooO--U--Ooo------------{=
   - baruch at tkos.co.il - tel: +972.52.368.4656, http://www.tkos.co.il -
#8 lore raw

PATCH 1/1 Restore .git directory in git package downloads

Thank you for your comments.

Quoted 3 lines · Baruch Siach

The OVERRIDE_SRCDIR mechanism is meant to cover this use case. See section 8.12.6 "Using Buildroot during development" in the manual[1]. Is there anything missing for your use case?

I wasn't aware of the OVERRIDE_SRCDIR flag - thank you for this suggestion. However, I can't help but feel that keeping the .git directory might result in a more integrated way of enabling package development without having to override the build process, and facilitate the use cases mentioned by Jan and Andreas in their comments?

Quoted 6 lines · Ricardo Martincoski

- it would make the tarballs for git packages not reproducible as the contents now depend on the state of the remote server (i.e. in some cases a full clone is needed; assume a tarball is generated, then a new commit is created in the remote server in any branch, a new full clone with the same reference as version would include that new commit and therefore the tarball is different);

Isn't it already the case that git tarballs are not reproducible? For example, after a tarball is generated from a clone of 'master' or a tag, Buildroot doesn't check and re-clone when changes are made to the branch or tag on subsequent builds. Additionally, the same tarball filename is also used for a full clone if a shallow clone fails. So tarballs can already differ markedly between users.

Quoted 2 lines

- it would make the tarballs for git packages much larger (gigabytes for some linux trees) as they now include the .git directory;

That's true. I don't know what people's appetite is for increasing the size of tarballs to enable integrated development, though it is worth noting that by default we only shallow clone with a depth of 1 rather than full clone, so file sizes should be minimized 'in theory'.

Quoted 3 lines · Baruch Siach

Interesting. I think it is worth a mention in the comment. Removing .git is not just an optimization as the comment implies. It is necessary in order to verify the generated tarball.

Not sure the tarball is verifiable without the .git directory, for the reasons mentioned in response to Ricardo above.

--
Thanks again,
James

#9 lore raw

PATCH 1/1 Restore .git directory in git package downloads

Hi James,

Quoted 9 lines · James Balean
Quoted 6 lines · Ricardo Martincoski

- it would make the tarballs for git packages not reproducible as the contents now depend on the state of the remote server (i.e. in some cases a full clone is needed; assume a tarball is generated, then a new commit is created in the remote server in any branch, a new full clone with the same reference as version would include that new commit and therefore the tarball is different);

Quoted 4 lines

Isn't it already the case that git tarballs are not reproducible? For example, after a tarball is generated from a clone of 'master' or a tag, Buildroot doesn't check and re-clone when changes are made to the branch or tag on subsequent builds.

For this reason we only use immutable git references (either commits ids or tags) for git downloaded <PKG>_VERSION.

Quoted 3 lines

Additionally, the same tarball filename is
also used for a full clone if a shallow clone fails. So tarballs can already differ markedly between users.

The content of the source tree should be the same for a given git reference, regardless of the clone type.

Buildroot has been verifying git generated tarballs using hashes in packages/<pkg>/<pkg>.hash files for some time now without an issue, AFAIK.

baruch

Signature · 3 lines
     http://baruch.siach.name/blog/                  ~. .~   Tk Open Systems
=}------------------------------------------------ooO--U--Ooo------------{=
   - baruch at tkos.co.il - tel: +972.2.679.5364, http://www.tkos.co.il -
#10 lore raw

PATCH 1/1 Restore .git directory in git package downloads

Baruch, James,

Quoted 20 lines · Baruch Siach

Hi James,

Quoted 9 lines · James Balean
Quoted 6 lines · Ricardo Martincoski

- it would make the tarballs for git packages not reproducible as the contents now depend on the state of the remote server (i.e. in some cases a full clone is needed; assume a tarball is generated, then a new commit is created in the remote server in any branch, a new full clone with the same reference as version would include that new commit and therefore the tarball is different);

Quoted 4 lines

Isn't it already the case that git tarballs are not reproducible? For example, after a tarball is generated from a clone of 'master' or a tag, Buildroot doesn't check and re-clone when changes are made to the branch or tag on subsequent builds.

For this reason we only use immutable git references (either commits ids or tags) for git downloaded <PKG>_VERSION.

Quoted 6 lines
Quoted 3 lines

Additionally, the same tarball filename is
also used for a full clone if a shallow clone fails. So tarballs can already differ markedly between users.

The content of the source tree should be the same for a given git reference, regardless of the clone type.

Indeed. Tarballs for git packages are already reproducible.

Quoted 2 lines

Buildroot has been verifying git generated tarballs using hashes in packages/<pkg>/<pkg>.hash files for some time now without an issue, AFAIK.

Not yet, but we are almost there, see
http://patchwork.ozlabs.org/patch/741360/

Regards,
Ricardo