Skip to Content.
Sympa Menu

sm-commit - [SM-Commit] GIT changes to master sorcery by Jaka Kranjc (b65fbde96c465775392d730cbf2188736f207999)

sm-commit AT lists.ibiblio.org

Subject: Source Mage code commit list

List archive

Chronological Thread  
  • From: Jaka Kranjc <scm AT sourcemage.org>
  • To: sm-commit AT lists.ibiblio.org
  • Subject: [SM-Commit] GIT changes to master sorcery by Jaka Kranjc (b65fbde96c465775392d730cbf2188736f207999)
  • Date: Fri, 19 Dec 2008 07:50:18 -0600

GIT changes to master sorcery by Jaka Kranjc <lynxlynxlynx AT sourcemage.org>:

ChangeLog | 32 +++++
etc/sorcery/config | 2
etc/sorcery/media | 3
etc/sorcery/url | 18 +++
usr/sbin/cast | 29 +++--
usr/sbin/sorcery | 92 ++++++++++------
var/lib/sorcery/modules/build_api/common | 27 ----
var/lib/sorcery/modules/dl_handlers/dl_aria2 | 145
++++++++++++++++++++++++++
var/lib/sorcery/modules/dl_handlers/dl_wget | 2
var/lib/sorcery/modules/libcast | 90 +++++++++++-----
var/lib/sorcery/modules/libdepends | 17 +--
var/lib/sorcery/modules/libdispel | 6 -
var/lib/sorcery/modules/libgrimoire | 15 +-
var/lib/sorcery/modules/libinitd | 8 -
var/lib/sorcery/modules/libqueue | 16 +-
var/lib/sorcery/modules/libresurrect | 10 +
var/lib/sorcery/modules/url_handlers/url_http | 8 -
17 files changed, 387 insertions(+), 133 deletions(-)

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

common, libcast: moved run_security to libcast for simpler access
cast, libdepends: do run_security before dependency resolution, right
after conflicts

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

* libcast: split run_conflicts into query_conflicts and
dispel_conflicts, so they can be asked for sooner #4815
* cast: act on conflicts sooner, right at the start of pass two
modified the end summaries to show conflicts properly
* libdepends: made run_other fallible and added query_conflicts to it
* libresurrect: use the new conflicts logic
* libgrimoire: made real_conflicts also deal with held spells

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

libdispel: fixed post_remove and pre_remove always returning 0

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

don't include the sorcery mirror list twice

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

sorcery: fixed a mirror_list regression from yesterday

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

config, url: moved MIRRORS definition to url

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

libcast, libinitd, libgrimoire, common: ensure most grimoire files
have correct ownership #14576

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

media: source the local config first

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

config, sorcery, url_http: added external mirror list support #13122
the sorcery mirror list menu is now autogenerated

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

libqueue: don't warn about the missing version index when looking up
single spells

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

dl_wget: fixed the continuous downloading check

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

dl_aria2: added an alternative http/ftp/http download handler #1777
using a slightly modified patch from David Kowis

aria2 has the edge when downloading from slower uplinks, since it
simultaneously downloads from any mirrors aswell

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

chmod +x var/lib/sorcery/modules/dl_handlers/dl_hg

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

sorcery, url_http, config: made the default http/ftp/http download
handler configurable #13838

diff --git a/ChangeLog b/ChangeLog
index a77126d..25674c8 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,35 @@
+2008-12-19 Jaka Kranjc <lynxlynxlynx AT sourcemage.org>
+ * libcast: split run_conflicts into query_conflicts and
+ dispel_conflicts, so they can be asked for sooner #4815
+ * cast: act on conflicts sooner, right at the start of pass two
+ modified the end summaries to show conflicts properly
+ * libdepends: made run_other fallible and added query_conflicts to it
+ * libresurrect: use the new conflicts logic
+ * libgrimoire: made real_conflicts also deal with held spells
+ * common, libcast: moved run_security to libcast for simpler access
+ * cast, libdepends: do run_security before dependency resolution,
right
+ after conflicts
+
+2008-12-18 Jaka Kranjc <lynxlynxlynx AT sourcemage.org>
+ * media: source the local config first
+ * libcast, libinitd, libgrimoire, common: ensure most grimoire files
+ have correct ownership #14576
+ * config, url: moved MIRRORS definition to url
+ * sorcery: fixed a mirror_list regression from yesterday
+ don't include the sorcery mirror list twice
+ * libdispel: fixed post_remove and pre_remove always returning 0
+
+2008-12-17 Jaka Kranjc <lynxlynxlynx AT sourcemage.org>
+ * sorcery, url_http, config: made the default http/ftp/http download
+ handler configurable #13838
+ * dl_aria2: added an alternative http/ftp/http download handler #1777
+ using a slightly modified patch from David Kowis
+ * dl_wget: fixed the continuous downloading check
+ * libqueue: don't warn about the missing version index when looking up
+ single spells
+ * config, sorcery, url_http: added external mirror list support #13122
+ the sorcery mirror list menu is now autogenerated
+
2008-12-15 Jaka Kranjc <lynxlynxlynx AT sourcemage.org>
* excluded: added /etc/.pwd.lock to fix #5924

