Skip to Content.
Sympa Menu

sm-commit - [SM-Commit] PERFORCE change 76787 by Andrew Stitt for review

sm-commit AT lists.ibiblio.org

Subject: Source Mage code commit list

List archive

Chronological Thread  
  • From: Perforce Review Daemon <p4review AT smee.org>
  • To: "Andrew Stitt" <a AT t.armory.com>, "Arjan Bouter" <abouter AT gmail.com>, "Arwed von Merkatz" <v.merkatz AT gmx.net>, "SM-Commit Daemon" <sm-commit AT lists.ibiblio.org>, "David Michael Leo Brown Jr." <dmlb2000 AT gmail.com>, "David Kowis" <dkowis+smgl-p4 AT shlrm.org>, "duane_malcolm" <d.malcolm AT auckland.ac.nz>, "Eric Sandall" <eric AT sandall.us>, "Jason Flatt" <jflatt AT sourcemage.org>, "Jeremy Blosser" <jblosser AT sourcemage.org>, "Karsten Behrmann" <bearperson AT gmx.net>, "Ladislav Hagara" <ladislav.hagara AT unob.cz>, "Maurizio Boriani" <baux AT member.fsf.org>, "paul_mahon" <pmahon AT sourcemage.org>, "Robin Cook" <rcook AT wyrms.net>, "Unet" <unet AT sourcemage.org>, "vladimir_marek" <vlmarek AT volny.cz>
  • Subject: [SM-Commit] PERFORCE change 76787 by Andrew Stitt for review
  • Date: Sat, 25 Mar 2006 22:35:01 +0000 (GMT)

Change 76787 by andrew_stitt@afk-courier on 2006/03/25 22:34:48

fix bug 10684

Affected files ...

... //sgl/sorcery/devel/ChangeLog#537 edit
... //sgl/sorcery/devel/var/lib/sorcery/modules/libapi#36 edit
... //sgl/sorcery/devel/var/lib/sorcery/modules/libunpack#22 edit

Differences ...

==== //sgl/sorcery/devel/ChangeLog#537 (text) ====

@@ -1,4 +1,9 @@
2006-03-25 Andrew Stitt <astitt AT sourcemage.org>
+ * libunpack: move verification code out of unpack_file and into
+ new verify_file function. Removed un-used inner loop.
+ * libapi: add entry point for verify_file. Fixes bug 10684.
+
+2006-03-25 Andrew Stitt <astitt AT sourcemage.org>
* libsorcery: remove LC_ALL hack
* cast: put slightly safer LC_ALL hack in cast around the build
phase. This fixes bug 10546, see also bug 2910.

==== //sgl/sorcery/devel/var/lib/sorcery/modules/libapi#36 (xtext) ====

@@ -77,6 +77,7 @@
# unpack (libunpack) (deprecated)
# unpack_file (libunpack)
# unpack_file_simple (libunpack)
+# verify_file (libunpack)
#
# Read-only variable that might be of use to a spell:
# SOURCE_CACHE, OPTS, BUILD HOST, INSTALL_ROOT
@@ -1056,6 +1057,21 @@

#---------------------------------------------------------------------
## @Type API
+## @param SOURCE suffix
+## @See <@function var.lib.sorcery.modules.libunpack.html,real_verify_file>
for more details.
+##
+## verify_file takes the SOURCE suffix and verifies the file without
+## unpacking it. It does not work with the old 'MD5[0]=...' style.
+## Only with the "new" SOURCEn_(GPG|HASH|IGNORE) style.
+##
+#---------------------------------------------------------------------
+function verify_file () {
+ debug "libapi" "verify_file - $*"
+ real_verify_file "$@"
+}
+
+#---------------------------------------------------------------------
+## @Type API
## @param Target of the trigger
## @param Action to execute
## @See <@function var.lib.sorcery.modules.libdepends.html,real_up_triggers>
for more details.

==== //sgl/sorcery/devel/var/lib/sorcery/modules/libunpack#22 (xtext) ====

@@ -122,34 +122,17 @@
function real_unpack_file() {
debug "libgrimoire" "real_unpack_file - $*"

- local GPGNUM="$1"
- local SVAR="SOURCE${GPGNUM}"
+ local FILENUM="$1"
+ local SVAR="SOURCE${FILENUM}"

- local crypto_func
- for crypto_func in GPG HASH IGNORE; do
- debug "libgrimoire" "checking $crypto_func verification"
- local AVAR="SOURCE${GPGNUM}_${crypto_func}"
- local AVARN="$AVAR"
- local iter=0
- local rc=""
- # NOTE ## date: 2005-08-25
- # This while loop runs through the SOURCEn_{GPG|HASH|IGNORE}m not the
- # SOURCEn_*[m] set of vars this is kinda confusing we might rip it out
- while [ -n "${!AVARN}" ]; do
- local lcase_crypto_func="$(echo $crypto_func | tr 'A-Z' 'a-z')"
- unpack_$lcase_crypto_func "${!SVAR}" "${!AVARN}"
- rc="$?"
- case "$rc" in
- 200) debug "libgrimoire" "falling back from $AVARN"; rc="" ;;
- 1) return "$rc" ;;
- 0) uncompress_unpack "${!SVAR}"; return "$?" ;;
- esac
- (( iter++ ))
- AVARN="$AVAR[$iter]"
- done
- [ -n "$rc" ] && return "$rc"
- done
-
+ real_verify_file "$@"
+ rc=$?
+ case "$rc" in
+ 200) debug "libunpack" "unable to verify $SVAR ${!SVAR}" ;;
+ 1) return 1 ;; # verification failed
+ 0) uncompress_unpack ${!SVAR}; return $? ;;
+ esac
+
if false; then # <------ here's the switch to disable oldworld -------
debug "libgrimoire" "falling back to missing verification"
unpack_missing "${!SVAR}"
@@ -160,13 +143,48 @@
esac
else
debug "libgrimoire" "falling back to regular MD5[]"
- local MD5NUM="$([ -z "$GPGNUM" ] && echo 0 || echo "$(($GPGNUM - 1))")"
+ local MD5NUM="$([ -z "$FILENUM" ] && echo 0 || echo "$(($FILENUM - 1))")"
real_unpack "${!SVAR}" "${MD5[$MD5NUM]}"
fi
}


#---------------------------------------------------------------------
+## @Type API
+## @param SOURCE suffix
+##
+## Does the work of verifying a file with the new-world verification
+## system.
+#---------------------------------------------------------------------
+function real_verify_file() {
+ debug "libunpack" "real_verify_file - $*"
+
+ local FILENUM="$1"
+ local SVAR="SOURCE${FILENUM}"
+
+ local crypto_func
+ for crypto_func in GPG HASH IGNORE; do
+ debug "libgrimoire" "checking $crypto_func verification"
+
+ local AVAR="SOURCE${FILENUM}_${crypto_func}"
+ [[ -n ${!AVAR} ]] || continue
+
+ local rc=""
+ local lcase_crypto_func="$(echo $crypto_func | tr 'A-Z' 'a-z')"
+ unpack_$lcase_crypto_func "${!SVAR}" "${!AVAR}"
+ rc="$?"
+
+ case "$rc" in
+ 200) debug "libgrimoire" "unable to verify $AVAR with $crypto_func" ;;
+ *) return $rc ;;
+ esac
+
+ done
+ return 200
+}
+
+
+#---------------------------------------------------------------------
## @param filename
## @param compressor
## @Stdout uncompressed



  • [SM-Commit] PERFORCE change 76787 by Andrew Stitt for review, Perforce Review Daemon, 03/25/2006

Archive powered by MHonArc 2.6.24.

Top of Page