fff: create proper package variants instead of copying file #96

Closed
adschm wants to merge 1 commits from adschm/firmware:fffpkg into master
Owner

So far, we ensure the selection of a specific variant by copying
included Make files. This not only breaks if the packages are used
as a feed, but also is against the concept of how packages are used.

In this patch, the fff package is converted into a set of variants
that allow selection via a FFF_VARIANT variable that is exported by
buildscript. If no export happens, e.g. when using packages in a
feed, no package is selected.

Since the names fff-node and fff-layer3 are not available anymore,
the packages for the variants are called (though irrelevant for
the user):

  • fff-variant-layer3
  • fff-variant-node

The only drawback is that we now have to specify the list of
available variants in the buildscript. However, these values are
hardcoded in several other places as well, and the former code
based on file names was not really appealing anyway.

Signed-off-by: Adrian Schmutzler freifunk@adrianschmutzler.de

So far, we ensure the selection of a specific variant by copying included Make files. This not only breaks if the packages are used as a feed, but also is against the concept of how packages are used. In this patch, the fff package is converted into a set of variants that allow selection via a FFF_VARIANT variable that is exported by buildscript. If no export happens, e.g. when using packages in a feed, no package is selected. Since the names fff-node and fff-layer3 are not available anymore, the packages for the variants are called (though irrelevant for the user): * fff-variant-layer3 * fff-variant-node The only drawback is that we now have to specify the list of available variants in the buildscript. However, these values are hardcoded in several other places as well, and the former code based on file names was not really appealing anyway. Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
adschm added the
packages/fff
build/scripts/tools
labels 2021-01-30 20:30:50 +01:00
adschm added 1 commit 2021-01-30 20:30:51 +01:00
96648e70d3 fff: create proper package variants instead of copying file
So far, we ensure the selection of a specific variant by copying
included Make files. This not only breaks if the packages are used
as a feed, but also is against the concept of how packages are used.

In this patch, the fff package is converted into a set of variants
that allow selection via a FFF_VARIANT variable that is exported by
buildscript. If no export happens, e.g. when using packages in a
feed, no package is selected.

Since the names fff-node and fff-layer3 are not available anymore,
the packages for the variants are called (though irrelevant for
the user):

  * fff-variant-layer3
  * fff-variant-node

The only drawback is that we now have to specify the list of
available variants in the buildscript. However, these values are
hardcoded in several other places as well, and the former code
based on file names was not really appealing anyway.

Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
adschm reviewed 2021-01-30 23:58:19 +01:00
@ -24,2 +11,2 @@
+fff-timeserver \
+fff-simple-tc
URL:=https://www.freifunk-franken.de
DEFAULT:=$(if $(findstring fff-variant-$(FFF_VARIANT),$(1)),y,n)
Author
Owner

Hier muss 'findstring' durch 'filter' ersetzt werden.

Hier muss 'findstring' durch 'filter' ersetzt werden.
Member

Hi, was steht denn hier in $1 ?

Hi, was steht denn hier in $1 ?
Author
Owner

$1 ist der Package-Name wie im Define, also fff-variant-node oder fff-variant-layer3.

Ich wollte erst direkt $(FFF_VARIANT) gegen VARIANT prüfen, aber aus irgendeinem Grund ist VARIANT zu dem Zeitpunkt, wo der Vergleich durchgeführt wird, noch nicht verfügbar (tatsächlich muss man hier statt VARIANT dann BUILD_VARIANT verwenden und ggf. auch "=" statt ":=", aber es hat in keinem Fall funktioniert, weshalb ich auf diese Methode ausgewichen bin, die sich als robust erwiesen hat).

$1 ist der Package-Name wie im Define, also fff-variant-node oder fff-variant-layer3. Ich wollte erst direkt $(FFF_VARIANT) gegen VARIANT prüfen, aber aus irgendeinem Grund ist VARIANT zu dem Zeitpunkt, wo der Vergleich durchgeführt wird, noch nicht verfügbar (tatsächlich muss man hier statt VARIANT dann BUILD_VARIANT verwenden und ggf. auch "=" statt ":=", aber es hat in keinem Fall funktioniert, weshalb ich auf diese Methode ausgewichen bin, die sich als robust erwiesen hat).
Member

danke dir,
ich glaub ich hab's jetzt tatsaechlich verstanden. Ich bin sehr dafuer.
Mit der function filter:

Tested-by: Robert Langhammer <rlanghammer@web.de>
Reviewed-by: Robert Langhammer <rlanghammer@web.de>
danke dir, ich glaub ich hab's jetzt tatsaechlich verstanden. Ich bin sehr dafuer. Mit der function filter: ``` Tested-by: Robert Langhammer <rlanghammer@web.de> Reviewed-by: Robert Langhammer <rlanghammer@web.de> ```
rohammer reviewed 2021-02-07 18:02:52 +01:00
@ -449,3 +450,3 @@
echo
else
if [ ! -f "src/packages/fff/fff/variant-$2.mk" ]; then
if ! echo "$FFF_VARIANTS" | grep -q "\b$2\b"; then
Member

Nicht so viel greppen, wenn es nicht noetig ist. Die bash ist im shebang ->

if [[ ! "$FFF_VARIANTS" =~ "$2" ]] ; then
Nicht so viel greppen, wenn es nicht noetig ist. Die bash ist im shebang -> ``` if [[ ! "$FFF_VARIANTS" =~ "$2" ]] ; then ```
Author
Owner

Ich bin bash nicht so gewohnt, werd mir das gelegentlich mal ankucken.

Ich bin bash nicht so gewohnt, werd mir das gelegentlich mal ankucken.
Author
Owner

Werde das jetzt erstmal ohne bash-specific change mergen.
Vielen Dank.

Werde das jetzt erstmal ohne bash-specific change mergen. Vielen Dank.
adschm closed this pull request 2021-02-09 22:55:55 +01:00
Member

Tut ja nix an der Sache. Ist nur bild-in vs. external.

Tut ja nix an der Sache. Ist nur bild-in vs. external.

Pull request closed

Sign in to join this conversation.
No description provided.