Project

General

Profile

packdist.sh

Creates new tarballs in distbuild/ with CHANGES/DOWNLOAD files (including make distcheck) - stbuehler, 2009-03-10 09:02

 
1
#!/bin/sh
2

    
3
SRCTEST=src/spawn-fcgi.c
4
PACKAGE=spawn-fcgi
5

    
6
# may take one argument for prereleases like
7
# ./packdist.sh [--nopack] rc1-r10
8

    
9
if [ ! -f ${SRCTEST} ]; then
10
	echo "Current directory is not the source directory"
11
	exit 1
12
fi
13

    
14
dopack=1
15
if [ "$1" = "--nopack" ]; then
16
	dopack=0
17
	shift
18
fi
19

    
20
append="$1"
21

    
22
function force() {
23
	"$@" || {
24
		echo "Command failed: $*"
25
		exit 1
26
	}
27
}
28

    
29
function genchanges() {
30
	(
31
		echo "h1. Changes"
32
		echo
33
		cat ../NEWS | sed "/^- ${version}/,/^-/p;d" | sed "/^- /d;/^$/d" | sed -e 's/^  \*/\*/'
34
	) > CHANGES
35
	return 0
36
}
37

    
38
if [ ${dopack} = "1" ]; then
39
	force ./autogen.sh
40

    
41
	if [ -d distbuild ]; then
42
		# make distcheck may leave readonly files
43
		chmod u+w -R distbuild
44
		rm -rf distbuild
45
	fi
46

    
47
	force mkdir distbuild
48
	force cd distbuild
49

    
50
	force ../configure --prefix=/usr
51
	version=`./config.status -V | head -n 1 | cut -d' ' -f3`
52
	name="${PACKAGE}-${version}"
53

    
54
	# force make
55
	# force make check
56

    
57
	force make distcheck
58
	force make dist-gzip
59
	force make dist-bzip2
60

    
61
	if [ -n "${append}" ]; then
62
		cp "${name}.tar.gz" "${name}${append}.tar.gz"
63
		cp "${name}.tar.bz2" "${name}${append}.tar.bz2"
64
		name="${name}${append}"
65
	fi
66
fi
67

    
68
force md5sum "${name}.tar."{gz,bz2} > "${name}.md5sum"
69
force sha1sum "${name}.tar."{gz,bz2} > "${name}.sha1sum"
70

    
71
(
72
	echo "h1. Downloads"
73
	echo
74
	echo "* http://www.lighttpd.net/download/${name}.tar.gz"
75
	echo "** MD5: $(md5sum ${name}.tar.gz | cut -d' ' -f1)"
76
	echo "** SHA1: $(sha1sum ${name}.tar.gz | cut -d' ' -f1)"
77
	echo "* http://www.lighttpd.net/download/${name}.tar.bz2"
78
	echo "** MD5: $(md5sum ${name}.tar.bz2 | cut -d' ' -f1)"
79
	echo "** SHA1: $(sha1sum ${name}.tar.bz2 | cut -d' ' -f1)"
80
	echo "* SHA1 checksums: http://www.lighttpd.net/download/${name}.sha1sum"
81
	echo "* MD5 checksums: http://www.lighttpd.net/download/${name}.md5sum"
82
) > DOWNLOADS
83

    
84
force genchanges