forked from clearlinux/swupd-client
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile.am
385 lines (344 loc) · 12.4 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
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
SUFFIXES= .rst
EXTRA_DIST = COPYING scripts/findstatic.pl swupd.bash
AM_CFLAGS = -fPIC -g -D_FORTIFY_SOURCE=2 -fno-common -std=gnu99 \
-O$(OPTIMIZE) \
-Wall \
-Wextra \
-Wformat-security \
-Wlogical-op \
-Wunreachable-code \
-Wswitch-default \
-Wcast-align \
-Wbad-function-cast \
-Winline \
-Wundef \
-Wnested-externs \
-Wredundant-decls
ACLOCAL_AMFLAGS = -I m4
bin_PROGRAMS = swupd
AM_CPPFLAGS = $(AM_CFLAGS) $(libarchive_CFLAGS)
swupd_SOURCES = \
src/alias.c \
src/alias.h \
src/archives.c \
src/autoupdate.c \
src/binary_loader.c \
src/bundle.c \
src/check_update.c \
src/clean.c \
src/clr_bundle_add.c \
src/clr_bundle_ls.c \
src/clr_bundle_rm.c \
src/curl.c \
src/curl_async.c \
src/delta.c \
src/extra_files.c \
src/filedesc.c \
src/fullfile.c \
src/globals.c \
src/hash.c \
src/hashdump.c \
src/helpers.c \
src/heuristics.c \
src/info.c \
src/lib/hashmap.c \
src/lib/hashmap.h \
src/lib/list.c \
src/lib/list.h \
src/lib/log.c \
src/lib/log.h \
src/lib/macros.h \
src/lib/strings.c \
src/lib/strings.h \
src/lib/sys.c \
src/lib/sys.h \
src/lib/thread_pool.c \
src/lib/thread_pool.h \
src/lock.c \
src/main.c \
src/manifest.c \
src/mirror.c \
src/packs.c \
src/scripts.c \
src/search.c \
src/signature.c \
src/signature.h \
src/staging.c \
src/stats.c \
src/subscriptions.c \
src/swupd.h \
src/swupd_build_opts.h \
src/swupd_build_variant.h \
src/swupd_curl.h \
src/swupd_curl_internal.h \
src/swupd_exit_codes.h \
src/swupd_internal.h \
src/telemetry.c \
src/timelist.c \
src/timelist.h \
src/update.c \
src/verify.c \
src/verifytime.c \
src/version.c \
src/xattrs.c \
src/xattrs.h
swupd_LDADD = \
$(lzma_LIBS) \
$(zlib_LIBS) \
$(bzip2_LIBS) \
$(openssl_LIBS) \
$(curl_LIBS) \
$(bsdiff_LIBS) \
$(libarchive_LIBS) \
$(pthread_LIBS)
verifytime_SOURCES = src/verifytime.h \
src/verifytime.c \
src/verifytime_main.c
verifytime_LDADD =
bin_PROGRAMS += verifytime
EXTRA_DIST += \
data/check-update.service \
data/check-update.timer \
data/swupd-update.service \
data/swupd-update.timer \
data/verifytime.service
DISTCHECK_CONFIGURE_FLAGS = \
--with-systemdsystemunitdir=$$dc_install_base/$(systemdunitdir)
systemdunitdir = @SYSTEMD_UNITDIR@
systemdunit_DATA = \
data/check-update.service \
data/check-update.timer \
data/swupd-update.service \
data/swupd-update.timer \
data/verifytime.service
TEST_EXTENSIONS = .bats .prereq .test
if ENABLE_TESTS
tap_driver = env AM_TAP_AWK='$(AWK)' $(SHELL) \
$(top_srcdir)/tap-driver.sh
BATS_LOG_DRIVER = $(tap_driver)
TESTS = $(dist_check_SCRIPTS) $(UNIT_TESTS)
BATS = \
test/functional/bundleadd/add-alias-basic.bats \
test/functional/bundleadd/add-bad-hash.bats \
test/functional/bundleadd/add-bad-hash-state.bats \
test/functional/bundleadd/add-bad-manifest.bats \
test/functional/bundleadd/add-basics.bats \
test/functional/bundleadd/add-boot-file.bats \
test/functional/bundleadd/add-boot-skip.bats \
test/functional/bundleadd/add-client-certificate.bats \
test/functional/bundleadd/add-directory.bats \
test/functional/bundleadd/add-experimental.bats \
test/functional/bundleadd/add-fall-back-to-fullfile.bats \
test/functional/bundleadd/add-include.bats \
test/functional/bundleadd/add-install-time.bats \
test/functional/bundleadd/add-multiple.bats \
test/functional/bundleadd/add-no-disk-space.bats \
test/functional/bundleadd/add-no-signature.bats \
test/functional/bundleadd/add-skip-scripts.bats \
test/functional/bundleadd/add-uses-fullfile.bats \
test/functional/bundleadd/add-uses-zeropack.bats \
test/functional/bundleadd/add-verify-fix-path.bats \
test/functional/bundlelist/list-client-certificate.bats \
test/functional/bundlelist/list-all.bats \
test/functional/bundlelist/list-deps-flat.bats \
test/functional/bundlelist/list-deps-invalid-bundle.bats \
test/functional/bundlelist/list-deps-nested.bats \
test/functional/bundlelist/list-experimental.bats \
test/functional/bundlelist/list-has-dep-nested.bats \
test/functional/bundlelist/list-has-dep-nested-not-installed.bats \
test/functional/bundlelist/list-has-dep-nested-server.bats \
test/functional/bundlelist/list-installed.bats \
test/functional/bundlelist/list-no-deps.bats \
test/functional/bundlelist/list-no-disk-space.bats \
test/functional/bundlelist/list-none-has-deps.bats \
test/functional/bundleremove/remove-basics.bats \
test/functional/bundleremove/remove-boot-file.bats \
test/functional/bundleremove/remove-client-certificate.bats \
test/functional/bundleremove/remove-include.bats \
test/functional/bundleremove/remove-include-nested.bats \
test/functional/bundleremove/remove-no-disk-space.bats \
test/functional/bundleremove/remove-os-core.bats \
test/functional/bundleremove/remove-parse-args.bats \
test/functional/bundleremove/remove-with-dependency.bats \
test/functional/checkupdate/chk-update-client-certificate.bats \
test/functional/checkupdate/chk-update-new-version.bats \
test/functional/checkupdate/chk-update-no-server-content.bats \
test/functional/checkupdate/chk-update-no-target-content.bats \
test/functional/checkupdate/chk-update-slow-server.bats \
test/functional/checkupdate/chk-update-version-match.bats \
test/functional/hashdump/hashdump-file-hash.bats \
test/functional/mirror/mirror-createdir.bats \
test/functional/mirror/mirror-createdir-negative.bats \
test/functional/search/search-content-check-negative.bats \
test/functional/search/search-content-check-positive.bats \
test/functional/search/search-client-certificate.bats \
test/functional/search/search-experimental.bats \
test/functional/search/search-no-disk-space.bats \
test/functional/update/update-boot-file.bats \
test/functional/update/update-boot-skip.bats \
test/functional/update/update-bundle-removed.bats \
test/functional/update/update-client-certificate.bats \
test/functional/update/update-download.bats \
test/functional/update/update-fail-to-get-mom.bats \
test/functional/update/update-include.bats \
test/functional/update/update-include-old-bundle.bats \
test/functional/update/update-include-old-bundle-with-tracked-file.bats \
test/functional/update/update-minversion.bats \
test/functional/update/update-missing-os-core.bats \
test/functional/update/update-newest-added.bats \
test/functional/update/update-newest-deleted.bats \
test/functional/update/update-newest-ghosted.bats \
test/functional/update/update-non-responsive.bats \
test/functional/update/update-no-disk-space.bats \
test/functional/update/update-older-server-version.bats \
test/functional/update/update-rename.bats \
test/functional/update/update-rename-ghosted.bats \
test/functional/update/update-re-update-bad-os-release.bats \
test/functional/update/update-re-update-required.bats \
test/functional/update/update-skip-scripts.bats \
test/functional/update/update-slow-server.bats \
test/functional/update/update-statedir-bad-hash.bats \
test/functional/update/update-status.bats \
test/functional/update/update-status-no-server-content.bats \
test/functional/update/update-status-no-target-content.bats \
test/functional/update/update-use-full-file.bats \
test/functional/update/update-use-pack.bats \
test/functional/update/update-verify-fix-path-hash-mismatch.bats \
test/functional/update/update-verify-fix-path-missing-dir.bats \
test/functional/update/update-verify-fullfile-hash.bats \
test/functional/update/update-with-mirror.bats \
test/functional/update/update-with-old-mirror.bats \
test/functional/update/update-with-slightly-old-mirror.bats \
test/functional/usability/usa-completion-basic.bats \
test/functional/usability/usa-download-retries.bats \
test/functional/usability/usa-external-modules.bats \
test/functional/verify/verify-add-missing-include.bats \
test/functional/verify/verify-add-missing-include-old.bats \
test/functional/verify/verify-boot-file.bats \
test/functional/verify/verify-boot-file-deleted.bats \
test/functional/verify/verify-boot-skip.bats \
test/functional/verify/verify-bundle.bats \
test/functional/verify/verify-client-certificate.bats \
test/functional/verify/verify-directory-tree-deleted.bats \
test/functional/verify/verify-empty-dir-deleted.bats \
test/functional/verify/verify-fix.bats \
test/functional/verify/verify-fix-unsafe-to-delete.bats \
test/functional/verify/verify-fix-version-mismatch.bats \
test/functional/verify/verify-fix-version-mismatch-override.bats \
test/functional/verify/verify-format-mismatch.bats \
test/functional/verify/verify-format-mismatch-override.bats \
test/functional/verify/verify-ghosted.bats \
test/functional/verify/verify-good.bats \
test/functional/verify/verify-install-bad.bats \
test/functional/verify/verify-install.bats \
test/functional/verify/verify-install-directory.bats \
test/functional/verify/verify-install-latest-directory.bats \
test/functional/verify/verify-install-multiple.bats \
test/functional/verify/verify-install-no-fullfile-fallbacks.bats \
test/functional/verify/verify-install-no-zero-packs.bats \
test/functional/verify/verify-latest-missing.bats \
test/functional/verify/verify-missing-file.bats \
test/functional/verify/verify-no-disk-space.bats \
test/functional/verify/verify-picky.bats \
test/functional/verify/verify-picky-downgrade.bats \
test/functional/verify/verify-picky-ghosted.bats \
test/functional/verify/verify-picky-ghosted-missing.bats \
test/functional/verify/verify-picky-whitelist.bats \
test/functional/verify/verify-skip-scripts.bats
UNIT_TESTS = \
test/unit/test_strings.test
dist_check_SCRIPTS = $(BATS)
# Must be run before all other tests
dist_check_SCRIPTS += test/functional/generate-cert.prereq
parallel_tests = $(BATS:.bats=.log)
$(parallel_tests) : test/functional/generate-cert.log
check_PROGRAMS = $(UNIT_TESTS)
LDADD = $(swupd_LDADD) $(swupd_OBJECTS:src/main.o=)
endif
if ENABLE_MANPAGE
MANPAGES = \
docs/swupd.1 \
docs/swupd-alias.7 \
docs/check-update.service.4 \
docs/check-update.timer.4 \
docs/swupd-update.service.4 \
docs/swupd-update.timer.4 \
docs/update-triggers.target.4
dist_man_MANS = \
$(MANPAGES)
clean-local:
rm -rf $(MANPAGES)
endif
if COVERAGE
AM_CFLAGS += --coverage
coverage: coverage-clean
mkdir -p coverage
lcov --compat-libtool --directory . --capture --output-file coverage/report
genhtml -o coverage/ coverage/report
coverage-clean:
rm -rf coverage
endif
distclean-local:
rm -rf aclocal.m4 ar-lib autom4te.cache config.guess config.h.in config.h.in~ config.sub configure depcomp install-sh ltmain.sh m4 Makefile.in missing compile
install-exec-hook:
perl $(top_srcdir)/scripts/findstatic.pl */*.o | grep -v Checking ||:
compliant:
@git diff --quiet --exit-code src; ret=$$?; \
if [ $$ret -eq 1 ]; then \
echo "Error: can only check code style when src/ are clean."; \
echo "Stash or commit your changes and try again."; \
exit $$ret; \
elif [ $$ret -gt 1 ]; then \
exit $$ret; \
fi; \
clang-format -i -style=file src/*.[ch] src/lib/*.[ch] ; ret=$$?; \
if [ $$ret -ne 0 ]; then \
exit $$ret; \
fi; \
git diff --quiet --exit-code src; ret=$$?; \
if [ $$ret -eq 1 ]; then \
echo "Code style issues found. Run 'git diff' to view issues."; \
fi; \
OUT=$$(git grep if\ \(.*\)$$ -- '*.c'); ret2=$$?; \
if [ $$ret2 -eq 0 ]; then \
echo "Missing brackets in single line if:"; \
echo "$$OUT"; \
elif [ $$ret -eq 0 ]; then \
echo "No code style issues found."; \
exit 0; \
fi; \
exit 1
# Ignore SC2207 because that's the standard way to fill COMPREPLY
# Ignore SC1008 because scripts are using an unsupported shebang
shellcheck:
for i in $$(git diff --name-only origin/master HEAD | \grep -E "\.bats|\.bash"); do \
echo checking "$$i"; \
sed 's/^@.*/func() {/' "$$i" | \
sed 's/^load.*/source test\/functional\/testlib.bash/' | \
shellcheck -s bash -x -e SC1008 /dev/stdin; \
done
shellcheck-all:
shellcheck -e SC2207 swupd.bash
find -name "*.bats" -exec sh -c "\
echo checking {}; \
sed 's/^@.*/func() {/' {} | \
sed 's/^load.*/source test\/functional\/testlib.bash/' | \
shellcheck -s bash -x -e SC1008 /dev/stdin \
" \;
release:
@git rev-parse v$(PACKAGE_VERSION) &> /dev/null; \
if [ "$$?" -eq 0 ]; then \
echo "Error: Release for $(PACKAGE_VERSION) already exists."; \
echo "Bump version in configure.ac before releasing."; \
exit 1; \
fi
@git tag -a -m "$(PACKAGE_NAME) release $(PACKAGE_VERSION)" v$(PACKAGE_VERSION)
@printf "\nNew release $(PACKAGE_VERSION) tagged!\n\n"
man: $(dist_man_MANS)
.rst:
mkdir -p "$$(dirname $@)"
rst2man.py "$<" > "[email protected]" && mv -f "[email protected]" "$@"
if ENABLE_TESTS
install-check:
test/installation/test.bats
endif