Skip to contentSkip to conversation

kbuild: control extra pacman packages with PACMAN_EXTRAPACKAGES

PATCH Superseded Jose Fernandez 3 participants 10 messages Aug 7, 2024 – Aug 11, 2024

Subsystems (2)

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH v2 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.

The headers and api-headers packages will be included by default if PACMAN_EXTRAPACKAGES is not set. This changes the previous behavior where api-headers was always included, and headers was conditionally included if CONFIG_MODULES=y. Now, this decision is delegated to the user.

To disable extra packages, set PACMAN_EXTRAPACKAGES to an empty value:

make pacman-pkg PACMAN_EXTRAPACKAGES=

or

make pacman-pkg PACMAN_EXTRAPACKAGES=""

---
v1 -> v2: Build all extra packages by default. Remove unnecessary 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].

[1] https://lore.kernel.org/lkml/20240801192008.GA3923315@thelio-3990X/T/

 scripts/Makefile.package |  2 ++
 scripts/package/PKGBUILD | 11 +++++++----
 2 files changed, 9 insertions(+), 4 deletions(-)
scripts/Makefile.package +2 -0
index 4a80584ec771..ccdf8ba41f0b 100644
@@ -144,6 +144,8 @@ snap-pkg:
 # pacman-pkg
 # ---------------------------------------------------------------------------
 
+PACMAN_EXTRAPACKAGES ?= headers api-headers
+
 PHONY += pacman-pkg
 pacman-pkg:
 	@ln -srf $(srctree)/scripts/package/PKGBUILD $(objtree)/PKGBUILD
scripts/package/PKGBUILD +7 -4
index 663ce300dd06..8de869f9b1d4 100644
@@ -3,10 +3,13 @@
 # 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")
-fi
+pkgname=("${pkgbase}")
+
+_extrapackages=${PACMAN_EXTRAPACKAGES:-}
+for pkg in $_extrapackages; do
+	pkgname+=("${pkgbase}-${pkg}")
+done
+
 pkgver="${KERNELRELEASE//-/_}"
 # The PKGBUILD is evaluated multiple times.
 # Running scripts/build-version from here would introduce inconsistencies.
Signature · 1 line
2.46.0
#1 lore raw
Quoted 14 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.

The headers and api-headers packages will be included by default if PACMAN_EXTRAPACKAGES is not set. This changes the previous behavior where api-headers was always included, and headers was conditionally included if CONFIG_MODULES=y. Now, this decision is delegated to the user.

To disable extra packages, set PACMAN_EXTRAPACKAGES to an empty value:

make pacman-pkg PACMAN_EXTRAPACKAGES=

Quoted 8 lines

or

make pacman-pkg PACMAN_EXTRAPACKAGES=""

---
v1 -> v2: Build all extra packages by default. Remove unnecessary lines.

I see only the main package built by default.

Quoted 18 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].

[1] https://lore.kernel.org/lkml/20240801192008.GA3923315@thelio-3990X/T/

 scripts/Makefile.package |  2 ++
 scripts/package/PKGBUILD | 11 +++++++----
 2 files changed, 9 insertions(+), 4 deletions(-)
scripts/Makefile.package +0 -0
index 4a80584ec771..ccdf8ba41f0b 100644

scripts/Makefile.package snap-pkg: · line 147

Quoted 4 lines
scripts/Makefile.package +1 -0
@@ -144,6 +144,8 @@ snap-pkg:
 # pacman-pkg
 # ---------------------------------------------------------------------------
 
+PACMAN_EXTRAPACKAGES ?= headers api-headers

Meaningless line.

Since 'export' is missing,
this default line is not propagated to PKGBUILD.

Nathan also mentioned 'export' would be needed if you wanted to describe this here.

https://lore.kernel.org/linux-kbuild/20240806025853.GB1570554@thelio-3990X/

Quoted 9 lines
scripts/Makefile.package +1 -0
+
 PHONY += pacman-pkg
 pacman-pkg:
        @ln -srf $(srctree)/scripts/package/PKGBUILD $(objtree)/PKGBUILD
scripts/package/PKGBUILD +0 -0
index 663ce300dd06..8de869f9b1d4 100644

