Commit Graph

7371 Commits

Author SHA1 Message Date
Ingo Weinhold
10e9f49914 QueryParser: Equation::Match(): Fix generic attribute case
Init size to the buffer size before passing it to
QueryPolicy::NodeGetAttribute(). Since size was 0 by default, we would
only read 0 length data.
2013-06-01 03:58:11 +02:00
Ingo Weinhold
d055934e36 QueryParser: Fix some debug macros 2013-06-01 02:40:08 +02:00
Ingo Weinhold
56b43eca03 BPackageInfoContentHandler: Handle new attributes
Also add respective *Data constructors to BUser, BUserSettingsFileInfo,
and BGlobalSettingsFileInfo.
2013-05-28 02:44:13 +02:00
Ingo Weinhold
a3e070a7ff WriterImplBase: Add _AddStringAttributeList()
... and simplify some code by using it.
2013-05-25 01:12:38 +02:00
Ingo Weinhold
c0ab140961 hpkg format: Add attribute for declaring post install scripts 2013-05-25 01:12:37 +02:00
Ingo Weinhold
0f4e11e75c hpkg format: Add attributes for declaring users and groups 2013-05-25 01:12:37 +02:00
Ingo Weinhold
c82776b2fa BString: Add Split() 2013-05-25 01:12:36 +02:00
Ingo Weinhold
8698ee4521 BStringList: Declare Join() const 2013-05-25 01:12:36 +02:00
Ingo Weinhold
79d5ddb77b ReaderImplBase: Verify that the attribute type matches
... the one expected for the respective attribute. Before it was
possible that e.g. a uint was read and then interpreted as a
const char*, if a string was expected for that attribute.
2013-05-25 01:12:35 +02:00
Ingo Weinhold
a8de2761c7 Move package attribute ID definitions to a separate file
... <package/hpkg/PackageAttributes.h>, which also defines other
properties (name and type) for each attribute. It does so via a macro
that the caller can define to generate whatever code is desired.
2013-05-25 01:12:35 +02:00
Ingo Weinhold
fe707a23fc hpkg format: Add attributes for declaring settings files
Global and user settings files can be declared. For global ones an
update policy can be specified. If not specified, the settings file is
not included in the package, but created by the program (or user) later.
If an update type is specified, it defines what to do with the settings
file when updating the package to a newer version.

User settings files are never included in the package; they are always
created by the program or the user. If the package contains a template/
default settings file, it can be declared, but for informative purposes
only.
2013-05-25 01:12:34 +02:00
Ingo Weinhold
5497f08e5e hpkg attribute tags: use 7 bits for attribute ID
ATM the 6 bits suffice, but there isn't that much headroom.
2013-05-25 01:12:34 +02:00
Ingo Weinhold
47039b852e Package/repository file format: Add a minor version header field
* Add minor_version to hpkg_header and hpkg_repo_header and make
  heap_compression uint16.
* If the minor version of a package/repository file is greater than the
  current one unknown attributes are ignored without error. This allows
  introducing new harmless attributes without making the resulting files
  unreadable for older package kit versions.
2013-05-25 01:12:33 +02:00
Ingo Weinhold
5dae1541d6 Add "source" package architecture 2013-05-25 01:12:33 +02:00
Ingo Weinhold
bc306e210f Declare some string constants actually const 2013-05-25 01:12:33 +02:00
Ingo Weinhold
46122852f1 packagefs: Add caching for the package file heap reader
* ReaderImplBase:
  - Add virtual CreateCachedHeapReader() which can create a cached
    reader based on the given heap reader.
  - Rename HeapReader() to RawHeapReader() and add HeapReader() for the
    cached heap reader.
  - Add DetachHeapReader() to allow a clients to remove the heap
    reader(s) after deleting the ReaderImplBase object.
* packagefs:
  - Add CachedDataReader class, which wraps a given
    BAbstractBufferedDataReader and provides caching for it using a
    VMCache. The implementation is based on the IOCache implementation.
  - Use CachedDataReader to wrap the heap reader. For file data that
    means they are cached twice -- in the heap reader cache and in the
    file cache -- but due to the heap reader using a VMCache as well,
    the pages will be recycled automatically anyway. For attribute data
    the cache should be very helpful, since they weren't cached at all
    before.
2013-05-25 01:12:32 +02:00
Ingo Weinhold
d59e0feb59 package: Suppress version mismatch errors where V1 is supported
* 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.
2013-05-25 01:12:31 +02:00
Ingo Weinhold
5261923e87 Add dvprintf() 2013-05-25 01:12:29 +02:00
Ingo Weinhold
521545f7fb Add padding in HPKG/HPKR headers
... so that the different alignment on 32 and 64 bit machines doesn't
change the layout.
2013-05-25 01:12:28 +02:00
Ingo Weinhold
d03ac965a2 ReaderImplBase: Fix gcc 4 build 2013-05-25 01:12:28 +02:00
Ingo Weinhold
b05413ed78 PackageFileHeapWriter: Fix update case
* 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.
2013-05-25 01:12:27 +02:00
Ingo Weinhold
520a7a76c7 PackageFileHeapAccessorBase: small refactoring
* Pull method DecompressChunkData() out of ReadAndDecompressChunkData()
  for potential reuse.
