public inbox for linux-kbuild@vger.kernel.org
 help / color / mirror / Atom feed
From: Masahiro Yamada <masahiroy@kernel.org>
To: linux-kbuild@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, Ben Hutchings <ben@decadent.org.uk>,
	Masahiro Yamada <masahiroy@kernel.org>,
	Nathan Chancellor <nathan@kernel.org>,
	Nicolas Schier <nicolas@fjasle.eu>
Subject: [PATCH] kbuild: deb-pkg: require debian_revision when creating source package
Date: Wed, 12 Mar 2025 04:00:26 +0900	[thread overview]
Message-ID: <20250311190124.634007-1-masahiroy@kernel.org> (raw)

Debian Policy [1] specifies the version format as follows:

    [epoch:]upstream_version[-debian_revision]

Here, the presence of the debian_revision part indicates a non-native
package, while its absence indicates a native package.

Kbuild adopts the source format 3.0 (quilt), meaning the kernel is a
non-native package and therefore requires the revision portion.

This commit prevents the creation of an invalid source package when
KDEB_PKGVERSION contains no hyphen.

[1]: https://www.debian.org/doc/debian-policy/ch-controlfields.html#version

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
---

 scripts/package/mkdebian | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/scripts/package/mkdebian b/scripts/package/mkdebian
index b6dd98ca860b..193e33bcb989 100755
--- a/scripts/package/mkdebian
+++ b/scripts/package/mkdebian
@@ -94,6 +94,14 @@ set_debarch() {
 # Create debian/source/ if it is a source package build
 gen_source ()
 {
+	# The Debian Policy requires -debian_revision portion in the version.
+	# Since the source format 3.0 (quilt) is used here, a hyphen is
+	# required in the version.
+	if [ "${KDEB_PKGVERSION:+set}" ] && ! echo "${KDEB_PKGVERSION}" | grep -- '-..*'; then
+		echo "error: KDEB_PKGVERSION must include a hyphen to create a source package" >&2
+		exit 1
+	fi
+
 	mkdir -p debian/source
 
 	echo "3.0 (quilt)" > debian/source/format
-- 
2.43.0


             reply	other threads:[~2025-03-11 19:01 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-03-11 19:00 Masahiro Yamada [this message]
2025-03-21  5:22 ` [PATCH] kbuild: deb-pkg: require debian_revision when creating source package Nicolas Schier
2025-03-22 14:47   ` Masahiro Yamada

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250311190124.634007-1-masahiroy@kernel.org \
    --to=masahiroy@kernel.org \
    --cc=ben@decadent.org.uk \
    --cc=linux-kbuild@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=nathan@kernel.org \
    --cc=nicolas@fjasle.eu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox