{"action":"created","issue":{"url":"https://api.github.com/repos/systemd/systemd/issues/1164","labels_url":"https://api.github.com/repos/systemd/systemd/issues/1164/labels{/name}","comments_url":"https://api.github.com/repos/systemd/systemd/issues/1164/comments","events_url":"https://api.github.com/repos/systemd/systemd/issues/1164/events","html_url":"https://github.com/systemd/systemd/pull/1164","id":105054644,"number":1164,"title":"[RFC] Use git commit in systemd version","user":{"login":"filbranden","id":106037,"avatar_url":"https://avatars.githubusercontent.com/u/106037?v=3","gravatar_id":"","url":"https://api.github.com/users/filbranden","html_url":"https://github.com/filbranden","followers_url":"https://api.github.com/users/filbranden/followers","following_url":"https://api.github.com/users/filbranden/following{/other_user}","gists_url":"https://api.github.com/users/filbranden/gists{/gist_id}","starred_url":"https://api.github.com/users/filbranden/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/filbranden/subscriptions","organizations_url":"https://api.github.com/users/filbranden/orgs","repos_url":"https://api.github.com/users/filbranden/repos","events_url":"https://api.github.com/users/filbranden/events{/privacy}","received_events_url":"https://api.github.com/users/filbranden/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/systemd/systemd/labels/build-system","name":"build-system","color":"c7def8"}],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":11,"created_at":"2015-09-05T22:55:44Z","updated_at":"2015-10-05T16:57:47Z","closed_at":"2015-10-01T10:48:24Z","pull_request":{"url":"https://api.github.com/repos/systemd/systemd/pulls/1164","html_url":"https://github.com/systemd/systemd/pull/1164","diff_url":"https://github.com/systemd/systemd/pull/1164.diff","patch_url":"https://github.com/systemd/systemd/pull/1164.patch"},"body":"Right now, it's hard to tell whether systemd binaries running are from *released* 225 or from git *head*, since both will identify themselves as `systemd 225` in logs, `--version`, etc.\r\n\r\nThis commit uses `git-version-gen` (from gnulib) to use git tags and `git describe` to produce a meaningful version number that includes the number of commits since the previous release and whether the tree was dirty when built.\r\n\r\nI tested quite a few situations (building from `make dist` tarball, etc.) but there are still some shortcomings, such as:\r\n- Build from GitHub tarball (such as `https://github.com/systemd/systemd/archive/master.tar.gz` and similar URLs for tags) does not currently work. We could fix that by shipping a `.tarball-version` (which we might want to rename) containing something like `225+` indicating this is at least version 225, potentially followed by patches and backports.\r\n- When rebasing the local tree, the build will not see the new version unless it's reconfigured (with `autoreconf` etc.) I think we can possibly work around this as well, by having the version generated or re-generate (perhaps in a file such as `version.h` instead of `config.h`) as part of the build by `make`.\r\n\r\nThere's also the issue that the included script is licensed under GPL 3, not sure if that poses a problem considering it will be distributed with the systemd build tree (even though it is not really installed anywhere.) The logic is fairly simple, so we could potentially replace it with something custom (particularly if we want to add hooks to re-generate the version when running make, etc.)\r\n\r\nFor downstream distributions, I figure this should also work fine. If they build from a tarball, they can always use the `.tarball-version` hook to override it to whatever they want (e.g. to match the version/release they use in their package.) If, on the other hand, they build from git (a downstream clone from systemd, with a release branch including backports and custom patches), all they have to do is to set a git tag for it to be used.\r\n\r\nBefore iterating on this idea (finding a fix for the issues mentioned above), I'd like to know if this is a desirable feature that would be accepted into the systemd build.\r\n\r\nThanks!\r\nFilipe\r\n"},"comment":{"url":"https://api.github.com/repos/systemd/systemd/issues/comments/145598341","html_url":"https://github.com/systemd/systemd/pull/1164#issuecomment-145598341","issue_url":"https://api.github.com/repos/systemd/systemd/issues/1164","id":145598341,"user":{"login":"filbranden","id":106037,"avatar_url":"https://avatars.githubusercontent.com/u/106037?v=3","gravatar_id":"","url":"https://api.github.com/users/filbranden","html_url":"https://github.com/filbranden","followers_url":"https://api.github.com/users/filbranden/followers","following_url":"https://api.github.com/users/filbranden/following{/other_user}","gists_url":"https://api.github.com/users/filbranden/gists{/gist_id}","starred_url":"https://api.github.com/users/filbranden/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/filbranden/subscriptions","organizations_url":"https://api.github.com/users/filbranden/orgs","repos_url":"https://api.github.com/users/filbranden/repos","events_url":"https://api.github.com/users/filbranden/events{/privacy}","received_events_url":"https://api.github.com/users/filbranden/received_events","type":"User","site_admin":false},"created_at":"2015-10-05T16:57:47Z","updated_at":"2015-10-05T16:57:47Z","body":"Thanks for your feedback @g2p but I think that approach still have some of the drawbacks in that if you do a small change it will cause a lot of files to be recompiled without a good reason...\r\n\r\nI've been thinking of an approach that would minimize that (though it still causes some potentially expensive relinking), let me see how far I can take that to see if we can minimize the \"waste\", be pretty accurate about the source tree used for all the binaries and still keep this support fairly generic.\r\n"}}