mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Steven Rostedt <rostedt@goodmis.org>
To: David Weinehall <tao@acc.umu.se>
Cc: linux-kernel@vger.kernel.org, Matt Mackall <mpm@selenic.com>
Subject: Re: [ketchup] patch to allow for moving of .gitignore in 2.6.14
Date: Sat, 29 Oct 2005 23:48:07 -0400 (EDT)	[thread overview]
Message-ID: <Pine.LNX.4.58.0510292343280.10073@localhost.localdomain> (raw)
In-Reply-To: <20051030011959.GA17750@vasa.acc.umu.se>


On Sun, 30 Oct 2005, David Weinehall wrote:
>
> Uhm, this patch assumes that you're using bash as /bin/sh.
> Not everyone does.  (I haven't checked the rest of the system calls
> in ketchup though, maybe this is a more generic problem?)

OK, if I work any more on ketchup, I'm going to convert the whole damn
thing into perl! ;-} (and call it "mustard").

Is this patch better? It even tests the version of tar and if it is less
than 1.15 it uses --strip-path (the old name) and if it is 1.15 or greater
it uses --strip-components (the new name).  And if it fails the version
test all together, it goes back to the old (broken) method of just moving
the contents.

Is this robust enough for you?

-- Steve

Index: Ketchup-d9503020b3c1/ketchup
===================================================================
--- Ketchup-d9503020b3c1.orig/ketchup	2005-10-29 17:02:26.000000000 -0400
+++ Ketchup-d9503020b3c1/ketchup	2005-10-29 23:41:32.000000000 -0400
@@ -477,16 +477,37 @@
     qprint("Unpacking %s" % os.path.basename(file))
     if options["dry-run"]: return ver

-    err = os.system("tar xjf %s" % file)
-    if err:
+    f = os.popen('tar --version', 'r')
+    if not f:
         error("Unpacking failed: ", err)
         sys.exit(-1)

-    err = os.system("mv linux*/* . ; rmdir linux*")
+    strip = ""
+    line = f.readline()
+    while line:
+        m = re.match(r'.*?(\d+)\.(\d+)', line)
+        if m:
+            v1 = int(m.group(1))
+            v2 = int(m.group(2))
+            if v1 > 1 or (v1 == 1 and v2 >= 15):
+                strip = "--strip-components 1 "
+            else:
+                strip = "--strip-path 1 "
+	    break
+        line = f.readline()
+    f.close()
+
+    err = os.system("tar %s-xjf %s" % (strip, file))
     if err:
         error("Unpacking failed: ", err)
         sys.exit(-1)

+    if not len(strip):
+        err = os.system("mv linux*/* . ; rmdir linux*")
+        if err:
+            error("Unpacking failed: ", err)
+            sys.exit(-1)
+
     return ver

 def find_ver(ver):

  parent reply	other threads:[~2005-10-30  3:48 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-10-17  7:38 ketchup+rt with ktimers added Steven Rostedt
2005-10-17 21:39 ` Matt Mackall
2005-10-18  6:20   ` Steven Rostedt
2005-10-18  6:30     ` Matt Mackall
2005-10-18  6:45       ` Steven Rostedt
2005-10-18  7:29         ` Matt Mackall
2005-10-28 12:54           ` [ketchup] patch to allow for moving of .gitignore in 2.6.14 Steven Rostedt
2005-10-28 13:35             ` [ketchup] patch to alt urls for local trees Steven Rostedt
2005-10-28 17:00               ` Matt Mackall
2005-10-28 20:46                 ` Steven Rostedt
2005-10-30 19:53                   ` Matt Mackall
2005-10-28 14:49             ` [ketchup] patch to allow for moving of .gitignore in 2.6.14 Steven Rostedt
2005-10-29 21:06             ` Steven Rostedt
2005-10-29 21:06               ` Matt Mackall
2005-10-29 23:56                 ` Steven Rostedt
2005-10-30  1:19               ` David Weinehall
2005-10-30  2:10                 ` Steven Rostedt
2005-10-30  3:48                 ` Steven Rostedt [this message]
2005-10-30  6:56                   ` Patrick McFarland
2005-10-30 17:59                   ` Matt Mackall

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Pine.LNX.4.58.0510292343280.10073@localhost.localdomain \
    --to=rostedt@goodmis.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mpm@selenic.com \
    --cc=tao@acc.umu.se \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®