Skip to contentSkip to conversation

kbuild, deb-pkg: Try to determine distribution

PATCH In review Sedat Dilek 5 participants 8 messages Apr 23, 2012 – Feb 28, 2013 Kbuild

lore
Share & tools
lore
#0 lore raw

PATCH 1/3 kbuild, deb-pkg: Try to determine distribution

---
 scripts/package/builddeb |   15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)
scripts/package/builddeb +14 -1
index eee5f8e..f5b56ac 100644
@@ -172,9 +172,22 @@ else
 fi
 maintainer="$name <$email>"
 
+# Try to determine distribution
+if [ -e $(which lsb_release) ]; then
+       codename=$(lsb_release --codename --short)
+       if [ "$codename" != "" ]; then
+		distribution=$codename
+       else
+		distribution="UNRELEASED"
+		echo "WARNING: The distribution could NOT be determined!"
+       fi
+else
+       echo "HINT: Install lsb_release binary, this helps to identify your distribution!"
+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
1.7.9.5
#1 lore raw

PATCH 2/3 kbuild, deb-pkg: Bump year in debian/copyright file

---
 scripts/package/builddeb |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
scripts/package/builddeb +1 -1
index f5b56ac..62c512b 100644
@@ -201,7 +201,7 @@ This is a packacked upstream version of the Linux kernel.
 The sources may be found at most Linux ftp sites, including:
 ftp://ftp.kernel.org/pub/linux/kernel
 
-Copyright: 1991 - 2009 Linus Torvalds and others.
+Copyright: 1991 - 2012 Linus Torvalds and others.
 
 The git repository for mainline kernel development is at:
 git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6.git
Signature · 1 line
1.7.9.5
#2 lore raw

PATCH 3/3 kbuild, deb-pkg: Update git repository URL in debian/copyright file

In reply to Sedat Dilek
---
 scripts/package/builddeb |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
scripts/package/builddeb +1 -1
index 62c512b..aec6aee 100644
@@ -204,7 +204,7 @@ ftp://ftp.kernel.org/pub/linux/kernel
 Copyright: 1991 - 2012 Linus Torvalds and others.
 
 The git repository for mainline kernel development is at:
-git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6.git
+git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
 
     This program is free software; you can redistribute it and/or modify
     it under the terms of the GNU General Public License as published by
Signature · 1 line
1.7.9.5
#3 lore raw
In reply to Sedat Dilek

Sorry I missed this series. Max, can you have a look? I don't know the policies for debian package changelogs. The full series is at
http://lkml.indiana.edu/hypermail/linux/kernel/1204.2/index.html#04252,
but the remaining two patches are obvious.

Michal

Quoted 34 lines · Sedat Dilek
---
 scripts/package/builddeb |   15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)
scripts/package/builddeb +14 -1
index eee5f8e..f5b56ac 100644
@@ -172,9 +172,22 @@ else
 fi
 maintainer="$name <$email>"
 
+# Try to determine distribution
+if [ -e $(which lsb_release) ]; then
+       codename=$(lsb_release --codename --short)
+       if [ "$codename" != "" ]; then
+		distribution=$codename
+       else
+		distribution="UNRELEASED"
+		echo "WARNING: The distribution could NOT be determined!"
+       fi
+else
+       echo "HINT: Install lsb_release binary, this helps to identify your distribution!"
+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.
 
#4 lore raw
Quoted 5 lines · Michal Marek

Sorry I missed this series. Max, can you have a look? I don't know the policies for debian package changelogs. The full series is at
http://lkml.indiana.edu/hypermail/linux/kernel/1204.2/index.html#04252,
but the remaining two patches are obvious.

[ CC mirabilos and formorer ]

[PATCH 1/3] kbuild, deb-pkg: Try to determine distribution

...was discussed in (hehe, so long ago) April 2012 on #grml IRC (a Linux live-system based on Debian) with Thorsten Glaser and Alexander Wirt.
Both cool guys (longterm Debian maintainers and admins) gave me several good hints to make this a "proper" solution. Maybe, they won't remember :-).

I switched from Debian/unstable to Ubuntu/precise these days and that was the reason I wanted the correct $distribution in my generated Debian kernel packages.

Might be I come back when Debian/wheezy is released... you never know :-). Or I get an Amiga-3000 with Debian/m68k running... with DirOpus and DPaint-IV, hahaha.

I was simply too lazy to place a rock-solid changelog.

- Sedat -

Quoted 39 lines

Michal

Quoted 34 lines · Sedat Dilek
---
 scripts/package/builddeb |   15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)
scripts/package/builddeb +14 -1
index eee5f8e..f5b56ac 100644
@@ -172,9 +172,22 @@ else
 fi
 maintainer="$name <$email>"
 
+# Try to determine distribution
+if [ -e $(which lsb_release) ]; then
+       codename=$(lsb_release --codename --short)
+       if [ "$codename" != "" ]; then
+             distribution=$codename
+       else
+             distribution="UNRELEASED"
+             echo "WARNING: The distribution could NOT be determined!"
+       fi
+else
+       echo "HINT: Install lsb_release binary, this helps to identify your distribution!"
+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.
 
