On Mon, Sep 16, 2024 at 07:51:31PM +0000, Anthony Ortega wrote:
> I am trying to generate reproducible builds for a Linux environment
> using Buildroot. One of the last packages that is giving me trouble
> is the DTC programs.
> [...]
> They all seem to intend to encode the git
> version of the package they were pulled from. However, in a build
> system such as Buildroot the DTC source is staged in such a way that
> the git information is stripped away. While that in of itself is not
> a problem, the problem is that it may be getting built in an output
> directory that is within a larger git repository. Therefore, when
> the setlocalversion script runs, it ends up pulling the version of
> this larger git repository.
Yocto/OpenEmbedded[1] and OpenWrt[2] avoid such issues by setting
GIT_CEILING_DIRECTORIES. Maybe buildroot could do the same and fix it
for all packages, not just dtc tools?
[1]
https://git.openembedded.org/openembedded-core/tree/meta/conf/bitbake.conf?id=bb3101fffceacfa4c021c33affb7c785da8d859f#n788
[2]
https://git.openwrt.org/?p=openwrt/openwrt.git;a=blob;f=include/package.mk;h=7fbecf98dc7c9a5b11ce1958e254578f7e4d9c73;hb=7850e197670afff38426075953ba6a71f0f431c8#l202
On 2024-09-20 13:05, david@xxxxxxxxxxxxxxxxxxxxx wrote:
> Unfortunately, I don't think our system can be configured to use
> meson without a massive overhaul. In the short term I've applied a
> patch in our build that removes the line that grabs the commit tag
> during build.
On Thu, Sep 19, 2024 at 09:45:04PM +0000, Anthony Ortega wrote:
> But, in any case, I wasn't suggesting this as a practical workaround,
> but more as a diagnostic. If it works with meson we can look closer
> at what it's doing and maybe duplicate it with make.
I do not know what other projects do, but most likely those that do not
exhibit this issue, set the git-dir explicitly (or use GIT_CEILING_DIRS)
to avoid git taking some repository above the source directory.
I still think as a first thing, buildroot should implement a generic
solution and then we can look into fixing dtc and tools.
Regards, Andreas