Skip to Content.
Sympa Menu

sm-commit - [SM-Commit] GIT changes to devel-pyrobor2 sorcery by Bor Kraljič (1fd98acc7d3c39bd2cd0aa4c7d238d331ed5fda4)

sm-commit AT lists.ibiblio.org

Subject: Source Mage code commit list

List archive

Chronological Thread  
  • From: Bor Kraljič <scm AT sourcemage.org>
  • To: sm-commit AT lists.ibiblio.org
  • Subject: [SM-Commit] GIT changes to devel-pyrobor2 sorcery by Bor Kraljič (1fd98acc7d3c39bd2cd0aa4c7d238d331ed5fda4)
  • Date: Sat, 22 Oct 2011 09:19:19 -0500

GIT changes to devel-pyrobor2 sorcery by Bor Kraljič <pyrobor AT ver.si>:

ChangeLog | 22 ++++
usr/sbin/alter | 2
usr/sbin/cleanse | 1
usr/sbin/confmeld | 1
usr/sbin/scribbler | 1
usr/sbin/scribe | 1
usr/sbin/sorcery | 1
usr/sbin/vcast | 2
var/lib/sorcery/modules/libapi | 23 ----
var/lib/sorcery/modules/libcodex | 3
var/lib/sorcery/modules/libmisc | 73 ++-----------
var/lib/sorcery/modules/libresurrect | 2
var/lib/sorcery/modules/libunpack | 188
+----------------------------------
13 files changed, 53 insertions(+), 267 deletions(-)

New commits:
commit 941886ec683daa692089ee7b797897b3470308cc
Author: Jaka Kranjc <lynxlynxlynx AT sourcemage.org>
Commit: Jaka Kranjc <lynxlynxlynx AT sourcemage.org>

libapi, libunpack: removed oldworld md5 support

commit d8e2d76cf40f69c191c374a954f1e783fd428f44
Author: Bor Kraljič <pyrobor AT ver.si>
Commit: Bor Kraljič <pyrobor AT ver.si>

libmisc: use brace expansion to shorten the list of functions for hooks,
changed run_hooks to be more generic

commit 4e534a1fa14d6ed023c6012a8d703fdeb336495e
Author: Bor Kraljič <pyrobor AT ver.si>
Commit: Bor Kraljič <pyrobor AT ver.si>

libcodex: wrap long description to the width of the terminal

commit 50c3b486c667c05c321cd085e9824e9c4f39a25a
Author: Jaka Kranjc <lynxlynxlynx AT sourcemage.org>
Commit: Jaka Kranjc <lynxlynxlynx AT sourcemage.org>

alter, vcast: removed last mentions of cast --fix (deprecated long time
ago)

commit c9c5fcba958877b867e0fffed3d1e0b2a38bcfeb
Author: Jaka Kranjc <lynxlynxlynx AT sourcemage.org>
Commit: Jaka Kranjc <lynxlynxlynx AT sourcemage.org>

libressurect: clarified a merge message
based on c664ae494729b8

commit 0c004cbb265fc34b8f884714acec26af727f0df6
Author: Bor Kraljič <pyrobor AT ver.si>
Commit: Jaka Kranjc <lynxlynxlynx AT sourcemage.org>

libsummon: added msg with information that file was downloaded

Conflicts:

ChangeLog

commit a65603eae5f4d111aa201894790b10fd60bf9b12
Author: Bor Kraljič <pyrobor AT ver.si>
Commit: Jaka Kranjc <lynxlynxlynx AT sourcemage.org>

xterm_title.hook,libmisc: moved function set_term_title to libmisc

Some scripts in guru-tools (example hashcheck.sh) use set_term_title.
To be able to use it without init hooks function must be in libmisc.

Such function can be very usefull when coding with sorcery functions so
lets have it in libmisc.

Signed-off-by: Jaka Kranjc <lynxlynxlynx AT sourcemage.org>

commit dbde70059610d9270606dd763e89b8ad7a6fe4fb
Author: Bor Kraljič <pyrobor AT ver.si>
Commit: Bor Kraljič <pyrobor AT ver.si>

cleanse, confmeld, scribbler, scribe, sorcery: added missing init_hooks

