refactor(compression): Unify compression APIs with libarchive backend#13788
Conversation
There was a problem hiding this comment.
Pull request overview
This PR refactors QGroundControl's compression utilities by replacing three separate modules (QGCLZMA, QGCZlib, QGCZip) with a unified QGCCompression API backed by libarchive. The changes introduce automatic format detection, support for multiple compression formats (GZIP, XZ, ZSTD, ZIP, TAR variants), and consolidate the dependency management through CPM.
Key Changes
- Introduced unified
QGCCompressionnamespace with format detection and single API for all compression operations - Added
QGClibarchivewrapper for ZIP archive operations using libarchive instead of Qt's private QZipWriter/QZipReader - Integrated 6 compression libraries (zlib-ng, xz/liblzma, zstd, lz4, bzip2, libarchive) via CPM with proper dependency configuration
Reviewed changes
Copilot reviewed 22 out of 22 changed files in this pull request and generated 12 comments.
Show a summary per file
| File | Description |
|---|---|
src/Utilities/Compression/QGCCompression.h |
New unified compression API header with format detection and operations for single-file and archive compression |
src/Utilities/Compression/QGCCompression.cc |
Implementation of unified compression API with libarchive-based decompression for GZIP, XZ, ZSTD formats |
src/Utilities/Compression/QGClibarchive.h |
Header for libarchive-based ZIP archive operations |
src/Utilities/Compression/QGClibarchive.cc |
Implementation of ZIP creation/extraction with Qt resource support and security checks |
src/Utilities/Compression/CMakeLists.txt |
Build configuration for 6 compression libraries with CPM integration and cross-library compatibility setup |
src/Utilities/Compression/QGCLZMA.{h,cc} |
Removed - replaced by QGCCompression |
src/Utilities/Compression/QGCZlib.{h,cc} |
Removed - replaced by QGCCompression |
src/Utilities/Compression/QGCZip.{h,cc} |
Removed - replaced by QGClibarchive |
src/Vehicle/VehicleSetup/FirmwareUpgradeController.cc |
Updated to use QGCCompression::decompressFile() instead of QGCZlib::inflateGzipFile() |
src/Vehicle/ComponentInformation/ComponentInformationTranslation.cc |
Simplified decompression logic using QGCCompression::decompressIfNeeded() |
src/Vehicle/ComponentInformation/ComponentInformationManager.cc |
Simplified decompression logic using QGCCompression::decompressIfNeeded() |
src/Camera/VehicleCameraControl.cc |
Replaced manual LZMA decompression with QGCCompression::decompressIfNeeded() |
test/Utilities/Compression/QGCCompressionTest.{h,cc} |
New comprehensive test suite with 10 tests for format detection, ZIP operations, and single-file decompression |
test/Utilities/Compression/DecompressionTest.{h,cc} |
Removed - consolidated into QGCCompressionTest |
test/Utilities/Compression/CMakeLists.txt |
Updated to reference new test files |
test/UnitTestList.cc |
Updated test registration from DecompressionTest to QGCCompressionTest |
test/CMakeLists.txt |
Updated test name reference |
| void QGCCompressionTest::cleanup() | ||
| { | ||
| delete _testDataDir; | ||
| _testDataDir = nullptr; | ||
|
|
||
| delete _tempOutputDir; | ||
| _tempOutputDir = nullptr; | ||
|
|
||
| UnitTest::cleanup(); | ||
| } |
There was a problem hiding this comment.
The test creates temporary directories but doesn't verify that cleanup happened correctly. The QTemporaryDir destructor should handle cleanup, but if tests fail midway, it's good practice to verify the directories are cleaned up. Additionally, the test doesn't check that the temporary directories are actually deleted after cleanup() is called.
src/Vehicle/ComponentInformation/ComponentInformationTranslation.cc
Outdated
Show resolved
Hide resolved
dc869a3 to
3f327b5
Compare
3f327b5 to
444b68f
Compare
444b68f to
8bd1dc4
Compare
8bd1dc4 to
bc485bf
Compare
bc485bf to
b7c9f30
Compare
b7c9f30 to
3c837c7
Compare
3c837c7 to
2303cf1
Compare
2303cf1 to
2de2213
Compare
f3b6757 to
7613cc7
Compare
47ab336 to
8052de9
Compare
8eb4057 to
699413c
Compare
…cture Complete refactor of QGC compression system using libarchive as the single backend for all archive operations (ZIP, TAR, GZIP, etc.). Key changes: - Unified QGCCompression API with decompression-only support - QGCCompressionJob for async operations with progress tracking - QGClibarchive backend replacing multiple format-specific handlers - QGCArchiveModel for QML-friendly archive browsing - QGCArchiveWatcher for monitoring archive directories Enhanced file download infrastructure: - QGCFileDownload with progress, retry logic, and range requests - QGCCachedFileDownload with ETag/Last-Modified validation - Concurrent download management - Removed http_parser dependency (inline HTTP status handling) Includes comprehensive test coverage for compression and downloads.
699413c to
05cf552
Compare
Summary
Replace fragmented compression utilities (QGCLZMA, QGCZlib, QGCZip) with a unified
QGCCompressioninterface backed by libarchive.Changes
New Unified API
QGCCompressionnamespace with format detection and unified operationsQGClibarchivefor ZIP archive operations via libarchiveCompression Library Stack (via CPM)
API Simplification
Removed
QGCLZMAmodule (replaced by QGCCompression)QGCZlibmodule (replaced by QGCCompression)QGCZipmodule (replaced by QGClibarchive)Test Plan
QGCCompressionTestpasses (10 tests)