diff --git a/etc/sorcery/config b/etc/sorcery/config
index 0f12804..7f9420c 100755
--- a/etc/sorcery/config
+++ b/etc/sorcery/config
@@ -95,7 +95,6 @@ FORCE_BASESYSTEM_DEPENDS=${FORCE_BASESYSTEM_DEPENDS:-off}

SORCERY_INSTALL_LOG=${SORCERY_INSTALL_LOG:-/etc/sorcery/install.log}

- MIRRORS=${MIRRORS:-/etc/sorcery/mirrors}
SM_LICENSE_DIRECTORY=${SM_LICENSE_DIRECTORY:-/etc/sorcery/licenses}

SM_CONFIG_OPTION_CACHE=${SM_CONFIG_OPTION_CACHE:-/etc/sorcery/local/config_option_cache}
ACCOUNT_LIST=${ACCOUNT_LIST:-/etc/sorcery/accounts}
@@ -173,6 +172,7 @@
DEFAULT_CHANGED_CONFIG_ACTION=${DEFAULT_CHANGED_CONFIG_ACTION:-2}
DOC_DIRS=${DOC_DIRS:-'doc* conf'}
PROGRESS_SPINNER_CHARS=${PROGRESS_SPINNER_CHARS:-'-\|/'}
VERBOSE_QUEUING=${VERBOSE_QUEUING:-on}
+ HTTP_DL_HANDLER=${HTTP_DL_HANDLER:-wget}

WHITESPACE_IFS=$' \t\n'
TAB_ENTER_IFS=$'\t\n'
diff --git a/etc/sorcery/media b/etc/sorcery/media
index 44c0b4f..5f47350 100755
--- a/etc/sorcery/media
+++ b/etc/sorcery/media
@@ -1,8 +1,9 @@
+test -e $LOCAL_MEDIA_CONFIG && . $LOCAL_MEDIA_CONFIG
+
SOUND_DIRECTORY=${SOUND_DIRECTORY:-$SGL_LIBRARY/sound}
SOUND_THEME=${SOUND_THEME:-"startrek"}
SOUND=${SOUND:-"off"}
COLOR_SCHEME=${COLOR_SCHEME:-"bright"}

-test -e $LOCAL_MEDIA_CONFIG && . $LOCAL_MEDIA_CONFIG
media_init ""

diff --git a/etc/sorcery/url b/etc/sorcery/url
index bb71b60..23917e4 100755
--- a/etc/sorcery/url
+++ b/etc/sorcery/url
@@ -1,7 +1,25 @@
+# source local mirror/url choices
if [[ -e $LOCAL_URL_CONFIG ]]; then
. $LOCAL_URL_CONFIG
fi

