Commit Graph

35503 Commits

Author SHA1 Message Date
Ingo Weinhold
e35a99be4c Pull class BPackageInfoSet out of BRepositoryCache 2011-11-25 06:19:47 +01:00
Ingo Weinhold
f96d3856e1 Removed left-over code 2011-11-25 06:19:47 +01:00
Ingo Weinhold
9968845d69 Use BStringList in package kit
Replace all instances of BObjectList<BString> by BStringList.
2011-11-25 06:19:46 +01:00
Ingo Weinhold
7de6af25e9 Add a BStringList class 2011-11-25 06:19:45 +01:00
Ingo Weinhold
ad07ecd821 BString::Private class to access BString internals 2011-11-25 06:19:45 +01:00
Ingo Weinhold
4f5f15f080 BRepositoryCache: Add iteration, etc.
* Remove InitCheck() and the initializing constructor.
* Rename PackageCount() to CountPackages().
* Use BOpenHashTable instead of HashMap for the internal PackageMap.
* Allow multiple packages with the same name. Equally named packages are
  in a singly linked list after the first package with that name.
* Add an Iterator inner class and a GetIterator() method, so one can now
  iterate through the packages in the repository.
2011-11-25 06:19:44 +01:00
Ingo Weinhold
156ea481b3 Add HashValue() methods to BString 2011-11-25 06:19:44 +01:00
Ingo Weinhold
1524eed163 Handle the newer package attributes
This unbreaks reading repository cache files using the respective
attributes.
2011-11-25 06:19:43 +01:00
Ingo Weinhold
d0b2d58a4e Add error output in case of invalid compression ID 2011-11-25 06:19:42 +01:00
Ingo Weinhold
4caf282707 Fix handling of shine-through directories
* Add a new class ShineThroughDirectory for shine-through directories
  instead of using UnpackingDirectory.
* Split up setting up the shine-through directories in two steps. First
  the directories are only created. That happens before adding the
  initial package domains. After publishing the root node we bind the
  shine-through directories to the underlying directories.
* This makes adding a package directory with the same name as a
  shine-through directory fail in _AddPackageNode() as originally
  intended. Since we no longer want it to fail -- the package daemon
  will copy the files in the respective directories as part of the
  activation process -- we simply skip the directory now. Adjust
  _AddPackageNode() and _AddPackageContentRootNode() accordingly.
2011-11-25 06:19:42 +01:00
Ingo Weinhold
166412ff77 Fix notifications when adding package link dir
When adding a new package link directory, the volume would only be
notified about the addition of the directory itself, not of the addition
of its contents. Add a new PackageLinkDirectory::NotifyDirectoryAdded()
which does the whole job and use it in
PackageLinksDirectory::AddPackage().
2011-11-25 06:19:41 +01:00
Ingo Weinhold
a70f4da47e Fix debug output 2011-11-25 06:19:41 +01:00
Ingo Weinhold
8fb0681018 Implement more virtuals in Node and Directory
* Node: Add default implementations for UserID(), GroupID(),
  OpenAttributeDirectory(), and OpenAttribute().
* Directory: Add default implementations for Mode() and FileSize().
* Remove the respective hook implementations in the PackageLink*
  classes.
2011-11-25 06:19:40 +01:00
Ingo Weinhold
84f50b1ce9 GetRepositoryCache/Config(): return valid entry
Always create the common repository cache/config paths so the BEntry
that is returned is valid at least. Fixes BRefreshRepositoryRequest
failing when the common repository cache path didn't exist yet.
2011-11-25 06:19:39 +01:00
Ingo Weinhold
ad4fba78b2 Initialize BRepositoryInfo::fInitStatus 2011-11-25 06:19:39 +01:00
Ingo Weinhold
56fed01db3 Handle the newer package attributes 2011-11-25 06:19:38 +01:00
Ingo Weinhold
18126bc7c7 Notify earlier when removing a package node
Volume::_RemovePackageNode(): Notify listeners before removing the last
package node from the node, . This prevents the size/last modified
indices from not finding the node anymore, since the node would return
a default value instead of the value it was added to the index with.
2011-11-25 06:19:38 +01:00
Ingo Weinhold
f391c9b0ea Add UnpackingNode::IsOnlyPackageNode()
It returns whether the given package node is the only package node
attached to that node.
2011-11-25 06:19:37 +01:00
Ingo Weinhold
0a9478a707 Force package names and versions to lower case 2011-11-25 06:19:37 +01:00
Ingo Weinhold
17a7f65c0a Add install path support to packagefs 2011-11-25 06:19:36 +01:00
Ingo Weinhold
1fc3ceeda2 Add options -b and -I to package command
* With -b building a build package can be requested. It will be empty
  save for the .PackageInfo. No license check is performed.
