package/systemd: show correct version info
PATCH 1/1 package/systemd: show correct version info
When systemd running show wrong version in dmesg log:
systemd[1]: systemd 2019.02-1086-gf5f17c4 running in system mode.
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Shoule be:
systemd[1]: systemd 241 running in system mode. (-PAM -AUDIT -SEL
^^^^^^^^^^^Fix:
Get version info using git, ensure to get right git tree.
meson.build call vcs-tagger
- meson.build:vcs_tagger =
[meson.source_root() + '/tools/meson-vcs-tag.sh',
- script "meson-vcs-tag.sh" execute git describe directly
So
add "--git-dir ./.git" into the script "tools/meson-vcs-tag.sh" to ensure systemd in br2 tree can get correct version info.
--- ...-correct-version-info-when-build-in-br2-git-tree.patch | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 package/systemd/0005-show-correct-version-info-when-build-in-br2-git-tree.patch
package/systemd/0005-show-correct-version-info-when-build-in-br2-git-tree.patch new file +8 -0
@@ -0,0 +1,8 @@ +--- a/tools/meson-vcs-tag.sh 2019-05-07 08:53:51.527553144 +0000 ++++ b/tools/meson-vcs-tag.sh 2019-05-07 08:35:49.152813721 +0000 +@@ -15,4 +15,4 @@ + # Apparently git describe has a bug where it always considers the work-tree + # dirty when invoked with --git-dir (even though 'git status' is happy). Work + # around this issue by cd-ing to the source directory. +-cd "$dir" && git describe --abbrev=7 --dirty=+ 2>/dev/null | sed 's/^v//' || echo "$fallback" ++cd "$dir" && git --git-dir ./.git describe --abbrev=7 --dirty=+ 2>/dev/null | sed 's/^v//' || echo "$fallback"
Signature · 1 line
2.17.1
PATCH 1/1 package/systemd: show correct version info
J?rg, Yann, another example of the thing we discussed last week... Apparently
people indeed do find the version info important.
Quoted 3 lines · Joe Lin
When systemd running show wrong version in dmesg log:
systemd[1]: systemd 2019.02-1086-gf5f17c4 running in system mode.^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Just to be sure: this happens only with in-tree build, not with out-of-tree
build (where there is no parent .git dir), right?
package/systemd/0005-show-correct-version-info-when-build-in-br2-git-tree.patch
Quoted 25 lines
Shoule be:
systemd[1]: systemd 241 running in system mode. (-PAM -AUDIT -SEL> ^^^^^^^^^^^
Fix:
Get version info using git, ensure to get right git tree.
meson.build call vcs-tagger
- meson.build:vcs_tagger =
[meson.source_root()+ '/tools/meson-vcs-tag.sh',
- script "meson-vcs-tag.sh" executegit describedirectly
So
add "--git-dir ./.git" into the script "tools/meson-vcs-tag.sh" to ensure systemd in br2 tree can get correct version info.Signed-off-by Joe Lin <[email protected]>--- ...-correct-version-info-when-build-in-br2-git-tree.patch | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 package/systemd/0005-show-correct-version-info-when-build-in-br2-git-tree.patchpackage/systemd/0005-show-correct-version-info-when-build-in-br2-git-tree.patch new file +0
-0@@ -0,0 +1,8 @@
Since upstream is managed in git, please make this a git-formatted patch
(generated with git format-patch -N) [1]. Make sure it has a summary and description just like any other commit, and also include your Signed-off-by. The latter is needed to ascertain that the patch may be distributed under the upstream project's license (which may be different from Buildroot's).
Also, please send the patch upstream (and add a reference to the upstream pull
request or whatnot in your Buildroot submission).
package/systemd/0005-show-correct-version-info-when-build-in-br2-git-tree.patch line 8
Quoted 8 lines
package/systemd/0005-show-correct-version-info-when-build-in-br2-git-tree.patch new file +8
-0+--- a/tools/meson-vcs-tag.sh 2019-05-07 08:53:51.527553144 +0000 ++++ b/tools/meson-vcs-tag.sh 2019-05-07 08:35:49.152813721 +0000 +@@ -15,4 +15,4 @@ + # Apparently git describe has a bug where it always considers the work-tree + # dirty when invoked with --git-dir (even though 'git status' is happy). Work + # around this issue by cd-ing to the source directory. +-cd "$dir" && git describe --abbrev=7 --dirty=+ 2>/dev/null | sed 's/^v//' || echo "$fallback" ++cd "$dir" && git --git-dir ./.git describe --abbrev=7 --dirty=+ 2>/dev/null | sed 's/^v//' || echo "$fallback"
If you use --git-dir, the cd is not needed, you can use the directory directly. So:
git --git-dir "${dir}/.git" describe --abbrev=7 --dirty=+ 2>/dev/null | sed 's/^v//' || echo "$fallback"
However, maybe we should look for a more fundamental solution, by forcing the
same behaviour as an out-of-tree build. I think it should be sufficient to create an empty .git file in the output directory. All git commands will then fail with "fatal: invalid gitfile format" and not recurse to Buildroot's git directory. Packages which have a fallback (like this one) will work as expected, while packages which don't (like mfgtools) will fail hard and we'll detect the issue.
This won't make it into 2019.05, though, so the current patch is still relevant.
Regards,
Arnout
[1] https://buildroot.org/manual.html#_format_and_licensing_of_the_package_patches