Patchwork [12/12] wpa-supplicant: Added configuration support. Initialy three options EAP-FAST, WPS, wpa-cli readline support.

login
register
mail settings
Submitter Morten Svendsen
Date Nov. 21, 2012, 10:36 p.m.
Message ID <ae95c23a21863e8de9c3035aea9f63a671e40719.1353493728.git.Morten.ThunbergSvendsen@prevas.dk>
Download mbox | patch
Permalink /patch/200878/
State Accepted
Delegated to: Esben Haabendal
Headers show

Comments

Morten Svendsen - Nov. 21, 2012, 10:36 p.m.
---
 recipes/wpa-supplicant/wpa-supplicant-1.0.inc      |   19 ++++++++++++++--
 .../wpa-supplicant/wpa-supplicant-configure.inc    |   23 ++++++++++++++++++++
 2 files changed, 40 insertions(+), 2 deletions(-)
 create mode 100644 recipes/wpa-supplicant/wpa-supplicant-configure.inc
Esben Haabendal - March 2, 2013, 5:58 p.m.
Morten Thunberg Svendsen <Morten.ThunbergSvendsen@prevas.dk> writes:

> ---
>  recipes/wpa-supplicant/wpa-supplicant-1.0.inc      |   19 ++++++++++++++--
>  .../wpa-supplicant/wpa-supplicant-configure.inc    |   23 ++++++++++++++++++++
>  2 files changed, 40 insertions(+), 2 deletions(-)
>  create mode 100644 recipes/wpa-supplicant/wpa-supplicant-configure.inc
>
> diff --git a/recipes/wpa-supplicant/wpa-supplicant-1.0.inc b/recipes/wpa-supplicant/wpa-supplicant-1.0.inc
> index 0fd4cc4..fa66af3 100644
> --- a/recipes/wpa-supplicant/wpa-supplicant-1.0.inc
> +++ b/recipes/wpa-supplicant/wpa-supplicant-1.0.inc
> @@ -1,10 +1,11 @@
>  DESCRIPTION = "A Client for Wi-Fi Protected Access (WPA)."
>  HOMEPAGE = "http://hostap.epitest.fi/wpa_supplicant/"
>  BUGTRACKER = "http://hostap.epitest.fi/bugz/"
> +require wpa-supplicant-configure.inc
>  
>  inherit make c++ pkgconfig
>  
> -LICENSE = "GPLv2 | BSD"
> +LICENSE = "GPL-2.0 | BSD-3-Clause"
>  
>  DEPENDS += "libdbus libgnutls libgnutls-extra libnl-3 libnl-genl-3 libnl-genl-3 libdl"
>  
> @@ -22,7 +23,21 @@ S = "${SRCDIR}/wpa_supplicant-${PV}/wpa_supplicant"
>  RDEPENDS_${PN}-wpa-passphrase += "libgcrypt"
>  RDEPENDS_${PN}-wpa-supplicant += "libgnutls libgnutls-extra libgcrypt libgpg-error libdbus libnl-3 libnl-genl-3"
>  RDEPENDS_${PN} = "util/wpa-passphrase util/wpa-cli util/wpa-supplicant"
> - 
> +
> +RECIPE_FLAGS += "readline"
> +WPA_SUPPLICANT_FLAGS:>USE_readline += " CONFIG_READLINE"
> +DEPENDS:>USE_readline += " libreadline libncurses"
> +RDEPENDS_${PN}-wpa-cli:>USE_readline += " libncurses libreadline"
> +
> +RECIPE_FLAGS += "wpa_fast_eap"
> +WPA_SUPPLICANT_FLAGS:>USE_wpa_fast_eap += " CONFIG_EAP_FAST"
> +DEPENDS:>USE_wpa_fast_eap += " libssl"
> +RDEPENDS_${PN}-wpa-supplicant:>USE_wpa_fast_eap += " libssl"
> +
> +RECIPE_FLAGS += "wpa_wps"
> +WPA_SUPPLICANT_FLAGS:>USE_wpa_wps += " CONFIG_WPS CONFIG_WPS2"
> +
> +
>  do_configure () {
>  	install -m 0755 ${SRCDIR}/defconfig-gnutls .config
>  }
> diff --git a/recipes/wpa-supplicant/wpa-supplicant-configure.inc b/recipes/wpa-supplicant/wpa-supplicant-configure.inc
> new file mode 100644
> index 0000000..ca82875
> --- /dev/null
> +++ b/recipes/wpa-supplicant/wpa-supplicant-configure.inc
> @@ -0,0 +1,23 @@
> +do_configure[postfuncs] += "do_configure_flags"
> +CONF ?= "${S}/.config"
> +WPA_SUPPLICANT_FLAGS ?= ""
> +
> +def do_configure_flags(d):
> +    f = open(d.get("CONF"))
> +    conf = f.read()
> +    f.close()
> +
> +    for flag in (d.get("WPA_SUPPLICANT_FLAGS") or "").split():
> +        try:
> +            flag, val = flag.split("=", 1)
> +        except ValueError:
> +            val = "y"
> +        (conf, number_of_subs_made) = re.subn(r'^#* *'+flag+' *= *.+$', flag+'='+val, conf, flags=re.MULTILINE)
> +        if (number_of_subs_made > 1):
> +            bb.fatal('wpa-supplicant-configure multiple matches for '+flag+' in '+d.get("CONF"))
> +        elif (number_of_subs_made == 0):
> +            conf = '%s\n%s=%s\n'%(conf,flag,val)
> +
> +    f = open(d.get("CONF"),"w")
> +    f.write(conf)
> +    f.close()

