Message ID | 20191110153356.351383-1-fabian@blaese.de |
---|---|
State | Accepted |
Headers | show |
diff --git a/buildscript b/buildscript index 098a70d..306b91f 100755 --- a/buildscript +++ b/buildscript @@ -131,10 +131,9 @@ prepare() { patch_target - # set the variant for this build - cp "./src/packages/fff/fff/variant-$(cat selected_variant).mk" "$builddir"/variant.mk - # force the reevaluation of this Makefile to make note of the new variant - touch ./src/packages/fff/fff/Makefile + # apply variant to ensure the included file "variant.mk" + # exists in builddir. + apply_variant #saves ~200MB for each build test -d ./src/dl || mkdir ./src/dl @@ -143,6 +142,13 @@ prepare() { update_feeds } +apply_variant() { + # set the variant for this build + cp "./src/packages/fff/fff/variant-$(cat selected_variant).mk" "$builddir"/variant.mk + # force the reevaluation of this Makefile to make note of the new variant + touch ./src/packages/fff/fff/Makefile +} + update_feeds() { ## generate own feeds.conf #this local variable should be globally configure variable used in get_source and here @@ -177,6 +183,8 @@ update_feeds() { } prebuild() { + apply_variant + #create filesdir for our config /bin/rm -rf "$builddir"/files mkdir "$builddir"/files
Reviewed-by: Adrian Schmutzler <freifunk@adrianschmutzler.de> Das ist im Prinzip das, was ich bei mir schon seit einiger Zeit mache: https://github.com/adrianschmutzler/fff-firmware/commit/c637ef2b6ea9d2aa78866238988b1b82738b7e61 Grüße Adrian > -----Original Message----- > From: franken-dev [mailto:franken-dev-bounces@freifunk.net] On Behalf > Of Fabian Bläse > Sent: Sonntag, 10. November 2019 16:34 > To: franken-dev@freifunk.net > Subject: [PATCH v2] buildscript: Apply variant to builddir in build step > > The build variant previously only got applied in the prepare step. Therefore > selecting a new variant for a subsequent build without calling prepare again > produced a build with a different variant than the selected one. > > As the filename and version number is evaluated in the prebuild step, which > is called on every build, the version number did use selected variant, so the > build variant did not match the variant in the version string. > > As applying the variant only causes the fff-base package to be fully rebuilt, > this step is moved into a function and also executed in buildscripts prebuild > step. It is therefore always applied when starting a new build. > > Signed-off-by: Fabian Bläse <fabian@blaese.de> > --- > Changes in v2: > - Also apply variant in prepare step as update_feeds > otherwise isn't able to parse our feed > --- > buildscript | 16 ++++++++++++---- > 1 file changed, 12 insertions(+), 4 deletions(-) > > diff --git a/buildscript b/buildscript > index 098a70d..306b91f 100755 > --- a/buildscript > +++ b/buildscript > @@ -131,10 +131,9 @@ prepare() { > > patch_target > > - # set the variant for this build > - cp "./src/packages/fff/fff/variant-$(cat selected_variant).mk" > "$builddir"/variant.mk > - # force the reevaluation of this Makefile to make note of the new variant > - touch ./src/packages/fff/fff/Makefile > + # apply variant to ensure the included file "variant.mk" > + # exists in builddir. > + apply_variant > > #saves ~200MB for each build > test -d ./src/dl || mkdir ./src/dl > @@ -143,6 +142,13 @@ prepare() { > update_feeds > } > > +apply_variant() { > + # set the variant for this build > + cp "./src/packages/fff/fff/variant-$(cat selected_variant).mk" > "$builddir"/variant.mk > + # force the reevaluation of this Makefile to make note of the new variant > + touch ./src/packages/fff/fff/Makefile } > + > update_feeds() { > ## generate own feeds.conf > #this local variable should be globally configure variable used in get_source > and here @@ -177,6 +183,8 @@ update_feeds() { } > > prebuild() { > + apply_variant > + > #create filesdir for our config > /bin/rm -rf "$builddir"/files > mkdir "$builddir"/files > -- > 2.23.0
applied.
The build variant previously only got applied in the prepare step. Therefore selecting a new variant for a subsequent build without calling prepare again produced a build with a different variant than the selected one. As the filename and version number is evaluated in the prebuild step, which is called on every build, the version number did use selected variant, so the build variant did not match the variant in the version string. As applying the variant only causes the fff-base package to be fully rebuilt, this step is moved into a function and also executed in buildscripts prebuild step. It is therefore always applied when starting a new build. Signed-off-by: Fabian Bläse <fabian@blaese.de> --- Changes in v2: - Also apply variant in prepare step as update_feeds otherwise isn't able to parse our feed --- buildscript | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-)