Skip to Content.
Sympa Menu

sm-commit - [SM-Commit] BZR Change 4 to test sorcery by Andrew Stitt <astitt@sourcemage.org>

sm-commit AT lists.ibiblio.org

Subject: Source Mage code commit list

List archive

Chronological Thread  
  • From: bzr AT fawkes.sourcemage.org
  • To: sm-commit AT lists.ibiblio.org
  • Subject: [SM-Commit] BZR Change 4 to test sorcery by Andrew Stitt <astitt AT sourcemage.org>
  • Date: Mon, 10 Apr 2006 10:45:05 -0500

------------------------------------------------------------
revno: 4
committer: Andrew Stitt <astitt AT sourcemage.org>
branch nick: test
timestamp: Tue 2006-04-04 20:30:26 -0700
message:
pull in fix for bug 10684
=== modified file 'ChangeLog'
--- ChangeLog
+++ ChangeLog
@@ -1,3 +1,8 @@
+2006-04-05 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-04-04 Andrew Stitt <astitt AT sourcemage.org>
* libmisc: fix bug 10357, add extra check for a file incase theres
a directory named make.

=== modified file 'var/lib/sorcery/modules/libapi'
--- var/lib/sorcery/modules/libapi
+++ var/lib/sorcery/modules/libapi
@@ -74,6 +74,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
@@ -1016,6 +1017,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.

=== modified file 'var/lib/sorcery/modules/libunpack'
--- var/lib/sorcery/modules/libunpack
+++ var/lib/sorcery/modules/libunpack
@@ -122,34 +122,17 @@
function real_unpack_file() {
debug "libgrimoire" "real_unpack_file - $*"

- local GPGNUM="$1"
- local SVAR="SOURCE${GPGNUM}"
-
- 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
-
+ local FILENUM="$1"
+ local SVAR="SOURCE${FILENUM}"
+
+ 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,9 +143,44 @@
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
}






  • [SM-Commit] BZR Change 4 to test sorcery by Andrew Stitt <astitt AT sourcemage.org>, bzr, 04/10/2006

Archive powered by MHonArc 2.6.24.

Top of Page