summaryrefslogtreecommitdiff
path: root/media-libs/netpbm/files/make-tarball.sh
blob: 29ad4b3d92e4a60c9cd422ce96e98fc82fe20a89 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
#!/bin/bash
# Copyright 1999-2021 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

# Helper script for creating tarballs of netpbm releases since the netpbm
# project refuses to do so themselves for "current" releases.  Their process
# is entirely contained in the svn repo.
# http://netpbm.sourceforge.net/getting_netpbm.php
# https://sourceforge.net/p/netpbm/code/HEAD/tree/

. /lib/gentoo/functions.sh

PV=$1
SVN_ROOT=${2:-/usr/local/src}
NETPBM="${SVN_ROOT}/netpbm"
USERGUIDE="${NETPBM}/userguide"

if [[ $# -eq 0 ]] ; then
	ebegin "Detecting latest version"
	cd "${NETPBM}/release_number" || die
	svn up -q || die
	PV=$(svn ls | sort -V | tail -1) || die
	[[ -z ${PV} ]] && die
	PV=${PV%/}
	eend
	einfo "Using PV=${PV}"

	if [[ ! -d ${PV} ]] ; then
		ebegin "Checking out ${PV}"
		svn up -q "${PV}"
		eend || die
	fi

	ebegin "Updating userguide"
	cd "${USERGUIDE}" || die
	svn up -q || die
	eend
fi

if [[ $# -gt 2 ]] ; then
	exec echo "Usage: $0 [version] [netpbm svn root]"
fi

PN=netpbm
P=${PN}-${PV}

T=/tmp

maint_pkg_create() {
	local base="${SVN_ROOT}"
	local srcdir="${NETPBM}/release_number"
	local htmldir="${USERGUIDE}"
	if [[ -d ${srcdir} ]] ; then
		cd "${T}" || die

		rm -rf "${P}"

		ebegin "Exporting ${srcdir}/${PV} to ${P}"
		svn export -q "${srcdir}/${PV}" "${P}"
		eend $? || return 1

		ebegin "Exporting ${htmldir} to ${P}/userguide"
		svn export -q "${htmldir}" "${P}"/userguide
		eend $? || return 1

		ebegin "Generating manpages from html"
		(cd "${P}/userguide" && ../buildtools/makeman ./*.html)
		eend $? || return 1

		ebegin "Creating ${P}.tar.xz"
		tar cf - "${P}" | xz > "${P}".tar.xz
		eend $?

		einfo "Tarball now ready at: ${T}/${P}.tar.xz"
	else
		einfo "You need to run:"
		einfo " cd ${base}"
		einfo " svn co https://netpbm.svn.sourceforge.net/svnroot/netpbm"
		die "need svn checkout dir"
	fi
}
maint_pkg_create