forked from canonical/landscape-client
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile.packaging
More file actions
51 lines (45 loc) · 2.02 KB
/
Makefile.packaging
File metadata and controls
51 lines (45 loc) · 2.02 KB
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
UBUNTU_RELEASE := $(shell lsb_release -cs)
# version in the code is authoritative
# Use := here, not =, it's really important, otherwise UPSTREAM_VERSION
# will be updated behind your back with the current result of that
# command everytime it is mentioned/used.
UPSTREAM_VERSION := $(shell python3 -c "from landscape import UPSTREAM_VERSION; print(UPSTREAM_VERSION)")
.PHONY: tarball
tarball: sdist
cp -f sdist/landscape-client-$(UPSTREAM_VERSION).tar.gz \
../landscape-client_$(UPSTREAM_VERSION).orig.tar.gz
.PHONY: prepchangelog
prepchangelog:
@_=$$(dpkg-query -s libdistro-info-perl 2>&1) ;\
if [ "$$?" -ne 0 ]; then \
echo sudo apt-get install libdistro-info-perl ;\
sudo apt-get install libdistro-info-perl ;\
fi
@if [ "$$DEBEMAIL" = "" ]; then \
echo "ERROR: please set \$$DEBEMAIL (NAME <EMAIL>)" 1>&2 ;\
exit 1 ;\
fi
dch --distribution $(UBUNTU_RELEASE) --release $(UBUNTU_RELEASE)
.PHONY: updateversion
updateversion:
sed -i -e "s/^UPSTREAM_VERSION.*/UPSTREAM_VERSION = \"$(UPSTREAM_VERSION)\"/g" \
landscape/__init__.py
.PHONY: package
package: clean prepchangelog updateversion ## Generate the debian packages (use with DEBUILD_OPTS="-us -uc").
debuild -b $(DEBUILD_OPTS)
.PHONY: sourcepackage
sourcepackage: tarball prepchangelog updateversion
# need to remove sdist here because it doesn't exist in the
# tarball
rm -rf sdist
debuild -S $(DEBUILD_OPTS)
.PHONY: sdist
sdist: clean
mkdir -p sdist/landscape-client-$(UPSTREAM_VERSION)
git ls-files --recurse-submodules | xargs -I {} cp -r --parents {} sdist/landscape-client-$(UPSTREAM_VERSION)
rm -rf sdist/landscape-client-$(UPSTREAM_VERSION)/debian
sed -i -e "s/^UPSTREAM_VERSION.*/UPSTREAM_VERSION = \"$(UPSTREAM_VERSION)\"/g" \
sdist/landscape-client-$(UPSTREAM_VERSION)/landscape/__init__.py
cd sdist && tar cfz landscape-client-$(UPSTREAM_VERSION).tar.gz landscape-client-$(UPSTREAM_VERSION)
cd sdist && md5sum landscape-client-$(UPSTREAM_VERSION).tar.gz > landscape-client-$(UPSTREAM_VERSION).tar.gz.md5
rm -rf sdist/landscape-client-$(UPSTREAM_VERSION)