Verified Commit f8f7fbf3 authored by intrigeri's avatar intrigeri
Browse files

Lint

parent bbc87dd5
......@@ -17,17 +17,26 @@ log = logging.getLogger()
def main():
parser = argparse.ArgumentParser(
description="Copy IUKs from Jenkins to our rsync server \
and verify that they match those built locally"
)
parser.add_argument("--hashes-file", type=str, action="store", required=True)
parser.add_argument("--jenkins-build-id", type=int, action="store", required=True)
and verify that they match those built locally")
parser.add_argument("--hashes-file",
type=str,
action="store",
required=True)
parser.add_argument("--jenkins-build-id",
type=int,
action="store",
required=True)
parser.add_argument("--work-dir", type=str, action="store", default=".")
parser.add_argument("-q", "--quiet", action="store_true",
parser.add_argument("-q",
"--quiet",
action="store_true",
help="quiet output")
parser.add_argument("--debug", action="store_true", help="debug output")
parser.add_argument("--skip-sending-hashes-file", action="store_true",
parser.add_argument("--skip-sending-hashes-file",
action="store_true",
help="Assume the hashes file was uploaded already")
parser.add_argument("--skip-downloading-iuks", action="store_true",
parser.add_argument("--skip-downloading-iuks",
action="store_true",
help="Assume the IUKs were already downloaded")
args = parser.parse_args()
......@@ -65,19 +74,14 @@ def main():
)
def send_hashes_file(
hashes_file: str,
desthost: str,
destdir: str) -> None:
def send_hashes_file(hashes_file: str, desthost: str, destdir: str) -> None:
log.info("Sending %(f)s to %(d)s on %(h)s…" % {
"f": hashes_file,
"d": destdir,
"h": desthost,
})
subprocess.run(
["scp", hashes_file, "%s:%s" % (desthost, destdir)],
check=True
)
["scp", hashes_file, "%s:%s" % (desthost, destdir)], check=True)
def iuks_listed_in(hashes_file: str) -> List[str]:
......@@ -86,12 +90,9 @@ def iuks_listed_in(hashes_file: str) -> List[str]:
return [l.split(' ')[-1].rstrip() for l in lines]
def download_iuks_from_jenkins(
hashes_file: str,
desthost: str,
destdir: str,
jenkins_iuks_base_url: str,
jenkins_build_id: int) -> None:
def download_iuks_from_jenkins(hashes_file: str, desthost: str, destdir: str,
jenkins_iuks_base_url: str,
jenkins_build_id: int) -> None:
log.info("Downloading IUKs from Jenkins to %s…" % (desthost))
iuks = iuks_listed_in(hashes_file)
log.debug("IUKS: %s" % ', '.join(iuks))
......@@ -112,14 +113,14 @@ def download_iuks_from_jenkins(
def verify_iuks(desthost: str, iuks_dir: str, hashes_file: str) -> None:
log.info("Verifying that IUKs built on Jenkins match those you've built…")
try:
subprocess.run(
["ssh", desthost,
"cd '%(d)s' && sha256sum --check --strict '%(f)s'" % {
"d": iuks_dir,
"f": Path(hashes_file).name,
}],
check=True
)
subprocess.run([
"ssh", desthost,
"cd '%(d)s' && sha256sum --check --strict '%(f)s'" % {
"d": iuks_dir,
"f": Path(hashes_file).name,
}
],
check=True)
except subprocess.CalledProcessError:
print("\nERROR: IUKs built on Jenkins don't match yours\n",
file=sys.stderr)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment