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
}
+ 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