Osamu Aoki <[email protected]> writes:

> Hi,
>
> I am a bit concerned for origtar.py compatibility.
>
>> 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)
>
> This is good as is.
>
>> @@ -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']))
>                                                      ^ ? why space

Ouch!.. accidental, will fix it.. also I see that you don't use pep8
coding standard any reason for that?..


>
> These are good idea but this means there is no tarball in the root of
> build location.  If os.path.dirname(tarball) is not os.getcwd(), let's
> copy.  Then reset para['tarball'] to
> os.path.basename(para['tarball']).

makes sense.

> diff --git a/debmake/sanity.py b/debmake/sanity.py
>
> index fdfdcab..d9bd877 100755
> --- a/debmake/sanity.py
> +++ b/debmake/sanity.py
> @@ -58,7 +58,7 @@ def sanity(para):
>                  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(para['tarball']))
>          if resrcrpm:
>              command = 'rpm2cpio ' + para['tarball'] + '|cpio -dium'
>              print('I: $ {}'.format(command), file=sys.stderr)
> @@ -76,6 +76,13 @@ def sanity(para):
>          if not os.path.isfile(para['tarball']):
>              print('E: Non-existing tarball name {}'.format(para['tarball']), 
> file=sys.stderr)
>              exit(1)
> +        if os.path.abspath(os.path.dirname(para['tarball'])) != os.getcwd():
> +            command = 'cp ' + para['tarball'] + ' ' + 
> os.path.basename(para['tarball'])
> +            print('I: $ {}'.format(command), file=sys.stderr)
> +            if subprocess.call(command, shell=True) != 0:
> +                print('E: {} failed.'.format(command), file=sys.stderr)
> +                exit(1)
> +        para['tarball'] = os.path.basename(para['tarball'])
>          # tarball: package_version.orig.tar.gz
>          reorigtar = 
> re.match(r'([^/_]+)_([^-/_]+)\.orig\.(tar\.gz|tar\.bz2|tar\.xz)$', 
> para['tarball'])
>          # tarball: package-version.tar.gz or package_version.tar.gz
>
> What do you think.

Looks good to me!.

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