scripts/package/PKGBUILD line 8

Quoted 10 lines
scripts/package/PKGBUILD +3 -4
@@ -3,10 +3,13 @@
 # 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")
-fi
+pkgname=("${pkgbase}")
+
+_extrapackages=${PACMAN_EXTRAPACKAGES:-}

Instead of adding inconsistent defaults in two places, I would write like this:

_extrapackages=${PACMAN_EXTRAPACKAGES-headers api-headers}

Lastly, I will never accept new error messages
with CONFIG_MODULES=n.

Quoted 10 lines
scripts/package/PKGBUILD +4 -1
+for pkg in $_extrapackages; do
+       pkgname+=("${pkgbase}-${pkg}")
+done
+
 pkgver="${KERNELRELEASE//-/_}"
 # The PKGBUILD is evaluated multiple times.
 # Running scripts/build-version from here would introduce inconsistencies.
--

2.46.0

--
Best Regards
Masahiro Yamada

#2 lore raw
Quoted 19 lines · Masahiro Yamada
Quoted 18 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.

The headers and api-headers packages will be included by default if PACMAN_EXTRAPACKAGES is not set. This changes the previous behavior where api-headers was always included, and headers was conditionally included if CONFIG_MODULES=y. Now, this decision is delegated to the user.

To disable extra packages, set PACMAN_EXTRAPACKAGES to an empty value:

make pacman-pkg PACMAN_EXTRAPACKAGES=

or

make pacman-pkg PACMAN_EXTRAPACKAGES=""

Quoted 7 lines
Quoted 4 lines

---
v1 -> v2: Build all extra packages by default. Remove unnecessary lines.

I see only the main package built by default.

Same.

Do we even need PACMAN_EXTRAPACKAGES in the Makefile? IMO having it in the PKGBUILD would be enough. It can still be overriden from the commandline.

Quoted 26 lines
Quoted 18 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].

[1] https://lore.kernel.org/lkml/20240801192008.GA3923315@thelio-3990X/T/

 scripts/Makefile.package |  2 ++
 scripts/package/PKGBUILD | 11 +++++++----
 2 files changed, 9 insertions(+), 4 deletions(-)
scripts/Makefile.package +0 -0
index 4a80584ec771..ccdf8ba41f0b 100644

scripts/Makefile.package snap-pkg: · line 147

Quoted 4 lines
scripts/Makefile.package +1 -0
@@ -144,6 +144,8 @@ snap-pkg:
 # pacman-pkg
 # ---------------------------------------------------------------------------
 
+PACMAN_EXTRAPACKAGES ?= headers api-headers

Meaningless line.

Quoted 8 lines

Since 'export' is missing,
this default line is not propagated to PKGBUILD.

Nathan also mentioned 'export' would be needed if you wanted to describe this here.

https://lore.kernel.org/linux-kbuild/20240806025853.GB1570554@thelio-3990X/

Same as above.

Quoted 24 lines
Quoted 9 lines
scripts/Makefile.package +1 -0
+
 PHONY += pacman-pkg
 pacman-pkg:
        @ln -srf $(srctree)/scripts/package/PKGBUILD $(objtree)/PKGBUILD
scripts/package/PKGBUILD +0 -0
index 663ce300dd06..8de869f9b1d4 100644

scripts/package/PKGBUILD line 8

Quoted 10 lines
scripts/package/PKGBUILD +3 -4
@@ -3,10 +3,13 @@
 # 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")
-fi
+pkgname=("${pkgbase}")
+
+_extrapackages=${PACMAN_EXTRAPACKAGES:-}

Instead of adding inconsistent defaults in two places, I would write like this:

Quoted 1 line

_extrapackages=${PACMAN_EXTRAPACKAGES-headers api-headers}

Agreed.

Quoted 2 lines

Lastly, I will never accept new error messages
with CONFIG_MODULES=n.

Could you elaborate?
For me this works fine with CONFIG_MODULES=n.
(After having fixed the above issues so all subpackages are built)

Quoted 9 lines
Quoted 9 lines
scripts/package/PKGBUILD +4 -1
+for pkg in $_extrapackages; do
+       pkgname+=("${pkgbase}-${pkg}")
+done
+
 pkgver="${KERNELRELEASE//-/_}"
 # The PKGBUILD is evaluated multiple times.
 # Running scripts/build-version from here would introduce inconsistencies.
--

2.46.0

#3 lore raw
Quoted 98 lines · Thomas Weißschuh
Quoted 19 lines · Masahiro Yamada
Quoted 18 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.

The headers and api-headers packages will be included by default if PACMAN_EXTRAPACKAGES is not set. This changes the previous behavior where api-headers was always included, and headers was conditionally included if CONFIG_MODULES=y. Now, this decision is delegated to the user.

To disable extra packages, set PACMAN_EXTRAPACKAGES to an empty value:

make pacman-pkg PACMAN_EXTRAPACKAGES=

or

make pacman-pkg PACMAN_EXTRAPACKAGES=""

Quoted 7 lines
Quoted 4 lines

---
v1 -> v2: Build all extra packages by default. Remove unnecessary lines.

I see only the main package built by default.

Same.

Do we even need PACMAN_EXTRAPACKAGES in the Makefile? IMO having it in the PKGBUILD would be enough. It can still be overriden from the commandline.

Quoted 26 lines
Quoted 18 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].

[1] https://lore.kernel.org/lkml/20240801192008.GA3923315@thelio-3990X/T/

 scripts/Makefile.package |  2 ++
 scripts/package/PKGBUILD | 11 +++++++----
 2 files changed, 9 insertions(+), 4 deletions(-)
scripts/Makefile.package +0 -0
index 4a80584ec771..ccdf8ba41f0b 100644

scripts/Makefile.package snap-pkg: · line 147

Quoted 4 lines
scripts/Makefile.package +1 -0
@@ -144,6 +144,8 @@ snap-pkg:
 # pacman-pkg
 # ---------------------------------------------------------------------------
 
+PACMAN_EXTRAPACKAGES ?= headers api-headers

Meaningless line.

Quoted 8 lines

Since 'export' is missing,
this default line is not propagated to PKGBUILD.

Nathan also mentioned 'export' would be needed if you wanted to describe this here.

https://lore.kernel.org/linux-kbuild/20240806025853.GB1570554@thelio-3990X/

Same as above.

Quoted 24 lines
Quoted 9 lines
scripts/Makefile.package +1 -0
+
 PHONY += pacman-pkg
 pacman-pkg:
        @ln -srf $(srctree)/scripts/package/PKGBUILD $(objtree)/PKGBUILD
scripts/package/PKGBUILD +0 -0
index 663ce300dd06..8de869f9b1d4 100644

scripts/package/PKGBUILD line 8

Quoted 10 lines
scripts/package/PKGBUILD +3 -4
@@ -3,10 +3,13 @@
 # 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")
-fi
+pkgname=("${pkgbase}")
+
+_extrapackages=${PACMAN_EXTRAPACKAGES:-}

Instead of adding inconsistent defaults in two places, I would write like this:

Quoted 1 line

_extrapackages=${PACMAN_EXTRAPACKAGES-headers api-headers}

Quoted 8 lines

Agreed.

Quoted 2 lines

Lastly, I will never accept new error messages
with CONFIG_MODULES=n.

Could you elaborate?
For me this works fine with CONFIG_MODULES=n.
(After having fixed the above issues so all subpackages are built)

$ make  allnoconfig pacman-pkg

Check the linux-headers log closely.

Signature · 2 lines
Best Regards
Masahiro Yamada
#4 lore raw
Quoted 3 lines · Masahiro Yamada
Quoted 2 lines · Thomas Weißschuh
Quoted 1 line · Masahiro Yamada

On Wed, Aug 7, 2024 at 11:28 AM Jose Fernandez <[email protected]> wrote:

<snip>

Quoted 10 lines
Quoted 6 lines
Quoted 2 lines

Lastly, I will never accept new error messages
with CONFIG_MODULES=n.

Could you elaborate?
For me this works fine with CONFIG_MODULES=n.
(After having fixed the above issues so all subpackages are built)

$ make  allnoconfig pacman-pkg

Check the linux-headers log closely.

