[PATCH] fff-sysupgrade: Remove dependency from fff-hoods

Tim Niemeyer tim at tn-x.org
Sa Dez 23 13:08:02 CET 2017


Hi

Am Dienstag, den 21.11.2017, 17:50 +0100 schrieb Adrian Schmutzler:
> Sysupgrade implements a lib file from fff-hoods to look for the
> hood file and read the upgrade path from it.
> If fff-hoods is not desired, this poses a problem. Thus, we
> move the lib file to fff-config, as its primary purpose is
> actually providing the paths to the hood files (=config).
> 
> Signed-off-by: Adrian Schmutzler <freifunk at adrianschmutzler.de>
> ---
>  .../fff-config/files/lib/functions/fff/keyxchange  | 32
> ++++++++++++++++++++++
>  src/packages/fff/fff-hoods/Makefile                |  2 +-
>  .../fff-hoods/files/lib/functions/fff/keyxchange   | 32 ------------
> ----------
>  src/packages/fff/fff-sysupgrade/Makefile           |  2 +-
>  4 files changed, 34 insertions(+), 34 deletions(-)
>  create mode 100644 src/packages/fff/fff-
> config/files/lib/functions/fff/keyxchange
>  delete mode 100644 src/packages/fff/fff-
> hoods/files/lib/functions/fff/keyxchange
> 
> diff --git a/src/packages/fff/fff-
> config/files/lib/functions/fff/keyxchange b/src/packages/fff/fff-
> config/files/lib/functions/fff/keyxchange
> new file mode 100644
> index 0000000..30963ae
> --- /dev/null
> +++ b/src/packages/fff/fff-config/files/lib/functions/fff/keyxchange
Wenn es nur um "config" geht, sollte die Datei nicht keyxchange heißen,
sondern vielleicht "getUpgradePath", wobei dann das getJsonPath
wiederum in eine lib vom keyXchange gehört.

fff-config müsste dann von fff-hoods abhängen, das geht aber nicht,
weil andersrum bereits eine Abhängigkeit besteht.

Wenn es trotzdem entkoppelt sein soll, muss man überlegen, ob es
abseits von fff-hoods noch eine Möglichkeit gibt den upgradepath zu
erlangen. Dann könnte man ein fff-upgradepath (oder fff-config) Package
haben, welches eine ODER Abhängigkeit hat. Fest steht, irgendwo muss
der Pfad herkommen, denn fff-sysupgrade prüft nicht, ob der Pfad
korrekt ist oder nicht.

Tim

> @@ -0,0 +1,32 @@
> +#!/bin/sh
> +# Copyright 2017 Adrian Schmutzler
> +# License GPLv3
> +
> +. /usr/share/libubox/jshn.sh
> +
> +hoodfile="/tmp/keyxchangev2data"
> +hoodfilecopy="/www/hood/keyxchangev2data"
> +
> +getJsonPath() {
> +	jsonfile=""
> +	if [ -s "$hoodfilecopy" ] ; then
> +		jsonfile="$hoodfilecopy"
> +	elif [ -s "$hoodfile" ] ; then
> +		jsonfile="$hoodfile"
> +	fi
> +	echo "$jsonfile"
> +}
> +
> +getUpgradePath() {
> +	jsonfile="$(getJsonPath)"
> +
> +	if [ -n "$jsonfile" ] ; then
> +		json_load "$(cat "$jsonfile")"
> +		json_select hood
> +		json_get_var upath upgrade_path
> +		echo "$upath"
> +	else
> +		return 1
> +	fi
> +	return 0
> +}
> diff --git a/src/packages/fff/fff-hoods/Makefile
> b/src/packages/fff/fff-hoods/Makefile
> index 11ab6d1..1a616ff 100644
> --- a/src/packages/fff/fff-hoods/Makefile
> +++ b/src/packages/fff/fff-hoods/Makefile
> @@ -1,7 +1,7 @@
>  include $(TOPDIR)/rules.mk
>  
>  PKG_NAME:=fff-hoods
> -PKG_VERSION:=0.0.1
> +PKG_VERSION:=2
>  PKG_RELEASE:=1
>  
>  PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)
> diff --git a/src/packages/fff/fff-
> hoods/files/lib/functions/fff/keyxchange b/src/packages/fff/fff-
> hoods/files/lib/functions/fff/keyxchange
> deleted file mode 100644
> index 30963ae..0000000
> --- a/src/packages/fff/fff-hoods/files/lib/functions/fff/keyxchange
> +++ /dev/null
> @@ -1,32 +0,0 @@
> -#!/bin/sh
> -# Copyright 2017 Adrian Schmutzler
> -# License GPLv3
> -
> -. /usr/share/libubox/jshn.sh
> -
> -hoodfile="/tmp/keyxchangev2data"
> -hoodfilecopy="/www/hood/keyxchangev2data"
> -
> -getJsonPath() {
> -	jsonfile=""
> -	if [ -s "$hoodfilecopy" ] ; then
> -		jsonfile="$hoodfilecopy"
> -	elif [ -s "$hoodfile" ] ; then
> -		jsonfile="$hoodfile"
> -	fi
> -	echo "$jsonfile"
> -}
> -
> -getUpgradePath() {
> -	jsonfile="$(getJsonPath)"
> -
> -	if [ -n "$jsonfile" ] ; then
> -		json_load "$(cat "$jsonfile")"
> -		json_select hood
> -		json_get_var upath upgrade_path
> -		echo "$upath"
> -	else
> -		return 1
> -	fi
> -	return 0
> -}
> diff --git a/src/packages/fff/fff-sysupgrade/Makefile
> b/src/packages/fff/fff-sysupgrade/Makefile
> index 4a03652..5bccc65 100644
> --- a/src/packages/fff/fff-sysupgrade/Makefile
> +++ b/src/packages/fff/fff-sysupgrade/Makefile
> @@ -13,7 +13,7 @@ define Package/$(PKG_NAME)
>      CATEGORY:=Freifunk
>      TITLE:=Freifunk-Franken sysupgrade
>      URL:=http://www.freifunk-franken.de
> -    DEPENDS:=+fff-boardname +fff-config +fff-hoods + at BUSYBOX_CONFIG_
> WGET
> +    DEPENDS:=+fff-boardname +fff-config + at BUSYBOX_CONFIG_WGET
>  endef
>  
>  define Package/$(PKG_NAME)/description
> -- 
> 2.7.4
> 
-------------- nächster Teil --------------
Ein Dateianhang mit Binärdaten wurde abgetrennt...
Dateiname   : signature.asc
Dateityp    : application/pgp-signature
Dateigröße  : 488 bytes
Beschreibung: This is a digitally signed message part
URL         : <http://lists.freifunk.net/pipermail/franken-dev-freifunk.net/attachments/20171223/34f4b658/attachment.sig>


Mehr Informationen über die Mailingliste franken-dev