Gentoo Archives: gentoo-commits

From: "Michał Górny" <mgorny@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/portage:plugin-sync commit in: pym/portage/sync/modules/rsync/
Date: Mon, 01 Dec 2014 21:50:19
Message-Id: 1417470582.be0a1641e0a69ea04a54a7da00d6dcb402b552e6.mgorny@gentoo
1 commit: be0a1641e0a69ea04a54a7da00d6dcb402b552e6
2 Author: Zac Medico <zmedico <AT> gentoo <DOT> org>
3 AuthorDate: Wed Oct 22 10:59:32 2014 +0000
4 Commit: Michał Górny <mgorny <AT> gentoo <DOT> org>
5 CommitDate: Mon Dec 1 21:49:42 2014 +0000
6 URL: http://sources.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=be0a1641
7
8 RsyncSync: support file:// sync-uri
9
10 This will be useful for unit tests that will sync from a local
11 file:// sync-uri.
12
13 ---
14 pym/portage/sync/modules/rsync/rsync.py | 13 +++++++++++--
15 1 file changed, 11 insertions(+), 2 deletions(-)
16
17 diff --git a/pym/portage/sync/modules/rsync/rsync.py b/pym/portage/sync/modules/rsync/rsync.py
18 index 76d83f2..74c10e7 100644
19 --- a/pym/portage/sync/modules/rsync/rsync.py
20 +++ b/pym/portage/sync/modules/rsync/rsync.py
21 @@ -66,6 +66,9 @@ class RsyncSync(SyncBase):
22 rsync_opts = self._validate_rsync_opts(rsync_opts, syncuri)
23 self.rsync_opts = self._rsync_opts_extend(opts, rsync_opts)
24
25 + self.extra_rsync_opts = portage.util.shlex_split(
26 + self.settings.get("PORTAGE_RSYNC_EXTRA_OPTS",""))
27 +
28 # Real local timestamp file.
29 self.servertimestampfile = os.path.join(
30 self.repo.location, "metadata", "timestamp.chk")
31 @@ -93,6 +96,14 @@ class RsyncSync(SyncBase):
32 except:
33 maxretries = -1 #default number of retries
34
35 + if syncuri.startswith("file://"):
36 + self.proto = "file"
37 + dosyncuri = syncuri[6:]
38 + is_synced, exitcode = self._do_rsync(
39 + dosyncuri, timestamp, opts)
40 + self._process_exitcode(exitcode, dosyncuri, out, 1)
41 + return (exitcode, exitcode == os.EX_OK)
42 +
43 retries=0
44 try:
45 self.proto, user_name, hostname, port = re.split(
46 @@ -116,8 +127,6 @@ class RsyncSync(SyncBase):
47 getaddrinfo_host = hostname[1:-1]
48 updatecache_flg=True
49 all_rsync_opts = set(self.rsync_opts)
50 - self.extra_rsync_opts = portage.util.shlex_split(
51 - self.settings.get("PORTAGE_RSYNC_EXTRA_OPTS",""))
52 all_rsync_opts.update(self.extra_rsync_opts)
53
54 family = socket.AF_UNSPEC