[gentoo-commits] proj/portage:master commit in: misc/

2024-01-28 Thread Zac Medico
commit: 86a3bfce1e399b3274143df00e68c762d3666724
Author: Zac Medico  gentoo  org>
AuthorDate: Mon Jan 29 00:48:53 2024 +
Commit: Zac Medico  gentoo  org>
CommitDate: Mon Jan 29 00:52:05 2024 +
URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=86a3bfce

emerge-delta-webrsync: cd to TMPDIR before rsync

The cd to TMPDIR before rsync was erroneously removed in
commit fa0f8720e168c95bcd6a8bd57d5abf09c488fd32. Apparently
this problem was not reported earlier because this code
path only executes when tarsync is not installed, and the
emerge-delta-webrsync postinstall suggests to install
tarsync since version 3.7.3 released near the end of 2015.

Bug: https://bugs.gentoo.org/922923
Fixes: fa0f8720e168 ("emerge-delta-webrsync: handle gentoo-MMDD directory 
name")
Signed-off-by: Zac Medico  gentoo.org>

 misc/emerge-delta-webrsync | 1 +
 1 file changed, 1 insertion(+)

diff --git a/misc/emerge-delta-webrsync b/misc/emerge-delta-webrsync
index 49c8f606e1..a788cdb0eb 100755
--- a/misc/emerge-delta-webrsync
+++ b/misc/emerge-delta-webrsync
@@ -553,6 +553,7 @@ sync_local() {
chown -R ${ownership} "${TMPDIR}"
rsync_opts+=" --owner --group"
fi
+   cd "${TMPDIR}" || die "failed to change directory to TMPDIR"
chmod 755 .
rsync ${rsync_opts} . "${repo_location%%/}"
cd "${DISTDIR}"



[gentoo-commits] proj/portage:master commit in: misc/

2023-11-10 Thread Sam James
commit: f511b5a1f55df1cd7b322d50ce0f0c5a4e24d81c
Author: Sam James  gentoo  org>
AuthorDate: Sat Nov 11 05:52:53 2023 +
Commit: Sam James  gentoo  org>
CommitDate: Sat Nov 11 07:24:02 2023 +
URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=f511b5a1

misc/emerge-delta-webrsync: fix typos

Thanks to codespell.

Signed-off-by: Sam James  gentoo.org>

 misc/emerge-delta-webrsync | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/misc/emerge-delta-webrsync b/misc/emerge-delta-webrsync
index 12930a0a68..49c8f606e1 100755
--- a/misc/emerge-delta-webrsync
+++ b/misc/emerge-delta-webrsync
@@ -501,7 +501,7 @@ check_file_signature() {
 
if [[ ${r} != 0 ]] ; then
eerror "Error occurred in check_file_signature: ${r}. 
Aborting."
-   die "Verification error occured."
+   die "Verification error occurred."
fi
else
r=0
@@ -990,7 +990,7 @@ if ! verify_md5_file 
"${TMPDIR}/portage-${final_date}.tar.bz2" "${DISTDIR}/porta
exit 5
fi
# hokay.  md5 doesn't agree with umd5. bzip2 issue in effect.
-   echo "compressed md5 differs, but uncompressed md5 says it right.  
bzip2 version incompatability in other words"
+   echo "compressed md5 differs, but uncompressed md5 says it right.  
bzip2 version incompatibility in other words"
echo "saving the md5"
if type -p md5sum &> /dev/null; then
md5sum "${TMPDIR}/portage-${final_date}.tar.bz2" | sed -e 
"s:${TMPDIR}/\?::" > \



[gentoo-commits] proj/portage:master commit in: misc/

2023-08-19 Thread Sam James
commit: 591f0826a15e437eb02e2eddf8ed1487b05f5e94
Author: Sam James  gentoo  org>
AuthorDate: Sat Aug 19 15:16:04 2023 +
Commit: Sam James  gentoo  org>
CommitDate: Sat Aug 19 15:16:04 2023 +
URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=591f0826

misc/emerge-delta-webrsync: fix incorrect warning in --help

I was wrong - the full thing is indeed verified, because we check both
the base + final signatures.

Fixes: 0347637fe5033d3d8eb4fdafa1e86de171934819
Signed-off-by: Sam James  gentoo.org>

 misc/emerge-delta-webrsync | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/misc/emerge-delta-webrsync b/misc/emerge-delta-webrsync
index 5b26fc14a8..610a03f8f7 100755
--- a/misc/emerge-delta-webrsync
+++ b/misc/emerge-delta-webrsync
@@ -152,7 +152,7 @@ for x in $*; do
echo "$x isn't a valid arg.  bailing."
fi
if [[ -n $PUKE_HELP ]]; then
-   echo "--no-pgp-verify; disable PGP verification of snapshot 
(note that patches are not verified either way)"
+   echo "--no-pgp-verify; disable PGP verification of snapshot and 
patches"
echo "-u for upgrade; sync only if new snapshots are found"
echo "-k for keep; keep old tree snapshots around"
exit -1



[gentoo-commits] proj/portage:master commit in: misc/

2023-08-19 Thread Sam James
commit: 79f0b50b79d6ddde4cabd2dca5eac88b2cbf40c1
Author: Sam James  gentoo  org>
AuthorDate: Sat Aug 19 15:02:44 2023 +
Commit: Sam James  gentoo  org>
CommitDate: Sat Aug 19 15:02:44 2023 +
URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=79f0b50b

misc/emerge-delta-webrsync: drop dead --keyserver code

Signed-off-by: Sam James  gentoo.org>

 misc/emerge-delta-webrsync | 5 -
 1 file changed, 5 deletions(-)

diff --git a/misc/emerge-delta-webrsync b/misc/emerge-delta-webrsync
index 1a54d41734..5b26fc14a8 100755
--- a/misc/emerge-delta-webrsync
+++ b/misc/emerge-delta-webrsync
@@ -391,11 +391,6 @@ check_file_signature_gemato() {
die "Needed keys unavailable! Install its package or 
set PORTAGE_GPG_KEY to the right path."
fi
 
-   local keyserver
-   if [[ -n ${PORTAGE_GPG_KEY_SERVER} ]] ; then
-   keyserver="--keyserver ${PORTAGE_GPG_KEY_SERVER}"
-   fi
-
local gemato_args=(
openpgp-verify-detached
-K "${key}"



[gentoo-commits] proj/portage:master commit in: misc/

2023-08-19 Thread Sam James
commit: 058af64372fc6937cb83e58653133f2dba47d410
Author: Sam James  gentoo  org>
AuthorDate: Sat Aug 19 15:02:17 2023 +
Commit: Sam James  gentoo  org>
CommitDate: Sat Aug 19 15:02:17 2023 +
URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=058af643

misc/emerge-delta-webrsync: sync with emerge-webrsync for proxy support

Signed-off-by: Sam James  gentoo.org>

 misc/emerge-delta-webrsync | 10 --
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/misc/emerge-delta-webrsync b/misc/emerge-delta-webrsync
index b2925f0134..1a54d41734 100755
--- a/misc/emerge-delta-webrsync
+++ b/misc/emerge-delta-webrsync
@@ -94,8 +94,8 @@ eval "$("${portageq}" envvar -v DISTDIR EPREFIX FEATURES \
PORTAGE_BIN_PATH PORTAGE_CONFIGROOT PORTAGE_GPG_DIR \
PORTAGE_NICENESS PORTAGE_REPOSITORIES PORTAGE_RSYNC_EXTRA_OPTS \
PORTAGE_RSYNC_OPTS PORTAGE_TEMP_GPG_DIR PORTAGE_TMPDIR \
-   USERLAND http_proxy ftp_proxy)"
-export http_proxy ftp_proxy
+   USERLAND http_proxy https_proxy ftp_proxy)"
+export http_proxy https_proxy ftp_proxy
 
 source "${PORTAGE_BIN_PATH}"/isolated-functions.sh || exit
 
@@ -401,6 +401,12 @@ check_file_signature_gemato() {
-K "${key}"
)
 
+   if [[ -n ${http_proxy} || -n ${https_proxy} ]] ; then
+   gemato_args+=(
+   --proxy "${http_proxy:-${https_proxy}}"
+   )
+   fi
+
[[ -n ${PORTAGE_GPG_KEY_SERVER} ]] && gemato_args+=( 
--keyserver "${PORTAGE_GPG_KEY_SERVER}" )
[[ ${PORTAGE_QUIET} == 1 ]] && gemato_args+=( --quiet )
[[ ${do_debug} == 1 ]] && gemato_args+=( --debug )



[gentoo-commits] proj/portage:master commit in: misc/

2023-08-19 Thread Sam James
commit: fe8b6d95b9c46b67cd4cf0040b5ae81704056cb7
Author: Sam James  gentoo  org>
AuthorDate: Sat Aug 19 13:35:04 2023 +
Commit: Sam James  gentoo  org>
CommitDate: Sat Aug 19 13:35:04 2023 +
URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=fe8b6d95

misc/emerge-delta-webrsync: fix copyright header, whitespace

Signed-off-by: Sam James  gentoo.org>

 misc/emerge-delta-webrsync | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/misc/emerge-delta-webrsync b/misc/emerge-delta-webrsync
index 8859bd79fe..b2925f0134 100755
--- a/misc/emerge-delta-webrsync
+++ b/misc/emerge-delta-webrsync
@@ -1,5 +1,5 @@
 #!/usr/bin/env bash
-# Copyright 1999-2014 Gentoo Foundation
+# Copyright 1999-2023 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 # Author: Brian Harring , kar...@gentoo.org originally.
 # Rewritten from the old, Perl-based emerge-webrsync script
@@ -374,7 +374,6 @@ check_file_digest() {
return "${r}"
 }
 
-
 check_file_signature_gemato() {
local signature="$1"
local file="$2"



[gentoo-commits] proj/portage:master commit in: misc/, /

2023-08-19 Thread Sam James
commit: 0347637fe5033d3d8eb4fdafa1e86de171934819
Author: Sam James  gentoo  org>
AuthorDate: Sat Aug 19 13:31:19 2023 +
Commit: Sam James  gentoo  org>
CommitDate: Sat Aug 19 13:33:47 2023 +
URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=0347637f

misc/emerge-delta-webrsync: fix pgp verification

Sync the logic with bin/emerge-webrsync to bring in the recent updates
from portage-3.0.47 onwards.

Bug: https://bugs.gentoo.org/911335
Signed-off-by: Sam James  gentoo.org>

 NEWS   |   4 +
 misc/emerge-delta-webrsync | 295 -
 2 files changed, 242 insertions(+), 57 deletions(-)

diff --git a/NEWS b/NEWS
index ad541b95b1..f7e092808a 100644
--- a/NEWS
+++ b/NEWS
@@ -7,6 +7,10 @@ Features:
 * sync: git, rsync: now respects --debug for better output from gemato. This is
   especially useful for debugging hangs during the 'Refreshing keys' stage.
 
+Bug fixes:
+* misc/emerge-delta-webrsync: Fix PGP logic which prevented syncing for this
+  rarely-used tool (bug #911335).
+
 portage-3.0.50 (2023-08-09)
 --
 

diff --git a/misc/emerge-delta-webrsync b/misc/emerge-delta-webrsync
index d4c70fb9c4..8859bd79fe 100755
--- a/misc/emerge-delta-webrsync
+++ b/misc/emerge-delta-webrsync
@@ -19,6 +19,51 @@
 # gpg --homedir /etc/portage/gnupg --edit-key $KEY_ID trust
 #
 
+# Opportunistically use gentoo-functions for nicer output
+functions_script="${EPREFIX:-/}/lib/gentoo/functions.sh"
+source "${functions_script}" || {
+   echo "${argv0}: Could not source ${functions_script}!" 1>&2
+
+   ebegin() {
+   printf '%s*%s %s ... ' "${GOOD}" "${NORMAL}" "$*"
+   }
+
+   eend() {
+   local r=${1:-0}
+   shift
+   if [[ $r -eq 0 ]] ; then
+   printf '[ %sok%s ]\n' "${GOOD}" "${NORMAL}"
+   else
+   printf '%s [ %s!!%s ]\n' "$*" "${BAD}" "${NORMAL}"
+   fi
+   return "${r}"
+   }
+
+   einfo() {
+   echo "${argv0##*/}: $*"
+   }
+
+   ewarn() {
+   echo "${argv0##*/}: warning: $*" 1>&2
+   }
+
+   eerror() {
+   echo "${argv0##*/}: error: $*" 1>&2
+   }
+
+}
+
+# Only echo if in normal mode
+vvecho() { [[ ${PORTAGE_QUIET} != 1 ]] && echo "$@" ; }
+# Only echo if in quiet mode
+nvecho() { [[ ${PORTAGE_QUIET} == 1 ]] && echo "$@" ; }
+
+# Unfortunately, gentoo-functions doesn't yet have a die() (bug #878505)
+die() {
+   eerror "$@"
+   exit 1
+}
+
 argv0=$0
 
 # Only echo if not in verbose mode
@@ -52,13 +97,12 @@ eval "$("${portageq}" envvar -v DISTDIR EPREFIX FEATURES \
USERLAND http_proxy ftp_proxy)"
 export http_proxy ftp_proxy
 
-source "${PORTAGE_BIN_PATH}"/isolated-functions.sh || exit 
+source "${PORTAGE_BIN_PATH}"/isolated-functions.sh || exit
 
 repo_name=gentoo
 repo_location=$(__repo_attr "${repo_name}" location)
 if [[ -z ${repo_location} ]]; then
-   eecho "Repository '${repo_name}' not found"
-   exit 1
+   die "Repository '${repo_name}' not found"
 fi
 
 if [ -z "$NICENESS_PULLED" ]; then
@@ -89,7 +133,12 @@ for x in $*; do
PORTAGE_QUIET=1
continue
;;
+   --no-pgp-verify)
+   no_pgp_verify=1
+   continue
+   ;;
esac
+
if [[ $x == "-u" ]]; then
MUST_SYNC=''
elif [[ $x == "-k" ]]; then
@@ -103,6 +152,7 @@ for x in $*; do
echo "$x isn't a valid arg.  bailing."
fi
if [[ -n $PUKE_HELP ]]; then
+   echo "--no-pgp-verify; disable PGP verification of snapshot 
(note that patches are not verified either way)"
echo "-u for upgrade; sync only if new snapshots are found"
echo "-k for keep; keep old tree snapshots around"
exit -1
@@ -114,35 +164,68 @@ if [[ ! -d $STATE_DIR ]]; then
exit -2
 fi
 
-has webrsync-gpg ${FEATURES} && webrsync_gpg=1 || webrsync_gpg=0
+handle_pgp_setup() {
+   # WEBRSYNC_VERIFY_SIGNATURE=0: disable PGP verification
+   # WEBRSYNC_VERIFY_SIGNATURE=1: use gemato for verification, fallback to 
regular gpg
+   # WEBRSYNC_VERIFY_SIGNATURE=2: use legacy FEATURES="webrsync-gpg"
+   WEBRSYNC_VERIFY_SIGNATURE=1
+
+   has webrsync-gpg ${FEATURES} && webrsync_gpg=1 || webrsync_gpg=0
+
+   repo_has_webrsync_verify=$(
+   has $(__repo_attr "${repo_name}" sync-webrsync-verify-signature 
| LC_ALL=C tr '[:upper:]' '[:lower:]') true yes
+   )
+
+   if [[ -n ${PORTAGE_TEMP_GPG_DIR} ]] || [[ ${repo_has_webrsync_verify} 
-eq 1 ]]; then
+   # If FEATURES=webrsync-gpg is enabled then allow direct 
emerge-webrsync
+   # calls for backward compatibility (this triggers a deprecation 
warning
+   # above). Since direct emerge-webrsync 

[gentoo-commits] proj/portage:master commit in: misc/

2019-12-30 Thread Zac Medico
commit: 82b29bdd12c1ea1002a455c98fa7958311b92ec3
Author: Zac Medico  gentoo  org>
AuthorDate: Mon Dec 30 21:34:29 2019 +
Commit: Zac Medico  gentoo  org>
CommitDate: Mon Dec 30 21:34:29 2019 +
URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=82b29bdd

emerge-delta-webrsync: chmod 755 temp dir (bug 704256)

Before the rsync call, chmod 755 the temporary directory so that the
root directory of the repository will have appropriate permissions.

Fixes: fa0f8720e168 ("emerge-delta-webrsync: handle gentoo-MMDD directory 
name")
Bug: https://bugs.gentoo.org/704256
Signed-off-by: Zac Medico  gentoo.org>

 misc/emerge-delta-webrsync | 1 +
 1 file changed, 1 insertion(+)

diff --git a/misc/emerge-delta-webrsync b/misc/emerge-delta-webrsync
index cda5a9229..082e15e52 100755
--- a/misc/emerge-delta-webrsync
+++ b/misc/emerge-delta-webrsync
@@ -372,6 +372,7 @@ sync_local() {
chown -R ${ownership} "${TMPDIR}"
rsync_opts+=" --owner --group"
fi
+   chmod 755 .
rsync ${rsync_opts} . "${repo_location%%/}"
cd "${DISTDIR}"
 



[gentoo-commits] proj/portage:master commit in: misc/

2019-12-09 Thread Zac Medico
commit: fa0f8720e168c95bcd6a8bd57d5abf09c488fd32
Author: Zac Medico  gentoo  org>
AuthorDate: Mon Dec  9 09:26:55 2019 +
Commit: Zac Medico  gentoo  org>
CommitDate: Mon Dec  9 09:28:50 2019 +
URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=fa0f8720

emerge-delta-webrsync: handle gentoo-MMDD directory name

Bug: https://bugs.gentoo.org/693454
Signed-off-by: Zac Medico  gentoo.org>

 misc/emerge-delta-webrsync | 13 ++---
 1 file changed, 6 insertions(+), 7 deletions(-)

diff --git a/misc/emerge-delta-webrsync b/misc/emerge-delta-webrsync
index c5f6fbbd3..cda5a9229 100755
--- a/misc/emerge-delta-webrsync
+++ b/misc/emerge-delta-webrsync
@@ -332,7 +332,7 @@ check_file_signature() {
 get_snapshot_timestamp() {
local file="$1"
 
-   do_tar "${file}" --to-stdout -xf - portage/metadata/timestamp.x | cut 
-f 1 -d " "
+   do_tar "${file}" --to-stdout -f - --wildcards -x 
'*/metadata/timestamp.x' | cut -f 1 -d " "
 }
 
 sync_local() {
@@ -361,23 +361,22 @@ sync_local() {
return 1
fi
else
-   if ! do_tar "${file}" xf - -C "${TMPDIR}" ; then
+   if ! do_tar "${file}" -x --strip-components=1 -f - -C 
"${TMPDIR}" ; then
eecho "tar failed to extract the image. tarball is 
corrupt? (${file})"
-   rm -fr "${TMPDIR}"/portage
+   rm -fr "${TMPDIR}"
return 1
fi
 
local rsync_opts="${PORTAGE_RSYNC_OPTS} 
${PORTAGE_RSYNC_EXTRA_OPTS}"
-   if chown ${ownership} "${TMPDIR}"/portage > /dev/null 2>&1; then
-   chown -R ${ownership} "${TMPDIR}"/portage
+   if chown ${ownership} "${TMPDIR}" > /dev/null 2>&1; then
+   chown -R ${ownership} "${TMPDIR}"
rsync_opts+=" --owner --group"
fi
-   cd "${TMPDIR}"/portage
rsync ${rsync_opts} . "${repo_location%%/}"
cd "${DISTDIR}"
 
__vecho "Cleaning up ..."
-   rm -fr "${TMPDIR}"/portage
+   rm -fr "${TMPDIR}"
fi
 
if has metadata-transfer ${FEATURES} ; then



[gentoo-commits] proj/portage:master commit in: misc/

2018-07-28 Thread Zac Medico
commit: b8c070708bbc6d0db544d4b04b530d6d03d39bb5
Author: Zac Medico  gentoo  org>
AuthorDate: Sat Jul 28 06:15:53 2018 +
Commit: Zac Medico  gentoo  org>
CommitDate: Sat Jul 28 06:15:53 2018 +
URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=b8c07070

emerge-delta-webrsync: fix vecho command substitution

Since vecho now outputs to stderr, the output has to be redirected
to stdout when command substitution is intended.

Fixes: 2b6210463300 ("isolated-functions.sh: Ensure informational command 
output to stderr")

 misc/emerge-delta-webrsync | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/misc/emerge-delta-webrsync b/misc/emerge-delta-webrsync
index 14e5c7c55..8419e01a9 100755
--- a/misc/emerge-delta-webrsync
+++ b/misc/emerge-delta-webrsync
@@ -342,7 +342,7 @@ sync_local() {
if type -P tarsync > /dev/null ; then
local chown_opts="-o ${ownership%:*} -g ${ownership#*:}"
chown ${ownership} "${repo_location}" > /dev/null 2>&1 || 
chown_opts=""
-   if ! tarsync $(__vecho -v) -s 1 ${chown_opts} \
+   if ! tarsync $(__vecho -v 2>&1) -s 1 ${chown_opts} \
-e /distfiles -e /packages -e /local "${file}" 
"${repo_location}"; then
eecho "tarsync failed; tarball is corrupt? (${file})"
return 1



[gentoo-commits] proj/portage:master commit in: misc/

2018-07-28 Thread Zac Medico
commit: dd307922c584faa8be13468261dbedb0cc65b181
Author: Zac Medico  gentoo  org>
AuthorDate: Fri Jul 27 06:30:36 2018 +
Commit: Zac Medico  gentoo  org>
CommitDate: Sat Jul 28 05:53:08 2018 +
URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=dd307922

emerge-delta-webrsync: exit early for signature problem (bug 661838)

Exit early after signature verification failure, since it's
typically inappropriate to try other mirrors in this case
(it may indicate a keyring problem).

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

 misc/emerge-delta-webrsync | 7 +++
 1 file changed, 7 insertions(+)

diff --git a/misc/emerge-delta-webrsync b/misc/emerge-delta-webrsync
index 868c6a347..ebaa616f9 100755
--- a/misc/emerge-delta-webrsync
+++ b/misc/emerge-delta-webrsync
@@ -283,6 +283,13 @@ check_file_signature() {
fi
done <<< "${gnupg_status}"
fi
+   if [[ ${r} -ne 0 ]]; then
+   # Exit early since it's typically inappropriate 
to
+   # try other mirrors in this case (it may 
indicate
+   # a keyring problem).
+   eecho "signature verification failed"
+   exit 1
+   fi
else
eecho "cannot check signature: gpg binary not found"
exit 1



[gentoo-commits] proj/portage:master commit in: misc/, man/, lib/portage/sync/modules/webrsync/

2018-07-28 Thread Zac Medico
commit: f810f8694f78dd87172e38d942580532017db4fe
Author: Zac Medico  gentoo  org>
AuthorDate: Fri Jul 27 07:05:03 2018 +
Commit: Zac Medico  gentoo  org>
CommitDate: Sat Jul 28 05:54:43 2018 +
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  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 , kar...@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



[gentoo-commits] proj/portage:master commit in: misc/

2018-01-31 Thread Zac Medico
commit: 52d5d444ffb144911ca9b6e70b383405a8bd8af6
Author: Zac Medico  gentoo  org>
AuthorDate: Thu Feb  1 06:16:45 2018 +
Commit: Zac Medico  gentoo  org>
CommitDate: Thu Feb  1 06:16:45 2018 +
URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=52d5d444

emerge-delta-webrsync: uses gpg --status-fd

 misc/emerge-delta-webrsync | 11 ++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/misc/emerge-delta-webrsync b/misc/emerge-delta-webrsync
index f2dc8220c..868c6a347 100755
--- a/misc/emerge-delta-webrsync
+++ b/misc/emerge-delta-webrsync
@@ -267,13 +267,22 @@ check_file_signature() {
local signature="$1"
local file="$2"
local r=1
+   local gnupg_status line
 
if [[ ${WEBSYNC_VERIFY_SIGNATURE} != 0 ]] ; then
 
__vecho "Checking signature ..."
 
if type -P gpg > /dev/null; then
-   gpg --homedir "${PORTAGE_GPG_DIR}" --verify 
"$signature" "$file" && r=0
+   if gnupg_status=$(gpg --homedir "${PORTAGE_GPG_DIR}" 
--batch \
+   --status-fd 1 --verify "${signature}" 
"${file}"); then
+   while read -r line; do
+   if [[ ${line} == "[GNUPG:] GOODSIG"* 
]]; then
+   r=0
+   break
+   fi
+   done <<< "${gnupg_status}"
+   fi
else
eecho "cannot check signature: gpg binary not found"
exit 1



[gentoo-commits] proj/portage:master commit in: misc/

2015-11-05 Thread Zac Medico
commit: d2ae2f85a34e27a6b458cb51cac008686911e8ce
Author: Xiami  f2light  com>
AuthorDate: Fri Nov  6 05:24:48 2015 +
Commit: Zac Medico  gentoo  org>
CommitDate: Fri Nov  6 05:30:44 2015 +
URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=d2ae2f85

emerge-delta-webrsync: fix incorrect bzip2 file path argument

 misc/emerge-delta-webrsync | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/misc/emerge-delta-webrsync b/misc/emerge-delta-webrsync
index 05a0ac7..f2dc822 100755
--- a/misc/emerge-delta-webrsync
+++ b/misc/emerge-delta-webrsync
@@ -754,7 +754,7 @@ if [ "$verified" == "1" ]; then
rm -f "${TMPDIR}/portage-${final_date}.tar"
 else
echo "recompressing."
-   bzip2 -v9 "${TMPDIR}/portage-${final_date}.tar.bz2"
+   bzip2 -v9 "${TMPDIR}/portage-${final_date}.tar"
 fi
 
 echo "verifying generated tarball"



[gentoo-commits] proj/portage:master commit in: misc/

2014-10-19 Thread Zac Medico
commit: 84bba68958ccf8d84a271f110fdb858e4f7700b4
Author: Zac Medico zmedico AT gentoo DOT org
AuthorDate: Wed Oct  8 17:56:31 2014 +
Commit: Zac Medico zmedico AT gentoo DOT org
CommitDate: Sun Oct 19 17:18:10 2014 +
URL:
http://sources.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=84bba689

emerge-delta-webrsync: fix bug #506192

This fixes the sync_local function so that it doesn't prematurely remove
the whole TMPDIR when tarsync is not installed. In this case, we really
only want to remove the ${TMPDIR}/portage directory which contains a
temporary copy of the portage tree. The faulty code was introduced in
commit 24f6a9599bcf445c468022264cd6952aad4d4076 when a bunch of code
from emerge-webrsync was merged into emerge-delta-webrsync.

Fixes: 24f6a9599bcf (emerge-delta-webrsync: check full snapshot sig)
X-Gentoo-Bug: 506192
X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=506192

---
 misc/emerge-delta-webrsync | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/misc/emerge-delta-webrsync b/misc/emerge-delta-webrsync
index a412ac8..05a0ac7 100755
--- a/misc/emerge-delta-webrsync
+++ b/misc/emerge-delta-webrsync
@@ -333,7 +333,7 @@ sync_local() {
cd ${DISTDIR}
 
__vecho Cleaning up ...
-   rm -fr ${TMPDIR}
+   rm -fr ${TMPDIR}/portage
fi
 
if has metadata-transfer ${FEATURES} ; then



[gentoo-commits] proj/portage:master commit in: misc/, bin/

2014-09-24 Thread Zac Medico
commit: 779a9e686d89e31af43e33b1163b01aeff65d7ea
Author: Zac Medico zmedico AT gentoo DOT org
AuthorDate: Wed Sep 24 16:47:58 2014 +
Commit: Zac Medico zmedico AT gentoo DOT org
CommitDate: Wed Sep 24 16:47:58 2014 +
URL:
http://sources.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=779a9e68

emerge-webrsync: fix bug #523494

Use PATH instead of PORTAGE_BIN_PATH to locate emerge.

Fixes: 0cc4c1ac21a2 (Install Portage using setup.py)
X-Gentoo-Bug: 523494
X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=523494

---
 bin/emerge-webrsync| 4 ++--
 misc/emerge-delta-webrsync | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/bin/emerge-webrsync b/bin/emerge-webrsync
index 2f0689c..2443c2d 100755
--- a/bin/emerge-webrsync
+++ b/bin/emerge-webrsync
@@ -249,12 +249,12 @@ sync_local() {
 
if has metadata-transfer ${FEATURES} ; then
__vecho Updating cache ...
-   ${PORTAGE_BIN_PATH}/emerge --metadata
+   emerge --metadata
fi
local post_sync=${PORTAGE_CONFIGROOT}etc/portage/bin/post_sync
[ -x ${post_sync} ]  ${post_sync}
# --quiet suppresses output if there are no relevant news items
-   has news ${FEATURES}  ${PORTAGE_BIN_PATH}/emerge --check-news 
--quiet
+   has news ${FEATURES}  emerge --check-news --quiet
return 0
 }
 

diff --git a/misc/emerge-delta-webrsync b/misc/emerge-delta-webrsync
index 96564af..a412ac8 100755
--- a/misc/emerge-delta-webrsync
+++ b/misc/emerge-delta-webrsync
@@ -338,12 +338,12 @@ sync_local() {
 
if has metadata-transfer ${FEATURES} ; then
__vecho Updating cache ...
-   ${PORTAGE_BIN_PATH}/emerge --metadata
+   emerge --metadata
fi
local post_sync=${PORTAGE_CONFIGROOT}etc/portage/bin/post_sync
[ -x ${post_sync} ]  ${post_sync}
# --quiet suppresses output if there are no relevant news items
-   has news ${FEATURES}  ${PORTAGE_BIN_PATH}/emerge --check-news 
--quiet
+   has news ${FEATURES}  emerge --check-news --quiet
return 0
 }