Skip to contentSkip to conversation

builddeb: Try to determine distribution

RFC Superseded Sedat Dilek 1 participant 1 message Jan 2, 2015 Kbuild

v2 of 7 Superseded Latest is v7 →

lore
Share & tools
lore
#0 lore raw

RFC v2 1/1 builddeb: Try to determine distribution

This is based on ideas of me and Ben.
Thanks goes to Thorsten and Alexander for the vital help in 2012. Also Thanks to maximilian for the review of my diverse patches.

Like in my initial patch [1] lsb_release is used to determine the short codename as distribution name for debian/changelog.

Ben gave some helpful and detailed information in [2]. There he also suggested to have an option to explicitly set the distribution (see $KDEB_CHANGELOG_DIST variable).

I have hardcoded the script-name when the default distribution is used. This is a bit ugly.

This patch is based on the snippet of Ben in [2] and tested against Linux v3.19-rc2.

[1] https://lkml.org/lkml/2012/4/23/516
[2] http://marc.info/?l=linux-kbuild&m=142022188322321&w=2

CC Ben Hutchings <[email protected]>
CC maximilian attems <[email protected]>
CC Thorsten Glaser <[email protected]>
CC Alexander Wirt <[email protected]>
CC Michal Marek <[email protected]>

---
v2: Suppress error messages when lsb_release is not installed.
(Thanks maximilian and Ben.)

 scripts/package/builddeb | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)
scripts/package/builddeb +13 -1
index 5972624..6918429 100755
@@ -217,9 +217,21 @@ else
 fi
 maintainer="$name <$email>"
 
+# Try to determine distribution
+codename=$(lsb_release --codename --short 2> /dev/null)
+if [ -n "$KDEB_CHANGELOG_DIST" ]; then
+        distribution=$KDEB_CHANGELOG_DIST
+elif [ -n "$codename" ]; then
+        distribution=$codename
+else
+        distribution="unstable"
+        echo "builddeb: Using default distribution of 'unstable' in the changelog"
+        echo "builddeb: Install lsb-release or set \$KDEB_CHANGELOG_DIST to change this"
+fi
+
 # Generate a simple changelog template
 cat <<EOF > debian/changelog
-linux-upstream ($packageversion) unstable; urgency=low
+linux-upstream ($packageversion) $distribution; urgency=low
 
   * Custom built Linux kernel.
 
Signature · 1 line
2.2.1