public inbox for isar-users@googlegroups.com
 help / color / mirror / Atom feed
* [PATCH] repro-build-test.py: Fix flake8 issues
@ 2023-01-07 11:58 venkata.pyla
  2023-01-07 16:11 ` Henning Schild
  2023-03-30  7:13 ` Uladzimir Bely
  0 siblings, 2 replies; 4+ messages in thread
From: venkata.pyla @ 2023-01-07 11:58 UTC (permalink / raw)
  To: isar-users
  Cc: venkata pyla, amikan, jan.kiszka, henning.schild,
	kazuhiro3.hayashi, dinesh.kumar

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]
         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")
-- 
2.20.1



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] repro-build-test.py: Fix flake8 issues
  2023-01-07 11:58 [PATCH] repro-build-test.py: Fix flake8 issues venkata.pyla
@ 2023-01-07 16:11 ` Henning Schild
  2023-01-09  7:21   ` Venkata.Pyla
  2023-03-30  7:13 ` Uladzimir Bely
  1 sibling, 1 reply; 4+ messages in thread
From: Henning Schild @ 2023-01-07 16:11 UTC (permalink / raw)
  To: venkata.pyla
  Cc: isar-users, amikan, jan.kiszka, kazuhiro3.hayashi, dinesh.kumar

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


^ permalink raw reply	[flat|nested] 4+ messages in thread

* RE: [PATCH] repro-build-test.py: Fix flake8 issues
  2023-01-07 16:11 ` Henning Schild
@ 2023-01-09  7:21   ` Venkata.Pyla
  0 siblings, 0 replies; 4+ messages in thread
From: Venkata.Pyla @ 2023-01-09  7:21 UTC (permalink / raw)
  To: henning.schild
  Cc: isar-users, amikan, jan.kiszka, kazuhiro3.hayashi, dinesh.kumar



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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] repro-build-test.py: Fix flake8 issues
  2023-01-07 11:58 [PATCH] repro-build-test.py: Fix flake8 issues venkata.pyla
  2023-01-07 16:11 ` Henning Schild
@ 2023-03-30  7:13 ` Uladzimir Bely
  1 sibling, 0 replies; 4+ messages in thread
From: Uladzimir Bely @ 2023-03-30  7:13 UTC (permalink / raw)
  To: isar-users

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.




^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2023-03-30  7:13 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-01-07 11:58 [PATCH] repro-build-test.py: Fix flake8 issues venkata.pyla
2023-01-07 16:11 ` Henning Schild
2023-01-09  7:21   ` Venkata.Pyla
2023-03-30  7:13 ` Uladzimir Bely

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox