aboutsummaryrefslogtreecommitdiffstats
path: root/english/security/oval/Makefile
blob: 390539142537091743384d163c7f37d06b68aa47 (plain) (blame)
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
# If this makefile is not generic enough to support a translation,
# please contact debian-www.

WMLBASE=../..
CUR_DIR=security/oval
SUBS=

PYTHON=/usr/bin/python

include $(WMLBASE)/Make.lang

XMLFILES=$(shell for release in wheezy jessie stretch buster; do echo oval-definitions-$$release.xml; done)

XMLDESTFILES=$(patsubst %,$(HTMLDIR)/%,$(XMLFILES))

all:: check_empty_files $(XMLFILES)

install:: $(XMLDESTFILES)
# JSON file to download with security tracker information
# This is a phony target, it will download it only if the file does not
# exist or if it is less than 1 hour old. 
#
# Note: This is defined this way to prevent a 'make' build in an empty
# location from downloading the 20MB+ file $(CUR_YEAR)-1997+1 times!
#
DebianSecTracker.json:
	@if ! test -e "$@" || test `find "$@" -mmin +60` ; then \
	 if test -d /etc/ssl/ca-debian; then \
	  wget https://security-tracker.debian.org/tracker/data/json --ca-directory=/etc/ssl/ca-debian -O $@ ;\
	 else \
	  wget https://security-tracker.debian.org/tracker/data/json -O $@; \
	 fi \
	fi

oval-definitions-%.xml: force DebianSecTracker.json
	@[ -e $(PYTHON) ] || { echo "ERROR: Required python binary $(PYTHON) is not available, aborting generation" >&2; exit 1; }
	$(IGNORE)$(PYTHON) generate.py -q -d .. -j DebianSecTracker.json -r $(patsubst oval-definitions-%.xml,%,$@) >$@
# Warn if empty files are generated
# Note: They cannot be removed or the install target will fail later
	@[ -s $@ ] || echo "WARNING: OVAL Definition $@ is empty, please review script and/or DSAs" 

$(XMLDESTFILES): $(HTMLDIR)/%: %
	@test -d $(HTMLDIR) || mkdir -m g+w -p $(HTMLDIR)
	install -m 664 -p $< $(HTMLDIR)

# TODO 'clean' could also remove the python-compiled files generated
# by Python when running the script
clean::
	  -rm -f oval-definitions-*.xml DebianSecTracker.json
	
cleandest::
	  -rm -f $(HTMLDIR)/oval-definitions-*.xml
	
# Remove empty files to force regeneration
check_empty_files:
	@for file in oval-definitions-*.xml; do \
		if [ -e "$$file" -a ! -s "$$file" ] ; then \
			rm $$file ; \
		fi \
	done

force:
.PHONY : check_empty_files force DebianSecTracker.json

© 2014-2024 Faster IT GmbH | imprint | privacy policy