Skip to content

Commit

Permalink
Remove unused argument for extra rsync options (#720)
Browse files Browse the repository at this point in the history
Everything passes the empty string along anyway, and it's not user-configurable
at all.

Co-authored-by: Timo Wilken <timo.wilken@cern.ch>
  • Loading branch information
ktf and TimoWilken authored Oct 29, 2021
1 parent d708a25 commit 5635296
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 13 deletions.
2 changes: 1 addition & 1 deletion alibuild_helpers/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()

Expand Down
19 changes: 8 additions & 11 deletions alibuild_helpers/sync.py
Original file line number Diff line number Diff line change
Expand Up @@ -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/<arch>/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)
Expand All @@ -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)
Expand All @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion tests/test_sync.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down

0 comments on commit 5635296

Please sign in to comment.