* Also fix/improve some error output strings.
2013-05-25 01:12:27 +02:00
Ingo Weinhold
796343ed73 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.
2013-05-25 01:12:26 +02:00
Ingo Weinhold
18b19ba49d ZlibCompressor: Allow setting the compression level 2013-05-25 01:12:26 +02:00
Ingo Weinhold
1f633814fa 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.
2013-05-25 01:12:25 +02:00
Ingo Weinhold
16e5e5e4ec Some *DataReader improvements
* BFDDataReader: Add SetFD().
* BBufferDataReader: Derive from BAbstractBufferedDataReader.
2013-05-25 01:12:25 +02:00
Ingo Weinhold
0ee1651856 Rename BBlockBufferCache and friends to *Pool*
Also move BBlockBufferPoolNoLock into BHPKG namespace with the other
classes. Not sure why it wasn't there before.
2013-05-25 01:12:25 +02:00
Ingo Weinhold
7adfd76b17 Add "base package" package attribute 2013-05-25 01:12:24 +02:00
Ingo Weinhold
df29539688 Remove resolvable provides type
* Remove BPackageResolvableType and respective property from
  BPackageResolvable.
* Remove package attribute B_HPKG_ATTRIBUTE_ID_PACKAGE_PROVIDES_TYPE.
2013-05-25 01:12:24 +02:00
Ingo Weinhold
2c32402da5 package kit: internalize BPackageDataReader
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.
2013-05-25 01:12:23 +02:00
Ingo Weinhold
175ff8ec77 package kit: Add BAbstractBufferedDataReader
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.
2013-05-25 01:12:23 +02:00
Ingo Weinhold
b5786b0f68 BPackageDataReader: Remove unused Size(), BlockSize() 2013-05-25 01:12:23 +02:00
Ingo Weinhold
dd0b33cb63 BPackageInfo: Support reading both HPKG format versions 2013-05-25 01:12:22 +02:00
Ingo Weinhold
fc0cec5396 Bump HPKG format version 2013-05-25 01:12:22 +02:00
Ingo Weinhold
7575abbca2 Clone read support functionality for HPKG format version 1
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.
2013-05-25 01:12:22 +02:00
Ingo Weinhold
171fd58c4b package kit: some fixes for multi-version support
* 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.
2013-05-25 01:12:21 +02:00
Ingo Weinhold
c663ca2171 Merge branch 'master' into package-management
Conflicts:
	build/jam/HaikuImage
	src/system/kernel/arch/x86/64/arch.S
2013-05-12 00:18:19 +02:00
Ingo Weinhold
1848fdc329 util/khash: Add hash_hash_string_part() 2013-05-11 23:17:55 +02:00
John Scipione
f6d93b80f3 Remove the unused bounds parameter from DrawLabel
Also refactor BMenuField::Draw()
2013-05-09 21:29:13 -04:00
John Scipione
91810d8efd Use better variable names in SetDivider 2013-05-09 21:29:12 -04:00
John Scipione
df5d08a718 Style fixes to BMenuField
Rename resize to resizingMode, whitespace fixes, compare to 0 explicitly
2013-05-09 21:29:12 -04:00
Adrien Destugues
2b67ff2420 Add AddText method to AboutWindow
* Factor out the code to add some data to the about window, with a header and a content under it
 * Make this method public so it's possible to add custom entries in an about box
 * If the method is called with only the header or only the content, the text is added non-bold and non-indented (like the description entry*).
 * Make the header text bold. I'm not sure it looks that good, after all. Thoughts ?
2013-05-09 21:27:43 +02:00
Ingo Weinhold
204dee708a Use libbe_build also on Haiku
This means the build tools will no longer be built against the host
platform's libbe, which avoids compatibility problems -- e.g. an
older Haiku host libbe may not have certain features the build tools
require -- and also makes the build behave more similiar on Haiku and
other platforms. The host libroot dependency still remains and is not
easy to get rid of.

Also remove some bits of BeOS/Dano/Zeta build support.
2013-05-09 18:08:55 +02:00
Ingo Weinhold
baadb25955 Add te MimeInfoUpdater to libbe_build 2013-05-09 03:19:25 +02:00
Ingo Weinhold
5fb3348319 MimeEntryProcessor: Add DoRecursively()
While Do() only process the specified entry, DoRecursively() also
recurses into directories.
2013-05-09 03:18:46 +02:00
Ingo Weinhold
00090d290d boot loader: print max heap usage info before entering kernel 2013-05-09 03:14:35 +02:00
Ingo Weinhold
865ab2816d Pull class MimeInfoUpdater out of UpdateMimeInfoThread
* Pull out base class MimeEntryProcessor out of AppMetaMimeCreator.
* Pull class MimeInfoUpdater out of UpdateMimeInfoThread and derive it
  from MimeEntryProcessor.
* MimeInfoUpdater: Instead of BMimeType::GuessMimeType(), use
  Database::GuessMimeType() directly.
2013-05-09 01:48:36 +02:00
Ingo Weinhold
d0815ca03b Add private MIME DB classes to libbe_build
* This pulls in some more stuff, like libicon and agg which are also
  included in libbe_build, now.
* Update a few libbe_build classes and headers needed to get things
  building.
* This likely breaks the <build>mimeset build on Haiku.
2013-05-08 04:39:56 +02:00
Ingo Weinhold
b6a89f410e Pull class AppMetaMimeCreator out of CreateAppMetaMimeThread
Instead of using a BMimeType to set the MIME type properties, it
operates directly on the Database object, though.
2013-05-08 01:08:16 +02:00
Ingo Weinhold
b94857b322 Refactor MIME DB access
* Add class DatabaseLocation. It contains a list of the MIME DB
  directory paths plus methods to access type files.
* Move all low-level MIME DB access functions from
  database_{support,access} to DatabaseLocation. All code that formerly
  used those now requires a DatabaseLocation object. In BMimeType and in
  the registrar the default object is used, but the low-level classes
  can now be reused with different locations.
* Move get_icon_data() from database_access to database_support and
  delete the former, which is now empty.
2013-05-07 23:15:36 +02:00