I see now, previously I was not on kbuild/for-next and had an old Module.symvers sitting around, hiding the issue.

==> Starting package_linux-upstream-headers()... Installing build files...
tar: Module.symvers: Cannot stat: No such file or directory
tar: Exiting with failure status due to previous errors Installing System.map and config...
Adding symlink...
==> Tidying install...

(coming from scripts/package/install-extmod-build)

linux-upstream-headers also contains .config and System.map which are useful without modules.
So either we completely disable linux-upstream-headers or skip install-extmod-build when CONFIG_MODULES=n.
And maybe move System.map and .config to some other package, which would then deviate from the original PKGBUILD.

Neither option feels great, but it probably won't make a big difference. If you have a preference, let's go with that.

Thomas

#5 lore raw
Quoted 38 lines · Thomas Weißschuh
Quoted 3 lines · Masahiro Yamada
Quoted 2 lines · Thomas Weißschuh
Quoted 1 line · Masahiro Yamada

On Wed, Aug 7, 2024 at 11:28 AM Jose Fernandez <[email protected]> wrote:

<snip>

Quoted 10 lines
Quoted 6 lines
Quoted 2 lines

Lastly, I will never accept new error messages
with CONFIG_MODULES=n.

Could you elaborate?
For me this works fine with CONFIG_MODULES=n.
(After having fixed the above issues so all subpackages are built)

$ make  allnoconfig pacman-pkg

Check the linux-headers log closely.

I see now, previously I was not on kbuild/for-next and had an old Module.symvers sitting around, hiding the issue.

==> Starting package_linux-upstream-headers()... Installing build files...
tar: Module.symvers: Cannot stat: No such file or directory
tar: Exiting with failure status due to previous errors Installing System.map and config...
Adding symlink...
==> Tidying install...

(coming from scripts/package/install-extmod-build)

linux-upstream-headers also contains .config and System.map which are useful without modules.
So either we completely disable linux-upstream-headers or skip install-extmod-build when CONFIG_MODULES=n.
And maybe move System.map and .config to some other package, which would then deviate from the original PKGBUILD.

Quoted 2 lines

Neither option feels great, but it probably won't make a big difference. If you have a preference, let's go with that.

Thomas, Masahiro,
Thanks for the feedback. It seems that System.map and .config are commonly included in -header Arch packages. To avoid deviating too much and to address the issue with install-extmod-build when CONFIG_MODULES=n, how about considering something like this:

mkdir -p "${builddir}" # needed if install-extmod-build is not run if grep -q CONFIG_MODULES=y include/config/auto.conf; then

	echo "Installing build files..."
	"${srctree}/scripts/package/install-extmod-build" "${builddir}"	

fi

echo "Installing System.map and config..."
cp System.map "${builddir}/System.map"
cp .config "${builddir}/.config"

Thanks,
Jose

#6 lore raw
Quoted 40 lines · Jose Fernandez
Quoted 38 lines · Thomas Weißschuh
Quoted 3 lines · Masahiro Yamada
Quoted 2 lines · Thomas Weißschuh
Quoted 1 line · Masahiro Yamada

On Wed, Aug 7, 2024 at 11:28 AM Jose Fernandez <[email protected]> wrote:

<snip>

Quoted 10 lines
Quoted 6 lines
Quoted 2 lines

Lastly, I will never accept new error messages
with CONFIG_MODULES=n.

Could you elaborate?
For me this works fine with CONFIG_MODULES=n.
(After having fixed the above issues so all subpackages are built)

$ make  allnoconfig pacman-pkg

Check the linux-headers log closely.

I see now, previously I was not on kbuild/for-next and had an old Module.symvers sitting around, hiding the issue.

==> Starting package_linux-upstream-headers()... Installing build files...
tar: Module.symvers: Cannot stat: No such file or directory
tar: Exiting with failure status due to previous errors Installing System.map and config...
Adding symlink...
==> Tidying install...

(coming from scripts/package/install-extmod-build)

linux-upstream-headers also contains .config and System.map which are useful without modules.
So either we completely disable linux-upstream-headers or skip install-extmod-build when CONFIG_MODULES=n.
And maybe move System.map and .config to some other package, which would then deviate from the original PKGBUILD.