* -I allows to specify an install path.
2011-11-25 06:19:35 +01:00
Ingo Weinhold
6ae0ecd49a 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.
2011-11-25 06:19:35 +01:00
Ingo Weinhold
7efa133cb4 BPackageWriter: Add SetCheckLicenses()
The default is still "true", but now it is possible to disable the
license check.
2011-11-25 06:19:34 +01:00
Ingo Weinhold
bde1972229 Move <directories.h> to headers/private/system 2011-11-25 06:19:32 +01:00
Ingo Weinhold
9076c04c01 Declare packagefs persistent
Besides that it is kind of correct, it also makes tracker queries work
correctly.
2011-11-25 06:19:32 +01:00
Ingo Weinhold
0b45c28c4f Implement packagefs index (dir) hooks 2011-11-25 06:19:31 +01:00
Ingo Weinhold
3b97d999e7 Add set_dirent_name() without name length parameter 2011-11-25 06:19:31 +01:00
Ingo Weinhold
9590b31b31 Remove unused IndexIterator constructor 2011-11-25 06:19:30 +01:00
Ingo Weinhold
e8d560154a Remove references in index iterator interface
This avoids checks.
2011-11-25 06:19:30 +01:00
Ingo Weinhold
1197afa806 Remove superfluous checks 2011-11-25 06:19:29 +01:00
Ingo Weinhold
08bed1acb7 Check key length, if index keys are fixed length 2011-11-25 06:19:28 +01:00
Ingo Weinhold
8db89f6336 Create a "BEOS:APP_SIG" index by default 2011-11-25 06:19:28 +01:00
Ingo Weinhold
03aed3a314 Attribute index support for non-special attributes
* Add AttributeIndex class.
* Each attribute does now have an attribute index cookie. The new
  attribute index service methods Node::IndexAttribute() and
  IndexCookieForAttribute() create+set/retrieve the cookie. The cookie
  is actually the attribute index's tree node.
* Add OldNodeAttribute::IndexCookieForAttribute() so the cookie is
  available when the node changes.
2011-11-25 06:19:27 +01:00
Ingo Weinhold
1cf4d082ab More abstraction in GenericIndexIterator
* Move tree node operations to a subpolicy TreePolicy.
* Add a GenericIndexIteratorTreePolicy templatized over the policy,
  implementing the tree policy for the standard indices.
2011-11-25 06:19:27 +01:00
Ingo Weinhold
af1cc77849 QueryPolicy::NodeGetAttribute(): Get the type too 2011-11-25 06:19:26 +01:00
Ingo Weinhold
28269859c8 Remove unused PackageNodeAttribute::fParent 2011-11-25 06:19:25 +01:00
Ingo Weinhold
8b07f87a91 compareKeys(): Also handle B_MIME_STRING_TYPE 2011-11-25 06:19:25 +01:00
Ingo Weinhold
a54f7dc250 Move B_MIME_STRING_TYPE to <TypeConstants.h> 2011-11-25 06:19:24 +01:00
Ingo Weinhold
2c5c1adc91 Remove TwoKeyAVLTree from kernel utils again
It's not ready for shared use yet.
2011-11-25 06:19:23 +01:00
Ingo Weinhold
6cc3dcdb9b Move helper function out of QueryParser.h
They live in the new QueryParserUtils.{h,cpp} now.
2011-11-25 06:19:23 +01:00
Ingo Weinhold
ed81de869e Add last modified index support
* Add class LastModifiedIndex.
* Create and add an instance of it in Volume::Mount().
2011-11-25 06:19:21 +01:00
Ingo Weinhold
e708cdd90f Removed left-over commented code 2011-11-25 06:19:20 +01:00
Ingo Weinhold
ab6a1e0f74 QueryParser: The last_modified index is time_t
* Changed value type from B_INT64_TYPE to B_INT32_TYPE.
* Changed QueryPolicy::NodeGetLastModifiedTime() return value from
  bigtime_t to time_t.
2011-11-25 06:19:20 +01:00
Ingo Weinhold
3793289c21 Add size index support
* Add class SizeIndex.
* Create and add an instance of it in Volume mount.
2011-11-25 06:19:19 +01:00
Ingo Weinhold
0d988526bc GenericIndexIterator: Add node change helpers
Add NodeChangeBegin()/NodeChangeEnd() methods that can be used by the
index when the respective node attribute has changed. They make sure
that the iterator doesn't move with the node, should it be inserted into
the index at a different position.
2011-11-25 06:19:19 +01:00
Ingo Weinhold
304eaea680 Add comment 2011-11-25 06:19:18 +01:00
Ingo Weinhold
84989de15b GenericIndexIterator::SetTo(): Find fuzzily
Use TwoKeyAVLTree::FindFirstClosest() instead of FindFirst(), so, if the
value isn't in the index, we find the closest greater value. That's the
semantics Index::InternalFind() is expected to have.
2011-11-25 06:19:17 +01:00
Ingo Weinhold
abaf82e5a9 GenericIndexIterator: Fix NameIndex dependency
Next() was still copying the name. Add a GetNodeValue() method to the
policy that fetches the value instead.
2011-11-25 06:19:17 +01:00
Ingo Weinhold
24c2d0cc09 Refactor NameIndexIterator into template class
Create template class GenericIndexIterator from NameIndexIterator.
2011-11-25 06:19:15 +01:00
Ingo Weinhold
182e58f709 NodeListener::NodeChanged(): Provide old value
* Add interface OldNodeAttributes an instance of which is passed to
  NodeListener::NodeChanged() to provide the old attribute values
  (currently only modification time and file size).
