Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update from upstream #30

Draft
wants to merge 571 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
571 commits
Select commit Hold shift + click to select a range
b81242d
refactor(mkdwarfs): abstract out file creation
mhx Dec 28, 2023
1f8ad8f
test: add test_file_access abstraction
mhx Dec 28, 2023
1ef2b61
refactor: add canonical() to os_access
mhx Dec 28, 2023
85be65e
refactor: rename categorizer_test to tool_main_test
mhx Dec 28, 2023
fea0352
test: test command line tool usage / help
mhx Dec 28, 2023
80dc5b0
test(dwarfs): add cache tidying options to tools test
mhx Dec 28, 2023
17295ff
test: exercise --chmod
mhx Dec 28, 2023
fa60881
fix: allow everything to build/test without FLAC support
mhx Dec 28, 2023
dbdf7e2
refactor: remove unused code
mhx Dec 28, 2023
fe66117
refactor: move locale setup code to util module
mhx Dec 28, 2023
b87db2d
test: add dwarfsextract perfmon test
mhx Dec 28, 2023
abbbadd
fix(util): improve error handling in parse_(size|time)_with_unit
mhx Dec 29, 2023
6d9bb5a
test(util): add tests for parse_(time|size)_with_unit
mhx Dec 29, 2023
ae43f11
test: add terminal tests
mhx Dec 29, 2023
5404e7a
chore(inode): remove unused add_chunk() method
mhx Dec 29, 2023
b8476bc
chore(inode): remove unused files() method
mhx Dec 29, 2023
9753a41
chore(segmenter): remove unused code
mhx Dec 29, 2023
9274f7e
refactor: input stream abstraction and wide char support
mhx Dec 29, 2023
709c6bb
refactor: make os_access and file_access settable in test_iolayer
mhx Dec 29, 2023
84b5b6f
refactor: add current_path() abstraction to os_access
mhx Dec 29, 2023
33ea3bd
test: add tests for --input-list
mhx Dec 29, 2023
14038dc
chore: replace rogue throw in mkdwarfs_main
mhx Dec 30, 2023
064c7c7
refactor: move mode string implementation to file_stat module
mhx Dec 30, 2023
a8646a7
feat: add mode_string() and perm_string() to inode_view
mhx Dec 30, 2023
6a57d62
refactor: introduce mkdwarfs_tester and simplify tests
mhx Dec 30, 2023
eb60ed1
test: add proper --chmod=norm test
mhx Dec 30, 2023
ac3248f
feat: add getenv() abstraction to os_access
mhx Dec 30, 2023
619abd8
chore: add throwing file_access methods for convenience
mhx Dec 30, 2023
46e6fbb
chore: use file_access abstraction in builtin_script
mhx Dec 30, 2023
8a61697
chore(inode_manager): remove unused include
mhx Dec 30, 2023
61db8ce
chore: add open_output() to file_access
mhx Dec 30, 2023
86f0af2
feat(scanner): use file_access abstraction for dumping inodes
mhx Dec 30, 2023
4d1de7d
test: add inode dumping test
mhx Dec 30, 2023
9eb23bd
chore: add throwing close() overload
mhx Dec 30, 2023
6d4153c
chore: add create_random_string() test helper
mhx Dec 30, 2023
22af434
chore: update gtest to v1.14.0
mhx Dec 30, 2023
6ac70d6
fix(file_access): remove unnecessary special casing for windows
mhx Dec 31, 2023
0ac4ba0
test: basic file_access tests
mhx Dec 30, 2023
1e0eeac
test: add dump/info tests
mhx Dec 31, 2023
c104ded
chore(entry): remove unused type_string() method
mhx Dec 31, 2023
bf33cba
test: add --set-time tests
mhx Dec 31, 2023
9e83ebd
chore(util): add time point parser
mhx Jan 1, 2024
d432b4b
feat(mkdwarfs): support time strings for `--set-time`
mhx Jan 1, 2024
7842919
fix(mkdwarfs): don't use SYS_CERR directly + test
mhx Jan 1, 2024
3dbff1e
chore: remove SYS_CERR define
mhx Jan 1, 2024
e5856fc
test: test invalid compression level
mhx Jan 1, 2024
04988e8
test: add tests for block size range
mhx Jan 1, 2024
7fd51fb
test: cannot combine --input-list and --filter
mhx Jan 1, 2024
3e1d69e
chore: support `map_file` without size argument
mhx Jan 1, 2024
e9688b7
test: add test for failing to open input list file
mhx Jan 1, 2024
d2bb917
fix(mkdwarfs): use os_access for mapping input filesystem
mhx Jan 1, 2024
3575bfb
test: add recompression test
mhx Jan 1, 2024
4ab808c
fix: utf8_truncate() handling of zero-width chars + test
mhx Jan 1, 2024
2aa96df
test: more tools tests
mhx Jan 1, 2024
310c8b6
chore: simplify coverage upload
mhx Jan 1, 2024
3eb6b22
chore: include test binaries in coverage analysis
mhx Jan 1, 2024
043b0b1
test: include lzma binary filters in end-to-end tests
mhx Jan 2, 2024
01c6c74
test: add block range tests
mhx Jan 2, 2024
300010f
fix: max number of nilsimsa options is 3, not 4
mhx Jan 2, 2024
d75f78b
test: more mkdwarfs tests
mhx Jan 2, 2024
c1c0cc3
test: improve inode dumping test
mhx Jan 2, 2024
710b321
test: add mkdwarfs --debug-filter tests
mhx Jan 2, 2024
0a0be0c
fix: --set-owner and --set-group did not work with non-zero ids
mhx Jan 2, 2024
01065f9
test: more mkdwarfs option tests
mhx Jan 2, 2024
aad28c6
feat(filesystem_v2): add dump() to string
mhx Jan 3, 2024
accece1
test(mkdwarfs): metadata packing options
mhx Jan 3, 2024
2881a92
fix(dwarfsck): use iolayer for mapping files / writing header
mhx Jan 3, 2024
8e4ecd6
test: add filesystem header tests
mhx Jan 3, 2024
10cbbb3
fix(progress): ensure timely exit in progress dtor
mhx Jan 3, 2024
3c552eb
test(mkdwarfs): add output file tests
mhx Jan 3, 2024
2a9f301
fix: race condition for iol.err after progress thread is started
mhx Jan 3, 2024
4868612
fix: error handling when using compression with metadata requirements
mhx Jan 4, 2024
c7c4672
test: add speedometer test
mhx Jan 4, 2024
70b421c
test: add fragment_category test
mhx Jan 4, 2024
a23d04f
fix: add missing include in integral_value_parser.h
mhx Jan 4, 2024
6267df8
test: add integral_value_parser test
mhx Jan 4, 2024
ccfd97b
test: add error tests
mhx Jan 4, 2024
3d545e9
refactor: narrow scope of scanner worker group
mhx Jan 4, 2024
4abbdf0
chore(mkdwarfs): add file/line logging in case of exceptions
mhx Jan 4, 2024
b2f368b
chore: propagate exceptions in filesystem_writer
mhx Jan 4, 2024
2b7c373
feat(mkdwarfs): check input filesystem before rewriting
mhx Jan 4, 2024
cd9be29
test(mkdwarfs): corrupt input image when rewriting
mhx Jan 4, 2024
205c2f6
test(mkdwarfs): add more metadata requirements tests
mhx Jan 4, 2024
8df9514
test: add lazy_value test
mhx Jan 4, 2024
8a21dc4
test: add very basic progress test
mhx Jan 4, 2024
daf3e2d
refactor: abstract out more terminal operations
mhx Jan 4, 2024
499aee3
chore: update folly/fbthrift
mhx Jan 6, 2024
37ebf51
fix(metadata): correctly handle uid/gid in legacy filesytem images
mhx Jan 5, 2024
979ce8e
refactor(compat_test): add compat suffix to test names
mhx Jan 5, 2024
a65f883
test(compat): legacy images built with --set-owner/--set-group
mhx Jan 5, 2024
31d9d11
feat(metadata): show deprecated entry table for legacy images
mhx Jan 5, 2024
6327c48
chore: add thread sanitizer suppression for future race
mhx Jan 5, 2024
fc0c0ca
feat: log file/line info with error if available
mhx Jan 5, 2024
b5e6398
refactor: add parse_image_offset + test
mhx Jan 5, 2024
f7336ba
refactor: clean up & simplify error handling
mhx Jan 5, 2024
c6ee3c8
refactor(dwarfs): clean up fuse driver implementation
mhx Jan 5, 2024
e7c398d
refactor: extract common code from tool tester classes
mhx Jan 5, 2024
55b0a19
test: add basic dwarfsextract_main tests
mhx Jan 5, 2024
da2a4de
feat(dwarfsck): use special exit code to indicate missing header
mhx Jan 5, 2024
aaf8c91
chore(dwarfsck): use iolayer abstractions for metadata export
mhx Jan 5, 2024
a1ba52d
chore(dwarfsextract): use iolayer abstractions for mapping image
mhx Jan 5, 2024
92e3202
build: factor out repetitive thrift library code
mhx Jan 6, 2024
ba44766
chore(metadata.thrift): fix typo
mhx Jan 6, 2024
774fa24
chore: more checks in compression_metadata_requirements
mhx Jan 6, 2024
db6316a
test: more compression_metadata_requirements tests
mhx Jan 6, 2024
e6dbb1a
test: even more metadata requirements tests
mhx Jan 6, 2024
5f733bd
docs: update change log
mhx Dec 5, 2023
9b643b4
docs: update change log
mhx Dec 28, 2023
b820ce0
docs: update dependency list
mhx Jan 6, 2024
6168411
chore: use fixed-length commit hashes
mhx Jan 7, 2024
9088a53
feat: include latest commit date in tool header
mhx Jan 7, 2024
1c9030e
feat: simpler and more user friendly nilsimsa options
mhx Jan 7, 2024
e00ac88
chore: improve option_map implementation
mhx Jan 7, 2024
5d7b83c
chore: update change log
mhx Jan 7, 2024
e4ffccc
feat(mkdwarfs): show more defaults in command line help
mhx Jan 8, 2024
0604d9d
doc(mkdwarfs): mention stdout in --output-file docs
mhx Jan 8, 2024
2003a21
docs(mkdwarfs): improve categorizer docs
mhx Jan 8, 2024
08a7887
docs(mkdwarfs): rephrase --max-similarity-size from files to fragments
mhx Jan 8, 2024
ae7de24
fix(mkdwarfs): make --max-similarity-size work again + tests
mhx Jan 9, 2024
cc583da
feat(dwarfs): add diagnostics about missing fusermount programs
mhx Jan 9, 2024
2ff1b8e
chore: install custom upx in docker that hopefully has less bugs
mhx Jan 9, 2024
bf1a59c
chore: retry "file" ftp download as it's extremely unreliable
mhx Jan 9, 2024
f85873a
build: use upx -9 for universal binaries
mhx Jan 9, 2024
991b321
chore: update TODO
mhx Jan 9, 2024
1ea730c
build: avoid installation of package pulled in via FetchContent
mhx Jan 9, 2024
e70fc29
chore: bump libfmt version
mhx Jan 9, 2024
4d3ba94
doc: be explicit about --input-list expecting a list of file paths
mhx Jan 9, 2024
bb9810a
build: add debug and reldbg static builds
mhx Jan 10, 2024
d5955f0
chore: try artifact upload in workflow
mhx Jan 10, 2024
a83bea3
feat: check for tool link/copy before --tool
mhx Jan 10, 2024
7389b56
chore: add simple mkdwarfs fuzzer (wip)
mhx Jan 10, 2024
4a0c6df
docs(mkdwarfs): writing to stdout
mhx Jan 11, 2024
46b1e3f
docs: add zpaqfranz comparison
mhx Jan 11, 2024
64d2904
fix(pcmaudio): cast bytes_per_sample to int before logging
mhx Jan 11, 2024
0eceb4d
fix(pcmaudio): work around files with wrong pcm_length due to padding
mhx Jan 11, 2024
0f212f0
refactor(pcmaudio): remove some code duplication between formats
mhx Jan 11, 2024
f8aed78
feat(pcmaudio): add some more audio format checks
mhx Jan 11, 2024
58c7d69
chore(pcmaudio): change WARN -> VERBOSE for issues that can be handled
mhx Jan 11, 2024
e3598ed
fix(pcmaudio): warning was unintentionally logged as TRACE
mhx Jan 11, 2024
ee21373
fix(pcmaudio): improve error logging
mhx Jan 11, 2024
5d2189d
test(pcmaudio): add format error tests
mhx Jan 11, 2024
45498c0
refactor(pcmaudio): use a chunk policy in iff_parser
mhx Jan 12, 2024
61560f7
fix(pcmaudio): correctly handle chunk alignment for AIFF, WAV, WAV64
mhx Jan 12, 2024
7e40b3c
test(block_cache): stress test with different configurations
mhx Jan 12, 2024
7ff5196
chore: only rebuild static release, only copy source tarball once
mhx Jan 12, 2024
dae268b
chore(block_cache): log stats at VERBOSE level rather than INFO
mhx Jan 12, 2024
0156f64
test(block_cache): test set_tidy_config error handling
mhx Jan 12, 2024
e4f1fdf
chore(checksum): remove unused code
mhx Jan 12, 2024
de5ec99
test(checksum): add checksum tests
mhx Jan 12, 2024
2124bbb
refactor(metadata): simplify call to check_consistency()
mhx Jan 12, 2024
077763d
test(metadata): add path and modestring tests
mhx Jan 12, 2024
c205c37
test(mkdwarfs): test for filter recursion detection
mhx Jan 12, 2024
b7cdf93
test(mkdwarfs): add large input list test
mhx Jan 12, 2024
131beea
test(filesystem): add readlink tests
mhx Jan 12, 2024
786e0ba
chore(metadata): remove unused method
mhx Jan 12, 2024
f978531
test(metadata): special file and time resolution tests
mhx Jan 12, 2024
fc65375
refactor: tweak some tests for better performance
mhx Jan 13, 2024
70d6f10
fix(metadata): access() should work according to mode flags
mhx Jan 13, 2024
8649cb9
test(metadata): add opendir/readdir tests
mhx Jan 13, 2024
30f9c77
test: always assert tester.run() success
mhx Jan 13, 2024
cc2a034
test(metadata): add inode_info test
mhx Jan 13, 2024
bc8ff4e
test: more dwarfsextract tests
mhx Jan 13, 2024
73b4680
fix(dwarfsc): there's nothing in errno if ostream is bad() or fail()
mhx Jan 13, 2024
00ef910
test(dwarfsck): more header and image check tests
mhx Jan 13, 2024
5cf79e2
test(mkdwarfs): low memory limit warning
mhx Jan 13, 2024
5dd8715
test(mkdwarfs): more error tests
mhx Jan 13, 2024
f90bec0
test(mkdwarfs): colored logs test
mhx Jan 13, 2024
95c5092
feat(mkdwarfs): exit with code 2 in case of recoverable errors
mhx Jan 13, 2024
2d12cd6
test(mkdwarfs): add test for fancy vs. non-fancy logging
mhx Jan 13, 2024
8ebb06c
test: make random file tree more random
mhx Jan 13, 2024
66533ba
chore: try to make gmock regexes somewhat portable
mhx Jan 13, 2024
7a1427f
chore(inode_reader): report iovec stats as VERBOSE rather than INFO
mhx Jan 14, 2024
27ac296
test: add history tests
mhx Jan 14, 2024
c322708
test: add filesystem read error tests
mhx Jan 14, 2024
3be0715
fix(segmenter): repeating sequence detection was broken + test
mhx Jan 14, 2024
0162aba
chore: silence gcc warnings
mhx Jan 14, 2024
4966013
build: don't try to use mold with gcc at the moment
mhx Jan 14, 2024
2e02131
fix(metadata): exit from find() if we found a non-directory inode
mhx Jan 14, 2024
179cfb8
fix(inode_manager): handle file mapping errors
mhx Jan 14, 2024
0446513
fix: make sure exceptions in worker threads produce an error message
mhx Jan 14, 2024
e045a42
chore(logger): support LOG_FATAL
mhx Jan 14, 2024
3dbe63b
chore: support logging in worker_group
mhx Jan 14, 2024
f3b8dc2
chore: support using real terminal in test_iolayer
mhx Jan 15, 2024
f08dec2
refactor: more flexible random file tree generation for testing
mhx Jan 15, 2024
bc72147
fix(logger): detect and remove \r from log messages
mhx Jan 15, 2024
2d4d8e7
fix: correctly handle delayed file access errors
mhx Jan 15, 2024
96a0ae1
feat(logging): consolidate log option handling, add --log-with-context
mhx Jan 15, 2024
3f56013
chore: update TODO
mhx Jan 15, 2024
6cf799a
test: test log context presence and option
mhx Jan 15, 2024
70d3c82
test: check inode dumps in the presence of read/map errors
mhx Jan 15, 2024
a0acdac
chore: remove unused code
mhx Jan 15, 2024
f95ae41
test(filesystem): find_image_offset tests
mhx Jan 15, 2024
ccddd64
fix(logger): fix context shortening on Windows
mhx Jan 15, 2024
99d6e20
chore: add more asserts and slightly fix reported fragment counts
mhx Jan 16, 2024
91368d0
chore(fs_section): use cache for check_fast(), add check() to bypass
mhx Jan 16, 2024
fd005e0
feat(filesystem): load image even if non-metadata sections are corrupt
mhx Jan 16, 2024
860912e
refactor: get rid of std::endl
mhx Jan 16, 2024
1e6d76d
refactor(dwarfsck): prevent shadowing of local variable
mhx Jan 16, 2024
0771e8a
refactor: get rid of null_block_decompressor
mhx Jan 16, 2024
75a3986
chore: update change log
mhx Jan 16, 2024
0c2a18f
chore: update change log
mhx Jan 16, 2024
04067e1
chore: use upx -9 to make the binary decompress/start faster
mhx Jan 16, 2024
07acf55
fix: windows compiler warning
mhx Jan 16, 2024
6804aa0
refactor(test_helpers): argument name was a bit too specific
mhx Jan 16, 2024
b11725b
fix(mkdwarfs): don't store inodes with inconsistent fragments
mhx Jan 16, 2024
72c9a45
doc: fix man page generation
mhx Jan 16, 2024
51bd06e
fix(mkdwarfs): don't assert on Windows when input path is not found
mhx Jan 16, 2024
6e1e82e
feat: only report basename of file in runtime errors
mhx Jan 17, 2024
480b00f
docs: manpage rendering tweaks
mhx Jan 17, 2024
d9feb70
chore: enable ccache on Windows
mhx Jan 17, 2024
1b70247
chore: update folly/fbthrift
mhx Jan 20, 2024
66f3798
build: use MSVC embedded debug info to enable ccache in debug build
mhx Jan 18, 2024
09749b3
chore: add cmake_minimum_required to version.cmake
mhx Jan 18, 2024
fbe188e
chore: add header to thrift_library.cmake
mhx Jan 18, 2024
3c3de6c
fix: terminal detection was wrong
mhx Jan 19, 2024
6994f96
feat: add support for built-in manual pages
mhx Jan 18, 2024
b9f8e61
chore: clean separation between is_tty() and is_fancy() for terminal
mhx Jan 19, 2024
f5869dd
test: tool --man tests
mhx Jan 19, 2024
0ec3af3
docs: update manual pages
mhx Jan 19, 2024
da608ba
refactor: use class to temporarily disable leak checks
mhx Jan 19, 2024
06e1910
refactor: pass os_access to worker_group and other classes
mhx Jan 19, 2024
a1ab950
refactor: more os_access abstraction, worker group tests
mhx Jan 19, 2024
813de13
chore: don't waste time on unused byproducts in Windows build
mhx Jan 19, 2024
047b9be
refactor(pager): make pager somewhat testable
mhx Jan 19, 2024
45439b5
test: improve test speed and test more options
mhx Jan 19, 2024
6f3ad2a
test: try to improve test speed a bit
mhx Jan 19, 2024
c323b84
test: exercise script and entry interfaces
mhx Jan 19, 2024
7d09cc0
chore: try to distribute CI load a bit better
mhx Jan 20, 2024
242273a
chore: more system includes
mhx Jan 20, 2024
291f541
chore: try to silence some gcc warnings
mhx Jan 20, 2024
5369210
chore: set a default for cache tidy strategy expiry time
mhx Jan 20, 2024
c624181
refactor: ensure FUSE driver options are standard layout
mhx Jan 20, 2024
921e832
chore: add explicit init for logger_options
mhx Jan 20, 2024
4bbd46b
chore: update change log
mhx Jan 20, 2024
0037a7c
fix(win): find the right tool if argv[0] doesn't include extension
mhx Jan 20, 2024
90c8fcb
refactor: always update console output in a single call
mhx Jan 20, 2024
1e319bb
feat(logger): special case logging to cerr, mostly for Windows terminal
mhx Jan 20, 2024
cb737a5
feat: unicode progress mode works on Windows
mhx Jan 20, 2024
4c52178
feat: fancy spinner, plus some refactoring
mhx Jan 20, 2024
0967b9b
chore: support building ARM image in docker makefile
mhx Jan 21, 2024
d7d390d
test: make chmod_transformer_test easier to compile
mhx Jan 21, 2024
f98874e
build: allow optimization level to be set via DWARFS_OPTIMIZE
mhx Jan 21, 2024
e0bcadd
build: try building a gcc-static binary
mhx Jan 21, 2024
340c96f
build: also build static binaries with -O2
mhx Jan 21, 2024
f0c6a58
chore: add benchmarking script
mhx Jan 22, 2024
fd12e8a
chore: update TODO
mhx Jan 22, 2024
87ff678
chore: update changes
mhx Jan 22, 2024
a342ef6
chore: update windows.gif
mhx Jan 22, 2024
55a8b76
chore: update README.md
mhx Jan 22, 2024
c4211ab
chore: prepare for release
mhx Jan 22, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .codecov.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
ignore:
- "fsst/"
10 changes: 8 additions & 2 deletions .docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ RUN apt install -y \
libboost-thread-dev \
libbrotli-dev \
libevent-dev \
libhowardhinnant-date-dev \
libjemalloc-dev \
libdouble-conversion-dev \
libiberty-dev \
Expand All @@ -53,10 +54,15 @@ RUN apt install -y \
libgoogle-glog-dev \
libutfcpp-dev \
libflac++-dev \
bash-completion \
upx
python3-mistletoe \
bash-completion
COPY install-static-libs.sh /usr/local/bin/install-static-libs.sh
RUN bash /usr/local/bin/install-static-libs.sh
ARG ARCH
# upx-4.2.2 is broken for arm64 (https://github.com/upx/upx/issues/758)
RUN wget -O - https://github.com/upx/upx/releases/download/v4.2.1/upx-4.2.1-$(bash -c "echo \${0//v8/}" $ARCH)_linux.tar.xz | tar -xJf - -C /usr/local/bin --strip-components=1 --wildcards "*/upx"
# current ronn version is horribly broken
RUN gem install ronn-ng
# RUN useradd -g users -u 1000 -m mhx
ARG SCRIPT=build-linux.sh
COPY $SCRIPT /usr/local/bin/run.sh
Expand Down
9 changes: 7 additions & 2 deletions .docker/Makefile
Original file line number Diff line number Diff line change
@@ -1,15 +1,20 @@
IMAGE="dwarfs-buildenv"

