Eddy Petrişor" wrote:
> I managed to test it on MAC OS X with fink and found an interesting
> thing: not all regex implmentation work well enough to write something
> like: 'sed -e s/[, ]\+/ /g' so I changed this into "sed -e s/[, ]/ /g
> | tr -s ' '"
correct. "+" is an extended regex, and sed should not understand it
(but in extended mode -r)
>
> I have also disabled (commented) the code that was supposed to
> calculate the size of the block because the obtained info was not used
> at all.
>
> I added the missing shift commands in the parameter interpretation in
> common.sh
> and added a TODO list for developemnt (this should be different than
> ENHANCEMENTS)
>
> The generated code looks good.
>
>
> Please apply the attached patch over your apt-zip-0.13.6 variant.
BTW I had already applied and upload your previous patch.
Now I reverted it and applied the new patch.
You patch format seems to have problems:
debian/changelog and not debian/Changelog
and some of "(Stripping trailing CRs from patch.)"
warning.
And I've uploaded apt-zip 0.13.7 with the new changes.
ciao
cate
>
>
> ------------------------------------------------------------------------
>
> diff -ruN apt-zip-0.13.6/TODO apt-zip-0.13.6.real_sleep_fix/TODO
> --- apt-zip-0.13.6/TODO Thu Jan 1 02:00:00 1970
> +++ apt-zip-0.13.6.real_sleep_fix/TODO Mon Mar 6 09:43:56 2006
> @@ -0,0 +1,10 @@
> +Hey Emacs, this is -*- text -*- file.
> +
> +Open points that should be closed:
> +- document in the man page the newly added options: -S/--use-sleep
> +- document in the man page that apt-zip-list can now be ran as non-root
> +- use a consistent indenting schema (take care that method scripts are
> + dealt differently and should have mixed indenting in order to have nicely
> + indeneted generated scripts)
> +
> +* -- File last reviewed: 2006/03/06
> diff -ruN apt-zip-0.13.6/apt-zip-list
> apt-zip-0.13.6.real_sleep_fix/apt-zip-list
> --- apt-zip-0.13.6/apt-zip-list Sat Feb 18 18:16:12 2006
> +++ apt-zip-0.13.6.real_sleep_fix/apt-zip-list Mon Mar 6 09:37:00 2006
> @@ -2,7 +2,8 @@
>
> exithook()
> {
> - rm -f "$TMP" "$TEMP" "$BSTMP"
> + #rm -f "$TMP" "$TEMP" "$BSTMP"
> + rm -f "$TMP" "$TEMP"
> }
>
> SHAREDIR=$(cd $(dirname $0) && pwd)
> @@ -18,15 +19,15 @@
> APTGETEXTRAOPTS="${APTGETEXTRAOPTS} -o Debug::NoLocking=true"
>
> # Find block size on zip
> -BSTMP=$(tempfile -d "$MEDIUM" -p aptzip)
> -if [ $? != 0 ]
> -then
> - error "Could not create temporary file"
> -fi
> -
> -echo "bs test" > "$BSTMP"
> -BLOCKSIZE=$(du -b "$BSTMP" | cut -f1)
> -rm "$BSTMP"
> +#BSTMP=$(tempfile -d "$MEDIUM" -p aptzip)
> +#if [ $? != 0 ]
> +#then
> +# error "Could not create temporary file"
> +#fi
> +
> +#echo "bs test" > "$BSTMP"
> +#BLOCKSIZE=$(du -b "$BSTMP" | cut -f1)
> +#rm "$BSTMP"
> #echo >&2 "Block size = $BLOCKSIZE"
>
> TMP=$(tempfile -p aptzip)
> @@ -64,6 +65,10 @@
> #SIZE0=$(echo 'n' | apt-get ${APTGETEXTRAOPTS} dselect-upgrade | grep '^Need
> to get' | cut -d' ' -f4)
>
> #error "Size0 = $SIZE0 - Size = $SIZE blocks = $[ $SIZE * $BLOCKSIZE ]"
> +
> +#export the sleep command so it is visible in the method script
> +export SLEEPTIME
> +export SLEEPCMD=`eval "$SLEEPEVALCMD"`
>
> # Write the script
> SCRIPT="${MEDIUM}"/fetch-script-$METHOD-$(uname -n)
> diff -ruN apt-zip-0.13.6/common.sh apt-zip-0.13.6.real_sleep_fix/common.sh
> --- apt-zip-0.13.6/common.sh Tue Feb 7 01:50:50 2006
> +++ apt-zip-0.13.6.real_sleep_fix/common.sh Mon Mar 6 09:50:04 2006
> @@ -54,6 +54,7 @@
> Overrides the name of the options file with the given FILENAME
> -f, --fix-broken Call apt-get with this flag
> -s, --skip-mount Do not mount a device on the dir specified by --medium
> + -S, --use-sleep=SEC Wait SEC seconds after each download
> EOF
> }
>
> @@ -99,7 +100,7 @@
> }
> check_packages()
> {
> - PACKAGES=$(echo "$PACKAGES" | sed -e "s/[, ]\+/ /g")
> + PACKAGES=$(echo "$PACKAGES" | sed -e "s/[, ]/ /g" | tr -s ' ')
> }
> check_aptgetaction()
> {
> @@ -109,7 +110,9 @@
> }
> az_loadconf()
> {
> - SLEEPTIME=0
> + # make sure that we will have a valid command for sleep
> + SLEEPTIME=0
> + SLEEPEVALCMD='true'
> [ -r $CONFFILE ] && . $CONFFILE
> METHOD=${METHOD-wget}
> MEDIUM=${MEDIUM-/ZIP}
> @@ -162,12 +165,17 @@
> shift
> ;;
> --use-sleep=*)
> - SLEEPTIME="${1#--use-sleep=}"
> - ;;
> - --use-sleep)
> + SLEEPTIME="${1#--use-sleep=}"
> + SLEEPEVALCMD='echo "[ ! -z "\`type sleep\`" ] && sleep
> ${SLEEPTIME}"'
> + shift
> + ;;
> + --use-sleep|-S)
> if [ $# -lt 2 ]; then syntax_error "$1 needs an argument"; fi
> - SLEEPTIME=$2
> - ;;
> + SLEEPTIME=$2
> + SLEEPEVALCMD='echo "[ ! -z "\`type sleep\`" ] && sleep
> ${SLEEPTIME}"'
> + shift
> + shift
> + ;;
> --aptgetaction=*)
> APTGETACTION=${1#--aptgetaction=}
> shift
> @@ -251,9 +259,9 @@
> # ensure known opts are set to 0 if not requested
> for kopt in $KNOWNOPTIONS
> do
> - eval export OPTION_${kopt}=0
> + eval export OPTION_${kopt}=0
> done
> -
> +
> for opt in $OPTIONS
> do
> # Warn if unknown option
> @@ -297,7 +305,7 @@
> WAS_MOUNTED=1
> if mount | grep "${MEDIUM}.*[(,]ro[,)]" >/dev/null
> then
> - error "$MEDIUM is mounted READ ONLY"
> + error "$MEDIUM is mounted READ ONLY"
> fi
> else
> WAS_MOUNTED=0
> diff -ruN apt-zip-0.13.6/debian/Changelog
> apt-zip-0.13.6.real_sleep_fix/debian/Changelog
> --- apt-zip-0.13.6/debian/Changelog Wed Feb 22 09:13:20 2006
> +++ apt-zip-0.13.6.real_sleep_fix/debian/Changelog Mon Mar 6 09:37:00 2006
> @@ -11,6 +11,9 @@
> * renamed TODO to ENHANCEMENTS
> * added TODO in order to store devlopment related info in it
> * added info regarding updates via modem and apt-zip (closes: #181042)
> + * Improved handling of the PACKAGES list not to depend on good
> + implementations of sed
> + * disabled BLOCKSIZE unused code
>
> -- Giacomo Catenazzi <[EMAIL PROTECTED]> Wed, 22 Feb 2006 07:54:33 +0100
>
> diff -ruN apt-zip-0.13.6/methods/wget
> apt-zip-0.13.6.real_sleep_fix/methods/wget
> --- apt-zip-0.13.6/methods/wget Wed Feb 22 09:13:08 2006
> +++ apt-zip-0.13.6.real_sleep_fix/methods/wget Mon Mar 6 09:37:00 2006
> @@ -55,7 +55,7 @@
>
> do_wget() {
> wget -t3 -nv -O \$2 \$1
> - [ ! -z `type sleep` ] && sleep "${SLEEPTIME}"
> + ${SLEEPCMD}
> return \$?
> }
>
> @@ -80,7 +80,7 @@
> if [ -r \$2 ] ; then echo "Already got \$2"; return 0;
> fi
> fi
> wget -nc -t3 -nv -O \$2 \$1
> - [ ! -z `type sleep` ] && "sleep ${SLEEPTIME}"
> + ${SLEEPCMD}
> return \$?
> }
>
> @@ -90,7 +90,7 @@
> do_wget() {
> if [ -r ../\$2 ] ; then echo "Already got \$2"; return 1; fi
> wget -t3 -nv -O \$2 \$1
> - [ ! -z `type sleep` ] && sleep "${SLEEPTIME}"
> + ${SLEEPCMD}
> return \$?
> }
>