Remove ZSTD_ENABLED checks from the Package Kit.

BZstdCompressionAlgorithm already has these #ifdefs and will
return error codes appropriately if built without libzstd,
so we do not need to check again inside the Package Kit.

This should not break the no-zstd build (well, it is broken
somewhat right now anyway, but this will not break it further),
and it simplifies logic somewhat.
This commit is contained in:
Augustin Cavalier
2021-10-26 16:24:22 -04:00
parent a04b2f4c5e
commit 0cf34918bf
4 changed files with 1 additions and 14 deletions
@@ -5,11 +5,9 @@ UseBuildFeatureHeaders zlib ;
UsePrivateKernelHeaders ; UsePrivateKernelHeaders ;
UsePrivateHeaders package shared storage support file_systems ; UsePrivateHeaders package shared storage support file_systems ;
local zstdSources ;
local zstdKernelLib ; local zstdKernelLib ;
if [ FIsBuildFeatureEnabled zstd ] { if [ FIsBuildFeatureEnabled zstd ] {
zstdSources = ZstdCompressionAlgorithm.cpp ;
zstdKernelLib = kernel_libzstd.a ; zstdKernelLib = kernel_libzstd.a ;
UseBuildFeatureHeaders zstd ; UseBuildFeatureHeaders zstd ;
Includes [ FGristFiles $(zstdSources) ] Includes [ FGristFiles $(zstdSources) ]
@@ -112,7 +110,7 @@ local storageKitSources =
local supportKitSources = local supportKitSources =
CompressionAlgorithm.cpp CompressionAlgorithm.cpp
ZlibCompressionAlgorithm.cpp ZlibCompressionAlgorithm.cpp
$(zstdSources) ZstdCompressionAlgorithm.cpp
; ;
KernelAddon packagefs KernelAddon packagefs
-3
View File
@@ -64,9 +64,6 @@ HPKG_SOURCES =
local architectureObject ; local architectureObject ;
for architectureObject in [ MultiArchSubDirSetup ] { for architectureObject in [ MultiArchSubDirSetup ] {
on $(architectureObject) { on $(architectureObject) {
if [ FIsBuildFeatureEnabled zstd ] {
SubDirC++Flags -DZSTD_ENABLED ;
}
SEARCH_SOURCE += [ FDirName $(HAIKU_TOP) src kits package hpkg ] ; SEARCH_SOURCE += [ FDirName $(HAIKU_TOP) src kits package hpkg ] ;
SEARCH_SOURCE += [ FDirName $(HAIKU_TOP) src kits package hpkg v1 ] ; SEARCH_SOURCE += [ FDirName $(HAIKU_TOP) src kits package hpkg v1 ] ;
SEARCH_SOURCE += [ FDirName $(HAIKU_TOP) src kits package manager ] ; SEARCH_SOURCE += [ FDirName $(HAIKU_TOP) src kits package manager ] ;
-4
View File
@@ -20,9 +20,7 @@
#include <DataIO.h> #include <DataIO.h>
#include <ZlibCompressionAlgorithm.h> #include <ZlibCompressionAlgorithm.h>
#ifdef ZSTD_ENABLED
#include <ZstdCompressionAlgorithm.h> #include <ZstdCompressionAlgorithm.h>
#endif
#include <package/hpkg/HPKGDefsPrivate.h> #include <package/hpkg/HPKGDefsPrivate.h>
#include <package/hpkg/PackageFileHeapReader.h> #include <package/hpkg/PackageFileHeapReader.h>
@@ -834,7 +832,6 @@ ReaderImplBase::InitHeapReader(uint32 compression, uint32 chunkSize,
return B_NO_MEMORY; return B_NO_MEMORY;
} }
break; break;
#ifdef ZSTD_ENABLED
case B_HPKG_COMPRESSION_ZSTD: case B_HPKG_COMPRESSION_ZSTD:
decompressionAlgorithm = DecompressionAlgorithmOwner::Create( decompressionAlgorithm = DecompressionAlgorithmOwner::Create(
new(std::nothrow) BZstdCompressionAlgorithm, new(std::nothrow) BZstdCompressionAlgorithm,
@@ -846,7 +843,6 @@ ReaderImplBase::InitHeapReader(uint32 compression, uint32 chunkSize,
return B_NO_MEMORY; return B_NO_MEMORY;
} }
break; break;
#endif
default: default:
fErrorOutput->PrintError("Error: Invalid heap compression\n"); fErrorOutput->PrintError("Error: Invalid heap compression\n");
return B_BAD_DATA; return B_BAD_DATA;
-4
View File
@@ -20,9 +20,7 @@
#include <AutoDeleter.h> #include <AutoDeleter.h>
#include <ZlibCompressionAlgorithm.h> #include <ZlibCompressionAlgorithm.h>
#ifdef ZSTD_ENABLED
#include <ZstdCompressionAlgorithm.h> #include <ZstdCompressionAlgorithm.h>
#endif
#include <package/hpkg/DataReader.h> #include <package/hpkg/DataReader.h>
#include <package/hpkg/ErrorOutput.h> #include <package/hpkg/ErrorOutput.h>
@@ -329,7 +327,6 @@ WriterImplBase::InitHeapReader(size_t headerSize)
throw std::bad_alloc(); throw std::bad_alloc();
} }
break; break;
#ifdef ZSTD_ENABLED
case B_HPKG_COMPRESSION_ZSTD: case B_HPKG_COMPRESSION_ZSTD:
compressionAlgorithm = CompressionAlgorithmOwner::Create( compressionAlgorithm = CompressionAlgorithmOwner::Create(
new(std::nothrow) BZstdCompressionAlgorithm, new(std::nothrow) BZstdCompressionAlgorithm,
@@ -351,7 +348,6 @@ WriterImplBase::InitHeapReader(size_t headerSize)
throw std::bad_alloc(); throw std::bad_alloc();
} }
break; break;
#endif
default: default:
fErrorOutput->PrintError("Error: Invalid heap compression\n"); fErrorOutput->PrintError("Error: Invalid heap compression\n");
return B_BAD_VALUE; return B_BAD_VALUE;