forked from QubesOS/qubes-vmm-xen
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
63 lines (47 loc) · 1.9 KB
/
Makefile
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
VERSION := $(file <version)
#DISTFILES_MIRROR ?= http://ftp.qubes-os.org/distfiles/
all:
@true
UNTRUSTED_SUFF := .UNTRUSTED
# All the URLs we need to fetch. URLS ending in .sig result in fetching the
# signature file _and_ the file it signs for (assumed to be the basename).
URLS := \
https://downloads.xenproject.org/release/xen/$(VERSION)/xen-$(VERSION).tar.gz.sig
ALL_FILES := $(notdir $(URLS:%.sig=%)) $(notdir $(filter %.sig, $(URLS)))
ALL_URLS := $(URLS:%.sig=%) $(filter %.sig, $(URLS))
ifneq ($(DISTFILES_MIRROR),)
ALL_URLS := $(addprefix $(DISTFILES_MIRROR),$(ALL_FILES))
endif
get-sources: $(ALL_FILES)
git submodule update --init --recursive
keyring := vmm-xen-trustedkeys.gpg
keyring-file := $(if $(GNUPGHOME), $(GNUPGHOME)/, $(HOME)/.gnupg/)$(keyring)
keyring-import := gpg -q --no-auto-check-trustdb --no-default-keyring --import
$(keyring-file): $(wildcard *.asc)
@rm -f $(keyring-file) && $(keyring-import) --keyring $(keyring) $^
# get-sources already handle verification and remove the file(s) when it fails.
# Keep verify-sources target present for compatibility with qubes-builder API.
verify-sources:
@true
ifeq ($(FETCH_CMD),)
$(error "You can not run this Makefile without having FETCH_CMD defined")
endif
$(filter %.sig, $(ALL_FILES)): %:
@$(FETCH_CMD) $@ $(filter %$@,$(ALL_URLS))
%: %.sig $(keyring-file)
@$(FETCH_CMD) $@$(UNTRUSTED_SUFF) $(filter %$@,$(ALL_URLS))
@gpgv --keyring vmm-xen-trustedkeys.gpg $< $@$(UNTRUSTED_SUFF) 2>/dev/null || \
{ echo "Wrong signature on $@$(UNTRUSTED_SUFF)!"; exit 1; }
@mv $@$(UNTRUSTED_SUFF) $@
%: %.sha1sum
@$(FETCH_CMD) $@$(UNTRUSTED_SUFF) $(filter %$@,$(ALL_URLS))
@sha1sum --status -c $< <$@$(UNTRUSTED_SUFF) || \
{ echo "Wrong SHA1 checksum on $@$(UNTRUSTED_SUFF)!"; exit 1; }
@mv $@$(UNTRUSTED_SUFF) $@
.PHONY: clean-sources
clean-sources:
rm -f $(ALL_FILES) *$(UNTRUSTED_SUFF)
.PHONY: clean
clean::
rm -rf pkgs
rm -rf debian/changelog.*