pcb

append branch to version string

Bug #700193 reported by KaiMartin on 2011-01-08
10
This bug affects 1 person
Affects Status Importance Assigned to Milestone
gEDA project
Wishlist
Unassigned
pcb
Low
Bert Timmerman

Bug Description

Automatically add a note to the version string that says which branch/fork/development-version it was compiled from. This would help to avoid confusion for testers like me.

This is a deliberate almost-duplicate of #699681. Unlike that bug, this one refers to pcb rather than gschem.

---<)kaimartin(>---

Peter Clifton (pcjc2) on 2011-01-14
tags: added: build-system
Jonatan Åkerlind (natanoj) wrote :

The attached patch adds an extra string to the version string if built from a git source repository.

Since a branch in git does not really tell anything without extra information (i.e. to what commit did the branch point at the moment, is it a local only branch etc), this patch uses `git describe` which will output an annotated tag if found (which will only happen on release branches with current strategy), or (on branches without annotated tags) will output an abbreviated commit hash.

Example version string (on branch with this patch):
$ ./src/pcb --version
PCB version 1.99z-079c0d2

$ git log --oneline -n 3
079c0d2 Add git commit hash to version if building from git sources
68d01fd action.c: clean up before return.
6e8b883 action.c: added cast to int.

Traumflug (mah-jump-ing) on 2015-09-27
Changed in geda-project:
importance: Undecided → Wishlist
Changed in pcb:
milestone: none → pcb-4.0.1
assignee: nobody → Bert Timmerman (bert-timmerman)
importance: Wishlist → Low
status: New → In Progress
Bert Timmerman (bert-timmerman) wrote :
Chad Parker (parker-charles) wrote :

I created a branch LP700193. In that branch I modified the version string generated to get rid of the number of commits since the tag.

If we were to tag commit 9c5c7462b5e0b5b2d76bddfc383b820b57da45a0 as 'v4.0.0' then this would produce a version string: v4.0.0-ge6711103. I think this is a good solution.

I'm not sure how the script is supposed to work, but it looks like it also needs a signed tag. The script also uses "tr" which may not be available on all platforms (I read that somewhere, but I don't remember where).

Bert Timmerman (bert-timmerman) wrote :

Hi Chad,

Just looked at your most recent commit 7b0fc95f455a5755d72576797bf67700a60323f2

It gives me the blurb below:

Usage: awk [POSIX or GNU style options] -f progfile [--] file ...
Usage: awk [POSIX or GNU style options] [--] 'program' file ...
POSIX options: GNU long options:
 -f progfile --file=progfile
 -F fs --field-separator=fs
 -v var=val --assign=var=val
 -m[fr] val
 -O --optimize
 -W compat --compat
 -W copyleft --copyleft
 -W copyright --copyright
 -W dump-variables[=file] --dump-variables[=file]
 -W exec=file --exec=file
 -W gen-po --gen-po
 -W help --help
 -W lint[=fatal] --lint[=fatal]
 -W lint-old --lint-old
 -W non-decimal-data --non-decimal-data
 -W profile[=file] --profile[=file]
 -W posix --posix
 -W re-interval --re-interval
 -W source=program-text --source=program-text
 -W traditional --traditional
 -W usage --usage
 -W use-lc-numeric --use-lc-numeric
 -W version --version

