Commit Graph

295 Commits

Author SHA1 Message Date
Ingo Weinhold 05b565f4f2 Add private BDataPositionIOWrapper
Implements the BPositionIO interface on top of a BDataIO, requiring the
{Read,Write}At() accesses to be sequential.
2014-07-13 17:57:56 +02:00
Ingo Weinhold c55a06055f Add private class BFdIO
Simple BPositionIO implementation using the POSIX API on a FD. In effect
similar to BFile, but more easily ported to kernel and boot loader (and
the FD is reusable).
2014-07-12 15:40:21 +02:00
Ingo Weinhold b3263ad3e1 Switch package kit to BZlibCompressionAlgorithm
... and remove the Zlib{Compressor,Decompressor} API.
2014-06-30 21:55:41 +02:00
Ingo Weinhold dcdc33b0af Add B[Zlib]CompressionAlgorithm
* BCompressionAlgorithm is a base class for classes that provide
  compression/decompression functionality. There are methods for
  compressing/decompressing a single buffer and factory methods for
  a compressing/decompressing input/output BDataIO.
* BZlibCompressionAlgorithm is a BCompressionAlgorithm implementation
  using zlib.
2014-06-30 21:55:41 +02:00
Ingo Weinhold 6a89a36aa0 Move package kit Zlib* classes to support kit
Also move to B* namespace and no longer expose the zlib dependency in
the headers.
2014-06-30 21:55:41 +02:00
Ingo Weinhold 84297881bb Remove BPackageKit::[...]::AbstractDataWriter and friends
* FDDataWriter and ZlibDataWriter weren't used anymore.
* AbstractDataWriter was implemented only by PackageFileHeapWriter,
  which was only used by WriterImplBase.
* Add a PackageFileHeapWriter::AddDataThrows() which has semantics
  equivalent to the previously inherited WriteDataThrows().
2014-06-23 22:58:15 +02:00
Ingo Weinhold 32832cbe47 Remove BPackageKit::BDataOutput
Use BDataIO instead.
2014-06-23 22:58:15 +02:00
Ingo Weinhold d2d1af830b Revert "Move ZlibDecompressor to libshared"
This reverts commit 9af2105d36.

Conflicts:
	src/kits/package/Jamfile
2014-06-18 22:13:39 +02:00
Ingo Weinhold 0de3219e33 package daemon: Rework error and issue propagation to client
* BDaemonClient: Move inner class BCommitTransactionResult to top level
  and make it public.
* BCommitTransactionResult:
  - Add a whole bunch of specific error code enum values. Such an error
    code is now the primary error, as opposed to before where we would
    mix status_t and enum value errors. There's a systemError property
    of type status_t which may provide additional information, though
    (depending on the primary error type).
  - Remove the errorMessage property. Due to mapping all errors to the
    specific error codes this is no longer necessary. Mixing such a
    message with another error description is also not very helpful when
    it comes to localization (still not supported, though).
  - Add several properties (paths, strings, error codes) that serve as
    arguments to the primary error and are used by FullErrorMessage().
  - Add issues property, a list of instances of new class
    BTransactionIssue. Those describe non-critical issues (e.g. failed
    update of a settings file) that occurred in the process of
    committing the transaction. Those issues should be presented to the
    user by the package management program.
* Exception: Adjust to transport the BCommitTransactionResult
  properties.
* CommitTransactionHandler, FsTransactions, Root, Volume: Adjust to
  BCommitTransactionResult/Exception changes.
* CommitTransactionHandler: Now requires a BCommitTransactionResult to
  which it adds the issues it encounters. The reply BMessage is no
  longer needed, though.
* Volume: Refactor common code from the three methods that use
  CommitTransactionHandler into new method _CommitTransaction.
2014-06-15 17:21:01 +02:00
Jessica Hamilton fad4fc59f9 Revert "ByteOrder.h: remove use of __builtin_bswap16."
This reverts commit 040dc2eebc.
2014-05-30 20:39:43 +12:00
Jessica Hamilton 040dc2eebc ByteOrder.h: remove use of __builtin_bswap16.
* Fixes the build for host compilers older than gcc-4.8
2014-05-30 08:45:57 +12:00
Adrien Destugues 77b60d2222 Use std::stable_sort instead of mergesort.
* stable_sort is part of the C++ standard, and should work just as well.
2014-05-02 16:36:16 +02:00
Adrien Destugues 6df2ee73b3 Try to fix build on Linux.
* Linux is the only one of our supported build hosts to not have
mergesort. Provide an implementation that calls qsort, since the qsort
implementation in the glibc used by Linux uses a mergesort (!) for small
arrays.
2014-05-02 13:56:00 +02:00
Jessica Hamilton 181948a678 libbe_build: fix unterminated string in BEntry::set. Fixes #10686.
Signed-off-by: Stephan Aßmus <superstippi@gmx.de>
2014-03-17 18:21:39 +01:00
Adrien Destugues 9af2105d36 Move ZlibDecompressor to libshared
* This will be used to implement compressed http streams
* Remove the custom BDataOutput class, and use BDataIO instead, for
easier integration with existing code.
2014-02-11 12:06:38 +01:00
Jonathan Schleifer b55c918f57 Import gnuregex 0.12 and remove hardcoded paths
This is required on OS X and other systems which do not have the glibc
extensions for regular expressions (FreeBSD is not one of them as it
already includes gnuregex in /usr). With this there are no hardcoded
non-standard paths for OS X anymore.

