I was wondering why my U-Boot build would always report as coming from a
-dirty directory. The /git source directory was completely clean and
matched the desired commit.

But the -dirty is appended by the scripts/setlocalversion (linux uses
the same script) if

  git diff-index --name-only HEAD

reports anything (mind you, you have to run that command before running
"git status" - the latter will update git's index so the diff-index may
no longer print anything). Indeed, that prints

  Licenses/gpl-2.0.txt

The reason diff-index thinks that might be changed is that, since the
git checkout, that file has had its nlinks (and consequently ctime)
modified:

  File: Licenses/gpl-2.0.txt
  Size: 18092           Blocks: 40         IO Block: 4096   regular file
Device: 811h/2065d      Inode: 41445215    Links: 3
Access: (0644/-rw-r--r--)  Uid: ( 1000/    ravi)   Gid: ( 1001/  abcdef)
Access: 2020-05-01 12:04:47.708081401 +0200
Modify: 2020-05-01 12:04:45.756078017 +0200
Change: 2020-05-01 12:04:48.032081963 +0200
 Birth: -

And who creates those extra links? do_populate_lic (and perhaps some
other task later yet). Since that is just "after patch before build", it
is almost certain to get run before the compile task gets around to
invoking setlocalversion and thus create the
include/config/uboot.release file. A crude hack that just forces
do_populate_lic after do_install indeed makes the -dirty go away. Or, an
even cruder hack, prepending a "git status" done in ${S} to do_compile
causes git to refresh its index.

I have tons of ways of working around this, but the question is, is the
optimization of using hard links really worth it? If it is, can we at
least have a "do not ever create hard links to stuff under ${S}"
per-recipe variable, defaulting to 1 if the "primary" SRC_URI (yeah,
that concept probably doesn't exist) is a git:// one?

do_populate_lic is not the only offender, btw., there's apparently also
some create-debug-package-with-sources that will do the same thing, but
I think that will by its nature always run after any configure/compile
step that uses git to create some version.

Rasmus
-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.

View/Reply Online (#137702): 
https://lists.openembedded.org/g/openembedded-core/message/137702
Mute This Topic: https://lists.openembedded.org/mt/73394646/21656
Group Owner: openembedded-core+ow...@lists.openembedded.org
Unsubscribe: 
https://lists.openembedded.org/g/openembedded-core/leave/8023207/1426099254/xyzzy
  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to