kbuild: control extra pacman packages with PACMAN_EXTRAPACKAGES
PATCH 1/1 kbuild: control extra pacman packages with PACMAN_EXTRAPACKAGES
Introduce a new variable, PACMAN_EXTRAPACKAGES, in the Makefile.package to control the creation of additional packages by the pacman-pkg target.
This changes the behavior of the pacman-pkg target to only create the main kernel package by default. The rest of the packages will be opt-in going forward.
In a previous patch, there was concern that adding a new debug package would increase the package time. To address this concern and provide more flexibility, this change has been added to allow users to decide which extra packages to include before introducing an optional debug package [1].
[1] https://lore.kernel.org/lkml/20240801192008.GA3923315@thelio-3990X/T/
--- scripts/Makefile.package | 5 +++++ scripts/package/PKGBUILD | 11 ++++++++--- 2 files changed, 13 insertions(+), 3 deletions(-)
scripts/Makefile.package +5 -0
@@ -144,6 +144,10 @@ snap-pkg: # pacman-pkg # --------------------------------------------------------------------------- +# Space-separated list of extra packages to build +# The available extra packages are: headers api-headers +PACMAN_EXTRAPACKAGES ?= + PHONY += pacman-pkg pacman-pkg: @ln -srf $(srctree)/scripts/package/PKGBUILD $(objtree)/PKGBUILD
@@ -152,6 +156,7 @@ pacman-pkg: CARCH="$(UTS_MACHINE)" \ KBUILD_MAKEFLAGS="$(MAKEFLAGS)" \ KBUILD_REVISION="$(shell $(srctree)/scripts/build-version)" \ + PACMAN_EXTRAPACKAGES="$(PACMAN_EXTRAPACKAGES)" \ makepkg $(MAKEPKGOPTS) # dir-pkg tar*-pkg - tarball targets
scripts/package/PKGBUILD +8 -3
@@ -3,10 +3,15 @@ # Contributor: Jan Alexander Steffens (heftig) <[email protected]> pkgbase=${PACMAN_PKGBASE:-linux-upstream} -pkgname=("${pkgbase}" "${pkgbase}-api-headers") -if grep -q CONFIG_MODULES=y include/config/auto.conf; then - pkgname+=("${pkgbase}-headers") +pkgname=("${pkgbase}") + +_extrapackages=${PACMAN_EXTRAPACKAGES:-} +if [ -n "$_extrapackages" ]; then + for pkg in $_extrapackages; do + pkgname+=("${pkgbase}-$pkg") + done fi + pkgver="${KERNELRELEASE//-/_}" # The PKGBUILD is evaluated multiple times. # Running scripts/build-version from here would introduce inconsistencies.
Signature · 1 line
2.46.0
Thomas Weißschuh
maintainerHi Jose,
Quoted 6 lines · Jose Fernandez
Introduce a new variable,
PACMAN_EXTRAPACKAGES, in the Makefile.package to control the creation of additional packages by the pacman-pkg target.This changes the behavior of the pacman-pkg target to only create the main kernel package by default. The rest of the packages will be opt-in going forward.
I had the impression that by default all extrapackages should be built. The variable can then be used by expert users where needed. Other Opinions?
Quoted 5 lines
In a previous patch, there was concern that adding a new debug package would increase the package time. To address this concern and provide more flexibility, this change has been added to allow users to decide which extra packages to include before introducing an optional debug package [1].
This paragraph seems like it shouldn't be part of the final commit. If you put it after a line with "---" it will be dropped from the commit, like so:
---
In a previous patch, ...
Quoted 15 lines
[1] https://lore.kernel.org/lkml/20240801192008.GA3923315@thelio-3990X/T/
Signed-off-by Jose Fernandez <[email protected]>Reviewed-by Peter Jung <[email protected]>--- scripts/Makefile.package | 5 +++++ scripts/package/PKGBUILD | 11 ++++++++--- 2 files changed, 13 insertions(+), 3 deletions(-)scripts/Makefile.package +0
-0
scripts/Makefile.package snap-pkg: · line 149
Quoted 6 lines
scripts/Makefile.package +3
-0@@ -144,6 +144,10 @@ snap-pkg: # pacman-pkg # --------------------------------------------------------------------------- +# Space-separated list of extra packages to build +# The available extra packages are: headers api-headers +PACMAN_EXTRAPACKAGES ?=
The assignment doesn't do anything.
Do we need the documentation if the default enables all subpackages?
scripts/Makefile.package pacman-pkg: · line 159
Quoted 9 lines
scripts/Makefile.package +2
-0+ PHONY += pacman-pkg pacman-pkg: @ln -srf $(srctree)/scripts/package/PKGBUILD $(objtree)/PKGBUILD@@ -152,6 +156,7 @@ pacman-pkg: CARCH="$(UTS_MACHINE)" \ KBUILD_MAKEFLAGS="$(MAKEFLAGS)" \ KBUILD_REVISION="$(shell $(srctree)/scripts/build-version)" \ + PACMAN_EXTRAPACKAGES="$(PACMAN_EXTRAPACKAGES)" \
This line is superfluous.
Quoted 8 lines
scripts/Makefile.package +0
-0makepkg $(MAKEPKGOPTS) # dir-pkg tar*-pkg - tarball targetsscripts/package/PKGBUILD +0
-0
scripts/package/PKGBUILD line 9
Quoted 10 lines
scripts/package/PKGBUILD +4
-3@@ -3,10 +3,15 @@ # Contributor: Jan Alexander Steffens (heftig) <[email protected]> pkgbase=${PACMAN_PKGBASE:-linux-upstream} -pkgname=("${pkgbase}" "${pkgbase}-api-headers") -if grep -q CONFIG_MODULES=y include/config/auto.conf; then - pkgname+=("${pkgbase}-headers") +pkgname=("${pkgbase}") + +_extrapackages=${PACMAN_EXTRAPACKAGES:-} +if [ -n "$_extrapackages" ]; then
No need for this check. The loop over an empty variable work fine.
scripts/package/PKGBUILD line 11
Quoted 2 lines
scripts/package/PKGBUILD +2
-0+ for pkg in $_extrapackages; do + pkgname+=("${pkgbase}-$pkg")
Use consistent variable references: "${pkgbase}-${pkg}"
Quoted 9 lines
scripts/package/PKGBUILD +2
-0+ done fi + pkgver="${KERNELRELEASE//-/_}" # The PKGBUILD is evaluated multiple times. # Running scripts/build-version from here would introduce inconsistencies.Signature · 1 line
2.46.0
Quoted 7 lines · Thomas Weißschuh
Quoted 3 lines
This changes the behavior of the pacman-pkg target to only create the main kernel package by default. The rest of the packages will be opt-in going forward.
I had the impression that by default all extrapackages should be built. The variable can then be used by expert users where needed. Other Opinions?
I think switching to defaulting to all packages is a good idea. One concern I had was how regular users would discover the customization options. Expert users will likely look at the Makefile and figure out how to opt out.
I will plan to make this change for v2 unless there are any objections.
Quoted 6 lines
Quoted 5 lines
In a previous patch, there was concern that adding a new debug package would increase the package time. To address this concern and provide more flexibility, this change has been added to allow users to decide which extra packages to include before introducing an optional debug package [1].
Quoted 7 lines
This paragraph seems like it shouldn't be part of the final commit. If you put it after a line with "---" it will be dropped from the commit, like so:
---
In a previous patch, ...
Agreed, I will move this paragraph to below --- for v2.
Quoted 26 lines
Quoted 16 lines
[1] https://lore.kernel.org/lkml/20240801192008.GA3923315@thelio-3990X/T/
Signed-off-by Jose Fernandez <[email protected]>Reviewed-by Peter Jung <[email protected]>--- scripts/Makefile.package | 5 +++++ scripts/package/PKGBUILD | 11 ++++++++--- 2 files changed, 13 insertions(+), 3 deletions(-)scripts/Makefile.package +0
-0scripts/Makefile.package snap-pkg: · line 149
Quoted 6 lines
scripts/Makefile.package +3
-0@@ -144,6 +144,10 @@ snap-pkg: # pacman-pkg # --------------------------------------------------------------------------- +# Space-separated list of extra packages to build +# The available extra packages are: headers api-headers +PACMAN_EXTRAPACKAGES ?=The assignment doesn't do anything.
Do we need the documentation if the default enables all subpackages?
Quoted 11 lines
scripts/Makefile.package pacman-pkg: · line 159
Quoted 9 lines
scripts/Makefile.package +2
-0+ PHONY += pacman-pkg pacman-pkg: @ln -srf $(srctree)/scripts/package/PKGBUILD $(objtree)/PKGBUILD@@ -152,6 +156,7 @@ pacman-pkg: CARCH="$(UTS_MACHINE)" \ KBUILD_MAKEFLAGS="$(MAKEFLAGS)" \ KBUILD_REVISION="$(shell $(srctree)/scripts/build-version)" \ + PACMAN_EXTRAPACKAGES="$(PACMAN_EXTRAPACKAGES)" \This line is superfluous.
Ack.
Quoted 10 lines
Quoted 10 lines
scripts/Makefile.package +0
-0makepkg $(MAKEPKGOPTS) # dir-pkg tar*-pkg - tarball targetsscripts/package/PKGBUILD +0
-0@@ -3,10 +3,15 @@ # Contributor: Jan Alexander Steffens (heftig) <[email protected]>
Quoted 10 lines
scripts/package/PKGBUILD line 9
Quoted 8 lines
scripts/package/PKGBUILD +4
-3pkgbase=${PACMAN_PKGBASE:-linux-upstream} -pkgname=("${pkgbase}" "${pkgbase}-api-headers") -if grep -q CONFIG_MODULES=y include/config/auto.conf; then - pkgname+=("${pkgbase}-headers") +pkgname=("${pkgbase}") + +_extrapackages=${PACMAN_EXTRAPACKAGES:-} +if [ -n "$_extrapackages" ]; thenNo need for this check. The loop over an empty variable work fine.
Ack. Will update in v2.
Quoted 4 lines
scripts/package/PKGBUILD line 11
Quoted 2 lines
scripts/package/PKGBUILD +2
-0+ for pkg in $_extrapackages; do + pkgname+=("${pkgbase}-$pkg")Use consistent variable references: "${pkgbase}-${pkg}"
Ack. Will update in v2.
Quoted 9 lines
Quoted 9 lines
scripts/package/PKGBUILD +2
-0+ done fi + pkgver="${KERNELRELEASE//-/_}" # The PKGBUILD is evaluated multiple times. # Running scripts/build-version from here would introduce inconsistencies.Signature · 1 line
2.46.0
Nathan Chancellor
maintainerQuoted 5 lines · Jose Fernandez
Quoted 4 lines · Thomas Weißschuh
Quoted 3 lines
This changes the behavior of the pacman-pkg target to only create the main kernel package by default. The rest of the packages will be opt-in going forward.
Quoted 7 lines
Quoted 3 lines
I had the impression that by default all extrapackages should be built. The variable can then be used by expert users where needed. Other Opinions?
I think switching to defaulting to all packages is a good idea. One concern I had was how regular users would discover the customization options. Expert users will likely look at the
Makefileand figure out how to opt out.
I think that most users will likely want all of the packages built by default. I think leaving this to be discovered by power users in the Makefile is reasonable.
Quoted 54 lines
Quoted 6 lines
Quoted 5 lines
In a previous patch, there was concern that adding a new debug package would increase t.he package time. To address this concern and provide more flexibility, this change has been added to allow users to decide which extra packages to include before introducing an optional debug package [1].
Quoted 7 lines
This paragraph seems like it shouldn't be part of the final commit. If you put it after a line with "---" it will be dropped from the commit, like so:
---
In a previous patch, ...
Agreed, I will move this paragraph to below --- for v2.
Quoted 26 lines
Quoted 16 lines
[1] https://lore.kernel.org/lkml/20240801192008.GA3923315@thelio-3990X/T/
Signed-off-by Jose Fernandez <[email protected]>Reviewed-by Peter Jung <[email protected]>--- scripts/Makefile.package | 5 +++++ scripts/package/PKGBUILD | 11 ++++++++--- 2 files changed, 13 insertions(+), 3 deletions(-)scripts/Makefile.package +0
-0scripts/Makefile.package snap-pkg: · line 149
Quoted 6 lines
scripts/Makefile.package +3
-0@@ -144,6 +144,10 @@ snap-pkg: # pacman-pkg # --------------------------------------------------------------------------- +# Space-separated list of extra packages to build +# The available extra packages are: headers api-headers +PACMAN_EXTRAPACKAGES ?=The assignment doesn't do anything.
Do we need the documentation if the default enables all subpackages?Quoted 11 lines
scripts/Makefile.package pacman-pkg: · line 159
Quoted 9 lines
scripts/Makefile.package +2
-0+ PHONY += pacman-pkg pacman-pkg: @ln -srf $(srctree)/scripts/package/PKGBUILD $(objtree)/PKGBUILD@@ -152,6 +156,7 @@ pacman-pkg: CARCH="$(UTS_MACHINE)" \ KBUILD_MAKEFLAGS="$(MAKEFLAGS)" \ KBUILD_REVISION="$(shell $(srctree)/scripts/build-version)" \ + PACMAN_EXTRAPACKAGES="$(PACMAN_EXTRAPACKAGES)" \This line is superfluous.
Quoted 1 line
Ack.
Is it superfluous if PACMAN_EXTRAPACKAGES is not exported to makepkg? If I remove this while changing the default of PACMAN_EXTRAPACKAGES in scripts/Makefile.package, its value is not visible in makepkg, so only the default package gets built. I think
export PACMAN_EXTRAPACKAGES
is needed after the '?=' assignment line.
Quoted 39 lines
Quoted 10 lines
Quoted 10 lines
scripts/Makefile.package +0
-0makepkg $(MAKEPKGOPTS) # dir-pkg tar*-pkg - tarball targetsscripts/package/PKGBUILD +0
-0@@ -3,10 +3,15 @@ # Contributor: Jan Alexander Steffens (heftig) <[email protected]>Quoted 10 lines
scripts/package/PKGBUILD line 9
Quoted 8 lines
scripts/package/PKGBUILD +4
-3pkgbase=${PACMAN_PKGBASE:-linux-upstream} -pkgname=("${pkgbase}" "${pkgbase}-api-headers") -if grep -q CONFIG_MODULES=y include/config/auto.conf; then - pkgname+=("${pkgbase}-headers") +pkgname=("${pkgbase}") + +_extrapackages=${PACMAN_EXTRAPACKAGES:-} +if [ -n "$_extrapackages" ]; thenNo need for this check. The loop over an empty variable work fine.
Ack. Will update in v2.
Quoted 4 lines
scripts/package/PKGBUILD line 11
Quoted 2 lines
scripts/package/PKGBUILD +2
-0+ for pkg in $_extrapackages; do + pkgname+=("${pkgbase}-$pkg")Use consistent variable references: "${pkgbase}-${pkg}"
Ack. Will update in v2.
Quoted 9 lines
Quoted 9 lines
scripts/package/PKGBUILD +2
-0+ done fi + pkgver="${KERNELRELEASE//-/_}" # The PKGBUILD is evaluated multiple times. # Running scripts/build-version from here would introduce inconsistencies.Signature · 1 line
2.46.0
Quoted 10 lines · Nathan Chancellor
Quoted 9 lines · Jose Fernandez
Quoted 7 lines · Thomas Weißschuh
Quoted 3 lines
This changes the behavior of the pacman-pkg target to only create the main kernel package by default. The rest of the packages will be opt-in going forward.
I had the impression that by default all extrapackages should be built. The variable can then be used by expert users where needed. Other Opinions?
Quoted 7 lines
Quoted 3 lines
I think switching to defaulting to all packages is a good idea. One concern I had was how regular users would discover the customization options. Expert users will likely look at the
Makefileand figure out how to opt out.I think that most users will likely want all of the packages built by default. I think leaving this to be discovered by power users in the
Makefileis reasonable.
Sounds good!
Quoted 56 lines
Quoted 54 lines
Quoted 6 lines
Quoted 5 lines
In a previous patch, there was concern that adding a new debug package would increase t.he package time. To address this concern and provide more flexibility, this change has been added to allow users to decide which extra packages to include before introducing an optional debug package [1].
Quoted 7 lines
This paragraph seems like it shouldn't be part of the final commit. If you put it after a line with "---" it will be dropped from the commit, like so:
---
In a previous patch, ...
Agreed, I will move this paragraph to below --- for v2.
Quoted 26 lines
Quoted 16 lines
[1] https://lore.kernel.org/lkml/20240801192008.GA3923315@thelio-3990X/T/
Signed-off-by Jose Fernandez <[email protected]>Reviewed-by Peter Jung <[email protected]>--- scripts/Makefile.package | 5 +++++ scripts/package/PKGBUILD | 11 ++++++++--- 2 files changed, 13 insertions(+), 3 deletions(-)scripts/Makefile.package +0
-0scripts/Makefile.package snap-pkg: · line 149
Quoted 6 lines
scripts/Makefile.package +3
-0@@ -144,6 +144,10 @@ snap-pkg: # pacman-pkg # --------------------------------------------------------------------------- +# Space-separated list of extra packages to build +# The available extra packages are: headers api-headers +PACMAN_EXTRAPACKAGES ?=The assignment doesn't do anything.
Do we need the documentation if the default enables all subpackages?Quoted 11 lines
scripts/Makefile.package pacman-pkg: · line 159
Quoted 9 lines
scripts/Makefile.package +2
-0+ PHONY += pacman-pkg pacman-pkg: @ln -srf $(srctree)/scripts/package/PKGBUILD $(objtree)/PKGBUILD@@ -152,6 +156,7 @@ pacman-pkg: CARCH="$(UTS_MACHINE)" \ KBUILD_MAKEFLAGS="$(MAKEFLAGS)" \ KBUILD_REVISION="$(shell $(srctree)/scripts/build-version)" \ + PACMAN_EXTRAPACKAGES="$(PACMAN_EXTRAPACKAGES)" \This line is superfluous.
Quoted 1 line
Ack.
Quoted 8 lines
Is it superfluous if
PACMAN_EXTRAPACKAGESis not exported to makepkg? If I remove this while changing the default ofPACMAN_EXTRAPACKAGESinscripts/Makefile.package, its value is not visible in makepkg, so only the default package gets built. I thinkexport
PACMAN_EXTRAPACKAGESis needed after the '?=' assignment line.
Nathan, I removed the line and it appears to work as expected.
If I set the default packages to:
PACMAN_EXTRAPACKAGES ?= headers api-headers
Then any of these commands builds only the main kernel package:
make pacman-pkg PACMAN_EXTRAPACKAGES=
make pacman-pkg PACMAN_EXTRAPACKAGES=""
This command builds the main package + headers package:
make pacman-pkg PACMAN_EXTRAPACKAGES="headers"
I'm not quite sure how PACMAN_EXTRAPACKAGES makes it to makepkg without that line. But it appears like it does.
Quoted 40 lines
Quoted 40 lines
Quoted 11 lines
Quoted 11 lines
scripts/Makefile.package +0
-0makepkg $(MAKEPKGOPTS) # dir-pkg tar*-pkg - tarball targetsscripts/package/PKGBUILD +0
-0@@ -3,10 +3,15 @@ # Contributor: Jan Alexander Steffens (heftig) <[email protected]>Quoted 10 lines
scripts/package/PKGBUILD line 9
Quoted 8 lines
scripts/package/PKGBUILD +4
-3pkgbase=${PACMAN_PKGBASE:-linux-upstream} -pkgname=("${pkgbase}" "${pkgbase}-api-headers") -if grep -q CONFIG_MODULES=y include/config/auto.conf; then - pkgname+=("${pkgbase}-headers") +pkgname=("${pkgbase}") + +_extrapackages=${PACMAN_EXTRAPACKAGES:-} +if [ -n "$_extrapackages" ]; thenNo need for this check. The loop over an empty variable work fine.
Ack. Will update in v2.
Quoted 4 lines
scripts/package/PKGBUILD line 11
Quoted 2 lines
scripts/package/PKGBUILD +2
-0+ for pkg in $_extrapackages; do + pkgname+=("${pkgbase}-$pkg")Use consistent variable references: "${pkgbase}-${pkg}"
Ack. Will update in v2.
Quoted 9 lines
Quoted 9 lines
scripts/package/PKGBUILD +2
-0+ done fi + pkgver="${KERNELRELEASE//-/_}" # The PKGBUILD is evaluated multiple times. # Running scripts/build-version from here would introduce inconsistencies.Signature · 1 line
2.46.0