1 |
Add a repos.conf sync-webrsync-delta setting that makes the webrsync |
2 |
module call emerge-delta-webrsync, so that emerge-delta-webrsync users |
3 |
can benefit from sync-openpgp-key-path support in the webrsync module. |
4 |
|
5 |
Bug: https://bugs.gentoo.org/661838 |
6 |
--- |
7 |
lib/portage/sync/modules/webrsync/__init__.py | 1 + |
8 |
lib/portage/sync/modules/webrsync/webrsync.py | 10 ++++++++++ |
9 |
man/portage.5 | 4 ++++ |
10 |
misc/emerge-delta-webrsync | 16 +++++++++++++++- |
11 |
4 files changed, 30 insertions(+), 1 deletion(-) |
12 |
|
13 |
diff --git a/lib/portage/sync/modules/webrsync/__init__.py b/lib/portage/sync/modules/webrsync/__init__.py |
14 |
index 118e752de..a413553a1 100644 |
15 |
--- a/lib/portage/sync/modules/webrsync/__init__.py |
16 |
+++ b/lib/portage/sync/modules/webrsync/__init__.py |
17 |
@@ -46,6 +46,7 @@ module_spec = { |
18 |
}, |
19 |
'validate_config': CheckSyncConfig, |
20 |
'module_specific_options': ( |
21 |
+ 'sync-webrsync-delta', |
22 |
'sync-webrsync-keep-snapshots', |
23 |
'sync-webrsync-verify-signature', |
24 |
), |
25 |
diff --git a/lib/portage/sync/modules/webrsync/webrsync.py b/lib/portage/sync/modules/webrsync/webrsync.py |
26 |
index 1b4c08e65..609ba0be2 100644 |
27 |
--- a/lib/portage/sync/modules/webrsync/webrsync.py |
28 |
+++ b/lib/portage/sync/modules/webrsync/webrsync.py |
29 |
@@ -34,6 +34,16 @@ class WebRsync(SyncBase): |
30 |
def __init__(self): |
31 |
SyncBase.__init__(self, 'emerge-webrsync', '>=sys-apps/portage-2.3') |
32 |
|
33 |
+ @property |
34 |
+ def has_bin(self): |
35 |
+ if (self._bin_command != 'emerge-delta-webrsync' and |
36 |
+ self.repo.module_specific_options.get( |
37 |
+ 'sync-webrsync-delta', 'false').lower() in ('true', 'yes')): |
38 |
+ self._bin_command = 'emerge-delta-webrsync' |
39 |
+ self.bin_command = portage.process.find_binary(self._bin_command) |
40 |
+ self.bin_pkg = '>=app-portage/emerge-delta-webrsync-3.7.5' |
41 |
+ |
42 |
+ return super(WebRsync, self).has_bin |
43 |
|
44 |
def sync(self, **kwargs): |
45 |
'''Sync the repository''' |
46 |
diff --git a/man/portage.5 b/man/portage.5 |
47 |
index 4cb1b0b34..cd9d5036d 100644 |
48 |
--- a/man/portage.5 |
49 |
+++ b/man/portage.5 |
50 |
@@ -1128,6 +1128,10 @@ when 0. Defaults to disabled. |
51 |
Require the repository to contain a signed MetaManifest and verify |
52 |
it using \fBapp\-portage/gemato\fR. Defaults to no. |
53 |
.TP |
54 |
+.B sync\-webrsync\-delta = true|false |
55 |
+Use \fBapp\-portage/emerge\-delta\-webrsync\fR to minimize bandwidth. |
56 |
+Defaults to false. |
57 |
+.TP |
58 |
.B sync\-webrsync\-keep\-snapshots = true|false |
59 |
Keep snapshots in \fBDISTDIR\fR (do not delete). Defaults to false. |
60 |
.TP |
61 |
diff --git a/misc/emerge-delta-webrsync b/misc/emerge-delta-webrsync |
62 |
index ebaa616f9..5ade2708b 100755 |
63 |
--- a/misc/emerge-delta-webrsync |
64 |
+++ b/misc/emerge-delta-webrsync |
65 |
@@ -4,7 +4,15 @@ |
66 |
# Author: Brian Harring <ferringb@g.o>, karltk@g.o originally. |
67 |
# Rewritten from the old, Perl-based emerge-webrsync script |
68 |
|
69 |
+# repos.conf configuration for use with emerge --sync and emaint sync |
70 |
+# using keyring from app-crypt/openpgp-keys-gentoo-release: |
71 |
+# [gentoo] |
72 |
+# sync-type = webrsync |
73 |
+# sync-webrsync-delta = true |
74 |
+# sync-webrsync-verify-signature = true |
75 |
+# sync-openpgp-key-path = /usr/share/openpgp-keys/gentoo-release.asc |
76 |
# |
77 |
+# Alternative (legacy) PORTAGE_GPG_DIR configuration: |
78 |
# gpg key import |
79 |
# KEY_ID=0x96D8BF6D |
80 |
# gpg --homedir /etc/portage/gnupg --keyserver subkeys.pgp.net --recv-keys $KEY_ID |
81 |
@@ -106,7 +114,13 @@ if [[ ! -d $STATE_DIR ]]; then |
82 |
exit -2 |
83 |
fi |
84 |
|
85 |
-if has webrsync-gpg ${FEATURES} ; then |
86 |
+if has $(__repo_attr "${repo_name}" sync-webrsync-verify-signature) true yes; then |
87 |
+ if [[ ! -d ${PORTAGE_GPG_DIR} ]]; then |
88 |
+ eecho "Do not call ${argv0##*/} directly, instead call emerge --sync or emaint sync." |
89 |
+ exit 1 |
90 |
+ fi |
91 |
+ WEBSYNC_VERIFY_SIGNATURE=1 |
92 |
+elif has webrsync-gpg ${FEATURES}; then |
93 |
WEBSYNC_VERIFY_SIGNATURE=1 |
94 |
else |
95 |
WEBSYNC_VERIFY_SIGNATURE=0 |
96 |
-- |
97 |
2.16.4 |