From 56352960adfd47d6d5e8fd39d67c185b7b00cd12 Mon Sep 17 00:00:00 2001 From: Giulio Eulisse <10544+ktf@users.noreply.github.com> Date: Fri, 29 Oct 2021 10:07:34 +0200 Subject: [PATCH] Remove unused argument for extra rsync options (#720) Everything passes the empty string along anyway, and it's not user-configurable at all. Co-authored-by: Timo Wilken --- alibuild_helpers/build.py | 2 +- alibuild_helpers/sync.py | 19 ++++++++----------- tests/test_sync.py | 2 +- 3 files changed, 10 insertions(+), 13 deletions(-) diff --git a/alibuild_helpers/build.py b/alibuild_helpers/build.py index fe4d7def..827c17a9 100644 --- a/alibuild_helpers/build.py +++ b/alibuild_helpers/build.py @@ -217,7 +217,7 @@ def doBuild(args, parser): syncHelper = Boto3RemoteSync(args.remoteStore, args.writeStore, args.architecture, args.workDir) elif args.remoteStore: - syncHelper = RsyncRemoteSync(args.remoteStore, args.writeStore, args.architecture, args.workDir, "") + syncHelper = RsyncRemoteSync(args.remoteStore, args.writeStore, args.architecture, args.workDir) else: syncHelper = NoRemoteSync() diff --git a/alibuild_helpers/sync.py b/alibuild_helpers/sync.py index be783753..b957b692 100644 --- a/alibuild_helpers/sync.py +++ b/alibuild_helpers/sync.py @@ -212,26 +212,24 @@ def syncDistLinksToRemote(self, link_dir): class RsyncRemoteSync: """Helper class to sync package build directory using RSync.""" - def __init__(self, remoteStore, writeStore, architecture, workdir, rsyncOptions): + def __init__(self, remoteStore, writeStore, architecture, workdir): self.remoteStore = re.sub("^ssh://", "", remoteStore) self.writeStore = re.sub("^ssh://", "", writeStore) self.architecture = architecture - self.rsyncOptions = rsyncOptions self.workdir = workdir def syncToLocal(self, p, spec): debug("Updating remote store for package %s with hashes %s", p, ", ".join(spec["remote_hashes"])) err = execute("""\ - rsync -av --delete {ro} {remoteStore}/{linksPath}/ {workDir}/{linksPath}/ || : + rsync -av --delete {remoteStore}/{linksPath}/ {workDir}/{linksPath}/ || : for storePath in {storePaths}; do mkdir -p {workDir}/$storePath # If we transferred at least one file, quit. This assumes that the remote # doesn't have empty dirs under TARS//store/. - rsync -av {ro} {remoteStore}/$storePath/ {workDir}/$storePath/ && break || : + rsync -av {remoteStore}/$storePath/ {workDir}/$storePath/ && break || : done - """.format(ro=self.rsyncOptions, - remoteStore=self.remoteStore, + """.format(remoteStore=self.remoteStore, workDir=self.workdir, linksPath=resolve_links_path(self.architecture, p), storePaths=" ".join(resolve_store_path(self.architecture, pkg_hash) @@ -245,11 +243,10 @@ def syncToRemote(self, p, spec): architecture=self.architecture, **spec) cmd = format("cd %(workdir)s && " - "rsync -avR %(rsyncOptions)s --ignore-existing %(storePath)s/%(tarballNameWithRev)s %(remoteStore)s/ &&" - "rsync -avR %(rsyncOptions)s --ignore-existing %(linksPath)s/%(tarballNameWithRev)s %(remoteStore)s/", + "rsync -avR --ignore-existing %(storePath)s/%(tarballNameWithRev)s %(remoteStore)s/ &&" + "rsync -avR --ignore-existing %(linksPath)s/%(tarballNameWithRev)s %(remoteStore)s/", workdir=self.workdir, remoteStore=self.remoteStore, - rsyncOptions=self.rsyncOptions, storePath=resolve_store_path(self.architecture, spec["hash"]), linksPath=resolve_links_path(self.architecture, p), tarballNameWithRev=tarballNameWithRev) @@ -259,8 +256,8 @@ def syncToRemote(self, p, spec): def syncDistLinksToRemote(self, link_dir): if not self.writeStore: return - execute("cd {w} && rsync -avR {o} --ignore-existing {t}/ {rs}/".format( - w=self.workdir, rs=self.writeStore, o=self.rsyncOptions, t=link_dir)) + execute("cd {w} && rsync -avR --ignore-existing {t}/ {rs}/".format( + w=self.workdir, rs=self.writeStore, t=link_dir)) class S3RemoteSync: diff --git a/tests/test_sync.py b/tests/test_sync.py index 2f8fea50..4144ac89 100644 --- a/tests/test_sync.py +++ b/tests/test_sync.py @@ -126,7 +126,7 @@ def test_sync(self, mock_os): sync.RsyncRemoteSync(remoteStore="ssh://localhost/test", writeStore="ssh://localhost/test", architecture=ARCHITECTURE, - workdir="/sw", rsyncOptions=""), + workdir="/sw"), sync.S3RemoteSync(remoteStore="s3://localhost", writeStore="s3://localhost", architecture="slc7_x86-64",