Values are now configured from the command line or the configuration
file. Since the configuration file is a shell fragment, it can invoke
`mdw-conf' itself for compatibility, and, indeed, I now have such a
configuration file. The default `mdw.conf' file now has the necessary
extra keys in it.
This involves a little new machinery in `mdw-build' itself. Some new
flags are introduced, to control whether the outputs should be
signed (and if so, which key should be used); and whether a Debian
upload should be performed (and if so, which target to use).
Correspondingly, the existing `upload' option has grown a configurable
remote path to control where the files should be written.
unset checkout checkoutrev
unset setup setupcmd
unset checkout checkoutrev
unset setup setupcmd
+unset sign signkey
+unset upload uploadpath
-unset build distcheck debian upload clean vpath native
+unset build distcheck debian clean vpath native
for i in \
"/etc/mdw-build.conf" \
"${XDG_CONFIG_HOME-$HOME/.config}/mdw-build.conf" \
for i in \
"/etc/mdw-build.conf" \
"${XDG_CONFIG_HOME-$HOME/.config}/mdw-build.conf" \
do
if [ -f "$i" ]; then . "$i"; fi
done
do
if [ -f "$i" ]; then . "$i"; fi
done
+default_depends () {
+ var=$1 want=$2
+ eval "p=\${$var+t} q=\${$want+t}"
+ case $p,$q in t,*) ;; *,t) eval "$var=yes" ;; *) eval "$var=no" ;; esac
+}
: ${checkout=yes} ${checkoutrev=HEAD}
: ${build=test}
: ${setup=yes} ${setupcmd=mdw-setup}
: ${distcheck=yes}
: ${debian=yes}
: ${checkout=yes} ${checkoutrev=HEAD}
: ${build=test}
: ${setup=yes} ${setupcmd=mdw-setup}
: ${distcheck=yes}
: ${debian=yes}
: ${clean=yes}
: ${vpath=yes}
: ${native=yes}
: ${clean=yes}
: ${vpath=yes}
: ${native=yes}
+default_depends sign signkey
+default_depends upload uploadpath
+default_depends dput dputtarget
: ${DEB_BUILD_OPTIONS=parallel=4}; export DEB_BUILD_OPTIONS
###--------------------------------------------------------------------------
: ${DEB_BUILD_OPTIONS=parallel=4}; export DEB_BUILD_OPTIONS
###--------------------------------------------------------------------------
[no]setup[=RUNE]
[no]distcheck
[no]debian
[no]setup[=RUNE]
[no]distcheck
[no]debian
+ [no]upload[=SERVER:PATH]
+ [no]dput[=TARGET]
shift $((OPTIND - 1))
## Parse the build options.
shift $((OPTIND - 1))
## Parse the build options.
+maybe_set () {
+ var=$1 want=$2
+ eval "p=\${$want+t}\${$want-nil}"
+ case $p in
+ t) eval $var=yes ;;
+ nil) echo >&2 "$prog: $want not set"; exit 1 ;;
+ esac
+}
for opt; do
case "$opt" in
checkout) checkout=yes checkoutrev=HEAD ;;
for opt; do
case "$opt" in
checkout) checkout=yes checkoutrev=HEAD ;;
norelease) build=test ;;
setup) setup=yes setupcmd=mdw-setup ;;
setup=*) setup=yes setupcmd=${opt#*=} ;;
norelease) build=test ;;
setup) setup=yes setupcmd=mdw-setup ;;
setup=*) setup=yes setupcmd=${opt#*=} ;;
-
- distcheck | debian | upload | clean | vpath | native)
+ upload) maybe_set upload uploadpath ;;
+ upload=*) upload=yes uploadpath=${opt#*=} ;;
+ sign) maybe_set sign signkey ;;
+ sign=*) sign=yes signkey=${opt#*=} ;;
+ dput) maybe_set dput dputtarget ;;
+ dput=*) dput=yes dputtarget=${opt#*=} ;;
+
+ distcheck | debian | clean | vpath | native)
eval "$opt=yes"
;;
nocheckout | nosetup | nodistcheck | nodebian | \
eval "$opt=yes"
;;
nocheckout | nosetup | nodistcheck | nodebian | \
- noupload | noclean | novpath | nonative)
+ noupload | nodput | noclean | novpath | nonative | nosign)
eval "${opt#no}=no"
;;
*)
eval "${opt#no}=no"
;;
*)
esac
run mv $buildpath/$distdir.tar.gz .
esac
run mv $buildpath/$distdir.tar.gz .
-case $build in
- release)
- run gpg -u$(mdw-conf releasekey) -ab -o$distdir.tar.gz.gpg \
- $distdir.tar.gz
+case $build,$sign in
+ release,yes)
+ run gpg -u$signkey -ab -o$distdir.tar.gz.gpg $distdir.tar.gz
mv debian/changelog.new debian/changelog
;;
esac
mv debian/changelog.new debian/changelog
;;
esac
- run dpkg-buildpackage -k$(mdw-conf releasekey)
+ case $build,$sign in
+ release,yes) run dpkg-buildpackage -k$signkey ;;
+ no,*) run dpkg-buildpackage -us -uc ;;
+ esac
;;
esac
## Maybe upload Debian packages.
cd $releasepath
case "$upload,$build" in
;;
esac
## Maybe upload Debian packages.
cd $releasepath
case "$upload,$build" in
- yes,test)
- info "Test build: not uploading."
- ;;
- yes,release)
- run rsync $distdir.tar.gz $distdir.tar.gz.gpg \
- $(mdw-conf upload-target ftp.distorted.org.uk:~ftp/pub/mdw/)
- case "$debian" in
- yes)
- run dput -f $(mdw-conf dput-target distorted) *.changes
- ;;
- esac
+ yes,test) info "Test build: not uploading." ;;
+ yes,release) run rsync $distdir.tar.gz $distdir.tar.gz.gpg $uploadpath ;;
+esac
+case "$debian,$upload,$dput,$build" in
+ yes,yes,yes,release) run dput -f $dputtarget *.changes ;;
--- /dev/null
+### -*-sh-*-
+
+set_from_mdw_conf () {
+ var=$1 key=$2; shift 2
+ case $# in 0) defaultp=nil ;; *) defaultp=t default=$1; shift ;; esac
+ if value=$(mdw-conf $key 2>/dev/null); then
+ eval "$var=\$value"
+ else
+ case $defaultp in t) eval "$var=\$default" ;; esac
+ fi
+}
+
+setup=yes setupcmd=mdw-setup
+
+set_from_mdw_conf uploadpath upload-target
+set_from_mdw_conf dputtarget dput-target
+set_from_mdw_conf signkey releasekey
+
+DEB_BUILD_OPTIONS=parallel=4
console-ctype = en_GB.utf8
x-ctype = en_GB.utf8
releasekey = E359CA55
console-ctype = en_GB.utf8
x-ctype = en_GB.utf8
releasekey = E359CA55
+upload-target = ftp.distorted.org.uk:~ftp/pub/mdw/
+dput-target = distorted
lisp-init.lisp:.clisprc.lisp
lisp-init.lisp:.eclrc
swank.lisp
lisp-init.lisp:.clisprc.lisp
lisp-init.lisp:.eclrc
swank.lisp
+ mdw-build.conf:.config/mdw-build.conf
w3m-config:.w3m/config elinks.conf:.elinks/elinks.conf
dircolors colordiffrc screenrc cvsrc indent.pro"
[ "$xstuff" ] && dotfiles="$dotfiles
w3m-config:.w3m/config elinks.conf:.elinks/elinks.conf
dircolors colordiffrc screenrc cvsrc indent.pro"
[ "$xstuff" ] && dotfiles="$dotfiles