Hi, On Tue, Jan 19, 2016 at 04:30:01PM -0500, Alexandre Viau wrote: > Package: devscripts > Version: 2.15.10 > Severity: wishlist > Usertags: uscan > > In the Go Packaging Team[1], we face the issue that the Golang community > does not tag releases for library packages. This practice is encouraged > by the golang tools and by the community. Whether that is a good thing > or not is the subject of a broader discussion. > > When used with git mode, I would like for uscan to generate a version > number even though the repository is not tagged. > > One of our tools, dh-make-golang, is able to do this. For example: > "0.0~git20151028.0.2a60fc2-1": > > - 0.0 is the latest tag. If there are no tags found, 0.0 is the default. > - git20151028 represents the date of the last commit > - 0 represents the number of commits that day (counting from 0) > - 2a60fc2 is the commit id > > It does not have to be this exact versioning scheme, others can work too. > > I have done a quick research and it looks like this can be done with a > combination of git ls-remote, downloading the last object, and parsing > it for the date.
The uscan current uscan does "git ls-remote" and try to use tag as if it is a version name and locate the latest version using mangling rules. The current code only use refs/tags/ and designed for it. > This would help us a great deal to keep up with our packages, and would > surely be useful for other teams/packages. Yes. My current method does not pay attention to branch and simply relies on the remote tag. This approach is used to filter out unwanted tags. After reading Paul's comment, I thought it is a good idea ... but it was not simple. Let me describe ... If you wish to track particular remore branch HEAD, the simplest thing I can do is to pull that branch and use "git describe" to get the nice tag if there is a nice previous tag. (Hush is 97d8771) $ git describe v2.16.4-9-g97d8771 Here comes complication when there is no tag. $ git describe fatal: No names found, cannot describe anything. $ git describe --all heads/master $ git describe --tags fatal: No names found, cannot describe anything. $ git describe --always c58401b So I need to do the following to get consistent tag with 0.0~. $ git describe 2>/dev/null|| ( echo -n "0.0~g" ; git describe --always ) 0.0~gc58401b OK, problem solved ... No, the package version generated in this way will not be in the sortable series expected by the Debian packaging system. We need ito fix this problem using your suggestion to embed date in the version. If uscan is in git mode and matching rule is "HEAD" or start with "ref/heads/", we need to pull the matched object and get the date on it. Let me recall your last part of comment again: > downloading the last object, and parsing it for the date. Can you show me this "parsing it for the date" part with an example shell activity? (Yes, I am addicted to gitk. So I never bothered to use fancy git copmmands to get date etc.) Osamu