* Also extend PackageLinksListener::PackageLinkNodeChanged() with a
  OldNodeAttributes parameter.
* Add OldNodeAttributes implementations for PackageLinkSymlink (inner
  class OldAttributes) and UnpackingNode (OldUnpackageNodeAttributes).
2011-11-25 06:19:15 +01:00
Ingo Weinhold
ac490e3bb9 PackageLinkSymlink: Init fLinkPath in constructor 2011-11-25 06:19:14 +01:00
Ingo Weinhold
670b0d106a ~NameIndex(): Make more robust
Remove the listener only, if it was registered.
2011-11-25 06:19:13 +01:00
Ingo Weinhold
8373bcd169 Name::Index(): Fix initialization order
Add the node listener directly after calling the base class Init().
Otherwise, on error, the we could try to remove the listener although it
wasn't added in the first place.
2011-11-25 06:19:13 +01:00
Ingo Weinhold
989addc209 Simplify [Abstract]IndexIterator interface
* Remove Current() and Previous() and add a HasNext() instead.
* Reimplement NameIndexIterator. It directly works with tree nodes
  instead of using an iterator, now.
2011-11-25 06:19:12 +01:00
Ingo Weinhold
dcc6ab5408 Fix NameIndexPrimaryKeyCompare
It was actually returning whether the names where not equal.
2011-11-25 06:19:12 +01:00
Ingo Weinhold
502a5e2388 QueryParser: Explicitly suspend/resume iterators
Extended policy by IndexIteratorSuspend() and IndexIteratorResume()
methods that are invoked for the index iterator by Query::GetNextEntry()
after entering respectively before exiting.
2011-11-25 06:19:11 +01:00
Ingo Weinhold
5deb28d6d2 Cleanup 2011-11-25 06:19:09 +01:00
Ingo Weinhold
b4a9359d84 Automatic whitespace cleanup 2011-11-25 06:19:09 +01:00
Ingo Weinhold
1fb71f8739 Implement query FS hooks, add empty index FS hooks 2011-11-25 06:19:08 +01:00
Ingo Weinhold
617ac41c60 Add Query class and query management in Volume 2011-11-25 06:19:08 +01:00
Ingo Weinhold
331b89b3a5 Add NameIndex class and create instance in Volume 2011-11-25 06:19:07 +01:00
Ingo Weinhold
4791f5ebb3 Add Index base class and index table in Volume 2011-11-25 06:19:06 +01:00
Ingo Weinhold
ec59ac7515 Add a global node listener mechanism 2011-11-25 06:19:06 +01:00
Ingo Weinhold
239ce182ab Fix loading the resolvable compatible version 2011-11-25 06:19:04 +01:00
Ingo Weinhold
7e0f4e5703 Fix Dependency version comparisons 2011-11-25 06:19:04 +01:00
Ingo Weinhold
e7c648e06d PackageWriterImpl::_AddEntry(): Fix update logic
* Don't only look up the entry attribute when the entry is implicit.
  Look it up, when it is a directory instead. This aligns it the logic
  with _UpdateCheckEntryCollisions().
* When the entry attribute exits and the entry is not implicit, add file
  attributes, but not stat data. This also aligns the logic with
  _UpdateCheckEntryCollisions(), which removes colliding attributes, but
  keeps stat data.
