History log of /haiku/headers/private/package/hpkg/PackageWriterImpl.h
Revision Date Author Comments
# e1e6c124 13-Jul-2014 Ingo Weinhold <ingo_weinhold@gmx.de>

BPackageWriter::Recompress(): Change param to BPositionIO*

Besides that this is a nicer interface, it allows us to get a the HPKG
header as a side effect of initializing the reader, thus preventing
seeking backward in the file. This makes "package recompress - <file>"
work.


# 44c47711 12-Jul-2014 Ingo Weinhold <ingo_weinhold@gmx.de>

BPackageWriter: Add BPositionIO support


# cdfeba5a 08-Jul-2014 Ingo Weinhold <ingo_weinhold@gmx.de>

BPackageWriter: Add Recompress()

Allows rewriting an existing package file with a different compression.


# 0a62e019 30-Jun-2014 Ingo Weinhold <ingo_weinhold@gmx.de>

PackageWriterImpl: Remove superfluous method


# 796343ed 18-May-2013 Ingo Weinhold <ingo_weinhold@gmx.de>

Allow specifying the compression level for package creation

* 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.


# 1f633814 17-May-2013 Ingo Weinhold <ingo_weinhold@gmx.de>

hpkg format: compress the whole heap

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.


# 6ae0ecd4 11-Jul-2011 Ingo Weinhold <ingo_weinhold@gmx.de>

Add a package info "install-path" attribute

The attribute is intended for simplifying package building. The
package's install path will be used for the package's .self package
symlink, allowing installation to a temporary directory when building
the package.


# 7efa133c 11-Jul-2011 Ingo Weinhold <ingo_weinhold@gmx.de>

BPackageWriter: Add SetCheckLicenses()

The default is still "true", but now it is possible to disable the
license check.


# 8ffba2a6 02-Jul-2011 Ingo Weinhold <ingo_weinhold@gmx.de>

Write uncompressed package file TOC, if necessary


# 00bc8e9c 02-Jul-2011 Ingo Weinhold <ingo_weinhold@gmx.de>

Add support for adding/updating package entries

Add flags parameter to BPackageWriter::Init() (and the private
implementation classes) to indicate that an existing package file shall
be updated instead of created. Currently that always happens in-place.


# de9e64b2 02-Jul-2011 Ingo Weinhold <ingo_weinhold@gmx.de>

Write uncompressed package attributes if necessary

When compression doesn't save space, using it nonetheless results in a
file that the reader complains about. So we fall back to writing an
uncompressed package attributes section in such a case.

The same still needs to be done for the TOC section.


# 0f9a98a4 30-Jun-2011 Ingo Weinhold <ingo_weinhold@gmx.de>

Add optional FD parameter to AddEntry()

If a FD is specified, instead of using the file with the given the FD is
used. Allows for adding entries without first copying them into the
directory structure.


# f19957b8 11-Jul-2011 Ingo Weinhold <ingo_weinhold@gmx.de>

Add a package info "install-path" attribute

The attribute is intended for simplifying package building. The
package's install path will be used for the package's .self package
symlink, allowing installation to a temporary directory when building
the package.


# d7227dfa 11-Jul-2011 Ingo Weinhold <ingo_weinhold@gmx.de>

BPackageWriter: Add SetCheckLicenses()

The default is still "true", but now it is possible to disable the
license check.


# 6f785748 02-Jul-2011 Ingo Weinhold <ingo_weinhold@gmx.de>

Write uncompressed package file TOC, if necessary


# 327b38d6 02-Jul-2011 Ingo Weinhold <ingo_weinhold@gmx.de>

Add support for adding/updating package entries

Add flags parameter to BPackageWriter::Init() (and the private
implementation classes) to indicate that an existing package file shall
be updated instead of created. Currently that always happens in-place.


# 7b6bcdb1 02-Jul-2011 Ingo Weinhold <ingo_weinhold@gmx.de>

Write uncompressed package attributes if necessary

When compression doesn't save space, using it nonetheless results in a
file that the reader complains about. So we fall back to writing an
uncompressed package attributes section in such a case.

The same still needs to be done for the TOC section.


# 4512e8d5 30-Jun-2011 Ingo Weinhold <ingo_weinhold@gmx.de>

Add optional FD parameter to AddEntry()

If a FD is specified, instead of using the file with the given the FD is
used. Allows for adding entries without first copying them into the
directory structure.


# 33bc4425 12-Feb-2011 Oliver Tappe <zooey@hirschkaefer.de>

