public inbox for linux-kbuild@vger.kernel.org
 help / color / mirror / Atom feed
* [RFC] builddeb: Try to determine distribution
@ 2015-01-02 20:14 Sedat Dilek
  2015-01-02 20:21 ` maximilian attems
  2015-01-02 20:24 ` Ben Hutchings
  0 siblings, 2 replies; 4+ messages in thread
From: Sedat Dilek @ 2015-01-02 20:14 UTC (permalink / raw)
  Cc: Sedat Dilek, Ben Hutchings, maximilian attems, Thorsten Glaser,
	Alexander Wirt, Michal Marek, linux-kbuild

This is based on ideas of me and Ben.
Thanks goes to Thorsten and Alexander for the vital help in 2012.

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 <ben@decadent.org.uk>
CC: maximilian attems <max@stro.at>
CC: Thorsten Glaser <tg@debian.org>
CC: Alexander Wirt <formorer@debian.org>
CC: Michal Marek <mmarek@suse.cz>
CC: linux-kbuild@vger.kernel.org
Suggested-by: Ben Hutchings <ben@decadent.org.uk>
Signed-off-by: Sedat Dilek <sedat.dilek@gmail.com>
---
 scripts/package/builddeb | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)

diff --git a/scripts/package/builddeb b/scripts/package/builddeb
index 5972624..be1f4d7 100755
--- a/scripts/package/builddeb
+++ b/scripts/package/builddeb
@@ -217,9 +217,21 @@ else
 fi
 maintainer="$name <$email>"
 
+# Try to determine distribution
+codename=$(lsb_release --codename --short)
+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.
 
-- 
2.2.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [RFC] builddeb: Try to determine distribution
  2015-01-02 20:14 [RFC] builddeb: Try to determine distribution Sedat Dilek
@ 2015-01-02 20:21 ` maximilian attems
  2015-01-02 20:29   ` Sedat Dilek
  2015-01-02 20:24 ` Ben Hutchings
  1 sibling, 1 reply; 4+ messages in thread
From: maximilian attems @ 2015-01-02 20:21 UTC (permalink / raw)
  To: Sedat Dilek
  Cc: Ben Hutchings, Thorsten Glaser, Alexander Wirt, Michal Marek,
	linux-kbuild



On Fri, Jan 02, 2015 at 09:14:29PM +0100, Sedat Dilek wrote:
> This is based on ideas of me and Ben.
> Thanks goes to Thorsten and Alexander for the vital help in 2012.
> 
> Like in my initial patch [1] lsb_release is used to determine
> the short codename as distribution name for debian/changelog.

In contrast to the code snippet from Ben, you assume lsb_release
to be installed, which is a wrong assumption.
 
> 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
> 

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [RFC] builddeb: Try to determine distribution
  2015-01-02 20:14 [RFC] builddeb: Try to determine distribution Sedat Dilek
  2015-01-02 20:21 ` maximilian attems
@ 2015-01-02 20:24 ` Ben Hutchings
  1 sibling, 0 replies; 4+ messages in thread
From: Ben Hutchings @ 2015-01-02 20:24 UTC (permalink / raw)
  To: Sedat Dilek
  Cc: maximilian attems, Thorsten Glaser, Alexander Wirt, Michal Marek,
	linux-kbuild

[-- Attachment #1: Type: text/plain, Size: 580 bytes --]

On Fri, 2015-01-02 at 21:14 +0100, Sedat Dilek wrote:
[...]
> --- a/scripts/package/builddeb
> +++ b/scripts/package/builddeb
> @@ -217,9 +217,21 @@ else
>  fi
>  maintainer="$name <$email>"
>  
> +# Try to determine distribution
> +codename=$(lsb_release --codename --short)
[...]

This needs a '2> /dev/null' to suppress error messages when lsb_release
is missing (or doesn't support the options).

Ben.

-- 
Ben Hutchings
Theory and practice are closer in theory than in practice.
                                - John Levine, moderator of comp.compilers

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 811 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [RFC] builddeb: Try to determine distribution
  2015-01-02 20:21 ` maximilian attems
@ 2015-01-02 20:29   ` Sedat Dilek
  0 siblings, 0 replies; 4+ messages in thread
From: Sedat Dilek @ 2015-01-02 20:29 UTC (permalink / raw)
  To: maximilian attems
  Cc: Ben Hutchings, Thorsten Glaser, Alexander Wirt, Michal Marek,
	linux-kbuild

On Fri, Jan 2, 2015 at 9:21 PM, maximilian attems <max@stro.at> wrote:
>
>
> On Fri, Jan 02, 2015 at 09:14:29PM +0100, Sedat Dilek wrote:
>> This is based on ideas of me and Ben.
>> Thanks goes to Thorsten and Alexander for the vital help in 2012.
>>
>> Like in my initial patch [1] lsb_release is used to determine
>> the short codename as distribution name for debian/changelog.
>
> In contrast to the code snippet from Ben, you assume lsb_release
> to be installed, which is a wrong assumption.
>

So I should change that line?

+codename=$(lsb_release --codename --short)
-codename=$(lsb_release --codename --short 2>/dev/null)

- Sedat -

>> 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
>>

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2015-01-02 20:30 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-01-02 20:14 [RFC] builddeb: Try to determine distribution Sedat Dilek
2015-01-02 20:21 ` maximilian attems
2015-01-02 20:29   ` Sedat Dilek
2015-01-02 20:24 ` Ben Hutchings

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox