|
374
by Mario Limonciello
Move packaging to git based commands. |
1 |
#Custom debian/rules snippet used for building MythTV packages that come from MythTV's github location
|
2 |
||
3 |
#Figure out what we're working with by parsing the project and debian changelog
|
|
4 |
#To make sense of these sed rules that are used:
|
|
5 |
# Sample version string:
|
|
6 |
# Version: 1:0.25.0+master.20101129.a8acde8-0ubuntu1
|
|
|
439
by Mario Limonciello
* debian/mythtv.make: |
7 |
# /^Version/!d -> only version line from dpkg-parsechangelog
|
|
374
by Mario Limonciello
Move packaging to git based commands. |
8 |
# s/.*1:0.// -> kill the epoch and Version bit and 0. leading the version |
9 |
# s/-.*// -> kill everything after and including the - |
|
10 |
# s/+.*// -> kill everything after and including the + |
|
11 |
# s/.*+// -> kill everything before and including the + |
|
12 |
||
|
439
by Mario Limonciello
* debian/mythtv.make: |
13 |
GIT_MAJOR_RELEASE:=$(shell dpkg-parsechangelog | dpkg-parsechangelog | sed '/^Version/!d; s/.*[0-9]:0.//; s/~.*//; s/+.*//' | awk -F. '{print $$1 }') |
14 |
GIT_MINOR_RELEASE:=$(shell dpkg-parsechangelog | dpkg-parsechangelog | sed '/^Version/!d; s/.*[0-9]:0.//; s/~.*//; s/+.*//' | awk -F. '{print $$2 }') |
|
15 |
GIT_TYPE:=$(shell dpkg-parsechangelog | sed '/^Version/!d; s/.*~//; s/.*+//; s/-.*//;' | awk -F. '{print $$1}') |
|
16 |
DATE:=$(shell dpkg-parsechangelog | sed '/^Version/!d; s/.*~//; s/.*+//; s/-.*//;' | awk -F. '{print $$2}') |
|
17 |
GIT_HASH:=$(shell dpkg-parsechangelog | sed '/^Version/!d; s/.*~//; s/.*+//; s/-.*//;' | awk -F. '{print $$3}') |
|
18 |
LAST_GIT_HASH:=$(shell dpkg-parsechangelog --offset 1 --count 1 | sed '/^Version/!d; s/.*~//; s/.*+//; s/-.*//;' | awk -F. '{print $$3}') |
|
19 |
DEBIAN_SUFFIX:=$(shell dpkg-parsechangelog | sed '/^Version/!d; s/.*-//;') |
|
20 |
AUTOBUILD=$(shell dpkg-parsechangelog | sed '/^Version/!d' | grep mythbuntu) |
|
21 |
EPOCH:=$(shell dpkg-parsechangelog | sed '/^Version/!d; s/.* //; s/:.*//;') |
|
|
374
by Mario Limonciello
Move packaging to git based commands. |
22 |
|
23 |
TODAY=$(shell date +%Y%m%d) |
|
24 |
||
25 |
MAIN_GIT_URL=git://github.com/MythTV/mythtv.git |
|
26 |
MYTHWEB_GIT_URL=git://github.com/MythTV/mythweb.git |
|
|
100.1.422
by Mario Limonciello
* Drop mythtv-themes metapackage and childish theme. Should be installed |
27 |
MYTHBUNTU_THEME_GIT_URL=git://github.com/MythTV-Themes/Mythbuntu.git |
|
374
by Mario Limonciello
Move packaging to git based commands. |
28 |
|
29 |
ifeq "$(GIT_TYPE)" "master" |
|
|
418
by Mario Limonciello
* debian/mythtv.make: |
30 |
GIT_BRANCH:=master |
|
419
by Mario Limonciello
Set a GIT_BRANCH_FALLBACK in case GIT_BRANCH only exists on a particular |
31 |
GIT_BRANCH_FALLBACK=master |
|
374
by Mario Limonciello
Move packaging to git based commands. |
32 |
DELIMITTER="~" |
|
100.1.160
by Mario Limonciello
Include a custom snippet for debian/rules mythtv packages in libmyth-dev. |
33 |
else
|
|
418
by Mario Limonciello
* debian/mythtv.make: |
34 |
GIT_BRANCH:=fixes/0.$(GIT_MAJOR_RELEASE) |
|
464
by Mario Limonciello
Add a fallback to master for non-existant fixes branches. |
35 |
GIT_BRANCH_FALLBACK=master |
|
374
by Mario Limonciello
Move packaging to git based commands. |
36 |
DELIMITTER="+" |
|
100.1.160
by Mario Limonciello
Include a custom snippet for debian/rules mythtv packages in libmyth-dev. |
37 |
endif
|
38 |
||
|
374
by Mario Limonciello
Move packaging to git based commands. |
39 |
GIT_RELEASE=0.$(GIT_MAJOR_RELEASE).$(GIT_MINOR_RELEASE) |
40 |
SUFFIX+=$(GIT_TYPE).$(DATE).$(GIT_HASH) |
|
41 |
||
42 |
ABI:=$(shell awk -F= '/^LIBVERSION/ { gsub(/[ \t]+/, ""); print $$2}' mythtv/settings.pro 2>/dev/null || echo 0.$(GIT_MAJOR_RELEASE)) |
|
43 |
||
|
467
by Mario Limonciello
fix get-orig-source rule's broken tarball fetch from archive. |
44 |
TARFILE:=mythtv_$(GIT_RELEASE)$(DELIMITTER)$(SUFFIX).orig.tar.gz |
45 |
||
|
384
by Mario Limonciello
modify get-git-source to better handle being scripted when starting from a blank changelog |
46 |
build-tarball: |
47 |
#build the tarball |
|
|
467
by Mario Limonciello
fix get-orig-source rule's broken tarball fetch from archive. |
48 |
tar czf $(CURDIR)/../$(TARFILE) * --exclude-vcs --exclude .pc --exclude debian |
|
384
by Mario Limonciello
modify get-git-source to better handle being scripted when starting from a blank changelog |
49 |
|
|
374
by Mario Limonciello
Move packaging to git based commands. |
50 |
get-git-source: |
51 |
#checkout mythtv/mythplugins |
|
52 |
if [ -d .git ]; then \ |
|
|
379
by Mario Limonciello
go a git fetch before checkout in case switching branchs |
53 |
git fetch ;\ |
|
419
by Mario Limonciello
Set a GIT_BRANCH_FALLBACK in case GIT_BRANCH only exists on a particular |
54 |
git checkout $(GIT_BRANCH) || git checkout $(GIT_BRANCH_FALLBACK);\ |
|
374
by Mario Limonciello
Move packaging to git based commands. |
55 |
git pull --rebase; \ |
56 |
else \
|
|
57 |
git clone $(MAIN_GIT_URL) tmp ;\ |
|
58 |
mv tmp/.git* tmp/* . ;\ |
|
59 |
rm -rf tmp ;\
|
|
|
419
by Mario Limonciello
Set a GIT_BRANCH_FALLBACK in case GIT_BRANCH only exists on a particular |
60 |
git checkout $(GIT_BRANCH) || git checkout $(GIT_BRANCH_FALLBACK);\
|
|
374
by Mario Limonciello
Move packaging to git based commands. |
61 |
fi
|
62 |
||
63 |
#checkout mythweb
|
|
64 |
if [ -d mythplugins/mythweb/.git ]; then \
|
|
65 |
cd mythplugins/mythweb; \
|
|
|
379
by Mario Limonciello
go a git fetch before checkout in case switching branchs |
66 |
git fetch ;\
|
|
419
by Mario Limonciello
Set a GIT_BRANCH_FALLBACK in case GIT_BRANCH only exists on a particular |
67 |
git checkout $(GIT_BRANCH) || git checkout $(GIT_BRANCH_FALLBACK);\
|
|
374
by Mario Limonciello
Move packaging to git based commands. |
68 |
git pull --rebase ;\
|
69 |
else \
|
|
70 |
mkdir -p mythplugins/mythweb ;\
|
|
71 |
git clone $(MYTHWEB_GIT_URL) tmp ;\
|
|
72 |
mv tmp/.git* tmp/* mythplugins/mythweb ;\
|
|
73 |
rm -rf tmp ;\
|
|
74 |
cd mythplugins/mythweb ;\
|
|
|
419
by Mario Limonciello
Set a GIT_BRANCH_FALLBACK in case GIT_BRANCH only exists on a particular |
75 |
git checkout $(GIT_BRANCH) || git checkout $(GIT_BRANCH_FALLBACK);\
|
|
374
by Mario Limonciello
Move packaging to git based commands. |
76 |
fi
|
77 |
||
|
100.1.422
by Mario Limonciello
* Drop mythtv-themes metapackage and childish theme. Should be installed |
78 |
#checkout mythbuntu theme
|
79 |
if [ -d Mythbuntu/.git ]; then \
|
|
80 |
cd Mythbuntu; \
|
|
|
380
by Mario Limonciello
include myththemes in the checkout |
81 |
git fetch ;\
|
|
419
by Mario Limonciello
Set a GIT_BRANCH_FALLBACK in case GIT_BRANCH only exists on a particular |
82 |
git checkout $(GIT_BRANCH) || git checkout $(GIT_BRANCH_FALLBACK);\
|
|
380
by Mario Limonciello
include myththemes in the checkout |
83 |
git pull --rebase ;\
|
84 |
else \
|
|
|
100.1.422
by Mario Limonciello
* Drop mythtv-themes metapackage and childish theme. Should be installed |
85 |
mkdir -p Mythbuntu ;\
|
86 |
git clone $(MYTHBUNTU_THEME_GIT_URL) tmp ;\
|
|
87 |
mv tmp/.git* tmp/* Mythbuntu ;\
|
|
|
380
by Mario Limonciello
include myththemes in the checkout |
88 |
rm -rf tmp ;\
|
|
100.1.422
by Mario Limonciello
* Drop mythtv-themes metapackage and childish theme. Should be installed |
89 |
cd Mythbuntu ;\
|
|
419
by Mario Limonciello
Set a GIT_BRANCH_FALLBACK in case GIT_BRANCH only exists on a particular |
90 |
git checkout $(GIT_BRANCH) || git checkout $(GIT_BRANCH_FALLBACK);\
|
|
380
by Mario Limonciello
include myththemes in the checkout |
91 |
fi
|
92 |
||
|
405
by Mario Limonciello
While grabbing git source, capture the details of 'git describe' |
93 |
#fixup --version
|
94 |
DESCRIBE=`git describe` ;\
|
|
95 |
echo "BRANCH=\"$(GIT_BRANCH)\"" > debian/DESCRIBE ;\
|
|
96 |
echo "SOURCE_VERSION=\"$$DESCRIBE\"" >> debian/DESCRIBE ;\
|
|
97 |
||
|
388
by Mario Limonciello
make the tarball building only via a separate rule (as necessary) |
98 |
#fixup changelog
|
|
374
by Mario Limonciello
Move packaging to git based commands. |
99 |
#1) Check if the hash in the changelog (GIT_HASH) matches what the tree has
|
100 |
# ->If not, then set the new HASH we are diffing to as the one from the tree
|
|
101 |
# and the old HASH we are diffing from as the one from the changelog
|
|
102 |
# ->If so , then set the current HASH to the one from the tree
|
|
103 |
#2) Check for autobuild.
|
|
104 |
# ->If not, do nothing
|
|
105 |
# ->If so, then query the PPA for a revision number
|
|
106 |
#3) Check for an empty last git hash, and fill if empty
|
|
|
384
by Mario Limonciello
modify get-git-source to better handle being scripted when starting from a blank changelog |
107 |
|
|
374
by Mario Limonciello
Move packaging to git based commands. |
108 |
CURRENT_GIT_HASH=`git log -1 --oneline | awk '{ print $$1 }'` ;\
|
|
384
by Mario Limonciello
modify get-git-source to better handle being scripted when starting from a blank changelog |
109 |
echo "Current hash: $$CURRENT_GIT_HASH" ;\
|
|
374
by Mario Limonciello
Move packaging to git based commands. |
110 |
if [ "$(GIT_HASH)" != "$$CURRENT_GIT_HASH" ]; then \
|
111 |
GIT_HASH=$$CURRENT_GIT_HASH ;\
|
|
112 |
LAST_GIT_HASH=$(GIT_HASH) ;\
|
|
|
399
by Mario Limonciello
in the git building rule, make sure to include the proper phrases |
113 |
if [ -n "$(AUTOBUILD)" ]; then \
|
114 |
LAST_GIT_HASH=`python debian/PPA-published-git-checker.py 0.$(GIT_MAJOR_RELEASE)` ;\
|
|
115 |
AUTOBUILD="Automated Build: " ;\
|
|
116 |
fi ;\
|
|
117 |
dch -b -v $(EPOCH):$(GIT_RELEASE)$(DELIMITTER)$(GIT_TYPE).$(TODAY).$$GIT_HASH-$(DEBIAN_SUFFIX) "$${AUTOBUILD}New upstream checkout ($$GIT_HASH)";\
|
|
|
374
by Mario Limonciello
Move packaging to git based commands. |
118 |
else \
|
119 |
GIT_HASH=$(GIT_HASH) ;\
|
|
120 |
fi ;\
|
|
121 |
[ -n "$$LAST_GIT_HASH" ] || LAST_GIT_HASH=$(LAST_GIT_HASH) ;\
|
|
122 |
if [ -n "$$LAST_GIT_HASH" ] && [ "$$GIT_HASH" != "$$LAST_GIT_HASH" ]; then \
|
|
123 |
echo "Appending upstream changes between $$LAST_GIT_HASH and $$GIT_HASH" ;\
|
|
124 |
dch -a ">>Upstream changes since last upload ($$LAST_GIT_HASH):" ;\
|
|
125 |
if [ -d .git ]; then \
|
|
|
441
by Mario Limonciello
fixup changelog entires to be version rather than Version |
126 |
git log --oneline $$LAST_GIT_HASH..$$GIT_HASH | sed 's,^,[,; s, ,] ,; s,Version,version,' > .gitout ;\
|
|
374
by Mario Limonciello
Move packaging to git based commands. |
127 |
while read line; do \
|
128 |
dch -a "$$line"; \
|
|
129 |
done < .gitout ;\
|
|
130 |
rm -f .gitout ;\
|
|
|
329
by Mario Limonciello
Add a new get-svn-source rule to use with mythbuntu-weekly-build. |
131 |
fi \
|
|
374
by Mario Limonciello
Move packaging to git based commands. |
132 |
fi
|
|
329
by Mario Limonciello
Add a new get-svn-source rule to use with mythbuntu-weekly-build. |
133 |
|
|
100.1.160
by Mario Limonciello
Include a custom snippet for debian/rules mythtv packages in libmyth-dev. |
134 |
get-orig-source:
|
|
374
by Mario Limonciello
Move packaging to git based commands. |
135 |
python debian/LP-get-orig-source.py $(GIT_RELEASE)$(DELIMITTER)$(SUFFIX) $(CURDIR)/../$(TARFILE)
|
|
100.1.160
by Mario Limonciello
Include a custom snippet for debian/rules mythtv packages in libmyth-dev. |
136 |
|
137 |
info:
|
|
|
374
by Mario Limonciello
Move packaging to git based commands. |
138 |
echo "--Upstream Project--\n" \
|
139 |
"ABI: $(ABI)\n" \
|
|
140 |
"--From CURRENT changelog entry in debian--\n" \
|
|
141 |
"Epoch: $(EPOCH)\n" \
|
|
142 |
"Type: $(GIT_TYPE)\n" \
|
|
143 |
"Major Release: $(GIT_MAJOR_RELEASE)\n" \
|
|
144 |
"Minor Release: $(GIT_MINOR_RELEASE)\n" \
|
|
145 |
"Total Release: $(GIT_RELEASE)\n" \
|
|
146 |
"Hash: $(GIT_HASH)\n" \
|
|
147 |
"Date: $(DATE)\n" \
|
|
148 |
"--Calculated Data--\n" \
|
|
149 |
"Branch: $(GIT_BRANCH)\n" \
|
|
150 |
"Suffix: $(SUFFIX)\n" \
|
|
151 |
"Tarfile: $(TARFILE)\n" \
|
|
152 |
"--Other info--\n" \
|
|
153 |
"OLD Hash: $(LAST_GIT_HASH)\n" \
|
|
154 |
"Current branch hash: $(CURRENT_GIT_HASH)\n" \
|
|
155 |
"Current date: $(TODAY)\n" \
|
|
|
100.1.162
by Mario Limonciello
add a new rule to query the newest revision |
156 |
|
|
100.5.10
by Mario Limonciello
merge in the myththemes source package (from fixes branch) |
157 |
update-control-files:
|
|
100.1.422
by Mario Limonciello
* Drop mythtv-themes metapackage and childish theme. Should be installed |
158 |
rm -f debian/control
|
159 |
sed "s/#TYPE#/$(GIT_TYPE)/; s/#ABI#/$(ABI)/" debian/control.in > debian/control
|
|
|
334
by Mario Limonciello
for autobuilds, make sure to always create an ABI file in debian/ |
160 |
cp debian/libmyth.install.in debian/libmyth-$(ABI)-0.install
|
|
389
by Mario Limonciello
If running on a master build, have the update-control-files rule recommends |
161 |
if [ "$(GIT_TYPE)" = "master" ]; then \
|
162 |
sed -i debian/control -e 's/Recommends:\ mythtv-themes.*/Recommends:\ mythtv-themes, mythtv-dbg/' ;\ |
|
163 |
fi
|
|
|
100.5.10
by Mario Limonciello
merge in the myththemes source package (from fixes branch) |
164 |