Go to:
Gentoo Home
Documentation
Forums
Lists
Bugs
Planet
Store
Wiki
Get Gentoo!
Gentoo's Bugzilla – Attachment 50025 Details for
Bug 80148
[PATCH] Add last successful snapshot date support to emerge-webrsync
Home
|
New
–
[Ex]
|
Browse
|
Search
|
Privacy Policy
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Corrected patch
emerge-webrsync.patch (text/plain), 6.32 KB, created by
James Roberts-Thomson
on 2005-01-30 17:36:20 UTC
(
hide
)
Description:
Corrected patch
Filename:
MIME Type:
Creator:
James Roberts-Thomson
Created:
2005-01-30 17:36:20 UTC
Size:
6.32 KB
patch
obsolete
>--- /usr/sbin/emerge-webrsync 2005-01-31 13:49:44.000000000 +1300 >+++ ./emerge-webrsync 2005-01-31 14:34:05.376407043 +1300 >@@ -4,6 +4,53 @@ > # $Header: /var/cvsroot/gentoo-src/portage/bin/Attic/emerge-webrsync,v 1.8.2.3 2005/01/17 16:38:22 jstubbs Exp $ > # Author: Karl Trygve Kalleberg <karltk@gentoo.org> > # Rewritten from the old, Perl-based emerge-webrsync script >+# Snapshot date verification etc added by James Roberts-Thomson >+ >+showhelp() { >+ echo "Usage: $0 [-v] [-n|-N], where:" >+ echo " -v indicates verbose wgets" >+ echo " -n prevents downloading, just looks for previously downloaded snapshot" >+ exit 1 >+} >+ >+invalid_parameter() { >+ echo "Error: \"${_cmd_options}\" is not a valid parameter." >+ echo "" >+ showhelp >+} >+ >+store_date() { >+ if [ ! -d "/var/lib/portage" ]; then mkdir -p /var/lib/portage; fi >+ echo $1 > /var/lib/portage/webrsync-date >+} >+ >+check_date() { >+ if [ -f "/var/lib/portage/webrsync-date" ]; then >+ if [ "$1" == "`cat /var/lib/portage/webrsync-date`" ]; then >+ exit 1 >+ else >+ exit 0 >+ fi >+ else >+ exit 0 >+ fi >+} >+ >+found=0 >+attempts=0 >+download=1 >+_optv=0 >+_optn=0 >+ >+# Iterate through any command-line options (if supplied), and set appropriate variables >+for _cmd_options do >+ case "${_cmd_options}" in >+ -v) _optv=1 ;; >+ -n) _optn=1 ;; >+ -\?|-h|-H) showhelp;; >+ *) invalid_parameter;; >+ esac >+done > > GENTOO_MIRRORS="${GENTOO_MIRRORS} $(/usr/lib/portage/bin/portageq gentoo_mirrors)" > PORTDIR="$(/usr/lib/portage/bin/portageq portdir)" >@@ -17,8 +64,7 @@ fi > > cd "$DISTDIR" > >-found=0 >-if [ "$1" == "-v" ] ; then >+if [ "${_optv}" = "1" ] ; then > wgetops= > else > #this sucks. probably better to do 1> /dev/null >@@ -30,6 +76,10 @@ else > fi > fi > >+if [ "${_optn}" = "1" ] ; then >+ download=0 >+fi >+ > if type -p md5sum > /dev/null; then > md5_com='md5sum -c "${FILE}.md5sum"' > elif type -p md5 > /dev/null; then >@@ -41,27 +91,50 @@ else > fi > > sync_local() { >- echo Syncing local tree... >- if ! tar jxf $FILE; then >- echo "Tar failed to extract the image. Please review the output." >- echo "Executed command: tar jxf $FILE" >- exit 1 >+# echo Syncing local tree... >+# if ! tar jxf $FILE; then >+# echo "Tar failed to extract the image. Please review the output." >+# echo "Executed command: tar jxf $FILE" >+# exit 1 >+# fi >+# rm -f $FILE >+# rm -f ${FILE}.md5sum >+# # 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 >+# echo "transferring metadata/cache" >+# emerge metadata >+ store_date ${year}${month}${day} >+} >+ >+get_md5file() { >+ if [ ! -s "${FILE_ORIG}.md5sum" ]; then >+ FILE_ORIG="${FILE}" >+ FILE="${FILE}.md5sum" >+ for i in $GENTOO_MIRRORS ; do >+ URI="${i}/snapshots/${FILE}" >+ if (eval "$FETCHCOMMAND $wgetops") && [ -s "${FILE}" ]; then >+ got_md5=1 >+ break >+ fi >+ done >+ else >+ got_md5=1 > fi >- rm -f $FILE >- # 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 >- echo "transferring metadata/cache" >- emerge metadata >+ FILE="${FILE_ORIG}" > } > >-echo "Fetching most recent snapshot" >+if [ $download == 1 ]; then >+ echo "Fetching most recent snapshot" >+else >+ echo "Using most recently downloaded snapshot" >+fi > > declare -i attempts=-1 > while (( $attempts < 40 )) ; do >@@ -79,61 +152,68 @@ while (( $attempts < 40 )) ; do > year=$(date -d "-$attempts day" +"%Y") > fi > >- FILE_ORIG="portage-${year}${month}${day}.tar.bz2" >+ if (check_date ${year}${month}${day}) >+ then >+ FILE="portage-${year}${month}${day}.tar.bz2" > >- echo "Attempting to fetch file dated: ${year}${month}${day}" >- >- got_md5=0 >+ [ "$_optn" == "0" ] && echo "Attempting to fetch file dated: ${year}${month}${day}" > >- if [ ! -e "${FILE_ORIG}.md5sum" ]; then >- FILE="${FILE_ORIG}.md5sum" >- for i in $GENTOO_MIRRORS ; do >- URI="${i}/snapshots/${FILE}" >- if (eval "$FETCHCOMMAND $wgetops") && [ -s "${FILE}" ]; then >- got_md5=1 >- break >+ got_md5=0 >+ >+ if [ "$download" = "1" ] >+ then >+ get_md5file >+ >+ if (($got_md5 == 0 )); then >+ echo " --- No md5sum present on the mirror. (Not yet available.)" >+ continue > fi >- done >- else >- got_md5=1 >- fi >- FILE="${FILE_ORIG}" > >- if (($got_md5 == 0 )); then >- echo " --- No md5sum present on the mirror. (Not yet available.)" >- continue >- elif [ -s "${FILE}" ]; then >- if eval "$md5_com"; then >- echo " === snapshot $FILE is correct, using it" >- sync_local >- echo >- echo " === Snapshot has beed sync'd" >- echo >- exit 0 >+ for i in $GENTOO_MIRRORS ; do >+ URI="${i}/snapshots/$FILE" >+ rm -f "$FILE" >+ if (eval "$FETCHCOMMAND $wgetops") && [ -s "$FILE" ]; then >+ if ! eval "$md5_com"; then >+ echo "md5 failed on $FILE" >+ rm ${FILE} >+ rm ${FILE}.md5sum >+ continue >+ else >+ sync_local >+ echo >+ echo " *** Completed websync, please now perform a normal rsync if possible." >+ echo " Update is current as of the of YYYYMMDD: ${year}${month}${day}" >+ echo >+ exit 0 >+ fi >+ fi >+ done > else >- rm $FILE >- fi >- fi >- >- for i in $GENTOO_MIRRORS ; do >- URI="${i}/snapshots/$FILE" >- rm -f "$FILE" >- if (eval "$FETCHCOMMAND $wgetops") && [ -s "$FILE" ]; then >- if ! eval "$md5_com"; then >- echo "md5 failed on $FILE" >- rm ${FILE} >- continue >- else >- sync_local >- echo >- echo " *** Completed websync, please now perform a normal rsync if possible." >- echo " Update is current as of the of YYYYMMDD: ${year}${month}${day}" >- echo >- exit 0 >+ if [ -s "${FILE}" ] >+ then >+ echo " === found snapshot $FILE" >+ if [ ! -s "${FILE}.md5sum" ]; then >+ echo " === no MD5 checksum, trying to fetch one" >+ get_md5file >+ fi >+ if eval "$md5_com"; then >+ echo " === snapshot $FILE is correct, using it" >+ sync_local >+ echo >+ echo " === Snapshot has beed sync'd" >+ echo >+ exit 0 >+ else >+ echo " === unable to verify snapshot $FILE, removing it" >+ rm $FILE >+ rm -f ${FILE}.md5sum >+ fi > fi > fi >- >- done >+ else >+ echo "Earlier snapshot date reached - aborting" >+ attempts=999 >+ fi > done > > rm -rf portage
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 80148
:
50009
|
50025
|
50086