regex.c and regex.h are from the official gnuregex 0.12 distribution,
the only modification is that I added __BEGIN_DECLS and __END_DECLS to
regex.h.
2014-02-03 18:27:35 +01:00
Ingo Weinhold 0973f2a791 libbe_build: Sync BAppFileInfo 2014-01-26 13:43:05 +01:00
Pawel Dziepak d0f2d8282f Merge branch 'scheduler'
Conflicts:
	build/jam/packages/Haiku
	headers/os/kernel/OS.h
	headers/os/opengl/GLRenderer.h
	headers/private/shared/cpu_type.h
	src/add-ons/kernel/drivers/power/acpi_battery/acpi_battery.h
	src/bin/sysinfo.cpp
	src/bin/top.c
	src/system/kernel/arch/x86/arch_system_info.cpp
	src/system/kernel/port.cpp
2014-01-17 04:06:15 +01:00
Ingo Weinhold 2b76973fa2 mimeset: Use TextSnifferAddon when using a custom MIME DB
That addresses the problem that packaged text files aren't correctly
identified (ticket #9972). All concerned packages have to be rebuilt,
of course.
2013-11-22 12:24:13 +01:00
Pawel Dziepak 077c84eb27 kernel: atomic_*() functions rework
* No need for the atomically changed variables to be declared as
   volatile.
 * Drop support for atomically getting and setting unaligned data.
 * Introduce atomic_get_and_set[64]() which works the same as
   atomic_set[64]() used to. atomic_set[64]() does not return the
   previous value anymore.
2013-11-05 22:32:59 +01:00
Ingo Weinhold de49e34927 Add symbol versioning for find_directory()
Should already have been done back when the semantics for the
B_COMMON_*DIRECTORY constants was changed.

Currently old and new version behave the same. So this is just a
contingency measure ATM.
2013-10-05 01:33:26 +02:00
Ingo Weinhold 4b7e219688 Remove /boot/common for good
* Remove support for the "common" installation location from packagefs,
  package kit, package daemon, package managers.
* Rename the B_COMMON_*_DIRECTORY constants referring to writable
  directories to B_SYSTEM_*_DIRECTORY.
* Remove/adjust the use of various B_COMMON_*_DIRECTORY constants.
  I'm sure some occurrence still remain. They can be adjusted when the
  remaining B_COMMON_*_DIRECTORY constants are removed.
2013-10-03 21:52:25 +02:00
Ingo Weinhold f73f5d4c42 Initial changes to remove /boot/common
* find_directory() and hard-coded paths use /boot/system instead of
  /boot/common.
* The build system creates the writable directories in /boot/system
  instead of /boot/common.
* The build system no longer installs any packages in /boot/common.
2013-10-03 21:52:25 +02:00
Pawel Dziepak 1238bebddc build: Add stub _get_thread_info() needed by support/Referenceable.cpp
This is a step towards fixing #10042.

When DEBUG is set BReferenceable::~BReferenceable() performs some checks
ensuring that the object is destroyed correctly. These checks require
information on thread stack, which is obtained by get_thread_info().

_get_thread_info() stub is added (actually, readded) which always returns
B_ERROR. Moreover, the check in BReferenceable destructor is modified
so that it does not fail when get_thread_info() fails.
2013-10-01 15:06:17 +02:00
François Revol 8bf87f9341 Actually fix the build
Looks like I was too quick on previous commit.

It seems -pthread is actually not that much needed on Linux though...
although the manpage says "compile and link with -pthread". Go figure.

Now dlopen() uses RTLD_LAZY | RTLD_LOCAL for Linux, which seems
to work here.
2013-10-01 03:57:24 +02:00
François Revol 4135f9cde3 Fix build
Declare a HOST_PTHREAD_LINKFLAGS variable to hold the flags
required to link with pthreads, and use it for the solver addon.

Works on GNU/Linux, please test and fix for other platforms.
2013-10-01 02:37:54 +02:00
Ingo Weinhold 5fd3766e03 libroot_build: fs_darwin: fdopendir(): close FD on success
fdopendir() is supposed to consume the specified FD on success.
2013-09-30 21:41:56 +02:00
Rene Gollent 6114dd1fc2 Clean up FreeBSD build support as suggested by Ingo. 2013-09-29 19:50:00 -04:00
Rene Gollent 4a3649a4ac libpackage_build: Fix build on FreeBSD.
FreeBSD's gcc doesn't include /usr/local/{include,lib} in its default
search paths, but libcurl gets installed there.
2013-09-29 17:51:23 -04:00
Rene Gollent 5ef03b1bda libpackage_build: Fix build on gcc2 haiku.
- gcc2 lacks the -iquote option, and side effects of some of the other flags
  we use with it during the build cause some of libcurl's includes to fail.
  This temporarily works around the problem until gcc2 can be suitably fixed.
2013-09-29 17:25:34 -04:00
Rene Gollent cd76e0903f libpackage: Use libcurl directly for downloads.
- Initial step towards allowing listening for download progress.
2013-09-29 17:25:29 -04:00
Niels Sascha Reedijk 3e3ffe6858 Set defines for Mac OS X so that libsolv can be built 2013-09-29 11:56:27 +02:00
Ingo Weinhold b543870a97 libpackage_build: Fix build for paths with spaces 2013-09-28 23:44:23 +02:00
Ingo Weinhold 52b81e5a60 libpackage_build: Make sure built-in data dir path is absolute
Fixes #10022.
2013-09-28 15:07:06 +02:00
Ingo Weinhold 83462cc28d Refactor reusable pkgman code into libpackage
* Move RepositoryBuilder class to libpackage and add B* prefix to name.
* Pull BPackageManager class out of PackageManager and move to
  libpackage. The base class is customizable via three handler objects
  responsible for transaction handling, request execution, respectively
  user interaction.
* Reorganize _ApplyPackageChanges(): Now we first prepare the
  transactions for all affected installation locations (downloading
  files etc.) and then commit them.
2013-08-31 21:19:07 +02:00
Ingo Weinhold bbd644b00b libsolv_build: add support for building on FreeBSD
Also fail immediately when an unsupported platform is encountered.
2013-07-06 02:15:39 +02:00
Ingo Weinhold ee64a0a6db BRepositoryConfig::SetTo(): fix use after deallocation
The strings retrieved from the driver settings were used after
unload_driver_settings(). Use BDriverSettings which also simplifies
things quite a bit.
2013-07-06 02:13:54 +02:00
Ingo Weinhold 30cdb26b5f Add BDriverSettings to libbe_build 2013-07-06 02:11:18 +02:00
Ingo Weinhold fdf111aa57 libsolvext requires libz 2013-07-05 13:45:25 +02:00
Ingo Weinhold a65099bbe4 libsolv_build: fix build on gcc 2 Haiku
* Fix the "UseHeaders" invocation for libsolvext to use the correct
  directory.
* Reorder things slightly, merely for aesthetical reasons.
2013-07-05 13:23:48 +02:00
Ingo Weinhold 812baf3925 libsolv_build: declare missing dependency 2013-07-05 12:14:59 +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 2f5551ec2a libroot_build: make path normalization more robust
In case we don't have read permission for an ancestor directory, we try
to guess the path from the CWD.
2013-07-04 10:16:15 +02:00
Ingo Weinhold bc96e8f30c Add more robust generic attribute emulation variant
The new configure option "--use-xattr-ref" enables an xattr assisted
variant of the generic attribute emulation. Instead of using the inode
ID of a node to identify its attribute directory, we use a reasonably
unique random 128 bit number, which we generate and attach as an
attribute to the node. This way, when a node changes its inode ID
(defragmentation?) or the inode ID of a removed node with a left-over
attribute directory is reused, attributes won't get mixed up.

The old method is still used for symlinks (since on Linux only
priviledged users can write attributes on symlinks), but those usually
only have a rather boring BEOS:TYPE attribute, so mix-ups wouldn't be
that problematic anyway.
2013-06-07 02:27:48 +02:00
Ingo Weinhold 280b7cb63a libroot_build: Improve/fix get_path()
In fs_attr_generic() get_path() is used with a symlink FD, which didn't
work at all. Handle symlink descriptors explicitly now.
2013-06-07 02:01:46 +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 75c10de291 libroot_build _kern_read_dir(): reset errno before readdir()
Since we're checking errno when readdir() didn't return an entry, we
need to reset it before, or we might see a spurious error value.
2013-05-27 01:05:58 +02:00
Ingo Weinhold 3da422ad05 libroot_build: Fix issues with attribute FD for symlink
AttributeDescriptor: Don't use dup() directly. Check, if the given FD is
one we track and clone it respectively. This allows use with symlink FDs
which we have to fake on Linux (since symlinks cannot be opened). Fixes
extraction of packages containing symlinks with attributes.
2013-05-25 02:38:52 +02:00
Ingo Weinhold 0f4e11e75c hpkg format: Add attributes for declaring users and groups 2013-05-25 01:12:37 +02:00