Control: tag -1 +pending +patch

Here is the proposed patch to fix this, which I have tested and seems to
be working. I feel that we need extensive unittest for this package, I
will see if I can right the same.


Cheers,
From 2098c6baf484174bddb3545d404e70ecebedb28b Mon Sep 17 00:00:00 2001
From: Vasudev Kamath <[email protected]>
Date: Sat, 21 Jun 2014 17:11:39 +0530
Subject: Only archive tarball's basename for regexp match

Regular expression to detect rpm/orig tarball/upstream tarball doesn't
match if user specifies entire path to tarball to -a/--archive option
and gives error saying Non-supported format. To fix this all regexp
match are now called on os.path.basname(para['tarball']).

This has been tested and works as expected.

Closes: bug#752206

Signed-off-by: Vasudev Kamath <[email protected]>
---
 debmake/sanity.py | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/debmake/sanity.py b/debmake/sanity.py
index fdfdcab..9dc20de 100755
--- a/debmake/sanity.py
+++ b/debmake/sanity.py
@@ -57,8 +57,10 @@ def sanity(para):
                 print('E: wget/curl failed.', file=sys.stderr)
                 exit(1)
         parent = ''
+
         # tarball: ibus-1.5.5-2.fc19.src.rpm
-        resrcrpm = re.match(r'([^/_]+-[^/_-]+)-[0-9]+\.[^.]+\.src\.rpm$', para['tarball'])
+        resrcrpm = re.match(r'([^/_]+-[^/_-]+)-[0-9]+\.[^.]+\.src\.rpm$',
+                            os.path.basename('tarball'))
         if resrcrpm:
             command = 'rpm2cpio ' + para['tarball'] + '|cpio -dium'
             print('I: $ {}'.format(command), file=sys.stderr)
@@ -77,9 +79,12 @@ def sanity(para):
             print('E: Non-existing tarball name {}'.format(para['tarball']), file=sys.stderr)
             exit(1)
         # tarball: package_version.orig.tar.gz
-        reorigtar = re.match(r'([^/_]+)_([^-/_]+)\.orig\.(tar\.gz|tar\.bz2|tar\.xz)$', para['tarball'])
+        reorigtar = re.match(
+            r'([^/_]+)_([^-/_]+)\.orig\.(tar\.gz|tar\.bz2|tar\.xz)$',
+            os.path.basename(para['tarball']))
         # tarball: package-version.tar.gz or package_version.tar.gz
-        rebasetar = re.match(r'([^/_]+)[-_]([^-/_]+)\.(tar\.gz|tar\.bz2|tar\.xz)$', para['tarball'])
+        rebasetar = re.match(r'([^/_]+)[-_]([^-/_]+)\.(tar\.gz|tar\.bz2|tar\.xz)$',
+                             os.path.basename(para ['tarball']))
         if reorigtar:
             package = reorigtar.group(1).lower()
             version = reorigtar.group(2)
-- 
2.0.0

Best Regards
-- 
Vasudev Kamath
http://copyninja.info
Connect on ~friendica: [email protected]
IRC nick: copyninja | vasudev {irc.oftc.net | irc.freenode.net}
GPG Key: C517 C25D E408 759D 98A4  C96B 6C8F 74AE 8770 0B7E

Attachment: signature.asc
Description: PGP signature

Reply via email to