File: prepare-builddir

package info (click to toggle)
doc-linux-nonfree 2006.09-1
  • links: PTS
  • area: non-free
  • in suites: etch, etch-m68k
  • size: 3,412 kB
  • ctags: 15
  • sloc: perl: 390; makefile: 151; sh: 122
file content (120 lines) | stat: -rw-r--r-- 3,360 bytes parent folder | download | duplicates (4)
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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
#!/bin/sh
# 2003 by Frank Lichtenheld

# Usage: debian/prepare-builddir [nonfree]
# Prepares a clean build directory for the doc-linux{-nonfree}
# package. It assumes that you are in checked out copy of the
# svn repository (in trunk/doc-linux) and have already downloaded
# new tarballs and updated the changelog files for the new version

# it assumes the commands `svn' and `fakeroot' are available

set -e

echo -n check if we\'re in the right directory...
if [ -f debian/rules ]; then
    echo done
else
    echo no!
    echo ERROR: There is no debian/rules file in this directory.
    echo This can not to be right.
    exit 1
fi

echo -n "determine package name(s)..."
if test "$1" = "nonfree"; then
    packages="doc-linux doc-linux-nonfree"
else
    packages=doc-linux
fi
echo $packages

echo -n updating svn working directory...
svn update --quiet
echo done

echo -n clean up work directory...
fakeroot debian/rules -s clean
echo done

# we assume that the versions are the same for free and nonfree
echo -n "copy control files (1st time)..."
debian/make-links doc-linux
echo done

echo -n reading upstream versions...
upstreamversion=`dpkg-parsechangelog | grep ^Version: | perl -pe "s/^Version: //; s/-[^-]+$//;"`
tarballversion=`ls -1 --color=never HOWTO/Linux-HOWTOs-*.tar.bz2 | tail -n 1 | perl -pe "s/HOWTO\/Linux-HOWTOs-(\d{8})\.tar\.bz2$/\1/;" `
echo $upstreamversion $tarballversion

for pkg in $packages; do

    echo -n check for existing build directory for $pkg...
    if test -e ../$pkg-$upstreamversion; then
	echo exists!
	echo ERROR: The directory ../$pkg-$upstreamversion already 
	echo exists. Please remove it first, I will not do this automatically.
	exit 1
    else
	echo "doesn't exist, good"
    fi

done

echo -n split tarballs...[text]...
debian/split-package HOWTO/Linux-HOWTOs-$tarballversion.tar.bz2
echo -n [html]...
debian/split-package HOWTO/Linux-html-HOWTOs-$tarballversion.tar.bz2
echo done

for pkg in $packages; do

    echo    \*\*\*
    echo processing $pkg
    echo    \*\*\*

    if test "$pkg" = "doc-linux-nonfree"; then
	free=non-free
    else
	free=free
    fi

    echo -n create build directory...
    mkdir ../$pkg-$upstreamversion
    echo done

    echo -n export debian/ directory...
    svn export debian/ ../$pkg-$upstreamversion/debian
    echo done

    echo -n copy FAQ and HOWTOs...
    cd ../$pkg-$upstreamversion
    mkdir HOWTO
    if test "$free" = "free"; then
	echo -n "FAQ "
	cp -a ../doc-linux/FAQ .
	cp -a ../doc-linux/HOWTO/extra HOWTO/
    fi
# the following two should be just symlinks
    echo -n "HOWTOs "
    cp -a ../doc-linux/HOWTO/Linux-HOWTOs.tar.bz2 HOWTO/
    cp -a ../doc-linux/HOWTO/Linux-html-HOWTOs.tar.bz2 HOWTO/
    cp -a ../doc-linux/HOWTO/$free-Linux-HOWTOs-$tarballversion.tar.bz2 HOWTO/Linux-HOWTOs-$tarballversion.tar.bz2
    cp -a ../doc-linux/HOWTO/$free-Linux-html-HOWTOs-$tarballversion.tar.bz2 HOWTO/Linux-html-HOWTOs-$tarballversion.tar.bz2
    echo done

    echo -n "copy control files (2nd time)..."
    debian/make-links $pkg
    debian/make-copyright $free debian/$pkg.copyright.head > debian/copyright
    echo done

    echo make orig.tar.gz...
    fakeroot debian/rules -s orig
    echo make orig.tar.gz...done

    cd ../doc-linux
    echo    \*\*\* 
    echo directory ../$pkg-$upstreamversion is now ready for building
    echo    \*\*\*

done