To report bugs, see node `Bugs' in `gawk.info', which is
section `Reporting Problems and Bugs' in the printed version.

gawk is a pattern scanning and processing language.
By default it reads standard input and writes standard output.

Examples:
 gawk '{ sum += $1 }; END { print sum }' file
 gawk -F: '{ print $1 }' /etc/passwd
sh: line 1: -F-: command not found
/usr/bin/m4: m4_esyscmd subprocess failed
configure.ac:7: error: AC_INIT should be called with package and version arguments
/usr/share/aclocal-1.11/init.m4:26: AM_INIT_AUTOMAKE is expanded from...
configure.ac:7: the top level
autom4te: /usr/bin/m4 failed with exit status: 1
aclocal: autom4te failed with exit status: 1

I run GNU Awk 3.1.8

Kind regards,

Bert Timmerman.

Stupid auto-line-wrapping... sorry about that. I amended the commit, and it
should work now.

On Fri, Feb 17, 2017 at 2:12 PM, Bert Timmerman <email address hidden>
wrote:

> Hi Chad,
>
> Just looked at your most recent commit
> 7b0fc95f455a5755d72576797bf67700a60323f2
>
> It gives me the blurb below:
>
> Usage: awk [POSIX or GNU style options] -f progfile [--] file ...
> Usage: awk [POSIX or GNU style options] [--] 'program' file ...
> POSIX options: GNU long options:
> -f progfile --file=progfile
> -F fs --field-separator=fs
> -v var=val --assign=var=val
> -m[fr] val
> -O --optimize
> -W compat --compat
> -W copyleft --copyleft
> -W copyright --copyright
> -W dump-variables[=file] --dump-variables[=file]
> -W exec=file --exec=file
> -W gen-po --gen-po
> -W help --help
> -W lint[=fatal] --lint[=fatal]
> -W lint-old --lint-old
> -W non-decimal-data --non-decimal-data
> -W profile[=file] --profile[=file]
> -W posix --posix
> -W re-interval --re-interval
> -W source=program-text --source=program-text
> -W traditional --traditional
> -W usage --usage
> -W use-lc-numeric --use-lc-numeric
> -W version --version
>
> To report bugs, see node `Bugs' in `gawk.info', which is
> section `Reporting Problems and Bugs' in the printed version.
>
> gawk is a pattern scanning and processing language.
> By default it reads standard input and writes standard output.
>
> Examples:
> gawk '{ sum += $1 }; END { print sum }' file
> gawk -F: '{ print $1 }' /etc/passwd
> sh: line 1: -F-: command not found
> /usr/bin/m4: m4_esyscmd subprocess failed
> configure.ac:7: error: AC_INIT should be called with package and version
> arguments
> /usr/share/aclocal-1.11/init.m4:26: AM_INIT_AUTOMAKE is expanded from...
> configure.ac:7: the top level
> autom4te: /usr/bin/m4 failed with exit status: 1
> aclocal: autom4te failed with exit status: 1
>
>
> I run GNU Awk 3.1.8
>
> Kind regards,
>
> Bert Timmerman.
>
> --
> You received this bug notification because you are subscribed to the bug
> report.
> https://bugs.launchpad.net/bugs/700193
>
> Title:
> append branch to version string
>
> Status in gEDA project:
> New
> Status in pcb:
> In Progress
>
> Bug description:
> Automatically add a note to the version string that says which
> branch/fork/development-version it was compiled from. This would help
> to avoid confusion for testers like me.
>
> This is a deliberate almost-duplicate of #699681. Unlike that bug,
> this one refers to pcb rather than gschem.
>
> ---<)kaimartin(>---
>
> To manage notifications about this bug go to:
> https://bugs.launchpad.net/geda-project/+bug/700193/+subscriptions
>

Bert Timmerman (bert-timmerman) wrote :

Hi Chad,

It nibbles off to much:

config.status: executing po/stamp-it commands

** Configuration summary for pcb pcb-base:

   Cross Compiling: no

Maybe awk is not the "best" candidate to solve this "issue".

Proposal:

How about implementing the version generation script (#2) so that other functions can use the generated versions too (doxygen, texinfo, maybe someday an "automatic updater plug-in").

Like to hear your opinion on this proposal.

Kind regards,

Bert Timmerman.

Chad Parker (parker-charles) wrote :

You're getting that because you didn't also set the tag as I suggested:
$ git tag v4.0.0 9c5c7462b5e0b5b2d76bddfc383b820b57da45a0
$ ./autogen.sh > /dev/null && ./configure | grep "Configuration summary"
** Configuration summary for pcb v4.0.0-g5b53f888:

All of the Makefiles inherit several variables with related strings:
PACKAGE = pcb
VERSION= v4.0.0-g5b53f888
PACKAGE_VERSION= v4.0.0-g5b53f888

so, any of the docs, or whatever else, that are built using make will have access to these variables, and thus the version string.

I imagine that an automatic updater would compare against VERSION defined in config.h.

I've been thinking about this a bit more as I've written this, and it's actually a little more complicated.

I put the command to create the version string in the AC_INIT macro. This works, except that you have to re-run autogen.sh to get the version to update. I don't usually do that, I usually just run configure after I update git, so, putting it in AC_INIT may not be the right thing to do.

Also, we aren't guaranteed to be building sources from git, we could be building from a tar.gz, so, for releases we would have to reset this manually.

It might make sense if the version string detection were put inside the conditional where git is detected (as did the original patch), however, the PACKAGE and VERSION variables have already been echoed to confdefs.h. Redefining VERSION, etc. in this conditional will get into the Makesfiles, but it wont get into config.h, and consequently, not into the about dialog box.

It's not immediately obvious to me how putting the version string generation into a shell script will solve any of these problems.

Bert Timmerman (bert-timmerman) wrote :

Hi Chad,

Pushed both your commit and the tag to upstream.

Thanks and kind regards,

Bert Timmerman.

Changed in pcb:
status: In Progress → Fix Committed
milestone: pcb-4.1.1 → pcb-4.1.0
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers