mirror of
https://github.com/rkd77/elinks.git
synced 2024-09-29 03:17:53 -04:00
Rewrote contrib/mkdist.
* All arguments must now be given as options. * Documented. * chmod +x in Git. * Do not distribute files whose contents should depend on what the configure script found: config.h, config.log, config.status, features.log, Makefile.config, contrib/conv/w3m2links.awk, contrib/lua/hooks.lua, doc/man/man1/elinks.1. * Do not distribute other files that configure will rebuild anyway: src/intl/gettext/ref-add.sed, src/intl/gettext/ref-del.sed. But do distribute contrib/elinks.spec, because it specifies how to run configure, and only the @VERSION@ varies in it. * Do not distribute the empty directory po/.deps. * Save the commit ID into .git/HEAD in the tar file. * Compress the *.tar.gz and *.tar.bz2 from the same *.tar file. * Instead of *.tar.gz.md5 and *.tar.bz2.md5, generate a *.md5 file that contains md5sums for *.tar, *.tar.gz, and *.tar.bz2. * Use md5sum --binary for the sake of Windows.
This commit is contained in:
parent
4c8cf822dd
commit
d070c8338f
166
contrib/mkdist
Normal file → Executable file
166
contrib/mkdist
Normal file → Executable file
@ -2,11 +2,21 @@
|
|||||||
#
|
#
|
||||||
# This script can be used by a cron to generate snapshots.
|
# This script can be used by a cron to generate snapshots.
|
||||||
# For example, use:
|
# For example, use:
|
||||||
# 35 0 * * * mkdist elinks-0.11 0.11 >>mkdist.log 2>&1
|
# 35 0 * * * mkdist -r elinks-0.11 -l 0.11 -s >>mkdist.log 2>&1
|
||||||
# 40 0 * * * mkdist HEAD 0.12 >>mkdist.log 2>&1
|
# 40 0 * * * mkdist -r HEAD -l 0.12 -s >>mkdist.log 2>&1
|
||||||
#
|
#
|
||||||
# To generate a release (which doesn't have a date in the
|
# Options:
|
||||||
# top-level directory) also pass -r as the third parameter.
|
# -g GIT_DIR Git repository from which this script exports ELinks.
|
||||||
|
# May be given in the environment instead.
|
||||||
|
# -r REVISION Git revision to be exported from the repository.
|
||||||
|
# -l LABEL User-friendly name of the branch or release.
|
||||||
|
# This ends up in the name of the tar file, and in the
|
||||||
|
# name of the directory it contains.
|
||||||
|
# -s Generate a snapshot (which has a date in the top-level
|
||||||
|
# directory).
|
||||||
|
# -d DOCDIR Copy prebuilt documentation from DOCDIR.
|
||||||
|
# -o OUTDIR Place the output files in OUTDIR. Defaults to the
|
||||||
|
# current directory.
|
||||||
|
|
||||||
# set -x
|
# set -x
|
||||||
|
|
||||||
@ -15,64 +25,118 @@ echo "Date: $(date)"
|
|||||||
echo "Args: $*"
|
echo "Args: $*"
|
||||||
echo "-------------------------------------------------"
|
echo "-------------------------------------------------"
|
||||||
|
|
||||||
ub=$1
|
# Variables used in this script:
|
||||||
lb=$2
|
# $GIT_DIR = option -g GIT_DIR; passed in environment to Git
|
||||||
|
# $OPTARG = Bash special: argument of the option being parsed
|
||||||
|
# $OPTIND = Bash special: index of argument to be parsed next
|
||||||
|
# $commit = commit ID corresponding to $rev
|
||||||
|
# $docdir = option -d DOCDIR
|
||||||
|
# $label = option -l LABEL
|
||||||
|
# $opt = option letter being parsed, or '?' on error
|
||||||
|
# $outdir = option -o OUTDIR
|
||||||
|
# $rev = option -r REVISION
|
||||||
|
# $snap = option -s
|
||||||
|
# $tarbasename = name of the tar file without .tar.* extensions
|
||||||
|
# $tartopdir = name of the top directory within the tar file
|
||||||
|
# $tmpdir = temporary directory created by this script
|
||||||
|
|
||||||
GIT_DIR="elinks-repo-directory"
|
rev=
|
||||||
DOC_DIR="" # Leave empty for no doc dir
|
label=
|
||||||
TMP_DIR="/tmp/elinks-git.$$"
|
snap=
|
||||||
TAR_DIR="elinks-snapshot-directory"
|
docdir=
|
||||||
|
outdir=.
|
||||||
|
while getopts "g:r:l:sd:o:" opt
|
||||||
|
do
|
||||||
|
case "$opt" in
|
||||||
|
(g) GIT_DIR=$OPTARG ;;
|
||||||
|
(r) rev=$OPTARG ;;
|
||||||
|
(l) label=$OPTARG ;;
|
||||||
|
(s) snap=1 ;;
|
||||||
|
(d) docdir=$OPTARG ;;
|
||||||
|
(o) outdir=$OPTARG ;;
|
||||||
|
("?") exit 1 ;;
|
||||||
|
(*) echo >&2 "$0:$LINENO: bug found"
|
||||||
|
exit 1 ;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
|
||||||
[ "$ub" ] || exit 1
|
if [ $OPTIND -le $# ]
|
||||||
[ "$lb" ] || exit 1
|
then
|
||||||
|
echo >&2 "$0: too many non-option arguments"
|
||||||
if [ "$3" != "-r" ]; then
|
exit 1
|
||||||
ver=$lb-`date +%Y%m%d`
|
|
||||||
c="-current";
|
|
||||||
else
|
|
||||||
ver=$lb;
|
|
||||||
c="";
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
mkdir "$TMP_DIR
|
if [ -z "$GIT_DIR" ]
|
||||||
cd "$TMP_DIR"
|
then
|
||||||
|
echo >&2 "$0: Must specify -g GIT_DIR option"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
if [ -z "$outdir" ]
|
||||||
|
then
|
||||||
|
echo >&2 "$0: Must specify -o OUTDIR option"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
if [ -z "$rev" ]
|
||||||
|
then
|
||||||
|
echo >&2 "$0: Must specify -r REVISION option"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
if [ -z "$label" ]
|
||||||
|
then
|
||||||
|
label=$rev
|
||||||
|
fi
|
||||||
|
|
||||||
GIT_DIR="$GIT_DIR" cg-export -r "$ub" "$TMP_DIR"/elinks"
|
commit=$(GIT_DIR=$GIT_DIR cg-object-id -c "$rev") || exit 1
|
||||||
|
|
||||||
cd elinks
|
if [ "$snap" ]
|
||||||
|
then
|
||||||
./autogen.sh
|
tartopdir=elinks-$label-$(date +%Y%m%d)
|
||||||
./configure
|
tarbasename=elinks-current-$label
|
||||||
|
|
||||||
if [ "$ub" = "REL_0_10" ]; then
|
|
||||||
make dist
|
|
||||||
tar xfz elinks-$lb*.tar.gz
|
|
||||||
cd elinks-$ub*
|
|
||||||
else
|
else
|
||||||
|
tartopdir=elinks-$label
|
||||||
|
tarbasename=elinks-$label
|
||||||
|
fi
|
||||||
|
|
||||||
|
tmpdir=$(mktemp -d -t elinks-dist-XXXXXXXX) || exit 1
|
||||||
|
|
||||||
|
# To make it easier to compare build logs, put the source first in an
|
||||||
|
# "elinks" directory, and only move to "$tartopdir" when finished.
|
||||||
|
|
||||||
|
GIT_DIR=$GIT_DIR cg-export -r "$rev" -- "$tmpdir/elinks"
|
||||||
|
mkdir -- "$tmpdir/elinks/.git"
|
||||||
|
printf "%s\n" "$commit" > "$tmpdir/elinks/.git/HEAD"
|
||||||
|
|
||||||
|
(set -e
|
||||||
|
cd -- "$tmpdir/elinks"
|
||||||
|
./autogen.sh
|
||||||
|
mkdir build
|
||||||
|
cd build
|
||||||
|
../configure
|
||||||
make -C po
|
make -C po
|
||||||
fi
|
mv po/*.gmo ../po/
|
||||||
|
mv contrib/elinks.spec ../contrib/
|
||||||
|
) || exit 1
|
||||||
|
|
||||||
if test -n "$DOC_DIR"; then
|
if [ -n "$docdir" ]; then
|
||||||
mkdir doc/html
|
mkdir -- "$tmpdir/elinks/doc/html"
|
||||||
cp -r "$DOC_DIR"/*.html* doc/html
|
cp -r -- "$docdir"/*.html* "$tmpdir/elinks/doc/html/"
|
||||||
# mkdir doc/pdf
|
# mkdir doc/pdf
|
||||||
# cp "$DOC_DIR"/*.pdf doc/pdf
|
# cp "$docdir"/*.pdf doc/pdf
|
||||||
fi
|
fi
|
||||||
|
|
||||||
cd ..
|
rm -rf -- "$tmpdir/elinks/build"
|
||||||
|
mv -- "$tmpdir/elinks" "$tmpdir/$tartopdir"
|
||||||
|
|
||||||
if [ "$c" ]; then
|
(set -e
|
||||||
dir=`ls .`
|
cd -- "$tmpdir"
|
||||||
mv $dir elinks-$ver
|
tar cf "$tarbasename.tar" "$tartopdir"
|
||||||
fi
|
md5sum --binary -- "$tarbasename.tar" > "$tarbasename.md5"
|
||||||
|
bzip2 --keep -- "$tarbasename.tar"
|
||||||
|
gzip -9 -- "$tarbasename.tar"
|
||||||
|
md5sum --binary -- "$tarbasename.tar.gz" "$tarbasename.tar.bz2" >> "$tarbasename.md5"
|
||||||
|
) || exit 1
|
||||||
|
|
||||||
|
mv -- "$tmpdir/$tarbasename.tar.gz" "$outdir"
|
||||||
tar cfz elinks$c-$lb.tar.gz elinks-$ver && \
|
mv -- "$tmpdir/$tarbasename.tar.bz2" "$outdir"
|
||||||
mv elinks$c-$lb.tar.gz "$TAR_DIR" && \
|
mv -- "$tmpdir/$tarbasename.md5" "$outdir"
|
||||||
(cd "$TAR_DIR" && md5sum elinks$c-$lb.tar.gz > elinks$c-$lb.tar.gz.md5)
|
rm -rf -- "$tmpdir"
|
||||||
|
|
||||||
tar cfj elinks$c-$lb.tar.bz2 elinks-$ver && \
|
|
||||||
mv elinks$c-$lb.tar.bz2 "$TAR_DIR" && \
|
|
||||||
(cd "$TAR_DIR" && md5sum elinks$c-$lb.tar.bz2 > elinks$c-$lb.tar.gz.md5)
|
|
||||||
|
|
||||||
rm -rf "$TMP_DIR"
|
|
||||||
|
Loading…
Reference in New Issue
Block a user