Panu Matilainen [Mon, 11 Jul 2011 06:19:55 +0000 (09:19 +0300)]
Remove pointless fdSeekNot() "not implemented" function
- Fseek() and friends already return -2 for not implemented functions,
this is not needed at all
Panu Matilainen [Fri, 8 Jul 2011 11:54:42 +0000 (14:54 +0300)]
Add a simple test for Fflush() functionality in python
- Prior to previous patch this segfaulted and tracebacked...
Panu Matilainen [Fri, 8 Jul 2011 11:48:54 +0000 (14:48 +0300)]
Fix totally broken Fflush() operation
- This only ever worked for fpio, for all other types it returns
bogons or crashes and burns.
- Use the file op vectors to find our fflush function instead
of #ifdef/#endif if/else/ifelse jungle.
- Notably fdio and ufdio do not have a fflush() equivalent because
they dont need one. Use a dummy function to always return success to
differentiate from -2 aka "not supported by this io type"
Panu Matilainen [Fri, 8 Jul 2011 07:43:00 +0000 (10:43 +0300)]
Axe the broken fpio support for good
- The whole thing is extremely hacky and failing to properly take
fundamental differences in eg fread() and read() semantics into
account (the whole rpmio fd is confused over this: Fread() claims
to be fread() clone but reads behave with read() semantics
and we dont provide feof() equivalent etc), special cased all over
the io code when vectors exist for this purpose etc (not that fpio
is the only offender in that regard)... RIP. Nothing should miss
this but if we'd ever want to add it back, it'd better be done
right at least.
- This COULD silently break somebody's code if they rely on the broken
special case semantics of fpio mode, but most likely rpm itself
was the only thing using fpio (and relying on the behavior) and
even then, mostly only to get a FILE stream pointer out of it.
Now we'll just silently return a fdio descriptor, as we do for any
unrecognized io mode... (another sigh)
Panu Matilainen [Fri, 8 Jul 2011 07:31:34 +0000 (10:31 +0300)]
zlib is mandatory, fail at configure if missing + remove conditionals
- Unlike bz2 and xz/lz, zlib compression is not tracked by any rpmlib
feature and is part of the original package format really, zlib
simply must be always present.
Panu Matilainen [Fri, 8 Jul 2011 07:20:02 +0000 (10:20 +0300)]
Eliminate the last two fpio uses in rpm codebase
- Both relate to reading manifests and it doesn't make the damnest
difference what io mode these use as rpmReadPackageManifest()
opens its own stream on the fd with fdopen() which works on
any io type, not just fpio..
Panu Matilainen [Fri, 8 Jul 2011 07:18:53 +0000 (10:18 +0300)]
Eliminate the uuugly and stupid fdGetFILE() from the API
Panu Matilainen [Thu, 7 Jul 2011 19:51:29 +0000 (22:51 +0300)]
If we need a FILE stream then get one...
- Replace the hysterical "lets see if the temp creation gave an fpio
fd (it didn't), if not open another fd and then get its private
FILE pointer" fiddling: since we need a FILE stream then open one
with fdopen(), duh. Grabbing a rpmio fd to begin with is stupid enough
when all we want is a stream, but wanting to use rpmMkTempFile()
functionality...
- Also fixes an fd+mem leak in the unlikely but possible case that
rpmMkTempFile() succeeds but fdopen() fails.
Panu Matilainen [Thu, 7 Jul 2011 14:26:56 +0000 (17:26 +0300)]
Take advantage of Fdescr() in rpmReadPackageFile()
- If fn to rpmReadPackageFile() is NULL, use Fdescr() value to give
more meaningful errors
- Change a couple of places where we haven't got a clue of the file
name to take advantage of the above
Panu Matilainen [Thu, 7 Jul 2011 13:27:03 +0000 (16:27 +0300)]
Teach python rpmio bindings about Fdescr()
- Similarly to python file object having o.name, export Fdescr()
as fd.name. Python uses <foo> for non-paths but [foo] seems like
a safer choice wrt accidental redirections.
- Also add a basic testcase for fd.name
Panu Matilainen [Thu, 7 Jul 2011 12:47:47 +0000 (15:47 +0300)]
Remember path (or other description) in fd's, add getter
- If opened by path, we obviously want to use that. Otherwise
generate a description lazily on first Fdescr() call: on Linux
we can grab something relatively meaningful by looking up from /proc
(this is why we want to be lazy here...). If that's not available
or fails, just generate a string on the current fdno. Actual
paths are returned as is, other descriptions are bracketed,
(eg "[mumble 123]").
- This makes it possible to give more meaningful error messages in
places where we only get an fd from somebody (related to RhBug:522160)
Panu Matilainen [Thu, 7 Jul 2011 10:55:16 +0000 (13:55 +0300)]
Eliminate fdNew() from the API
- Nobody should be able to create file descriptors which are not
attached to a file/descriptor of some kind, the only sane
fd constructors are Fopen(), Fdopen() and fdDup().
- The same applies to fdFree() but its a bit more complicated,
punting that till later...
Panu Matilainen [Thu, 7 Jul 2011 08:55:28 +0000 (11:55 +0300)]
Further streamline & sanitize lead handling
- Never log anything from rpmLeadRead(), instead return an error message
the callers can log if they see fit
- Add a return value for the lead type (which is the only bit of
info from the lead we sometimes resort to using)
- Permit NULL pointers on all return values
- Eliminate rpmLeadCheck() and rpmLeadType() from the internal API,
these are now combined into rpmLeadRead().
- Fix up the callers: only (re)signing needs the actual lead,
signature verification only cares if its valid or not and
package reading only wants the type from the lead (annoying but...)
Panu Matilainen [Thu, 7 Jul 2011 08:17:29 +0000 (11:17 +0300)]
Only bother mallocing lead for return if read actually succeeded
- Doesn't make much of a difference now, just paving way for next steps
Panu Matilainen [Wed, 6 Jul 2011 09:53:59 +0000 (12:53 +0300)]
Eliminate remaining assert()'s in rpmlead.c
- Blowing up with assert() on freeing NULL is just dumb...
- rpmLeadWrite() can easily be made to handle NULL lead gracefully
Panu Matilainen [Wed, 6 Jul 2011 09:42:56 +0000 (12:42 +0300)]
Make rpmLeadRead() return an allocated lead, fixup callers
- Requiring callers to allocate a lead "buffer" for reading into
is just DUMB (greetings to self back in 2008, sigh). This avoids
having to deal with freeing the lead in case the read failed, and
allows getting rid of rpmLeadNew() completely.
Panu Matilainen [Wed, 6 Jul 2011 09:09:21 +0000 (12:09 +0300)]
Start beating a little bit of sense into the braindamaged rpmlead API
- rpmLeadNew() should not populate the struct, only allocate it
- The only case where we're creating new lead data is
rpmLeadFromHeader(), move all initialization there, and add a comment
for RhBug:717898. Also eliminate the stupid assert, we can
easily handle NULL header here.
Panu Matilainen [Wed, 6 Jul 2011 08:20:44 +0000 (11:20 +0300)]
Add tests for header getattr() behavior sanity
Panu Matilainen [Wed, 6 Jul 2011 08:05:42 +0000 (11:05 +0300)]
Fix the broken python header __getattr__() behavior, take 13 (or so)
- Tags as header attributes seemed like a nice idea at the time... but
has been a PITA due to side-effects it causes, such as breaking
getattr() use for "capability testing", eg:
>>> h2 = copy.deepcopy(h)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib64/python2.7/copy.py", line 172, in deepcopy
copier = getattr(x, "__deepcopy__", None)
ValueError: unknown header tag
- Since we can't really go removing the brainded feature (somebody might
actually be using it) try harder to fix it: if its not an actual
attribute, save the exception we got from PyObject_GenericGetAttr()
and if its not a valid tag either, restore the original exception.
This allows cases like the above __deepcopy__ to work properly.
Panu Matilainen [Wed, 6 Jul 2011 07:22:01 +0000 (10:22 +0300)]
Add __reduce__() method to python header object
- This allows header objects to be pickled and also copied correctly
with python's copy.copy()
- Split the header to string-conversion into a separate helper function,
used by the now largely unnecessary unload() method and __reduce__().
Panu Matilainen [Wed, 6 Jul 2011 05:16:12 +0000 (08:16 +0300)]
Revert the ds, ts, fi and spec python object creation commits
- Hasty push-finger syndrom, while its not exactly plain wrong to
do things this way, it doesn't really make sense for these types
either. Python's own file object permits reinitialization though,
so leaving rpm.fd() the way it is now.
- This reverts the following commits:
d056df28c38e602d82b4f9b527c686037074e660
3f77c3146da46a49f44b17fa66139fbe2dd9e45c
7214b2e0a271b7a7b3df312c58593878cbf56504
dc50fb2863c81159fb4cc8b25ce3862720c0cce5
Panu Matilainen [Tue, 5 Jul 2011 19:46:18 +0000 (22:46 +0300)]
Bring back c++ "protection" to rpmsq, oops
- The beginning of c++ extern block went with the dishwater in commit
269df02ae1fc3955bee4e5f471b1172c04c714e2
Panu Matilainen [Fri, 1 Jul 2011 11:39:19 +0000 (14:39 +0300)]
Fix/sanitize rpm.ds python object creation a bit
- Move all actual initialization work into tp_init, permit
reinitialization without leaking and use PyType_GenericNew for tp_new.
Panu Matilainen [Fri, 1 Jul 2011 11:25:47 +0000 (14:25 +0300)]
Fix/sanitize rpm.ts python object creation a bit
- Move all actual initialization work into tp_init, permit
reinitialization without leaking and use PyType_GenericNew for tp_new.
Panu Matilainen [Fri, 1 Jul 2011 10:37:48 +0000 (13:37 +0300)]
Fix/sanitize rpm.fi python object creation a bit
- Move all actual initialization work into tp_init, permit
reinitialization without leaking and use PyType_GenericNew for
tp_new, eliminate internal rpmfi_Wrap() use.
There's one user for rpmfi_Wrap() in rpmte-py.c which needs fixing
later...
- Remove unused fiFromFi() helper function
Panu Matilainen [Fri, 1 Jul 2011 09:55:53 +0000 (12:55 +0300)]
Fix/sanitize rpm.spec python object creation
- Specs are not really immutable, move the initialization work into
tp_init and use PyType_GenericNew for tp_new since we're not
doing anything special there.
- Eliminate the stupid spec_Wrap() thing and hide specPkg_Wrap()
out of side (TODO later...)
Panu Matilainen [Fri, 1 Jul 2011 09:33:55 +0000 (12:33 +0300)]
Add a simple and stupid test case for python spec parse
Panu Matilainen [Fri, 1 Jul 2011 09:08:04 +0000 (12:08 +0300)]
Fix/sanitize rpm.fd python object creation
- FD's are not really immutable, move the initialization work into
tp_init and use PyType_GenericNew for tp_new since we're not
doing anything special there.
- Remove half a dozen different unnecessary exit points
Panu Matilainen [Fri, 1 Jul 2011 08:19:02 +0000 (11:19 +0300)]
Fix the totally broken rpm.fd() read method
Panu Matilainen [Fri, 1 Jul 2011 08:14:26 +0000 (11:14 +0300)]
Add basic test for rpmio python bindings
Panu Matilainen [Tue, 28 Jun 2011 10:01:59 +0000 (13:01 +0300)]
Fix explicit directory %attr() when %defattr() is active (RhBug:481875)
- parseForAttr() doesn't know whether it's dealing with a directory or
a file, so it can't know which defaults it should use.
Move all the decision making on which of the explicit/default/implicit
attributes into addFile() where we do know what kind of entry we're
dealing with, and only parse in parseForAttr().
- Update the test-case status to expect success now.
Panu Matilainen [Tue, 28 Jun 2011 07:34:13 +0000 (10:34 +0300)]
Add a test-case for various %attr and %defattr combinations
- Currently this fails expectedly due to RhBug:681540 on the last
directory of the test rpm.
Panu Matilainen [Tue, 28 Jun 2011 05:37:41 +0000 (08:37 +0300)]
Enable GLOB_ONLYDIR of the bundled glob() on platforms that support it
Panu Matilainen [Mon, 27 Jun 2011 11:52:22 +0000 (14:52 +0300)]
Pay attention to dir vs file when building (RhBug:505995)
- Preserve trailing slash if it exists, and also add one on explicit
%dir entires. This lets rpmGlob() and friends to skip any matching
files that might be present, fixing both test-cases in RhBug:505995.
Panu Matilainen [Mon, 27 Jun 2011 11:09:17 +0000 (14:09 +0300)]
Honor trailing slash in rpmGlob()
- Only return directories if a pattern contains a trailing slash.
Use GLOB_ONLYDIR hint if available but as this is unreliable,
we need to stat the paths to be sure.
- Hysterically enough, rpm bundles its own copy of glob() which does
have GLOB_ONLYDIR but ATM it doesn't get build because HAVE_D_TYPE
isn't defined outside glibc build environment which is where our glob
originally came from...
Panu Matilainen [Mon, 27 Jun 2011 09:41:39 +0000 (12:41 +0300)]
Remove ugly isDir recurse prevention hack on build
- We know if we're already fts-walking by the way addFile() gets called,
dont corrupt fl->isDir for no good reason.
Panu Matilainen [Thu, 23 Jun 2011 06:47:10 +0000 (09:47 +0300)]
Eliminate static BUFSIZ use in filelist parsing
- In the unlikely event of filelist line being longer than BUFSIZ
we'd previously end up truncating the line, which is stupid
since we can just as easily make the buffer large enough.
Panu Matilainen [Tue, 21 Jun 2011 13:27:18 +0000 (16:27 +0300)]
Use ARGV_t for filelist current locale storage
- Avoids having to manually do search, sort, join, free etc for
no good reason. Could be further simplified with argvSplit() etc
and sanitized overall but leaving that for another day...
Panu Matilainen [Tue, 21 Jun 2011 11:53:05 +0000 (14:53 +0300)]
Eliminate redundant noGlob member from filelist
- Since the only thing where globs are not permitted are %dev entires,
check for device explicitcly in the glob part. Doh.
Panu Matilainen [Tue, 21 Jun 2011 11:43:03 +0000 (14:43 +0300)]
Eliminate redundant special docs tracking members in filelist
Panu Matilainen [Tue, 21 Jun 2011 11:33:48 +0000 (14:33 +0300)]
Eliminate unused fileCount member from FileList struct
Jakub Jelinek [Fri, 17 Jun 2011 13:40:20 +0000 (16:40 +0300)]
Add DWARF-4 support to debugedit (RhBug:707677)
Signed-off-by: Panu Matilainen <pmatilai@redhat.com>
Panu Matilainen [Fri, 17 Jun 2011 11:25:44 +0000 (14:25 +0300)]
Avoid extra newlines in parsed spec output outside preamble
Panu Matilainen [Fri, 17 Jun 2011 10:53:43 +0000 (13:53 +0300)]
Add --parse option to rpmspec tool to dump parsed spec contents
- This is somewhat like 'gcc -E', useful for analyzing/troubleshooting
what happens inside the preprocessing.
Panu Matilainen [Fri, 17 Jun 2011 10:44:39 +0000 (13:44 +0300)]
Support retrieving the spec contents in parsed format
- Collect the preprocessed (conditionals, macros etc evaluated)
lines to a separate stringbuf, make rpmSpecGetSection() return
that on RPMBUILD_NONE "section" (hack, but so is abusing RPMBUILD_FOO
for the section here so shrug)
Panu Matilainen [Thu, 16 Jun 2011 16:21:54 +0000 (19:21 +0300)]
Error on unclosed macros & trailing line continuations in spec (RhBug:681567)
- Track the starting line in case copyNextLineFromOFI() indicates
a multiline-construct. If we get an EOF from readLineFromOFI()
while inside multiline read, its an illegal construct of some kind
and we can even spit out a reasonably meaningful error pointing
out the starting line number of the bad construct.
Panu Matilainen [Thu, 16 Jun 2011 09:26:42 +0000 (12:26 +0300)]
Try to generate fileclass in the tag ext at runtime if missing from header
- For non-regular files we can easily generate this information based
on file mode + in case of symlinks, the link target is available
in the header elsewhere. This also means --fileclass will return
at least partial data for packages built with the external depgen.
- Clean up fileclassTag() a bit while at it, removing redundant fluff.
- Arguably this "magic" should be done inside rpmfiFClass() instead, but
that'd require changing the API to return malloced data.
Panu Matilainen [Thu, 16 Jun 2011 05:48:57 +0000 (08:48 +0300)]
Export rpmteFailed() to python bindings
- Kinda related to RhBug:661962, yum relies on callbacks to catch
install/erase errors but this is not accurate: on erase the
element can be ambiguous as the callback only gives a name (sigh).
In addition, elements can be skipped entirely if "parent" element
fails, in which case no callbacks are issued so these cases would go
completely unnoticed when relying on callbacks alone. te.Failed()
gives users such as yum a chance to have a look at the real status
of elements (after the transaction).
Panu Matilainen [Mon, 13 Jun 2011 08:52:54 +0000 (11:52 +0300)]
Don't remove buildroot docdir on %doc usage (ticket #836)
- Some software installs its own documentation and if you try to
combine it with %doc, rpmbuild will abort with mysterious
"cpio bad magic" or such errors because what was assumed to be
there was not, as %doc would 'rm -rf' the docdir upon first
invocation. I don't see any good reason to disallow sharing the
same directory for %doc and documentation installed by software
"make install" - the other alternative would be forcing %doc to
go to some other location, only making docs harder to find.
- Also at least Mageia (and prior to that Mandriva) has been doing
this for quite some time now.
Panu Matilainen [Fri, 10 Jun 2011 09:08:45 +0000 (12:08 +0300)]
Adjust script detection rules to work with file >= 5.07 too (RhBug:712251)
- Somewhere between file 5.05 and 5.07 it started adding encoding
to script descriptions, eg "<mumble> script text executable" became
"<mumble> script, <encoding> text executable" breaking what had
been working for 10+ years in the case of old find-requires.
- Permit either comma or space after "script", this works for both
old and new file.
Panu Matilainen [Thu, 9 Jun 2011 12:13:46 +0000 (15:13 +0300)]
Add bunch of further rpm-python tests for this and that
Panu Matilainen [Thu, 9 Jun 2011 11:25:37 +0000 (14:25 +0300)]
Eww, python ds.Instance() doesn't take any arguments
- ...means its been broken all along, sigh
Panu Matilainen [Thu, 9 Jun 2011 10:44:10 +0000 (13:44 +0300)]
Add a bunch of db match/key iterator test-cases in python
- This would've caught the breakage introduced in commit
7e4415fcc5e11cfd4cd9d0dfe19568be73f15d74, but better late than never...
Panu Matilainen [Thu, 9 Jun 2011 10:19:14 +0000 (13:19 +0300)]
Rearrange test-suite python helper macros a bit
- Handle double [] "escaping" at RPM_PYRUN to avoid surprises when
its used on its own
- Spin python-wrapped AT_CHECK into a macro of its own (RPMPY_CHECK)
- What formerly was RPMPY_CHECK is now RPMPY_TEST: this represents
one entire testcase with all its setup and cleanup, whereas
RPMPY_CHECK (the new one) might be used several times within a
single test
Panu Matilainen [Thu, 9 Jun 2011 09:45:42 +0000 (12:45 +0300)]
Fix the non-keyed match iteration case wrt DB_NOTFOUND
- This broke in commit
7e4415fcc5e11cfd4cd9d0dfe19568be73f15d74,
the cases are not identical afterall: With non-keyed cursor
retrievals DB_NOTFOUND is returned when there's nothing more to
get, this is not an error situation.
Panu Matilainen [Thu, 9 Jun 2011 09:38:53 +0000 (12:38 +0300)]
Use dbiCursorGetToSet() for the non-keyed match-iterator case too
Panu Matilainen [Thu, 9 Jun 2011 08:33:38 +0000 (11:33 +0300)]
Support set append in dbiCursorGetToSet()
- If called with an existing set, results are appended. Otherwise
return a newly allocated set.
Panu Matilainen [Thu, 9 Jun 2011 08:32:39 +0000 (11:32 +0300)]
If key not specified, use DB_NEXT cursor mode (DB_SET wouldn't make sense)
Panu Matilainen [Thu, 9 Jun 2011 08:26:32 +0000 (11:26 +0300)]
Only honor keylen if keyp is also specified
Panu Matilainen [Thu, 9 Jun 2011 08:07:21 +0000 (11:07 +0300)]
Make it an error to call dbiGetToSet() with NULL keyp
- All current callers always supply non-NULL keyp, and requiring
this gives useful possibilities elsewhere
Panu Matilainen [Wed, 8 Jun 2011 16:01:13 +0000 (19:01 +0300)]
Move the remaining DBT's in rpmdbInitIterator() to (more) local scope
Panu Matilainen [Wed, 8 Jun 2011 15:59:20 +0000 (18:59 +0300)]
Error/notfound case is handled the same for both these cases
Panu Matilainen [Wed, 8 Jun 2011 15:52:30 +0000 (18:52 +0300)]
Take advantage of dbiCursorGetToSet() in dbiFindByLabel() & friends
- Reduces the number of arguments to somewhat saner level and
eliminates another reincarnation of the dbt2set() + error handling
code littered all over the place.
Panu Matilainen [Wed, 8 Jun 2011 15:46:45 +0000 (18:46 +0300)]
Split actual cursor get + set-conversion to separate function
- Allows multiple retrieves on a single cursor instance, dbiGetToSet()
is just a convenience wrapper around dbiCursorGetToSet() now.
- Creating and tearing down cursors isn't exactly terrifyingly
expensive but still measurable when lots of lookups are done.
Panu Matilainen [Wed, 8 Jun 2011 15:44:39 +0000 (18:44 +0300)]
Add cursor method for retrieving the underlying db index handle
Panu Matilainen [Wed, 8 Jun 2011 11:53:36 +0000 (14:53 +0300)]
Add tests for the most common nvra query combinations
Panu Matilainen [Wed, 8 Jun 2011 10:33:41 +0000 (13:33 +0300)]
Use dbiGetToSet() in rpmdbFindByFile(), lose now unnecessary arguments
Panu Matilainen [Wed, 8 Jun 2011 10:27:35 +0000 (13:27 +0300)]
Use dbiGetToSet() for the common case in rpmdbInitIterator()
Panu Matilainen [Wed, 8 Jun 2011 10:15:02 +0000 (13:15 +0300)]
Simplify + cleanup rpmdbExtendIterator()
- Use the new dbiGetToSet() for doing the actual work, reducing
fluff considerably
- Don't bother checking for NULLs where the lower levels do it
already (mi and keyp NULL-checks are necessary here though)
Panu Matilainen [Wed, 8 Jun 2011 10:02:28 +0000 (13:02 +0300)]
Simplify + cleanup rpmdbCountPackages()
- Use the new dbiGetToSet() for doing the actual work, reducing
fluff considerably
- Dont bother checking for NULL db, rpmdbOpenIndex() does this anyway
- Return an error, not 0 (ie "not found") for NULL db and name
- Remove redundant dbtag variable, this is always RPMDBI_NAME
Panu Matilainen [Wed, 8 Jun 2011 09:52:12 +0000 (12:52 +0300)]
Add a helper function to convert cursor retrievals to dbiIndexSets
- This stuff is repeated in rpmdb.c all over the place, to some
this suggests making it into a function:
- Hide the DBTs inside the function
- Handle keylen fixups, set conversions and error logging centrally
Panu Matilainen [Wed, 8 Jun 2011 09:32:48 +0000 (12:32 +0300)]
Rename dbiFreeIndexSet() to dbiIndexSetFree() for naming style consistency
Panu Matilainen [Wed, 8 Jun 2011 08:57:14 +0000 (11:57 +0300)]
Minor cleanup to rpmdbFindByFile()
- Pass the dbi we already opened in rpmdbInitIterator() as argument
instead of unnecessarily reopening in rpmdbFindByFile()
- Adjust the argument order to match that of dbiFindByLabel()
for consistency
- Remove redundant error code assignment, we are already assuming error
Panu Matilainen [Wed, 8 Jun 2011 08:48:37 +0000 (11:48 +0300)]
Push cursor init+free down to dbiFindByLabel()
- The cursor is fully local to dbiFindByLabel() so there's no
point passing it as an argument
Panu Matilainen [Wed, 8 Jun 2011 08:00:40 +0000 (11:00 +0300)]
Handle EINTR on the spot instead of restarting the entire loop
- The previous code was violating the "golden rules of select()" by
possibly skipping processing of fd's that were included in the
select() set. Also restarting the entire loop should not be
necessary in case of EINTR select(), our conditions do not change
in that situation.
Panu Matilainen [Wed, 8 Jun 2011 07:06:15 +0000 (10:06 +0300)]
Kick out self-pipe trick from depgen helper
- As we're not actually /doing/ anything with signals here, the self-pipe
is not needed: select() will get interrupted and re-evaluated when the
child exits so we can't get stuck there.
- Free "I spotted a classic dailywtf overcomplication" t-shirt goes to
Michael Schroeder for pointing this out.
Panu Matilainen [Wed, 8 Jun 2011 07:01:14 +0000 (10:01 +0300)]
Abort depgen output reading on EOF, not child exiting
- There could, at least in theory, still be data to read after
we receive SIGCHLD. Stop the loop on EOF on read instead.
Thanks to Michael Schroeder for pointing this out.
Panu Matilainen [Mon, 6 Jun 2011 10:10:32 +0000 (13:10 +0300)]
Return explicit NULL from dbiFreeIndexSet()
- Explicit NULL is much more obvious here, also eliminate the (now)
dead NULL-assignments and add a trash-n-burn memset() just in case
Panu Matilainen [Mon, 6 Jun 2011 10:09:15 +0000 (13:09 +0300)]
Cosmetics: function blocks start on a new line
Panu Matilainen [Wed, 1 Jun 2011 10:29:03 +0000 (13:29 +0300)]
Lift Dijkstra algorithm out of collectSCC() to separate function
- This splits outs nicely, moving queue allocation into separate
scope and making collectSCC() less of an heavy-weight.
No functional changes.
Panu Matilainen [Wed, 1 Jun 2011 09:40:55 +0000 (12:40 +0300)]
Eliminate struct copy in collectSCC(), use a pointer instead
- collectSCC() doesn't actually modify the SCC struct it looks at
so operating on a copy is harmless, but using a (const) pointer
to the original makes the idea more clear (we're not modifying
the scc struct here, only its members)
Panu Matilainen [Wed, 1 Jun 2011 08:31:55 +0000 (11:31 +0300)]
Clean up + simplify pgpsigFormat()
- Don't do manually what the computer can do for you, let rasprintf()
calculate the string sizes
- Handle possible date conversion errors: if we can't format the
date correctly then at least show the integer value along with
a complaint
Panu Matilainen [Wed, 1 Jun 2011 07:00:04 +0000 (10:00 +0300)]
Split the --replacepkgs hack to a helper function and document it
- Makes the huge rpmpsmStage() that little bit smaller, this
special-case code does not belong inline there. Also gets rid
of couple of dead assignments and unnecessary variable.
- Don't bother unless RPMPROB_FILTER_REPLACEPKG is set, it's not
terribly expensive but its also wholly unnecessary in the normal case
- Document how the dang thing "works"
Panu Matilainen [Wed, 1 Jun 2011 06:35:47 +0000 (09:35 +0300)]
Make test-case for --replacepkgs stricter
- Actually verify we got the expected result, ie exactly one instance
of the pkg installed after successful reinstall.
Panu Matilainen [Wed, 1 Jun 2011 06:01:24 +0000 (09:01 +0300)]
Reset cli configured flag on rpmcliFini() (RhBug:709421)
Panu Matilainen [Tue, 31 May 2011 12:32:44 +0000 (15:32 +0300)]
Cleanup rpmpsmNew() and rpmpsmFree()
- Remove redundant checks and other fluff, including dead
NULL-assignments on free
Panu Matilainen [Tue, 31 May 2011 09:43:15 +0000 (12:43 +0300)]
Remove reamining dead assignments from rpmtsiFree() in transaction code
- Not all of these are at the end of local scope and in many cases
the iterator pointer is reused, but the logic in all these is
straightforward enough (no jumps etc) that there's no much
chance of mistakenly using already freed iterator.
Panu Matilainen [Tue, 31 May 2011 09:35:18 +0000 (12:35 +0300)]
Remove dead NULL-assignment before reassign
Panu Matilainen [Tue, 31 May 2011 09:27:58 +0000 (12:27 +0300)]
Remove superfluous localtime() call
- The tm pointer is reset to localtime(&when) before accessed,
this is nothing but a dead call and assignment
Panu Matilainen [Tue, 31 May 2011 08:57:45 +0000 (11:57 +0300)]
Remove dead keyp & keylen assignments in rpmdbNextIterator()
- Both get assigned to their values earlier in the loop and neither
is used beyond this point in the loop .. so these are useless.
Panu Matilainen [Tue, 31 May 2011 08:38:38 +0000 (11:38 +0300)]
Clean up + clarify popMacro() a bit
- Actually protect against NULL mep (shouldn't happen but...)
- Remove bogus comment + add actually relevant comments
- Make the *mep reassignment more obvious by taking it out of
the if where its easily missed
- Replace dead NULL-assignments with a trash-n-burn memset()
- Fixup indentation to match general rpm style
Panu Matilainen [Tue, 31 May 2011 07:38:17 +0000 (10:38 +0300)]
Use popMacro() when freeing the entire macro table
- We already have a function to free macro entries, use it to
remove code duplication
Panu Matilainen [Tue, 31 May 2011 06:02:29 +0000 (09:02 +0300)]
Pass dbiClose() flags down to db->close()
- BDB of old might not have taken flags there but current ones
do accept DB_NOSYNC to be specified (not that we use it but...)
- As a side-effect this eliminates another dead assignment
Panu Matilainen [Tue, 31 May 2011 05:59:21 +0000 (08:59 +0300)]
Return an explicit NULL from dbiFree(), remove dead assignment
Panu Matilainen [Tue, 31 May 2011 05:38:09 +0000 (08:38 +0300)]
Remove bogus condition on provide checking in query
- RPMQV_WHATPROVIDES only falls through to RPMQV_PATH on absolute
paths, so the only place checking for provides_checked value would
never be reached in the case it was set.
- Add a comment about the fallthrough case
Panu Matilainen [Mon, 30 May 2011 14:13:51 +0000 (17:13 +0300)]
Eliminate dead NULL-assignment by avoiding unnecessary allocation
- cpioHeaderRead() only needs to alloc after successfully reading
the next filename from the cpio header, delay alloc until
we know the read was successful.
Panu Matilainen [Mon, 30 May 2011 12:54:16 +0000 (15:54 +0300)]
Fix a logic error leading to unlink(NULL) call, oops.
- If writing the scriptlet to a file fails, its possible to
end up with non-NULL script but with NULL fn and kaboom in unlink()
Panu Matilainen [Mon, 30 May 2011 12:50:29 +0000 (15:50 +0300)]
Eliminate bunch of dead assignments on ts vsflags
- The common pattern here is grabbing current flags to a local
variable, modifying them for an operation and then restoring,
which is fine... but we dont care about the previous flags
when we're restoring them.
Panu Matilainen [Mon, 30 May 2011 09:38:13 +0000 (12:38 +0300)]
Eliminate dead assignment(s) on rpmfsFree(), memset() wipeout instead
Panu Matilainen [Mon, 30 May 2011 09:37:06 +0000 (12:37 +0300)]
rpmgiFree() cleanup to remove an exit point and dead assignment(s)