ROOT_DIR:=$(shell dirname $(realpath $(firstword $(MAKEFILE_LIST))))
NPROC:=$(shell nproc)

build:
docker build -t $(IMAGE) .

build_arm:
docker build -t $(IMAGE) --build-arg ARCH=arm64v8 .

run:
@docker run -it --rm \
--cap-add SYS_ADMIN --device /dev/fuse --privileged \
--mount type=bind,source="$(ROOT_DIR)"/..,target=/workspace,readonly \
--mount type=bind,source="$(ROOT_DIR)"/../@docker-ccache,target=/ccache \
--mount type=bind,source="$(ROOT_DIR)"/../@docker-build,target=/home/mhx/build \
--env CCACHE_DIR=/ccache --env CTEST_PARALLEL_LEVEL=$(nproc) \
--mount type=bind,source="$(ROOT_DIR)"/../@docker-home,target=/home/ubuntu \
--mount type=bind,source="$(ROOT_DIR)"/../@docker-build,target=/home/ubuntu/build \
--env CCACHE_DIR=/ccache --env CTEST_PARALLEL_LEVEL=$(NPROC) \
--entrypoint /bin/bash $(IMAGE)
92 changes: 66 additions & 26 deletions .docker/build-linux.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ export CCACHE_DIR=/ccache

