Commit Graph

1802 Commits

Author SHA1 Message Date
Panu Matilainen 9a3f590e32 Freeze the rpmfc string pools once all additions are done
- Memory use isn't typically that critical during build, but saving
  a little bit of it doesn't hurt anyway...
2012-09-26 12:52:13 +03:00
Panu Matilainen 50983815f0 Dont waste time with argi for rpmfc file class indexes
- argiAdd() isn't as costly as argvAdd(), but it still involves unnecessary
  reallocation on every addition as the number of files is predetermined,
  and each file has an associated class index.
- Additionally fixes a mostly harmless glitch introduced in commit
  65e616cc9fdd00f523939088fab1070021b9f742: the pool id's are one larger
  than the indexes we store in headers, take this into account in the
  debug output.
2012-09-26 12:32:32 +03:00
Panu Matilainen 1c18cb27e6 Dont waste time with argi for rpmfc file colors
- argiAdd() isn't as costly as argvAdd(), but it still involves unnecessary
  reallocation on every addition as the number of files is predetermined,
  and each file has an associated color (whether its zero or something else)
2012-09-26 12:02:27 +03:00
Panu Matilainen da20a6dbf1 Dont waste time with argv for rpmfc file names
- argvAdd() gets more and more costly as the number of files increase,
  use a plain old string array where one is called for: the size
  is predetermined (from another argv) and we're just copying the
  strings for internal storage here. We do need to pay a little bit
  more attention to details now though.
2012-09-26 11:58:29 +03:00
Panu Matilainen cb112b6745 Use a string pool for the build-time file dependency string storage
- The pool is mostly just a dumb storage space for this case, but
  insertion to pool is far more efficient than argv search, add,
  sort operation. The order does not matter as the actual information
  is encoded in the string and then painfully parsed out again. This
  could really use a special-purpose data structure for sanity but...
2012-09-26 10:49:56 +03:00
Panu Matilainen 65e616cc9f Use a string pool to build file class dictionary and indexes
- The string pool is a natural fit for this and much more efficient
  when the number of files (and classes) is large.
- This does have an effect on the generated classdict array: it's no
  longer sorted, and we no longer always (possibly unnecessarily)
  insert an empty string and "directory" in it, but only when they
  actually exist. Neither change makes any difference for usage,
  unless some 3rd party software is making assumptions about the
  classdict contents they shouldn't be making (very unlikely anyway)
2012-09-26 10:49:49 +03:00
Panu Matilainen ced81d2169 Cosmetics: properly indent the rpmfc debug foobar 2012-09-26 09:41:30 +03:00
Panu Matilainen e06177ee65 Fix bogus "unclosed %if" error when %include is used in conditionals
- 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.
2012-08-08 09:43:42 +03:00
Panu Matilainen 7c70bdea1a Handle all dependency tags in spec via same switch-case fallthrough
- Requires and OrderWithRequires take extra qualifiers, but other
  than that they areall handled the same through parseRCPOT()
2012-08-07 08:28:26 +03:00
Panu Matilainen cce0fb4387 "prereq" is not a valid qualifier to regular Requires 2012-08-07 08:24:57 +03:00
Panu Matilainen 01706306d1 Extra qualifiers like (postun) are not valid with legacy PreReq 2012-08-07 08:18:00 +03:00
Panu Matilainen 395be24637 Fix memleak in changelog parsing on error paths
- All the early returns would leak memory from the argvJoin(),
  assume failure and force all exits through a single path where
  we can clean up.
2012-08-01 19:17:09 +03:00
Panu Matilainen 465f5f9d5c Turn the invalid date error to warning (related to RhBug:843525)
- The strict date validation introduced in commit
  a29e5f9894 is too much of a PITA
  for such a petty cause, mismatching weekday names as very very
  common in specs. Maybe we can change it to a hard error in a couple
  of years from now once folks have had time to get rid of the
  warnings first.
2012-08-01 19:03:15 +03:00
Panu Matilainen 94b4ee60c0 Refactor the struct stat hacking into a helper function
- Shouldn't change actual functionality, just makes the code easier
  to read and fit on screen by reducing indentation level.
- Add further commentary about what it does and why.
2012-08-01 16:38:15 +03:00
Panu Matilainen d6775a746b Permit non-existent %ghost directories to be packaged (RhBug:839656)
- Directories can be explicitly specified via either %dir or trailing
  slash in the %files manifest, take this into account for %ghosts that
  dont exist in the buildroot. Otherwise we still assume regular file.