Largish adjustments to PackagerReaderImpl and package attribute
handling:
* package attributes are now compatible with the low level attribute
handling of other HPKG attributes (such that 'package dump' now shows
package attributes, too)
* dropped type names from hpkg format, the attributes were identified
by IDs already and this simplifies the code considerably. Type names
are now handled in BLowLevelPackageHandler only.
* instead of rolling their own mechanism, high-level package attributes
handling is now implemented via a corresonding set of
AttributeHandler-subclasses
* adjusted package writer to only write package attributes that are
needed (empty ones are left out)


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@40466 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 91ebce66 10-Feb-2011 Oliver Tappe <zooey@hirschkaefer.de>

Some cleanup, no functional change
* typedef base classes as 'inherited' and use that instead of the
explicit base class name
* remove superfluous scopes in case blocks


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@40420 a95241bf-73f2-0310-859d-f6bbb57e9c96


# d77c6cd2 08-Feb-2011 Oliver Tappe <zooey@hirschkaefer.de>

* implemented checking of licenses, such that it is no longer possible
to create a package that refers to a license that is not a system
license or contained in the package
* added package-info flags (currently only approve_license and
system_package)
* adjusted package-reader/writer and pkgman accordingly

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@40393 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 4ee7d007 08-Feb-2011 Oliver Tappe <zooey@hirschkaefer.de>

Cleanup:
* PackageWriterImpl no longer accesses members of WriterImplBase
directly, but uses getters/setters instead
* package attribute registration has been moved from PackageWriterImpl
to WriterImplBase, as it will be used in the same manner by the
RepositoryWriter


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@40388 a95241bf-73f2-0310-859d-f6bbb57e9c96


# f2022173 07-Feb-2011 Oliver Tappe <zooey@hirschkaefer.de>

Refactoring step towards implementation of RepositoryWriter:
* pulled commonly useful parts out of PackageWriterImpl into
WriterImplBase
* moved CachedStringTable and related methods into a separate class,
StringCache, in order to support having more than one string cache
per package file
* made package attribute section use a string cache, too, as that's
going to be very useful for repositories
* instead of writing package attributes directly, we now collect
corresponding PackageAttributes and write those later
* adjusted package reader accordingly


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@40376 a95241bf-73f2-0310-859d-f6bbb57e9c96


# fd9c0b33 04-Feb-2011 Oliver Tappe <zooey@hirschkaefer.de>

* added support for compressing the package attributes section to
PackageWriterImpl
* added my own copyright

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@40358 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 6f0278cd 04-Feb-2011 Oliver Tappe <zooey@hirschkaefer.de>

Implemented reading of package info attributes from hpkg file
* added kernel-compatible datatypes for reading package info attribute
values (PackageInfoAttributeValue.h) - these will be used at a later
stage by the package-fs to transport those attributes to userland
when asked to do so (by ioctl)
* implemented parsing of package info attributes in PackageReaderImpl
* added support for compressed package attribute section to
PackageReaderImpl
* completed the writing of package info attributes in PackageWriterImpl
and fixed a couple of bugs exposed by parsing
* adjusted 'package list' to show the package info attributes as they
are found


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@40354 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 68dc1eb6 01-Feb-2011 Oliver Tappe <zooey@hirschkaefer.de>

* implemented writing of package attributes to hpkg file

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@40348 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 7fd711ef 31-Jan-2011 Oliver Tappe <zooey@hirschkaefer.de>

* refactored PackageWriter(Impl) to no longer print anything itself,
but publish that info through a BPackageWriterListener
* adjusted 'package create' to print a package summary by default and
more verbose info upon request.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@40332 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 5fb1c6ff 30-Jan-2011 Oliver Tappe <zooey@hirschkaefer.de>

Refactored hpkg implementation to provide some separation between
public and private API (still far from ideal, but a start):
* moved several HPKG-classes into the public namespace BPackageKit::HPKG
* added fImpl-wrappers around PackageReader and PackageWriter to hide
most of the gory details
* adjusted 'package'-binary and packagefs accordingly


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@40320 a95241bf-73f2-0310-859d-f6bbb57e9c96


# e1e6c124809fae466b89b13ef1ecf87f8026d7fb 13-Jul-2014 Ingo Weinhold <ingo_weinhold@gmx.de>

BPackageWriter::Recompress(): Change param to BPositionIO*

Besides that this is a nicer interface, it allows us to get a the HPKG
header as a side effect of initializing the reader, thus preventing
seeking backward in the file. This makes "package recompress - <file>"
work.


# 44c4771163b9166dc042f69cb5373c9de9e37006 12-Jul-2014 Ingo Weinhold <ingo_weinhold@gmx.de>

BPackageWriter: Add BPositionIO support


