[Toybox] TOYBOX_VERSION

Rob Landley rob at landley.net
Mon Oct 16 14:24:33 PDT 2017


Hey, didn't wind up in spam this time! (Gmail learns.)

On 10/16/2017 12:29 PM, enh wrote:
> i was going to send this patch to allow Android to add "-android"
> without having to work out what the toybox version would otherwise
> have been:
> 
> diff --git a/main.c b/main.c
> index 6025d43..57e53ec 100644
> --- a/main.c
> +++ b/main.c
> @@ -6,7 +6,10 @@
>  #include "toys.h"
> 
>  #ifndef TOYBOX_VERSION
> -#define TOYBOX_VERSION "0.7.4"
> +#ifndef TOYBOX_VENDOR
> +#define TOYBOX_VENDOR ""
> +#endif
> +#define TOYBOX_VERSION "0.7.4"TOYBOX_VENDOR
>  #endif
> 
>  // Populate toy_list[].

Huh. I'd assumed people wanting that would just override TOYBOX_VERSION
from the command line to include the -suffix.

> but i notice that you haven't updated that to 0.7.5 yet, and are
> instead relying on `git describe --tags` to override this.
> 
> is that the plan going forward, or was this just an oversight?

It's because I'd already pushed the cut rewrite up to github, an then
went "this is a can of worms, I should cut the release first", which
meant tagging a historical version. In orer to update the TOYBOX_VERSION
macro in main, I'd have to branch and I've mostly avoiding branching the
history.

It wasn't an oversight, it was a hack because I did this release
slightly wrong. :)

> the reason i bring this up now is that with Treble there are two
> (potentially different) copies of toybox on a device: the /system one
> and the /vendor one which may lag behind, but is built from the same
> source. in the past we've used sed(1) to hack this together, but it
> might make more sense to just support this in toybox (similar to what
> mksh does). especially for us, because we're moving to a more
> declarative build system where that gets a bit more interesting
> (https://android-review.googlesource.com/511275).
> 
> but if your plan is for the git tag to be the one true source of
> version, we can switch to a git/sed combo...

The build system sets TOYBOX_VERSION if there is a .git directory at the
top of tree and git describe works. That means it's #defined so the
#ifndef doesn't trigger.

But the tarballs don't have the .git directory (and git isn't a build
prerequisite), so there's a fallback #define that I'm supposed to update
every release, but I'm not 100% reliable about that. (It's in my release
checklist, but this time I got steps out of order because backtracking.)

As for the patch, I don't have a strong opinion. If having two version
macros makes life easier for you, I can take the patch. Could you send
me one with the headers I can "git am"?

Thanks,

Rob

(Thanks for your patience on the other stuff, I drove back from
Minneapolis this weekend and then $DAYJOB ate today. Working on it...)



More information about the Toybox mailing list