Skip to Content.
Sympa Menu

sm-commit - [SM-Commit] GIT changes to master sorcery by Ismael Luceno (e2b8b12421a654aee3a5638b5448162bb479c144)

sm-commit AT lists.ibiblio.org

Subject: Source Mage code commit list

List archive

Chronological Thread  
  • From: Ismael Luceno <scm AT sourcemage.org>
  • To: sm-commit AT lists.ibiblio.org
  • Subject: [SM-Commit] GIT changes to master sorcery by Ismael Luceno (e2b8b12421a654aee3a5638b5448162bb479c144)
  • Date: Fri, 20 Sep 2019 19:03:01 +0000

GIT changes to master sorcery by Ismael Luceno <ismael AT sourcemage.org>:

ChangeLog | 5 ++
Makefile | 33 ++++++++++++++++++
build | 49
----------------------------
usr/sbin/cast | 10 +----
var/lib/sorcery/modules/build_api/api2 | 8 +---
var/lib/sorcery/modules/dl_handlers/dl_bzr | 16 ++-------
var/lib/sorcery/modules/dl_handlers/dl_curl | 4 --
var/lib/sorcery/modules/dl_handlers/dl_cvs | 18 +++++-----
var/lib/sorcery/modules/dl_handlers/dl_hg | 28 +++++++---------
9 files changed, 70 insertions(+), 101 deletions(-)

New commits:
commit e2b8b12421a654aee3a5638b5448162bb479c144
Author: Ismael Luceno <ismael AT sourcemage.org>
Commit: Ismael Luceno <ismael AT sourcemage.org>

Implement a Makefile for maintenance tasks

Replaces build script and servers as a wrapper for the basic scripts.

commit 9bd03151c4361fe9edf3a432d43f6a5c2b558c78
Author: Ismael Luceno <ismael AT sourcemage.org>
Commit: Ismael Luceno <ismael AT sourcemage.org>

api2, cast, dl_{bzr,curl,cvs,hg}: Improve style

diff --git a/ChangeLog b/ChangeLog
index 44e8219..c64e8e0 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2019-09-20 Ismael Luceno <ismael AT sourcemage.org>
+ * api2, cast, dl_bzr, dl_curl, dl_cvs, dl_hg: Improved code style
+ * build: removed
+ * Makefile: Added for maintenance tasks and to wrap basic scripts
+
2019-09-04 Ismael Luceno <ismael AT sourcemage.org>
* install: Fixed running from outside the source directory

diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..431a0ee
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,33 @@
+.PHONY: help
+help:; @echo '$(help)'
+help = Available targets:
+
+BRANCH = stable
+release = sorcery-$(BRANCH).tar.bz2
+
+ts-scm = .git/refs/heads/master
+
+$(release): $(ts-scm)
+ tmp="$$(mktemp -p .)" \
+ && git archive --prefix=sorcery/ | bzip2 > "$$tmp" \
+ && mv "$$tmp" $(release) \
+ || rm -f "$$tmp"
+
+help += $(.newline) release - Make a release
+.PHONY: release
+release: $(release)
+
+help += $(.newline) bump - Bump version
+.PHONY: bump bump-stable bump-devel
+bump-stable:
+ git describe --tags | >etc/sorcery/version \
+ awk -F'[^0-9]' -vOFS=. '{++$$NF;for(i=1;i<NF;i++)$$i=$$(i+1)}NF--'
+
+bump-devel:
+ date -u +%Y%m%d > etc/sorcery/version
+
+bump: bump-$(BRANCH)
+
+script-targets = install uninstall convert
+.PHONY: $(script-targets)
+$(script-targets):; ./$@
diff --git a/build b/build
deleted file mode 100755
index 2a84dee..0000000
--- a/build
+++ /dev/null
@@ -1,49 +0,0 @@
-#!/bin/bash
-
-build__find_non_volatile() {
- find "$@" -follow -type d \( \
- \( -name CVS -o -name .svn -o -name .arch-id -o -name {arch} \
- -o -name .bzr -o -name .git \) -prune -o -true \) -o -print
-}
-
-branch_dir=$(basename $(pwd))
-if [[ $1 ]] ; then
- branch_name=$1
-else
- branch_name=$branch_dir
-fi
-
-if [ -e ../sorcery ]; then
- echo "We need a blank directory beneath the current one to link sorcery ->
$branch_dir"
- exit 1
-fi
-[[ $branch_name == devel ]] && date -u "+%Y%m%d" > etc/sorcery/version
-pushd .. &>/dev/null
-NAMES_TMP=/tmp/sorcery.build.$$
-ln -sf $branch_dir sorcery
-build__find_non_volatile sorcery > $NAMES_TMP
-tar --owner=0 --group=0 -cvjf sorcery-${branch_name}.tar.bz2 -T $NAMES_TMP
-rm $NAMES_TMP
-rm sorcery
-popd &>/dev/null
-
-#---------------------------------------------------------------------
-##=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/usr/sbin/cast b/usr/sbin/cast
index 67d02e2..dd11e05 100755
--- a/usr/sbin/cast
+++ b/usr/sbin/cast
@@ -606,12 +606,10 @@ pass_four() {
unlock_resources "libgrimoire" "install"
unlock_resources "cast" "$SPELL"
unlock_resources "solo" "cast"
+ return $rc
else
cast_spell $*
- rc=$?
fi
-
- return $rc
}