# cdfeba5a1e49d0993e7ab6853c77392bbc10d3c4 08-Jul-2014 Ingo Weinhold <ingo_weinhold@gmx.de>

BPackageWriter: Add Recompress()

Allows rewriting an existing package file with a different compression.


# 0a62e0190298a7930a1baf27a4d72de077fbb051 30-Jun-2014 Ingo Weinhold <ingo_weinhold@gmx.de>

PackageWriterImpl: Remove superfluous method


# 796343ed73b1707ed97e91e22b72b8ca81bcdbad 18-May-2013 Ingo Weinhold <ingo_weinhold@gmx.de>

Allow specifying the compression level for package creation

* 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.


# 1f633814fa347b0bd822f683af731615df600347 17-May-2013 Ingo Weinhold <ingo_weinhold@gmx.de>

hpkg format: compress the whole heap

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.


# 6ae0ecd49a584abd81f3fa0fb0c0dd5b7a3ddb71 11-Jul-2011 Ingo Weinhold <ingo_weinhold@gmx.de>

Add a package info "install-path" attribute

The attribute is intended for simplifying package building. The
package's install path will be used for the package's .self package
symlink, allowing installation to a temporary directory when building
the package.


# 7efa133cb45708be6f134f3dc60a0426beaeb440 11-Jul-2011 Ingo Weinhold <ingo_weinhold@gmx.de>

BPackageWriter: Add SetCheckLicenses()

The default is still "true", but now it is possible to disable the
license check.


# 8ffba2a6cbd6f0bafeb7380bec6a73ab55e97c78 02-Jul-2011 Ingo Weinhold <ingo_weinhold@gmx.de>

Write uncompressed package file TOC, if necessary


# 00bc8e9cbd92f6a812d75ad75ca91c34beb67e72 02-Jul-2011 Ingo Weinhold <ingo_weinhold@gmx.de>

Add support for adding/updating package entries

Add flags parameter to BPackageWriter::Init() (and the private
implementation classes) to indicate that an existing package file shall
be updated instead of created. Currently that always happens in-place.


# de9e64b235bffc7bc03fa006dca67f9df0178105 02-Jul-2011 Ingo Weinhold <ingo_weinhold@gmx.de>

Write uncompressed package attributes if necessary

When compression doesn't save space, using it nonetheless results in a
file that the reader complains about. So we fall back to writing an
uncompressed package attributes section in such a case.

The same still needs to be done for the TOC section.


# 0f9a98a4194cd773a14affbf7aba5de5a2800b81 30-Jun-2011 Ingo Weinhold <ingo_weinhold@gmx.de>

Add optional FD parameter to AddEntry()

If a FD is specified, instead of using the file with the given the FD is
used. Allows for adding entries without first copying them into the
directory structure.


# f19957b8e5311ffc5b802032e4f24cdda81f9b50 11-Jul-2011 Ingo Weinhold <ingo_weinhold@gmx.de>

Add a package info "install-path" attribute

The attribute is intended for simplifying package building. The
package's install path will be used for the package's .self package
symlink, allowing installation to a temporary directory when building
the package.


# d7227dfa9e644112f7019d94b4611da400c6c884 11-Jul-2011 Ingo Weinhold <ingo_weinhold@gmx.de>

BPackageWriter: Add SetCheckLicenses()

The default is still "true", but now it is possible to disable the
license check.


# 6f785748aa1fef5bb193e17ff243794250004ac6 02-Jul-2011 Ingo Weinhold <ingo_weinhold@gmx.de>

Write uncompressed package file TOC, if necessary


# 327b38d69c8d9a128c64d0535f15b0274b51c51b 02-Jul-2011 Ingo Weinhold <ingo_weinhold@gmx.de>

Add support for adding/updating package entries

Add flags parameter to BPackageWriter::Init() (and the private
implementation classes) to indicate that an existing package file shall
be updated instead of created. Currently that always happens in-place.


# 7b6bcdb146b8ac24ef3569fcb152627f724e156c 02-Jul-2011 Ingo Weinhold <ingo_weinhold@gmx.de>

Write uncompressed package attributes if necessary

When compression doesn't save space, using it nonetheless results in a
file that the reader complains about. So we fall back to writing an
uncompressed package attributes section in such a case.

The same still needs to be done for the TOC section.


# 4512e8d5669716c2d0e41f6f117cb86635482ebc 30-Jun-2011 Ingo Weinhold <ingo_weinhold@gmx.de>

Add optional FD parameter to AddEntry()

If a FD is specified, instead of using the file with the given the FD is
used. Allows for adding entries without first copying them into the
directory structure.


# 33bc4425be0b545ed3d0b7e7a9a873d31e5a0330 12-Feb-2011 Oliver Tappe <zooey@hirschkaefer.de>