- Dont require explicit %attr() for missing %ghosts, let them fall
  back to %defattr() instead. If %defattr() doesn't specify a mode
  the file will be seen without any permissions at all, but that's
  not strictly an error (and same can happen with %dev() already)
2012-08-01 16:25:43 +03:00
Panu Matilainen 24ad8291bb Dont bother asking libmagic about directories
- There's no (relevant) additional information to be gained from passing
  directories to libmagic and we already have this info available in the
  file mode. This permits nice and easy handling of %ghost directories
  (related to RhBug:839656)
2012-08-01 16:25:06 +03:00
Panu Matilainen 9c26bd05ea Report starting line for unclosed %if in specs 2012-07-31 16:20:16 +03:00
Panu Matilainen 89ce186258 Dynamically grow spec line buffer on line continuations
- 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...
2012-07-31 14:22:08 +03:00
Panu Matilainen e5ea5dcd2d Minor cleanups: const pedantry and helper variable scoping
- Make the reading pointers const, push helpers to scope where needed
2012-07-31 13:27:30 +03:00
Panu Matilainen 729fd554ee Allocate spec line buffer separately from spec struct
- Further preliminaries for dynamic buffer resizing
2012-07-31 11:56:01 +03:00
Panu Matilainen 0c737f72b2 Track spec parse buffer position by offset instead of pointer
- Preliminaries for dynamically reallocating the buffer
2012-07-31 11:12:27 +03:00
Panu Matilainen a29e5f9894 Stricter validation of changelog date (RhBug:843525)
- Compare the date parsed from changelog to date normalized by mktime()
  and complain if they differ. This catches cases like wrong weekday
  specified for an otherwise valid date, and a leap day on a non-leap
  year etc.
2012-07-30 14:59:35 +03:00
Panu Matilainen 2e95618c0e Always print out package dependencies on build
- Previously packages which had no files or for which automatic
  dependency generation was partially or fully disabled didn't get
  any of their dependencies printed out at build-time. This doesn't
  affect the actual recorded dependencies, only the "debugging"
  output during package builds.
2012-07-12 14:51:12 +03:00
Panu Matilainen d1dcc53dfb Accept "owner" as an alias to "user" %verify attribute (RhBug:838657)
- Both Maximum RPM and the newer RPM Guide incorrectly list "owner"
  as a valid %verify() attribute, whereas rpm has used "user"
  for as long as the code has been present (since 1996). Since
  adding the alias is so trivial, and certainly easier than changing
  published books... meh.
2012-07-10 12:52:23 +03:00
Panu Matilainen cf3069b4d9 Also track large file presence for src.rpm's (RhBug:833427) 2012-07-02 17:19:03 +03:00
Panu Matilainen 338f6e4cf7 Push payload file size limit checking into cpio code
- At the time when the file list is being processed, we dont yet
  have the slightest clue what kind of payload will be used for
  for the archive or what limits it might have. Let the cpio code
  handle its own limits checking, the build-side only needs to
  worry about whether 32bit uints are sufficient for storing the
  sizes in headers.
2012-07-02 17:11:00 +03:00
Panu Matilainen f79ce27fff Report the actual failure reason on archive create failure (again) 2012-07-02 16:15:41 +03:00
Panu Matilainen 38932d1d17 Export our own version of glob_pattern_p() as rpmIsGlob()
- Further preliminaries to hiding the glob() implementation
2012-05-31 16:45:32 +03:00
Panu Matilainen 6e4e5ebd87 Parametrize default vs current %verify and %attr parsing
- Only try to parse one thing at a time so the caller knows what
  value its going to get if any and doesn't have to pass both
  current and default pointers. Just simplifies things a little.
2012-05-29 12:58:13 +03:00
Panu Matilainen 55bf9abee2 Initial support for "special" %license, similar to %doc (ticket #116)
- 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)
2012-05-28 16:55:57 +03:00
Panu Matilainen c1f59e74de Generalize special doc attribute to "special dir" 2012-05-28 15:26:49 +03:00
Panu Matilainen ff16d1a487 Handle rpmfiNew() failure centrally in genCpioListAndHeader() 2012-05-28 12:14:15 +03:00
Panu Matilainen 06cd93832d Fix spec parsing memleak from source header on buildarch recursion 2012-05-28 12:03:43 +03:00
Panu Matilainen 1adaff3ee4 Eliminate redundant helper variables from src.rpm generation
- Spec being the first is easily detected from the current index,
  no need for separate tracking variable