fixes #298
Patch was reviewed and approved by Jaka Kranjc before commiting.

diff --git a/ChangeLog b/ChangeLog
index 2d0802d..aceac58 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,25 @@
+2011-10-22 Bor Kraljič <pyrobor AT ver.si>
+ * libmisc: use brace expansion to shorten the list of functions for
hooks,
+ changed run_hooks to be more generic
+
+2011-10-17 Bor Kraljič <pyrobor AT ver.si>
+ * libcodex: wrap long description to the width of the terminal
+
+2011-10-16 Jaka Kranjc <lynxlynxlynx AT sourcemage.org>
+ * libressurect: clarified a merge message
+ * alter, vcast: removed last mentions of cast --fix
+ * libapi, libunpack: removed oldworld md5 support
+
+2011-10-21 Bor Kraljič <pyrobor AT ver.si>
+ * libsummon: added msg with information that file was downloaded
+
+2011-10-21 Bor Kraljič <pyrobor AT ver.si>
+ * xterm_title.hook,libmisc: moved function set_term_title to libmisc
+
+2011-10-21 Bor Kraljič <pyrobor AT ver.si>
+ * cleanse, confmeld, scribbler, scribe, sorcery: added missing
init_hooks,
+ fixes #298
+
2011-10-21 Bor Kraljič <pyrobor AT ver.si>
* xterm_title.hook,libmisc: moved function set_term_title to libmisc

diff --git a/usr/sbin/alter b/usr/sbin/alter
index e29f10c..0e05b99 100755
--- a/usr/sbin/alter
+++ b/usr/sbin/alter
@@ -410,7 +410,7 @@ but keep them in the analyzed spell. For example, if you
run it on
coreutils, psmisc and util-linux will have their /bin/kill purged from
their md5sum records. This however leaves them in the install logs of
the environmental spells because they actually were installed by the
-spell. The purpose is to enable a more intelligent cast --fix. a
+spell. The purpose is to enable a more intelligent cleanse --fix. a
forced dispel -d env_spell env_version will restore the environmental
md5log and restore the binary from the environmental spell, so this is
undoable piecemeal, or, you can use the shotgun undo cache created,
diff --git a/usr/sbin/cleanse b/usr/sbin/cleanse
index db2ca81..65d36bb 100755
--- a/usr/sbin/cleanse
+++ b/usr/sbin/cleanse
@@ -1085,6 +1085,7 @@ if [ $UID -eq 0 ] ; then
message "Unable to make tmp dirs..."
exit 1
fi
+ init_hooks
args "$@"
rc=$?
cleanup_tmp_dir $TMP_DIR
diff --git a/usr/sbin/confmeld b/usr/sbin/confmeld
index 0b58220..5be32c4 100755
--- a/usr/sbin/confmeld
+++ b/usr/sbin/confmeld
@@ -318,6 +318,7 @@ if [ "$UID" -gt 0 ]; then
run_as_root confmeld "$@"
else
STAGED_INSTALL="off"
+ init_hooks
main "$@"
fi

diff --git a/usr/sbin/scribbler b/usr/sbin/scribbler
index dfc634a..f87cf97 100755
--- a/usr/sbin/scribbler
+++ b/usr/sbin/scribbler
@@ -185,6 +185,7 @@ if [ "${UID}" != 0 ]; then
run_as_root scribbler "$PARAMS"
fi

+init_hooks
main "$@"
#---------------------------------------------------------------------
##
diff --git a/usr/sbin/scribe b/usr/sbin/scribe
index 4c699d9..6cc290a 100755
--- a/usr/sbin/scribe
+++ b/usr/sbin/scribe
@@ -858,6 +858,7 @@ if [ "$UID" == 0 ] ; then
renice $NICE -p $$ >/dev/null
fi
mk_tmp_dirs scribe
+ init_hooks
main $@
rc=$?
cleanup_tmp_dir $TMP_DIR
diff --git a/usr/sbin/sorcery b/usr/sbin/sorcery
index cb42252..da2da12 100755
--- a/usr/sbin/sorcery
+++ b/usr/sbin/sorcery
@@ -1962,6 +1962,7 @@ if [ "$UID" == 0 ]; then

