Commit Graph

41213 Commits

Author SHA1 Message Date
Ingo Weinhold
b8ae1eb25d Volume::_RemoveNodeAndVNode(): Squash TODO
Only get/remove/put the vnode when the node is actually known to the
VFS. This does not only save unnecessary work, it also solves a
(temporary) deadlock -- at least partially. If another thread caused a
call to our get_vnode() hook just before, it would block on the volume
lock we're holding when adding/removing packages. The vnode would be
marked busy until the other thread's request was fulfilled and our call
to get_vnode() would block until timing out. Now we're calling
get_vnode() only, if we already know that the VFS already has a valid
vnode.

There still remains a race condition. If the VFS discards the vnode
right before we call get_vnode(), we essentially have the same situation
as before (i.e. us calling get_vnode() although the vnode is no longer
known to the VFS) with the same potential problem. For a real solution
we need a get_vnode() variant which can be told not to block.
2011-11-25 06:20:05 +01:00
Ingo Weinhold
bbf2abc503 Node: Keep track of VFS init status
* Node::VFSInit() and VFSUninit() set/clear the new node flag
  NODE_FLAG_KNOWN_TO_VFS. They need to be called by overriding methods,
  now.
* Add Node::IsKnownToVFS() which returns the VFS init status.
2011-11-25 06:20:05 +01:00
Ingo Weinhold
d9ec209546 Fix removing dependencies on package removal
The dependencies must also be dissociated from the resolvables they have
been resolved to.
2011-11-25 06:20:04 +01:00
Ingo Weinhold
564f56b150 Fix node handling on package addition/removal
* UnpackingLeafNode: Add a fFinalPackageNode attribute. It is set when
  the node is about to be removed and will point to the node's previous
  head package node and be used in its stead. From the perspective of
  the FS hooks this leaves the node in an unchanged state.
* Unpacking[Leaf,Directory]Node:
  - Add WillBeFirstPackageNode(), returning whether the given package
    node would become the head package node when added.
  - Add PrepareForRemoval() which removes all package nodes. In case of
    UnpackingLeafNode it also sets fFinalPackageNode.
  - Add CloneTransferPackageNodes(). It is only implemented for
    UnpackingLeafNode. It clones the node, transfers all package nodes
    to the clone and sets fFinalPackageNode on this node.
* Volume::_{Add,Remove}PackageNode(): Solved the following TODO: When a
  package is added or removed and a file present in both the
  added/removed package and another package with the version in the
  former having precedence, we have to remove the node (leaving it
  unchanged) and replace it by a new node. This prevents clients having
  the node opened or mapped from suddenly seeing different data. It also
  fixes unbalanced calls to PackageNode::VFSInit()/VFSUninit() which
  would result in file descriptors to package files being leaked.
2011-11-25 06:20:03 +01:00
Ingo Weinhold
4ba3c257e4 Fix package removal with skipped directories
Volume::_RemovePackageContentRootNode(): Check whether a directory
corresponding to the package directory does actually exist. This might
not be the case when the package directory has been skipped due to
clashing with a shine-through directory. Would crash in this case.
2011-11-25 06:20:03 +01:00
Ingo Weinhold
863eb983f8 Fix typo 2011-11-25 06:20:02 +01:00
Ingo Weinhold
085f6723a4 Fix build due to <directories.h> move
Apparently I should have done a complete rebuild after moving
directories.h from headers/private/libroot to .../system, since a lot of
stuff didn't build anymore.
2011-11-25 06:19:50 +01:00
Ingo Weinhold
9213e9d6a8 Add BPackageRoster::GetActivePackages()
The implementation is temporary. Currently it reads through the packages
in the respective packages directory and checks against the package
links. Once package activation is tracked explicitly we'll use the
activation file/directory.
2011-11-25 06:19:49 +01:00
Ingo Weinhold
26265b7b4d Add class BPackageInfoContentHandler
A BPackageContentHandler subclass that initializes a BPackageInfo from
the read package attributes. Pulled out of RepositoryWriterImpl's
PackageContentHandler.
2011-11-25 06:19:48 +01:00
Ingo Weinhold
dbe2a683f0 find_directory(): Fix package links path 2011-11-25 06:19:48 +01:00
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
14f94ae7d4 Fix location of the Deskbar menu symlinks
Conflicts:

	build/jam/OptionalPackages
2011-11-25 06:19:34 +01:00
Ingo Weinhold
609fc55f96 Rename the package links directory
Rename the package links directory from /package-links to just
/packages.
2011-11-25 06:19:33 +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