public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-commits] proj/portage:master commit in: misc/
@ 2012-08-18  0:09 Zac Medico
  0 siblings, 0 replies; 32+ messages in thread
From: Zac Medico @ 2012-08-18  0:09 UTC (permalink / raw
  To: gentoo-commits

commit:     44b0faa3b84c1fd39ef72f58677ed3bcd6c82109
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Fri Aug 17 23:38:40 2012 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Fri Aug 17 23:57:37 2012 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=44b0faa3

emerge-delta-webrsync: import version 3.5.1-r3

---
 misc/emerge-delta-webrsync |  512 ++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 512 insertions(+), 0 deletions(-)

diff --git a/misc/emerge-delta-webrsync b/misc/emerge-delta-webrsync
new file mode 100755
index 0000000..6e1f5cf
--- /dev/null
+++ b/misc/emerge-delta-webrsync
@@ -0,0 +1,512 @@
+#!/bin/bash
+# Copyright 1999-2004 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# Author: Brian Harring <ferringb@gentoo.org>, karltk@gentoo.org originally.
+# Rewritten from the old, Perl-based emerge-webrsync script
+
+#-------------------
+#initialization
+#------------------
+
+f=$(python -c 'import portage, sys; sys.stdout.write("|".join([portage.settings[x] for x in ("PORTAGE_NICENESS", "FEATURES", "GENTOO_MIRRORS", "PORTDIR", "FETCHCOMMAND", "USERLAND", "DISTDIR", "PORTAGE_TMPDIR")]))')
+
+IFS='|'
+PORTAGE_NICENESS="${f%%|*}";	f="${f#*|}"
+FEATURES="${f%%|*}"	  ; 		f="${f#*|}"
+GENTOO_MIRRORS="${f%%|*}" ; 		f="${f#*|}"
+PORTDIR="${f%%|*}"	 ;		f="${f#*|}"
+FETCHCOMMAND="${f%%|*}"	 ;		f="${f#*|}"
+USERLAND="${f%%|*}"	 ;		f="${f#*|}"
+DISTDIR="${f%%|*}"	 ;		f="${f#*|}"
+TMPDIR="${f%%|*}/snapshots"
+unset IFS
+
+source /usr/lib/portage/bin/isolated-functions.sh || exit 1
+
+if [ -z "$NICENESS_PULLED" ]; then
+	if [ -n "${PORTAGE_NICENESS}" ]; then
+		export NICENESS_PULLED=asdf
+		exec nice -n "${PORTAGE_NICENESS}" "$0" "$@"
+		echo "failed setting PORTAGE_NICENESS to '$PORTAGE_NICENESS', disabling"
+	fi
+fi
+
+STATE_DIR="/var/delta-webrsync/"
+
+# hack.  bug 92224
+if [ "${FETCHCOMMAND/getdelta.sh}" != "${FETCHCOMMAND}" ]; then
+	# evil evil evil evil
+	eval "$(grep FETCHCOMMAND /etc/make.globals)"
+fi
+
+unset f
+unset IFS
+
+MUST_SYNC='1'
+unset PUKE_HELP wgetops
+for x in $*; do
+	if [[ $x == "-u" ]]; then
+		MUST_SYNC=''
+	elif [[ $x == "-k" ]]; then
+		KEEP_OLDIES='asdf'
+	elif [[ $x == "-h" ]]; then
+		PUKE_HELP=1
+	elif [[ $x == "-v" ]]; then
+		wgetops=
+	else
+		PUKE_HELP=1
+		echo "$x isn't a valid arg.  bailing."
+	fi
+	if [[ -n $PUKE_HELP ]]; then
+		echo "-u for upgrade; sync only if new snapshots are found"
+		echo "-k for keep; keep old tree snapshots around"
+		exit -1
+	fi
+done
+
+if [[ ! -d $STATE_DIR ]]; then
+	echo "$STATE_DIR doesn't exist.  don't have the ability to compensate for compressor differences without it!"
+	exit -2
+fi
+
+if [[ ! -d $DISTDIR ]] ; then
+	mkdir -p $DISTDIR
+fi
+if [[ ! -d $TMPDIR ]]; then
+	mkdir -p $TMPDIR
+fi
+
+cd "$DISTDIR"
+
+found=0
+if [ "${wgetops-UNSET}" == "unset" ]; then
+	#this sucks.  probably better to do 1> /dev/null
+	#that said, waiting on the refactoring.
+	if [ "${FETCHCOMMAND/wget}" != "${FETCHCOMMAND}" ]; then
+		wgetops="-q"
+	elif [ "${FETCHCOMMAND/curl}" != "${FETCHCOMMAND}" ]; then
+		wgetops="-s -f"
+	fi
+fi
+
+if type -p md5sum > /dev/null; then
+	md5_com='md5sum -c "${MD5_LOC}" &> /dev/null'
+elif type -p md5 > /dev/null; then
+	md5_com='[ "$(md5 -q ${FILE})" == "$(cut -d \  -f 1 ${MD5_LOC})" ]'
+else
+	echo "warning, unable to do md5 verification of the snapshot!"
+	echo "no suitable md5/md5sum binary was found!"
+	md5_com='true'
+fi
+
+#---------------
+#funcs
+#---------------
+
+cleanse_state_dir() {
+	[[ ${STATE_DIR:-/} != '/' ]] && rm ${STATE_DIR}/* &> /dev/null;
+}
+
+full_version_attempt() {
+	local FILE file_exists
+	echo "Fetching most recent snapshot"
+	declare -i attempts=-1
+	while (( $attempts <  40 )) ; do
+		unset file_exists
+		attempts=$(( attempts + 1 ))
+
+		#this too, sucks.  it works in the interim though.
+		if [ "$USERLAND" == "BSD" ] || [ "$USERLAND" == "Darwin" ] ; then
+			daysbefore=$(expr $(date +"%s") - 86400 \* $attempts)
+			day=$(date -r $daysbefore +"%d")
+			month=$(date -r $daysbefore +"%m")
+			year=$(date -r $daysbefore +"%Y")
+		else
+			day=$(date -d "-$attempts day" +"%d")
+			month=$(date -d "-$attempts day" +"%m")
+			year=$(date -d "-$attempts day" +"%Y")
+		fi
+
+		FILE="portage-${year}${month}${day}.tar.bz2"
+
+		echo "Attempting to fetch file dated: ${year}${month}${day}"
+		
+		got_md5=0
+
+		if [  ! -e "${FILE}.md5sum" ]; then
+			fetch_from_mirrors "/snapshots/${FILE}.md5sum" "${FILE}.md5sum"
+			got_md5=$?
+		else
+			file_exists='asdf'
+			got_md5=0
+		fi
+
+		if [[ $got_md5 != 0 ]]; then
+			echo " --- No md5sum present on the mirror. (Not yet available.)"
+			continue
+		elif [ -s "${FILE}" ]; then
+			if verify_md5_file "$FILE"; then
+				echo " === snapshot $FILE is correct, using it"
+				if [[ -n $MUST_SYNC ]] || [[ -z file_exists ]]; then
+					sync_local "${FILE}"
+					echo
+					echo " === Snapshot has been sync'd"
+					echo
+				else
+					echo
+					echo "skipped sync"
+					echo
+				fi
+				exit 0
+			else
+				echo "md5 on ${FILE} failed, removing it and starting anew"
+				rm "$FILE" &> /dev/null
+			fi
+		fi
+	
+		if fetch_from_mirrors "/snapshots/${FILE}" "${FILE}"; then
+			if ! verify_md5_file "$FILE"; then
+				echo "md5 failed on $FILE"
+				rm ${FILE} &> /dev/null
+				continue
+			else
+				sync_local "${FILE}"
+				cleanse_state_dir
+				echo
+				echo " *** Completed websync, please now perform a normal rsync if possible."
+				echo "     Update is current as of YYYYMMDD: ${year}${month}${day}"
+				echo
+				exit 0
+			fi
+		fi
+
+	done
+	exit 1
+}
+
+
+sync_local() {
+	local FILE flags
+	FILE="$1"
+	if [ "${FILE/\/}" == "${FILE}" ]; then
+		FILE="${DISTDIR}/${FILE}";
+	fi
+	
+	echo Syncing local tree...
+	if type -p tarsync &> /dev/null; then
+		echo "apparently you have tarsync installed.  using it."
+		if ! tarsync "${FILE}" "${PORTDIR}" -v -s 1 -o portage -g portage -e /distfiles -e /packages -e /local; then
+			echo "ok, tarsync failed.  that's teh suck :/"
+			exit 6
+		fi
+	else
+		cd ${TMPDIR} || die "couldn't cd to tmpdir, $TMPDIR!?"
+		flags="xf"
+		if [ "${FILE%.bz2}" != "${FILE}" ]; then
+			flags="jxf"
+		fi
+		if ! tar ${flags} "$FILE"; then
+			echo "Tar failed to extract the image. Please review the output."
+			echo "Executed command: tar jxf $FILE"
+			exit 1
+		fi
+		# Make sure user and group file ownership is root
+		chown -R 0:0 portage
+		cd portage
+		rsync -av --progress --stats --delete --delete-after \
+		--exclude='/distfiles' --exclude='/packages' \
+		--exclude='/local' . ${PORTDIR%%/}
+		cd ..
+		echo "cleaning up"
+		rm -rf portage
+	fi
+	if has metadata-transfer ${FEATURES} ; then
+		echo "transferring metadata/cache"
+		emerge --metadata
+	fi
+	local post_sync=/etc/portage/bin/post_sync
+	[[ -x "${post_sync}" ]] && ${post_sync}
+}
+
+fetch_from_mirrors() {
+	local i URI FILE MIRRORS
+	if [[ "$#" == 3 ]]; then
+		MIRRORS="${3}"
+	else
+		MIRRORS=$GENTOO_MIRRORS
+	fi
+	FILE="$2"
+	for i in $MIRRORS ; do
+		URI="${i}/${1}"
+		if (eval "$FETCHCOMMAND $wgetops") && [ -s "${FILE}" ]; then
+			return 0
+		else
+			rm "${FILE}" &> /dev/null
+		fi
+	done
+	return 1
+}
+
+verify_md5_file() {
+	local FILE MD5_LOC CUR
+	FILE="$1"
+	if [[ $# == 2 ]]; then
+		MD5_LOC="$2"
+	else
+		MD5_LOC="$(pwd)/$1.md5sum"
+	fi
+	if [ "${FILE/*\/}" != "$1" ]; then
+		CUR="$(pwd)"
+		cd "$(dirname ${FILE})"
+		FILE="$(basename ${FILE})"
+	fi
+	if eval "$md5_com"; then
+		[ -n "${CUR}" ] && cd "${CUR}"
+		return 0
+	else
+		[ -n "${CUR}" ] && cd "${CUR}"
+		return 1
+	fi
+}
+
+
+#--------------------
+#inline actual script
+#--------------------
+
+if ! type -p patcher &> /dev/null; then
+	echo "!!!"
+	echo "!!! cannot find patcher, did you emerge dev-util/diffball?"
+	echo "!!! lack of patcher == have to do full fetch"
+	echo "!!!"
+	sleep 10
+	full_version_attempt
+fi
+
+echo "Looking for available base versions for a delta"
+
+#note we're already in distdir
+
+unset base_version
+# portage-snapshots in reverse order.
+# icky.
+unset dfile
+potentials="$(ls -1 portage-2[[:digit:]][[:digit:]][[:digit:]][[:digit:]][[:digit:]][[:digit:]][[:digit:]].tar.bz2 ${STATE_DIR}/portage-2[[:digit:]][[:digit:]][[:digit:]][[:digit:]][[:digit:]][[:digit:]][[:digit:]].tar.bz2 2> /dev/null | sed -e 's:^.*/::' | sort -r)"
+for basef in ${potentials}; do
+	chksum=''
+	found="dar"
+	if [ -e "${STATE_DIR}/${basef}.md5sum" ]; then
+		chksum="${STATE_DIR}/${basef}.md5sum"
+	elif [ -e "${basef}.md5sum" ]; then
+		chksum="${DISTDIR}/${basef}.md5sum"
+	else
+		echo "attempting to get md5sum for $basef"
+		if ! fetch_from_mirrors "/snapshots/${basef}.md5sum" "${basef}.md5sum"; then
+			echo "can't get md5 for ${basef}"
+			continue
+		fi
+		chksum="${basef}.md5sum"
+	fi
+	if [ -e "${basef}" ]; then
+		dfile="${DISTDIR}/${basef}"
+	else
+		dfile="${STATE_DIR}/${basef}"
+	fi
+	if ! verify_md5_file "${dfile}" "${chksum}"; then
+		echo "found a stale snapshot.  cleansing"
+		rm "${dfile}" &> /dev/null
+		rm "${chksum}.md5sum" &> /dev/null
+		dar=""
+	else
+		base_version="${basef}"
+		break
+	fi
+done
+
+#by this point, we either have a base_version, or we don't.
+if [[ -z ${base_version} ]]; then
+	echo "no base found.  resorting to pulling a full version"
+	full_version_attempt
+fi
+
+#we have a md5 verified base.  now we get the patch.
+
+base_date="${base_version%.tar.bz2}"
+base_date="${base_date#portage-}"
+# we now have yyyymmdd
+
+unset patch_dates
+if [ "$USERLAND" == "BSD" ] || [ "$USERLAND" == "Darwin" ] ; then
+	daysbefore=$(expr $(date +"%s") - 86400 \* $attempts)
+	day=$(date -r $daysbefore +"%d")
+	month=$(date -r $daysbefore +"%m")
+	year=$(date -r $daysbefore +"%Y")
+else
+	day=$(date -d "-$attempts day" +"%d")
+	month=$(date -d "-$attempts day" +"%m")
+	year=$(date -d "-$attempts day" +"%Y")
+fi
+
+#todays_date="${year}${month}${day}"
+
+next_date() {
+	local year day month
+	year="${1:0:4}"
+	month="${1:4:2}"
+	day="${1:6:2}"
+#	if [[ "${USERLAND}" == "BSD" ]] || [[ "${USERLAND}" == "Darwin" ]]; then
+#	else
+		date -d "$year/$month/$day +1 day" +"%Y%m%d"
+#	fi
+}
+
+patches=''
+echo "fetching patches"
+fetched='asdf'
+while [[ -n ${fetched} ]]; do
+	next_day=$(next_date ${base_date})
+	# if we can't get a *single* patch or md5, even one missing, do full.
+	p="snapshot-${base_date}-${next_day}.patch.bz2"
+	if [[ ! -e ${p}.md5sum ]] && ! fetch_from_mirrors "/snapshots/deltas/${p}.md5sum" "${p}.md5sum"; then
+		echo "failed fetching ${p}.md5sum"
+		fetched=''
+		break
+	fi
+	fetch="yes"
+	if [[ -e ${p} ]]; then
+		if ! verify_md5_file "${p}"; then
+			rm ${p} &> /dev/null
+		else
+			fetch=""
+		fi
+	fi
+	if [[ -n $fetch ]]; then
+		if ! fetch_from_mirrors "/snapshots/deltas/${p}" "${p}"; then
+			echo "failed fetching ${p}"
+			fetched=''
+		fi
+	fi
+	if [[ -z ${fetched} ]]; then
+		break
+	fi
+	if ! verify_md5_file "${p}"; then
+		echo "md5 failed on ${p}"
+		fetched=''
+		break
+	fi
+	patches="${patches} ${p}"
+	base_date="${next_day}"
+done
+final_date=${base_date}
+
+if [[ -z $patches ]]; then
+	echo "no patches found? up to date?"
+	if [[ -n $MUST_SYNC ]]; then
+		echo "syncing with existing file"
+		sync_local "${dfile}"
+	else
+		:
+	fi
+	exit $?
+fi
+
+unset got_umd5
+#grab the md5 for later usage.
+if [[ ! -e portage-${final_date}.tar.bz2.md5sum ]] && ! fetch_from_mirrors "/snapshots/portage-${final_date}.tar.bz2.md5sum" "portage-${final_date}.tar.bz2.md5sum"; then
+	echo "warning... couldn't grab the md5sum for ${final_date}.  which is odd"
+	echo "thus, bailing (sorry)"
+	exit 5
+else
+	if [[ ! -e portage-${final_date}.tar.bz2.umd5sum ]] && ! fetch_from_mirrors "/snapshots/portage-${final_date}.tar.bz2.umd5sum" "portage-${final_date}.tar.bz2.umd5sum"; then
+		if ! fetch_from_mirrors "/snapshots/portage-${final_date}.tar.bz2.umd5sum" "portage-${final_date}.tar.bz2.umd5sum"; then
+			echo "couldn't grab umd5sum (uncompressed md5sum) for ${final_date}."
+			echo "can't compensate for bzip2 version differences iow."
+		else
+			got_umd5=1
+		fi
+	else
+		got_umd5=1
+	fi
+fi
+	
+# generate tmp dir.
+TEMPDIR=$(mktemp -d /tmp/delta-webrsync-XXXXXX)
+# got our patches.
+if ! patcher -v "${dfile}" ${patches} "${TEMPDIR}/portage-${final_date}.tar"; then
+	echo "reconstruction failed (contact the author with the error from the reconstructor please)"
+	rm "${TEMPDIR}/portage-${final_date}.tar"
+	rmdir ${TEMPDIR}
+	full_version_attempt
+fi
+verified=0
+if [[ -n $got_umd5 ]]; then
+	echo "verifying uncompressed md5"
+	if ! verify_md5_file "${TEMPDIR}/portage-${final_date}.tar" "${DISTDIR}/portage-${final_date}.tar.bz2.umd5sum"; then
+		echo "uncompressed verification failed.  This means either you found a bug in diffball, or something odd is going on"
+		echo "with upstream patch generation"
+		echo "trying md5sum next, which probably will fail."
+	else
+		verified="1"
+	fi
+fi
+
+unset need_last_sync
+if [ "$verified" == "1" ]; then
+	echo "recompressing. (backgrounding)"
+	need_last_sync="dar"
+	bzip2 -vk9 "${TEMPDIR}/portage-${final_date}.tar" &
+
+	echo "beginning update to the tree"
+	sync_local "${TEMPDIR}/portage-${final_date}.tar"
+	echo "doing final md5 stuff"
+	wait
+	# bzip2 is finished now.
+	rm "${TEMPDIR}/portage-${final_date}.tar"
+else
+	echo "recompressing."
+	bzip2 -v9 "${TEMPDIR}/portage-${final_date}.tar.bz2"
+fi
+
+echo "verifying generated tarball"
+
+if ! verify_md5_file "${TEMPDIR}/portage-${final_date}.tar.bz2" "${DISTDIR}/portage-${final_date}.tar.bz2.md5sum"; then
+	if [[ -z $verified ]]; then
+		echo "couldn't verify the generated tarball.  bug, most likely."
+		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 "saving the md5"
+	if type -p md5sum &> /dev/null; then
+		md5sum ${TEMPDIR}/portage-${final_date}.tar.bz2 | sed -e "s:${TEMPDIR}/\?::" > \
+			${STATE_DIR}/portage-${final_date}.tar.bz2.md5sum
+	elif type -p md5 &> /dev/null; then
+		echo "$(md5 -q ${TEMPDIR}/portage-${final_date}.tar.bz2)  portage-${final_date}.tar.bz2" > \
+			${STATE_DIR}/portage-${final_date}.tar.bz2.md5sum
+	else
+		echo "couldn't find either md5 or md5sum.  something is screwed... (bailing, sorry)"
+		exit 7
+	fi
+	mv "${DISTDIR}/portage-${final_date}.tar.bz2.umd5sum" "${TEMPDIR}/portage-${final_date}.tar.bz2" ${STATE_DIR}/
+	rmdir ${TEMPDIR}
+	dfile="${STATE_DIR}/portage-${final_date}.tar.bz2"
+else
+	dfile="${DISTDIR}/portage-${final_date}.tar.bz2"
+	mv "${TEMPDIR}/portage-${final_date}.tar.bz2" ${DISTDIR}/
+fi
+
+if [ -z "${need_last_sync}" ]; then
+	echo "beginning update to the tree"
+	sync_local "${dfile}"
+fi
+
+if [[ -z $KEEP_OLDIES ]]; then
+	echo "cleansing"
+	for x in $potentials; do
+		echo "removing ${x}"
+		rm "${DISTDIR}/${x}" "${DISTDIR}/${x}.md5sum" &> /dev/null
+		rm "${STATE_DIR}/${x}" "${STATE_DIR}/${x}.md5sum" "${STATE_DIR}/${x}.umd5sum" &> /dev/null
+	done
+fi
+echo "done."
+


^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [gentoo-commits] proj/portage:master commit in: misc/
@ 2012-08-18  1:28 Zac Medico
  0 siblings, 0 replies; 32+ messages in thread
From: Zac Medico @ 2012-08-18  1:28 UTC (permalink / raw
  To: gentoo-commits

commit:     f6b15499b54b9b7766cf3cd4b0a053cff76c9749
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Sat Aug 18 00:27:18 2012 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Sat Aug 18 00:27:18 2012 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=f6b15499

emerge-delta-webrsync: call portageq for config

---
 misc/emerge-delta-webrsync |   41 ++++++++++++++++++++++++++---------------
 1 files changed, 26 insertions(+), 15 deletions(-)

diff --git a/misc/emerge-delta-webrsync b/misc/emerge-delta-webrsync
index 6e1f5cf..729188b 100755
--- a/misc/emerge-delta-webrsync
+++ b/misc/emerge-delta-webrsync
@@ -1,27 +1,38 @@
 #!/bin/bash
-# Copyright 1999-2004 Gentoo Foundation
+# Copyright 1999-2012 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
 # Author: Brian Harring <ferringb@gentoo.org>, karltk@gentoo.org originally.
 # Rewritten from the old, Perl-based emerge-webrsync script
 
+argv0=$0
+
+# error echos
+eecho() { echo "${argv0##*/}: error: $*" 1>&2 ; }
+
 #-------------------
 #initialization
 #------------------
 
-f=$(python -c 'import portage, sys; sys.stdout.write("|".join([portage.settings[x] for x in ("PORTAGE_NICENESS", "FEATURES", "GENTOO_MIRRORS", "PORTDIR", "FETCHCOMMAND", "USERLAND", "DISTDIR", "PORTAGE_TMPDIR")]))')
-
-IFS='|'
-PORTAGE_NICENESS="${f%%|*}";	f="${f#*|}"
-FEATURES="${f%%|*}"	  ; 		f="${f#*|}"
-GENTOO_MIRRORS="${f%%|*}" ; 		f="${f#*|}"
-PORTDIR="${f%%|*}"	 ;		f="${f#*|}"
-FETCHCOMMAND="${f%%|*}"	 ;		f="${f#*|}"
-USERLAND="${f%%|*}"	 ;		f="${f#*|}"
-DISTDIR="${f%%|*}"	 ;		f="${f#*|}"
-TMPDIR="${f%%|*}/snapshots"
-unset IFS
-
-source /usr/lib/portage/bin/isolated-functions.sh || exit 1
+# Use portageq from the same directory/prefix as the current script, so
+# that we don't have to rely on PATH including the current EPREFIX.
+scriptpath=${BASH_SOURCE[0]}
+if [ -x "${scriptpath%/*}/portageq" ]; then
+	portageq=${scriptpath%/*}/portageq
+elif type -P portageq > /dev/null ; then
+	portageq=portageq
+else
+	eecho "could not find 'portageq'; aborting"
+	exit 1
+fi
+eval $("${portageq}" envvar -v DISTDIR FEATURES FETCHCOMMAND GENTOO_MIRRORS \
+	PORTAGE_BIN_PATH PORTAGE_GPG_DIR \
+	PORTAGE_NICENESS PORTAGE_RSYNC_EXTRA_OPTS \
+	PORTAGE_RSYNC_OPTS PORTAGE_TMPDIR PORTDIR \
+	USERLAND http_proxy ftp_proxy)
+export http_proxy ftp_proxy
+TMPDIR=${PORTAGE_TMPDIR}/snapshots
+
+source "${PORTAGE_BIN_PATH}"/isolated-functions.sh || exit 1
 
 if [ -z "$NICENESS_PULLED" ]; then
 	if [ -n "${PORTAGE_NICENESS}" ]; then


^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [gentoo-commits] proj/portage:master commit in: misc/
@ 2012-08-18  1:28 Zac Medico
  0 siblings, 0 replies; 32+ messages in thread
From: Zac Medico @ 2012-08-18  1:28 UTC (permalink / raw
  To: gentoo-commits

commit:     79674c13905962dc380ea4f951233d4cada32f5b
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Sat Aug 18 00:47:57 2012 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Sat Aug 18 00:47:57 2012 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=79674c13

emerge-delta-webrsync: support gpg verification

This will fix bug #286373.

BUG: Signature verification will fail if the local bzip2 program does
not produce output that is perfectly identical to the bzip2 program
used to compress the signed tar file.

---
 misc/emerge-delta-webrsync |   62 +++++++++++++++++++++++++++++++++++++++++--
 1 files changed, 59 insertions(+), 3 deletions(-)

diff --git a/misc/emerge-delta-webrsync b/misc/emerge-delta-webrsync
index 5df9658..2f73c90 100755
--- a/misc/emerge-delta-webrsync
+++ b/misc/emerge-delta-webrsync
@@ -4,6 +4,13 @@
 # Author: Brian Harring <ferringb@gentoo.org>, karltk@gentoo.org originally.
 # Rewritten from the old, Perl-based emerge-webrsync script
 
+#
+# gpg key import
+# KEY_ID=0x96D8BF6D
+# gpg --homedir /etc/portage/gnupg --keyserver subkeys.pgp.net --recv-keys $KEY_ID
+# gpg --homedir /etc/portage/gnupg --edit-key $KEY_ID trust
+#
+
 argv0=$0
 
 # error echos
@@ -80,6 +87,16 @@ if [[ ! -d $STATE_DIR ]]; then
 	exit -2
 fi
 
+if has webrsync-gpg ${FEATURES} ; then
+	WEBSYNC_VERIFY_SIGNATURE=1
+else
+	WEBSYNC_VERIFY_SIGNATURE=0
+fi
+if [ ${WEBSYNC_VERIFY_SIGNATURE} != 0 -a -z "${PORTAGE_GPG_DIR}" ]; then
+	eecho "please set PORTAGE_GPG_DIR in make.conf"
+	exit 1
+fi
+
 if [[ ! -d $DISTDIR ]] ; then
 	mkdir -p $DISTDIR
 fi
@@ -280,6 +297,27 @@ verify_md5_file() {
 	fi
 }
 
+check_file_signature() {
+	local signature="$1"
+	local file="$2"
+	local r=1
+
+	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
+		else
+			eecho "cannot check signature: gpg binary not found"
+			exit 1
+		fi
+	else
+		r=0
+	fi
+
+	return "${r}"
+}
 
 #--------------------
 #inline actual script
@@ -439,7 +477,14 @@ else
 		got_umd5=1
 	fi
 fi
-	
+
+if [[ ${WEBSYNC_VERIFY_SIGNATURE} == 1 && ! -e portage-${final_date}.tar.bz2.gpgsig ]] && \
+	! fetch_from_mirrors "/snapshots/portage-${final_date}.tar.bz2.gpgsig" "portage-${final_date}.tar.bz2.gpgsig" ; then
+	echo "warning... couldn't grab the gpgsig for ${final_date}.  which is odd"
+	echo "thus, bailing (sorry)"
+	exit 5
+fi
+
 # generate tmp dir.
 TEMPDIR=$(mktemp -d /tmp/delta-webrsync-XXXXXX)
 # got our patches.
@@ -465,7 +510,15 @@ unset need_last_sync
 if [ "$verified" == "1" ]; then
 	echo "recompressing. (backgrounding)"
 	need_last_sync="dar"
-	bzip2 -vk9 "${TEMPDIR}/portage-${final_date}.tar" &
+	if [[ ${WEBSYNC_VERIFY_SIGNATURE} == 1 ]] ; then
+		# BUG: Signature verification will fail if the local bzip2
+		# program does not produce output that is perfectly identical
+		# to the bzip2 program used to compress the signed tar file.
+		bzip2 -vk9 "${TEMPDIR}/portage-${final_date}.tar"
+		check_file_signature "${DISTDIR}/portage-${final_date}.tar.bz2.gpgsig" "${TEMPDIR}/portage-${final_date}.tar.bz2" || exit 1
+	else
+		bzip2 -vk9 "${TEMPDIR}/portage-${final_date}.tar" &
+	fi
 
 	echo "beginning update to the tree"
 	sync_local "${TEMPDIR}/portage-${final_date}.tar"
@@ -507,6 +560,9 @@ else
 fi
 
 if [ -z "${need_last_sync}" ]; then
+	if [[ ${WEBSYNC_VERIFY_SIGNATURE} == 1 ]] ; then
+		check_file_signature "${DISTDIR}/portage-${final_date}.tar.bz2.gpgsig" "${dfile}" || exit 1
+	fi
 	echo "beginning update to the tree"
 	sync_local "${dfile}"
 fi
@@ -515,7 +571,7 @@ if [[ -z $KEEP_OLDIES ]]; then
 	echo "cleansing"
 	for x in $potentials; do
 		echo "removing ${x}"
-		rm "${DISTDIR}/${x}" "${DISTDIR}/${x}.md5sum" "${DISTDIR}/${x}.umd5sum" &> /dev/null
+		rm -f "${DISTDIR}/${x}"{,.md5sum,.umd5sum,.gpgsig} &> /dev/null
 		rm "${STATE_DIR}/${x}" "${STATE_DIR}/${x}.md5sum" "${STATE_DIR}/${x}.umd5sum" &> /dev/null
 	done
 fi


^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [gentoo-commits] proj/portage:master commit in: misc/
@ 2012-08-18  1:28 Zac Medico
  0 siblings, 0 replies; 32+ messages in thread
From: Zac Medico @ 2012-08-18  1:28 UTC (permalink / raw
  To: gentoo-commits

commit:     1c5bda94674222d5ada06c74f5578ea99b7aaf2c
Author:     Alexey Solovyev <asoloviev <AT> mail15 <DOT> com>
AuthorDate: Sat Aug 18 00:32:52 2012 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Sat Aug 18 00:32:52 2012 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=1c5bda94

emerge-delta-webrsync: remove umd5sum

This will fix bug #189084.

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

diff --git a/misc/emerge-delta-webrsync b/misc/emerge-delta-webrsync
index 729188b..5df9658 100755
--- a/misc/emerge-delta-webrsync
+++ b/misc/emerge-delta-webrsync
@@ -515,7 +515,7 @@ if [[ -z $KEEP_OLDIES ]]; then
 	echo "cleansing"
 	for x in $potentials; do
 		echo "removing ${x}"
-		rm "${DISTDIR}/${x}" "${DISTDIR}/${x}.md5sum" &> /dev/null
+		rm "${DISTDIR}/${x}" "${DISTDIR}/${x}.md5sum" "${DISTDIR}/${x}.umd5sum" &> /dev/null
 		rm "${STATE_DIR}/${x}" "${STATE_DIR}/${x}.md5sum" "${STATE_DIR}/${x}.umd5sum" &> /dev/null
 	done
 fi


^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [gentoo-commits] proj/portage:master commit in: misc/
@ 2012-08-18  1:28 Zac Medico
  0 siblings, 0 replies; 32+ messages in thread
From: Zac Medico @ 2012-08-18  1:28 UTC (permalink / raw
  To: gentoo-commits

commit:     76fa7e4b7a28804d42b2fa7f50f9d9bfc73312b9
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Sat Aug 18 01:12:41 2012 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Sat Aug 18 01:12:41 2012 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=76fa7e4b

emerge-delta-webrsync: add -q/--quiet option

---
 misc/emerge-delta-webrsync |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/misc/emerge-delta-webrsync b/misc/emerge-delta-webrsync
index 3b934ff..aa3a3d9 100755
--- a/misc/emerge-delta-webrsync
+++ b/misc/emerge-delta-webrsync
@@ -63,6 +63,12 @@ unset IFS
 MUST_SYNC='1'
 unset PUKE_HELP wgetops
 for x in $*; do
+	case "${x}" in
+		-q|--quiet)
+			PORTAGE_QUIET=1
+			continue
+			;;
+	esac
 	if [[ $x == "-u" ]]; then
 		MUST_SYNC=''
 	elif [[ $x == "-k" ]]; then


^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [gentoo-commits] proj/portage:master commit in: misc/
@ 2012-08-18  1:28 Zac Medico
  0 siblings, 0 replies; 32+ messages in thread
From: Zac Medico @ 2012-08-18  1:28 UTC (permalink / raw
  To: gentoo-commits

commit:     87a769bdab8e54c68260996026c87d3d7845d2e6
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Sat Aug 18 00:57:19 2012 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Sat Aug 18 00:57:19 2012 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=87a769bd

emerge-delta-webrsync: handle FEATURES=usersync

---
 misc/emerge-delta-webrsync |   22 +++++++++++++++++++---
 1 files changed, 19 insertions(+), 3 deletions(-)

diff --git a/misc/emerge-delta-webrsync b/misc/emerge-delta-webrsync
index 2f73c90..e23316a 100755
--- a/misc/emerge-delta-webrsync
+++ b/misc/emerge-delta-webrsync
@@ -221,9 +221,24 @@ sync_local() {
 	fi
 	
 	echo Syncing local tree...
+
+	local ownership="portage:portage"
+	if has usersync ${FEATURES} ; then
+		case "${USERLAND}" in
+			BSD)
+				ownership=$(stat -f '%Su:%Sg' "${PORTDIR}")
+				;;
+			*)
+				ownership=$(stat -c '%U:%G' "${PORTDIR}")
+				;;
+		esac
+	fi
+
 	if type -p tarsync &> /dev/null; then
 		echo "apparently you have tarsync installed.  using it."
-		if ! tarsync "${FILE}" "${PORTDIR}" -v -s 1 -o portage -g portage -e /distfiles -e /packages -e /local; then
+		local chown_opts="-o ${ownership%:*} -g ${ownership#*:}"
+		chown ${ownership} "${PORTDIR}" > /dev/null 2>&1 || chown_opts=""
+		if ! tarsync "${FILE}" "${PORTDIR}" -v -s 1 ${chown_opts} -e /distfiles -e /packages -e /local; then
 			echo "ok, tarsync failed.  that's teh suck :/"
 			exit 6
 		fi
@@ -238,8 +253,9 @@ sync_local() {
 			echo "Executed command: tar jxf $FILE"
 			exit 1
 		fi
-		# Make sure user and group file ownership is root
-		chown -R 0:0 portage
+		# Make sure user and group file ownership is appropriate
+		chown ${ownership} portage > /dev/null 2>&1 && \
+			chown -R ${ownership} portage
 		cd portage
 		rsync -av --progress --stats --delete --delete-after \
 		--exclude='/distfiles' --exclude='/packages' \


^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [gentoo-commits] proj/portage:master commit in: misc/
@ 2012-08-18  1:28 Zac Medico
  0 siblings, 0 replies; 32+ messages in thread
From: Zac Medico @ 2012-08-18  1:28 UTC (permalink / raw
  To: gentoo-commits

commit:     9807b6646b8f9ce6d67b03cddfe4b9d0b02288bf
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Sat Aug 18 01:07:15 2012 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Sat Aug 18 01:07:15 2012 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=9807b664

emerge-delta-webrsync: check write permission

This will fix bug #176008.

---
 misc/emerge-delta-webrsync |   19 +++++++++++++++----
 1 files changed, 15 insertions(+), 4 deletions(-)

diff --git a/misc/emerge-delta-webrsync b/misc/emerge-delta-webrsync
index e23316a..3b934ff 100755
--- a/misc/emerge-delta-webrsync
+++ b/misc/emerge-delta-webrsync
@@ -97,11 +97,22 @@ if [ ${WEBSYNC_VERIFY_SIGNATURE} != 0 -a -z "${PORTAGE_GPG_DIR}" ]; then
 	exit 1
 fi
 
-if [[ ! -d $DISTDIR ]] ; then
-	mkdir -p $DISTDIR
+[[ -d ${PORTDIR} ]] || mkdir -p "${PORTDIR}"
+if [[ ! -w ${PORTDIR} ]] ; then
+	eecho "PORTDIR is not writable: ${PORTDIR}"
+	exit 1
+fi
+
+[[ -d ${DISTDIR} ]] || mkdir -p "${DISTDIR}"
+if [[ ! -w ${DISTDIR} ]] ; then
+	eecho "DISTDIR is not writable: ${DISTDIR}"
+	exit 1
 fi
-if [[ ! -d $TMPDIR ]]; then
-	mkdir -p $TMPDIR
+
+[[ -d ${TMPDIR} ]] || mkdir -p "${TMPDIR}"
+if [[ ! -w ${TMPDIR} ]] ; then
+	eecho "TMPDIR is not writable: ${TMPDIR}"
+	exit 1
 fi
 
 cd "$DISTDIR"


^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [gentoo-commits] proj/portage:master commit in: misc/
@ 2012-08-18  1:28 Zac Medico
  0 siblings, 0 replies; 32+ messages in thread
From: Zac Medico @ 2012-08-18  1:28 UTC (permalink / raw
  To: gentoo-commits

commit:     1286c42c9221a87efaafa6017b86a85f5f408036
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Sat Aug 18 01:27:58 2012 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Sat Aug 18 01:27:58 2012 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=1286c42c

emerge-delta-webrsync: PORTAGE_RSYNC_OPTS

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

diff --git a/misc/emerge-delta-webrsync b/misc/emerge-delta-webrsync
index aa3a3d9..34c7094 100755
--- a/misc/emerge-delta-webrsync
+++ b/misc/emerge-delta-webrsync
@@ -274,9 +274,7 @@ sync_local() {
 		chown ${ownership} portage > /dev/null 2>&1 && \
 			chown -R ${ownership} portage
 		cd portage
-		rsync -av --progress --stats --delete --delete-after \
-		--exclude='/distfiles' --exclude='/packages' \
-		--exclude='/local' . ${PORTDIR%%/}
+		rsync ${PORTAGE_RSYNC_OPTS} ${PORTAGE_RSYNC_EXTRA_OPTS} . "${PORTDIR%%/}"
 		cd ..
 		echo "cleaning up"
 		rm -rf portage


^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [gentoo-commits] proj/portage:master commit in: misc/
@ 2012-08-18  1:45 Zac Medico
  0 siblings, 0 replies; 32+ messages in thread
From: Zac Medico @ 2012-08-18  1:45 UTC (permalink / raw
  To: gentoo-commits

commit:     a98eee34881f9a7180a5e467eaa63435efa890db
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Sat Aug 18 01:44:59 2012 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Sat Aug 18 01:44:59 2012 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=a98eee34

emerge-delta-webrsync: normalize fetch URI

This will fix bug #124072.

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

diff --git a/misc/emerge-delta-webrsync b/misc/emerge-delta-webrsync
index 34c7094..fffa815 100755
--- a/misc/emerge-delta-webrsync
+++ b/misc/emerge-delta-webrsync
@@ -296,7 +296,7 @@ fetch_from_mirrors() {
 	fi
 	FILE="$2"
 	for i in $MIRRORS ; do
-		URI="${i}/${1}"
+		URI="${i%/}/${1#/}"
 		if (eval "$FETCHCOMMAND $wgetops") && [ -s "${FILE}" ]; then
 			return 0
 		else


^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [gentoo-commits] proj/portage:master commit in: misc/
@ 2012-08-18 20:32 Zac Medico
  0 siblings, 0 replies; 32+ messages in thread
From: Zac Medico @ 2012-08-18 20:32 UTC (permalink / raw
  To: gentoo-commits

commit:     a695533917d969d66210ce8e2fe8aa88bee42dc7
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Sat Aug 18 20:32:00 2012 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Sat Aug 18 20:32:00 2012 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=a6955339

emerge-delta-webrsync: rm -f for non-interactive

This prevents interactive mode as reported in bug #176008.

---
 misc/emerge-delta-webrsync |   20 ++++++++++----------
 1 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/misc/emerge-delta-webrsync b/misc/emerge-delta-webrsync
index fffa815..f6748cb 100755
--- a/misc/emerge-delta-webrsync
+++ b/misc/emerge-delta-webrsync
@@ -149,7 +149,7 @@ fi
 #---------------
 
 cleanse_state_dir() {
-	[[ ${STATE_DIR:-/} != '/' ]] && rm ${STATE_DIR}/* &> /dev/null;
+	[[ ${STATE_DIR:-/} != '/' ]] && rm -f "${STATE_DIR}"/* &> /dev/null
 }
 
 full_version_attempt() {
@@ -205,14 +205,14 @@ full_version_attempt() {
 				exit 0
 			else
 				echo "md5 on ${FILE} failed, removing it and starting anew"
-				rm "$FILE" &> /dev/null
+				rm -f "${FILE}" &> /dev/null
 			fi
 		fi
 	
 		if fetch_from_mirrors "/snapshots/${FILE}" "${FILE}"; then
 			if ! verify_md5_file "$FILE"; then
 				echo "md5 failed on $FILE"
-				rm ${FILE} &> /dev/null
+				rm -f "${FILE}" &> /dev/null
 				continue
 			else
 				sync_local "${FILE}"
@@ -300,7 +300,7 @@ fetch_from_mirrors() {
 		if (eval "$FETCHCOMMAND $wgetops") && [ -s "${FILE}" ]; then
 			return 0
 		else
-			rm "${FILE}" &> /dev/null
+			rm -f "${FILE}" &> /dev/null
 		fi
 	done
 	return 1
@@ -394,8 +394,8 @@ for basef in ${potentials}; do
 	fi
 	if ! verify_md5_file "${dfile}" "${chksum}"; then
 		echo "found a stale snapshot.  cleansing"
-		rm "${dfile}" &> /dev/null
-		rm "${chksum}.md5sum" &> /dev/null
+		rm -f "${dfile}" &> /dev/null
+		rm -f "${chksum}.md5sum" &> /dev/null
 		dar=""
 	else
 		base_version="${basef}"
@@ -455,7 +455,7 @@ while [[ -n ${fetched} ]]; do
 	fetch="yes"
 	if [[ -e ${p} ]]; then
 		if ! verify_md5_file "${p}"; then
-			rm ${p} &> /dev/null
+			rm -f "${p}" &> /dev/null
 		else
 			fetch=""
 		fi
@@ -521,7 +521,7 @@ TEMPDIR=$(mktemp -d /tmp/delta-webrsync-XXXXXX)
 # got our patches.
 if ! patcher -v "${dfile}" ${patches} "${TEMPDIR}/portage-${final_date}.tar"; then
 	echo "reconstruction failed (contact the author with the error from the reconstructor please)"
-	rm "${TEMPDIR}/portage-${final_date}.tar"
+	rm -f "${TEMPDIR}/portage-${final_date}.tar"
 	rmdir ${TEMPDIR}
 	full_version_attempt
 fi
@@ -556,7 +556,7 @@ if [ "$verified" == "1" ]; then
 	echo "doing final md5 stuff"
 	wait
 	# bzip2 is finished now.
-	rm "${TEMPDIR}/portage-${final_date}.tar"
+	rm -f "${TEMPDIR}/portage-${final_date}.tar"
 else
 	echo "recompressing."
 	bzip2 -v9 "${TEMPDIR}/portage-${final_date}.tar.bz2"
@@ -603,7 +603,7 @@ if [[ -z $KEEP_OLDIES ]]; then
 	for x in $potentials; do
 		echo "removing ${x}"
 		rm -f "${DISTDIR}/${x}"{,.md5sum,.umd5sum,.gpgsig} &> /dev/null
-		rm "${STATE_DIR}/${x}" "${STATE_DIR}/${x}.md5sum" "${STATE_DIR}/${x}.umd5sum" &> /dev/null
+		rm -f "${STATE_DIR}/${x}"{,.md5sum,.umd5sum} &> /dev/null
 	done
 fi
 echo "done."


^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [gentoo-commits] proj/portage:master commit in: misc/
@ 2012-08-18 20:51 Zac Medico
  0 siblings, 0 replies; 32+ messages in thread
From: Zac Medico @ 2012-08-18 20:51 UTC (permalink / raw
  To: gentoo-commits

commit:     49cc97a199f38904ad5ad5a3d496cb796ecac657
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Sat Aug 18 20:51:28 2012 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Sat Aug 18 20:51:28 2012 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=49cc97a1

emerge-delta-webrsync: fix make.globals path

---
 misc/emerge-delta-webrsync |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/misc/emerge-delta-webrsync b/misc/emerge-delta-webrsync
index f6748cb..8c43bdc 100755
--- a/misc/emerge-delta-webrsync
+++ b/misc/emerge-delta-webrsync
@@ -31,7 +31,8 @@ else
 	eecho "could not find 'portageq'; aborting"
 	exit 1
 fi
-eval $("${portageq}" envvar -v DISTDIR FEATURES FETCHCOMMAND GENTOO_MIRRORS \
+eval $("${portageq}" envvar -v DISTDIR EPREFIX FEATURES \
+	FETCHCOMMAND GENTOO_MIRRORS \
 	PORTAGE_BIN_PATH PORTAGE_GPG_DIR \
 	PORTAGE_NICENESS PORTAGE_RSYNC_EXTRA_OPTS \
 	PORTAGE_RSYNC_OPTS PORTAGE_TMPDIR PORTDIR \
@@ -54,7 +55,7 @@ STATE_DIR="/var/delta-webrsync/"
 # hack.  bug 92224
 if [ "${FETCHCOMMAND/getdelta.sh}" != "${FETCHCOMMAND}" ]; then
 	# evil evil evil evil
-	eval "$(grep FETCHCOMMAND /etc/make.globals)"
+	eval "$(grep "^FETCHCOMMAND=" "${EPREFIX}/usr/share/portage/config/make.globals")"
 fi
 
 unset f


^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [gentoo-commits] proj/portage:master commit in: misc/
@ 2012-08-18 22:51 Zac Medico
  0 siblings, 0 replies; 32+ messages in thread
From: Zac Medico @ 2012-08-18 22:51 UTC (permalink / raw
  To: gentoo-commits

commit:     9bf5900fb2fff77a89b91dd5f38478aaa635ef66
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Sat Aug 18 22:50:53 2012 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Sat Aug 18 22:50:53 2012 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=9bf5900f

emerge-delta-webrsync: mktemp in PORTAGE_TMPDIR

This will fix bug #198362.

---
 misc/emerge-delta-webrsync |   43 ++++++++++++++++++++-----------------------
 1 files changed, 20 insertions(+), 23 deletions(-)

diff --git a/misc/emerge-delta-webrsync b/misc/emerge-delta-webrsync
index 8c43bdc..0b282d9 100755
--- a/misc/emerge-delta-webrsync
+++ b/misc/emerge-delta-webrsync
@@ -38,7 +38,6 @@ eval $("${portageq}" envvar -v DISTDIR EPREFIX FEATURES \
 	PORTAGE_RSYNC_OPTS PORTAGE_TMPDIR PORTDIR \
 	USERLAND http_proxy ftp_proxy)
 export http_proxy ftp_proxy
-TMPDIR=${PORTAGE_TMPDIR}/snapshots
 
 source "${PORTAGE_BIN_PATH}"/isolated-functions.sh || exit 1
 
@@ -116,7 +115,8 @@ if [[ ! -w ${DISTDIR} ]] ; then
 	exit 1
 fi
 
-[[ -d ${TMPDIR} ]] || mkdir -p "${TMPDIR}"
+[[ -d ${PORTAGE_TMPDIR}/portage ]] || mkdir -p "${PORTAGE_TMPDIR}/portage" 
+TMPDIR=$(mktemp -d "${PORTAGE_TMPDIR}/portage/delta-webrsync-XXXXXX")
 if [[ ! -w ${TMPDIR} ]] ; then
 	eecho "TMPDIR is not writable: ${TMPDIR}"
 	exit 1
@@ -261,7 +261,7 @@ sync_local() {
 			exit 6
 		fi
 	else
-		cd ${TMPDIR} || die "couldn't cd to tmpdir, $TMPDIR!?"
+		cd "${TMPDIR}" || die "couldn't cd to tmpdir, ${TMPDIR}!?"
 		flags="xf"
 		if [ "${FILE%.bz2}" != "${FILE}" ]; then
 			flags="jxf"
@@ -517,19 +517,16 @@ if [[ ${WEBSYNC_VERIFY_SIGNATURE} == 1 && ! -e portage-${final_date}.tar.bz2.gpg
 	exit 5
 fi
 
-# generate tmp dir.
-TEMPDIR=$(mktemp -d /tmp/delta-webrsync-XXXXXX)
 # got our patches.
-if ! patcher -v "${dfile}" ${patches} "${TEMPDIR}/portage-${final_date}.tar"; then
+if ! patcher -v "${dfile}" ${patches} "${TMPDIR}/portage-${final_date}.tar"; then
 	echo "reconstruction failed (contact the author with the error from the reconstructor please)"
-	rm -f "${TEMPDIR}/portage-${final_date}.tar"
-	rmdir ${TEMPDIR}
+	rm -f "${TMPDIR}/portage-${final_date}.tar"
 	full_version_attempt
 fi
 verified=0
 if [[ -n $got_umd5 ]]; then
 	echo "verifying uncompressed md5"
-	if ! verify_md5_file "${TEMPDIR}/portage-${final_date}.tar" "${DISTDIR}/portage-${final_date}.tar.bz2.umd5sum"; then
+	if ! verify_md5_file "${TMPDIR}/portage-${final_date}.tar" "${DISTDIR}/portage-${final_date}.tar.bz2.umd5sum"; then
 		echo "uncompressed verification failed.  This means either you found a bug in diffball, or something odd is going on"
 		echo "with upstream patch generation"
 		echo "trying md5sum next, which probably will fail."
@@ -546,26 +543,26 @@ if [ "$verified" == "1" ]; then
 		# BUG: Signature verification will fail if the local bzip2
 		# program does not produce output that is perfectly identical
 		# to the bzip2 program used to compress the signed tar file.
-		bzip2 -vk9 "${TEMPDIR}/portage-${final_date}.tar"
-		check_file_signature "${DISTDIR}/portage-${final_date}.tar.bz2.gpgsig" "${TEMPDIR}/portage-${final_date}.tar.bz2" || exit 1
+		bzip2 -vk9 "${TMPDIR}/portage-${final_date}.tar"
+		check_file_signature "${DISTDIR}/portage-${final_date}.tar.bz2.gpgsig" "${TMPDIR}/portage-${final_date}.tar.bz2" || exit 1
 	else
-		bzip2 -vk9 "${TEMPDIR}/portage-${final_date}.tar" &
+		bzip2 -vk9 "${TMPDIR}/portage-${final_date}.tar" &
 	fi
 
 	echo "beginning update to the tree"
-	sync_local "${TEMPDIR}/portage-${final_date}.tar"
+	sync_local "${TMPDIR}/portage-${final_date}.tar"
 	echo "doing final md5 stuff"
 	wait
 	# bzip2 is finished now.
-	rm -f "${TEMPDIR}/portage-${final_date}.tar"
+	rm -f "${TMPDIR}/portage-${final_date}.tar"
 else
 	echo "recompressing."
-	bzip2 -v9 "${TEMPDIR}/portage-${final_date}.tar.bz2"
+	bzip2 -v9 "${TMPDIR}/portage-${final_date}.tar.bz2"
 fi
 
 echo "verifying generated tarball"
 
-if ! verify_md5_file "${TEMPDIR}/portage-${final_date}.tar.bz2" "${DISTDIR}/portage-${final_date}.tar.bz2.md5sum"; then
+if ! verify_md5_file "${TMPDIR}/portage-${final_date}.tar.bz2" "${DISTDIR}/portage-${final_date}.tar.bz2.md5sum"; then
 	if [[ -z $verified ]]; then
 		echo "couldn't verify the generated tarball.  bug, most likely."
 		exit 5
@@ -574,21 +571,20 @@ if ! verify_md5_file "${TEMPDIR}/portage-${final_date}.tar.bz2" "${DISTDIR}/port
 	echo "compressed md5 differs, but uncompressed md5 says it right.  bzip2 version incompatability in other words"
 	echo "saving the md5"
 	if type -p md5sum &> /dev/null; then
-		md5sum ${TEMPDIR}/portage-${final_date}.tar.bz2 | sed -e "s:${TEMPDIR}/\?::" > \
-			${STATE_DIR}/portage-${final_date}.tar.bz2.md5sum
+		md5sum "${TMPDIR}/portage-${final_date}.tar.bz2" | sed -e "s:${TMPDIR}/\?::" > \
+			"${STATE_DIR}/portage-${final_date}.tar.bz2.md5sum"
 	elif type -p md5 &> /dev/null; then
-		echo "$(md5 -q ${TEMPDIR}/portage-${final_date}.tar.bz2)  portage-${final_date}.tar.bz2" > \
-			${STATE_DIR}/portage-${final_date}.tar.bz2.md5sum
+		echo "$(md5 -q "${TMPDIR}/portage-${final_date}.tar.bz2")  portage-${final_date}.tar.bz2" > \
+			"${STATE_DIR}/portage-${final_date}.tar.bz2.md5sum"
 	else
 		echo "couldn't find either md5 or md5sum.  something is screwed... (bailing, sorry)"
 		exit 7
 	fi
-	mv "${DISTDIR}/portage-${final_date}.tar.bz2.umd5sum" "${TEMPDIR}/portage-${final_date}.tar.bz2" ${STATE_DIR}/
-	rmdir ${TEMPDIR}
+	mv "${DISTDIR}/portage-${final_date}.tar.bz2.umd5sum" "${TMPDIR}/portage-${final_date}.tar.bz2" "${STATE_DIR}/"
 	dfile="${STATE_DIR}/portage-${final_date}.tar.bz2"
 else
 	dfile="${DISTDIR}/portage-${final_date}.tar.bz2"
-	mv "${TEMPDIR}/portage-${final_date}.tar.bz2" ${DISTDIR}/
+	mv "${TMPDIR}/portage-${final_date}.tar.bz2" "${DISTDIR}/"
 fi
 
 if [ -z "${need_last_sync}" ]; then
@@ -607,5 +603,6 @@ if [[ -z $KEEP_OLDIES ]]; then
 		rm -f "${STATE_DIR}/${x}"{,.md5sum,.umd5sum} &> /dev/null
 	done
 fi
+rm -rf "${TMPDIR}"
 echo "done."
 


^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [gentoo-commits] proj/portage:master commit in: misc/
@ 2012-08-19  5:21 Zac Medico
  0 siblings, 0 replies; 32+ messages in thread
From: Zac Medico @ 2012-08-19  5:21 UTC (permalink / raw
  To: gentoo-commits

commit:     76e037f33eeaa4969bae13c6c23eda40566dca39
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Sun Aug 19 05:21:40 2012 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Sun Aug 19 05:21:40 2012 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=76e037f3

emerge-delta-webrsync: improve date calculations

This borrows some code from emerge-webrsync, and will fix bug #153513.

---
 misc/emerge-delta-webrsync |   84 ++++++++++++++++++++++---------------------
 1 files changed, 43 insertions(+), 41 deletions(-)

diff --git a/misc/emerge-delta-webrsync b/misc/emerge-delta-webrsync
index 874c527..e237c7f 100755
--- a/misc/emerge-delta-webrsync
+++ b/misc/emerge-delta-webrsync
@@ -153,29 +153,56 @@ cleanse_state_dir() {
 	[[ ${STATE_DIR:-/} != '/' ]] && rm -f "${STATE_DIR}"/* &> /dev/null
 }
 
+get_utc_date_in_seconds() {
+	date -u +"%s"
+}
+
+get_date_part() {
+	local utc_time_in_secs="$1"
+	local part="$2"
+
+	if	[[ ${USERLAND} == BSD ]] ; then
+		date -r ${utc_time_in_secs} -u +"${part}"
+	else
+		date -d @${utc_time_in_secs} -u +"${part}"
+	fi
+}
+
+increment_date() {
+	local s="$1" inc="$2"
+	if [[ ${USERLAND} == BSD ]] ; then
+		# Specify zeros for the least significant digits, or else those
+		# digits are inherited from the current system clock time.
+		date -v${inc}d -juf "%Y%m%d%H%M.%S" "${s}0000.00" +"%Y%m%d"
+	else
+		date -d "${s:0:4}-${s:4:2}-${s:6:2} ${inc} day" -u +"%Y%m%d"
+	fi
+}
+
 full_version_attempt() {
 	local FILE file_exists
 	echo "Fetching most recent snapshot"
+
+	local start_time=$(get_utc_date_in_seconds)
+	local start_hour=$(get_date_part ${start_time} "%H")
+	local snapshot_date=$(get_date_part ${start_time} "%Y%m%d")
+
+	# Daily snapshots are created at 00:45 and are not
+	# available until after 01:00. Don't waste time trying
+	# to fetch a snapshot before it's been created.
+	if [ ${start_hour} -lt 1 ] ; then
+		snapshot_date=$(increment_date ${snapshot_date} -1)
+	fi
+
 	declare -i attempts=-1
 	while (( $attempts <  40 )) ; do
 		unset file_exists
 		attempts=$(( attempts + 1 ))
+		snapshot_date=$(increment_date ${snapshot_date} -1)
 
-		#this too, sucks.  it works in the interim though.
-		if [ "$USERLAND" == "BSD" ] || [ "$USERLAND" == "Darwin" ] ; then
-			daysbefore=$(expr $(date +"%s") - 86400 \* $attempts)
-			day=$(date -r $daysbefore +"%d")
-			month=$(date -r $daysbefore +"%m")
-			year=$(date -r $daysbefore +"%Y")
-		else
-			day=$(date -d "-$attempts day" +"%d")
-			month=$(date -d "-$attempts day" +"%m")
-			year=$(date -d "-$attempts day" +"%Y")
-		fi
-
-		FILE="portage-${year}${month}${day}.tar.bz2"
+		FILE="portage-${snapshot_date}.tar.bz2"
 
-		echo "Attempting to fetch file dated: ${year}${month}${day}"
+		echo "Attempting to fetch file dated: ${snapshot_date}"
 		
 		got_md5=0
 
@@ -220,7 +247,7 @@ full_version_attempt() {
 				cleanse_state_dir
 				echo
 				echo " *** Completed websync, please now perform a normal rsync if possible."
-				echo "     Update is current as of YYYYMMDD: ${year}${month}${day}"
+				echo "     Update is current as of YYYYMMDD: ${snapshot_date}"
 				echo
 				exit 0
 			fi
@@ -418,36 +445,11 @@ base_date="${base_version%.tar.bz2}"
 base_date="${base_date#portage-}"
 # we now have yyyymmdd
 
-unset patch_dates
-if [ "$USERLAND" == "BSD" ] || [ "$USERLAND" == "Darwin" ] ; then
-	daysbefore=$(expr $(date +"%s") - 86400 \* $attempts)
-	day=$(date -r $daysbefore +"%d")
-	month=$(date -r $daysbefore +"%m")
-	year=$(date -r $daysbefore +"%Y")
-else
-	day=$(date -d "-$attempts day" +"%d")
-	month=$(date -d "-$attempts day" +"%m")
-	year=$(date -d "-$attempts day" +"%Y")
-fi
-
-#todays_date="${year}${month}${day}"
-
-next_date() {
-	local year day month
-	year="${1:0:4}"
-	month="${1:4:2}"
-	day="${1:6:2}"
-#	if [[ "${USERLAND}" == "BSD" ]] || [[ "${USERLAND}" == "Darwin" ]]; then
-#	else
-		date -d "$year/$month/$day +1 day" +"%Y%m%d"
-#	fi
-}
-
 patches=''
 echo "fetching patches"
 fetched='asdf'
 while [[ -n ${fetched} ]]; do
-	next_day=$(next_date ${base_date})
+	next_day=$(increment_date ${base_date} +1)
 	# if we can't get a *single* patch or md5, even one missing, do full.
 	p="snapshot-${base_date}-${next_day}.patch.bz2"
 	if [[ ! -e ${p}.md5sum ]] && ! fetch_from_mirrors "/snapshots/deltas/${p}.md5sum" "${p}.md5sum"; then


^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [gentoo-commits] proj/portage:master commit in: misc/
@ 2012-08-19  5:44 Zac Medico
  0 siblings, 0 replies; 32+ messages in thread
From: Zac Medico @ 2012-08-19  5:44 UTC (permalink / raw
  To: gentoo-commits

commit:     604eb9bd43ec035c4e26197ab21cba33b4faa8f9
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Sun Aug 19 05:44:35 2012 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Sun Aug 19 05:44:35 2012 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=604eb9bd

emerge-delta-webrsync: tweak "recompressing" msg

FEATURES=webrsync-gpg forces it to recompress in the foreground.

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

diff --git a/misc/emerge-delta-webrsync b/misc/emerge-delta-webrsync
index e237c7f..102a991 100755
--- a/misc/emerge-delta-webrsync
+++ b/misc/emerge-delta-webrsync
@@ -541,15 +541,16 @@ fi
 
 unset need_last_sync
 if [ "$verified" == "1" ]; then
-	echo "recompressing. (backgrounding)"
 	need_last_sync="dar"
 	if [[ ${WEBSYNC_VERIFY_SIGNATURE} == 1 ]] ; then
 		# BUG: Signature verification will fail if the local bzip2
 		# program does not produce output that is perfectly identical
 		# to the bzip2 program used to compress the signed tar file.
+		echo "recompressing ..."
 		bzip2 -vk9 "${TMPDIR}/portage-${final_date}.tar"
 		check_file_signature "${DISTDIR}/portage-${final_date}.tar.bz2.gpgsig" "${TMPDIR}/portage-${final_date}.tar.bz2" || exit 1
 	else
+		echo "recompressing. (backgrounding)"
 		bzip2 -vk9 "${TMPDIR}/portage-${final_date}.tar" &
 	fi
 


^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [gentoo-commits] proj/portage:master commit in: misc/
@ 2012-09-14  7:26 Zac Medico
  0 siblings, 0 replies; 32+ messages in thread
From: Zac Medico @ 2012-09-14  7:26 UTC (permalink / raw
  To: gentoo-commits

commit:     bb9186cd81d707593ea386d17321bd594d847126
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Fri Sep 14 07:25:57 2012 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Fri Sep 14 07:25:57 2012 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=bb9186cd

emerge-delta-webrsync: fix vecho breakage

Broken since commit 9b19ac5696c487dab58d7c10990fe07fd7f1f731.

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

diff --git a/misc/emerge-delta-webrsync b/misc/emerge-delta-webrsync
index 102a991..9dd2a62 100755
--- a/misc/emerge-delta-webrsync
+++ b/misc/emerge-delta-webrsync
@@ -15,6 +15,10 @@ argv0=$0
 
 # error echos
 eecho() { echo "${argv0##*/}: error: $*" 1>&2 ; }
+# This function from isolated-functions.sh got renamed to __vecho.
+vecho() {
+	[[ ${PORTAGE_QUIET} -eq 1 ]] || echo "$@"
+}
 
 #-------------------
 #initialization


^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [gentoo-commits] proj/portage:master commit in: misc/
@ 2013-01-28 21:45 Zac Medico
  0 siblings, 0 replies; 32+ messages in thread
From: Zac Medico @ 2013-01-28 21:45 UTC (permalink / raw
  To: gentoo-commits

commit:     935b3a11148e0600c3ff3a2685ed101698fbb5d4
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Mon Jan 28 21:45:44 2013 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Mon Jan 28 21:45:44 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=935b3a11

emerge-delta-webrsync: fix STATE_DIR for EPREFIX

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

diff --git a/misc/emerge-delta-webrsync b/misc/emerge-delta-webrsync
index a782be7..de0f93e 100755
--- a/misc/emerge-delta-webrsync
+++ b/misc/emerge-delta-webrsync
@@ -53,7 +53,7 @@ if [ -z "$NICENESS_PULLED" ]; then
 	fi
 fi
 
-STATE_DIR="/var/delta-webrsync/"
+STATE_DIR="${EPREFIX}/var/delta-webrsync/"
 
 # hack.  bug 92224
 if [ "${FETCHCOMMAND/getdelta.sh}" != "${FETCHCOMMAND}" ]; then


^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [gentoo-commits] proj/portage:master commit in: misc/
@ 2013-06-22  5:54 Zac Medico
  0 siblings, 0 replies; 32+ messages in thread
From: Zac Medico @ 2013-06-22  5:54 UTC (permalink / raw
  To: gentoo-commits

commit:     24f6a9599bcf445c468022264cd6952aad4d4076
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Sat Jun 22 05:53:41 2013 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Sat Jun 22 05:53:41 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=24f6a959

emerge-delta-webrsync: check full snapshot sig

This patch merges a lot of code from emerge-webrsync, so that the same
code is used when it's necessary to download a full snapshot and check
the signature. This will fix bug #286373.

---
 misc/emerge-delta-webrsync | 476 ++++++++++++++++++++++++++++++---------------
 1 file changed, 323 insertions(+), 153 deletions(-)

diff --git a/misc/emerge-delta-webrsync b/misc/emerge-delta-webrsync
index de0f93e..85ee656 100755
--- a/misc/emerge-delta-webrsync
+++ b/misc/emerge-delta-webrsync
@@ -1,5 +1,5 @@
 #!/bin/bash
-# Copyright 1999-2012 Gentoo Foundation
+# Copyright 1999-2013 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
 # Author: Brian Harring <ferringb@gentoo.org>, karltk@gentoo.org originally.
 # Rewritten from the old, Perl-based emerge-webrsync script
@@ -13,12 +13,13 @@
 
 argv0=$0
 
+# Only echo if not in verbose mode
+nvecho() { [[ ${do_verbose} -eq 0 ]] && echo "$@" ; }
+# warning echos
+wecho() { echo "${argv0##*/}: warning: $*" 1>&2 ; }
 # error echos
 eecho() { echo "${argv0##*/}: error: $*" 1>&2 ; }
-# This function from isolated-functions.sh got renamed to __vecho.
-vecho() {
-	[[ ${PORTAGE_QUIET} -eq 1 ]] || echo "$@"
-}
+
 
 #-------------------
 #initialization
@@ -64,8 +65,9 @@ fi
 unset f
 unset IFS
 
+do_verbose=0
 MUST_SYNC='1'
-unset PUKE_HELP wgetops
+unset PUKE_HELP
 for x in $*; do
 	case "${x}" in
 		-q|--quiet)
@@ -80,7 +82,7 @@ for x in $*; do
 	elif [[ $x == "-h" ]]; then
 		PUKE_HELP=1
 	elif [[ $x == "-v" ]]; then
-		wgetops=
+		do_verbose=1
 	else
 		PUKE_HELP=1
 		echo "$x isn't a valid arg.  bailing."
@@ -129,15 +131,6 @@ fi
 cd "$DISTDIR"
 
 found=0
-if [ "${wgetops-UNSET}" == "unset" ]; then
-	#this sucks.  probably better to do 1> /dev/null
-	#that said, waiting on the refactoring.
-	if [ "${FETCHCOMMAND/wget}" != "${FETCHCOMMAND}" ]; then
-		wgetops="-q"
-	elif [ "${FETCHCOMMAND/curl}" != "${FETCHCOMMAND}" ]; then
-		wgetops="-s -f"
-	fi
-fi
 
 if type -p md5sum > /dev/null; then
 	md5_com='md5sum -c "${MD5_LOC}" &> /dev/null'
@@ -157,6 +150,20 @@ cleanse_state_dir() {
 	[[ ${STATE_DIR:-/} != '/' ]] && rm -f "${STATE_DIR}"/* &> /dev/null
 }
 
+do_tar() {
+	local file=$1; shift
+	local decompressor
+	case ${file} in
+		*.xz)   decompressor="xzcat" ;;
+		*.bz2)  decompressor="bzcat" ;;
+		*.gz)   decompressor="zcat"  ;;
+		*)      decompressor="cat"   ;;
+	esac
+	${decompressor} "${file}" | tar "$@"
+	_pipestatus=${PIPESTATUS[*]}
+	[[ ${_pipestatus// /} -eq 0 ]]
+}
+
 get_utc_date_in_seconds() {
 	date -u +"%s"
 }
@@ -172,6 +179,27 @@ get_date_part() {
 	fi
 }
 
+get_utc_second_from_string() {
+	local s="$1"
+	if [[ ${USERLAND} == BSD ]] ; then
+		# Specify zeros for the least significant digits, or else those
+		# digits are inherited from the current system clock time.
+		date -juf "%Y%m%d%H%M.%S" "${s}0000.00" +"%s"
+	else
+		date -d "${s:0:4}-${s:4:2}-${s:6:2}" -u +"%s"
+	fi
+}
+
+get_portage_timestamp() {
+	local portage_current_timestamp=0
+
+	if [ -f "${PORTDIR}/metadata/timestamp.x" ]; then
+		portage_current_timestamp=$(cut -f 1 -d " " "${PORTDIR}/metadata/timestamp.x" )
+	fi
+
+	echo "${portage_current_timestamp}"
+}
+
 increment_date() {
 	local s="$1" inc="$2"
 	if [[ ${USERLAND} == BSD ]] ; then
@@ -183,93 +211,78 @@ increment_date() {
 	fi
 }
 
-full_version_attempt() {
-	local FILE file_exists
-	echo "Fetching most recent snapshot"
 
-	local start_time=$(get_utc_date_in_seconds)
-	local start_hour=$(get_date_part ${start_time} "%H")
-	local snapshot_date=$(get_date_part ${start_time} "%Y%m%d")
+fetch_file() {
+	local URI="$1"
+	local FILE="$2"
+	local opts
 
-	# Daily snapshots are created at 00:45 and are not
-	# available until after 01:00. Don't waste time trying
-	# to fetch a snapshot before it's been created.
-	if [ ${start_hour} -lt 1 ] ; then
-		snapshot_date=$(increment_date ${snapshot_date} -1)
+	if [ "${FETCHCOMMAND/wget/}" != "${FETCHCOMMAND}" ]; then
+		opts="--continue $(nvecho -q)"
+	elif [ "${FETCHCOMMAND/curl/}" != "${FETCHCOMMAND}" ]; then
+		opts="--continue-at - $(nvecho -s -f)"
+	else
+		rm -f "${FILE}"
 	fi
 
-	declare -i attempts=-1
-	while (( $attempts <  40 )) ; do
-		unset file_exists
-		attempts=$(( attempts + 1 ))
-		snapshot_date=$(increment_date ${snapshot_date} -1)
+	__vecho "Fetching file ${FILE} ..."
+	# already set DISTDIR=
+	eval "${FETCHCOMMAND} ${opts}"
+	[ -s "${DISTDIR}/${FILE}" ]
+}
 
-		FILE="portage-${snapshot_date}.tar.bz2"
+check_file_digest() {
+	local digest="$1"
+	local file="$2"
+	local r=1
 
-		echo "Attempting to fetch file dated: ${snapshot_date}"
-		
-		got_md5=0
+	__vecho "Checking digest ..."
 
-		if [  ! -e "${FILE}.md5sum" ]; then
-			fetch_from_mirrors "/snapshots/${FILE}.md5sum" "${FILE}.md5sum"
-			got_md5=$?
-		else
-			file_exists='asdf'
-			got_md5=0
-		fi
+	if type -P md5sum > /dev/null; then
+		local md5sum_output=$(md5sum "${file}")
+		local digest_content=$(< "${digest}")
+		[ "${md5sum_output%%[[:space:]]*}" = "${digest_content%%[[:space:]]*}" ] && r=0
+	elif type -P md5 > /dev/null; then
+		[ "$(md5 -q "${file}")" == "$(cut -d ' ' -f 1 "${digest}")" ] && r=0
+	else
+		eecho "cannot check digest: no suitable md5/md5sum binaries found"
+	fi
 
-		if [[ $got_md5 != 0 ]]; then
-			echo " --- No md5sum present on the mirror. (Not yet available.)"
-			continue
-		elif [ -s "${FILE}" ]; then
-			if verify_md5_file "$FILE"; then
-				echo " === snapshot $FILE is correct, using it"
-				if [[ -n $MUST_SYNC ]] || [[ -z file_exists ]]; then
-					sync_local "${FILE}"
-					echo
-					echo " === Snapshot has been sync'd"
-					echo
-				else
-					echo
-					echo "skipped sync"
-					echo
-				fi
-				exit 0
-			else
-				echo "md5 on ${FILE} failed, removing it and starting anew"
-				rm -f "${FILE}" &> /dev/null
-			fi
-		fi
-	
-		if fetch_from_mirrors "/snapshots/${FILE}" "${FILE}"; then
-			if ! verify_md5_file "$FILE"; then
-				echo "md5 failed on $FILE"
-				rm -f "${FILE}" &> /dev/null
-				continue
-			else
-				sync_local "${FILE}"
-				cleanse_state_dir
-				echo
-				echo " *** Completed websync, please now perform a normal rsync if possible."
-				echo "     Update is current as of YYYYMMDD: ${snapshot_date}"
-				echo
-				exit 0
-			fi
+	return "${r}"
+}
+
+check_file_signature() {
+	local signature="$1"
+	local file="$2"
+	local r=1
+
+	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
+		else
+			eecho "cannot check signature: gpg binary not found"
+			exit 1
 		fi
+	else
+		r=0
+	fi
 
-	done
-	exit 1
+	return "${r}"
 }
 
+get_snapshot_timestamp() {
+	local file="$1"
+
+	do_tar "${file}" --to-stdout -xf - portage/metadata/timestamp.x | cut -f 1 -d " "
+}
 
 sync_local() {
-	local FILE flags
-	FILE="$1"
-	if [ "${FILE/\/}" == "${FILE}" ]; then
-		FILE="${DISTDIR}/${FILE}";
-	fi
-	
-	echo Syncing local tree...
+	local file="$1"
+
+	__vecho "Syncing local tree ..."
 
 	local ownership="portage:portage"
 	if has usersync ${FEATURES} ; then
@@ -283,45 +296,218 @@ sync_local() {
 		esac
 	fi
 
-	if type -p tarsync &> /dev/null; then
-		echo "apparently you have tarsync installed.  using it."
+	if type -P tarsync > /dev/null ; then
 		local chown_opts="-o ${ownership%:*} -g ${ownership#*:}"
 		chown ${ownership} "${PORTDIR}" > /dev/null 2>&1 || chown_opts=""
-		if ! tarsync "${FILE}" "${PORTDIR}" -v -s 1 ${chown_opts} -e /distfiles -e /packages -e /local; then
-			echo "ok, tarsync failed.  that's teh suck :/"
-			exit 6
+		if ! tarsync $(__vecho -v) -s 1 ${chown_opts} \
+			-e /distfiles -e /packages -e /local "${file}" "${PORTDIR}"; then
+			eecho "tarsync failed; tarball is corrupt? (${file})"
+			return 1
 		fi
 	else
-		cd "${TMPDIR}" || die "couldn't cd to tmpdir, ${TMPDIR}!?"
-		flags="xf"
-		if [ "${FILE%.bz2}" != "${FILE}" ]; then
-			flags="jxf"
-		fi
-		if ! tar ${flags} "$FILE"; then
-			echo "Tar failed to extract the image. Please review the output."
-			echo "Executed command: tar jxf $FILE"
-			exit 1
+		if ! do_tar "${file}" xf - -C "${TMPDIR}" ; then
+			eecho "tar failed to extract the image. tarball is corrupt? (${file})"
+			rm -fr "${TMPDIR}"/portage
+			return 1
 		fi
 
 		local rsync_opts="${PORTAGE_RSYNC_OPTS} ${PORTAGE_RSYNC_EXTRA_OPTS}"
-		if chown ${ownership} portage > /dev/null 2>&1; then
-			chown -R ${ownership} portage
+		if chown ${ownership} "${TMPDIR}"/portage > /dev/null 2>&1; then
+			chown -R ${ownership} "${TMPDIR}"/portage
 			rsync_opts+=" --owner --group"
 		fi
-		cd portage
+		cd "${TMPDIR}"/portage
 		rsync ${rsync_opts} . "${PORTDIR%%/}"
-		cd ..
-		echo "cleaning up"
-		rm -rf portage
+		cd "${DISTDIR}"
+
+		__vecho "Cleaning up ..."
+		rm -fr "${TMPDIR}"
 	fi
+
 	if has metadata-transfer ${FEATURES} ; then
-		echo "Updating cache ..."
+		__vecho "Updating cache ..."
 		"${PORTAGE_BIN_PATH}/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
+	return 0
+}
+
+do_snapshot() {
+	local ignore_timestamp="$1"
+	local date="$2"
+
+	local r=1
+
+	local base_file="portage-${date}.tar"
+
+	local have_files=0
+	local mirror
+
+	local compressions=""
+	type -P bzcat > /dev/null && compressions="${compressions} bz2"
+
+	if [[ -z ${compressions} ]] ; then
+		eecho "unable to locate any decompressors (xzcat or bzcat or zcat)"
+		exit 1
+	fi
+
+	for mirror in ${GENTOO_MIRRORS} ; do
+
+		mirror=${mirror%/}
+		__vecho "Trying to retrieve ${date} snapshot from ${mirror} ..."
+
+		for compression in ${compressions} ; do
+			local file="portage-${date}.tar.${compression}"
+			local digest="${file}.md5sum"
+			local signature="${file}.gpgsig"
+
+			if [ -s "${DISTDIR}/${file}" -a -s "${DISTDIR}/${digest}" -a -s "${DISTDIR}/${signature}" ] ; then
+				check_file_digest "${DISTDIR}/${digest}" "${DISTDIR}/${file}" && \
+				check_file_signature "${DISTDIR}/${signature}" "${DISTDIR}/${file}" && \
+				have_files=1
+			fi
+
+			if [ ${have_files} -eq 0 ] ; then
+				fetch_file "${mirror}/snapshots/${digest}" "${digest}" && \
+				fetch_file "${mirror}/snapshots/${signature}" "${signature}" && \
+				fetch_file "${mirror}/snapshots/${file}" "${file}" && \
+				check_file_digest "${DISTDIR}/${digest}" "${DISTDIR}/${file}" && \
+				check_file_signature "${DISTDIR}/${signature}" "${DISTDIR}/${file}" && \
+				have_files=1
+			fi
+
+			#
+			# If timestamp is invalid
+			# we want to try and retrieve
+			# from a different mirror
+			#
+			if [ ${have_files} -eq 1 ]; then
+
+				__vecho "Getting snapshot timestamp ..."
+				local snapshot_timestamp=$(get_snapshot_timestamp "${DISTDIR}/${file}")
+
+				if [ ${ignore_timestamp} == 0 ]; then
+					if [ ${snapshot_timestamp} -lt $(get_portage_timestamp) ]; then
+						wecho "portage is newer than snapshot"
+						have_files=0
+					fi
+				else
+					local utc_seconds=$(get_utc_second_from_string "${date}")
+
+					#
+					# Check that this snapshot
+					# is what it claims to be ...
+					#
+					if [ ${snapshot_timestamp} -lt ${utc_seconds} ] || \
+						[ ${snapshot_timestamp} -gt $((${utc_seconds}+ 2*86400)) ]; then
+
+						wecho "snapshot timestamp is not in acceptable period"
+						have_files=0
+					fi
+				fi
+			fi
+
+			if [ ${have_files} -eq 1 ]; then
+				break
+			else
+				#
+				# Remove files and use a different mirror
+				#
+				rm -f "${DISTDIR}/${file}" "${DISTDIR}/${digest}" "${DISTDIR}/${signature}"
+			fi
+		done
+
+		[ ${have_files} -eq 1 ] && break
+	done
+
+	if [ ${have_files} -eq 1 ]; then
+		sync_local "${DISTDIR}/${file}" && r=0
+	else
+		__vecho "${date} snapshot was not found"
+	fi
+
+	return "${r}"
+}
+
+do_latest_snapshot() {
+	local attempts=0
+	local r=1
+
+	__vecho "Fetching most recent snapshot ..."
+
+	# The snapshot for a given day is generated at 00:45 UTC on the following
+	# day, so the current day's snapshot (going by UTC time) hasn't been
+	# generated yet.  Therefore, always start by looking for the previous day's
+	# snapshot (for attempts=1, subtract 1 day from the current UTC time).
+
+	# Timestamps that differ by less than 2 hours
+	# are considered to be approximately equal.
+	local min_time_diff=$(( 2 * 60 * 60 ))
+
+	local existing_timestamp=$(get_portage_timestamp)
+	local timestamp_difference
+	local timestamp_problem
+	local approx_snapshot_time
+	local start_time=$(get_utc_date_in_seconds)
+	local start_hour=$(get_date_part ${start_time} "%H")
+
+	# Daily snapshots are created at 00:45 and are not
+	# available until after 01:00. Don't waste time trying
+	# to fetch a snapshot before it's been created.
+	if [ ${start_hour} -lt 1 ] ; then
+		(( start_time -= 86400 ))
+	fi
+	local snapshot_date=$(get_date_part ${start_time} "%Y%m%d")
+	local snapshot_date_seconds=$(get_utc_second_from_string ${snapshot_date})
+
+	while (( ${attempts} <  40 )) ; do
+		(( attempts++ ))
+		(( snapshot_date_seconds -= 86400 ))
+		# snapshots are created at 00:45
+		(( approx_snapshot_time = snapshot_date_seconds + 86400 + 2700 ))
+		(( timestamp_difference = existing_timestamp - approx_snapshot_time ))
+		[ ${timestamp_difference} -lt 0 ] && (( timestamp_difference = -1 * timestamp_difference ))
+		snapshot_date=$(get_date_part ${snapshot_date_seconds} "%Y%m%d")
+
+		timestamp_problem=""
+		if [ ${timestamp_difference} -eq 0 ]; then
+			timestamp_problem="is identical to"
+		elif [ ${timestamp_difference} -lt ${min_time_diff} ]; then
+			timestamp_problem="is possibly identical to"
+		elif [ ${approx_snapshot_time} -lt ${existing_timestamp} ] ; then
+			timestamp_problem="is newer than"
+		fi
+
+		if [ -n "${timestamp_problem}" ]; then
+			ewarn "Latest snapshot date: ${snapshot_date}"
+			ewarn
+			ewarn "Approximate snapshot timestamp: ${approx_snapshot_time}"
+			ewarn "       Current local timestamp: ${existing_timestamp}"
+			ewarn
+			echo -e "The current local timestamp" \
+				"${timestamp_problem} the" \
+				"timestamp of the latest" \
+				"snapshot. In order to force sync," \
+				"use the --revert option or remove" \
+				"the timestamp file located at" \
+				"'${PORTDIR}/metadata/timestamp.x'." | fmt -w 70 | \
+				while read -r line ; do
+					ewarn "${line}"
+				done
+			r=0
+			break
+		fi
+
+		if do_snapshot 0 "${snapshot_date}"; then
+			r=0
+			break;
+		fi
+	done
+
+	return "${r}"
 }
 
 fetch_from_mirrors() {
@@ -334,57 +520,20 @@ fetch_from_mirrors() {
 	FILE="$2"
 	for i in $MIRRORS ; do
 		URI="${i%/}/${1#/}"
-		if (eval "$FETCHCOMMAND $wgetops") && [ -s "${FILE}" ]; then
-			return 0
-		else
-			rm -f "${FILE}" &> /dev/null
-		fi
+		fetch_file "${URI}" "${FILE}" && return 0
 	done
 	return 1
 }
 
 verify_md5_file() {
-	local FILE MD5_LOC CUR
+	local FILE MD5_LOC
 	FILE="$1"
 	if [[ $# == 2 ]]; then
 		MD5_LOC="$2"
 	else
 		MD5_LOC="$(pwd)/$1.md5sum"
 	fi
-	if [ "${FILE/*\/}" != "$1" ]; then
-		CUR="$(pwd)"
-		cd "$(dirname ${FILE})"
-		FILE="$(basename ${FILE})"
-	fi
-	if eval "$md5_com"; then
-		[ -n "${CUR}" ] && cd "${CUR}"
-		return 0
-	else
-		[ -n "${CUR}" ] && cd "${CUR}"
-		return 1
-	fi
-}
-
-check_file_signature() {
-	local signature="$1"
-	local file="$2"
-	local r=1
-
-	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
-		else
-			eecho "cannot check signature: gpg binary not found"
-			exit 1
-		fi
-	else
-		r=0
-	fi
-
-	return "${r}"
+	check_file_digest "${MD5_LOC}" "${FILE}"
 }
 
 #--------------------
@@ -397,7 +546,11 @@ if ! type -p patcher &> /dev/null; then
 	echo "!!! lack of patcher == have to do full fetch"
 	echo "!!!"
 	sleep 10
-	full_version_attempt
+	if do_latest_snapshot; then
+		cleanse_state_dir
+		exit 0
+	fi
+	exit 1
 fi
 
 echo "Looking for available base versions for a delta"
@@ -443,7 +596,11 @@ done
 #by this point, we either have a base_version, or we don't.
 if [[ -z ${base_version} ]]; then
 	echo "no base found.  resorting to pulling a full version"
-	full_version_attempt
+	if do_latest_snapshot; then
+		cleanse_state_dir
+		exit 0
+	fi
+	exit 1
 fi
 
 #we have a md5 verified base.  now we get the patch.
@@ -495,6 +652,15 @@ if [[ -z $patches ]]; then
 	echo "no patches found? up to date?"
 	if [[ -n $MUST_SYNC ]]; then
 		echo "syncing with existing file"
+		if [[ ${WEBSYNC_VERIFY_SIGNATURE} == 1 &&
+			! -e ${DISTDIR}/portage-${base_date}.tar.bz2.gpgsig ]] && \
+			! fetch_from_mirrors "/snapshots/portage-${base_date}.tar.bz2.gpgsig" "portage-${base_date}.tar.bz2.gpgsig" ; then
+			eecho "Couldn't fetch portage-${base_date}.tar.bz2.gpgsig"
+			exit 5
+		fi
+		if [[ ${WEBSYNC_VERIFY_SIGNATURE} == 1 ]] ; then
+			check_file_signature "${DISTDIR}/portage-${base_date}.tar.bz2.gpgsig" "${dfile}" || exit 1
+		fi
 		sync_local "${dfile}"
 	else
 		:
@@ -532,7 +698,11 @@ fi
 if ! patcher -v "${dfile}" ${patches} "${TMPDIR}/portage-${final_date}.tar"; then
 	echo "reconstruction failed (contact the author with the error from the reconstructor please)"
 	rm -f "${TMPDIR}/portage-${final_date}.tar"
-	full_version_attempt
+	if do_latest_snapshot; then
+		cleanse_state_dir
+		exit 0
+	fi
+	exit 1
 fi
 verified=0
 if [[ -n $got_umd5 ]]; then


^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [gentoo-commits] proj/portage:master commit in: misc/
@ 2013-06-22  6:14 Zac Medico
  0 siblings, 0 replies; 32+ messages in thread
From: Zac Medico @ 2013-06-22  6:14 UTC (permalink / raw
  To: gentoo-commits

commit:     fd7f9a8fd0761d3cfbb2ffa603bb71003a528735
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Sat Jun 22 06:14:35 2013 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Sat Jun 22 06:14:35 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=fd7f9a8f

emerge-delta-webrsync: clean TMPDIR more

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

diff --git a/misc/emerge-delta-webrsync b/misc/emerge-delta-webrsync
index 85ee656..a80c976 100755
--- a/misc/emerge-delta-webrsync
+++ b/misc/emerge-delta-webrsync
@@ -547,6 +547,7 @@ if ! type -p patcher &> /dev/null; then
 	echo "!!!"
 	sleep 10
 	if do_latest_snapshot; then
+		rm -fr "${TMPDIR}"
 		cleanse_state_dir
 		exit 0
 	fi
@@ -597,6 +598,7 @@ done
 if [[ -z ${base_version} ]]; then
 	echo "no base found.  resorting to pulling a full version"
 	if do_latest_snapshot; then
+		rm -fr "${TMPDIR}"
 		cleanse_state_dir
 		exit 0
 	fi
@@ -661,9 +663,9 @@ if [[ -z $patches ]]; then
 		if [[ ${WEBSYNC_VERIFY_SIGNATURE} == 1 ]] ; then
 			check_file_signature "${DISTDIR}/portage-${base_date}.tar.bz2.gpgsig" "${dfile}" || exit 1
 		fi
-		sync_local "${dfile}"
+		sync_local "${dfile}" && rm -fr "${TMPDIR}"
 	else
-		:
+		rm -fr "${TMPDIR}"
 	fi
 	exit $?
 fi
@@ -699,6 +701,7 @@ if ! patcher -v "${dfile}" ${patches} "${TMPDIR}/portage-${final_date}.tar"; the
 	echo "reconstruction failed (contact the author with the error from the reconstructor please)"
 	rm -f "${TMPDIR}/portage-${final_date}.tar"
 	if do_latest_snapshot; then
+		rm -fr "${TMPDIR}"
 		cleanse_state_dir
 		exit 0
 	fi


^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [gentoo-commits] proj/portage:master commit in: misc/
@ 2013-07-10 20:16 Zac Medico
  0 siblings, 0 replies; 32+ messages in thread
From: Zac Medico @ 2013-07-10 20:16 UTC (permalink / raw
  To: gentoo-commits

commit:     4ab31da4f09c7d0cb323b16b5b4b607d652ffc48
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Wed Jul 10 20:15:45 2013 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Wed Jul 10 20:15:45 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=4ab31da4

emerge-delta-webrsync: cleanup deltas

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

diff --git a/misc/emerge-delta-webrsync b/misc/emerge-delta-webrsync
index f7f82f8..9c27702 100755
--- a/misc/emerge-delta-webrsync
+++ b/misc/emerge-delta-webrsync
@@ -785,6 +785,10 @@ if [ -z "${need_last_sync}" ]; then
 	sync_local "${dfile}"
 fi
 
+for x in ${patches} ; do
+	rm -f "${DISTDIR}/${x}"{,.md5sum}
+done
+
 if [[ -z $KEEP_OLDIES ]]; then
 	echo "cleansing"
 	for x in $potentials; do


^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [gentoo-commits] proj/portage:master commit in: misc/
@ 2014-10-19 17:19 Zac Medico
  0 siblings, 0 replies; 32+ messages in thread
From: Zac Medico @ 2014-10-19 17:19 UTC (permalink / raw
  To: gentoo-commits

commit:     84bba68958ccf8d84a271f110fdb858e4f7700b4
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Wed Oct  8 17:56:31 2014 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Sun Oct 19 17:18:10 2014 +0000
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


^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [gentoo-commits] proj/portage:master commit in: misc/
@ 2015-11-06  5:31 Zac Medico
  0 siblings, 0 replies; 32+ messages in thread
From: Zac Medico @ 2015-11-06  5:31 UTC (permalink / raw
  To: gentoo-commits

commit:     d2ae2f85a34e27a6b458cb51cac008686911e8ce
Author:     Xiami <i <AT> f2light <DOT> com>
AuthorDate: Fri Nov  6 05:24:48 2015 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Fri Nov  6 05:30:44 2015 +0000
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"


^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [gentoo-commits] proj/portage:master commit in: misc/
@ 2018-02-01  6:18 Zac Medico
  0 siblings, 0 replies; 32+ messages in thread
From: Zac Medico @ 2018-02-01  6:18 UTC (permalink / raw
  To: gentoo-commits

commit:     52d5d444ffb144911ca9b6e70b383405a8bd8af6
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Thu Feb  1 06:16:45 2018 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Thu Feb  1 06:16:45 2018 +0000
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


^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [gentoo-commits] proj/portage:master commit in: misc/
@ 2018-07-28  6:12 Zac Medico
  0 siblings, 0 replies; 32+ messages in thread
From: Zac Medico @ 2018-07-28  6:12 UTC (permalink / raw
  To: gentoo-commits

commit:     dd307922c584faa8be13468261dbedb0cc65b181
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Fri Jul 27 06:30:36 2018 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Sat Jul 28 05:53:08 2018 +0000
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 <dolsen <AT> 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


^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [gentoo-commits] proj/portage:master commit in: misc/
@ 2018-07-28  6:20 Zac Medico
  0 siblings, 0 replies; 32+ messages in thread
From: Zac Medico @ 2018-07-28  6:20 UTC (permalink / raw
  To: gentoo-commits

commit:     b8c070708bbc6d0db544d4b04b530d6d03d39bb5
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Sat Jul 28 06:15:53 2018 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Sat Jul 28 06:15:53 2018 +0000
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


^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [gentoo-commits] proj/portage:master commit in: misc/
@ 2019-12-09  9:30 Zac Medico
  0 siblings, 0 replies; 32+ messages in thread
From: Zac Medico @ 2019-12-09  9:30 UTC (permalink / raw
  To: gentoo-commits

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

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

Bug: https://bugs.gentoo.org/693454
Signed-off-by: Zac Medico <zmedico <AT> 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


^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [gentoo-commits] proj/portage:master commit in: misc/
@ 2019-12-30 21:36 Zac Medico
  0 siblings, 0 replies; 32+ messages in thread
From: Zac Medico @ 2019-12-30 21:36 UTC (permalink / raw
  To: gentoo-commits

commit:     82b29bdd12c1ea1002a455c98fa7958311b92ec3
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Mon Dec 30 21:34:29 2019 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Mon Dec 30 21:34:29 2019 +0000
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-YYYYMMDD directory name")
Bug: https://bugs.gentoo.org/704256
Signed-off-by: Zac Medico <zmedico <AT> 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}"
 


^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [gentoo-commits] proj/portage:master commit in: misc/
@ 2023-08-19 13:35 Sam James
  0 siblings, 0 replies; 32+ messages in thread
From: Sam James @ 2023-08-19 13:35 UTC (permalink / raw
  To: gentoo-commits

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

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

Signed-off-by: Sam James <sam <AT> 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 <ferringb@gentoo.org>, karltk@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"


^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [gentoo-commits] proj/portage:master commit in: misc/
@ 2023-08-19 15:03 Sam James
  0 siblings, 0 replies; 32+ messages in thread
From: Sam James @ 2023-08-19 15:03 UTC (permalink / raw
  To: gentoo-commits

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

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

Signed-off-by: Sam James <sam <AT> 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}"


^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [gentoo-commits] proj/portage:master commit in: misc/
@ 2023-08-19 15:03 Sam James
  0 siblings, 0 replies; 32+ messages in thread
From: Sam James @ 2023-08-19 15:03 UTC (permalink / raw
  To: gentoo-commits

commit:     058af64372fc6937cb83e58653133f2dba47d410
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Sat Aug 19 15:02:17 2023 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Sat Aug 19 15:02:17 2023 +0000
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 <sam <AT> 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 )


^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [gentoo-commits] proj/portage:master commit in: misc/
@ 2023-08-19 15:42 Sam James
  0 siblings, 0 replies; 32+ messages in thread
From: Sam James @ 2023-08-19 15:42 UTC (permalink / raw
  To: gentoo-commits

commit:     591f0826a15e437eb02e2eddf8ed1487b05f5e94
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Sat Aug 19 15:16:04 2023 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Sat Aug 19 15:16:04 2023 +0000
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 <sam <AT> 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


^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [gentoo-commits] proj/portage:master commit in: misc/
@ 2023-11-11  7:24 Sam James
  0 siblings, 0 replies; 32+ messages in thread
From: Sam James @ 2023-11-11  7:24 UTC (permalink / raw
  To: gentoo-commits

commit:     f511b5a1f55df1cd7b322d50ce0f0c5a4e24d81c
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Sat Nov 11 05:52:53 2023 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Sat Nov 11 07:24:02 2023 +0000
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 <sam <AT> 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}/\?::" > \


^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [gentoo-commits] proj/portage:master commit in: misc/
@ 2024-01-29  1:22 Zac Medico
  0 siblings, 0 replies; 32+ messages in thread
From: Zac Medico @ 2024-01-29  1:22 UTC (permalink / raw
  To: gentoo-commits

commit:     86a3bfce1e399b3274143df00e68c762d3666724
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Mon Jan 29 00:48:53 2024 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Mon Jan 29 00:52:05 2024 +0000
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-YYYYMMDD directory name")
Signed-off-by: Zac Medico <zmedico <AT> 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}"


^ permalink raw reply related	[flat|nested] 32+ messages in thread

end of thread, other threads:[~2024-01-29  1:22 UTC | newest]

Thread overview: 32+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-08-19 15:03 [gentoo-commits] proj/portage:master commit in: misc/ Sam James
  -- strict thread matches above, loose matches on Subject: below --
2024-01-29  1:22 Zac Medico
2023-11-11  7:24 Sam James
2023-08-19 15:42 Sam James
2023-08-19 15:03 Sam James
2023-08-19 13:35 Sam James
2019-12-30 21:36 Zac Medico
2019-12-09  9:30 Zac Medico
2018-07-28  6:20 Zac Medico
2018-07-28  6:12 Zac Medico
2018-02-01  6:18 Zac Medico
2015-11-06  5:31 Zac Medico
2014-10-19 17:19 Zac Medico
2013-07-10 20:16 Zac Medico
2013-06-22  6:14 Zac Medico
2013-06-22  5:54 Zac Medico
2013-01-28 21:45 Zac Medico
2012-09-14  7:26 Zac Medico
2012-08-19  5:44 Zac Medico
2012-08-19  5:21 Zac Medico
2012-08-18 22:51 Zac Medico
2012-08-18 20:51 Zac Medico
2012-08-18 20:32 Zac Medico
2012-08-18  1:45 Zac Medico
2012-08-18  1:28 Zac Medico
2012-08-18  1:28 Zac Medico
2012-08-18  1:28 Zac Medico
2012-08-18  1:28 Zac Medico
2012-08-18  1:28 Zac Medico
2012-08-18  1:28 Zac Medico
2012-08-18  1:28 Zac Medico
2012-08-18  0:09 Zac Medico

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