SORCERY_VERSION=`cat /etc/sorcery/version`
mk_tmp_dirs sorcery
+ init_hooks
main "$@"
rc=$?
cleanup_tmp_dir $TMP_DIR
diff --git a/usr/sbin/vcast b/usr/sbin/vcast
index 6fdd6d1..5b301e8 100755
--- a/usr/sbin/vcast
+++ b/usr/sbin/vcast
@@ -30,10 +30,8 @@ process_parameters() {
case $1 in

--from) export SOURCE_CACHE="$2"; shift 2 ;;
- -n|--nofix) NO_SUMMON="$1"; NO_GAZE="$1"; shift 1 ;;
--silent) NO_SUMMON="$1"; NO_GAZE="$1"; shift 1 ;;
--deps) NO_SUMMON="$1"; shift 1 ;;
- -f|--fix) NO_SUMMON="$1"; shift 1 ;;
--help) HELP="$1"; shift 1 ;;
-s) NO_SUMMON="$1"; shift 1 ;;
*) shift 1 ;;
diff --git a/var/lib/sorcery/modules/libapi b/var/lib/sorcery/modules/libapi
index 8fba3be..4b75ccd 100755
--- a/var/lib/sorcery/modules/libapi
+++ b/var/lib/sorcery/modules/libapi
@@ -78,7 +78,6 @@
# suggest_depends (libdepends)
# track_manual (libtrack)
# uncompress (libunpack)
-# unpack (libunpack) (deprecated)
# unpack_file (libunpack)
# unpack_file_simple (libunpack)
# using_gcc (libgcc2)
@@ -1124,25 +1123,6 @@ function uncompress () {

#---------------------------------------------------------------------
## @Type API
-## @param file to unpack
-## @param md5sum
-## @See <@function var.lib.sorcery.modules.libunpack.html,real_unpack> for
more details.
-##
-## Given a file, unpack runs the decompression program for that file,
-## as well as untar'ing the file if appropriate and if the MD5
-## matches.
-## Note: zip is a special case because it doesn't work with streams.
-## Note: This function is deprecated and kept for spells that still
-## use the old verification methods (MD5[0]=).
-##
-#---------------------------------------------------------------------
-function unpack () {
- debug "libapi" "unpack - $*"
- real_unpack "$@"
-}
-
-#---------------------------------------------------------------------
-## @Type API
## @param SOURCE suffix
## @See <@function var.lib.sorcery.modules.libunpack.html,real_unpack_file>
for more details.
##
@@ -1199,9 +1179,6 @@ function unpack () {
## see unpack_ignore
##
## Otherwise, it falls back to MISSING mode, see unpack_missing
-## (or for now)
-## Otherwise, it falls back to old uncompressed md5sum check with MD5[n].
-## see real_unpack()
##
## The default verification level is "WORKS_FOR_ME"
##
diff --git a/var/lib/sorcery/modules/libcodex
b/var/lib/sorcery/modules/libcodex
index b3e9c05..176225a 100755
--- a/var/lib/sorcery/modules/libcodex
+++ b/var/lib/sorcery/modules/libcodex
@@ -1028,7 +1028,8 @@ function codex_find_spell_or_section_by_name() {
##
#---------------------------------------------------------------------
function codex_get_spell_description() {
- codex_is_directory_a_spell "$1" && . "$1/DETAILS"
+ local width=$(stty size | cut -d' ' -f2)
+ codex_is_directory_a_spell "$1" && . "$1/DETAILS" | fmt -w $width -s
}

#---------------------------------------------------------------------
diff --git a/var/lib/sorcery/modules/libmisc b/var/lib/sorcery/modules/libmisc
index 80172a7..4960726 100755
--- a/var/lib/sorcery/modules/libmisc
+++ b/var/lib/sorcery/modules/libmisc
@@ -371,62 +371,15 @@ function init_hooks() {
fi
done
local function_name function_list
- function_list="cast_initialize \
- cast_start_spell \
- cast_final \
- real_query \
- real_query_string \
+ function_list=$(echo cast_{initialize,start_spell,final} \
+ real_query{,_string} \
REPORT \
- pre_dispel \
- post_dispel \
- pre_SUCCESS \
- post_SUCCESS \
- pre_FAILURE \
- post_FAILURE \
- pre_BUILD \
- post_BUILD \
- pre_config_loc \
- post_config_loc \
- pre_CONFIGURE \
- post_CONFIGURE \
- pre_DEPENDS \
- post_DEPENDS \
- pre_DOWNLOAD \
- post_DOWNLOAD \
- pre_FINAL \
- post_FINAL \
- pre_INSTALL \
- post_INSTALL \
- pre_INSTALL_EXTRAS \
- post_INSTALL_EXTRAS \
- pre_POST_INSTALL \
- post_POST_INSTALL \
- pre_POST_REMOVE \
- post_POST_REMOVE \
- pre_POST_RESURRECT \
- post_POST_RESURRECT \
- pre_PRE_BUILD \
- post_PRE_BUILD \
- pre_PRE_INSTALL \
- post_PRE_INSTALL \
- pre_PREPARE \
- post_PREPARE \
- pre_PRE_REMOVE \
- post_PRE_REMOVE \
- pre_PRE_RESURRECT \
- post_PRE_RESURRECT \
- pre_SECURITY \
- post_SECURITY \
- pre_SUB_DEPENDS \
- post_SUB_DEPENDS \
- pre_TRANSFER \
- post_TRANSFER \
- pre_TRIGGER_CHECK \
- post_TRIGGER_CHECK \
- pre_TRIGGERS \
- post_TRIGGERS \
- pre_UP_TRIGGERS \
- post_UP_TRIGGERS"
+ {pre_,post_}{dispel,SUCCESS,FAILURE,BUILD,config_loc} \
+ {pre_,post_}{CONFIGURE,DEPENDS,DOWNLOAD,FINAL,INSTALL} \
+ {pre_,post_}{INSTALL_EXTRAS,POST_INSTALL,POST_REMOVE} \
+
{pre_,post_}{POST_RESURRECT,PRE_BUILD,PRE_INSTALL,PREPARE} \
+ {pre_,post_}{PRE_REMOVE,PRE_RESURRECT,SECURITY,TRANSFER} \
+ {pre_,post_}{TRIGGER_CHECK,TRIGGERS,UP_TRIGGERS})
local i f of
# [[ -z $hooks_list ]] && return
for function_name in $function_list; do
@@ -466,9 +419,13 @@ function run_hook() {
local hook_order="$2"
local rc=$3
case $spell_file in
- DETAILS|CONFLICTS|PRE_SUB_DEPENDS|SUB_DEPENDS) return 0 ;;
-
REPORT|cast_start_spell|cast_initialize|cast_final|real_query|real_query_string)
sorcery_default_${spell_file}_hook $rc ;;
- *) sorcery_default_${hook_order}_${spell_file}_hook $rc ;;
+ DETAILS|CONFLICTS|PRE_SUB_DEPENDS|SUB_DEPENDS) return 0 ;;
+ *)
+ if [[ $hook_order ]]; then
+ sorcery_default_${hook_order}_${spell_file}_hook $rc
+ else
+ sorcery_default_${spell_file}_hook $rc
+ fi ;;
esac
}