Quoted 8 lines
Quoted 2 lines

Neither option feels great, but it probably won't make a big difference. If you have a preference, let's go with that.

Thomas, Masahiro,
Thanks for the feedback. It seems that System.map and .config are commonly included in -header Arch packages. To avoid deviating too much and to address the issue with install-extmod-build when CONFIG_MODULES=n, how about considering something like this:

I am fine.

Quoted 2 lines

mkdir -p "${builddir}" # needed if install-extmod-build is not run

This comment might not be necessary if you move this code right before copying System.map.

Quoted 11 lines

if grep -q CONFIG_MODULES=y include/config/auto.conf; then
echo "Installing build files..." "${srctree}/scripts/package/install-extmod-build" "${builddir}"
fi

echo "Installing System.map and config..."
cp System.map "${builddir}/System.map"
cp .config "${builddir}/.config"

Thanks,
Jose

Signature · 2 lines
Best Regards
Masahiro Yamada
#8 lore raw
In reply to Jose Fernandez
Quoted 50 lines · Jose Fernandez
Quoted 38 lines · Thomas Weißschuh
Quoted 3 lines · Masahiro Yamada
Quoted 2 lines · Thomas Weißschuh
Quoted 1 line · Masahiro Yamada

On Wed, Aug 7, 2024 at 11:28 AM Jose Fernandez <[email protected]> wrote:

<snip>

Quoted 10 lines
Quoted 6 lines
Quoted 2 lines

Lastly, I will never accept new error messages
with CONFIG_MODULES=n.

Could you elaborate?
For me this works fine with CONFIG_MODULES=n.
(After having fixed the above issues so all subpackages are built)

$ make  allnoconfig pacman-pkg

Check the linux-headers log closely.

I see now, previously I was not on kbuild/for-next and had an old Module.symvers sitting around, hiding the issue.

==> Starting package_linux-upstream-headers()... Installing build files...
tar: Module.symvers: Cannot stat: No such file or directory
tar: Exiting with failure status due to previous errors Installing System.map and config...
Adding symlink...
==> Tidying install...

(coming from scripts/package/install-extmod-build)

linux-upstream-headers also contains .config and System.map which are useful without modules.
So either we completely disable linux-upstream-headers or skip install-extmod-build when CONFIG_MODULES=n.
And maybe move System.map and .config to some other package, which would then deviate from the original PKGBUILD.

Quoted 2 lines

Neither option feels great, but it probably won't make a big difference. If you have a preference, let's go with that.

Thomas, Masahiro,
Thanks for the feedback. It seems that System.map and .config are commonly included in -header Arch packages. To avoid deviating too much and to address the issue with install-extmod-build when CONFIG_MODULES=n, how about considering something like this:

mkdir -p "${builddir}" # needed if install-extmod-build is not run if grep -q CONFIG_MODULES=y include/config/auto.conf; then

Quoted 7 lines
	echo "Installing build files..."
	"${srctree}/scripts/package/install-extmod-build" "${builddir}"	

fi

echo "Installing System.map and config..."
cp System.map "${builddir}/System.map"
cp .config "${builddir}/.config"

Sounds good to me.

Thomas

#7 lore raw
In reply to Masahiro Yamada
Quoted 51 lines · Masahiro Yamada
Quoted 40 lines · Jose Fernandez
Quoted 38 lines · Thomas Weißschuh
Quoted 3 lines · Masahiro Yamada
Quoted 2 lines · Thomas Weißschuh
Quoted 1 line · Masahiro Yamada

On Wed, Aug 7, 2024 at 11:28 AM Jose Fernandez <[email protected]> wrote:

<snip>

Quoted 10 lines
Quoted 6 lines
Quoted 2 lines

Lastly, I will never accept new error messages
with CONFIG_MODULES=n.

Could you elaborate?
For me this works fine with CONFIG_MODULES=n.
(After having fixed the above issues so all subpackages are built)

$ make  allnoconfig pacman-pkg

Check the linux-headers log closely.

I see now, previously I was not on kbuild/for-next and had an old Module.symvers sitting around, hiding the issue.

==> Starting package_linux-upstream-headers()... Installing build files...
tar: Module.symvers: Cannot stat: No such file or directory
tar: Exiting with failure status due to previous errors Installing System.map and config...
Adding symlink...
==> Tidying install...

(coming from scripts/package/install-extmod-build)

linux-upstream-headers also contains .config and System.map which are useful without modules.
So either we completely disable linux-upstream-headers or skip install-extmod-build when CONFIG_MODULES=n.
And maybe move System.map and .config to some other package, which would then deviate from the original PKGBUILD.

Quoted 8 lines
Quoted 2 lines

Neither option feels great, but it probably won't make a big difference. If you have a preference, let's go with that.

Thomas, Masahiro,
Thanks for the feedback. It seems that System.map and .config are commonly included in -header Arch packages. To avoid deviating too much and to address the issue with install-extmod-build when CONFIG_MODULES=n, how about considering something like this:

Quoted 8 lines

I am fine.

Quoted 2 lines

mkdir -p "${builddir}" # needed if install-extmod-build is not run

This comment might not be necessary if you move this code right before copying System.map.

Ack. I will move the command to before copying System.map and drop the comment.

Quoted 18 lines
Quoted 12 lines

if grep -q CONFIG_MODULES=y include/config/auto.conf; then
echo "Installing build files..." "${srctree}/scripts/package/install-extmod-build" "${builddir}"
fi

echo "Installing System.map and config..."
cp System.map "${builddir}/System.map"
cp .config "${builddir}/.config"

Thanks,
Jose

Signature · 2 lines
Best Regards
Masahiro Yamada
#9 lore raw
In reply to Thomas Weißschuh

On 24/08/07 06:40PM, Thomas Weißschuh wrote:
<snip>

Quoted 24 lines
Quoted 24 lines
Quoted 9 lines
scripts/Makefile.package +1 -0
+
 PHONY += pacman-pkg
 pacman-pkg:
        @ln -srf $(srctree)/scripts/package/PKGBUILD $(objtree)/PKGBUILD
scripts/package/PKGBUILD +0 -0
index 663ce300dd06..8de869f9b1d4 100644

scripts/package/PKGBUILD line 8

Quoted 10 lines
scripts/package/PKGBUILD +3 -4
@@ -3,10 +3,13 @@
 # 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")
-fi
+pkgname=("${pkgbase}")
+
+_extrapackages=${PACMAN_EXTRAPACKAGES:-}

Instead of adding inconsistent defaults in two places, I would write like this:

Quoted 4 lines
Quoted 1 line

_extrapackages=${PACMAN_EXTRAPACKAGES-headers api-headers}

Agreed.

Closing the loop on this topic. I removed all changes made to Makefile.package and set the default in PKGBUILD as suggested:

_extrapackages=${PACMAN_EXTRAPACKAGES-headers api-headers}

Running the pacman-pkg target without setting PACMAN_EXTRAPACKAGES will build all packages:

make pacman-pkg
...
==> Creating package "linux-upstream"...
...
==> Creating package "linux-upstream-headers"...
...
==> Creating package "linux-upstream-api-headers"...

Setting PACMAN_EXTRAPACKAGES to an empty value will build only the kernel package:

make pacman-pkg PACMAN_EXTRAPACKAGES=""

objtree="/home/jose/Code/linux/linux" \
	BUILDDIR="/home/jose/Code/linux/linux/pacman" \
	CARCH="i386" \
	KBUILD_MAKEFLAGS="rR --no-print-directory -- PACMAN_EXTRAPACKAGES=" \
	KBUILD_REVISION="46" \
	makepkg 

...
==> Creating package "linux-upstream"...
-> Generating .PKGINFO file...
-> Generating .BUILDINFO file...
-> Generating .MTREE file...
-> Compressing package...
==> Leaving fakeroot environment.
==> Finished making: linux-upstream 6.11.0_rc2+-46 (Sun 11 Aug 2024 01:13:45 PM MDT)

Make exports command line arguments as env variables to sub-processes and this is how the PACMAN_EXTRAPACKAGES is passed to makepg without an explicit export with this change. V3 will include this change.