Skip to content

Commit d835e03

Browse files
author
Phil
committed
Prep for apt
1 parent a007b21 commit d835e03

6 files changed

Lines changed: 165 additions & 7 deletions

File tree

library/CHANGELOG.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
0.1.2
2-
-----
2+
-----
33

44
* Initial commit to Raspbian apt repository
55

66
0.1.1
7-
-----
7+
-----
88

99
* Increased delay in polling loop to avoid CPU hogging
1010

1111
0.0.2
12-
-----
12+
-----
1313

1414
* Many little bugfixes, for an actually working library
1515

packaging/CHANGELOG

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
cap1xxx (0.1.2) UNRELEASED; urgency=low
1+
cap1xxx (0.1.2) STABLE; urgency=low
22

33
* Initial commit to Raspbian apt repository
44

packaging/debian/changelog

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
cap1xxx (0.1.2) UNRELEASED; urgency=low
1+
cap1xxx (0.1.2) STABLE; urgency=low
22

33
* Initial commit to Raspbian apt repository
44

packaging/debian/control

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ Source: cap1xxx
22
Maintainer: Phil Howard <phil@pimoroni.com>
33
Homepage: https://github.com/pimoroni/cap1xxx
44
Section: python
5-
Priority: optional
5+
Priority: extra
66
Build-Depends: debhelper (>= 9.0.0), dh-python, python-all (>= 2.7), python-setuptools, python3-all (>= 3.4), python3-setuptools
77
Standards-Version: 3.9.6
88
X-Python-Version: >= 2.7

packaging/makeall.sh

Lines changed: 158 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,158 @@
1+
#!/bin/bash
2+
3+
# script control variables
4+
5+
reponame="cap1xxx" # leave this blank for auto-detection
6+
libname="cap1xxx" # leave this blank for auto-detection
7+
8+
debianlog="debian/changelog"
9+
debcontrol="debian/control"
10+
debcopyright="debian/copyright"
11+
debrules="debian/rules"
12+
debreadme="debian/README"
13+
14+
debdir="$(pwd)"
15+
rootdir="$(dirname $debdir)"
16+
libdir="$rootdir/library"
17+
18+
FLAG=false
19+
20+
# function define
21+
22+
success() {
23+
echo "$(tput setaf 2)$1$(tput sgr0)"
24+
}
25+
26+
inform() {
27+
echo "$(tput setaf 6)$1$(tput sgr0)"
28+
}
29+
30+
warning() {
31+
echo "$(tput setaf 1)$1$(tput sgr0)"
32+
}
33+
34+
newline() {
35+
echo ""
36+
}
37+
38+
# assessing repo and library variables
39+
40+
if [ -z "$reponame" ] || [ -z "$libname" ]; then
41+
inform "detecting reponame and libname..."
42+
else
43+
inform "using reponame and libname overrides"
44+
fi
45+
46+
if [ -z "$reponame" ]; then
47+
if [[ $rootdir == *"python"* ]]; then
48+
repodir="$(dirname $rootdir)"
49+
reponame="$(basename $repodir)"
50+
else
51+
repodir="$rootdir"
52+
reponame="$(basename $repodir)"
53+
fi
54+
fi
55+
56+
if [ -z "$libname" ]; then
57+
cd "$libdir"
58+
libname=$(grep "name" setup.py | tr -d "[:space:]" | cut -c 7- | rev | cut -c 3- | rev)
59+
cd "$debdir"
60+
fi
61+
62+
echo "reponame is $reponame and libname is $libname"
63+
64+
# checking generating changelog file
65+
66+
./makelog.sh
67+
version=$(head -n 1 "$libdir/CHANGELOG.txt")
68+
echo "building $libname version $version"
69+
70+
# checking debian/changelog file
71+
72+
inform "checking debian/changelog file..."
73+
74+
if ! head -n 1 $debianlog | grep "$libname" &> /dev/null; then
75+
warning "library not mentioned in header!" && FLAG=true
76+
elif head -n 1 $debianlog | grep "UNRELEASED"; then
77+
warning "this changelog is not going to generate a release!"
78+
warning "change distribution to 'stable'" && FLAG=true
79+
fi
80+
81+
# checking debian/copyright file
82+
83+
inform "checking debian/copyright file..."
84+
85+
if ! grep "^Source" $debcopyright | grep "$libname" $debcopyright &> /dev/null; then
86+
warning "$(grep "^Source" $debcopyright)" && FLAG=true
87+
fi
88+
89+
if ! grep "^Upstream-Name" $debcopyright | grep "$libname" $debcopyright &> /dev/null; then
90+
warning "$(grep "^Upstream-Name" $debcopyright)" && FLAG=true
91+
fi
92+
93+
# checking debian/control file
94+
95+
inform "checking debian/control file..."
96+
97+
if ! grep "^Source" $debcontrol | grep "$libname" $debcontrol &> /dev/null; then
98+
warning "$(grep "^Source" $debcontrol)" && FLAG=true
99+
fi
100+
101+
if ! grep "^Homepage" $debcontrol | grep "$reponame" $debcontrol &> /dev/null; then
102+
warning "$(grep "^Homepage" $debcontrol)" && FLAG=true
103+
fi
104+
105+
if ! grep "^Package: python-$libname" $debcontrol &> /dev/null; then
106+
warning "$(grep "^Package: python-" $debcontrol)" && FLAG=true
107+
fi
108+
109+
if ! grep "^Package: python3-$libname" $debcontrol &> /dev/null; then
110+
warning "$(grep "^Package: python3-" $debcontrol)" && FLAG=true
111+
fi
112+
113+
if ! grep "^Priority: extra" $debcontrol &> /dev/null; then
114+
warning "$(grep "^Priority" $debcontrol)" && FLAG=true
115+
fi
116+
117+
118+
# checking debian/rules file
119+
120+
inform "checking debian/rules file..."
121+
122+
if ! grep "debian/python-$libname" $debrules &> /dev/null; then
123+
warning "$(grep "debian/python-" $debrules)" && FLAG=true
124+
fi
125+
126+
if ! grep "debian/python3-$libname" $debrules &> /dev/null; then
127+
warning "$(grep "debian/python3-" $debrules)" && FLAG=true
128+
fi
129+
130+
# checking debian/README file
131+
132+
inform "checking debian/readme file..."
133+
134+
if ! grep -e "$libname" -e "$reponame" $debreadme &> /dev/null; then
135+
warning "README does not seem to mention product, repo or lib!" && FLAG=true
136+
fi
137+
138+
# summary of checks pre build
139+
140+
if $FLAG; then
141+
warning "Check all of the above and correct!" && exit 1
142+
else
143+
inform "we're good to go... bulding!"
144+
fi
145+
146+
# building deb and final checks
147+
148+
./makedeb.sh
149+
150+
inform "running lintian..."
151+
lintian -v $(find -name "python*$version*.deb")
152+
lintian -v $(find -name "python3*$version*.deb")
153+
154+
inform "checking signatures..."
155+
gpg --verify $(find -name "*$version*changes")
156+
gpg --verify $(find -name "*$version*dsc")
157+
158+
exit 0

packaging/makedeb.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ if [ $setup == "yes" ]; then
1616
cp -R ./debian/ ../library/
1717
fi
1818

19-
cd ../library && debuild
19+
cd ../library && debuild -aarmhf
2020

2121
for file in ${pkgfiles[@]}; do
2222
mv ../*.$file ../packaging

0 commit comments

Comments
 (0)