diff --git a/var/lib/sorcery/modules/libresurrect
b/var/lib/sorcery/modules/libresurrect
index 1062712..4065dff 100755
--- a/var/lib/sorcery/modules/libresurrect
+++ b/var/lib/sorcery/modules/libresurrect
@@ -536,7 +536,7 @@ function real_handle_changed_config() {
message "(0) trash $to and install over it"
message "(1) backup $to to $to.$savetime.old, install the new file in
its place"
message "(2) leave $to in its place, copy the new file to
$to.$savetime.new"
- message "(3) leave $to in its place, discard new file"
+ message "(3) do nothing - leave $to in its place, discard new file"
message "(4) see a diff between $to and the new file"
# TODO: someday add an option to use an external merge tool

diff --git a/var/lib/sorcery/modules/libunpack
b/var/lib/sorcery/modules/libunpack
index 4d1436f..aa57add 100755
--- a/var/lib/sorcery/modules/libunpack
+++ b/var/lib/sorcery/modules/libunpack
@@ -75,9 +75,6 @@
## see unpack_ignore
##
## Otherwise, it falls back to MISSING mode, see unpack_missing
-## (or for now)
-## Otherwise, it falls back to old uncompressed md5sum check with MD5[n].
-## see real_unpack()
##
## The default verification level is "WORKS_FOR_ME"
##
@@ -133,19 +130,13 @@ function real_unpack_file() {
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}"
- rc="$?"
- case "$rc" in
- 0) uncompress_unpack "${!SVAR}"; return "$?" ;;
- *) return "$rc" ;;
- esac
- else
- debug "libgrimoire" "falling back to regular MD5[]"
- local MD5NUM="$([ -z "$FILENUM" ] && echo 0 || echo "$(($FILENUM - 1))")"
- real_unpack "${!SVAR}" "${MD5[$MD5NUM]}"
- fi
+ debug "libgrimoire" "falling back to missing verification"
+ unpack_missing "${!SVAR}"
+ rc="$?"
+ case "$rc" in
+ 0) uncompress_unpack "${!SVAR}"; return "$?" ;;
+ *) return "$rc" ;;
+ esac
}