Merged to master, thanks.

/Esben

Patch

diff --git a/recipes/wpa-supplicant/wpa-supplicant-1.0.inc b/recipes/wpa-supplicant/wpa-supplicant-1.0.inc
index 0fd4cc4..fa66af3 100644
--- a/recipes/wpa-supplicant/wpa-supplicant-1.0.inc
+++ b/recipes/wpa-supplicant/wpa-supplicant-1.0.inc
@@ -1,10 +1,11 @@ 
 DESCRIPTION = "A Client for Wi-Fi Protected Access (WPA)."
 HOMEPAGE = "http://hostap.epitest.fi/wpa_supplicant/"
 BUGTRACKER = "http://hostap.epitest.fi/bugz/"
+require wpa-supplicant-configure.inc
 
 inherit make c++ pkgconfig
 
-LICENSE = "GPLv2 | BSD"
+LICENSE = "GPL-2.0 | BSD-3-Clause"
 
 DEPENDS += "libdbus libgnutls libgnutls-extra libnl-3 libnl-genl-3 libnl-genl-3 libdl"
 
@@ -22,7 +23,21 @@  S = "${SRCDIR}/wpa_supplicant-${PV}/wpa_supplicant"
 RDEPENDS_${PN}-wpa-passphrase += "libgcrypt"
 RDEPENDS_${PN}-wpa-supplicant += "libgnutls libgnutls-extra libgcrypt libgpg-error libdbus libnl-3 libnl-genl-3"
 RDEPENDS_${PN} = "util/wpa-passphrase util/wpa-cli util/wpa-supplicant"
- 
+
+RECIPE_FLAGS += "readline"
+WPA_SUPPLICANT_FLAGS:>USE_readline += " CONFIG_READLINE"
+DEPENDS:>USE_readline += " libreadline libncurses"
+RDEPENDS_${PN}-wpa-cli:>USE_readline += " libncurses libreadline"
+
+RECIPE_FLAGS += "wpa_fast_eap"
+WPA_SUPPLICANT_FLAGS:>USE_wpa_fast_eap += " CONFIG_EAP_FAST"
+DEPENDS:>USE_wpa_fast_eap += " libssl"
+RDEPENDS_${PN}-wpa-supplicant:>USE_wpa_fast_eap += " libssl"
+
+RECIPE_FLAGS += "wpa_wps"
+WPA_SUPPLICANT_FLAGS:>USE_wpa_wps += " CONFIG_WPS CONFIG_WPS2"
+
+
 do_configure () {
 	install -m 0755 ${SRCDIR}/defconfig-gnutls .config
 }
diff --git a/recipes/wpa-supplicant/wpa-supplicant-configure.inc b/recipes/wpa-supplicant/wpa-supplicant-configure.inc
new file mode 100644
index 0000000..ca82875
--- /dev/null
+++ b/recipes/wpa-supplicant/wpa-supplicant-configure.inc
@@ -0,0 +1,23 @@ 
+do_configure[postfuncs] += "do_configure_flags"
+CONF ?= "${S}/.config"
+WPA_SUPPLICANT_FLAGS ?= ""
+
+def do_configure_flags(d):
+    f = open(d.get("CONF"))
+    conf = f.read()
+    f.close()
+
+    for flag in (d.get("WPA_SUPPLICANT_FLAGS") or "").split():
+        try:
+            flag, val = flag.split("=", 1)
+        except ValueError:
+            val = "y"
+        (conf, number_of_subs_made) = re.subn(r'^#* *'+flag+' *= *.+$', flag+'='+val, conf, flags=re.MULTILINE)
+        if (number_of_subs_made > 1):
+            bb.fatal('wpa-supplicant-configure multiple matches for '+flag+' in '+d.get("CONF"))
+        elif (number_of_subs_made == 0):
+            conf = '%s\n%s=%s\n'%(conf,flag,val)
+
+    f = open(d.get("CONF"),"w")
+    f.write(conf)
+    f.close()