Skip to content

Commit

Permalink
beeversion: Add two additional format placeholders
Browse files Browse the repository at this point in the history
Add *E* and *d* as placeholders to format the extra version.

Sometimes, the bee version requirement, to separate the extra version
with an underscore, contradicts the upstream versioning, which for
example uses a dash. 4.8-rc2 is the version of the second release
candidate of the Linux kernel 4.8. An underscore has to be used in the
bee file version though.

```
$ beeversion linux-4.8_rc2-95.x86_64
PKGNAME=linux
PKGEXTRANAME=
PKGEXTRANAME_UNDERSCORE=
PKGEXTRANAME_DASH=
PKGVERSION=( 4.8 4 4.8 )
PKGEXTRAVERSION=rc2
PKGEXTRAVERSION_UNDERSCORE=_rc2
PKGEXTRAVERSION_DASH=-rc2
PKGREVISION=95
PKGARCH=x86_64
PKGFULLNAME=linux
PKGFULLVERSION=4.8_rc2
PKGFULLPKG=linux-4.8_rc2-95
PKGALLPKG=linux-4.8_rc2-95.x86_64
PKGSUFFIX=
```

As can be seen, environment variables to output the extra version with a
dash (-) or with an underscore (_) are provided.

These options are missing as placeholders for the switch `format`. So,
add them.

*E* adds an underscore in front of the extra version, while *d* adds a
dash.

These are useful, as now, no additional logic has to be implemented in
scripts calling `beeversion`, to check if an extra version is present,
to determine if a separator needs to be added or not.

In case of the Linux kernel, 4.8-rc2 can be created with the switch
below.

```
> beeversion --format="%v%d" linux-4.8_rc2-95.x86_64
4.8-rc2
```
  • Loading branch information
pmenzel authored and donald committed Aug 24, 2016
1 parent 3d5beef commit f247401
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/bee_version_output.c
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,12 @@ void print_format(char* s, struct beeversion *v, char *filter_pkgfullname)
case 'e':
printf("%s", v->extraversion);
break;
case 'E':
printf("_%s", v->extraversion);
break;
case 'd':
printf("-%s", v->extraversion);
break;
case 'r':
printf("%s", v->pkgrevision);
break;
Expand Down

0 comments on commit f247401

Please sign in to comment.