Commit Graph

127 Commits

Author SHA1 Message Date
Axel Dörfler e711e6e42f Moved BJob, and JobQueue into the support kit.
* Put it in the BSupportKit namespace, following the style introduced
  with the package kit for now.
* The BSupportKit::BJob class no longer knows about the package kit's
  Context class. However, the BPackageKit::BJob class does.
* Due to the namespace juggling, a lot of files had to be touched.
* The JobQueue class remains private.
* Due to the way Haiku is built on itself, you cannot build this change
  under Haiku with an older release.
2015-05-21 21:37:01 +02:00
Axel Dörfler 1aaa0c2142 Package Kit: FetchFileJob now contains package size.
* So that you know how much already was, and still has to be downloaded.
* Automatic whitespace cleanup.
* The link in FetchFileJob.h did not fetch the correct header under
  Haiku anymore (since the addition of the private headers to the
  image).
2015-03-31 13:40:42 +02:00
Ingo Weinhold d228f29f6e BPackageManager: Add SetDebugLevel()
Sets the debug level of the solver.
2014-10-26 00:19:35 +02:00
Ingo Weinhold e1e6c12480 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.
2014-07-13 17:57:57 +02:00
Ingo Weinhold 43a6b92c64 PackageReaderImpl: Delay reading sections until ParseContent() 2014-07-13 17:57:56 +02:00
Ingo Weinhold 1606450b32 ReaderImplBase::Init(): Make file size check optional
If the file doesn't support GetSize(), skip the header total size file
size check.
2014-07-13 17:57:56 +02:00
Ingo Weinhold 44c4771163 BPackageWriter: Add BPositionIO support 2014-07-13 17:57:55 +02:00
Ingo Weinhold 8f5130edfa package kit: Actually add support for B_HPKG_COMPRESSION_NONE
Until now we always declared in the HPKG header that the package file is
zlib compressed. For uncompressed files we would just store all
individual chunks uncompressed. Now we handle completely uncompressed
files slightly differently: We don't write the redundant chunk size
table anymore. The size savings are minor, but it makes the uncompressed
format read-streamable which may be handy.
2014-07-12 23:12:21 +02:00
Ingo Weinhold e527b79631 Switch package file accessor classes to use BPositionIO
* PackageFileHeap{Reader,Writer} as well as Package{Reader,Writer} and
  their implementation and super classes do now internally use a
  BPositionIO instead of a FD to access the package file. This provides
  more flexibility needed for features to come.
* BPackageReader has already grown a new Init() version with a
  BPositionIO* parameter.
2014-07-12 15:40:22 +02:00
Ingo Weinhold cdfeba5a1e BPackageWriter: Add Recompress()
Allows rewriting an existing package file with a different compression.
2014-07-08 22:00:35 +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 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 0dab9e5cb4 package kit: ReaderImplBase: Remove superfluous scratch buffer 2014-06-30 21:51:16 +02:00
Ingo Weinhold 0a62e01902 PackageWriterImpl: Remove superfluous method 2014-06-30 21:51:16 +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 d5660e67af Revert "build fix follow up on status_t/ssize_t changes."
This reverts commit 7202cfb455.
2014-06-18 22:13:38 +02:00
Ingo Weinhold f2f19f110d BPackageManager: Support installing/updating local package files
* The Install() and Update() versions that take a const char* array
  now check whether a string looks like a path to a local package file.
  If so, they use that file instead of interpreting the string as a
  search string.
* Extend the repository hierarchy. There's now a LocalRepository base
  class from which InstalledRepository and the new MiscLocalRepository
  derive. The latter is instantiated once and collects all package files
  specified by path.
2014-06-15 17:21:01 +02:00
Ingo Weinhold eee422752c BPackageManager: Make BCommitTransactionResult available
* BFatalErrorException: Add commitTransactionResult property and
  respective constructor. In case committing the transaction failed,
  BPackageManager throws a BFatalErrorException with the result.
* BFatalErrorException::UserInteractionHandler: Pass
  BCommitTransactionResult to ProgressTransactionCommitted().
2014-06-15 17:21:01 +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
Ingo Weinhold 333d4efe4f packagefs: Extend PACKAGE_FS_OPERATION_GET_PACKAGE_INFOS ioctl
Also return the package file names.
2014-04-26 15:34:18 +02:00
Ingo Weinhold 2d91773d2e Adjust packagefs ioctl interface to support old states
* PackageFSVolumeInfo: Add the directories for all relevant states.
* PackageFSPackageInfo: Include the package file's parent directory node
  ref.

Package daemon and package kit still don't support old states yet.
2014-04-18 23:31:40 +02:00
Jérôme Duval 7202cfb455 build fix follow up on status_t/ssize_t changes.
* added a TODO in packagefs.
2014-02-11 18:26:41 +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
Ingo Weinhold 32cae72412 package daemon: Handle location info request in app thread
* ... instead of queuing it for the job thread. The advantage is that
the request will be handled immediately and clients won't have to wait
for transactions (which may even require user feedback) to finish. It
complicates Volume a bit, since there are now two threads that may
access it. The shared data have been moved to a State object which is
protected by a lock.
* For commit transaction requests check whether another package request
is already pending/in progress before queuing a job. Fail immediately,
if there is.