+if [[ -d /usr/share/smgl-mirrors ]]; then
+ MIRRORS=${MIRRORS:-/usr/share/smgl-mirrors}
+ else
+ MIRRORS=${MIRRORS:-/etc/sorcery/mirrors}
+fi
+
+# source any other mirror lists, but in reverse order to preserve precedence
+for mirror in $MIRRORS; do
+ mirrors="$mirror $mirrors"
+done
+for mirror in $mirrors; do
+ if [[ -e $mirror/config/defaults ]]; then
+ . $mirror/config/defaults
+ fi
+done
+unset mirror mirrors
+
GNU_URL=${GNU_URL:-ftp://ftp.gnu.org/pub/gnu}
KDE_URL=${KDE_URL:-ftp://ftp.kde.org/pub/kde}
CTAN_URL=${CTAN_URL:-ftp://tug.ctan.org/tex-archive}
diff --git a/usr/sbin/cast b/usr/sbin/cast
index fbc1f6e..56c4e90 100755
--- a/usr/sbin/cast
+++ b/usr/sbin/cast
@@ -216,12 +216,6 @@ function cast_spell() { (
run_details
load_build_api || return 1

-# these both prompt, and prompting should NOT occur at this point
-# someday they will get split to a query and action pair (like use_xinetd
-# and install_xinetd) (afk 4/10/04)
- run_security &&
- run_conflicts || return 1
-
# show_downloading tail -f's (essentially) the download log as it
# comes in, or if downloading is complete, cats the download log, in
# either case it blocks until downloading is complete by the presence of
@@ -327,8 +321,16 @@ function pass_one() {
local cannot_cast=$(hash_get_table_fields "bad_spells")
message "${PROBLEM_COLOR}No spells to cast!${DEFAULT_COLOR}"
message "${MESSAGE_COLOR}Cannot cast these spells:${DEFAULT_COLOR}"
- message "---------------------------"
- message "${PROBLEM_COLOR}${cannot_cast}" | tr '[:blank:]' '\n' | column
+ message "---------------------------$PROBLEM_COLOR"
+
+ local failure_reason_log=$CAST_BACKUPDIR/failure_reason_log
+ local spell
+ for spell in $cannot_cast; do
+ grep -s "^$spell " $failure_reason_log ||
+ message "$spell"
+ done | awkuniq | column
+ rm -f $failure_reason_log
+
message "${DEFAULT_COLOR}"
exit 1
fi
@@ -414,9 +416,18 @@ function pass_two() {

if ! query "Do you want to cast these spells?" "y" ; then
message "Ok, quitting cast. Figure out what you want."
- return 1
+ # conflicts are already registered, but they weren't removed, so don't
show them
+ :> $CONFLICT_LIST
+ return 1
fi

+ if ! dispel_conflicts; then
+ #FIXME: only break the conflictees, not the whole cast
+ error_message "There was a problem with dispelling the conflicts.
Bailing out!"
+ return 1
+ fi
+ echo
+
rm -f $TMP_DIR/pass_three.done # don't return until this file exists
MINUS_K=yes
if [[ $SEPARATE ]] ; then
diff --git a/usr/sbin/sorcery b/usr/sbin/sorcery
index 5b599cb..82560ee 100755
--- a/usr/sbin/sorcery
+++ b/usr/sbin/sorcery
@@ -88,10 +88,13 @@ EOF
#' <-- fix for syntax highlighting in nedit
}

-mirror_list() {
-
- sort $MIRRORS/$1 | awk '{print "\""$NF"\""; NF-- ; print $0; }'
-
+mirror_list() {
+ local mirror_list
+ for mirror_list in $MIRRORS; do
+ [[ -f $mirror_list/$1 ]] || continue
+ sort $mirror_list/$1 | awk '{ print "\""$NF"\""; NF--; print $0; }'
+ break # only list duplicate mirror lists once
+ done
}


@@ -110,38 +113,22 @@ select_mirror() {


mirror_menu() {
-
- local A_HELP="Select mirror for downloading APACHE sources."
- local C_HELP="Select mirror for downloading CTAN sources."
- local K_HELP="Select mirror for downloading KDE sources."
- local L_HELP="Select mirror for downloading kernel related sources."
- local N_HELP="Select mirror for downloading GNOME sources."
- local G_HELP="Select mirror for downloading GNU sources."
- local P_HELP="Select mirror for downloading PERL-CPAN sources"
- local S_HELP="Select mirror for downloading Sorcery itself"
- local SF_HELP="Select mirror for downloading Sourceforge"
- local X_HELP="Select mirror for downloading XFree86 related sources."
+ local mirror_list mirrors mirror_name mirror_help cmd
+
+ mirrors=$(find $MIRRORS -maxdepth 1 -mindepth 1 -type f -printf "%f\n" |
sort -u)
+ cmd='--title "Mirror Menu" \
+ --ok-label "Select" \
+ --cancel-label "Exit" \
+ --item-help \
+ --menu "" 0 0 0'
+
+ while read mirror_name; do
+ mirror_help="Select mirror for downloading $mirror_name sources."
+ cmd="$cmd $mirror_name '' '$mirror_help'"
+ done <<< "$mirrors"
local HELP="Selecting a mirror site can speed your downloads."

- while
-
-
- COMMAND=`eval $DIALOG ' --title "Mirror Menu" \
- --ok-label "Select" \
- --cancel-label "Exit" \
- --item-help \
- --menu "" 0 0 0 \
- "APACHE" "" "$A_HELP" \
- "CTAN" "" "$C_HELP" \
- "KDE" "" "$K_HELP" \
- "KERNEL" "" "$L_HELP" \
- "GNOME" "" "$N_HELP" \
- "GNU" "" "$G_HELP" \
- "PERL_CPAN" "" "$P_HELP" \
- "SOURCEFORGE" "" "$SF_HELP" \
- "SORCERY" "" "$S_HELP" \
- "XFREE86" "" "$X_HELP"'`
- do
+ while COMMAND=$(eval $DIALOG "$cmd"); do
MIRROR=${COMMAND}_URL

if MIRROR_URL=`select_mirror $COMMAND`; then
@@ -1506,6 +1493,40 @@ sorcery_devel_settings() {

}

+function set_dl_handler() {
+ local W_HELP="Use wget to download from urls using the http/ftp/https
protocols"
+ local A_HELP="Use aria2 to download from urls using the http/ftp/https
protocols"
+
+ while
+ COMMAND=$(eval $DIALOG '--title "Currently using:
${HTTP_DL_HANDLER:-wget}" \
+ --item-help \
+ --ok-label "Select" \
+ --cancel-label "Exit" \
+ --menu \
+ "" \
+ 0 0 0 \
+ "W" "wget (default)" "$W_HELP" \
+ "A" "aria2" "$A_HELP"')
+ do
+ case $COMMAND in
+ W) modify_local_config HTTP_DL_HANDLER wget &&
+ HTTP_DL_HANDLER=wget ;;
+ A)
+ if ! spell_ok aria2; then
+ local error_msg
+ error_msg="aria2 is not installed on this system!\nIf you want"
+ error_msg="$error_msg to use it, cast it first, then revisit"
+ error_msg="$error_msg this menu.\n\nYour download handler choice"
+ error_msg="$error_msg has not been saved!"
+ eval "$DIALOG --msgbox \"\$error_msg\" 0 0"
+ else
+ modify_local_config HTTP_DL_HANDLER aria2 &&
+ HTTP_DL_HANDLER=aria2
+ fi ;;
+ esac
+ break
+ done
+}

feature_menu() {

@@ -1601,6 +1622,7 @@ option_menu() {
local U_HELP="Enter the permissions mask (umask value) to use for sorcery"
local S_HELP="Sorcery development options (debugging)"
local W_HELP="Enter maximum timeout (seconds) for summoning sources"
+ local Y_HELP="Select the default http/https/ftp download handler"
local X_HELP="Init.d/Xinetd Default Answer Selection Menu"
local Z_HELP="Select sorcery sound scheme"

@@ -1629,6 +1651,7 @@ option_menu() {
"T" "Compression Type" "$T_HELP" \
"S" "Sorcery Development" "$S_HELP" \
"W" "Summon Timeout Value" "$W_HELP" \
+ "Y" "Default download tool" "$Y_HELP" \
"X" "init.d xinetd.d defaults" "$X_HELP" \
"Z" "Select Sound Scheme" "$Z_HELP"'`

@@ -1652,6 +1675,7 @@ option_menu() {
S) sorcery_devel_settings ;;
T) set_compression_type ;;
W) set_http_ftp_timeout ;;
+ Y) set_dl_handler ;;
X) service_defaults ;;
Z) sound_schemes_menu ;;

diff --git a/var/lib/sorcery/modules/build_api/common
b/var/lib/sorcery/modules/build_api/common
index 1996150..e7b8a50 100755
--- a/var/lib/sorcery/modules/build_api/common
+++ b/var/lib/sorcery/modules/build_api/common
@@ -15,31 +15,6 @@
##=head1 FUNCTIONS
#---------------------------------------------------------------------

-# checks for a security file
-# returns 0 if spell should be cast, 1 otherwise
-#---------------------------------------------------------------------
-## Prompts the user about possible security problems with the current
-## spell. Allows a safe way of failing a spell due to security problems.
-## @return 0 if there are no security problem or the user acknowledges them.
-## @return 1 if the user decides not to accept the security concerns
-#---------------------------------------------------------------------
-function run_security() {
- debug "build_api/common" "Starting run_security() on $SPELL"
- local rc=0
- if [[ -f $SCRIPT_DIRECTORY/SECURITY ]]; then
- message "${SPELL_COLOR}${SPELL}:${DEFAULT_COLOR}"
- tee -a $SECURITY_LOG < $SCRIPT_DIRECTORY/SECURITY
- if grep -q critical $SCRIPT_DIRECTORY/SECURITY; then
- query "${RED}SECURITY CRITICAL:${QUERY_COLOR} Do you still want to
cast ${SPELL_COLOR}${SPELL}${DEFAULT_COLOR}?" "n"
- else
- query "SECURITY: Do you still want to cast
${SPELL_COLOR}$SPELL${QUERY_COLOR}?" "y"
- fi
- rc=$?
- fi
- [[ $rc != 0 ]] && log_failure_reason "security"
- return $rc
-}
-

#---------------------------------------------------------------------
## pokes around for a configure or src/configure and if it exists
@@ -214,7 +189,7 @@ function install_pam_confs() {
local file
for file in *; do
if ! [[ -f $INSTALL_ROOT/etc/pam.d/$file ]]; then
- cp "$file" "$INSTALL_ROOT/etc/pam.d"
+ install -g root -o root "$file" "$INSTALL_ROOT/etc/pam.d"
fi
done

diff --git a/var/lib/sorcery/modules/dl_handlers/dl_aria2
b/var/lib/sorcery/modules/dl_handlers/dl_aria2
new file mode 100755
index 0000000..061d29c
--- /dev/null
+++ b/var/lib/sorcery/modules/dl_handlers/dl_aria2
@@ -0,0 +1,145 @@
+#!/bin/bash
+#---------------------------------------------------------------------
+##
+##=head1 SYNOPSIS
+##
+## Url handler functions for downloading http, https, and ftp urls
+##
+##=head1 DESCRIPTION
+##
+## This file contains functions for downloading and verifying
+## http, https, and ftp urls. It uses the "aria2" program.
+##
+##=head1 COPYRIGHT
+##
+## Copyright 2007 by the Source Mage Team
+##
+##=head1 FUNCTIONS
+##
+##=over 4
+##
+#---------------------------------------------------------------------
+
+function dl_aria2_get() {
+ debug libdownload "$FUNCNAME -- $@"
+ dl_command_check aria2c || return 254
+
+ local target=$1
+ local url_list=$2
+ local hints=$3
+ local dl_target=$4
+ local dl_type=$5
+ local rc=1 url
+
+ [[ $target ]] &&
+ dl_connect || return 255
+
+ local ARIA2_OPTIONS
+ dl_aria2_set_options "$url_list"
+ dl_aria2_call_aria2 $target "$url_list"
+ rc=$?
+
+ dl_disconnect
+
+ eval "$dl_target=\"$target\""
+ eval "$dl_type=\"file\""
+ return $rc
+
+}
+
+#---------------------------------------------------------------------
+# dl_aria2_call_aria2 <filename> <extension-less filename> <url>
+#
+# Private Function. Calls aria2c to download the url.
+#
+#---------------------------------------------------------------------
+function dl_aria2_call_aria2() {
+ local FILE=$1
+ local URL_LIST=$2
+
+ debug 'dl_aria2' "$funcname -- $@"
+
+ rm -f $FILE
+ aria2c $ARIA2_OPTIONS $URL_LIST 2>&1 &&
+ if ! test -f "$FILE" ; then
+ # stupid http site trying to be nice and re-direct us, this is a failure
+ # even though aria2 doesnt notice it...
+ rm -f $FILE*
+ return 1
+ fi
+}
+
+#---------------------------------------------------------------------
+# dl_aria2_set_aria2_options
+#
+# Private Function. Sets aria2 options
+#
+#---------------------------------------------------------------------
+function dl_aria2_set_options() {
+ local URL_LIST=$1
+ if [ -n "$ACTIVE_FTP" ] ; then
+ unset PASSIVE
+ else
+ PASSIVE="--ftp-pasv"
+ fi
+
+ # Check for ? in the url, this seems to indicate that there may be
+ # some cgi redirection involved which means continued downloading would
+ # not work (bug 8993).
+ # The sourceforge check pre-dates that but is lacking any documentation,
+ # I suspect it is a less general attempt to solve the same problem.
+ # (afk 2005-06-25)
+ # assume that it's going to continue unless badness
+ CONTINUE="-c"
+ for URL in $URL_LIST; do
+ if grep -qE "(\?|sourceforge)" <<< "$URL"; then
+ unset CONTINUE
+ break
+ fi
+ done
+
+ if [[ -n $DOWNLOAD_RATE ]]; then
+ RATE="--max-download-limit=$DOWNLOAD_RATE"
+ fi
+
+ if [[ -n $URL_HTTP_FTP_TIMEOUT ]]; then
+ URL_HTTP_TIMEOUT="-t $URL_HTTP_FTP_TIMEOUT"
+ else
+ unset URL_HTTP_TIMEOUT
+ fi
+
+ if [[ -n $URL_HTTP_FTP_RETRIES ]]; then
+ URL_HTTP_RETRIES="-m $URL_HTTP_FTP_RETRIES"
+ else
+ URL_HTTP_RETRIES="-m 3"
+ fi
+
+ #If this option set to false, aria2 doesn't download a file which already
+ #exists in the file system but its corresponding .aria2 file doesn't exist.
+ #Default: false
+
+ ALLOW_OVERWRITE="--allow-overwrite=true"
+ ARIA2_OPTIONS="$URL_HTTP_TIMEOUT $URL_HTTP_RETRIES $RATE $PASSIVE
$CONTINUE $ALLOW_OVERWRITE"
+ debug 'dl_aria2' "aria2 options: $ARIA2_OPTIONS"
+}
+
+#---------------------------------------------------------------------
+##=back
+##
+##=head1 LICENSE
+##
+## This software is free software; you can redistribute it and/or modify
+## it under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 2 of the License, or
+## (at your option) any later version.
+##
+## This software is distributed in the hope that it will be useful,
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+## GNU General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with this software; if not, write to the Free Software
+## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+##
+#---------------------------------------------------------------------
diff --git a/var/lib/sorcery/modules/dl_handlers/dl_hg
b/var/lib/sorcery/modules/dl_handlers/dl_hg
old mode 100644
new mode 100755
diff --git a/var/lib/sorcery/modules/dl_handlers/dl_wget
b/var/lib/sorcery/modules/dl_handlers/dl_wget
index 4138a53..c61a6a5 100755
--- a/var/lib/sorcery/modules/dl_handlers/dl_wget
+++ b/var/lib/sorcery/modules/dl_handlers/dl_wget
@@ -94,7 +94,7 @@ function dl_wget_set_options() {
# The sourceforge check pre-dates that but is lacking any documentation,
# I suspect it is a less general attempt to solve the same problem.
# (afk 2005-06-25)
- if real_list_find "$URL" "?" "sourceforge"; then
+ if grep -qE "(\?|sourceforge)" <<< "$URL"; then
unset CONTINUE
else CONTINUE="-c"
fi
diff --git a/var/lib/sorcery/modules/libcast b/var/lib/sorcery/modules/libcast
index d3169a1..1b99b66 100755
--- a/var/lib/sorcery/modules/libcast
+++ b/var/lib/sorcery/modules/libcast
@@ -84,51 +84,87 @@ function prepare_spell_config() {

#---------------------------------------------------------------------
## Prompts the user about spells that are in conflict with the current
-## spell and allows them to dispel them. If the user chooses not to
+## spell for later dispelling. If the user chooses not to
## dispel the conflicting spell, the function returns 1
## @param dis-allow conflict with anything in this list, normally used to
prevent self conflicts
-## @return nothing if the user dispels the conflicting spell
+## @param file to store output (conflicts to be removed), defaults to
$CONFLICT_LIST
+## @return nothing if the user chose to dispel the conflicting spell
## @return 1 if the user chooses not to dispel the conflicting spell
+## @return 1 or if there was a problem parsing the CONFLICTS file
#---------------------------------------------------------------------
-function run_conflicts() {
-
- debug "build_api/common" "Starting run_conflicts() on $SPELL"
+function query_conflicts() {
+ debug "build_api/common" "Starting query_conflicts() on $SPELL"
local ignore_conflict=$1
- local each rc
+ local output=${2:-$CONFLICT_LIST}

- if [ -x $SCRIPT_DIRECTORY/CONFLICTS ]; then
- local CONFLICTS=$(
- run_spell_file CONFLICTS conflicts
- )
+ if [[ -x $SCRIPT_DIRECTORY/CONFLICTS ]]; then
+ local CONFLICTS=$(run_spell_file CONFLICTS conflicts) || return 1

local tmp to_dispel=""
- for tmp in $CONFLICTS ; do
+ for tmp in $CONFLICTS; do
local spell_and_default
- explode $tmp ':' spell_and_default
- local skip=no
- for each in $ignore_conflict ; do
- [[ $each == "${spell_and_default[0]}" ]] && skip=yes
- done
- [[ "$skip" == "yes" ]] && continue
+ explode $tmp ':' spell_and_default
+
+ # skip the spells we were told to ignore
+ list_find "$ignore_conflict" ${spell_and_default[0]} && continue

local text="${SPELL_COLOR}${SPELL}${MESSAGE_COLOR} conflicts with"
- text="$text ${SPELL_COLOR}${spell_and_default[0]}${QUERY_COLOR}."
+ text="$text ${SPELL_COLOR}${spell_and_default[0]}.${QUERY_COLOR}"
text="$text Dispel"
text="$text ${SPELL_COLOR}${spell_and_default[0]}${MESSAGE_COLOR}?"

- if query "$text" ${spell_and_default[1]} ; then
- dispel --noqueue ${spell_and_default[0]} || rc=1
- echo ${spell_and_default[0]} >> $CONFLICT_LIST
+ if query "$text" ${spell_and_default[1]}; then
+ echo ${spell_and_default[0]} >> $output
else
- echo $SPELL >> $FAILED_LIST
- log_failure_reason "conflict"
- return 1
+ log_failure_reason "conflicts"
+ return 1
fi
-
done
fi
- return ${rc:-0}

+ return 0
+}
+
+#---------------------------------------------------------------------
+## Dispels the spells that are scheduled for a dispel due to conflicting
+## @param file containing the list of conflicts
+#---------------------------------------------------------------------
+function dispel_conflicts() {
+ local conflict_list=${1:-$CONFLICT_LIST}
+ local spell
+
+ if [[ -s $conflict_list ]]; then
+ message "${MESSAGE_COLOR}Dispelling conflicts...$DEFAULT_COLOR"
+ else
+ return 0
+ fi
+
+ for spell in $(< $conflict_list); do
+ dispel --noqueue $spell || return 1
+ done
+}
+
+#---------------------------------------------------------------------
+## Prompts the user about possible security problems with the current
+## spell. Allows a safe way of failing a spell due to security problems.
+## @return 0 if there are no security problem or the user acknowledges them.
+## @return 1 if the user decides not to accept the security concerns
+#---------------------------------------------------------------------
+function run_security() {
+ debug "build_api/common" "Starting run_security() on $SPELL"
+ local rc=0
+ if [[ -f $SCRIPT_DIRECTORY/SECURITY ]]; then
+ message "${SPELL_COLOR}${SPELL}:${DEFAULT_COLOR}"
+ tee -a $SECURITY_LOG < $SCRIPT_DIRECTORY/SECURITY
+ if grep -q critical $SCRIPT_DIRECTORY/SECURITY; then
+ query "${RED}SECURITY CRITICAL:${QUERY_COLOR} Do you still want to
cast ${SPELL_COLOR}${SPELL}${DEFAULT_COLOR}?" "n"
+ else
+ query "SECURITY: Do you still want to cast
${SPELL_COLOR}$SPELL${QUERY_COLOR}?" "y"
+ fi
+ rc=$?
+ fi
+ [[ $rc != 0 ]] && log_failure_reason "security"
+ return $rc
}

function query_custom_cflags() {
@@ -523,7 +559,7 @@ function install_xinetd_sub() {
local install_dir=$3
local tmp_file=$TMP_DIR/$bfile
local inst_file=$install_dir/$bfile
- cp $file $tmp_file
+ install -g root -o root $file $tmp_file

set_xinetd_state $tmp_file $state

diff --git a/var/lib/sorcery/modules/libdepends
b/var/lib/sorcery/modules/libdepends
index bb212f4..1717055 100755
--- a/var/lib/sorcery/modules/libdepends
+++ b/var/lib/sorcery/modules/libdepends
@@ -103,12 +103,17 @@ function run_prepare()
function run_other() {
local SPELL=$1
# ask the questions about xinetd/initd script installation
- persistent_load
- query_services
- query_custom_cflags
- persistent_save
-# todo:
-#ask about conflicts
+ persistent_load &&
+ query_services &&
+ query_custom_cflags &&
+ query_conflicts &&
+ run_security &&
+ persistent_save ||
+ {
+ persistent_clear
+ log_failure_reason run_other #remove this if all the previous callers
get one
+ return 1
+ }
#ask about other stuff

}
diff --git a/var/lib/sorcery/modules/libdispel
b/var/lib/sorcery/modules/libdispel
index 81abb2b..db357ce 100755
--- a/var/lib/sorcery/modules/libdispel
+++ b/var/lib/sorcery/modules/libdispel
@@ -284,22 +284,20 @@ function load_spell() {
## Run the PRE_REMOVE script if it exists
#-----
function pre_remove() {
- local rc=0
if [[ $SCRIPT_DIRECTORY ]] ; then
run_spell_file PRE_REMOVE pre_remove
fi
- return $rc
+ return $?
}

#-----
## Run the POST_REMOVE script if it exists.
#-----
function post_remove() {
- local rc=0
if [[ $SCRIPT_DIRECTORY ]] ; then
run_spell_file POST_REMOVE post_remove
fi
- return $rc
+ return $?
}

#---------------------------------------------------------------------
diff --git a/var/lib/sorcery/modules/libgrimoire
b/var/lib/sorcery/modules/libgrimoire
index b1749a0..b2bdef7 100755
--- a/var/lib/sorcery/modules/libgrimoire
+++ b/var/lib/sorcery/modules/libgrimoire
@@ -188,7 +188,7 @@ function install_desktop_files() {
smgl_basename "$each" file
if ! test -f "$target_dir/$file" ; then
debug "libgrimoire" "Installing $file in $target_dir as a desktop file"
- cp $each $target_dir
+ install -g root -o root $each $target_dir
fi
done
}
@@ -227,18 +227,17 @@ function private_installed_version() {
##
#---------------------------------------------------------------------
function real_conflicts() {
-
debug "libgrimoire" "Running conflicts() on $1. Default query answer $2."

- if spell_installed $1; then
- [ "$2" = y ] && echo "$1:y" || echo "$1:n"
+ if spell_ok $1; then
+ if [[ $2 == y ]]; then
+ echo "$1:y"
+ else
+ echo "$1:n"
+ fi
fi
-
- true
-
}

-
#---------------------------------------------------------------------
## @Stdout Warning messages.
## Provides a neatly formatted rejection dialog for the
diff --git a/var/lib/sorcery/modules/libinitd
b/var/lib/sorcery/modules/libinitd
index 5cb2003..c9b4148 100755
--- a/var/lib/sorcery/modules/libinitd
+++ b/var/lib/sorcery/modules/libinitd
@@ -99,7 +99,7 @@ function _init_merge_config_file()
fi

local savetime=$( date +'%Y%m%d%H%M' )
- cp $2 $2.$savetime.backup
+ install -g root -o root $2 $2.$savetime.backup

for opt in $new_opts ; do
message " Merging option $opt into $2..."
@@ -144,7 +144,7 @@ function _init_install_conf_files()
check_if_modified "$target_file" && mark_file_modified "$target_file"
_init_merge_config_file $file $target_file
else
- install -m 644 $file $target_file
+ install -m 644 -g root -o root $file $target_file
touch $target_file
fi
done
@@ -229,11 +229,11 @@ function init_install()
else
_init_make_backup $script_path $runlevel_dir/$script_name
if [ "$enable_script" == "enabled" ] ; then
- install -m 754 $script_path $runlevel_dir
+ install -m 754 -g root -o root $script_path $runlevel_dir
message " script $script_name installed and
${MESSAGE_COLOR}enabled${DEFAULT_COLOR}. Disable with 'telinit disable
$script_name'."
message "${MESSAGE_COLOR}If you want to [re]start the service
now${DEFAULT_COLOR}, issue 'telinit run $script_name [re]start'."
else
- install -m 644 $script_path $runlevel_dir
+ install -m 644 -g root -o root $script_path $runlevel_dir
message " script $script_name installed and
${MESSAGE_COLOR}disabled${DEFAULT_COLOR}. Enable with 'telinit enable
$script_name'."
fi
_init_install_conf_files $( _init_get_conf_files $script_path )
diff --git a/var/lib/sorcery/modules/libqueue
b/var/lib/sorcery/modules/libqueue
index 0a590a5..79d96ff 100755
--- a/var/lib/sorcery/modules/libqueue
+++ b/var/lib/sorcery/modules/libqueue
@@ -272,7 +272,8 @@ function does_spell_need_update_sub() {
}

#---------------------------------------------------------------------
-## Common code between update_install_queue and update_security_install_queue
+## Common code between update_install_queue,
+## update_security_install_queue and does_spell_need_update
#---------------------------------------------------------------------
function update_install_queue_sub() {
local tmp_queue=$1
@@ -289,11 +290,14 @@ function update_install_queue_sub() {
cat $grimoire/$VERSION_INDEX_FILE
else
# provide a dummy version index, treating all spells as
multiversioned
- local grimoire_name
- smgl_basename "$grimoire" grimoire_name
- error_message "${PROBLEM_COLOR}Grimoire $grimoire_name is missing" \
- "the version index!$DEFAULT_COLOR"
- error_message "You can run scribe reindex-version $grimoire_name to
add one."
+ if [[ $type != single ]]; then
+ # don't whine for single spell lookups, so cast -Z is nicer
+ local grimoire_name
+ smgl_basename "$grimoire" grimoire_name
+ error_message "${PROBLEM_COLOR}Grimoire $grimoire_name is missing"
\
+ "the version index!$DEFAULT_COLOR"
+ error_message "You can run scribe reindex-version $grimoire_name
to add one."
+ fi
sed -n "s|^\(\S*\) .*$|\1 multiversioned|p"
$grimoire/$SPELL_INDEX_FILE
fi
done |
diff --git a/var/lib/sorcery/modules/libresurrect
b/var/lib/sorcery/modules/libresurrect
index cda39c3..5549f64 100755
--- a/var/lib/sorcery/modules/libresurrect
+++ b/var/lib/sorcery/modules/libresurrect
@@ -272,10 +272,16 @@ function resurrect_spell() { (
fi

# 9) remove conflicts, but not self-conflicts, they make no sense
- run_conflicts $SPELL || {
+ local conflicts=$TMP_DIR/list.of.conflicts
+ > $conflicts
+ query_conflicts $SPELL $conflicts
+ if [[ $? == 0 ]] && dispel_conflicts $conflicts; then
+ rm $conflicts
+ else
+ rm $conflicts
resurrect_fail
return 1
- }
+ fi

#####
# Start of critical region
diff --git a/var/lib/sorcery/modules/url_handlers/url_http
b/var/lib/sorcery/modules/url_handlers/url_http
index f48b0da..61759e0 100755
--- a/var/lib/sorcery/modules/url_handlers/url_http
+++ b/var/lib/sorcery/modules/url_handlers/url_http
@@ -27,13 +27,13 @@
##
#---------------------------------------------------------------------
function url_http_bucketize() {
- echo wget
+ echo $HTTP_DL_HANDLER
}
function url_ftp_bucketize() {
- echo wget
+ echo $HTTP_DL_HANDLER
}
function url_https_bucketize() {
- echo wget
+ echo $HTTP_DL_HANDLER
}

#---------------------------------------------------------------------
@@ -164,7 +164,7 @@ function url_http_expand() {
# note neither ends in a '/' but one has a '/' at the end of the
# hostname, the other has an end of line. The \(/\|\$\) stuff matches
# either
- for each in $(grep -l "://$my_hostname\(/\|\$\)" $MIRRORS/*); do
+ for each in $(grep -lr "://$my_hostname\(/\|\$\)" --exclude-dir=config
$MIRRORS); do
rep=$(grep "://$my_hostname\(/\|\$\)" $each|awk '{print $NF; exit 0;
}')
for tgt in $(awk '{print $NF}' $each|grep -v '^Custom$'); do
echo ${URL}|sed "s$A${rep}$A${tgt}$A"



  • [SM-Commit] GIT changes to master sorcery by Jaka Kranjc (b65fbde96c465775392d730cbf2188736f207999), Jaka Kranjc, 12/19/2008

Archive powered by MHonArc 2.6.24.

Top of Page