Skip to Content.
Sympa Menu

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

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 (0e75c5d40976d7af6a9f1f8cba1d799726f38e15)
  • Date: Mon, 24 Mar 2008 15:44:52 -0500

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

ChangeLog | 3 +++
usr/sbin/dispel | 40 ++++++++++++++++++++++++++++++++++------
usr/share/man/man8/dispel.8 | 9 +++++----
3 files changed, 42 insertions(+), 10 deletions(-)

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

dispel: made downgrading more user friendly #11749; now a list of
possible versions is displayed to choose from and the version
doesn't need to be specified on the commandline anymore

diff --git a/ChangeLog b/ChangeLog
index 5fbd97e..97b65e0 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -4,6 +4,9 @@
fixed ENTERED typo in codex_clear_current_spell and two comments
* grimoire.5, libcodex, libtablet: made BUILD_API=2 the default
* libmisc: simplified and sped up is_sorcery_var
+ * dispel: made downgrading more user friendly #11749; now a list of
+ possible versions is displayed to choose from and the version
+ doesn't need to be specified on the commandline anymore

2008-03-24 Jaka Kranjc <lynxlynxlynx AT sourcemage.org>
* Start 1.15 development stream.
diff --git a/usr/sbin/dispel b/usr/sbin/dispel
index 879c0e7..185b9b8 100755
--- a/usr/sbin/dispel
+++ b/usr/sbin/dispel
@@ -24,7 +24,7 @@ Optional Parameters:
-e | --exile spell Removes spells and blocks them
from being automatically reinstalled.

--d | --downgrade spell version
+-d | --downgrade spell [version]
Removes the spell and reinstalls
the selected version from cache

@@ -85,7 +85,7 @@ function downgrade() {
REQUESTED_VERSION=$2
CACHE_COMP="$INSTALL_CACHE/$SPELL-$REQUESTED_VERSION-$HOST.tar$EXTENSION"

- if [ ! -f $CACHE_COMP ]; then
+ if [[ -n $REQUESTED_VERSION && ! -f $CACHE_COMP ]]; then
message "${FILE_COLOR}$CACHE_COMP" \
"${PROBLEM_COLOR}was not found." \
"${DEFAULT_COLOR}"
@@ -118,8 +118,35 @@ function downgrade() {
return 1
fi

+ local version versions chosen_version
+ versions=$(find $INSTALL_CACHE -name "$SPELL-*-$HOST.*" -printf "%f\n" |
+ sed "s,^$SPELL-\(\S*\)-$HOST\.\S*$,\1," |
+ while read version; do
+ # we need to ignore other spells with similar names due to laxed
matching
+ # for example, wine-gecko would match when searching for wine, but we
can
+ # check if wine + gecko is a spell. We do that by comparing version
parts
+ if ! codex_find_spell_by_name "$SPELL-${version%%-*}" &>/dev/null; then
+ local version2="${version#*-}"
+ if ! codex_find_spell_by_name
"$SPELL-${version%%-*}-${version2%%-*}" &>/dev/null; then
+ echo $version
+ fi
+ fi
+ done | sort -r)
+ if [[ -z $versions ]]; then
+ error_message "${PROBLEM_COLOR}Unable to downgrade" \
+ "${SPELL_COLOR}${SPELL}${DEFAULT_COLOR}" \
+ "because no cache was found."
+ return 1
+ fi
+ # skip the query if there is only one candidate version
+ if [[ $(wc -l <<< "$versions") != 1 ]]; then
+ select_list chosen_version "$REQUESTED_VERSION" $versions
+ else
+ chosen_version="$versions"
+ fi
+
SUCCESS_LIST=/dev/null
- resurrect $SPELL $REQUESTED_VERSION
+ resurrect $SPELL $chosen_version

return 0
}
@@ -140,13 +167,14 @@ function process_parameters() {
EXILE="yes"; shift 1
;;
-d|--downgrade)
- if [[ -z $3 ]]; then
+ if [[ -z $2 ]]; then
message "${PROBLEM_COLOR}Missing parameters!${DEFAULT_COLOR}"
help
fi
downgrade $2 $3
DISPEL_EXIT_STATUS=${DISPEL_EXIT_STATUS:-$?}
- shift 3
+ [[ ${3:0:1} == - ]] || shift
+ shift 2
;;
--noreap) REAP="off"; shift 1 ;;
--no-reap-depends) NO_REAP_DEPENDS="on"; shift 1 ;;
@@ -207,7 +235,7 @@ function strip_parameters() {
if echo "" $1 | grep -q "^ -"; then
case $1 in
-e|--exile) shift 1 ;;
- -d|--downgrade) shift 3 ;;
+ -d|--downgrade) shift 2; [[ ${3:0:1} == - ]] || shift ;;
--noreap) shift 1 ;;
--no-reap-depends) shift 1 ;;
--nosustain) shift 1 ;;
diff --git a/usr/share/man/man8/dispel.8 b/usr/share/man/man8/dispel.8
index 3fa5301..ee004b5 100644
--- a/usr/share/man/man8/dispel.8
+++ b/usr/share/man/man8/dispel.8
@@ -6,7 +6,7 @@ dispel \- removes software packages
[options] [package1] ... [package2] ...
.PP
.B dispel -e|--exile|-d|--downgrade
-<package> <version>
+<package> [version]
.SH "EXAMPLE"
To uninstall emacs type:
.IP
@@ -64,9 +64,10 @@ There are several options, described below, for dependency
following. They accep
.I ignore.

.SH "OPTIONS"
-.SS "-d, --downgrade <spell> <version>"
-remove the selected spell and restore to the given
-previously installed version.
+.SS "-d, --downgrade <spell> [version]"
+Remove the selected spell and restore to the given previously installed
version.
+The version parameter is optional and specifies preference. The user will be
+shown a list of versions to choose from (unless there is only one).
.SS "-e, --exile <spell>"
removes software package and sets package status to 'exiled'.
This prevents it from being cast again automatically,



  • [SM-Commit] GIT changes to master sorcery by Jaka Kranjc (0e75c5d40976d7af6a9f1f8cba1d799726f38e15), Jaka Kranjc, 03/24/2008

Archive powered by MHonArc 2.6.24.

Top of Page