From patchwork Sun Oct 14 11:14:21 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Petazzoni X-Patchwork-Id: 191341 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from silver.osuosl.org (silver.osuosl.org [140.211.166.136]) by ozlabs.org (Postfix) with ESMTP id ABDA32C0082 for ; Sun, 14 Oct 2012 22:14:38 +1100 (EST) Received: from localhost (localhost [127.0.0.1]) by silver.osuosl.org (Postfix) with ESMTP id 5770429203; Sun, 14 Oct 2012 11:14:36 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from silver.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id RrEIxuzoAtPh; Sun, 14 Oct 2012 11:14:35 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by silver.osuosl.org (Postfix) with ESMTP id CF39025A54; Sun, 14 Oct 2012 11:14:34 +0000 (UTC) X-Original-To: buildroot@lists.busybox.net Delivered-To: buildroot@osuosl.org Received: from hemlock.osuosl.org (hemlock.osuosl.org [140.211.166.133]) by ash.osuosl.org (Postfix) with ESMTP id BC9058F74B for ; Sun, 14 Oct 2012 11:14:36 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by hemlock.osuosl.org (Postfix) with ESMTP id 1C766A0132 for ; Sun, 14 Oct 2012 11:14:34 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from hemlock.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id imdxC-6TYauC for ; Sun, 14 Oct 2012 11:14:32 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail.free-electrons.com (mail.free-electrons.com [88.190.12.23]) by hemlock.osuosl.org (Postfix) with ESMTP id 606A8A010B for ; Sun, 14 Oct 2012 11:14:32 +0000 (UTC) Received: by mail.free-electrons.com (Postfix, from userid 106) id CE95717B; Sun, 14 Oct 2012 13:14:12 +0200 (CEST) Received: from localhost (humanoidz.org [82.247.183.72]) by mail.free-electrons.com (Postfix) with ESMTPSA id 0CD75147; Sun, 14 Oct 2012 13:14:05 +0200 (CEST) From: Thomas Petazzoni To: "Yann E. MORIN" Date: Sun, 14 Oct 2012 13:14:21 +0200 Message-Id: <1350213261-4929-1-git-send-email-thomas.petazzoni@free-electrons.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1347234052-10527-3-git-send-email-yann.morin.1998@free.fr> References: <1347234052-10527-3-git-send-email-yann.morin.1998@free.fr> Cc: buildroot@uclibc.org Subject: [Buildroot] [PATCH] pkg-avail: make it work without stgit X-BeenThere: buildroot@busybox.net X-Mailman-Version: 2.1.14 Precedence: list List-Id: Discussion and development of buildroot List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: buildroot-bounces@busybox.net Sender: buildroot-bounces@busybox.net In order to make this script usable by more developers, make it work without stgit. It supports a --mode=stgit option or a --mode=git option. When using --mode=stgit, it will preserve its existing behavior, when using --mode=git, it will simply make git commits without fuzzing needlessly with stgit. I still don't understand why people keep using stgit. I guess it's a remnant of quilt-style workflow or something like that, because the plain git, with its "git rebase -i" feature, allows to do exactly the same thing, without having to use a separate tool. So people using stgit should /really/ consider having a serious look at "git rebase -i", and when they will see the light, they will wonder why for so many years they have suffered in keeping their old-style quilt-looking workflows. Note: the --mode=stgit hasn't been tested after the changes. Signed-off-by: Thomas Petazzoni --- support/scripts/pkg-avail | 44 +++++++++++++++++++++++++++++++------------- 1 file changed, 31 insertions(+), 13 deletions(-) diff --git a/support/scripts/pkg-avail b/support/scripts/pkg-avail index 1f616fd..4d47a44 100755 --- a/support/scripts/pkg-avail +++ b/support/scripts/pkg-avail @@ -192,9 +192,23 @@ munge_files() { ) } +if [ $# -ne 1 ] ; then + echo "Usage: pkg-avail --mode=[stgit|git]" + exit 1 +fi + +if [ $1 = "--mode=stgit" ] ; then + mode=stgit +elif [ $1 = "--mode=git" ] ; then + mode=git +else + echo "Unknown argument" + exit 1 +fi + # I have a local patch that updates the doc for the _AVAILABLE stuff, # and I want all munging patches to be pushed after that -stg push -a >/dev/null 2>&1 || true +[ $mode = "stgit" ] && stg push -a >/dev/null 2>&1 || true # Add the _AVAILABLE symbols... cat >/tmp/commit.msg <<-_EOF_ @@ -239,10 +253,11 @@ cat >/tmp/commit.msg <<-_EOF_ With the construct above, using 'select' is now safe. _EOF_ -stg new --sign -f /tmp/commit.msg pkg-add-available -rm /tmp/commit.msg +[ $mode = "stgit" ] && stg new --sign -f /tmp/commit.msg pkg-add-available munge_files "${AWK_SCRIPT_ADD}" -stg refresh +[ $mode = "stgit" ] && stg refresh +[ $mode = "git" ] && git commit -a -s -F /tmp/commit.msg +rm /tmp/commit.msg # ... and use them, now! ;-) cat >/tmp/commit.msg <<-_EOF_ @@ -252,10 +267,11 @@ cat >/tmp/commit.msg <<-_EOF_ the corresponding _AVAILABLE symbol, and adds a 'select' against the dependant package. _EOF_ -stg new --sign -f /tmp/commit.msg pkg-use-available -rm /tmp/commit.msg +[ $mode = "stgit" ] && stg new --sign -f /tmp/commit.msg pkg-use-available munge_files "${AWK_SCRIPT_USE}" -stg refresh +[ $mode = "stgit" ] && stg refresh +[ $mode = "git" ] && git commit -a -s -F /tmp/commit.msg +rm /tmp/commit.msg # Finally, check for missing 'depends on ..._AVAILABLE' cat >/tmp/commit.msg <<-_EOF_ @@ -264,10 +280,11 @@ cat >/tmp/commit.msg <<-_EOF_ This patch checks that all 'select' on a package have a 'depends on' on the corresponding _AVAILABLE symbol. _EOF_ -stg new --sign -f /tmp/commit.msg pkg-check-available -rm /tmp/commit.msg +[ $mode = "stgit" ] && stg new --sign -f /tmp/commit.msg pkg-check-available munge_files "${AWK_SCRIPT_CHECK}" -stg refresh +[ $mode = "stgit" ] && stg refresh +[ $mode = "git" ] && git commit -a -s -F /tmp/commit.msg +rm /tmp/commit.msg # And eventually, get rid of ourselves (Seppuku!) cat >/tmp/commit.msg <<-_EOF_ @@ -276,11 +293,12 @@ cat >/tmp/commit.msg <<-_EOF_ This script has done its job, and is no-longer needed. RIP, script! _EOF_ -stg new --sign -f /tmp/commit.msg pkg-delete-pkg_avail -rm /tmp/commit.msg +[ $mode = "stgit" ] && stg new --sign -f /tmp/commit.msg pkg-delete-pkg_avail rm -f support/scripts/pkg-avail git rm support/scripts/pkg-avail -stg refresh +[ $mode = "stgit" ] && stg refresh +[ $mode = "git" ] && git commit -a -s -F /tmp/commit.msg +rm /tmp/commit.msg # And eventually, get rid of ourselves (Seppuku!)