Commit Graph

14094 Commits

Author SHA1 Message Date
Panu Matilainen d6be2e4312 Mark ndb and lmdb experimental in configure too
Nobody reads release notes, better carry the message here...
2017-09-01 14:03:39 +03:00
Panu Matilainen 44570e253d Remove leftover parentheses, no functional change.
Should've been in commit 206c12acc2.
2017-09-01 11:17:48 +03:00
Panu Matilainen 206c12acc2 Don't assume %{quote:...} is surrounded by whitespace
As implemented in commit cdbc7e1d8b,
%{quote:...} only works when its used to quote the entire argument
and produces garbage when used in middle of other text, such as
"x%{quote:y}z". Not sure there's actual need to do that, but producing
garbage is never good.

Only unquoted separators can split an argument, copy argument manually
to strip any quote characters and adjust the math to match. Oh and
add testcases too.

Thanks to Pavlina Moravcova Varekova for pointing this out.
2017-09-01 10:59:21 +03:00
Panu Matilainen 1a08ab7e30 Add documentation for all/most built-in macros
This hasn't seen much love in recent decades, ugh...
2017-08-31 15:15:29 +03:00
Panu Matilainen 58213365e9 Plug what's probably an ancient memleak in build code 2017-08-31 13:25:02 +03:00
Panu Matilainen 0034a5c6e5 Avoid macro expansion on every rpmlog() call + fix a related memleak
Move color config macro expand into a helper function that's only called
once per thread and use enums for the possible states, ints are nicer
to compare than strings. Also remember to free the expansion result to plug
a memleak as well.
2017-08-31 13:25:02 +03:00
Michael Schroeder c69cfdf901 Fix classification of ELF binaries with both setuid/setgid set
There is a ',' between multiple entries.
2017-08-31 12:01:24 +02:00
Panu Matilainen cdbc7e1d8b Support parametric macro argument quoting, take three (#222)
All the nice quote-characters are already spoken for, we need to
do something more special here. Add a special-purpose built-in %{quote:...}
macro which quotes its argument using ASCII unit separator character 0x1f
(so it really shouldn't get into anybodys way) and teach macro argument
splitting to support that.

So with %{quote:...} it's now possible to pass strings containing
whitespace and empty strings as arguments. It might not be pretty, but
it's at least POSSIBLE, and no existing user is bothered by this.
2017-08-31 12:36:32 +03:00
Panu Matilainen 08ed0b20c6 Add a few more parametric macro argument tests 2017-08-31 12:14:36 +03:00
Panu Matilainen 6adef6a3c7 Make queryformat array behavior consistent for all types
Always require matching number of elements regardless of data type
and number of elements, and error out otherwise. Behaving differently
for plain strings and binaries makes no sense, those checks are ancient
artifacts that have long since ceased to produce what might've been
originally intended behavior.

A remaining quirk is the case where a tag doesn't exist at all, this
produces (none)'s all the way down. Which doesn't seem terribly wrong,
but neither does it seem really consistent with the rest of it. Dunno.
2017-08-30 16:57:09 +03:00
Panu Matilainen 1517c1a721 Add more queryformat array testcases
There are some funny quirks here: query 2 case needs to succeed
because there's exactly one changelog entry in the package, but if
that were not the case it should fail (but doesn't, so the testcase
fails for now). So we test for that separately in query 3, and finally
test for %{=foo} (ie repeat first entry) which is required to sort out
different sized arrays in the general case.
2017-08-30 16:48:30 +03:00
Panu Matilainen 7eb620f595 Restore 4.13 behavior with single value tags in query format arrays
Rpm documentation actually states that you must use %{=TAG} for the case
commit 7f47cbbd7d was trying to fix, but
caused regressions in other situations. So the 4.12 behavior is little
more than accidental, rpm is actually supposed to error out here
(but doesn't, which is another bug).

This reverts commits 7f47cbbd7d and
ead9cdd587.
2017-08-30 15:35:01 +03:00
Panu Matilainen 9c979cffe9 Eliminate a bunch of idiotic assert()'s in rpmtd getters
In the cases where zero is a sane return for non-existent data,
return it instead of barfing up an assert. Many more unnecessary
asserts left there but these are rather obvious...
2017-08-30 14:26:19 +03:00
Pavlina Moravcova Varekova d78813fa94 When printMacro() is used, print newline after "(empty)" macro 2017-08-30 10:37:01 +03:00
Pavlina Moravcova Varekova ed782b3653 Bring manual for %{echo:...}, %{warn:...} , %{error:...} up to date 2017-08-30 10:35:37 +03:00
Pavlina Moravcova Varekova fa39cb730d %trace mb states at the beginning/end of expandMacro must be equal
Macro %trace switched on in a nested stage level writes the trace
until the level is leaved to a lower stage level. This did not
work e.g. for macros containing several condition macros.

For example:
%prep
%define Branch1() {%trace %global Leaf1 "1"}
%define Branch2() {%global Leaf2 "2"}
%define Main() {%{?test1: %Branch1} %{?test1: %Branch2}}
%Main

with the result:
  4>         %global^Leaf1 "1"
  2>     %{?test1: %Branch2}^
  3>       %Branch2^
  4>         %global^Leaf2 "2"

It was because macro expansion is context free. This patch fixes it.
2017-08-30 10:33:14 +03:00
Panu Matilainen b052d69474 Only fallback to MDB_RDONLY if readonly database is requested
Somewhat similarly to commit 70a1efa52b,
only allow read-only environment if read-only is requested, writers
are better off failing early.
2017-08-28 19:33:40 +03:00
Panu Matilainen 2822ccbcdf Fallback to DB_PRIVATE on readonly DB_VERSION_MISMATCH too (RhBug:1465809)
All these years BDB has been relying on undefined behavior by storing
POSIX thread objects in its persistent environment files (for the long
story, see RhBug:1394862). As a side-effect of fixing it in BDB,
all sorts of creatures from dark corners are getting dragged into
the daylight: rawhide glibc gets updated a lot and we're getting
DB_VERSION_MISMATCH hits from rpm queries from package scriptlets
(told you so...), other tools not closing their database handles
when they should etc etc. This lets those cases continue "working"
to the extent they always did (ie unreliably) for now.

We should log some diagnostic message in this case, but coming up
with an understandable and reasonably short message for this mess
isn't that easy :)
2017-08-28 19:17:24 +03:00
Panu Matilainen 70a1efa52b Limit automatic fallback to DB_PRIVATE to read-only operations
Only permit automatic fallback to the essentially lockless operation
of DB_PRIVATE when read-only database is requested. This isn't exactly
correct, as readers need locks for correct operation just like writers do,
but at least in the readonly case the database wont be damaged.

The exception to the rule is systems which don't support the shared mapping
at all so we don't have much choice. Explicitly configured
I-know-what-I'm-doing DB_PRIVATE is not affected either.
2017-08-28 19:17:08 +03:00
Igor Gnatenko 98d0a51e16 metainfo.prov: scan /usr/share/metainfo and /usr/share/appdata for both types
Directory name doesn't matter, content does. In specification, both
appdata.xml and metainfo.xml should be in /usr/share/metainfo, but
tools should support /usr/share/appdata as for legacy location.

References: https://bugzilla.redhat.com/show_bug.cgi?id=1483644
Reported-by: Petr Pisar <ppisar@redhat.com>
Signed-off-by: Igor Gnatenko <i.gnatenko.brain@gmail.com>
2017-08-25 12:51:28 +02:00
Panu Matilainen eadee821b3 Export rpmsqBlock() to python bindings as blockSignals() 2017-08-23 13:02:24 +03:00
Panu Matilainen ee33773218 Leave build scripts around in debug mode (#1442015)
We do this for install-time scripts too, so its only logical to do
so with build scripts as well.
Depends on commit 724830018a.
2017-08-23 11:52:50 +03:00
Panu Matilainen 724830018a Allow running rpmbuild with debug verbosity
Only force RPMLOG_INFO level if running with less verbosity (as is
the case by default), but leave RPMLOG_DEBUG alone. Quiet overrides
any number of -v's though.
2017-08-23 11:50:11 +03:00
Panu Matilainen 4e647cd979 Eliminate unnecessary "delete" argument to freeArgs()
This became unused and useless with the big scoping change in
commit 237f35f16f. No functional
changes here.
2017-08-22 10:25:56 +03:00
Panu Matilainen 609adaa758 Bump macro max recursion limit up
Fedora java packages are running into the old limit of sixteen nesting
levels (commit b3179e6de3), bump it up
to 64. The old limit lasted almost twenty years, lets see how far this
gets us.
2017-08-21 16:36:32 +03:00
Panu Matilainen 2986e7659d Remove redundant max_macro_depth initialization
Oldies but goodies: the max depth is already initialized in declaration
to _MAX_MACRO_DEPTH which has been the same 16 since late nineties. This
wasn't always the case of course...
2017-08-18 17:12:47 +03:00
Panu Matilainen 054de0f50f Use silent lookup for debuginfo packages (#1482144)
Noarch packages do not have debuginfo, this was causing harmless
but bogus error messages via lookupPackage(). Depends on commit
4afe09cbcf.
2017-08-18 12:46:59 +03:00
Panu Matilainen 4afe09cbcf Add a flag to allow quiet test for package existence with lookupPackage()
Turning "flag" into an actual bitfield requires testing for
PART_NAME/PART_SUBNAME differently, no actual changes here though.
2017-08-18 12:44:46 +03:00
Pavlina Moravcova Varekova 94e8cd6058 Make macro %{error:...} cause an actual failure 2017-08-17 16:16:23 +03:00
Pavlina Moravcova Varekova a3b153eb47 Unified messages printed by %{echo:...}, %{warn:...}, and %{error:...}
Send all through rpmlog(), unify formatting - previously echo and
warn were missing the trailing newline. The other change is that
echo now goes to stdout.
2017-08-17 16:15:39 +03:00
Panu Matilainen 0cbcf9b9c3 _DBSWAP() macro is identical between lmdb.c and db3.c, consolidate to dbi.h 2017-08-17 13:09:17 +03:00
Panu Matilainen 18a2fc0744 Make _dbibyteswapped static within lmdb.c 2017-08-17 13:02:10 +03:00
Neal Gompa c84292fe23 ci: Add lmdb-devel to CI Dockerfile 2017-08-17 12:50:12 +03:00
Jeff Johnson ed9de1992f Add LMDB backend to RPM
v2 (Neal Gompa)
  * Switch from RPM_CHECK_LIB to PKG_CHECK_MODULES
  * Fix notation of file name in lmdb.c
  * Remove MDB_FIXEDMAP flag to prevent portability issues
  * Add comment that lmdb is an option for %_db_backend

Closes: #281
Fixes: #128
2017-08-17 12:49:06 +03:00
Panu Matilainen 9a6a95bf0b Add missing "il" to header sanity check error message 2017-08-15 10:51:00 +03:00
Panu Matilainen a3c1f733e0 Revert "Support quoting of macro arguments (#222)"
This simply breaks too many things - whole macro ecosystems exist based
on the assumption that quotes in arguments will pass to macros
untouched. Macro argument quoting support is necessary but it'll
need some entirely different approach that is either opt-in or
based on a different syntax altogether.

This reverts commit 47f0a899ef.
2017-08-14 14:28:10 +03:00
Panu Matilainen 1bf6da61fe Make the rpm 4.4.x compat layer removal explicit via an error message 2017-08-11 14:11:53 +03:00
Panu Matilainen 50c380e9e0 Disable two of the sigpipe tests, they're too unstable
Tests that fail half the time due to load on machines etc are
more trouble than its worth.
2017-08-10 20:21:26 +03:00
Panu Matilainen 7e65bec67d Revert "Only build bundled fts if system has a bad version that doesn't handle LFS"
The subtle test is too subtle for its own good, this patch breaks
thirty six testcases on 32bit architectures.

This reverts commit 1eadabe445.
2017-08-10 20:15:02 +03:00
Panu Matilainen 03a905c94c Remember to add macro-scope.spec to tarballs
Should've been in commit c4d41c30ce
2017-08-10 12:13:38 +03:00
Panu Matilainen 7c8048668d Revert "Make sure that debugsourcefiles.list is generated in the build dir."
This reverts commit 22431b78f7.
2017-08-10 11:17:46 +03:00
Panu Matilainen 1b49d43c06 Revert "Warn and create empty debugsource package if there are no sources."
This reverts commit 874dd7e388.
2017-08-10 11:17:36 +03:00
Mark Wielaard 874dd7e388 Warn and create empty debugsource package if there are no sources.
Signed-off-by: Mark Wielaard <mark@klomp.org>
2017-08-10 11:03:00 +03:00
Mark Wielaard 22431b78f7 Make sure that debugsourcefiles.list is generated in the build dir.
The %_debugsource_template expects the debugsourcefiles.list file
to be in the (current) build dir. Make sure that is always the case
even if find-debuginfo.sh was invoked in a different (sub) directory
by adding the build dir path as explicit argument to -S.

Signed-off-by: Mark Wielaard <mark@klomp.org>
2017-08-10 10:58:33 +03:00
Panu Matilainen 2321badddc Bump version to appear newer than latest stable branch (4.14.x) 2017-08-10 10:52:33 +03:00
Igor Gnatenko 456d0e590e add tests for with/without rich operators
Signed-off-by: Igor Gnatenko <i.gnatenko.brain@gmail.com>
2017-08-10 09:46:13 +02:00
Michael Schroeder dac1c70256 Implement with/without rich dependencies
Unlike the other rich rependencies they work by evaluating package
sets. This means, "Requires: (foo with bar)" is only fulfilled
by a package that provides both foo and bar. In comparison,
"Requires: (foo and bar)" can be fulfilled by two different
packages.

Without implements set subtraction, e.g. "Requires: (foo without bar)"
is only fulfilled by a package that provides foo but not bar.
2017-08-10 09:46:13 +02:00
Michael Schroeder 87b8b19eba Add rpmalLookupTE helper
It returns the index of a transaction element in the available
packages list, or (unsigned int)-1 if not fould.
2017-08-10 09:46:13 +02:00
Michael Schroeder eb6b13f9a7 Change hdrNumCmp to use the tagNum as secondary sort key
This brings rpmdbSortIterator in line with its documentation.

Note that there is a catch: this change also makes the dbiIndexSetPrune
function work different! It used to delete all items that had a
matching hdrNum, after the change only the one is deleted that also
has a matching tagNum. I consider this a bug fix.
Note that dbiIndexSetPrune is only used in the db3.c backend to remove
index entires, if we really want the old behavior we should add a
new dbiIndexSetPruneHdrnum function.

Also remove assertion when trying to sort an empty set.
2017-08-10 09:46:13 +02:00
Michael Schroeder 8a06ede513 Add dbiIndexSetFilter and dbiIndexSetFilterSet methods
They will be used to resolve "with" rich dependencies.
2017-08-10 09:46:13 +02:00