@@ -862,8 +860,7 @@ main() {
fi

for spell in $SPELLS ; do
- codex_does_spell_exist $spell
- if [ $? -eq 0 ] ; then
+ if codex_does_spell_exist $spell; then
T_SPELLS="$T_SPELLS $spell"
fi
done
@@ -881,9 +878,6 @@ main() {
five) pass_five $SPELLS ;; #cast report
*) pass_zero $SPELLS ;; #start everything
esac
- local rc=$?
-
- return $rc
}


diff --git a/var/lib/sorcery/modules/build_api/api2
b/var/lib/sorcery/modules/build_api/api2
index 55250e4..b24bdaf 100755
--- a/var/lib/sorcery/modules/build_api/api2
+++ b/var/lib/sorcery/modules/build_api/api2
@@ -168,9 +168,7 @@ run_build() {
message "$SPELL $VERSION"
message

- run_spell_file BUILD build optimize
-
- if [ "$?" != 0 ]; then
+ if ! run_spell_file BUILD build optimize; then
message "${PROBLEM_COLOR}" \
"! Problem Detected !" \
"${DEFAULT_COLOR}"
@@ -230,9 +228,7 @@ run_install() {
cd "$BUILD_DIRECTORY"
fi

- run_spell_file INSTALL install
-
- if [ "$?" != 0 ]; then
+ if ! run_spell_file INSTALL install; then
message "${PROBLEM_COLOR}" \
"Problem Detected!" \
"${DEFAULT_COLOR}"
diff --git a/var/lib/sorcery/modules/dl_handlers/dl_bzr
b/var/lib/sorcery/modules/dl_handlers/dl_bzr
index cae29d8..b9bafa5 100755
--- a/var/lib/sorcery/modules/dl_handlers/dl_bzr
+++ b/var/lib/sorcery/modules/dl_handlers/dl_bzr
@@ -40,21 +40,15 @@ dl_bzr_get() {
then
BZR_DIRECTORY=${target}
fi
- if test -d $BZR_DIRECTORY; then
+ eval "$dl_target=\"$BZR_DIRECTORY\""
+ if [ -d "$BZR_DIRECTORY" ]; then
message "${MESSAGE_COLOR}Updating...${DEFAULT_COLOR}"
- ( cd $BZR_DIRECTORY &&
- echo bzr update &&
- bzr update )
- rc=$?
- eval "$dl_target=\"$BZR_DIRECTORY\""
+ bzr update "$BZR_DIRECTORY"
else
message "${MESSAGE_COLOR}Doing a lightweight
checkout...${DEFAULT_COLOR}"
- echo bzr checkout --lightweight $BZR_ROOT $BZR_DIRECTORY
- bzr checkout --lightweight $BZR_ROOT $BZR_DIRECTORY
- rc=$?
- eval "$dl_target=\"$BZR_DIRECTORY\""
+ bzr checkout --lightweight "$BZR_ROOT" "$BZR_DIRECTORY"
fi
- [[ $rc == 0 ]] && break
+ ((rc = $?)) || break
done
dl_disconnect

diff --git a/var/lib/sorcery/modules/dl_handlers/dl_curl
b/var/lib/sorcery/modules/dl_handlers/dl_curl
index 24c5eec..52f974b 100755
--- a/var/lib/sorcery/modules/dl_handlers/dl_curl
+++ b/var/lib/sorcery/modules/dl_handlers/dl_curl
@@ -38,8 +38,7 @@ dl_curl_get() {
local CURL_OPTIONS
dl_curl_set_options $url $hints
dl_curl_call_curl $target $url
- rc=$?
- [[ $rc == 0 ]] && break
+ ((rc = $?)) || break
done

dl_disconnect
@@ -47,7 +46,6 @@ dl_curl_get() {
eval "$dl_target=\"$target\""
eval "$dl_type=\"file\""
return $rc
-
}

#---------------------------------------------------------------------
diff --git a/var/lib/sorcery/modules/dl_handlers/dl_cvs
b/var/lib/sorcery/modules/dl_handlers/dl_cvs
index be7131c..cb58831 100755
--- a/var/lib/sorcery/modules/dl_handlers/dl_cvs
+++ b/var/lib/sorcery/modules/dl_handlers/dl_cvs
@@ -58,29 +58,29 @@ dl_cvs_get() {
local URL CVS_ROOT CVS_MODULE CVS_TAG
url_cvs_crack $url

+ local origdir="$(pwd)"
# if the target is a directory then its quite possible we're
# updating a tree rather than checking a new one out
- if test -d $target; then
+ if [ -d "$target" ]; then
message "${MESSAGE_COLOR}Running cvs update...${DEFAULT_COLOR}"
- if cd $target; then
- cvs $CVS_OPTIONS update -d -r $CVS_TAG
- rc=$?
- cd ..
- else
+ if ! cd "$target"; then
dl_disconnect
return 1
fi
+ cvs $CVS_OPTIONS update -d -r "$CVS_TAG"
else
message "${MESSAGE_COLOR}Running cvs checkout...${DEFAULT_COLOR}"
- cvs $CVS_OPTIONS -d$CVS_ROOT checkout -r $CVS_TAG -d $target
$CVS_MODULE
- rc=$?
+ cvs $CVS_OPTIONS -d"$CVS_ROOT" checkout -r "$CVS_TAG" -d "$target" \
+ "$CVS_MODULE"
fi
- [[ $rc == 0 ]] && break
+ ((rc = $?)) || break
done
dl_disconnect

eval "$dl_target=\"$target\""
eval "$dl_type=\"tree\""
+
+ cd "$origdir"
return $rc
}

diff --git a/var/lib/sorcery/modules/dl_handlers/dl_hg
b/var/lib/sorcery/modules/dl_handlers/dl_hg
index 5e1e271..df407d6 100755
--- a/var/lib/sorcery/modules/dl_handlers/dl_hg
+++ b/var/lib/sorcery/modules/dl_handlers/dl_hg
@@ -32,6 +32,7 @@ dl_hg_get() {
[[ $target ]] &&
dl_connect || return 255

+ local origdir="$(pwd)"
for url in $url_list; do
local URL HG_ROOT HG_DIRECTORY HG_TAG
url_crack "$url" "$hints"
@@ -39,30 +40,27 @@ dl_hg_get() {
then
HG_DIRECTORY=${target/.hg/}
fi
+ eval "$dl_target=\"$HG_DIRECTORY\""
if [[ -d $HG_DIRECTORY ]]; then
message "${MESSAGE_COLOR}Running hg pull...${DEFAULT_COLOR}"
- ( cd $HG_DIRECTORY &&
- echo hg pull $HG_ROOT &&
- hg pull $HG_ROOT &&
- echo hg update $HG_TAG &&
- hg update $HG_TAG )
- rc=$?
- eval "$dl_target=\"$HG_DIRECTORY\""
+ cd "$HG_DIRECTORY" &&
+ echo hg pull "$HG_ROOT" &&
+ hg pull "$HG_ROOT"
else
message "${MESSAGE_COLOR}Running hg clone...${DEFAULT_COLOR}"
echo hg clone $HG_ROOT $HG_DIRECTORY
- hg clone $HG_ROOT $HG_DIRECTORY &&
- ( cd $HG_DIRECTORY &&
- echo hg update $HG_TAG &&
- hg update $HG_TAG )
- rc=$?
- eval "$dl_target=\"$HG_DIRECTORY\""
- fi
- [[ $rc == 0 ]] && break
+ hg clone "$HG_ROOT" "$HG_DIRECTORY" &&
+ cd "$HG_DIRECTORY"
+ fi &&
+ echo hg update "$HG_TAG" &&
+ hg update "$HG_TAG"
+ ((rc = $?)) || break
done
dl_disconnect

eval "$dl_type=\"tree\""
+
+ cd "$origdir"
return $rc
}




  • [SM-Commit] GIT changes to master sorcery by Ismael Luceno (e2b8b12421a654aee3a5638b5448162bb479c144), Ismael Luceno, 09/20/2019

Archive powered by MHonArc 2.6.24.

Top of Page