* [Buildroot] [RFC] iputils (meson build system) has git version from buildroot instead of iputils @ 2022-05-10 20:15 Petr Vorel 2022-05-10 21:47 ` Fabrice Fontaine 0 siblings, 1 reply; 4+ messages in thread From: Petr Vorel @ 2022-05-10 20:15 UTC (permalink / raw) To: buildroot; +Cc: Eric Le Bihan, Yann E. MORIN, Dagg Stompler, Fabrice Fontaine Hi all, meson.build [1] uses git-version.h.meson [2] to produce BUILD_DIRECTORY/git-version.h. Building from sources (not in Buildroot) it works: $ head -1 builddir/git-version.h #define PACKAGE_VERSION "20211215-15-g309f285" But building in Buildroot it gets git version from Buildroot: $ head -1 output/build/iputils-20211215/build/git-version.h #define PACKAGE_VERSION "2022.02-876-g3ef096786a" Is it a bug in iputils or in Buildroot meson? Any idea how to fix it? Kind regards, Petr [1] https://github.com/iputils/iputils/blob/master/meson.build#L14 [2] https://github.com/iputils/iputils/blob/master/git-version.h.meson _______________________________________________ buildroot mailing list buildroot@buildroot.org https://lists.buildroot.org/mailman/listinfo/buildroot ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [Buildroot] [RFC] iputils (meson build system) has git version from buildroot instead of iputils 2022-05-10 20:15 [Buildroot] [RFC] iputils (meson build system) has git version from buildroot instead of iputils Petr Vorel @ 2022-05-10 21:47 ` Fabrice Fontaine 2022-05-11 6:42 ` Arnout Vandecappelle 0 siblings, 1 reply; 4+ messages in thread From: Fabrice Fontaine @ 2022-05-10 21:47 UTC (permalink / raw) To: Petr Vorel Cc: Eric Le Bihan, Buildroot Mailing List, Dagg Stompler, Yann E. MORIN Hi Petr, Le mar. 10 mai 2022 à 22:16, Petr Vorel <petr.vorel@gmail.com> a écrit : > > Hi all, > > meson.build [1] uses git-version.h.meson [2] to produce BUILD_DIRECTORY/git-version.h. > > Building from sources (not in Buildroot) it works: > $ head -1 builddir/git-version.h > #define PACKAGE_VERSION "20211215-15-g309f285" > > But building in Buildroot it gets git version from Buildroot: > $ head -1 output/build/iputils-20211215/build/git-version.h > #define PACKAGE_VERSION "2022.02-876-g3ef096786a" > > Is it a bug in iputils or in Buildroot meson? This issue is raised because, in the context of buildroot, iputils is retrieved as a tarball, not a git clone. So meson's vcs_tag will retrieve the git information from buildroot and will not use its fallback (i.e. meson.project_version()). To fix it, there is three "simple" options: - allow buildroot to configure the version (as already done in open62541 package) - don't use vcs_tag and always set package_version to meson.project_version() outside of a "devel" mode as done for example in gnome console [1] - override the default vcs command in vcs_tag call (e.g. command: 'git --git-dir=.git describe --dirty=+') Another option would be to patch meson so vcs_tag is always run with "--git-dir=.git". This is probably the more correct option as this issue is probably affecting other packages than iputils. However, from my experience in meson, getting something merged upstream can take a very very long time (e.g. more than two years for a prefer_static option [2]) I don't know if this is completely related but this issue on vcs_tag is opened for more than one year [3] ... > Any idea how to fix it? > > Kind regards, > Petr > > [1] https://github.com/iputils/iputils/blob/master/meson.build#L14 > [2] https://github.com/iputils/iputils/blob/master/git-version.h.meson Best Regards, Fabrice [1] https://gitlab.gnome.org/GNOME/console/-/blob/main/meson.build#L35 [2] https://github.com/mesonbuild/meson/pull/6629 [3] https://github.com/mesonbuild/meson/issues/8567 _______________________________________________ buildroot mailing list buildroot@buildroot.org https://lists.buildroot.org/mailman/listinfo/buildroot ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [Buildroot] [RFC] iputils (meson build system) has git version from buildroot instead of iputils 2022-05-10 21:47 ` Fabrice Fontaine @ 2022-05-11 6:42 ` Arnout Vandecappelle 2022-05-15 5:42 ` Petr Vorel 0 siblings, 1 reply; 4+ messages in thread From: Arnout Vandecappelle @ 2022-05-11 6:42 UTC (permalink / raw) To: Fabrice Fontaine, Petr Vorel Cc: Eric Le Bihan, Dagg Stompler, Yann E. MORIN, Buildroot Mailing List On 10/05/2022 23:47, Fabrice Fontaine wrote: > Hi Petr, > > Le mar. 10 mai 2022 à 22:16, Petr Vorel <petr.vorel@gmail.com> a écrit : >> >> Hi all, >> >> meson.build [1] uses git-version.h.meson [2] to produce BUILD_DIRECTORY/git-version.h. >> >> Building from sources (not in Buildroot) it works: >> $ head -1 builddir/git-version.h >> #define PACKAGE_VERSION "20211215-15-g309f285" >> >> But building in Buildroot it gets git version from Buildroot: >> $ head -1 output/build/iputils-20211215/build/git-version.h >> #define PACKAGE_VERSION "2022.02-876-g3ef096786a" >> >> Is it a bug in iputils or in Buildroot meson? > > This issue is raised because, in the context of buildroot, iputils is > retrieved as a tarball, not a git clone. This would be the case even if we take it from a it clone, because we first archive the tree in a tarball and then extract the tarball in the build directory (i.e. without the .git directory). Note also that this only happens if your output directory is below the Buildroot tree. On the other hand, if you put your output directory, for example, under a BR2_EXTERNAL repository (which is what I usually do), then it will take the version from that repo. > So meson's vcs_tag will retrieve the git information from buildroot > and will not use its fallback (i.e. meson.project_version()). > > To fix it, there is three "simple" options: > - allow buildroot to configure the version (as already done in > open62541 package) > - don't use vcs_tag and always set package_version to > meson.project_version() outside of a "devel" mode as done for example > in gnome console [1] > - override the default vcs command in vcs_tag call (e.g. command: > 'git --git-dir=.git describe --dirty=+') This is a problem for all packages, not just iputils. I think a solution could be to export GIT_CEILING_DIRECTORIES = $(OUTPUT_DIR) That way, git won't travel up to the buildroot directory. Should be tested with putting the output directory in various places, and also with putting DL_DIR below OUTPUT_DIR or equal to OUTPUT_DIR and downloading git packages. Regards, Arnout > > Another option would be to patch meson so vcs_tag is always run with > "--git-dir=.git". > This is probably the more correct option as this issue is probably > affecting other packages than iputils. > However, from my experience in meson, getting something merged > upstream can take a very very long time (e.g. more than two years for > a prefer_static option [2]) > I don't know if this is completely related but this issue on vcs_tag > is opened for more than one year [3] ... > >> Any idea how to fix it? >> >> Kind regards, >> Petr >> >> [1] https://github.com/iputils/iputils/blob/master/meson.build#L14 >> [2] https://github.com/iputils/iputils/blob/master/git-version.h.meson > > Best Regards, > > Fabrice > > [1] https://gitlab.gnome.org/GNOME/console/-/blob/main/meson.build#L35 > [2] https://github.com/mesonbuild/meson/pull/6629 > [3] https://github.com/mesonbuild/meson/issues/8567 _______________________________________________ buildroot mailing list buildroot@buildroot.org https://lists.buildroot.org/mailman/listinfo/buildroot ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [Buildroot] [RFC] iputils (meson build system) has git version from buildroot instead of iputils 2022-05-11 6:42 ` Arnout Vandecappelle @ 2022-05-15 5:42 ` Petr Vorel 0 siblings, 0 replies; 4+ messages in thread From: Petr Vorel @ 2022-05-15 5:42 UTC (permalink / raw) To: Arnout Vandecappelle Cc: Eric Le Bihan, Yann E. MORIN, Buildroot Mailing List, Dagg Stompler, Fabrice Fontaine Hi Fabrice, Arnout, thanks a lot for a valuable info. ... > > > meson.build [1] uses git-version.h.meson [2] to produce BUILD_DIRECTORY/git-version.h. > > > Building from sources (not in Buildroot) it works: > > > $ head -1 builddir/git-version.h > > > #define PACKAGE_VERSION "20211215-15-g309f285" > > > But building in Buildroot it gets git version from Buildroot: > > > $ head -1 output/build/iputils-20211215/build/git-version.h > > > #define PACKAGE_VERSION "2022.02-876-g3ef096786a" > > > Is it a bug in iputils or in Buildroot meson? > > This issue is raised because, in the context of buildroot, iputils is > > retrieved as a tarball, not a git clone. > This would be the case even if we take it from a it clone, because we first > archive the tree in a tarball and then extract the tarball in the build > directory (i.e. without the .git directory). > Note also that this only happens if your output directory is below the > Buildroot tree. On the other hand, if you put your output directory, for > example, under a BR2_EXTERNAL repository (which is what I usually do), then > it will take the version from that repo. Right, I'll usually keep the default BR2_EXTERNAL. > > So meson's vcs_tag will retrieve the git information from buildroot > > and will not use its fallback (i.e. meson.project_version()). > > To fix it, there is three "simple" options: > > - allow buildroot to configure the version (as already done in > > open62541 package) > > - don't use vcs_tag and always set package_version to > > meson.project_version() outside of a "devel" mode as done for example > > in gnome console [1] > > - override the default vcs command in vcs_tag call (e.g. command: > > 'git --git-dir=.git describe --dirty=+') > This is a problem for all packages, not just iputils. > I think a solution could be to > export GIT_CEILING_DIRECTORIES = $(OUTPUT_DIR) > That way, git won't travel up to the buildroot directory. Should be tested > with putting the output directory in various places, and also with putting > DL_DIR below OUTPUT_DIR or equal to OUTPUT_DIR and downloading git packages. I'll try to do some testing soon. Obviously I prefer general solution, fixing by setting variable would be easier than trying to merge anything in meson upstream (if needed I'd open PR in upstream, just for a record of the problem). Kind regards, Petr > Regards, > Arnout > > Another option would be to patch meson so vcs_tag is always run with > > "--git-dir=.git". > > This is probably the more correct option as this issue is probably > > affecting other packages than iputils. > > However, from my experience in meson, getting something merged > > upstream can take a very very long time (e.g. more than two years for > > a prefer_static option [2]) > > I don't know if this is completely related but this issue on vcs_tag > > is opened for more than one year [3] ... > > > Any idea how to fix it? > > > Kind regards, > > > Petr > > > [1] https://github.com/iputils/iputils/blob/master/meson.build#L14 > > > [2] https://github.com/iputils/iputils/blob/master/git-version.h.meson > > Best Regards, > > Fabrice > > [1] https://gitlab.gnome.org/GNOME/console/-/blob/main/meson.build#L35 > > [2] https://github.com/mesonbuild/meson/pull/6629 > > [3] https://github.com/mesonbuild/meson/issues/8567 _______________________________________________ buildroot mailing list buildroot@buildroot.org https://lists.buildroot.org/mailman/listinfo/buildroot ^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2022-05-15 5:43 UTC | newest] Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2022-05-10 20:15 [Buildroot] [RFC] iputils (meson build system) has git version from buildroot instead of iputils Petr Vorel 2022-05-10 21:47 ` Fabrice Fontaine 2022-05-11 6:42 ` Arnout Vandecappelle 2022-05-15 5:42 ` Petr Vorel
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.