* Add flags parameter to Init() of BPackageReader and friends.
* Introduce flag B_HPKG_READER_DONT_PRINT_VERSION_MISMATCH_MESSAGE and
don't print a version mismatch error when given.
* package extract/list: Use the new flag.
* Add new package haiku_loader.hpkg and move haiku_loader there. The
package is built without compression, so that the stage 1 boot loader
has a chance of loading it.
* Adjust the stage 1 boot loader to load the haiku_loader package and
relocate the boot loader code accordingly.
* With a specified buffer size smaller than the attribute size the
function would fail with ERANGE on Linux although it should just read
as much as possible. Now we always read into our temporary data buffer
with the full buffer size.
* Fix return value in case pos is > 0. pos must be subtracted from the
bytes actually read.
* Pull _UnwriteLastPartialChunk() out of Reinit() for reuse.
* _UnwriteLastPartialChunk(): fPendingDataSize wasn't set.
* _PushChunks(): Some simplifications for clarity.
* ChunkBuffer/RemoveDataRanges(): Use data reading and decompression
methods provided by our base class instead of duplicating the
implementation.
* RemoveDataRanges():
- _FlushPendingData() before starting, so we don't ignore the pending
data and _UnwriteLastPartialChunk() when done, so a partial chunk
is read back into the pending data buffer.
- fUncompressedHeapSize wasn't reset before the main processing loop,
thus resulting in an erroneous size later on.
It allows to control the compression level used for package creation
and update. The default (9) is *very* slow, so developers may want to
use a smaller level during the regular development process to keep
turn-around times low.
* Introduce BPackageWriterParameters which comprises all parameters
for package creation, currently flags and compression level. Such an
object can be passed to BPackageWriter::Init() and is passed on to
PackageWriterImpl and WriterImplBase.
* PackageFileHeapWriter: Add compressionLevel property and pass the
value on to ZlibCompressor.
* package add/create: Add options -0 ... -9 to specify the compression
level to be used.
Instead of handling compression for individual file/attribute data we
do now compress the whole heap where they are stored. This
significantly improves compression ratios. We still divide the
uncompressed data into 64 KiB chunks and use a chunk offset array for
the compressed chunks to allow for quick random access without too much
overhead. The tradeoff is a limited possible compression ratio -- i.e.
we won't be as good as tar.gz (though surprisingly with my test
archives we did better than zip).
The other package file sections (package attributes and TOC) are no
longer compressed individually. Their uncompressed data are simply
pushed onto the heap where the usual compression strategy applies. To
simplify things the repository format has been changed in the same
manner although it doesn't otherwise use the heap, since it only stores
meta data.
Due to the data compression having been exposed in public and private
API, this change touches a lot of package kit using code, including
packagefs and the boot loader packagefs support. The latter two haven't
been tested yet. Moreover packagefs needs a new kind of cache so we
avoid re-reading the same heap chunk for two different data items it
contains.
* Add union-like class PackageData which wraps the V1 and V2
BPackageData classes.
* GlobalFactory: Create a data reader depending on the data format
version.
* Package: Add a loader for V1 format and try that, if the other one
fails.
It is no longer public (or even private) API. BPackageDataReaderFactory
returns a BAbstractBufferedDataReader instead. The advantage is that
the latter doesn't have hpkg format specific dependencies.
It doesn't do much in terms of buffering, but defines an interface
buffered readers can implement, namely the additional
ReadDataToOutput() which currently BPackageDataReader specifies.
It uses sub-namespace BPackage::BHPKG::V1. Unlike the one for the
current format version, the V1 version of BPackageInfoContentHandler
lives in BHPKG(::V1) sub-namespace and is private.
* Use enums/constants/functions instead of preprocessor macros.
* Missing include in PackageInfoAttributeValue.h.
* PackageReaderImpl::Init(): Check version before header size and
return B_MISMATCHED_VALUES instead of B_BAD_DATA, if the version
doesn't match. This allows callers to determine the condition and
try a reader for a different version. A more flexible interface for
that case would be nice, but since we want to support the old package
version only temporarily, the current solution should be good enough.
Consider ':' a potential path delimiter and try all combinations of
chopped off prefixes and suffixes. This makes detection in the output
of a multi-file grep work even if the found line starts with a path
character or is a path. A path in the typical colon delimited search
paths (e.g. PATH) is detected as well.
* We were trying relative paths as is, which means checking them with
Terminal's current working directory. Now we use the CWD of the active
process.
* In case the path is relative, add a context menu item "Copy absolute
path".
A similar problem to that described in my previous commit afflicted the
step out case as well. We now store the current IP when issuing a step
out, and use that as the function address once execution returns.
When using step over to step out of a function, we need to use the
address range of the step statement to determine the function which
returned said value, not the current IP, as that has already exited the
function and will consequently be that of the caller, leading to such
returns being attributed to the wrong function, and consequently also
the wrong type.