[elbe-devel] [PATCH v2 2/6] commands: check-build: Add cdrom checker

Olivier Dion dion at linutronix.de
Wed Aug 19 16:36:53 CEST 2020


On Wed, 19 Aug 2020, Torben Hohn <torben.hohn at linutronix.de> wrote:
> On Mon, Aug 03, 2020 at 12:40:31PM -0400, Olivier Dion wrote:
>> diff --git a/elbepack/commands/check-build.py b/elbepack/commands/check-build.py
>> index 2db8faf6..a39ac8ac 100644
>> --- a/elbepack/commands/check-build.py
>> +++ b/elbepack/commands/check-build.py
>> @@ -3,6 +3,7 @@
>> +        # For every src-cdrom*, extract it to a temporary directory
>> +        # and find all *.dsc files
>> +        for cdrom in iso_it:
>> +            with TmpdirFilesystem() as tmp:
>> +                self.extract_cdrom(tmp, cdrom)
>> +                for _dir, _, files in os.walk(tmp):
>> +                    for _file in files:
>
> why dont you use Filesystem.walk_files() ?

Didn't think of it.  Now that you mentioned it, it would make things
clearer.  Will do!

>

>> +                        for info in infos.split('\n'):
>> +
>> +                            if info.startswith("Source:"):
>> +                                src_name = info.split('Source:')[1].strip(' ')
>> +
>> +                            # Same as for the binary version.  The
>> +                            # PGP's signature contains a version field
>
> PGP ? you mean pkg ?

IIRC I really meant PGP.  There's embedded signature in *.dsc files and
the version field is messing with the version field of the package.


>> +                            elif info.startswith("Version:"):
>> +                                if not src_version:
>> +                                    src_version = info.split('Version:')[1].strip(' ')
>
> i would have preferred that the parsing would be separated into a
> separate class. 
>
> But lets keep it like this. We are short on time.

This is can be easily refactored later yes.

>> diff --git a/elbepack/filesystem.py b/elbepack/filesystem.py
>> index 51697907..714aadd4 100644
>> --- a/elbepack/filesystem.py
>> +++ b/elbepack/filesystem.py
>> @@ -507,6 +507,13 @@ class TmpdirFilesystem (Filesystem):
>>      def delete(self):
>>          shutil.rmtree(self.path, True)
>>  
>> +    def __enter__(self):
>> +        return self.path
>> +
>> +    def __exit__(self, exec_type, exec_value, tb):
>> +        shutil.rmtree(self.path)
>> +        return False
>> +
>
> errm... this seems to be misplaced.

What are you refering to?  The return False?  I think that returning
nothing would do the same thing.

-- 
Olivier Dion
Linutronix GmbH | Bahnhofstrasse 3 | D-88690 Uhldingen-Mühlhofen


More information about the elbe-devel mailing list