Skip to contentSkip to conversation

Fix warnings reported by check-package

PATCH New Yann E. MORIN 5 participants 32 messages Nov 29, 2017 – Dec 3, 2017

lore
Share & tools
lore
#0 lore raw

cover Fix warnings reported by check-package

Hello All!

This series fixes variables names as reported by check-package, to apply our porr-man's namespace in packages.

Also fix extra lines and trailing white-spaces.

It eventually adds a gitlab-ci job to automatically run check-package, but I suggest it is not applied because there is one false-positive reported by check-package, on the asterisk package:

package/asterisk/asterisk.mk:289: useless default value
(http://nightly.buildroot.org/#_infrastructure_for_autotools_based_packages)

However, this one is about _AUTORECONF, which is inherited from target to host variants, but for asterisk, we explcitly do not want to autoreconf the host variant (not the same _SUBDIR tree!).

Regards,
Yann E. MORIN.

The following changes since commit 15d1962cf8b70ebcf52614301f0db242894e28a2

ndisc6: fix bogus <pkg>_DEPENDENCIES names (2017-11-29 23:16:22 +0100)

are available in the git repository at:

git://git.buildroot.org/~ymorin/git/buildroot.git

for you to fetch changes up to b9a9596c19817cf5a70c17acaa23657ed3597f01

gitlab-ci: run check-package (2017-11-30 00:07:50 +0100)

----------------------------------------------------------------
Yann E. MORIN (8):
package/lttng-tools: fix typo in variable name package/checkpolicy: rename variable package/am335x-pru-package: rename variable package/lockfile-progs: rename variable
packages: remove "consecutive empty lines"
packages: fix trailing spaces and slash package/asterisk: add comment about a check-package false positive
gitlab-ci: run check-package

 .gitlab-ci.yml                                   | 4 ++++
 .gitlab-ci.yml.in                                | 4 ++++
 package/am335x-pru-package/am335x-pru-package.mk | 6 +++---
 package/asterisk/asterisk.mk                     | 1 +
 package/busybox/busybox.mk                       | 2 +-
 package/checkpolicy/checkpolicy.mk               | 8 ++++----
 package/lockfile-progs/lockfile-progs.mk         | 4 ++--
 package/lttng-tools/lttng-tools.mk               | 2 +-
 package/ntp/ntp.mk                               | 2 +-
 package/python3/python3.mk                       | 2 --
 package/setools/setools.mk                       | 1 -
 11 files changed, 21 insertions(+), 15 deletions(-)
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.  |
'------------------------------^-------^------------------^--------------------'
#1 lore raw

PATCH 1/8 package/lttng-tools: fix typo in variable name

It's lttng-tools, not lttng-libust. ;-)

Fixes numerous build failures caused by a late autoreconf:

    http://autobuild.buildroot.org/results/b84/b84a6e39fcca70c56bfe49d54c385dfe6da82422/
    etc...
---
 package/lttng-tools/lttng-tools.mk | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
package/lttng-tools/lttng-tools.mk +1 -1
index f0c5febafd..451f652cdc 100644
@@ -11,7 +11,7 @@ LTTNG_TOOLS_LICENSE = GPL-2.0+, LGPL-2.1+ (include/lttng/*, src/lib/lttng-ctl/*)
 LTTNG_TOOLS_LICENSE_FILES = gpl-2.0.txt lgpl-2.1.txt LICENSE
 LTTNG_TOOLS_CONF_OPTS += --disable-man-pages
 # 0001-Fix-detect-dlmopen-and-disable-corresponding-tests-i.patch
-LTTNG_LIBUST_AUTORECONF = YES
+LTTNG_TOOLS_AUTORECONF = YES
 LTTNG_TOOLS_DEPENDENCIES = liburcu libxml2 popt util-linux
 
 ifeq ($(BR2_PACKAGE_LTTNG_LIBUST),y)
Signature · 1 line
2.11.0
#2 lore raw

PATCH 1/8 package/lttng-tools: fix typo in variable name

Hello,

Quoted 8 lines · Yann E. MORIN

It's lttng-tools, not lttng-libust. ;-)

Fixes numerous build failures caused by a late autoreconf:

    http://autobuild.buildroot.org/results/b84/b84a6e39fcca70c56bfe49d54c385dfe6da82422/
    etc...

You had already sent this one, and I already merged it. So I'll mark that one as Rejected in patchwork.

Thanks!

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com
#3 lore raw

PATCH 2/8 package/checkpolicy: rename variable

In reply to Yann E. MORIN

We use package names as poor-man's namespace, so fix that.

Reported by utils/check-package.

Cc Adam Duskett <[email protected]>
Cc Clayton Shotwell <[email protected]>
Cc Matt Weber <[email protected]>
---
 package/checkpolicy/checkpolicy.mk | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
package/checkpolicy/checkpolicy.mk +4 -4
index c1fb43da4d..536a7d69ca 100644
@@ -11,22 +11,22 @@ CHECKPOLICY_LICENSE_FILES = COPYING
 
 CHECKPOLICY_DEPENDENCIES = libselinux flex host-flex host-bison
 
-TARGET_CHECKPOLICY_MAKE_OPTS = $(TARGET_CONFIGURE_OPTS) \
+CHECKPOLICY_TARGET_MAKE_OPTS = $(TARGET_CONFIGURE_OPTS) \
 	LEX="$(HOST_DIR)/bin/flex" \
 	YACC="$(HOST_DIR)/bin/bison -y"
 
 # DESTDIR is used at build time to find libselinux
 define CHECKPOLICY_BUILD_CMDS
-	$(TARGET_MAKE_ENV) $(MAKE) -C $(@D) $(TARGET_CHECKPOLICY_MAKE_OPTS) DESTDIR=$(STAGING_DIR)
+	$(TARGET_MAKE_ENV) $(MAKE) -C $(@D) $(CHECKPOLICY_TARGET_MAKE_OPTS) DESTDIR=$(STAGING_DIR)
 endef
 
 define CHECKPOLICY_STAGING_CMDS
-	$(TARGET_MAKE_ENV) $(MAKE) -C $(@D) $(TARGET_CHECKPOLICY_MAKE_OPTS) DESTDIR=$(STAGING_DIR) install
+	$(TARGET_MAKE_ENV) $(MAKE) -C $(@D) $(CHECKPOLICY_TARGET_MAKE_OPTS) DESTDIR=$(STAGING_DIR) install
 
 endef
 
 define CHECKPOLICY_INSTALL_TARGET_CMDS
-	$(TARGET_MAKE_ENV) $(MAKE) -C $(@D) $(TARGET_CHECKPOLICY_MAKE_OPTS) DESTDIR=$(TARGET_DIR) install
+	$(TARGET_MAKE_ENV) $(MAKE) -C $(@D) $(CHECKPOLICY_TARGET_MAKE_OPTS) DESTDIR=$(TARGET_DIR) install
 endef
 
 HOST_CHECKPOLICY_DEPENDENCIES = host-libselinux host-flex host-bison
Signature · 1 line
2.11.0
#4 lore raw

PATCH 2/8 package/checkpolicy: rename variable

Hello,

Quoted 11 lines · Yann E. MORIN

We use package names as poor-man's namespace, so fix that.

Reported by utils/check-package.

Cc Adam Duskett <[email protected]>
Cc Clayton Shotwell <[email protected]>
Cc Matt Weber <[email protected]>
---
 package/checkpolicy/checkpolicy.mk | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

Applied to master, after doing the following change:

[Thomas: use CHECKPOLICY_MAKE_OPTS instead of CHECKPOLICY_TARGET_MAKE_OPTS, as it is more consistent with HOST_CHECKPOLICY_MAKE_OPTS being used for the host variant.]

Thanks!

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
#5 lore raw

PATCH 3/8 package/am335x-pru-package: rename variable

In reply to Yann E. MORIN

We use package names as poor-man's namespace, so fix that.

Reported by utils/check-package.

---
 package/am335x-pru-package/am335x-pru-package.mk | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
package/am335x-pru-package/am335x-pru-package.mk +3 -3
index b2e89d3710..24a5df4815 100644
@@ -13,14 +13,14 @@ AM335X_PRU_PACKAGE_INSTALL_STAGING = YES
 
 # The default 'all' rule builds everything, when we just need the library
 ifeq ($(BR2_ENABLE_DEBUG),y)
-AM335X_MAKE_TARGET = debug $(if $(BR2_STATIC_LIBS),,sodebug)
+AM335X_PRU_PACKAGE_MAKE_TARGET = debug $(if $(BR2_STATIC_LIBS),,sodebug)
 else
-AM335X_MAKE_TARGET = release $(if $(BR2_STATIC_LIBS),,sorelease)
+AM335X_PRU_PACKAGE_MAKE_TARGET = release $(if $(BR2_STATIC_LIBS),,sorelease)
 endif
 
 define AM335X_PRU_PACKAGE_BUILD_CMDS
 	$(TARGET_MAKE_ENV) $(MAKE) CROSS_COMPILE="$(TARGET_CROSS)" \
-		-C $(@D)/pru_sw/app_loader/interface $(AM335X_MAKE_TARGET)
+		-C $(@D)/pru_sw/app_loader/interface $(AM335X_PRU_PACKAGE_MAKE_TARGET)
 endef
 
 # 'install' installs whatever was built, and our patch removes the dependency
Signature · 1 line
2.11.0
#6 lore raw

PATCH 3/8 package/am335x-pru-package: rename variable

Hello,

Quoted 9 lines · Yann E. MORIN

We use package names as poor-man's namespace, so fix that.

Reported by utils/check-package.

---
 package/am335x-pru-package/am335x-pru-package.mk | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

Applied to master, thanks.

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
#7 lore raw

PATCH 4/8 package/lockfile-progs: rename variable

In reply to Yann E. MORIN

We use package names as poor-man's namespace, so fix that.

Reported by utils/check-package.

---
 package/lockfile-progs/lockfile-progs.mk | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
package/lockfile-progs/lockfile-progs.mk +2 -2
index 57df573d4a..ed192f1028 100644
@@ -11,7 +11,7 @@ LOCKFILE_PROGS_DEPENDENCIES = liblockfile
 LOCKFILE_PROGS_LICENSE = GPL-2.0
 LOCKFILE_PROGS_LICENSE_FILES = COPYING
 
-LOCKFILE_BINS = \
+LOCKFILE_PROGS_BINS = \
 	$(addprefix lockfile-,check create remove touch) \
 	$(addprefix mail-,lock touchlock unlock)
 
@@ -20,7 +20,7 @@ define LOCKFILE_PROGS_BUILD_CMDS
 endef
 
 define LOCKFILE_PROGS_INSTALL_TARGET_CMDS
-	for i in $(LOCKFILE_BINS); do \
+	for i in $(LOCKFILE_PROGS_BINS); do \
 		$(INSTALL) -D -m 755 $(@D)/bin/$$i $(TARGET_DIR)/usr/bin/$$i || exit 1; \
 	done
 endef
Signature · 1 line
2.11.0
#8 lore raw

PATCH 4/8 package/lockfile-progs: rename variable

Hello,

Quoted 8 lines · Yann E. MORIN

We use package names as poor-man's namespace, so fix that.

Reported by utils/check-package.

---
 package/lockfile-progs/lockfile-progs.mk | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Applied to master, thanks.

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
#9 lore raw

PATCH 5/8 packages: remove "consecutive empty lines"

In reply to Yann E. MORIN

... as reported by utils/check-package

Cc Adam Duskett <[email protected]>
Cc Yegor Yefremov<[email protected]>
Cc Matt Weber <[email protected]>
Cc Thomas Petazzoni <[email protected]>
---
 package/python3/python3.mk | 2 --
 package/setools/setools.mk | 1 -
 2 files changed, 3 deletions(-)
package/python3/python3.mk +0 -2
index 1d2201eec7..6e61108661 100644
@@ -159,7 +159,6 @@ PYTHON3_CONF_OPTS += \
 	--disable-idle3 \
 	--disable-pyc-build
 
-
 #
 # Some of CPython's source code is generated using Python interpreter
 # and some helper tools such as "Programs/_freeze_importlib" or
@@ -201,7 +200,6 @@ endef
 
 PYTHON3_PRE_BUILD_HOOKS += PYTHON3_MAKE_REGEN_IMPORTLIB
 
-
 #
 # Remove useless files. In the config/ directory, only the Makefile
 # and the pyconfig.h files are needed at runtime.
package/setools/setools.mk +0 -1
index 8b93ccf45e..6748c95c23 100644
@@ -13,7 +13,6 @@ SETOOLS_LICENSE_FILES = COPYING COPYING.GPL COPYING.LGPL
 SETOOLS_SETUP_TYPE = setuptools
 HOST_SETOOLS_DEPENDENCIES = host-libselinux host-libsepol
 
-
 ifeq ($(BR2_PACKAGE_PYTHON3),y)
 SETOOLS_PYLIBVER = python$(PYTHON3_VERSION_MAJOR)
 else
Signature · 1 line
2.11.0
#10 lore raw

PATCH 5/8 packages: remove "consecutive empty lines"

Hello,

Quoted 11 lines · Yann E. MORIN

... as reported by utils/check-package

Cc Adam Duskett <[email protected]>
Cc Yegor Yefremov<[email protected]>
Cc Matt Weber <[email protected]>
Cc Thomas Petazzoni <[email protected]>
---
 package/python3/python3.mk | 2 --
 package/setools/setools.mk | 1 -
 2 files changed, 3 deletions(-)

Applied to master, thanks.

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
#11 lore raw

PATCH 6/8 packages: fix trailing spaces and slash

In reply to Yann E. MORIN

... as reported by utils/check-package.

---
 package/busybox/busybox.mk | 2 +-
 package/ntp/ntp.mk         | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
package/busybox/busybox.mk +1 -1
index 1aeeeef4bf..8b720b30b8 100644
@@ -65,7 +65,7 @@ define BUSYBOX_PERMISSIONS
 # Set permissions on all applets with BB_SUID_REQUIRE and BB_SUID_MAYBE.
 # 12 Applets are pulled from applets.h using grep command :
 #  grep -r -e "APPLET.*BB_SUID_REQUIRE\|APPLET.*BB_SUID_MAYBE" \
-#  $(@D)/include/applets.h 
+#  $(@D)/include/applets.h
 # These applets are added to the device table and the makedev file
 # ignores the files with type 'F' ( optional files).
 	/usr/bin/wall 			 F 4755 0  0 - - - - -
package/ntp/ntp.mk +1 -1
index 6605c3b85b..05619aef7c 100644
@@ -17,7 +17,7 @@ NTP_CONF_OPTS = \
 	--disable-tickadj \
 	--disable-debugging \
 	--with-yielding-select=yes \
-	--disable-local-libevent \
+	--disable-local-libevent
 
 # 0002-ntp-syscalls-fallback.patch
 # 0003-ntpq-fpic.patch
Signature · 1 line
2.11.0
#12 lore raw

PATCH 6/8 packages: fix trailing spaces and slash

Hello,

Quoted 8 lines · Yann E. MORIN

... as reported by utils/check-package.

---
 package/busybox/busybox.mk | 2 +-
 package/ntp/ntp.mk         | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

Applied to master, thanks.

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
#13 lore raw

PATCH 7/8 package/asterisk: add comment about a check-package false positive

In reply to Yann E. MORIN

This variable is inherited from the target variant, which is autoreconfed. But the host variant is only the menucselect sub-directory, which we do not want to autoreconf, so the explcit NO is required.

Cc Ricardo Martincoski <[email protected]>
Cc Thomas Petazzoni <[email protected]>
---
 package/asterisk/asterisk.mk | 1 +
 1 file changed, 1 insertion(+)
package/asterisk/asterisk.mk +1 -0
index 50512c0b3a..21dca549a0 100644
@@ -285,6 +285,7 @@ HOST_ASTERISK_LICENSE_FILES = COPYING
 
 # No need to autoreconf for the host variant,
 # so do not inherit the target setup.
+# check-package reports an issue here, but that's a false positive. Ignore.
 HOST_ASTERISK_AUTORECONF = NO
 
 HOST_ASTERISK_CONF_ENV = CONFIG_LIBXML2=$(HOST_DIR)/usr/bin/xml2-config
Signature · 1 line
2.11.0
#14 lore raw

PATCH 7/8 package/asterisk: add comment about a check-package false positive

Hello,

Quoted 2 lines · Yann E. MORIN

This variable is inherited from the target variant, which is autoreconfed. But the host variant is only the menucselect

menuselect

Quoted 15 lines

sub-directory, which we do not want to autoreconf, so the explcit NO is required.

Cc Ricardo Martincoski <[email protected]>
Cc Thomas Petazzoni <[email protected]>
---
 package/asterisk/asterisk.mk | 1 +
 1 file changed, 1 insertion(+)
package/asterisk/asterisk.mk +0 -0
index 50512c0b3a..21dca549a0 100644

package/asterisk/asterisk.mk HOST_ASTERISK_LICENSE_FILES = COPYING · line 289

Quoted 5 lines
package/asterisk/asterisk.mk +1 -0
@@ -285,6 +285,7 @@ HOST_ASTERISK_LICENSE_FILES = COPYING
 
 # No need to autoreconf for the host variant,
 # so do not inherit the target setup.
+# check-package reports an issue here, but that's a false positive. Ignore.
 HOST_ASTERISK_AUTORECONF = NO

I'm not sure we should have a comment here. Instead we should fix
check-package: it is not normal for check-package to emit a warning here, since it is legal (currently) for a package to autoreconf its target variant, and not autoreconf its host variant.

Ricardo, do you think you could fix this problem in check-package ?

Thanks!

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com
#15 lore raw

PATCH 7/8 package/asterisk: add comment about a check-package false positive

Hello,

Quoted 1 line · Thomas Petazzoni

On Thu, 30 Nov 2017 00:08:44 +0100, Yann E. MORIN wrote:

[snip]

Quoted 12 lines

package/asterisk/asterisk.mk HOST_ASTERISK_LICENSE_FILES = COPYING · line 289

Quoted 7 lines

+++ b/package/asterisk/asterisk.mk

package/asterisk/asterisk.mk +1 -0
@@ -285,6 +285,7 @@ HOST_ASTERISK_LICENSE_FILES = COPYING
 
 # No need to autoreconf for the host variant,
 # so do not inherit the target setup.
+# check-package reports an issue here, but that's a false positive. Ignore.
 HOST_ASTERISK_AUTORECONF = NO

I'm not sure we should have a comment here. Instead we should fix
check-package: it is not normal for check-package to emit a warning here, since it is legal (currently) for a package to autoreconf its target variant, and not autoreconf its host variant.

I agree, it's better to not issue a false warning.

Quoted 2 lines

Ricardo, do you think you could fix this problem in check-package ?

We can use something like this (not fully tested yet!):

+++ utils/checkpackagelib/lib_mk.py
@@ -219 +219 @@ class UselessFlag(_CheckFunction):
- if self.DEFAULT_AUTOTOOLS_FLAG.search(text):
+ if self.DEFAULT_AUTOTOOLS_FLAG.search(text) and not text.lstrip().startswith("HOST_"):

Avoiding false warnings is more important than testing for all corner cases IMO. Using the code above we don't issue a valid warning for rare cases, we stop issuing a false warning and we also keep O(n).

I will send it separately (after proper commit message and testing) if Yann doesn't include something similar (feel free to do so!) to the series before.

Regards,
--
Ricardo Martincoski
DATACOM
Ethernet Switches
Rua Am?rica, 1000 - Eldorado do Sul, RS - 92990-000 - Brasil +55 51 3933 3000 - Ramal 3307
ricardo.martincoski at datacom.ind.br www.datacom.ind.br

#16 lore raw

PATCH 7/8 package/asterisk: add comment about a check-package false positive

Hello,

Thanks for looking into it so quickly!

Quoted 10 lines · Ricardo Martincoski

We can use something like this (not fully tested yet!):

+++ utils/checkpackagelib/lib_mk.py

(quoted diff) +1 -1
@@ -219 +219 @@ class UselessFlag(_CheckFunction):
-        if self.DEFAULT_AUTOTOOLS_FLAG.search(text):
+        if self.DEFAULT_AUTOTOOLS_FLAG.search(text) and not text.lstrip().startswith("HOST_"):

Avoiding false warnings is more important than testing for all corner cases IMO. Using the code above we don't issue a valid warning for rare cases, we stop issuing a false warning and we also keep O(n).

Yeah, if you want to test this properly, it's more difficult. Just AUTORECONF = NO is redundant. Just HOST_AUTORECONF = NO is redundant. But the combination of AUTORECONF = YES + HOST_AUTORECONF = NO is valid.

So basically for all variables that have inheritance between target and host, having the host variant of the variable set the variable value back to its default is correct if the target variable is set.

So, your approach at least works, and will not generate false warnings.

Thanks!

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com
#17 lore raw

PATCH 7/8 package/asterisk: add comment about a check-package false positive

In reply to Yann E. MORIN

Hello,

Quoted 11 lines · Yann E. MORIN

This variable is inherited from the target variant, which is autoreconfed. But the host variant is only the menucselect sub-directory, which we do not want to autoreconf, so the explcit NO is required.

Cc Ricardo Martincoski <[email protected]>
Cc Thomas Petazzoni <[email protected]>
---
 package/asterisk/asterisk.mk | 1 +
 1 file changed, 1 insertion(+)

As we discussed, I marked this one as Rejected in patchwork. Thanks!

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com
#18 lore raw

PATCH 1/1 check-package: avoid false warning of useless flag

In reply to Yann E. MORIN

Just AUTORECONF = NO is redundant.
Just HOST_AUTORECONF = NO is redundant.
But the combination of AUTORECONF = YES + HOST_AUTORECONF = NO is valid.

So basically for all variables that have inheritance between target and host, having the host variant of the variable set the variable value back to its default is correct if the target variable is set.

Instead of increasing complexity of the script to fully detect this case, ignore the host flag set to its default value as it can be overriding a non-default value inherited from the equivalent target flag.

---
Part of commit log copied from Thomas' e-mail. I hope you don't mind.

---
 utils/checkpackagelib/lib_mk.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
utils/checkpackagelib/lib_mk.py +1 -1
index 6ed6011..817e809 100644
@@ -216,7 +216,7 @@ class UselessFlag(_CheckFunction):
                     .format(self.filename, lineno, self.url_to_manual),
                     text]
 
-        if self.DEFAULT_AUTOTOOLS_FLAG.search(text):
+        if self.DEFAULT_AUTOTOOLS_FLAG.search(text) and not text.lstrip().startswith("HOST_"):
             return ["{}:{}: useless default value "
                     "({}#_infrastructure_for_autotools_based_packages)"
                     .format(self.filename, lineno, self.url_to_manual),
Signature · 1 line
2.7.4
#19 lore raw

PATCH 1/1 check-package: avoid false warning of useless flag

Ricardo, All,

On 2017-12-02 02:28 -0200, Ricardo Martincoski spake thusly:

Quoted 4 lines

Just AUTORECONF = NO is redundant.
Just HOST_AUTORECONF = NO is redundant.
But the combination of AUTORECONF = YES + HOST_AUTORECONF = NO is valid.

Quoted 8 lines

So basically for all variables that have inheritance between target and host, having the host variant of the variable set the variable value back to its default is correct if the target variable is set.

Instead of increasing complexity of the script to fully detect this case, ignore the host flag set to its default value as it can be overriding a non-default value inherited from the equivalent target flag.

But then we miss the cases where:
- both are set to their default values,
- the target one is not set and the host one is set to the default value.

But as you said, detecting the real false-positive would require maintaining some state, which is currently not possible in the script.

Yet, htere is one issue I see: the script currently names issues mere 'warnings' but exits with a non-zero error code as soon as at least one such 'warning' is seen.

However, what we so far detected were really 'errors', not 'warnings', while the case we are speaking about now really is a warning: it should be reported, biut should not exit in error.

So I must say I'm still not really fond of this change... :-(

Also I noticed that the comments do match the regexps:

288: # We need HOST_ASTERISK_AUTORECONF = NO because the 289: # target variant has _AUTORECONF = YES 290: HOST_ASTERISK_AUTORECONF = NO

will report the issue twice (man URL removed):

package/asterisk/asterisk.mk:288: useless default value [...] package/asterisk/asterisk.mk:290: useless default value [...]

Since this is the .mk parser, it could ignore the comments, I believe...

Regards,
Yann E. MORIN.

Quoted 26 lines

---
Part of commit log copied from Thomas' e-mail. I hope you don't mind.

---
 utils/checkpackagelib/lib_mk.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
utils/checkpackagelib/lib_mk.py +1 -1
index 6ed6011..817e809 100644
@@ -216,7 +216,7 @@ class UselessFlag(_CheckFunction):
                     .format(self.filename, lineno, self.url_to_manual),
                     text]
 
-        if self.DEFAULT_AUTOTOOLS_FLAG.search(text):
+        if self.DEFAULT_AUTOTOOLS_FLAG.search(text) and not text.lstrip().startswith("HOST_"):
             return ["{}:{}: useless default value "
                     "({}#_infrastructure_for_autotools_based_packages)"
                     .format(self.filename, lineno, self.url_to_manual),
Signature · 1 line
2.7.4
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.  |
'------------------------------^-------^------------------^--------------------'
#20 lore raw

PATCH 1/1 check-package: avoid false warning of useless flag

Hello,

Quoted 13 lines · Yann E. MORIN
Quoted 4 lines

Instead of increasing complexity of the script to fully detect this case, ignore the host flag set to its default value as it can be overriding a non-default value inherited from the equivalent target flag.

But then we miss the cases where:
- both are set to their default values,
- the target one is not set and the host one is set to the default value.

But as you said, detecting the real false-positive would require maintaining some state, which is currently not possible in the script.

Quoted 7 lines

Yet, htere is one issue I see: the script currently names issues mere 'warnings' but exits with a non-zero error code as soon as at least one such 'warning' is seen.

However, what we so far detected were really 'errors', not 'warnings', while the case we are speaking about now really is a warning: it should be reported, biut should not exit in error.

I'm not sure we want to go down this road, and distinguish warnings and errors. Either something is correct, or it's not. I prefer to have a clean and readable check-package output, with only things that really need to be fixed.

Quoted 6 lines

Also I noticed that the comments do match the regexps:

288: # We need HOST_ASTERISK_AUTORECONF = NO because the 289: # target variant has _AUTORECONF = YES 290: HOST_ASTERISK_AUTORECONF = NO

Quoted 6 lines

will report the issue twice (man URL removed):

package/asterisk/asterisk.mk:288: useless default value [...] package/asterisk/asterisk.mk:290: useless default value [...]

Since this is the .mk parser, it could ignore the comments, I believe...

Agreed, but that's a separate issue :)

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com
#21 lore raw

PATCH 1/1 check-package: avoid false warning of useless flag

Thomas, All,

On 2017-12-02 14:10 +0100, Thomas Petazzoni spake thusly:

Quoted 19 lines · Yann E. MORIN
Quoted 18 lines
Quoted 5 lines

Instead of increasing complexity of the script to fully detect this case, ignore the host flag set to its default value as it can be overriding a non-default value inherited from the equivalent target flag.

But then we miss the cases where:
- both are set to their default values,
- the target one is not set and the host one is set to the default value.

But as you said, detecting the real false-positive would require maintaining some state, which is currently not possible in the script.

Yet, htere is one issue I see: the script currently names issues mere 'warnings' but exits with a non-zero error code as soon as at least one such 'warning' is seen.

Quoted 8 lines
Quoted 3 lines

However, what we so far detected were really 'errors', not 'warnings', while the case we are speaking about now really is a warning: it should be reported, biut should not exit in error.

I'm not sure we want to go down this road, and distinguish warnings and errors. Either something is correct, or it's not. I prefer to have a clean and readable check-package output, with only things that really need to be fixed.

OK, but then with this change, we will now be missing actual errors, e.g.:

FOO_AUTORECONF = NO
HOST_FOO_AUTORECONF = NO

Will not report the host vairant as bogus, even after the target variant gets removed.

So we lose a false positive for a false negative.

I have to admit I am not sure which is worse/best...

Regards,
Yann E. MORIN.

Quoted 20 lines
Quoted 6 lines

Also I noticed that the comments do match the regexps:

288: # We need HOST_ASTERISK_AUTORECONF = NO because the 289: # target variant has _AUTORECONF = YES 290: HOST_ASTERISK_AUTORECONF = NO

Quoted 6 lines

will report the issue twice (man URL removed):

package/asterisk/asterisk.mk:288: useless default value [...] package/asterisk/asterisk.mk:290: useless default value [...]

Since this is the .mk parser, it could ignore the comments, I believe...

Agreed, but that's a separate issue :)

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com
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.  |
'------------------------------^-------^------------------^--------------------'
#22 lore raw

PATCH 1/1 check-package: avoid false warning of useless flag

Hello,

Quoted 10 lines · Yann E. MORIN

OK, but then with this change, we will now be missing actual errors, e.g.:

FOO_AUTORECONF = NO
HOST_FOO_AUTORECONF = NO

Will not report the host vairant as bogus, even after the target variant gets removed.

So we lose a false positive for a false negative.

Yes, it was already mentioned by Ricardo in the discussion.

Quoted 1 line

I have to admit I am not sure which is worse/best...

Checking tools that have false positives are unusable, because they create some noise that always make you think "gaah, it must be the tool again complaining about something that doesn't make sense".

So I very much prefer a tool that doesn't report false positives, and for which the results can be trusted. This way, we are much more likely to pay attention to the tool results, and keep in a good shape what the tool is checking today.

And that doesn't prevent, in parallel, from improving the tool to detect other problems.

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com
#23 lore raw

PATCH 1/1 check-package: avoid false warning of useless flag

Quoted 19 lines · Thomas Petazzoni

Hello,

Quoted 10 lines · Yann E. MORIN

OK, but then with this change, we will now be missing actual errors, e.g.:

FOO_AUTORECONF = NO
HOST_FOO_AUTORECONF = NO

Will not report the host vairant as bogus, even after the target variant gets removed.

So we lose a false positive for a false negative.

Yes, it was already mentioned by Ricardo in the discussion.

Quoted 1 line

I have to admit I am not sure which is worse/best...

Quoted 8 lines

Checking tools that have false positives are unusable, because they create some noise that always make you think "gaah, it must be the tool again complaining about something that doesn't make sense".

So I very much prefer a tool that doesn't report false positives, and for which the results can be trusted. This way, we are much more likely to pay attention to the tool results, and keep in a good shape what the tool is checking today.

+1 to that.

Regards,
Arnout

Quoted 6 lines

And that doesn't prevent, in parallel, from improving the tool to detect other problems.

Thomas

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
#24 lore raw

PATCH 1/1 check-package: avoid false warning of useless flag

In reply to Ricardo Martincoski

Hello,

Quoted 17 lines · Ricardo Martincoski

Just AUTORECONF = NO is redundant.
Just HOST_AUTORECONF = NO is redundant.
But the combination of AUTORECONF = YES + HOST_AUTORECONF = NO is valid.

So basically for all variables that have inheritance between target and host, having the host variant of the variable set the variable value back to its default is correct if the target variable is set.

Instead of increasing complexity of the script to fully detect this case, ignore the host flag set to its default value as it can be overriding a non-default value inherited from the equivalent target flag.

Quoted 5 lines

---
Part of commit log copied from Thomas' e-mail. I hope you don't mind.

---
 utils/checkpackagelib/lib_mk.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Applied to master, thanks.

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
#25 lore raw

PATCH 8/8 gitlab-ci: run check-package

In reply to Yann E. MORIN
Cc Thomas Petazzoni <[email protected]>
Cc Arnout Vandecappelle <[email protected]>
---
 .gitlab-ci.yml    | 4 ++++
 .gitlab-ci.yml.in | 4 ++++
 2 files changed, 8 insertions(+)
.gitlab-ci.yml +4 -0
index 0dddb22f12..c80a6b129b 100644
@@ -30,6 +30,10 @@ check-DEVELOPERS:
     script:
         - "! utils/get-developers | grep -v 'No action specified'"
 
+check-package:
+    script:
+        - find . -type f -name '*.mk' -exec ./utils/check-package {} +
+
 .defconfig: &defconfig
     # Running the defconfigs for every push is too much, so limit to
     # explicit triggers through the API.
.gitlab-ci.yml.in +4 -0
index 33c7b13725..0d2e239414 100644
@@ -30,6 +30,10 @@ check-DEVELOPERS:
     script:
         - "! utils/get-developers | grep -v 'No action specified'"
 
+check-package:
+    script:
+        - find . -type f -name '*.mk' -exec ./utils/check-package {} +
+
 .defconfig: &defconfig
     # Running the defconfigs for every push is too much, so limit to
     # explicit triggers through the API.
Signature · 1 line
2.11.0
#26 lore raw

PATCH 8/8 gitlab-ci: run check-package

Hello,

.gitlab-ci.yml check-DEVELOPERS: · line 35

Quoted 3 lines · Yann E. MORIN
.gitlab-ci.yml +3 -0
+check-package:
+    script:
+        - find . -type f -name '*.mk' -exec ./utils/check-package {} +

Does it run without warning on all .mk files?

In fact, I think we shouldn't limit it to .mk files, because check-package can also verify Config.in files and .hash files.

Perhaps:

find package/ boot/ linux/ -type f -exec ./utils/check-package {}

Best regards,

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com
#27 lore raw

PATCH 8/8 gitlab-ci: run check-package

Thomas, All,

On 2017-11-30 08:59 +0100, Thomas Petazzoni spake thusly:

Quoted 6 lines · Yann E. MORIN

.gitlab-ci.yml check-DEVELOPERS: · line 35

Quoted 3 lines
.gitlab-ci.yml +3 -0
+check-package:
+    script:
+        - find . -type f -name '*.mk' -exec ./utils/check-package {} +

Does it run without warning on all .mk files?

As I explained in thecover letter, no. There is a false-positive in asterisk.

That's why I suggested in the cover-letter not to applu it for now, until check-pacakge learns about that case.

Quoted 2 lines

In fact, I think we shouldn't limit it to .mk files, because check-package can also verify Config.in files and .hash files.

This can be refined later on, probably?

Quoted 2 lines

Perhaps:
find package/ boot/ linux/ -type f -exec ./utils/check-package {}

But then it would also catch the patches, the init scripts, and any other data file that is present in packages directories.

For now, this catches 305+539+264 = 1108 warnings...

So I would at least limit it to Config.in, .mk, .hash, .patch files.

And even that generates 305+566+230 = 1101 warnings.

Regards,
Yann E. MORIN.

PS. Not sure what the split in three numbers is:

  $ find package/ boot/ linux/ -type f \
        \( -name '*.mk' -o -name '*.hash' \
           -o -name '*.patch' -o -name Config.in \
        \) -exec ./utils/check-package {} + 2>&1 \
    |grep 'warnings generated'
    305 warnings generated
    566 warnings generated
    230 warnings generated
Quoted 7 lines

Best regards,

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com
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.  |
'------------------------------^-------^------------------^--------------------'
#28 lore raw

PATCH 8/8 gitlab-ci: run check-package

Hello,

Quoted 6 lines · Yann E. MORIN

On 2017-11-30 08:59 +0100, Thomas Petazzoni spake thusly:

Quoted 5 lines · Yann E. MORIN
Quoted 3 lines
.gitlab-ci.yml +3 -0
+check-package:
+    script:
+        - find . -type f -name '*.mk' -exec ./utils/check-package {} +  
Quoted 7 lines
Quoted 1 line

Does it run without warning on all .mk files?

As I explained in thecover letter, no. There is a false-positive in asterisk.

That's why I suggested in the cover-letter not to applu it for now, until check-pacakge learns about that case.

Ricardo already proposed a fix for check-package to avoid the asterisk case :-)

Quoted 4 lines
Quoted 2 lines

In fact, I think we shouldn't limit it to .mk files, because check-package can also verify Config.in files and .hash files.

This can be refined later on, probably?

True.

Quoted 7 lines
Quoted 2 lines

Perhaps:
find package/ boot/ linux/ -type f -exec ./utils/check-package {}

But then it would also catch the patches, the init scripts, and any other data file that is present in packages directories.

For now, this catches 305+539+264 = 1108 warnings...

Doh.

Quoted 3 lines

So I would at least limit it to Config.in, .mk, .hash, .patch files.

And even that generates 305+566+230 = 1101 warnings.

That's indeed a lot. In addition, I want the thing to "fail" if there are some warnings, otherwise Gitlab CI will not report the job as failed.

So, let's do this:

1. Fix check-package to avoid the false warning on asterisk

2. Add the Gitlab CI job testing only .mk files, but making sure that if there is a single warning, it returns with a non-zero error code so that the job is considered as failed if we have a warning

3. Over time, fix warnings in Config.in and .hash files, until the point where we can enable checking them in Gitlab CI as well.

Thoughts?

Thanks,

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com
#29 lore raw

PATCH 8/8 gitlab-ci: run check-package

Thomas, All,

On 2017-12-01 10:54 +0100, Thomas Petazzoni spake thusly:

Quoted 8 lines · Yann E. MORIN
Quoted 7 lines

On 2017-11-30 08:59 +0100, Thomas Petazzoni spake thusly:

Quoted 6 lines · Yann E. MORIN

.gitlab-ci.yml check-DEVELOPERS: · line 35

Quoted 3 lines
.gitlab-ci.yml +3 -0
+check-package:
+    script:
+        - find . -type f -name '*.mk' -exec ./utils/check-package {} +  

Does it run without warning on all .mk files?

[--SNIP--]

Quoted 6 lines
Quoted 2 lines

So I would at least limit it to Config.in, .mk, .hash, .patch files. And even that generates 305+566+230 = 1101 warnings.

That's indeed a lot. In addition, I want the thing to "fail" if there are some warnings, otherwise Gitlab CI will not report the job as failed.

Agreed.

Quoted 3 lines

So, let's do this:

1. Fix check-package to avoid the false warning on asterisk

Waiting for Ricardo's change to trickle in. Ricardo, can you send an official patch, please?

Quoted 3 lines

2. Add the Gitlab CI job testing only .mk files, but making sure that if there is a single warning, it returns with a non-zero error code so that the job is considered as failed if we have a warning

Then this series is ready as it is, minus the comment in asterisk.mk.

Quoted 2 lines

3. Over time, fix warnings in Config.in and .hash files, until the point where we can enable checking them in Gitlab CI as well.

Agreed.

Regards,
Yann E. MORIN.

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.  |
'------------------------------^-------^------------------^--------------------'
#30 lore raw

PATCH 8/8 gitlab-ci: run check-package

In reply to Yann E. MORIN

Hello,

On Thu, Nov 30, 2017 at 01:34 PM, Yann E. MORIN wrote:
[snip]

Quoted 7 lines

And even that generates 305+566+230 = 1101 warnings.

Regards,
Yann E. MORIN.

PS. Not sure what the split in three numbers is:

Quoted 8 lines
  $ find package/ boot/ linux/ -type f \
        \( -name '*.mk' -o -name '*.hash' \
           -o -name '*.patch' -o -name Config.in \
        \) -exec ./utils/check-package {} + 2>&1 \
    |grep 'warnings generated'
    305 warnings generated
    566 warnings generated
    230 warnings generated

find -exec splits it into 3 lines:

  $ find package/ boot/ linux/ -type f \
        \( -name '*.mk' -o -name '*.hash' \
           -o -name '*.patch' -o -name Config.in \
        \) -exec echo {} + | wc -l
  3
Each one of the first two lines is 128KiB long.
  $ xargs --show-limits
  ...
  Size of command buffer we are actually using: 131072

Regards,
Ricardo

#31 lore raw

PATCH 8/8 gitlab-ci: run check-package

In reply to Yann E. MORIN

Hello,

Quoted 7 lines · Yann E. MORIN
Cc Thomas Petazzoni <[email protected]>
Cc Arnout Vandecappelle <[email protected]>
---
 .gitlab-ci.yml    | 4 ++++
 .gitlab-ci.yml.in | 4 ++++
 2 files changed, 8 insertions(+)

Applied to master, after doing two other commits fixing .mk files warning introduced in the next branch. We're down to just the false warning from asterisk.mk.

Thanks!

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com