-
-
Notifications
You must be signed in to change notification settings - Fork 26
/
Makefile-pbuilder.debian
83 lines (73 loc) · 3.24 KB
/
Makefile-pbuilder.debian
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
# This file is included from Makefile.debian if USE_DIST_BUILD_TOOLS is set
PBUILDER_BASEDIR = $(CHROOT_DIR)/pbuilder
dist-prepare-chroot: $(PBUILDER_BASEDIR)/.prepared_pbuilder
${Q}true
# TODO: avoid loading user ~/.pbuilderrc
$(PBUILDER_BASEDIR)/.prepared_pbuilder: $(DEBIAN_PLUGIN_DIR)/pbuilderrc
${Q}mkdir -p $(CHROOT_DIR)
${Q}if [ $$(stat -c %u $(CHROOT_DIR)) -eq 0 ]; then \
sudo mkdir -p $(PBUILDER_BASEDIR); \
sudo chown $$UID $(PBUILDER_BASEDIR); \
else \
mkdir -p $(PBUILDER_BASEDIR); \
fi
@echo "-> Preparing $(DIST) build environment"
$(DEBIAN_PLUGIN_DIR)/update-local-repo.sh $(DIST)
if [ -n "$(USE_QUBES_REPO_VERSION)" ]; then \
gpg --dearmor < $(DEBIAN_PLUGIN_DIR)keys/qubes-debian-r$(USE_QUBES_REPO_VERSION).asc > $(PBUILDER_BASEDIR)/qubes-keyring.gpg; \
fi
if [ -r "$(PBUILDER_BASEDIR)/base.tgz" ]; then \
action=update; \
else \
action=create; \
fi; \
sudo -E pbuilder $$action \
--distribution $(DIST) \
--configfile $(DEBIAN_PLUGIN_DIR)/pbuilderrc \
--othermirror "deb [trusted=yes] file:/tmp/qubes-deb $(DIST) main" || \
{ rm -f "$(PBUILDER_BASEDIR)/base.tgz"; exit 1; }
${Q}touch $(PBUILDER_BASEDIR)/.prepared_pbuilder
dist-prep: release_name = $(shell $(DEBIAN_PARSER) changelog --package-release-name $(ORIG_SRC)/$(DEBIAN_BUILD_DIRS)/changelog)
dist-prep:
${Q}rm -f "$(CHROOT_DIR)/$(DIST_SRC)/../$(release_name)"*
dist-build-dep:
${Q}true
.PHONY: build-source-package
build-source-package: debian-prepare-dist-src
cd $(CHROOT_DIR)/$(DIST_SRC)/$(PACKAGE)/.. && \
dpkg-source -b .
ifneq (,$(DEBIAN_BUILD_DIRS))
dist-package: release_name = $(shell $(DEBIAN_PARSER) changelog --package-release-name $(ORIG_SRC)/$(DEBIAN_BUILD_DIRS)/changelog)
dist-package: build-source-package
endif
dist-package:
ifndef PACKAGE
$(error "PACKAGE need to be set!")
endif
$(DEBIAN_PLUGIN_DIR)/update-local-repo.sh $(DIST)
mkdir -p "$(PBUILDER_BASEDIR)/results"
release_name_full=$$($(DEBIAN_PARSER) changelog --package-release-name-full $(CHROOT_DEBIAN_DIR)/changelog); \
extra_sources="deb [trusted=yes] file:/tmp/qubes-deb $(DIST) main"; \
if [ -n "$(USE_QUBES_REPO_VERSION)" ]; then \
extra_sources="$$extra_sources|deb [arch=amd64] http://deb.qubes-os.org/r$(USE_QUBES_REPO_VERSION)/vm $(DIST) main"; \
if [ "0$(USE_QUBES_REPO_TESTING)" -gt 0 ]; then \
extra_sources="$$extra_sources|deb [arch=amd64] http://deb.qubes-os.org/r$(USE_QUBES_REPO_VERSION)/vm $(DIST)-testing main"; \
fi; \
fi; \
cd $(CHROOT_DIR)/$(DIST_SRC)/$(PACKAGE)/../.. && \
sudo -E pbuilder build \
--override-config \
--distribution $(DIST) \
--configfile $(DEBIAN_PLUGIN_DIR)/pbuilderrc \
--othermirror "$$extra_sources" \
$(CHROOT_DIR)/$(DIST_SRC)/$(PACKAGE)/../../$$release_name_full.dsc
ifneq (,$(DEBIAN_BUILD_DIRS))
dist-copy-out: release_name = $(shell $(DEBIAN_PARSER) changelog --package-release-name $(CHROOT_DEBIAN_DIR)/changelog)
endif
dist-copy-out:
mkdir -p $(BUILDER_REPO_DIR)/deb
mkdir -p $(ORIG_SRC)/$(OUTPUT_DIR)
# ignore separate _source.changes, it's already included in the main binary pkg
rm -f $(PBUILDER_BASEDIR)/results/$(release_name)*_source.changes
dcmd cp -t $(BUILDER_REPO_DIR)/deb $(PBUILDER_BASEDIR)/results/$(release_name)*.changes
dcmd mv -t $(PWD)/$(ORIG_SRC)/$(OUTPUT_DIR) $(PBUILDER_BASEDIR)/results/$(release_name)*.changes