cd "$HOME"

git config --global --add safe.directory /workspace

rm -f dwarfs
ln -s /workspace dwarfs

Expand All @@ -30,12 +32,14 @@ esac
case "-$BUILD_TYPE-" in
*-gcc-*)
export CC=gcc-13 CXX=g++-13
export COMPILER=gcc
;;
*-oldgcc-*)
export CC=gcc-12 CXX=g++-12
;;
*-clang-*)
export CC=clang-17 CXX=clang++-17
export COMPILER=clang
;;
*-oldclang-*)
export CC=clang-16 CXX=clang++-16
Expand All @@ -52,31 +56,42 @@ case "-$BUILD_TYPE-" in
*-release-*)
CMAKE_ARGS="${CMAKE_ARGS} -DCMAKE_BUILD_TYPE=Release"
;;
*-reldbg-*)
CMAKE_ARGS="${CMAKE_ARGS} -DCMAKE_BUILD_TYPE=RelWithDebInfo"
;;
*-asan-*)
CMAKE_ARGS="${CMAKE_ARGS} -DCMAKE_BUILD_TYPE=Debug -DENABLE_ASAN=1"
;;
*-tsan-*)
CMAKE_ARGS="${CMAKE_ARGS} -DCMAKE_BUILD_TYPE=RelWithDebInfo -DENABLE_TSAN=1"
export TSAN_OPTIONS="suppressions=/workspace/tsan.supp"
;;
*-ubsan-*)
CMAKE_ARGS="${CMAKE_ARGS} -DCMAKE_BUILD_TYPE=RelWithDebInfo -DENABLE_UBSAN=1"
;;
*-coverage-*)
CMAKE_ARGS="${CMAKE_ARGS} -DCMAKE_BUILD_TYPE=RelWithDebInfo -DENABLE_COVERAGE=1"
;;
*)
echo "missing build type: $BUILD_TYPE"
exit 1
esac

