public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-commits] proj/portage:master commit in: misc/, man/, lib/portage/sync/modules/webrsync/
@ 2018-07-28  6:12 Zac Medico
  0 siblings, 0 replies; only message in thread
From: Zac Medico @ 2018-07-28  6:12 UTC (permalink / raw
  To: gentoo-commits

commit:     f810f8694f78dd87172e38d942580532017db4fe
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Fri Jul 27 07:05:03 2018 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Sat Jul 28 05:54:43 2018 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=f810f869

webrsync: support emerge-delta-webrsync (bug 661838)

Add a repos.conf sync-webrsync-delta setting that makes the webrsync
module call emerge-delta-webrsync, so that emerge-delta-webrsync users
can benefit from sync-openpgp-key-path support in the webrsync module.

Bug: https://bugs.gentoo.org/661838
Reviewed-by: Brian Dolbec <dolsen <AT> gentoo.org>

 lib/portage/sync/modules/webrsync/__init__.py |  1 +
 lib/portage/sync/modules/webrsync/webrsync.py | 10 ++++++++++
 man/portage.5                                 |  4 ++++
 misc/emerge-delta-webrsync                    | 17 ++++++++++++++++-
 4 files changed, 31 insertions(+), 1 deletion(-)

diff --git a/lib/portage/sync/modules/webrsync/__init__.py b/lib/portage/sync/modules/webrsync/__init__.py
index 118e752de..a413553a1 100644
--- a/lib/portage/sync/modules/webrsync/__init__.py
+++ b/lib/portage/sync/modules/webrsync/__init__.py
@@ -46,6 +46,7 @@ module_spec = {
 			},
 			'validate_config': CheckSyncConfig,
 			'module_specific_options': (
+				'sync-webrsync-delta',
 				'sync-webrsync-keep-snapshots',
 				'sync-webrsync-verify-signature',
 			),

diff --git a/lib/portage/sync/modules/webrsync/webrsync.py b/lib/portage/sync/modules/webrsync/webrsync.py
index 1b4c08e65..609ba0be2 100644
--- a/lib/portage/sync/modules/webrsync/webrsync.py
+++ b/lib/portage/sync/modules/webrsync/webrsync.py
@@ -34,6 +34,16 @@ class WebRsync(SyncBase):
 	def __init__(self):
 		SyncBase.__init__(self, 'emerge-webrsync', '>=sys-apps/portage-2.3')
 
+	@property
+	def has_bin(self):
+		if (self._bin_command != 'emerge-delta-webrsync' and
+			self.repo.module_specific_options.get(
+			'sync-webrsync-delta', 'false').lower() in ('true', 'yes')):
+			self._bin_command = 'emerge-delta-webrsync'
+			self.bin_command = portage.process.find_binary(self._bin_command)
+			self.bin_pkg = '>=app-portage/emerge-delta-webrsync-3.7.5'
+
+		return super(WebRsync, self).has_bin
 
 	def sync(self, **kwargs):
 		'''Sync the repository'''

diff --git a/man/portage.5 b/man/portage.5
index 4cb1b0b34..cd9d5036d 100644
--- a/man/portage.5
+++ b/man/portage.5
@@ -1128,6 +1128,10 @@ when 0. Defaults to disabled.
 Require the repository to contain a signed MetaManifest and verify
 it using \fBapp\-portage/gemato\fR. Defaults to no.
 .TP
+.B sync\-webrsync\-delta = true|false
+Use \fBapp\-portage/emerge\-delta\-webrsync\fR to minimize bandwidth.
+Defaults to false.
+.TP
 .B sync\-webrsync\-keep\-snapshots = true|false
 Keep snapshots in \fBDISTDIR\fR (do not delete). Defaults to false.
 .TP

diff --git a/misc/emerge-delta-webrsync b/misc/emerge-delta-webrsync
index ebaa616f9..14e5c7c55 100755
--- a/misc/emerge-delta-webrsync
+++ b/misc/emerge-delta-webrsync
@@ -4,7 +4,15 @@
 # Author: Brian Harring <ferringb@gentoo.org>, karltk@gentoo.org originally.
 # Rewritten from the old, Perl-based emerge-webrsync script
 
+# repos.conf configuration for use with emerge --sync and emaint sync
+# using keyring from app-crypt/openpgp-keys-gentoo-release:
+# [gentoo]
+# sync-type = webrsync
+# sync-webrsync-delta = true
+# sync-webrsync-verify-signature = true
+# sync-openpgp-key-path = /usr/share/openpgp-keys/gentoo-release.asc
 #
+# Alternative (legacy) PORTAGE_GPG_DIR configuration:
 # gpg key import
 # KEY_ID=0x96D8BF6D
 # gpg --homedir /etc/portage/gnupg --keyserver subkeys.pgp.net --recv-keys $KEY_ID
@@ -106,7 +114,14 @@ if [[ ! -d $STATE_DIR ]]; then
 	exit -2
 fi
 
-if has webrsync-gpg ${FEATURES} ; then
+if has $(__repo_attr "${repo_name}" sync-webrsync-verify-signature | \
+	LC_ALL=C tr '[:upper:]' '[:lower:]') true yes; then
+	if [[ ! -d ${PORTAGE_GPG_DIR} ]]; then
+		eecho "Do not call ${argv0##*/} directly, instead call emerge --sync or emaint sync."
+		exit 1
+	fi
+	WEBSYNC_VERIFY_SIGNATURE=1
+elif has webrsync-gpg ${FEATURES}; then
 	WEBSYNC_VERIFY_SIGNATURE=1
 else
 	WEBSYNC_VERIFY_SIGNATURE=0


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2018-07-28  6:13 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-07-28  6:12 [gentoo-commits] proj/portage:master commit in: misc/, man/, lib/portage/sync/modules/webrsync/ Zac Medico

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox