From mboxrd@z Thu Jan 1 00:00:00 1970 X-GM-THRID: 7185877375684444160 X-Received: by 2002:a5b:985:0:b0:6fa:1d8c:8d74 with SMTP id c5-20020a5b0985000000b006fa1d8c8d74mr6336679ybq.190.1673092454148; Sat, 07 Jan 2023 03:54:14 -0800 (PST) X-BeenThere: isar-users@googlegroups.com Received: by 2002:a25:ce82:0:b0:7b3:a60a:4bff with SMTP id x124-20020a25ce82000000b007b3a60a4bffls892920ybe.7.-pod-prod-gmail; Sat, 07 Jan 2023 03:54:13 -0800 (PST) X-Google-Smtp-Source: AMrXdXsat36mVAx9HOJPDx3VNhzM9IfwV/tuWcldoBbtPghjLUdOfl6Cu8pB5Xt+QRRiuck6Xgmn X-Received: by 2002:a25:f42:0:b0:6fb:4e26:c658 with SMTP id 63-20020a250f42000000b006fb4e26c658mr53304174ybp.32.1673092453351; Sat, 07 Jan 2023 03:54:13 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673092453; cv=none; d=google.com; s=arc-20160816; b=Y/5FSIXbyFXE0XCak+b+A0iYsCxdrVQWjHm8q5CPq47E2Jb+WRy3PuIw3n8f9m3ngY IJJD0afkPM5++5oiubWry8279Y7nxG5ltEIqg789R4Mdt/Z2pHgTuOwhOtQrWvz4RYkC oXOGBnShfNAcdYR5+bstavRFEfCMNLTAelEmW6f30btQhai25joooFedio5QXoj2DzwH 2Anlz17Kvbuh4R6hMQfATm+hasE/3gAb8VSXsSOIvu60JEbmtCh08dAqFCkUmWC3y0+K 9/ueCvX3kVQ+Q0o4oznqSaPKPkxru4Qxf79cmxGUtIVP2YCD4vaaR57O6EXDUkt8xByL l4Dw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from; bh=84jT1uy9p/LMsXQ9Uk0lHZvDIYqyvv1MK+ryfoo2uhg=; b=PZQ3gtUgbwvQ1RjsW5sWv4aTc7A7tb2vimfbeCCxas8WcKMnmBhwLuZtbo81mcm6+v ugmzY+CgsbeJpQvwBZ2mgxhrLUp95M/+PoUwXnDKqYgGpnFyp40YYj73LBbJdnHYhtCy XDG+ub3eySmEM8qn6HwzAao9uNke8F2RJSSSjGFbL0UhMwohoWpTFOCycX4UcI+H44cD PZZDbB8/zxV/0LvTAEoSqB1TLgVdkuWpgs1rEWzWRYt1J4D8gRFF4FfOv/2+I6dbjibi bYetelHeBbLpSikvLpdmwMXFQy4DdUMEtxzp3hN4bhikkSygwXwx6BOJBsrFKVZ+CMeR cWyQ== ARC-Authentication-Results: i=1; gmr-mx.google.com; spf=pass (google.com: domain of venkata.pyla@toshiba-tsip.com designates 210.130.202.155 as permitted sender) smtp.mailfrom=venkata.pyla@toshiba-tsip.com Return-Path: Received: from mo-csw.securemx.jp (mo-csw1516.securemx.jp. [210.130.202.155]) by gmr-mx.google.com with ESMTPS id y125-20020a257d83000000b007b5afaf560esi352621ybc.4.2023.01.07.03.54.12 for (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sat, 07 Jan 2023 03:54:12 -0800 (PST) Received-SPF: pass (google.com: domain of venkata.pyla@toshiba-tsip.com designates 210.130.202.155 as permitted sender) client-ip=210.130.202.155; Authentication-Results: gmr-mx.google.com; spf=pass (google.com: domain of venkata.pyla@toshiba-tsip.com designates 210.130.202.155 as permitted sender) smtp.mailfrom=venkata.pyla@toshiba-tsip.com Received: by mo-csw.securemx.jp (mx-mo-csw1516) id 307Bs9ac015314; Sat, 7 Jan 2023 20:54:09 +0900 X-Iguazu-Qid: 34tMVHkSTouFuNFuYk X-Iguazu-QSIG: v=2; s=0; t=1673092449; q=34tMVHkSTouFuNFuYk; m=n8ccDrXbJI8VMzvxyzZvFwpVRI6VX/3SK9pOnthiokg= Received: from imx12-a.toshiba.co.jp ([38.106.60.135]) by relay.securemx.jp (mx-mr1511) id 307Bs9w2001067 (version=TLSv1.2 cipher=AES128-GCM-SHA256 bits=128 verify=NOT); Sat, 7 Jan 2023 20:54:09 +0900 From: venkata.pyla@toshiba-tsip.com To: isar-users@googlegroups.com Cc: venkata pyla , amikan@ilbers.de, jan.kiszka@siemens.com, henning.schild@siemens.com, kazuhiro3.hayashi@toshiba.co.jp, dinesh.kumar@toshiba-tsip.com Subject: [PATCH] repro-build-test.py: Fix flake8 issues Date: Sat, 7 Jan 2023 17:28:18 +0530 X-TSB-HOP2: ON Message-Id: <20230107115818.8267-1-venkata.pyla@toshiba-tsip.com> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-OriginalArrivalTime: 07 Jan 2023 11:54:07.0622 (UTC) FILETIME=[BF69C260:01D9228E] X-TUID: 2thzxxIs9hyY From: venkata pyla 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 --- 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