forked from openSUSE/snapper
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile.am
97 lines (81 loc) · 3.49 KB
/
Makefile.am
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
84
85
86
87
88
89
90
91
92
93
94
95
96
#
# Makefile.am for snapper
#
SUBDIRS = snapper examples dbus server client scripts pam data doc po \
testsuite testsuite-real testsuite-cmp
AUTOMAKE_OPTIONS = foreign dist-bzip2 no-dist-gzip
doc_DATA = AUTHORS COPYING
EXTRA_DIST = $(doc_DATA) VERSION LIBVERSION
snapper-$(VERSION).tar.bz2: dist-bzip2
DEBIAN_FLAVOURS = \
Debian_7.0 \
Debian_8.0 \
Debian_9.0
UBUNTU_FLAVOURS = \
xUbuntu_14.04 \
xUbuntu_14.10 \
xUbuntu_15.04 \
xUbuntu_15.10 \
xUbuntu_16.04 \
xUbuntu_16.10 \
xUbuntu_17.04 \
xUbuntu_17.10 \
xUbuntu_18.04
show-debian:
@echo "Debian flavors: $(DEBIAN_FLAVOURS)"
show-ubuntu:
@echo "Ubuntu flavors: $(UBUNTU_FLAVOURS)"
package-clean:
rm -f package/snapper-*.tar.bz2
rm -f package/debian.*
rm -f package/*.dsc*
# Create all the files necessary for building the package with OBS:
#
# - Clean up the package/ directory
# - create a new tarball (via the depencency)
# - copy the content of the debian/ directory
# - for both Debian and Ubuntu, generate a master .dsc.in from file with the
# "Files:" line for the tarball with its md5sum, file size in bytes, and name
# - copy that .dsc.in master file for each flavor of Debian or Ubuntu to be supported
# - remove the .dsc.in master file and the .dsc.in.in file
# - move the new tarball to the package/ directory
#
# Unfortunately, using variables for the md5sum and the file size didn't work out
# (not even with the GNU make ':=' syntax): They cannot be assigned in the 'actions'
# part of a rule, only outside rules.
#
# The .dsc files are generated from a .dsc.in file for each Debian and Ubuntu,
# which in turn are generated by configure/autoconf from .dsc.in.in files (see
# configure.ac) where @VERSION@ is expanded with the content of the toplevel
# VERSION file.
#
# $< is the first depencency of the rule, i.e. snapper-$(VERSION).tar.gz in this case.
# Build a reproducible tarball:
# - set the file time stamps according to the latest commit
# - sort the files (in a locale independent way, use the NULL separator to
# correctly process also the file names containing a new line)
# Note: tar >= 1.28 supports "--sort=name" option, unfortunately
# Leap 42.3 and SLES12-SP3 contain version 1.27.1
# - use the GNU format (the default POSIX format contains some time stamps)
# - set the owner and group to "root"
# - set the fixed modification time
# shared tar options
EXTRA_TAR_OPTIONS = --format=gnu --owner=root --group=root \
--mtime='$(shell git show -s --format=%ci)' --null --files-from -
# redefine the standard automake "tar" command
am__tar=find "$$tardir" -type f -print0 | LC_ALL=C sort -z | \
tar -c -f - $(EXTRA_TAR_OPTIONS)
package: snapper-$(VERSION).tar.bz2 package-clean
find dists/debian -not -name '*.in' -not -name '.*' -type f -print0 | \
LC_ALL=C sort -z | \
tar -c -f package/debian.tar --transform='s|dists/||' --show-transformed \
$(EXTRA_TAR_OPTIONS)
## use -n option to exclude the original file time stamps to have a reproducible tarball
gzip -n package/debian.tar
cp dists/debian/*.dsc.in package/
echo "$(shell md5sum $< | sed -e 's/\s.*//') $(shell wc -c $<)" >> package/snapper-Debian.dsc.in
echo "$(shell md5sum $< | sed -e 's/\s.*//') $(shell wc -c $<)" >> package/snapper-xUbuntu.dsc.in
for FLAV in $(DEBIAN_FLAVOURS); do cp -v package/snapper-Debian.dsc.in package/snapper-$${FLAV}.dsc; done
for FLAV in $(UBUNTU_FLAVOURS); do cp -v package/snapper-xUbuntu.dsc.in package/snapper-$${FLAV}.dsc; done
rm package/snapper*.dsc.in*
mv snapper-$(VERSION).tar.bz2 package/