if [[ "-$BUILD_TYPE-" == *-O2-* ]]; then
CMAKE_ARGS="${CMAKE_ARGS} -DDWARFS_OPTIMIZE=2"
fi

if [[ "-$BUILD_TYPE-" == *-nojemalloc-* ]]; then
CMAKE_ARGS="${CMAKE_ARGS} -DUSE_JEMALLOC=0"
fi

if [[ "-$BUILD_TYPE-" == *-noperfmon-* ]]; then
CMAKE_ARGS="${CMAKE_ARGS} -DENABLE_PERFMON=0"
CMAKE_ARGS="${CMAKE_ARGS} -DENABLE_PERFMON=0 -DWITH_MAN_OPTION=0"
fi

if [[ "-$BUILD_TYPE-" == *-static-* ]]; then
CMAKE_ARGS="${CMAKE_ARGS} -DSTATIC_BUILD_DO_NOT_USE=1"
CMAKE_ARGS="${CMAKE_ARGS} -DSTATIC_BUILD_EXTRA_PREFIX=/opt/static-libs"
CMAKE_ARGS="${CMAKE_ARGS} -DSTATIC_BUILD_EXTRA_PREFIX=/opt/static-libs/$COMPILER"
else
CMAKE_ARGS="${CMAKE_ARGS} -DWITH_BENCHMARKS=1"
fi
Expand All @@ -89,47 +104,72 @@ cmake ../dwarfs/ $CMAKE_ARGS