- Use the file records used variable to track the progress, no need
  for separate index variable
2012-05-28 11:42:38 +03:00
Panu Matilainen d8334d2e3f Move file list freeing to helper function 2012-05-28 11:06:46 +03:00
Panu Matilainen 975489fa26 Hardlink detection doesn't need entire filelist, just the actual records 2012-05-28 09:56:11 +03:00
Panu Matilainen 86fc7db32d isDoc() only needs the doc dirs, not the entire filelist 2012-05-28 09:51:29 +03:00
Panu Matilainen bafde44e2d Clean up file records freeing a bit
- All the necessary data is in FileRecords struct so we only
  need to pass that. Dont bother NULLing everything as these
  are not passed around in a way where it would matter.
2012-05-28 09:47:58 +03:00
Panu Matilainen de94517558 Split the actual file records into a struct of their own
- No functional changes, just straightforward dumb conversion. Various
  places look fairly dumb with this, leaving sanitizing to other commits.
2012-05-28 09:39:48 +03:00
Panu Matilainen bd16afc2ac Use vfaMatch() for %config attributes as well 2012-05-28 08:57:09 +03:00
Panu Matilainen 487f26633f Unify %verify and virtual file attribute handling 2012-05-28 08:54:30 +03:00
Panu Matilainen f69dd4ce18 Eliminate unused negate field of VFA struct
- The negate field has never been used nor does it seem very useful
  either: %verify negation can't be handled by it anyway, and
  for others it hardly makes sense.
- While at it, make virtualFileAttributes const and fix the
  indentation
2012-05-28 08:50:55 +03:00
Panu Matilainen cca8f6bb55 Push special %doc handling details out of processPackageFiles()
- Add a new struct to hold the necessary bits and pieces about
  these special directories with functions to create & free for
  easy management for callers, move the remaining processing into
  processSpecialDocs() to make that part one-stop shop for the
  caller as well.
- Should not change functionality in any way.
2012-05-25 15:40:31 +03:00
Panu Matilainen b5a0f6876c Refactor getSpecialDocDir() so it cannot fail
- Spit a warning on illegal _docdir_fmt and fall back to the default
  format (which cannot fail). This just isn't worth dying for and
  avoids having to deal with such a petty error elsewhere.
2012-05-25 14:17:33 +03:00
Christophe Fergeau 185596818f Add support for 7zip compressed tarballs
Teach %prep and %uncompress how to handle 7zip tarballs, with
the mingw toolchain landing in fedora, this may be useful when
crossbuilding Windows sources compressed using 7zip (CxImage is
one such project).
2012-05-22 13:48:01 +03:00
Panu Matilainen 5895463186 Push special doc directory generation next to other special doc foobar
- There's no need to carry the special doc directory in the
  package struct, the directory is only a fleeting thing deep down
  in the filelist parsing. Handle local-only needs locally.
- No behavior/semantic changes intended or expected.
2012-05-16 17:05:26 +03:00
Panu Matilainen 29677605d4 Refactor special doc handling out of parseForSimple()
- Change parseForSimple() to return all filenames it finds, moving
  most sanity checking and decision making of what goes where to
  processPackageFiles() which has a better overall view of things.
  This also means we could trivially handle more than one file per
  %files line, but keeping the (now artificial) limitation for now
  at least.
- Collect special %doc arguments individually to a local ARGV,
  split the script generation and execution to a separate helper
  function.
- Actual semantics / behavior is not supposed to change (other than
  'cp' now getting called once per %doc arg, not per %doc line), but
  knock wood, this is a larger at-once change than I care for.
2012-05-16 16:05:53 +03:00
Panu Matilainen dda476dc77 parseForSimple() doesn't need the entire file list anymore 2012-05-16 12:03:56 +03:00
Panu Matilainen f2f591acae Negation doesn't make sense for any of the virtual file attributes
- The negate field is unused in all the attributes anyway, but
  the whole concept doesn't make any sense for the virtual file
  attributes. Simplifies the thing another little bit.
2012-05-16 11:40:38 +03:00
Panu Matilainen 13a7d31860 Handle %dir parsing with an internal file attribute
- Cleans things up a little bit by removing the special test
  for %dir in parseForSimple(). The separate isDir is still necessary
  for directory recursion tracking but that's separate from parsing
  the line.
2012-05-16 11:29:09 +03:00