Largish adjustments to PackagerReaderImpl and package attribute
handling:
* package attributes are now compatible with the low level attribute
handling of other HPKG attributes (such that 'package dump' now shows
package attributes, too)
* dropped type names from hpkg format, the attributes were identified
by IDs already and this simplifies the code considerably. Type names
are now handled in BLowLevelPackageHandler only.
* instead of rolling their own mechanism, high-level package attributes
handling is now implemented via a corresonding set of
AttributeHandler-subclasses
* adjusted package writer to only write package attributes that are
needed (empty ones are left out)


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@40466 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 91ebce663d5f11e5763851ad131e55d4c020421b 10-Feb-2011 Oliver Tappe <zooey@hirschkaefer.de>

Some cleanup, no functional change
* typedef base classes as 'inherited' and use that instead of the
explicit base class name
* remove superfluous scopes in case blocks


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@40420 a95241bf-73f2-0310-859d-f6bbb57e9c96


# d77c6cd26a5cf3863ba4258a063d7d8645abf1e3 08-Feb-2011 Oliver Tappe <zooey@hirschkaefer.de>

* implemented checking of licenses, such that it is no longer possible
to create a package that refers to a license that is not a system
license or contained in the package
* added package-info flags (currently only approve_license and
system_package)
* adjusted package-reader/writer and pkgman accordingly

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@40393 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 4ee7d007d6aa14cd7d9286e52dbb57580fd8f8f7 08-Feb-2011 Oliver Tappe <zooey@hirschkaefer.de>

Cleanup:
* PackageWriterImpl no longer accesses members of WriterImplBase
directly, but uses getters/setters instead
* package attribute registration has been moved from PackageWriterImpl
to WriterImplBase, as it will be used in the same manner by the
RepositoryWriter


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@40388 a95241bf-73f2-0310-859d-f6bbb57e9c96


# f202217364f40d170b7bf07b60a75457b275b0c1 07-Feb-2011 Oliver Tappe <zooey@hirschkaefer.de>

Refactoring step towards implementation of RepositoryWriter:
* pulled commonly useful parts out of PackageWriterImpl into
WriterImplBase
* moved CachedStringTable and related methods into a separate class,
StringCache, in order to support having more than one string cache
per package file
* made package attribute section use a string cache, too, as that's
going to be very useful for repositories
* instead of writing package attributes directly, we now collect
corresponding PackageAttributes and write those later
* adjusted package reader accordingly


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@40376 a95241bf-73f2-0310-859d-f6bbb57e9c96


# fd9c0b33616cfc25e833baa6e4a51deeee366634 04-Feb-2011 Oliver Tappe <zooey@hirschkaefer.de>

* added support for compressing the package attributes section to
PackageWriterImpl
* added my own copyright

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@40358 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 6f0278cdc9a22a1e22c3ac3f480beffd6bb5fcff 04-Feb-2011 Oliver Tappe <zooey@hirschkaefer.de>

Implemented reading of package info attributes from hpkg file
* added kernel-compatible datatypes for reading package info attribute
values (PackageInfoAttributeValue.h) - these will be used at a later
stage by the package-fs to transport those attributes to userland
when asked to do so (by ioctl)
* implemented parsing of package info attributes in PackageReaderImpl
* added support for compressed package attribute section to
PackageReaderImpl
* completed the writing of package info attributes in PackageWriterImpl
and fixed a couple of bugs exposed by parsing
* adjusted 'package list' to show the package info attributes as they
are found


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@40354 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 68dc1eb6adc2e36ec99677a03e20c42c5cc7c5f6 01-Feb-2011 Oliver Tappe <zooey@hirschkaefer.de>

* implemented writing of package attributes to hpkg file

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@40348 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 7fd711ef9999af8ce8dc6c44509ee154230b8d90 31-Jan-2011 Oliver Tappe <zooey@hirschkaefer.de>

* refactored PackageWriter(Impl) to no longer print anything itself,
but publish that info through a BPackageWriterListener
* adjusted 'package create' to print a package summary by default and
more verbose info upon request.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@40332 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 5fb1c6ff1f55fe4094a761b653041b3a0b9abf1d 30-Jan-2011 Oliver Tappe <zooey@hirschkaefer.de>

Refactored hpkg implementation to provide some separation between
public and private API (still far from ideal, but a start):
* moved several HPKG-classes into the public namespace BPackageKit::HPKG
* added fImpl-wrappers around PackageReader and PackageWriter to hide
most of the gory details
* adjusted 'package'-binary and packagefs accordingly


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@40320 a95241bf-73f2-0310-859d-f6bbb57e9c96