gconf: use $() to reference make variables instead of ${}
PATCH 1/5 gconf: use $() to reference make variables instead of ${}
--- package/gconf/gconf.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
package/gconf/gconf.mk +1 -1
@@ -5,7 +5,7 @@ ################################################################################ GCONF_VERSION = 3.2.6 -GCONF_SOURCE = GConf-${GCONF_VERSION}.tar.xz +GCONF_SOURCE = GConf-$(GCONF_VERSION).tar.xz GCONF_SITE = http://ftp.gnome.org/pub/gnome/sources/GConf/3.2 GCONF_CONF_OPTS = --disable-orbit GCONF_DEPENDENCIES = dbus dbus-glib libglib2 libxml2 \
Signature · 1 line
2.17.1
PATCH 2/5 json-for-modern-cpp: use $() to reference make variables instead of ${}
--- package/json-for-modern-cpp/json-for-modern-cpp.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
package/json-for-modern-cpp/json-for-modern-cpp.mk +1 -1
@@ -5,7 +5,7 @@ ################################################################################ JSON_FOR_MODERN_CPP_VERSION = v3.1.2 -JSON_FOR_MODERN_CPP_SOURCE = json-${JSON_FOR_MODERN_CPP_VERSION}.tar.gz +JSON_FOR_MODERN_CPP_SOURCE = json-$(JSON_FOR_MODERN_CPP_VERSION).tar.gz JSON_FOR_MODERN_CPP_SITE = $(call github,nlohmann,json,$(JSON_FOR_MODERN_CPP_VERSION)) JSON_FOR_MODERN_CPP_LICENSE = MIT JSON_FOR_MODERN_CPP_LICENSE_FILES = LICENSE.MIT
Signature · 1 line
2.17.1
PATCH 3/5 libpng: use $() to reference make variables instead of ${}
In reply to Ricardo Martincoski--- package/libpng/libpng.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
package/libpng/libpng.mk +1 -1
@@ -7,7 +7,7 @@ LIBPNG_VERSION = 1.6.34 LIBPNG_SERIES = 16 LIBPNG_SOURCE = libpng-$(LIBPNG_VERSION).tar.xz -LIBPNG_SITE = http://downloads.sourceforge.net/project/libpng/libpng${LIBPNG_SERIES}/$(LIBPNG_VERSION) +LIBPNG_SITE = http://downloads.sourceforge.net/project/libpng/libpng$(LIBPNG_SERIES)/$(LIBPNG_VERSION) LIBPNG_LICENSE = Libpng LIBPNG_LICENSE_FILES = LICENSE LIBPNG_INSTALL_STAGING = YES
Signature · 1 line
2.17.1
PATCH 4/5 php: use $() to reference make variables instead of ${}
In reply to Ricardo Martincoski--- package/php/php.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
package/php/php.mk +1 -1
@@ -137,7 +137,7 @@ endif ifeq ($(BR2_PACKAGE_PHP_EXT_LIBXML2),y) PHP_CONF_ENV += php_cv_libxml_build_works=yes -PHP_CONF_OPTS += --enable-libxml --with-libxml-dir=${STAGING_DIR}/usr +PHP_CONF_OPTS += --enable-libxml --with-libxml-dir=$(STAGING_DIR)/usr PHP_DEPENDENCIES += libxml2 endif
Signature · 1 line
2.17.1
PATCH 5/5 check-package: detect the use of ${} in .mk files
In reply to Ricardo MartincoskiAnd warn to use $() instead.
For examples see [1] and [2].
In the regexp, search for ${VARIABLE} but:
- ignore comments;
- ignore variables to be expanded by the shell "$${}";
- do not use \w as it would give false warnings for this sed contruct in mesa3d-headers.mk: 's:@includedir@:${prefix}/include:'.
[1] http://lists.busybox.net/pipermail/buildroot/2018-July/225211.html
[2] https://github.com/buildroot/buildroot/commit/36305380db1312442623128689fe5067d9058381
---
With only this patch applied:
https://gitlab.com/RicardoMartincoski/buildroot/-/jobs/80161018
--- utils/checkpackagelib/lib_mk.py | 10 ++++++++++ 1 file changed, 10 insertions(+)
utils/checkpackagelib/lib_mk.py +10 -0
@@ -251,3 +251,13 @@ class UselessFlag(_CheckFunction): "({}#_infrastructure_for_autotools_based_packages)" .format(self.filename, lineno, self.url_to_manual), text] + + +class VariableWithBraces(_CheckFunction): + VARIABLE_WITH_BRACES = re.compile(r"^[^#].*[^$]\${[A-Z0-9_]+}") + + def check_line(self, lineno, text): + if self.VARIABLE_WITH_BRACES.match(text.rstrip()): + return ["{}:{}: use $() to delimit variables, not ${{}}" + .format(self.filename, lineno), + text]
Signature · 1 line
2.17.1
PATCH 5/5 check-package: detect the use of ${} in .mk files
Quoted 6 lines · Ricardo Martincoski
And warn to use $() instead.
For examples see [1] and [2].In the regexp, search for ${VARIABLE} but:
- ignore comments;
- ignore variables to be expanded by the shell "$${}";
Theoretically, we should check for $$${} but I don't think the extra complexity
is warranted.
Quoted 2 lines
- do not use \w as it would give false warnings for this sed contruct in mesa3d-headers.mk: 's:@includedir@:${prefix}/include:'.
This is actually a bug in mesa3d-headers.mk!
Yann, you introduced this more than 3 years ago in 7468b60e7c7fe7f. It clearly
can never have worked, since the /usr bit would be missing from the paths. Of course, libdir and includedir aren't really needed in the pc file since they're the default, but wouldn't the dridriver dir be needed?
For the convenience of people trying to make sense of what I'm writing, here's
the relevant bit of mesa3d-headers.mk:
define MESA3D_HEADERS_BUILD_DRI_PC
sed -e 's:@\(exec_\)\?prefix@:/usr:' \
-e 's:@libdir@:${exec_prefix}/lib:' \
-e 's:@includedir@:${prefix}/include:' \
-e 's:@DRI_DRIVER_INSTALL_DIR@:${libdir}/dri:' \
-e 's:@VERSION@:$(MESA3D_HEADERS_VERSION):' \
-e 's:@DRI_PC_REQ_PRIV@::' \
$(@D)/src/mesa/drivers/dri/dri.pc.in \
>$(@D)/src/mesa/drivers/dri/dri.pcendef
And this is the resulting dri.pc file:
prefix=/usr
exec_prefix=/usr
libdir=/lib
includedir=/include
dridriverdir=/dri
Name: dri
Description: Direct Rendering Infrastructure
Version: 18.1.3
Requires.private:
Cflags: -I${includedir}
I think using \w would actually be better, because we do have lowercase make
variables and macros, and we want to catch them as well.
Otherwise LGTM so you can add my
once it has the \w.
Regards,
Arnout
Quoted 33 lines
[1] http://lists.busybox.net/pipermail/buildroot/2018-July/225211.html
[2] https://github.com/buildroot/buildroot/commit/36305380db1312442623128689fe5067d9058381Signed-off-by Ricardo Martincoski <[email protected]>Cc Arnout Vandecappelle <[email protected]>Cc Thomas Petazzoni <[email protected]>---
With only this patch applied:
https://gitlab.com/RicardoMartincoski/buildroot/-/jobs/80161018--- utils/checkpackagelib/lib_mk.py | 10 ++++++++++ 1 file changed, 10 insertions(+)utils/checkpackagelib/lib_mk.py +10
-0@@ -251,3 +251,13 @@ class UselessFlag(_CheckFunction): "({}#_infrastructure_for_autotools_based_packages)" .format(self.filename, lineno, self.url_to_manual), text] + + +class VariableWithBraces(_CheckFunction): + VARIABLE_WITH_BRACES = re.compile(r"^[^#].*[^$]\${[A-Z0-9_]+}") + + def check_line(self, lineno, text): + if self.VARIABLE_WITH_BRACES.match(text.rstrip()): + return ["{}:{}: use $() to delimit variables, not ${{}}" + .format(self.filename, lineno), + text]
Signature · 6 lines
Arnout Vandecappelle arnout at mind be Senior Embedded Software Architect +32-16-286500 Essensium/Mind http://www.mind.be G.Geenslaan 9, 3001 Leuven, Belgium BE 872 984 063 RPR Leuven LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle GPG fingerprint: 7493 020B C7E3 8618 8DEC 222C 82EB F404 F9AC 0DDF
PATCH 5/5 check-package: detect the use of ${} in .mk files
Arnout, Ricardo, All,
On 2018-07-08 11:57 +0200, Arnout Vandecappelle spake thusly:
Quoted 8 lines · Ricardo Martincoski
Quoted 6 lines
And warn to use $() instead.
For examples see [1] and [2].In the regexp, search for ${VARIABLE} but:
- ignore comments;
- ignore variables to be expanded by the shell "$${}";
Quoted 7 lines
Theoretically, we should check for $$${} but I don't think the extra complexity
is warranted.Quoted 2 lines
- do not use \w as it would give false warnings for this sed contruct in mesa3d-headers.mk: 's:@includedir@:${prefix}/include:'.
This is actually a bug in mesa3d-headers.mk!
Yup, definitely...
Quoted 1 line
Yann, you introduced this more than 3 years ago in
7468b60e7c7fe7f.
I hardly even remember what I did three *weeks* ago, and when I do, I don't really remember *why* I did it. So, three years... ;-]
Quoted 17 lines
It clearly
can never have worked, since the /usr bit would be missing from the paths. Of course, libdir and includedir aren't really needed in the pc file since they're the default, but wouldn't the dridriver dir be needed?For the convenience of people trying to make sense of what I'm writing, here's
the relevant bit of mesa3d-headers.mk:define
MESA3D_HEADERS_BUILD_DRI_PCsed -e 's:@\(exec_\)\?prefix@:/usr:' \ -e 's:@libdir@:${exec_prefix}/lib:' \ -e 's:@includedir@:${prefix}/include:' \ -e 's:@DRI_DRIVER_INSTALL_DIR@:${libdir}/dri:' \ -e 's:@VERSION@:$(MESA3D_HEADERS_VERSION):' \ -e 's:@DRI_PC_REQ_PRIV@::' \ $(@D)/src/mesa/drivers/dri/dri.pc.in \ >$(@D)/src/mesa/drivers/dri/dri.pc
Quoted 1 line
endef
Yup, bad; not good.
Regards,
Yann E. MORIN.
Quoted 68 lines
And this is the resulting dri.pc file:
prefix=/usr
exec_prefix=/usr
libdir=/lib
includedir=/include
dridriverdir=/driName: dri
Description: Direct Rendering Infrastructure
Version: 18.1.3
Requires.private:
Cflags: -I${includedir}I think using \w would actually be better, because we do have lowercase make
variables and macros, and we want to catch them as well.Otherwise LGTM so you can add my
once it has the \w.
Regards,
ArnoutQuoted 33 lines
[1] http://lists.busybox.net/pipermail/buildroot/2018-July/225211.html
[2] https://github.com/buildroot/buildroot/commit/36305380db1312442623128689fe5067d9058381Signed-off-by Ricardo Martincoski <[email protected]>Cc Arnout Vandecappelle <[email protected]>Cc Thomas Petazzoni <[email protected]>---
With only this patch applied:
https://gitlab.com/RicardoMartincoski/buildroot/-/jobs/80161018--- utils/checkpackagelib/lib_mk.py | 10 ++++++++++ 1 file changed, 10 insertions(+)utils/checkpackagelib/lib_mk.py +10
-0@@ -251,3 +251,13 @@ class UselessFlag(_CheckFunction): "({}#_infrastructure_for_autotools_based_packages)" .format(self.filename, lineno, self.url_to_manual), text] + + +class VariableWithBraces(_CheckFunction): + VARIABLE_WITH_BRACES = re.compile(r"^[^#].*[^$]\${[A-Z0-9_]+}") + + def check_line(self, lineno, text): + if self.VARIABLE_WITH_BRACES.match(text.rstrip()): + return ["{}:{}: use $() to delimit variables, not ${{}}" + .format(self.filename, lineno), + text]Signature · 6 lines
Arnout Vandecappelle arnout at mind be Senior Embedded Software Architect +32-16-286500 Essensium/Mind http://www.mind.be G.Geenslaan 9, 3001 Leuven, Belgium BE 872 984 063 RPR Leuven LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle GPG fingerprint: 7493 020B C7E3 8618 8DEC 222C 82EB F404 F9AC 0DDF
Signature · 6 lines
.-----------------.--------------------.------------------.--------------------. | Yann E. MORIN | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: | | +33 662 376 056 | Software Designer | \ / CAMPAIGN | ___ | | +33 223 225 172 `------------.-------: X AGAINST | \e/ There is no | | http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL | v conspiracy. | '------------------------------^-------^------------------^--------------------'
PATCH v2 1/1 check-package: detect the use of ${} in .mk files
In reply to Ricardo MartincoskiAnd warn to use $() instead.
For examples see [1] and [2].
In the regexp, search for ${VARIABLE} but:
- ignore comments;
- ignore variables to be expanded by the shell "$${}".
[1] http://lists.busybox.net/pipermail/buildroot/2018-July/225211.html
[2] https://github.com/buildroot/buildroot/commit/36305380db1312442623128689fe5067d9058381
---
Changes v1 -> v2:
- use \w instead of [A-Z0-9_] because we do have lowercase make variables and macros, and we want to catch them as well; (suggested by Arnout)
- collect review tag.
check-package job after this patch:
https://gitlab.com/RicardoMartincoski/buildroot/-/jobs/80256746
--- utils/checkpackagelib/lib_mk.py | 10 ++++++++++ 1 file changed, 10 insertions(+)
utils/checkpackagelib/lib_mk.py +10 -0
@@ -251,3 +251,13 @@ class UselessFlag(_CheckFunction): "({}#_infrastructure_for_autotools_based_packages)" .format(self.filename, lineno, self.url_to_manual), text] + + +class VariableWithBraces(_CheckFunction): + VARIABLE_WITH_BRACES = re.compile(r"^[^#].*[^$]\${\w+}") + + def check_line(self, lineno, text): + if self.VARIABLE_WITH_BRACES.match(text.rstrip()): + return ["{}:{}: use $() to delimit variables, not ${{}}" + .format(self.filename, lineno), + text]
Signature · 1 line
2.17.1
Thomas Petazzoni
AppliedPATCH v2 1/1 check-package: detect the use of ${} in .mk files
Hello,
Quoted 15 lines · Ricardo Martincoski
And warn to use $() instead.
For examples see [1] and [2].In the regexp, search for ${VARIABLE} but:
- ignore comments;
- ignore variables to be expanded by the shell "$${}".[1] http://lists.busybox.net/pipermail/buildroot/2018-July/225211.html
[2] https://github.com/buildroot/buildroot/commit/36305380db1312442623128689fe5067d9058381Signed-off-by Ricardo Martincoski <[email protected]>Cc Arnout Vandecappelle <[email protected]>Cc Thomas Petazzoni <[email protected]>Cc Yann E. MORIN <[email protected]>
Quoted 6 lines
---
Changes v1 -> v2:
- use \w instead of [A-Z0-9_] because we do have lowercase make variables and macros, and we want to catch them as well; (suggested by Arnout)
- collect review tag.
Applied to master, thanks.
Thomas
Signature · 3 lines
Thomas Petazzoni, CTO, Bootlin Embedded Linux and Kernel engineering https://bootlin.com
PATCH 1/5 gconf: use $() to reference make variables instead of ${}
In reply to Ricardo MartincoskiQuoted 1 line · Ricardo Martincoski
Signed-off-by Ricardo Martincoski <[email protected]>
Patches 1-4 applied to master, thanks.
Regards,
Arnout
Quoted 18 lines
--- package/gconf/gconf.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)package/gconf/gconf.mk +1
-1@@ -5,7 +5,7 @@ ################################################################################ GCONF_VERSION = 3.2.6 -GCONF_SOURCE = GConf-${GCONF_VERSION}.tar.xz +GCONF_SOURCE = GConf-$(GCONF_VERSION).tar.xz GCONF_SITE = http://ftp.gnome.org/pub/gnome/sources/GConf/3.2 GCONF_CONF_OPTS = --disable-orbit GCONF_DEPENDENCIES = dbus dbus-glib libglib2 libxml2 \
Signature · 6 lines
Arnout Vandecappelle arnout at mind be Senior Embedded Software Architect +32-16-286500 Essensium/Mind http://www.mind.be G.Geenslaan 9, 3001 Leuven, Belgium BE 872 984 063 RPR Leuven LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle GPG fingerprint: 7493 020B C7E3 8618 8DEC 222C 82EB F404 F9AC 0DDF