Commit Graph

7395 Commits

Author SHA1 Message Date
Ingo Weinhold
30cdb26b5f Add BDriverSettings to libbe_build 2013-07-06 02:11:18 +02:00
Ingo Weinhold
98c6dfa41e Switch build system from optional package to repositories
* Build libsolv and the dependency solver part of the package kit for
  the build platform.
* Add build tool get_package_dependencies. Given a list of package files
  and a list of repository files it determines the additional packages
  that need to be retrieved from the repositories and prints their URLs.
* Add rules to work with external repositories in the build system
  (build/jam/RepositoryRules):
  - PackageRepository declares an external repository with all its
    packages. The URL of the repository file isn't specified. It is
    computed from a given base URL and the SHA256 hash of the list of
    package files.
  - GeneratedRepositoryPackageList generates a file containing the file
    names of all packages in a repository.
  - IsPackageAvailable returns whether a package is available in any
    repository.
  - PackageURL returns the URL for a package.
* Declare the HaikuPorts repository for x86_gcc2
  (build/jam/repositories/HaikuPorts/x86_gcc2).
* Add rule AddHaikuImagePackages to add a package to the image and rule
  IsHaikuImagePackageAdded to determine whether a package has been
  added.
* OptionalPackages: Remove all entries that just downloaded and
  installed an external package. AddHaikuImagePackages can be used
  instead and is used in the remaining entries. Also move the remaining
  optional package dependency declarations from
  OptionalPackageDependencies here.
* ExtractBuildFeatureArchives: Instead of the URL parameter a package
  name must be specified now. This allows to simplify BuildFeatures
  significantly, since there's no dealing with URLs anymore. "if" out
  the entries that aren't supported yet.
* build_haiku_image: For the packages installed in system and common
  resolve their dependencies and download and install them as well.
2013-07-05 10:51:42 +02:00
Ingo Weinhold
e85334022e Repository file format: group attributes of a package
* Introduce new package attribute B_HPKG_ATTRIBUTE_ID_PACKAGE (valid
  only in a repository file) to group the attributes belonging to a
  package.
* BRepositoryContentHandler:
  - No longer derive from BPackageContentHandler.
  - Add hooks HandlePackage() and HandlePackageDone() that bracket the
    attributes for a package. This is more explicit and robust than
    handlers having to guess when one package ended and the next began.
* BRepositoryCache: Make use of BPackageInfoContentHandler. No need to
  duplicate the code for reading a package info from package info
  attributes.
2013-07-04 19:20:14 +02:00
Ingo Weinhold
383cd08d72 BSolverRepository: add SetTo(const BRepositoryCache&) 2013-07-04 19:06:42 +02:00
Ingo Weinhold
c8928835c5 BRepositoryCache: use BStandardErrorOutput 2013-07-04 19:02:10 +02:00
Ingo Weinhold
69f67e6de6 BRepositoryInfo: make sure fInitStatus is always set correctly 2013-07-04 19:00:39 +02:00
Ingo Weinhold
695a1b248a repository writer: fix use of incorrect header size
The header size of the package file header was used, which resulted in
broken repository files.
2013-07-04 16:37:24 +02:00
Ingo Weinhold
b5b9388a28 Add C++ API for driver settings
Copied from the userlandfs utility classes, adjusted coding style, did
some renaming and small interface changes.
2013-06-29 13:42:00 +02:00
Ingo Weinhold
04382d496e BPathMonitor: rewrite
This resolves all issues the test suite uncovered. It should also deal
with hard links correctly, though that hasn't been tested. Still
unsupported are:
* changes due to mounting/unmounting a volume,
* tracking of symlinks in the path components.
2013-06-27 21:57:44 +02:00
Ingo Weinhold
1eda8517f1 BOpenHashTable: Add IsEmpty() 2013-06-27 21:57:43 +02:00
Ingo Weinhold
3e8daeb7bc Add BMessenger::HashValue() 2013-06-27 21:57:42 +02:00
Ingo Weinhold
cb4a05cfdf Missed B_WATCH_FOLDERS_ONLY occurrence 2013-06-27 21:57:42 +02:00
Ingo Weinhold
38afe232de BPathMonitor: pass BMessenger by reference 2013-06-27 21:57:42 +02:00
Ingo Weinhold
7b198d812e B_WATCH_FOLDERS_ONLY -> B_WATCH_DIRECTORIES_ONLY
Stick to the nomenclature generally used in the public API.
2013-06-27 21:57:42 +02:00
Ingo Weinhold
8d572c9264 Add class NotOwningEntryRef
A entry_ref subclass that avoids cloning the entry name.
2013-06-27 21:57:41 +02:00
Ingo Weinhold
77ca66cdb7 BPathMonitor: make the node watching mechanism configurable
Add inner class BWatchingInterface and method SetWatchingInterface().
This abstracts the calls to watch_node() and stop_watching(), thus
making it possible to use the path monitor in Tracker.
2013-06-27 21:57:41 +02:00
Ingo Weinhold
ad1875fd70 BPathMonitor: use pthread_once for initialization 2013-06-27 21:57:40 +02:00
Ingo Weinhold
5fa3519dec BString::Private: Add IsShareable() 2013-06-27 21:57:40 +02:00
Ingo Weinhold
105511275e Move PUuid from shared to support 2013-06-27 21:57:39 +02:00
Ingo Weinhold
c625c5fd36 <langinfo.h>/<select.h>: don't use C++ comments 2013-06-12 14:55:16 +02:00
Ingo Weinhold
a1832a0e83 <resolv.h>: Make self-contained 2013-06-11 15:23:18 +02:00
Ingo Weinhold
01176bd944 Add basic BUuid class
ATM it's only able to generate random UUIDs.
2013-06-07 02:03:16 +02:00
Ingo Weinhold
4489c88b61 hpkg format: Generalize user/global settings file attributes
* For all identifiers: Rename global settings file to global writable
  file. We want to use the respective attribute also for other writable
  files, not only settings files.
* User settings file/global writable file info/attribute: Add
  isDirectory property/child attribute. This allows declaring global/
  user settings directories associated with the package.
2013-06-06 00:17:02 +02:00
Ingo Weinhold
a532c57308 Remove /boot/{apps,preferences} symlinks
And adjust all remained occurrence in the tree accordingly (->
/boot/common/{apps,preferences}).
2013-06-04 23:36:46 +02:00
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