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