-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpkg_create.sh
executable file
·121 lines (87 loc) · 2.95 KB
/
pkg_create.sh
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
121
#!/bin/bash
# Create script for a brand new package.
# What's our pwd? This is important, as we're going to run this in
# subdirectories.
pwd
# a "bailout error message" function. Allows me to write error tests like:
# if [ "$?" -ne 0 ]; then bailout "some message"; fi
. ../bailout
# Source the program name and GIT_REPO_DIR
. ./scripts/program_name
function usage () {
cat <<EOF
usage: $0 version distro <branch>
Branch defaults to 'master' if omitted.
Create Debian package of ${PROGRAM_NAME} with given version.
EOF
}
# Set the correct umask
umask 0022
# Avoid any gcc that's installed in /usr/local/bin
export PATH=/usr/bin:/bin
# The package maintainer parameters.
. ../package_maintainer
# Get version, distro, git branch from the command line
if [ -z $2 ]; then
usage
exit 1
fi
GIT_BRANCH_REQUEST="master"
if [ ! -z $3 ]; then
GIT_BRANCH_REQUEST="$3"
fi
VERSION="$1"
NEWDEBVERSION="$1"-1
DISTRO="$2"
# Source the Intention To Package bug number
. ./scripts/itpbug
# The deb source directory will be created with this directory name
DEBNAME=${PROGRAM_NAME}-${VERSION}
# The "orig" tarball will have this name
DEBORIG=${PROGRAM_NAME}_${VERSION}.orig
# Clean up any previously generated tarballs and files
rm -f ${PROGRAM_NAME}_${NEWDEBVERSION}.debian.tar.gz
rm -f ${PROGRAM_NAME}_${NEWDEBVERSION}.dsc
rm -f ${PROGRAM_NAME}_${NEWDEBVERSION}_amd64.changes
rm -f ${PROGRAM_NAME}_${NEWDEBVERSION}_amd64.deb
rm -f ${PROGRAM_NAME}_${NEWDEBVERSION}_amd64.build
rm -f ${PROGRAM_NAME}_${NEWDEBVERSION}_i386.changes
rm -f ${PROGRAM_NAME}_${NEWDEBVERSION}_i386.deb
rm -f ${PROGRAM_NAME}_${NEWDEBVERSION}_i386.build
rm -f ${PROGRAM_NAME}_${NEWDEBVERSION}_source.changes
# Unpack deborig
rm -rf ${DEBNAME}
tar xvf ${DEBORIG}.tar.gz
if [ "$?" -ne 0 ]; then bailout "unpacking deborig"; fi
pushd ${DEBNAME}
# Run dh_make.
dh_make -s
if [ "$?" -ne 0 ]; then bailout "dh_make"; fi
# We should have no upstream bugs to fix, as we ARE the upstream
# maintainers. However, the dquilt stuff would normally go here.
# Remove example files created by dh_make
rm -rf debian/*.ex
rm -rf debian/*.EX
# We don't need a README.Debian file to describe special instructions
# about running this softare on Debian.
rm -f debian/README.Debian
# Create the fresh debian/changelog.
rm -f debian/changelog
debchange --create --package ${PROGRAM_NAME} --closes ${ITPBUG} \
--distribution ${DISTRO} --urgency low --newversion ${NEWDEBVERSION}
if [ "$?" -ne 0 ]; then bailout "debchange"; fi
DEBHELPER_COMPAT_LEVEL=9
echo ${DEBHELPER_COMPAT_LEVEL} > debian/compat
if [ -f ../scripts/debian_docs ]; then
. ../scripts/debian_docs
fi
. ../scripts/debian_control
. ../scripts/debian_lintian_overrides
. ../scripts/debian_copyright
. ../scripts/debian_rules
# The source readme is copied in from a file created by pkg_curatesrc.sh
cp ../debian_README.source debian/README.source
if [ "$?" -ne 0 ]; then bailout "failed to copy in debian_README.source"; fi
popd
echo "build_package..."
. ../build_package