Message ID | 20230107115818.8267-1-venkata.pyla@toshiba-tsip.com |
---|---|
State | Accepted, archived |
Headers | show |
Series | repro-build-test.py: Fix flake8 issues | expand |
Thanks! Am Sat, 7 Jan 2023 17:28:18 +0530 schrieb venkata.pyla@toshiba-tsip.com: > From: venkata pyla <venkata.pyla@toshiba-tsip.com> > > It fixes following flake8 errors > > F401 'glob' imported but unused > F401 'os' imported but unused > F401 're' imported but unused > F401 'tempfile' imported but unused > F401 'time' imported but unused > F401 'cibuilder.isar_root' imported but unused > E302 expected 2 blank lines, found 1 > E501 line too long (97 > 79 characters) > E501 line too long (106 > 79 characters) > E203 whitespace before ',' > E231 missing whitespace after ',' > E501 line too long (91 > 79 characters) > E501 line too long (89 > 79 characters) > E501 line too long (84 > 79 characters) > E128 continuation line under-indented for visual indent > E128 continuation line under-indented for visual indent > E128 continuation line under-indented for visual indent > E203 whitespace before ',' > E128 continuation line under-indented for visual indent > E251 unexpected spaces around keyword / parameter equals > E251 unexpected spaces around keyword / parameter equals > > black: converts single quote strings to double quotes > > Signed-off-by: venkata pyla <venkata.pyla@toshiba-tsip.com> > --- > testsuite/repro-build-test.py | 64 > ++++++++++++++++++++--------------- 1 file changed, 36 insertions(+), > 28 deletions(-) > > diff --git a/testsuite/repro-build-test.py > b/testsuite/repro-build-test.py index e89becf..5d92e2c 100755 > --- a/testsuite/repro-build-test.py > +++ b/testsuite/repro-build-test.py > @@ -1,14 +1,9 @@ > #!/usr/bin/env python3 > > -import glob > -import os > -import re > -import tempfile > -import time > - > -from cibuilder import CIBuilder, isar_root > +from cibuilder import CIBuilder > from avocado.utils import process > > + > class ReproBuild(CIBuilder): > > """ > @@ -16,29 +11,38 @@ class ReproBuild(CIBuilder): > > :avocado: tags=repro-build > """ > + > def test_repro_build(self): > - target = self.params.get('build_target', > default='mc:qemuamd64-bullseye:isar-image-base') > - source_date_epoch = self.params.get('source_date_epoch', > default=self.git_last_commit_timestamp()) > + target = self.params.get( > + "build_target", > default="mc:qemuamd64-bullseye:isar-image-base" > + ) > + source_date_epoch = self.params.get( > + "source_date_epoch", > default=self.git_last_commit_timestamp() > + ) > self.init() > - self.build_repro_image(target, source_date_epoch, > 'image1.tar.gz') > - self.build_repro_image(target, source_date_epoch, > 'image2.tar.gz') > - self.compare_repro_image('image1.tar.gz', 'image2.tar.gz') > + self.build_repro_image(target, source_date_epoch, > "image1.tar.gz") > + self.build_repro_image(target, source_date_epoch, > "image2.tar.gz") > + self.compare_repro_image("image1.tar.gz", "image2.tar.gz") > > def git_last_commit_timestamp(self): > - return process.run('git log -1 --pretty=%ct').stdout > + return process.run("git log -1 > --pretty=%ct").stdout.decode().strip() > def get_image_path(self, target_name): > image_dir = "tmp/deploy/images" > - target_params = target_name.split(':') > - machine = target_params[1].split('-')[0] > - distro = 'debian-' + target_params[1].split('-')[1] > + target_params = target_name.split(":") > + machine = target_params[1].split("-")[0] > + distro = "debian-" + target_params[1].split("-")[1] Was this ever tried against ubuntu? Henning > image_type = target_params[2] > - return > f'{image_dir}/{machine}/{image_type}-{distro}-{machine}.tar.gz' > + return > f"{image_dir}/{machine}/{image_type}-{distro}-{machine}.tar.gz" > - def build_repro_image(self, target, source_date_epoch=None > ,image_name='image.tar.gz'): > + def build_repro_image( > + self, target, source_date_epoch=None, > image_name="image.tar.gz" > + ): > > if not source_date_epoch: > - self.error("Reproducible build should configure with > source_date_epoch time") > + self.error( > + "Reproducible build should configure with > source_date_epoch time" > + ) > > # clean artifacts before build > self.clean() > @@ -54,15 +58,19 @@ class ReproBuild(CIBuilder): > self.move_in_build_dir(image_path, image_name) > > def clean(self): > - self.delete_from_build_dir('tmp') > - self.delete_from_build_dir('sstate-cache') > + self.delete_from_build_dir("tmp") > + self.delete_from_build_dir("sstate-cache") > > def compare_repro_image(self, image1, image2): > - self.log.info("Compare artifacts image1: " + image1 + ", > image2: " + image2) > - result = process.run('diffoscope ' > - '--text ' + self.build_dir + > '/diffoscope-output.txt' > - ' ' + self.build_dir + '/' + image1 + > - ' ' + self.build_dir + '/' + image2 , > - ignore_status = True) > + self.log.info( > + "Compare artifacts image1: " + image1 + ", image2: " + > image2 > + ) > + result = process.run( > + "diffoscope " > + "--text " + self.build_dir + "/diffoscope-output.txt" > + " " + self.build_dir + "/" + image1 + > + " " + self.build_dir + "/" + image2, > + ignore_status=True, > + ) > if result.exit_status > 0: > - self.fail(f'Images {image1} and {image2} are not > reproducible') > + self.fail(f"Images {image1} and {image2} are not > reproducible")
>-----Original Message----- >From: isar-users@googlegroups.com <isar-users@googlegroups.com> On >Behalf Of Henning Schild >Sent: 07 January 2023 21:42 >To: pyla venkata(TSIP TMIEC ODG Porting) <Venkata.Pyla@toshiba- >tsip.com> >Cc: isar-users@googlegroups.com; amikan@ilbers.de; >jan.kiszka@siemens.com; hayashi kazuhiro(林 和宏 □SWC◯ACT) ><kazuhiro3.hayashi@toshiba.co.jp>; dinesh kumar(TSIP TMIEC ODG >Porting) <dinesh.kumar@toshiba-tsip.com> >Subject: Re: [PATCH] repro-build-test.py: Fix flake8 issues > >Thanks! > >Am Sat, 7 Jan 2023 17:28:18 +0530 >schrieb venkata.pyla@toshiba-tsip.com: > >> From: venkata pyla <venkata.pyla@toshiba-tsip.com> >> >> It fixes following flake8 errors >> >> F401 'glob' imported but unused >> F401 'os' imported but unused >> F401 're' imported but unused >> F401 'tempfile' imported but unused >> F401 'time' imported but unused >> F401 'cibuilder.isar_root' imported but unused >> E302 expected 2 blank lines, found 1 >> E501 line too long (97 > 79 characters) >> E501 line too long (106 > 79 characters) >> E203 whitespace before ',' >> E231 missing whitespace after ',' >> E501 line too long (91 > 79 characters) >> E501 line too long (89 > 79 characters) >> E501 line too long (84 > 79 characters) >> E128 continuation line under-indented for visual indent >> E128 continuation line under-indented for visual indent >> E128 continuation line under-indented for visual indent >> E203 whitespace before ',' >> E128 continuation line under-indented for visual indent >> E251 unexpected spaces around keyword / parameter equals >> E251 unexpected spaces around keyword / parameter equals >> >> black: converts single quote strings to double quotes >> >> Signed-off-by: venkata pyla <venkata.pyla@toshiba-tsip.com> >> --- >> testsuite/repro-build-test.py | 64 >> ++++++++++++++++++++--------------- 1 file changed, 36 insertions(+), >> 28 deletions(-) >> >> diff --git a/testsuite/repro-build-test.py >> b/testsuite/repro-build-test.py index e89becf..5d92e2c 100755 >> --- a/testsuite/repro-build-test.py >> +++ b/testsuite/repro-build-test.py >> @@ -1,14 +1,9 @@ >> #!/usr/bin/env python3 >> >> -import glob >> -import os >> -import re >> -import tempfile >> -import time >> - >> -from cibuilder import CIBuilder, isar_root >> +from cibuilder import CIBuilder >> from avocado.utils import process >> >> + >> class ReproBuild(CIBuilder): >> >> """ >> @@ -16,29 +11,38 @@ class ReproBuild(CIBuilder): >> >> :avocado: tags=repro-build >> """ >> + >> def test_repro_build(self): >> - target = self.params.get('build_target', >> default='mc:qemuamd64-bullseye:isar-image-base') >> - source_date_epoch = self.params.get('source_date_epoch', >> default=self.git_last_commit_timestamp()) >> + target = self.params.get( >> + "build_target", >> default="mc:qemuamd64-bullseye:isar-image-base" >> + ) >> + source_date_epoch = self.params.get( >> + "source_date_epoch", >> default=self.git_last_commit_timestamp() >> + ) >> self.init() >> - self.build_repro_image(target, source_date_epoch, >> 'image1.tar.gz') >> - self.build_repro_image(target, source_date_epoch, >> 'image2.tar.gz') >> - self.compare_repro_image('image1.tar.gz', 'image2.tar.gz') >> + self.build_repro_image(target, source_date_epoch, >> "image1.tar.gz") >> + self.build_repro_image(target, source_date_epoch, >> "image2.tar.gz") >> + self.compare_repro_image("image1.tar.gz", "image2.tar.gz") >> >> def git_last_commit_timestamp(self): >> - return process.run('git log -1 --pretty=%ct').stdout >> + return process.run("git log -1 >> --pretty=%ct").stdout.decode().strip() >> def get_image_path(self, target_name): >> image_dir = "tmp/deploy/images" >> - target_params = target_name.split(':') >> - machine = target_params[1].split('-')[0] >> - distro = 'debian-' + target_params[1].split('-')[1] >> + target_params = target_name.split(":") >> + machine = target_params[1].split("-")[0] >> + distro = "debian-" + target_params[1].split("-")[1] > >Was this ever tried against ubuntu? I have not checked this in other distributions, I am learning now that isar also used for other distributions. I will improve this to get the image name from the bitbake environment. > >Henning > >> image_type = target_params[2] >> - return >> f'{image_dir}/{machine}/{image_type}-{distro}-{machine}.tar.gz' >> + return >> f"{image_dir}/{machine}/{image_type}-{distro}-{machine}.tar.gz" >> - def build_repro_image(self, target, source_date_epoch=None >> ,image_name='image.tar.gz'): >> + def build_repro_image( >> + self, target, source_date_epoch=None, >> image_name="image.tar.gz" >> + ): >> >> if not source_date_epoch: >> - self.error("Reproducible build should configure with >> source_date_epoch time") >> + self.error( >> + "Reproducible build should configure with >> source_date_epoch time" >> + ) >> >> # clean artifacts before build >> self.clean() >> @@ -54,15 +58,19 @@ class ReproBuild(CIBuilder): >> self.move_in_build_dir(image_path, image_name) >> >> def clean(self): >> - self.delete_from_build_dir('tmp') >> - self.delete_from_build_dir('sstate-cache') >> + self.delete_from_build_dir("tmp") >> + self.delete_from_build_dir("sstate-cache") >> >> def compare_repro_image(self, image1, image2): >> - self.log.info("Compare artifacts image1: " + image1 + ", >> image2: " + image2) >> - result = process.run('diffoscope ' >> - '--text ' + self.build_dir + >> '/diffoscope-output.txt' >> - ' ' + self.build_dir + '/' + image1 + >> - ' ' + self.build_dir + '/' + image2 , >> - ignore_status = True) >> + self.log.info( >> + "Compare artifacts image1: " + image1 + ", image2: " + >> image2 >> + ) >> + result = process.run( >> + "diffoscope " >> + "--text " + self.build_dir + "/diffoscope-output.txt" >> + " " + self.build_dir + "/" + image1 + >> + " " + self.build_dir + "/" + image2, >> + ignore_status=True, >> + ) >> if result.exit_status > 0: >> - self.fail(f'Images {image1} and {image2} are not >> reproducible') >> + self.fail(f"Images {image1} and {image2} are not >> reproducible") > >-- >You received this message because you are subscribed to the Google Groups >"isar-users" group. >To unsubscribe from this group and stop receiving emails from it, send an email >to isar-users+unsubscribe@googlegroups.com. >To view this discussion on the web visit >https://groups.google.com/d/msgid/isar- >users/20230107171130.5eb3599b%40md1za8fc.ad001.siemens.net.
In mail from Saturday, 7 January 2023 14:58:18 +03 user venkata.pyla@toshiba- tsip.com wrote: > From: venkata pyla <venkata.pyla@toshiba-tsip.com> > > It fixes following flake8 errors > > F401 'glob' imported but unused > F401 'os' imported but unused > F401 're' imported but unused > F401 'tempfile' imported but unused > F401 'time' imported but unused > F401 'cibuilder.isar_root' imported but unused > E302 expected 2 blank lines, found 1 > E501 line too long (97 > 79 characters) > E501 line too long (106 > 79 characters) > E203 whitespace before ',' > E231 missing whitespace after ',' > E501 line too long (91 > 79 characters) > E501 line too long (89 > 79 characters) > E501 line too long (84 > 79 characters) > E128 continuation line under-indented for visual indent > E128 continuation line under-indented for visual indent > E128 continuation line under-indented for visual indent > E203 whitespace before ',' > E128 continuation line under-indented for visual indent > E251 unexpected spaces around keyword / parameter equals > E251 unexpected spaces around keyword / parameter equals > > black: converts single quote strings to double quotes > Applied to next, thanks.
diff --git a/testsuite/repro-build-test.py b/testsuite/repro-build-test.py index e89becf..5d92e2c 100755 --- a/testsuite/repro-build-test.py +++ b/testsuite/repro-build-test.py @@ -1,14 +1,9 @@ #!/usr/bin/env python3 -import glob -import os -import re -import tempfile -import time - -from cibuilder import CIBuilder, isar_root +from cibuilder import CIBuilder from avocado.utils import process + class ReproBuild(CIBuilder): """ @@ -16,29 +11,38 @@ class ReproBuild(CIBuilder): :avocado: tags=repro-build """ + def test_repro_build(self): - target = self.params.get('build_target', default='mc:qemuamd64-bullseye:isar-image-base') - source_date_epoch = self.params.get('source_date_epoch', default=self.git_last_commit_timestamp()) + target = self.params.get( + "build_target", default="mc:qemuamd64-bullseye:isar-image-base" + ) + source_date_epoch = self.params.get( + "source_date_epoch", default=self.git_last_commit_timestamp() + ) self.init() - self.build_repro_image(target, source_date_epoch, 'image1.tar.gz') - self.build_repro_image(target, source_date_epoch, 'image2.tar.gz') - self.compare_repro_image('image1.tar.gz', 'image2.tar.gz') + self.build_repro_image(target, source_date_epoch, "image1.tar.gz") + self.build_repro_image(target, source_date_epoch, "image2.tar.gz") + self.compare_repro_image("image1.tar.gz", "image2.tar.gz") def git_last_commit_timestamp(self): - return process.run('git log -1 --pretty=%ct').stdout + return process.run("git log -1 --pretty=%ct").stdout.decode().strip() def get_image_path(self, target_name): image_dir = "tmp/deploy/images" - target_params = target_name.split(':') - machine = target_params[1].split('-')[0] - distro = 'debian-' + target_params[1].split('-')[1] + target_params = target_name.split(":") + machine = target_params[1].split("-")[0] + distro = "debian-" + target_params[1].split("-")[1] image_type = target_params[2] - return f'{image_dir}/{machine}/{image_type}-{distro}-{machine}.tar.gz' + return f"{image_dir}/{machine}/{image_type}-{distro}-{machine}.tar.gz" - def build_repro_image(self, target, source_date_epoch=None ,image_name='image.tar.gz'): + def build_repro_image( + self, target, source_date_epoch=None, image_name="image.tar.gz" + ): if not source_date_epoch: - self.error("Reproducible build should configure with source_date_epoch time") + self.error( + "Reproducible build should configure with source_date_epoch time" + ) # clean artifacts before build self.clean() @@ -54,15 +58,19 @@ class ReproBuild(CIBuilder): self.move_in_build_dir(image_path, image_name) def clean(self): - self.delete_from_build_dir('tmp') - self.delete_from_build_dir('sstate-cache') + self.delete_from_build_dir("tmp") + self.delete_from_build_dir("sstate-cache") def compare_repro_image(self, image1, image2): - self.log.info("Compare artifacts image1: " + image1 + ", image2: " + image2) - result = process.run('diffoscope ' - '--text ' + self.build_dir + '/diffoscope-output.txt' - ' ' + self.build_dir + '/' + image1 + - ' ' + self.build_dir + '/' + image2 , - ignore_status = True) + self.log.info( + "Compare artifacts image1: " + image1 + ", image2: " + image2 + ) + result = process.run( + "diffoscope " + "--text " + self.build_dir + "/diffoscope-output.txt" + " " + self.build_dir + "/" + image1 + + " " + self.build_dir + "/" + image2, + ignore_status=True, + ) if result.exit_status > 0: - self.fail(f'Images {image1} and {image2} are not reproducible') + self.fail(f"Images {image1} and {image2} are not reproducible")