$BUILD_TOOL

if [[ "-$BUILD_TYPE-" == *-coverage-* ]]; then
export LLVM_PROFILE_FILE="$PWD/profile/%32m.profraw"
fi

ctest --output-on-failure -j$(nproc)

if [[ "-$BUILD_TYPE-" == *-static-* ]]; then
$BUILD_TOOL package_source
if [[ "$BUILD_ARCH" == "amd64" ]]; then
$BUILD_TOOL copy_source_artifacts
fi
if [[ "-$BUILD_TYPE-" == *-coverage-* ]]; then
unset LLVM_PROFILE_FILE
rm -rf /tmp-runner/coverage
mkdir -p /tmp-runner/coverage
llvm-profdata-17 merge -sparse profile/* -o dwarfs.profdata
for binary in mkdwarfs dwarfs dwarfsck dwarfsextract *_test; do
llvm-cov-17 show -instr-profile=dwarfs.profdata $binary >/tmp-runner/coverage/$binary.txt
done
fi

$BUILD_TOOL realclean

if [[ "-$BUILD_TYPE-" == *-static-* ]]; then
cd "$HOME"
if [[ "-$BUILD_TYPE-" == *-release-* ]]; then
# in the clang-release-static case, we also try to build from the source tarball
if [[ "-$BUILD_TYPE-" == *-clang-* ]] && [[ "-$BUILD_TYPE-" != *-O2-* ]]; then
$BUILD_TOOL package_source

if [[ "$BUILD_ARCH" == "amd64" ]]; then
$BUILD_TOOL copy_source_artifacts
fi

$BUILD_TOOL realclean

cd "$HOME"

VERSION=$(git -C /workspace describe --tags --match "v*" --dirty)
VERSION=${VERSION:1}
VERSION=$(git -C /workspace describe --tags --match "v*" --dirty --abbrev=10)
VERSION=${VERSION:1}

rm -rf dwarfs-*
rm -f dwarfs
rm -rf dwarfs-*
rm -f dwarfs

mv "build/dwarfs-${VERSION}.tar.zst" .
rm -rf build
mv "build/dwarfs-${VERSION}.tar.zst" .
rm -rf build

tar xvf "dwarfs-${VERSION}.tar.zst"
ln -s "dwarfs-${VERSION}" dwarfs
tar xvf "dwarfs-${VERSION}.tar.zst"
mv "dwarfs-${VERSION}" dwarfs

mkdir build
cd build
mkdir build
cd build

# shellcheck disable=SC2086
cmake ../dwarfs/ $CMAKE_ARGS
# shellcheck disable=SC2086
cmake ../dwarfs/ $CMAKE_ARGS

$BUILD_TOOL
$BUILD_TOOL

ctest --output-on-failure -j$(nproc)
ctest --output-on-failure -j$(nproc)
fi

$BUILD_TOOL strip
fi

$BUILD_TOOL strip
$BUILD_TOOL package
$BUILD_TOOL universal_upx

$BUILD_TOOL copy_artifacts

$BUILD_TOOL realclean
rm -rf /tmp-runner/artifacts
mkdir -p /tmp-runner/artifacts
cp artifacts.env /tmp-runner
cp dwarfs-universal-* /tmp-runner/artifacts
cp dwarfs-*-Linux*.tar.zst /tmp-runner/artifacts
fi

$BUILD_TOOL realclean
95 changes: 80 additions & 15 deletions .docker/install-static-libs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,86 @@ cd "$HOME"
mkdir pkgs
cd pkgs

wget https://github.com/libarchive/libarchive/releases/download/v3.7.2/libarchive-3.7.2.tar.xz
wget ftp://ftp.astron.com/pub/file/file-5.45.tar.gz

tar xf libarchive-3.7.2.tar.xz
cd libarchive-3.7.2
./configure --prefix=/opt/static-libs --without-iconv --without-xml2 --without-expat
make -j$(nproc)
make install

cd "$HOME/pkgs"
tar xf file-5.45.tar.gz
cd file-5.45
./configure --prefix=/opt/static-libs --enable-static=yes --enable-shared=no
make -j$(nproc)
make install
FILE_VERSION=5.45
FILE_SHA512=12611a59ff766c22a55db4b4a9f80f95a0a2e916a1d8593612c6ead32c247102a8fdc23693c6bf81bda9b604d951a62c0051e91580b1b79e190a3504c0efc20a
LIBARCHIVE_VERSION=3.7.2
FLAC_VERSION=1.4.3
LIBUNWIND_VERSION=1.7.2
# BENCHMARK_VERSION=1.8.2

RETRY=0
while true; do
rm -f file-${FILE_VERSION}.tar.gz
wget ftp://ftp.astron.com/pub/file/file-${FILE_VERSION}.tar.gz
if echo "${FILE_SHA512} file-${FILE_VERSION}.tar.gz" | sha512sum -c; then
break
fi
RETRY=$((RETRY+1))
if [ $RETRY -gt 10 ]; then
echo "Failed to download file-${FILE_VERSION}.tar.gz"
exit 1
fi
done

wget https://github.com/libarchive/libarchive/releases/download/v${LIBARCHIVE_VERSION}/libarchive-${LIBARCHIVE_VERSION}.tar.xz
wget https://github.com/xiph/flac/releases/download/${FLAC_VERSION}/flac-${FLAC_VERSION}.tar.xz
wget https://github.com/libunwind/libunwind/releases/download/v${LIBUNWIND_VERSION}/libunwind-${LIBUNWIND_VERSION}.tar.gz
# wget https://github.com/google/benchmark/archive/refs/tags/v${BENCHMARK_VERSION}.tar.gz

for COMPILER in clang gcc; do
if [[ "$COMPILER" == "clang" ]]; then
export CC=clang-17
export CXX=clang++-17
elif [[ "$COMPILER" == "gcc" ]]; then
export CC=gcc-13
export CXX=g++-13
else
echo "Unknown compiler: $COMPILER"
exit 1
fi

cd "$HOME/pkgs"
mkdir $COMPILER
cd $COMPILER

INSTALL_DIR=/opt/static-libs/$COMPILER

tar xf ../libarchive-${LIBARCHIVE_VERSION}.tar.xz
cd libarchive-${LIBARCHIVE_VERSION}
./configure --prefix="$INSTALL_DIR" --without-iconv --without-xml2 --without-expat
make -j$(nproc)
make install

cd "$HOME/pkgs/$COMPILER"
tar xf ../file-${FILE_VERSION}.tar.gz
cd file-${FILE_VERSION}
./configure --prefix="$INSTALL_DIR" --enable-static=yes --enable-shared=no
make -j$(nproc)
make install

cd "$HOME/pkgs/$COMPILER"
tar xf ../flac-${FLAC_VERSION}.tar.xz
cd flac-${FLAC_VERSION}
./configure --prefix="$INSTALL_DIR" --enable-static=yes --enable-shared=no --disable-doxygen-docs --disable-ogg --disable-programs --disable-examples
make -j$(nproc)
make install

cd "$HOME/pkgs/$COMPILER"
tar xf ../libunwind-${LIBUNWIND_VERSION}.tar.gz
cd libunwind-${LIBUNWIND_VERSION}
./configure --prefix="$INSTALL_DIR"
make -j$(nproc)
make install

# cd "$HOME/pkgs"
# tar xf v${BENCHMARK_VERSION}.tar.gz
# cd benchmark-${BENCHMARK_VERSION}
# mkdir build
# cd build
# cmake .. -DBENCHMARK_DOWNLOAD_DEPENDENCIES=1 -DCMAKE_INSTALL_PREFIX="$INSTALL_DIR"
# make -j$(nproc)
# make install
done

cd "$HOME"
rm -rf pkgs
Loading