From patchwork Fri Jan 2 21:16:45 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sedat Dilek X-Patchwork-Id: 5560971 Return-Path: X-Original-To: patchwork-linux-kbuild@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 3F4D39F37F for ; Fri, 2 Jan 2015 21:17:03 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 4869920220 for ; Fri, 2 Jan 2015 21:17:02 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 2C944201F2 for ; Fri, 2 Jan 2015 21:17:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752197AbbABVRA (ORCPT ); Fri, 2 Jan 2015 16:17:00 -0500 Received: from mail-wi0-f174.google.com ([209.85.212.174]:54692 "EHLO mail-wi0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752111AbbABVRA (ORCPT ); Fri, 2 Jan 2015 16:17:00 -0500 Received: by mail-wi0-f174.google.com with SMTP id h11so162459wiw.13 for ; Fri, 02 Jan 2015 13:16:59 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id; bh=FkCmPsCj6bItjk3sv5qpRgytDsMrExW09i06F3FWq9Q=; b=v16Z7uuTEJs4JOix4/QyUD+L38YnNEymPpRT/nImjVNZSKnn9xSUSu6UHSeIAYwRpZ HEJq6oHtPQiwHlRED4P/w7T+pJfJV8EftKJmSsPmetFD0OeEKEeds4oywZQo/K1zi37S VDebTqv4KOJ4HDxwGEYVX9SFdViE7uZo6eSFRjVzsuwLEgy8J87d2zKB2qixsc/70JZ0 P63x1oiOxXiTjsXXLJ5c0C0EisukVuIs6EJRZmxBdnK4GP4y/wBGdT2BfZQ3HqgaGlNo 3TNbp1tPo3htorGItByMRRD2PjVLvz4KhVPkP51rObx13UFvL/2377VHUDACA3PRTiHl hEKA== X-Received: by 10.180.85.33 with SMTP id e1mr1099576wiz.61.1420233419072; Fri, 02 Jan 2015 13:16:59 -0800 (PST) Received: from fambox.fambox-domain ([46.115.21.76]) by mx.google.com with ESMTPSA id e18sm65889652wjz.27.2015.01.02.13.16.55 (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 02 Jan 2015 13:16:58 -0800 (PST) From: Sedat Dilek Cc: Sedat Dilek , Ben Hutchings , maximilian attems , Thorsten Glaser , Alexander Wirt , Michal Marek , linux-kbuild@vger.kernel.org Subject: [RFC v3] builddeb: Try to determine distribution Date: Fri, 2 Jan 2015 22:16:45 +0100 Message-Id: <1420233405-23121-1-git-send-email-sedat.dilek@gmail.com> X-Mailer: git-send-email 2.2.1 To: unlisted-recipients:; (no To-header on input) Sender: linux-kbuild-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kbuild@vger.kernel.org X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, T_DKIM_INVALID, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Like in my initial patch [1] lsb_release is a good choice to determine the distribution name for debian/changelog. Its installation is no precondition. Ben gave some helpful and detailed information in [2]. There he also suggested to have an option to explicitly set the distribution name (see $KDEB_CHANGELOG_DIST variable). I have hardcoded the script-name into the outputs when we fallback to the default distribution name. This is a bit ugly. Based on the snippet of Ben (see [2]). Tested against Linux v3.19-rc2. Thanks goes to Thorsten and Alexander for the vital help in 2012. Equally thanks to maximilian and Ben for the comments on my patches. [1] https://lkml.org/lkml/2012/4/23/516 [2] http://marc.info/?l=linux-kbuild&m=142022188322321&w=2 CC: Ben Hutchings CC: maximilian attems CC: Thorsten Glaser CC: Alexander Wirt CC: Michal Marek CC: linux-kbuild@vger.kernel.org Suggested-by: Ben Hutchings Signed-off-by: Sedat Dilek --- v3: Massaged the commit-message 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(-) diff --git a/scripts/package/builddeb b/scripts/package/builddeb index 5972624..6918429 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 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 < debian/changelog -linux-upstream ($packageversion) unstable; urgency=low +linux-upstream ($packageversion) $distribution; urgency=low * Custom built Linux kernel.