- When committing hardlinks, adjust st_nlink to "this is the n'th
link to this file" value instead of passing the total number of
links it'll have. This way we dont need a separate tracking variable
for whether permissions should be set or not, and plugins will
also have a reliable way to determining whether they're looking
at a hardlink or the actual file: on install we fake it, on erasure
it comes naturally from the stat() on the file.
- This eliminates a case where thing can entirely unnecessarily break
on live updates if you're "lucky" enough to do something in the
tiny window of time between rename of a file and fixing up its
permissions. Perhaps more importantly, this avoids overwriting
any existing files in case where we fail to set the permissions
at all.
- For regular metadata the physical path of the file is unintresting,
but for selinux label lookups we need the destination path
separately, hence the previous commits.
- fsmCommit*() and saveHardLink() never modify the stat, make this
more obvious with const. Change all the related accesses go
through the pointer instead of &fsm->sb. Doesn't change functionality
but opens possibilities of passing st as an argument.
- Exportdb simply dumps all the headers from rpmdb into simple header
list which is about as rpm-native and backwards and forwards compatible
format as they come. Importdb obviously, well, imports such a
list into rpmdb.
- Both require transaction handle: we dont want anybody running
transactions while exporting, and importing obviously requires
write-locking.
- This makes pubkey imports guarded by transaction lock, previously
they relied on rpmdb locking which is .. well.
- We grab the transaction handle as the first thing on entry: if
they key happens to be already imported then this is "unnecessary",
but if we only get the lock later then somebody else might have
imported the same key and we end up with dupes anyway.
- This is what rpmtsImportPubkey() does anyway, and database conversion
utilities will need it too. This is just a lock-protected
rpmdbAdd(): the caller is required to explicitly request a
transaction handle to guarantee just one transaction at a time.
- This allows API users to lock the transaction from other players
long before entering rpmtsRun(): for example depsolvers first do
calculations based on the rpmdb, download packages and only then
start the transaction. We dutifully waited for others to complete
on the ts lock inside rpmtsRun(), but those others could've
invalidated all our prior calculations so continuing was potentially
hazardous even. There are other uses too, we'll get to them
eventually...
- Separate lock object creation from lock acquisition: lazily (try
to) create the lock object from rpmtxnBegin() if it doesn't
already exist, otherwise rpmtxnBegin() and rpmtxnEnd() just
acquire and release the lock. After all this trouble, we can
actually nest transaction locks. At least in theory ;)
- For now this doesn't do anything particularly interesting, it
just replaces the transaction lock handle we use internally.
We want to export this interface but that needs further changes.
- Note that unlike our "normal" refcounts, this counts references to
the file descriptor itself: an open descriptor is one reference,
and acquired locks are on top of that.
- This also moves the NULL checks to the external interface, we
need to NULL-check there anyway so there's no point rechecking
in internals.
- This is a lock constructor that we might want to keep around,
but we'll also need to be able to separate new + acquire steps,
so just making room for that...
- Concrete functionality doesn't really change here, but this makes
it more explicit what kind of db handle is accepted and used
in each case: for example previously it was possible to open an
index iterator on Packages which does not work and returns garbage,
this should now return an error instead. Similarly extend iterator
etc only are appropriate with indexes, this forces the issue.
- While they all are implemented on key-value BDB store currently,
on the higher level packages and indexes are (obviously) fundamentally
different. Again this shouldn't change anything as such, just
further steps towards abstracting the low-level backend from
the rpmdb level.
- Create a db handle without opening it for the purposes of figuring
out which paths belong to us when moving and removing databases.
Shouldn't change anything, just steps towards removing dependencies
to global data.
- These differ a fair bit, so besides paving way for next steps
this makes the code somewhat easier to follow.
- rpmdbOpenIndex() is now mostly just a dumb wrapper that can
be eliminated later.
- Some places dont care about the actual dbi, in others this
just makes things more simple, and this allows us to return
more meaningful error codes than just success/fail.
- This shouldn't change anything, except for a couple of additional
error checks but these should be "can't happen" cases.
- As it happens, these two cases have actually fairly little in common.
Besides paving the way for next steps, this actually makes the code
easier to follow.
- Rpm installation only creates /var if configured in specific way,
but the test-suite relies on /var being there. Ensure its always
there regardless of how rpm was configured.
- The previous "echo $0" got actually expanded to the temporary
build-time script name, something like /var/tmp/rpm-tmp.UtGhG1,
which isn't what we're interested in, and depends on rpm
configuration so can easily cause false positives. Just use
%{name}-%{version} to get stable content.
- Rpm might be configure'd with a _tmppath that isn't writable
or even existing on the build-host, force our testing tmp directory
to be used for package builds which cannot be executed within the
test-root.
- Fixes a few false positives in the test-suite by making it less
reliant on the configuration of the built rpm and build host
- The test-suite expected results are hardcoded, so we can't rely
on rpm-defined macros as those reflect rpm's own configuration
which could be something entirely different than our expectations.
- Fixes another big pile of false positives in the test suite
- Autoconf leaves things like @localstatedir@ unexpanded at build-time
on purpose so the paths can be overridden during "make install".
However this leaves %{_var} in macros in its unexpanded state
unless --localstatedir is explicitly passed in, which does not
work very well for rpm.
- Process the main macros file through the same meat grinder as
the platform macros. Ugly as sin but... it brings the casual
"./configure; make; make check" sequence much closer to working.
When srcdir != builddir the data has to be copied over from the srcdir.
When any of the required progs comes from /usr/bin then there also needs
to be a usr/bin under testing. Just use the same symlink as for testing/bin.
Signed-off-by: Panu Matilainen <pmatilai@redhat.com>
When configuring with srcdir != builddir the find-requires link would fail:
ln: failed to create symbolic link './autodeps/find-requires'
Do the link in the same way as find-provides with an explicit ${srcdir}.
Signed-off-by: Panu Matilainen <pmatilai@redhat.com>
- This actually makes the code a good deal simpler than the former
"simple" array-based stack. Besides that, this moves things into
direction where we could have properly opaque per io-type objects.
- Fclose() is still trickier than it should be due to statistics
and whatnot...
- fd, fmode and fdno are already checked for in Fdopen(), no need
to bother here. In addition, previously if the compressed open
failed we probably leaked the fd as we had already set the underlying
fdno to -1.
- The fd will be nuked on close anyway so there's nothing we can
do to preserve possible custom errors from the compressed types.
Just return return -1 on errors in case somebody cared.