Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Petr Vorel <petr.vorel@gmail.com>
To: Arnout Vandecappelle <arnout@mind.be>
Cc: Eric Le Bihan <eric.le.bihan.dev@free.fr>,
	"Yann E. MORIN" <yann.morin.1998@free.fr>,
	Buildroot Mailing List <buildroot@buildroot.org>,
	Dagg Stompler <daggs@gmx.com>,
	Fabrice Fontaine <fontaine.fabrice@gmail.com>
Subject: Re: [Buildroot] [RFC] iputils (meson build system) has git version from buildroot instead of iputils
Date: Sun, 15 May 2022 07:42:53 +0200	[thread overview]
Message-ID: <YoCS3bhGjo3juytd@pevik> (raw)
In-Reply-To: <891d79c1-531b-7a95-7739-a19e634a318d@mind.be>

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

      reply	other threads:[~2022-05-15  5:43 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=YoCS3bhGjo3juytd@pevik \
    --to=petr.vorel@gmail.com \
    --cc=arnout@mind.be \
    --cc=buildroot@buildroot.org \
    --cc=daggs@gmx.com \
    --cc=eric.le.bihan.dev@free.fr \
    --cc=fontaine.fabrice@gmail.com \
    --cc=yann.morin.1998@free.fr \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox