linux: indicate proper CPE prefix
PATCH 1/1 linux: indicate proper CPE prefix
The CPE type of the Linux kernel is special, it should be "o", unlike all other packages that use "a". We therefore need to override <pkg>_CPE_ID_PREFIX, so that the CPE ID of the linux package matches with the CPE dictionary.
--- linux/linux.mk | 1 + 1 file changed, 1 insertion(+)
linux/linux.mk +1 -0
@@ -14,6 +14,7 @@ LINUX_LICENSE_FILES = \ endif LINUX_CPE_ID_VENDOR = $(LINUX_NAME) LINUX_CPE_ID_NAME = $(LINUX_NAME)_kernel +LINUX_CPE_ID_PREFIX = cpe:2.3:o define LINUX_HELP_CMDS @echo ' linux-menuconfig - Run Linux kernel menuconfig'
Signature · 1 line
2.29.2
PATCH 1/1 support/scripts/pkg-stats: properly handle host packages with -c option
In commit 7a607dab336e7f78ab069cff1b503d0688950583 ("support/scripts/pkg-stats: support generating stats based on configured packages"), we added a -c option to pkg-stats to generate a report based on the list of packages enabled in the configuration, rather than for all packages.
This is done based on the list of packages returned in JSON format by "make show-info". However, this JSON output contains really the actual name of packages, including their host- prefix for host packages. Due to this, none of the host packages were matching and therefore reported in the pkg-stats -c output.
This commit fixes that by stripping the host- prefix for host packages.
--- support/scripts/pkg-stats | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
support/scripts/pkg-stats +7 -1
@@ -353,7 +353,13 @@ def get_pkglist(npackages, package_list): def get_config_packages(): cmd = ["make", "--no-print-directory", "show-info"] js = json.loads(subprocess.check_output(cmd)) - return js.keys() + pkgs = list() + for k, v in js.items(): + if v["type"] == "host": + pkgs.append(k[5:]) + else: + pkgs.append(k) + return pkgs def package_init_make_info():
Signature · 1 line
2.29.2
PATCH 1/1 support/scripts/pkg-stats: properly handle host packages with -c option
Thomas,
Quoted 30 lines · Thomas Petazzoni
In commit
7a607dab336e7f78ab069cff1b503d0688950583("support/scripts/pkg-stats: support generating stats based on configured packages"), we added a -c option to pkg-stats to generate a report based on the list of packages enabled in the configuration, rather than for all packages.This is done based on the list of packages returned in JSON format by "make show-info". However, this JSON output contains really the actual name of packages, including their host- prefix for host packages. Due to this, none of the host packages were matching and therefore reported in the pkg-stats -c output.
This commit fixes that by stripping the host- prefix for host packages.
Reported-by Matt Weber <[email protected]>Cc Matt Weber <[email protected]>Signed-off-by Thomas Petazzoni <[email protected]>--- support/scripts/pkg-stats | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)support/scripts/pkg-stats +0
-0@@ -353,7 +353,13 @@ def get_pkglist(npackages, package_list): def get_config_packages(): cmd = ["make", "--no-print-directory", "show-info"]
support/scripts/pkg-stats def get_pkglist(npackages, package_list): · line 363
Quoted 10 lines
support/scripts/pkg-stats +7
-1js = json.loads(subprocess.check_output(cmd)) - return js.keys() + pkgs = list() + for k, v in js.items(): + if v["type"] == "host": + pkgs.append(k[5:]) + else: + pkgs.append(k) + return pkgs
PATCH 1/1 support/scripts/pkg-stats: properly handle host packages with -c option
In reply to Thomas PetazzoniThomas, All,
On 2021-01-07 22:13 +0100, Thomas Petazzoni spake thusly:
Quoted 6 lines
In commit
7a607dab336e7f78ab069cff1b503d0688950583("support/scripts/pkg-stats: support generating stats based on configured packages"), we added a -c option to pkg-stats to generate a report based on the list of packages enabled in the configuration, rather than for all packages.
Quoted 8 lines
This is done based on the list of packages returned in JSON format by "make show-info". However, this JSON output contains really the actual name of packages, including their host- prefix for host packages. Due to this, none of the host packages were matching and therefore reported in the pkg-stats -c output.
This commit fixes that by stripping the host- prefix for host packages.
I think the correct fix would be for the json output to already contain the base name of the package, and the script to use that field, rather than the key, as a package name. That way, the behaviour would be the same for both target and host packages.
Something like:
diff --git a/package/pkg-utils.mk b/package/pkg-utils.mk
index a2cc160d0b..0f9d612f12 100644
--- a/package/pkg-utils.mk
+++ b/package/pkg-utils.mk
@@ -91,6 +91,7 @@ endef
# $(1): upper-case package or filesystem name
define json-info
"$($(1)_NAME)": {
+ "name": "$($(1)_RAWNAME)",
"type": "$($(1)_TYPE)",
$(if $(filter rootfs,$($(1)_TYPE)), \
$(call _json-info-fs,$(1)), \Regards,
Yann E. MORIN.
Quoted 33 lines
Reported-by Matt Weber <[email protected]>Cc Matt Weber <[email protected]>Signed-off-by Thomas Petazzoni <[email protected]>--- support/scripts/pkg-stats | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)support/scripts/pkg-stats +7
-1@@ -353,7 +353,13 @@ def get_pkglist(npackages, package_list): def get_config_packages(): cmd = ["make", "--no-print-directory", "show-info"] js = json.loads(subprocess.check_output(cmd)) - return js.keys() + pkgs = list() + for k, v in js.items(): + if v["type"] == "host": + pkgs.append(k[5:]) + else: + pkgs.append(k) + return pkgs def package_init_make_info():Signature · 6 lines
2.29.2 _______________________________________________ buildroot mailing list buildroot at busybox.net http://lists.busybox.net/mailman/listinfo/buildroot
Signature · 6 lines
.-----------------.--------------------.------------------.--------------------. | Yann E. MORIN | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: | | +33 662 376 056 | Software Designer | \ / CAMPAIGN | ___ | | +33 561 099 427 `------------.-------: X AGAINST | \e/ There is no | | http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL | v conspiracy. | '------------------------------^-------^------------------^--------------------'
PATCH 1/1 support/scripts/pkg-stats: properly handle host packages with -c option
Hello,
Quoted 4 lines · On Thu, 7 Jan 2021 22:32:07 +0100 "Yann E. MORIN" <[email protected]>…
I think the correct fix would be for the json output to already contain the base name of the package, and the script to use that field, rather than the key, as a package name. That way, the behaviour would be the same for both target and host packages.
Right, that could certainly work as well.
Quoted 12 lines
Something like:
diff --git a/package/pkg-utils.mk b/package/pkg-utils.mk index a2cc160d0b..0f9d612f12 100644 --- a/package/pkg-utils.mk +++ b/package/pkg-utils.mk @@ -91,6 +91,7 @@ endef # $(1): upper-case package or filesystem name define json-info "$($(1)_NAME)": { + "name": "$($(1)_RAWNAME)",
"name" or "rawname" ?
Thomas
Signature · 3 lines
Thomas Petazzoni, CTO, Bootlin Embedded Linux and Kernel engineering https://bootlin.com
PATCH 1/1 support/scripts/pkg-stats: properly handle host packages with -c option
Thomas, All,
On 2021-01-07 22:34 +0100, Thomas Petazzoni spake thusly:
Quoted 23 lines
Quoted 4 lines · On Thu, 7 Jan 2021 22:32:07 +0100 "Yann E. MORIN" <[email protected]>…
I think the correct fix would be for the json output to already contain the base name of the package, and the script to use that field, rather than the key, as a package name. That way, the behaviour would be the same for both target and host packages.
Right, that could certainly work as well.
Quoted 12 lines
Something like:
diff --git a/package/pkg-utils.mk b/package/pkg-utils.mk index a2cc160d0b..0f9d612f12 100644 --- a/package/pkg-utils.mk +++ b/package/pkg-utils.mk @@ -91,6 +91,7 @@ endef # $(1): upper-case package or filesystem name define json-info "$($(1)_NAME)": { + "name": "$($(1)_RAWNAME)",
Quoted 1 line
"name" or "rawname" ?
"rawname" is a detail of the naming of our internal variables. WE do not want to propagate that to the outside world.
"name" is really that: the name of the package, by which people know it and talk about.
Regards,
Yann E. MORIN.
Quoted 9 lines
Thomas
Signature · 7 lines
Thomas Petazzoni, CTO, Bootlin Embedded Linux and Kernel engineering https://bootlin.com _______________________________________________ buildroot mailing list buildroot at busybox.net http://lists.busybox.net/mailman/listinfo/buildroot
Signature · 6 lines
.-----------------.--------------------.------------------.--------------------. | Yann E. MORIN | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: | | +33 662 376 056 | Software Designer | \ / CAMPAIGN | ___ | | +33 561 099 427 `------------.-------: X AGAINST | \e/ There is no | | http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL | v conspiracy. | '------------------------------^-------^------------------^--------------------'
PATCH 1/1 support/scripts/pkg-stats: properly handle host packages with -c option
Quoted 26 lines · Yann E. MORIN
Thomas, All,
On 2021-01-07 22:34 +0100, Thomas Petazzoni spake thusly:
Quoted 23 lines
Quoted 4 lines · On Thu, 7 Jan 2021 22:32:07 +0100 "Yann E. MORIN" <[email protected]>…
I think the correct fix would be for the json output to already contain the base name of the package, and the script to use that field, rather than the key, as a package name. That way, the behaviour would be the same for both target and host packages.
Right, that could certainly work as well.
Quoted 12 lines
Something like:
diff --git a/package/pkg-utils.mk b/package/pkg-utils.mk index a2cc160d0b..0f9d612f12 100644 --- a/package/pkg-utils.mk +++ b/package/pkg-utils.mk @@ -91,6 +91,7 @@ endef # $(1): upper-case package or filesystem name define json-info "$($(1)_NAME)": { + "name": "$($(1)_RAWNAME)",
Quoted 7 lines
Quoted 1 line
"name" or "rawname" ?
"rawname" is a detail of the naming of our internal variables. WE do not want to propagate that to the outside world.
"name" is really that: the name of the package, by which people know it and talk about.
+1
Regards,
Arnout
PATCH 1/1 linux: indicate proper CPE prefix
In reply to Thomas PetazzoniThomas,
Quoted 18 lines · Thomas Petazzoni
The CPE type of the Linux kernel is special, it should be "o", unlike all other packages that use "a". We therefore need to override <pkg>_CPE_ID_PREFIX, so that the CPE ID of the linux package matches with the CPE dictionary.
Reported-by Matt Weber <[email protected]>Cc Matt Weber <[email protected]>Signed-off-by Thomas Petazzoni <[email protected]>--- linux/linux.mk | 1 + 1 file changed, 1 insertion(+)linux/linux.mk +0
-0
linux/linux.mk LINUX_LICENSE_FILES = \ · line 18
Quoted 5 lines
linux/linux.mk +1
-0@@ -14,6 +14,7 @@ LINUX_LICENSE_FILES = \ endif LINUX_CPE_ID_VENDOR = $(LINUX_NAME) LINUX_CPE_ID_NAME = $(LINUX_NAME)_kernel +LINUX_CPE_ID_PREFIX = cpe:2.3:o
Yann E. MORIN
AppliedPATCH 1/1 linux: indicate proper CPE prefix
In reply to Thomas PetazzoniThomas, All,
On 2021-01-07 22:13 +0100, Thomas Petazzoni spake thusly:
Quoted 8 lines
The CPE type of the Linux kernel is special, it should be "o", unlike all other packages that use "a". We therefore need to override <pkg>_CPE_ID_PREFIX, so that the CPE ID of the linux package matches with the CPE dictionary.
Reported-by Matt Weber <[email protected]>Cc Matt Weber <[email protected]>Signed-off-by Thomas Petazzoni <[email protected]>
Applied to master, thanks.
Regards,
Yann E. MORIN.
Quoted 23 lines
--- linux/linux.mk | 1 + 1 file changed, 1 insertion(+)linux/linux.mk +1
-0@@ -14,6 +14,7 @@ LINUX_LICENSE_FILES = \ endif LINUX_CPE_ID_VENDOR = $(LINUX_NAME) LINUX_CPE_ID_NAME = $(LINUX_NAME)_kernel +LINUX_CPE_ID_PREFIX = cpe:2.3:o define LINUX_HELP_CMDS @echo ' linux-menuconfig - Run Linux kernel menuconfig'Signature · 6 lines
2.29.2 _______________________________________________ buildroot mailing list buildroot at busybox.net http://lists.busybox.net/mailman/listinfo/buildroot
Signature · 6 lines
.-----------------.--------------------.------------------.--------------------. | Yann E. MORIN | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: | | +33 662 376 056 | Software Designer | \ / CAMPAIGN | ___ | | +33 561 099 427 `------------.-------: X AGAINST | \e/ There is no | | http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL | v conspiracy. | '------------------------------^-------^------------------^--------------------'