2011-11-25 06:19:03 +01:00
Ingo Weinhold
420a5c3e42 Remove copy'n'paste left-over 2011-11-25 06:19:02 +01:00
Ingo Weinhold
4d63965914 Fix "package add" heap compacting
PackageWriterImpl::_CompactHeap(): Incorrectly used fHeapEnd instead of
the heap size. So the last copied chunk was too large.
2011-11-25 06:19:02 +01:00
Ingo Weinhold
f4417e14fa PackageWriterImpl::_MoveHeapChunk(): better output 2011-11-25 06:19:01 +01:00
Ingo Weinhold
8ffba2a6cb Write uncompressed package file TOC, if necessary 2011-11-25 06:19:00 +01:00
Ingo Weinhold
2fac6eaa60 Add "package add" command. 2011-11-25 06:19:00 +01:00
Ingo Weinhold
723336fe52 Move directory iteration helper to own file 2011-11-25 06:18:59 +01:00
Ingo Weinhold
cba1e22376 Move PackageWriterListener to separate file 2011-11-25 06:18:59 +01:00
Ingo Weinhold
00bc8e9cbd 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.
2011-11-25 06:18:58 +01:00
Ingo Weinhold
de9e64b235 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.
2011-11-25 06:18:57 +01:00
Ingo Weinhold
443be501c0 Use fHeapOffset instead of sizeof(hpkg_header) 2011-11-25 06:18:57 +01:00
Ingo Weinhold
e6ebdaaf21 Move RegisterPackageInfo() to Finish() 2011-11-25 06:18:56 +01:00
Ingo Weinhold
78811461b1 Add BLowLevelPackageContentHandler section hooks
* Add hooks HandleSectionStart() and HandleSectionEnd(). They are
  invoked to bracket package file section, so the handler can
  discriminate which section the attributes belong to.
  HandleSectionStart() features a return parameter _handleSection, which
  allows to handler to pick which sections it wants to handle.
* "package dump" does now print the section names.
2011-11-25 06:18:55 +01:00
Ingo Weinhold
9395c27062 Move Debugger's Array class to headers/shared 2011-11-25 06:18:52 +01:00
Ingo Weinhold
b6d9fe9a6b PackageWriterImpl::_AddEntry(): Improve output
Print the relative path instead of only the leaf name.
2011-11-25 06:18:52 +01:00
Ingo Weinhold
8524dd3660 SubPathAdder: Check for overflows, omit initial / 2011-11-25 06:18:51 +01:00
Ingo Weinhold
2fce201893 BLowLevelPackageContentHandler interface extension
HandleAttributeDone(): Add parentToken parameter.
2011-11-25 06:18:50 +01:00
Ingo Weinhold
37880dd0a7 Remove debug output 2011-11-25 06:18:49 +01:00
Ingo Weinhold
d06e885aaf Print relative paths in error messages 2011-11-25 06:18:48 +01:00
Ingo Weinhold
37d971d3cc Support for extracting only specified entries 2011-11-25 06:18:48 +01:00
Ingo Weinhold
376bc55c27 Missing include 2011-11-25 06:18:47 +01:00
Ingo Weinhold
006056b7ee Add package extract -i option
Allows to specify an alternate location for the .PackageInfo.
2011-11-25 06:18:47 +01:00
Ingo Weinhold
93fc03aa52 Remove debug output 2011-11-25 06:18:46 +01:00
Ingo Weinhold
7395bf8a76 Add create -i option for specifying a package info 2011-11-25 06:18:45 +01:00
Ingo Weinhold
0f9a98a419 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.
2011-11-25 06:18:45 +01:00
Ingo Weinhold
cd8f03a8cc BPackageInfo::ReadFromConfigFile() BFile& version 2011-11-25 06:18:44 +01:00
Ingo Weinhold
b07fd63144 Add missing "cache" shine-through directory 2011-11-25 06:18:43 +01:00
Ingo Weinhold
85e13d1ef8 Remove the build platform work-arounds 2011-11-25 06:18:42 +01:00
Ingo Weinhold
02982802e6 Disable function remapping via macros
STL fstream::open() is used, so the macros break the build.
2011-11-25 06:18:41 +01:00
Ingo Weinhold
55bc371993 Wrap POSIX FD functions in libroot_build
This makes opening symlinks work universally in the build system tools.
Two mechanisms have been implemented, both of which don't always work.
The first is remapping via preprocessor macros. This fails where equally
named methods are used (e.g. STL fstream::open()). The other is using
hidden functions in the new libroot_build_function_remapper.a that is
linked into everything that is linked against libroot_build.so. This one
fails for functions that are defined inline in headers (Linux/glibc does
that). Together they seem to cover our build system needs ATM.
2011-11-25 06:18:41 +01:00
Ingo Weinhold
0fbcad54be Add helper is_unknown_or_system_descriptor() 2011-11-25 06:18:40 +01:00
Ingo Weinhold
640b4ed97d _kern_read_link() ignored the path 2011-11-25 06:18:40 +01:00
Ingo Weinhold
e6466c9a34 package extract: Delay setting node permissions
In HandleEntry() create the file/directory with sufficient permissions
for the user and set the archived permissions in HandleEntryDone(). This
makes sure child attributes and entries can be created.
2011-11-25 06:18:38 +01:00
Ingo Weinhold
f2db3c439d .OPD -> .PackageInfo conversion tool 2011-11-25 06:18:38 +01:00
Ingo Weinhold
4ebd3de828 Support package info [source] URL attributes 2011-11-25 06:18:37 +01:00