@@ -693,171 +684,6 @@ function locate_spell_file() {

}

-
-#===================== libunpack oldworld ============================
-
-#---------------------------------------------------------------------
-## @Type API
-## @param file to unpack
-## @param md5sum
-##
-## Given a file, unpack runs the decompression program for that file,
-## as well as untar'ing the file if appropriate and if the MD5
-## matches.
-## Note: zip is a special case because it doesn't work with streams.
-##
-#---------------------------------------------------------------------
-function real_unpack() {
- debug "libgrimoire" "Running unpack -- $*"
-
- message "${MESSAGE_COLOR}Unpacking source file
${SPELL_COLOR}${1}${DEFAULT_COLOR}" \
- "${MESSAGE_COLOR}for spell" \
-
"${SPELL_COLOR}${SPELL}${DEFAULT_COLOR}${MESSAGE_COLOR}.${DEFAULT_COLOR}"
-
- FILENAME="$(guess_filename "$SOURCE_CACHE/$1")" &&
- COMPRESSOR="$(guess_compressor "$FILENAME")"
-
- if [[ ! $FILENAME ]] || ! test -f "$FILENAME" ; then
- message "${PROBLEM_COLOR}Source file not found.${DEFAULT_COLOR}"
- return 1
- fi
-
- uncompress_md5 "$FILENAME" "$COMPRESSOR" "$2" |
- unpack_core "$FILENAME" "$COMPRESSOR" &&
- {
-
- # This section takes care of what happens if the md5sum doesn't match.
- # $TMP_DIR/libgrimoire.uncompress.$$ is set in uncompress. It's the only
- # way to get the return value since it's in a pipe.
- if ! [[ $2 ]] ; then
-
- rm "$TMP_DIR/libgrimoire.uncompress.$$"
-
- message "${SPELL_COLOR}${SPELL}${DEFAULT_COLOR}:" \
- "${QUERY_COLOR}doesn't have an MD5 sum for the uncompressed
$1."
-
- case "$MD5SUM_DL" in
- off) message "${RED}Continuing!${DEFAULT_COLOR}"; return 0
;;
- ask_ignore) query "Abort?" "n" && return 1 || return 0
;;
- ask_risky|ask_abort) query "Abort?" "y" && return 1 || return 0
;;
- on|abort_all|*) message "${RED}Aborting.${DEFAULT_COLOR}" ; return 1
;;
- esac
-
- elif [[ $2 == "IGNORE" ]] ; then
-
- rm "$TMP_DIR/libgrimoire.uncompress.$$"
-
- message "${SPELL_COLOR}${SPELL}${DEFAULT_COLOR}: ${QUERY_COLOR}MD5 sum
was" \
- "purposefully left out for the uncompressed $1."
- message "${QUERY_COLOR}Would you like to abort so you can validate" \
- "the source yourself via some alternate method?"
-
- case "$MD5SUM_DL" in
- off) message "${RED}Continuing!${DEFAULT_COLOR}"; return 0
;;
-ask_risky|ask_ignore) query "Abort?" "n" && return 1 || return 0
;;
- abort_all) message "${RED}Aborting.${DEFAULT_COLOR}" ; return 1
;;
- ask_abort|on|*) query "Abort?" "y" && return 1 || return 0
;;
- esac
-
- elif [[ "$(cat $TMP_DIR/libgrimoire.uncompress.$$)" != 0 ]] ; then
-
- rm "$TMP_DIR/libgrimoire.uncompress.$$"
-
- message "${SPELL_COLOR}${SPELL}${DEFAULT_COLOR}:" \
- "${QUERY_COLOR}MD5 sum is different for uncompressed $1."
-
- case "$MD5SUM_DL" in
- off) message "${RED}Continuing!${DEFAULT_COLOR}"; return 0
;;
- ask_ignore) query "Abort?" "n" && return 1 || return 0
;;
- ask_risky|ask_abort) query "Abort?" "y" && return 1 || return 0
;;
- on|abort_all|*) message "${RED}Aborting.${DEFAULT_COLOR}" ; return 1
;;
- esac
-
- fi
-
- rm "$TMP_DIR/libgrimoire.uncompress.$$"
-
- }
-
- #By this point, the archive is unarchived, and we know the MD5 check was
good.
- return 0
-
-}
-
-
-#---------------------------------------------------------------------
-## @param filename
-## @param compressor
-## @param md5
-## @Stdout uncompressed
-##
-## Uncompress_md5 dumps the expanded file via tee to md5_tar_check where it
-## is gobbled up by the bitbucket. It also dumps the main stream out to
-## stdout.
-##
-#---------------------------------------------------------------------
-function uncompress_md5() {
- debug "libgrimoire" "uncompress_md5 - $*"
-
- # This is here so Duff's super debugging info doesn't screw the next step
up
- set +x
-
- # Outer subshell is necessary to redirect stderr to stdout
- (
- uncompress_core "$1" "$2" |
- tee /dev/stderr |
- md5_tar_check "$3" 2>&1 1>/dev/null #we must avoid this printing
- ) 2>&1
-
- # This temp file is here because this function MUST NOT send
- # anything to stdout or stderr, and upack needs a way to get the success or
- # failure of this function.
-
- local a="$?"
- [[ $SUPER_DEBUG ]] && set -x #turn this back on as soon as possible
- echo "$a" > "$TMP_DIR/libgrimoire.uncompress.$$"
- return "$a"
-
-}
-
-
-#---------------------------------------------------------------------
-## @param md5
-##
-## Checks that the stdin matches the argument.
-## Note that DEBUG output may dissapear if it's /dev/stderr due to
-## uncompress' 2>/dev/null.
-##
-#---------------------------------------------------------------------
-function md5_tar_check() {
- debug "libgrimoire" "md5_tar_check() - Checking MD5 sum"
-
- local md5
-
- #Do the md5
- md5="$(md5sum /dev/stdin | awk '{print $1}')"
- debug "libgrimoire" "md5_tar_check() - MD5 of tarball is $md5."
- debug "libgrimoire" "md5_tar_check() - argument received is $1."
-
- #See if they match
- if [[ $1 == $md5 ]] ; then
- debug "libgrimoire" "md5_tar_check() - MD5 Sum Success ( $1 == $md5 )"
- return 0
- fi
-
- #See of we need to md5sum it at all
- if [[ ${MD5SUM_DL:-on} == off ]] || ! [[ $1 ]] ; then
- debug "libgrimoire" "md5_tar_check() - Skipping check"
- return 0
- fi
-
- #If we get here, the md5's don't match, but should.
- debug "libgrimoire" "md5_tar_check() - bad md5"
- return 1
-
-}
-
-
#---------------------------------------------------------------------
## @License
##



  • [SM-Commit] GIT changes to devel-pyrobor2 sorcery by Bor Kraljič (1fd98acc7d3c39bd2cd0aa4c7d238d331ed5fda4), Bor Kraljič, 10/22/2011

Archive powered by MHonArc 2.6.24.

Top of Page