- We have a function for this stuff so use it. This also ensures
the per-package rpmds'es and the data in header stay in sync
and that manually added self-provides wont cause duplicates.
- As newPackage() initializes the pkg header too, we now need
a different way of checking whether initSourceHeader() has
already been called. Checking RPMTAG_NAME should suffice for the job...
- Makes the src.rpm that little bit more like other packages.
Doesn't make things any saner here but we'll want to pass around
package structs instead of headers later on.
- All rpm versions log a bogus "unclosed %if" error when %include
is used inside %if-%endif (and rpm >= 4.10 actually aborts the
parse): the check for unclosed if occurs before checking whether
there's more to come.
- Move the error check into readLine() EOF path along with the other
similar check to fix, and to consolidate the error handling to
a single spot.
- Allows arbitrary length line continuation constructs in specs, but
probably the more useful side-effect is cleanly handling unterminated
macros and the like (instead of segfaulting) on large spec files,
there was a bug on this somewhere but cant find it atm.
- This also has a wee bit silly effect on the maximum macro expansion size:
after very long constructs the max expansion gets is bigger than
at the beginning of spec parse, but properly fixing the resizing wrt
macros is a different issue.
- Watch out for possible fallout from spec->line etc tracking, they
*seem* to be ok even with the potentially moving buffer location but...
- Now that this is relatively sanely doable... make %license with
non-absolute paths behave similarly to %doc, only installing to a
different directory (%_licensedir) and with different flags:
licenses are not generic documentation and should not be skipped
on installation even if --nodocs is used. The common practise of
stuffing licenses into %doc actually violates various licenses
which require the license text to always accompany the software.
- While ticket #116 suggests various schemes to reduce disk usage,
adding some very special logic to installation code just to deal
with these doesn't seem justifiable, given how small the licenses
generally are. However with licenses now in their own directory
structure (/usr/share/licenses by default), running hardlink on
them is trivial for cases where disk space is tight
(live images, embedded systems etc)
- Replace the rather useless newOpenFileInfo() "constructor" with
a function to push a new filename on spec stack, creating the
OFI struct as we go. forceIncludeFile() becomes so simple its
no longer necessary at all.
- 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)
- 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.
- having those expressions without argument is no more allowed
- white space between expression and argument is mandatory
- rpmbuild no more confuses %ifabcd macro with %if abcd
- fix criptic message in case of invalid %if condition
- fopen() returns NULL on errors, never an opened stream with error
flag set. These are leftovers from past where rpmio fd was used
instead of FILE and probably the checks were bogus even back then too.
- These were used, back in the day, to implement a hidden --specedit
switch, which in all its glory did: print a copy of a spec file,
with group, summary and description looked up from specspo.
This huge pile of junk was left behind from kicking out the
useless "feature" in commits 7b95061d3b and
0f991a1420.
- rpmParseState uses might actually qualify for a true enum here
but changing it would require changing half of librpmbuild and
many of them mix the parse states, other error codes and whatnot
in their types... just not worth the trouble, so use an int.
- Many of these cases would be true enums from preambleList & similar,
except for the list terminating sentinel. Just switch all the
remaining rpmTag's to rpmTagVals to bring our enum-whacking to
a grande finale.
- Been 2.5 years now without seeing that trap trigger, should be safe
to remove now ... to silence a warning about comparing to non-existent
enumeration value.
- For now just a wrapper around parseSpec() that returns *gasp*
a pointer to a parsed spec structure.
- Limit the amount of goo that needs passing - optimally we'd only need
the spec + parsing flags, but due to %{buildroot} macro abuse in specs
we'll need that for now too.
- This was broken for years without anybody complaining, should
be safe to conclude nobody will miss it later either. And if
somebody misses it, this is a job for rpmlint really.
- The whole rootDir seems dubious for build purposes, but in any case its
only relevant during the actual build process, not for spec parsing.
Set spec->rootDir from buildSpec() for the duration of the
build to avoid having to refactor doScript() and all right now.
- Cookies are not a property of spec but a given build, handle this
internally to buildSpec() except for --rebuild which passes the
srpm identifier cookie through buildArgs
The %sepolicy section is used to describe SELinux policy to be included
in a package. It's syntax is similar to other sections (%files, %pre,
%post, etc.) in that you can provide a string and -n after the
declaration to specify policy should be added to a subpackage.
For example:
%sepolicy
# policy in this section will be added to the main package
%sepolicy foo
# policy in this section will be added to the '<mainpackage>-foo' subpackage
%sepolicy -n bar
# policy in this section will be added to the 'bar' subpackage
The %sepolicy section contains zero or more %semodule directives, with the
following format:
%semodule [OPTIONS] path/to/module.pp
The available options are:
-b, --base
The module is a base module
-n, --name=NAME
The name of the module. If not given, assumes the name is the basename of
the module file with file extensions removed.
-t, --types=TYPES
One or more comma-separated strings specifying which policy types the
module can work with. To explicitly state that a module can work with any
policy type, "default" can be specified as the value. If not specified,
assumes the module can work with any policy type, and assigns the types as
"default".
Below is an example of this new format:
%sepolicy
%semodule -n foo -t mls policy/foo.pp
%semodule -n bar -t strict,targeted,mls -b policy/bar.pp
This also adds new header tags to store the new information:
RPMTAG_POLICYNAMES (string array)
RPMTAG_POLICYTYPES (string array)
RPMTAG_POLICYTYPESINDEXES (uint32 array)
RPMTAG_POLICYFLAGS (uint32 array)
The index of NAMES and FLAGS maps directly to the index of RPMTAG_POLICIES.
However, because a single policy can have multiple types, the mapping for
TYPES is not direct. For this, the index maps to TYPESINDEXES, which
contains the index of the policy that the type maps to. This is similar to
how DIRINDEXES is used to map DIRNAMES and BASENAMES. As an example, the
previous %sepolicy section would have the following header tags:
RPMTAG_POLICIES:
0: <foo.pp data, base64 encoded>
1: <bar.pp data, base64 encoded>
RPMTAG_POLICYNAMES:
0: foo
1: bar
RPMTAG_POLICYFLAGS:
0: 0
1: 1 # assumes flag 1 == BASE
RPMTAG_POILCYTYPES: RPMTAG_POLICYTYPESINDEXES:
0: mls 0: 0
1: strict 1: 1
2: targeted 2: 1
3: mls 3: 1
- Combining description /checking/ and arch/os/platform /adding/
into same for-loop (to save cycles or lines, dunno) makes no sense
whatsoever. No functional changes.
- Yank everything qualifying as "internal helper function" into
internal-only headers, loosely grouped as follows:
1) Everything involving spec-manipulation goes into rpmbuild_internal.h
2) All other miscellaneous helpers go into rpmbuild_misc.h
- This leaves us a rather minimal, and nearly useful API into librpmbuild:
Users need to be able to parse a spec, query or build (parts of) it
and free up the spec structure when done. This is what we have now,
various still exposed structures not counting.
- This is a funky little implementation detail which no caller should
have to bother with. Move it to parseSpec.c which is the only place
needing it now and make static.