Fixes bug #10039.
2014-02-07 01:21:57 +01:00
Ingo Weinhold 6ef57ae2a9 pkgman: Add full-sync command
* BSolver/LibsolvSolver: Add FullSync() method. It uses libsolv's
SOLVER_DISTUPGRADE mode.
* BPackageManager: Add FullSync() using the new solver mode.
* pkgman: Add full-sync command.

The new command is similar to the update command without arguments, just
more aggressive, allowing downgrading or even removal of packages, to
match the state of the repositories. Just like "update" it doesn't work
properly yet.
2014-01-25 10:47:35 +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 ee8e91583e BPackageManager::UserInteractionHandler: Make non-abstract
Most of the hooks don't strictly need a non-empty implementation. The
defaults now simply throw exceptions in those that do. This allows the
class to be instantiated, which is useful when a BPackageManager is only
used for finding packages.
2013-11-21 13:29:21 +01:00
Ingo Weinhold 6722e1ae43 BPackageManager: Add mandatory constructor parameters
Require the installation interface and the user interaction handle to
be passed to the constructor. Formerly, derived classes set them
manually in their constructors. This makes using the class without
having to subclass it possible.
2013-11-21 13:29:20 +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 3f40dcb6b4 PackageWriterImpl::_AttributeRemoved(): Update string cache
When removing a string attribute, decrement the referenced string's
usage count in the string cache. This fixes the potentially incorrect
usage counts in update mode. Not a serious problem, but it could lead
to only singly (or no longer) used strings to be written to the string
subsection instead of encoding them inline and thus to slightly greater
file sizes.
2013-10-25 22:54:44 +02:00
Ingo Weinhold b8f713e904 PackageReaderImpl: Add public TOC section accessor 2013-10-25 22:54:44 +02:00
Ingo Weinhold e07b8bd2df package kit: ReaderImplBase: Add public attrs section accessor 2013-10-25 22:54:43 +02:00
Ingo Weinhold df266f1c93 BDaemonClient::CommitTransaction(): Align with documentation
The method is supposed to return B_OK as long as the _result object has
been initialized, even if committing the transaction failed. Fixes the
unhelpful error messages of pkgman when committing the transaction
failed for some reason.
2013-10-22 01:12:02 +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
Rene Gollent 9345049af8 Package Kit: Implement progress notifications.
- BJobStateListener: Add progress state and corresponding hook.
- FetchFileJob: Notify job progress hook on libcurl notifications.
- UserInteractionHandler: Add hooks for download progress and checksum
  validation progress.
- PackageManager: inherit from JobStateListener and watch for job
  notifications for internally generated jobs. Forward to corresponding
  UserInteractionHandler hooks as needed.
- Adapt pkgman, HaikuDepot and package_daemon to above changes.
  Neither HaikuDepot nor package_daemon's progress hooks are wired up to
  do anything yet though.
2013-09-29 17:25:33 -04:00
Rene Gollent fe39d2eb8d BPackageManager: Eliminate RequestHandler.
- Pull functionality back into package manager itself since the extra
  indirection doesn't really buy us anything in this case, as neither
  request that it handles requires a decision provider.
- Adjust pkgman and HaikuDepot accordingly.
2013-09-29 17:25:32 -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
Ingo Weinhold 81a828b660 BPackageManager: Auto-refresh if repository cache is missing
This makes the initial "pkgman refresh" superfluous, that was necessary
for "install"/"search" to work.
2013-09-29 13:14:43 +02:00
Oliver Tappe 0a345af77e Separate notification from deletion in repository-handlers.
* Add NotifyDone() to all repository-attribute handlers and invoke that
  to notify any listeners.
* Unify deletion to a single implementation of Delete() in the base
  class. Before, the root handler for a repository didn't do that, but
  just triggered the notification.
2013-09-18 21:16:13 +02:00
Oliver Tappe 50ae264dad Add support for adding a package-info to BRepositoryWriter. 2013-09-18 12:05:34 +02:00
Ingo Weinhold 36204024cf BPackageManager: Add InstalledRepository::EnablePackage() 2013-09-10 19:14:20 +02:00
Ingo Weinhold 018173a2f5 BPackageManager: Add ResultComputed() callback 2013-09-10 19:14:20 +02:00
Ingo Weinhold c032903abc BPackageManager: Add VerifyInstallation() 2013-09-10 19:14:20 +02:00
Ingo Weinhold 7e0d2c4f94 BPackageManager: Add alternate Install()/Uninstall()/Update() 2013-09-10 19:14:20 +02:00
Ingo Weinhold 5a5d146510 BPackageManager: Make _InstallationRepository() protected 2013-09-10 19:14:19 +02:00
Ingo Weinhold 56b1376090 BActivationTransaction: Make BArchivable 2013-09-10 19:14:19 +02:00
Ingo Weinhold d4f9c465fd BDaemonClient: add comment 2013-09-10 19:14:19 +02:00
Ingo Weinhold a87c7d67e3 Don't use BPackageKit::BPrivate; avoids clashes 2013-09-10 19:14:18 +02:00