#6 lore raw
In reply to Michal Marek
Quoted 4 lines · Michal Marek

Sorry I missed this series. Max, can you have a look? I don't know the policies for debian package changelogs. The full series is at
http://lkml.indiana.edu/hypermail/linux/kernel/1204.2/index.html#04252,
but the remaining two patches are obvious.

the two remaining ones are trivial, should have pushed them a long time ago and will do so this weekend in a combined version going up to 2013 (sitting in my queue to send).

Quoted 32 lines · Sedat Dilek
Quoted 31 lines
---
 scripts/package/builddeb |   15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)
scripts/package/builddeb +14 -1
index eee5f8e..f5b56ac 100644
@@ -172,9 +172,22 @@ else
 fi
 maintainer="$name <$email>"
 
+# Try to determine distribution
+if [ -e $(which lsb_release) ]; then
+       codename=$(lsb_release --codename --short)
+       if [ "$codename" != "" ]; then
+		distribution=$codename
+       else
+		distribution="UNRELEASED"
+		echo "WARNING: The distribution could NOT be determined!"
+       fi
+else
+       echo "HINT: Install lsb_release binary, this helps to identify your distribution!"
+fi
+
 # Generate a simple changelog template
 cat <<EOF > debian/changelog
-linux-upstream ($packageversion) unstable; urgency=low
+linux-upstream ($packageversion) $distribution; urgency=low
 
Quoted 1 line

scripts/package/builddeb else · line 192

Quoted 1 line
scripts/package/builddeb +0 -0
   * Custom built Linux kernel.

this is pretty useless.
Nack, in adding a this additional lsb dep.
I know it should be installed by default, but in practise it is often not.

If you'd really care about the changelog you'd generate it out of your git repo with Debian's git dch in order to have something meaningful.

Signature · 1 line
maks
#7 lore raw
Quoted 42 lines · maximilian attems
Quoted 4 lines · Michal Marek

Sorry I missed this series. Max, can you have a look? I don't know the policies for debian package changelogs. The full series is at
http://lkml.indiana.edu/hypermail/linux/kernel/1204.2/index.html#04252,
but the remaining two patches are obvious.

the two remaining ones are trivial, should have pushed them a long time ago and will do so this weekend in a combined version going up to 2013 (sitting in my queue to send).

Quoted 32 lines · Sedat Dilek
Quoted 31 lines
---
 scripts/package/builddeb |   15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)
scripts/package/builddeb +14 -1
index eee5f8e..f5b56ac 100644
@@ -172,9 +172,22 @@ else
 fi
 maintainer="$name <$email>"
 
+# Try to determine distribution
+if [ -e $(which lsb_release) ]; then
+       codename=$(lsb_release --codename --short)
+       if [ "$codename" != "" ]; then
+           distribution=$codename
+       else
+           distribution="UNRELEASED"
+           echo "WARNING: The distribution could NOT be determined!"
+       fi
+else
+       echo "HINT: Install lsb_release binary, this helps to identify your distribution!"
+fi
+
 # Generate a simple changelog template
 cat <<EOF > debian/changelog
-linux-upstream ($packageversion) unstable; urgency=low
+linux-upstream ($packageversion) $distribution; urgency=low
 
Quoted 9 lines
Quoted 1 line

scripts/package/builddeb else · line 192

Quoted 1 line
scripts/package/builddeb +0 -0
   * Custom built Linux kernel.

this is pretty useless.
Nack, in adding a this additional lsb dep.
I know it should be installed by default, but in practise it is often not.

If you'd really care about the changelog you'd generate it out of your git repo with Debian's git dch in order to have something meaningful.

[ CCing Thorsten and Alexander ]

Thank you for your response.

This was a compromise for Debian and Ubuntu systems and as said discussed with two longterm Debian maintainers.
Thorsten Glaser uses same mechanisms in his Debian build-environments (he prefers -cs as parameters than long-format).
FYI: Ubuntu/precise ships lsb(-release) stuff by default! Can't say if it is a "essential" package on Debian these days or not (in my patch there is a warning if it's not available).

Personally, I think lsb-release binary is a good compromise in a non-Debian-world, too.
I don't know of a real distro not shipping it - not thinking of distros like LFS (Linux From Scratch) in first place (and did not verify even if LSB stuff is done or not, I might be wrong).

What's your proposal to check for $codename/$distribution (just curious)?

Last question:
Should people CC you always on patches for deb-pkg?
For me it looks like you are "maintaining" it, so why not place you as a maintainer in MAINTAINERS file?
( Didn't check what checkpatch.pl throws out. )
So, you do the work - get the credits :-)!

- Sedat -

P.S.: Ubuntu/precise beta1 ships lsb-release.

# grep lsb packages_01_precise-beta1.txt
ii  lsb-base                               4.0-0ubuntu20
                 Linux Standard Base 4.0 init script functionality
ii  lsb-release                            4.0-0ubuntu20
                 Linux Standard Base version reporting utility
Quoted 3 lines

--
maks