tools/librpm-tizen.git
11 years agoDont create %config backups on skipped files
Panu Matilainen [Mon, 20 Aug 2012 08:12:05 +0000 (11:12 +0300)]
Dont create %config backups on skipped files

- This cosmetical only, but there's no point creating the same backup
  twice. Depends on commit f7f5f88f9f3d6587e747b034ccb64a3f00ff4e1e.

11 years agoTest that the %config backup contents are what we expect
Panu Matilainen [Mon, 20 Aug 2012 07:56:17 +0000 (10:56 +0300)]
Test that the %config backup contents are what we expect

- Note we're only checking the contents where backups *should* be
  created, not much point checking buggy behavior.

11 years agoYet more %config test-cases - shared configs have quirks of their own
Panu Matilainen [Mon, 20 Aug 2012 07:48:31 +0000 (10:48 +0300)]
Yet more %config test-cases - shared configs have quirks of their own

11 years agoAdd similar set of %config(noreplace) tests
Panu Matilainen [Mon, 20 Aug 2012 07:24:45 +0000 (10:24 +0300)]
Add similar set of %config(noreplace) tests

- The first tests are kinda redundant but extra tests never hurt anybody...

11 years agoAdjust the config test descriptions a bit to make room...
Panu Matilainen [Mon, 20 Aug 2012 07:13:39 +0000 (10:13 +0300)]
Adjust the config test descriptions a bit to make room...

11 years agoAdd further "parametrization" to our config file test spec
Panu Matilainen [Mon, 20 Aug 2012 07:04:07 +0000 (10:04 +0300)]
Add further "parametrization" to our config file test spec

- Currently unused but to allow for testing further cases with the
  same base spec...

11 years agoAdd a test-case for another %config file special case
Panu Matilainen [Mon, 20 Aug 2012 06:52:56 +0000 (09:52 +0300)]
Add a test-case for another %config file special case

- When an existing config file content changes between package versions
  but the file has already been changed to match the content of the
  new version, we still create a backup file that's identical
  to the one that ends up being installed. This is a bug of sorts,
  but documenting the existing behavior before changing it.

11 years agoTighten the existing %config tests a bit
Panu Matilainen [Mon, 20 Aug 2012 06:49:13 +0000 (09:49 +0300)]
Tighten the existing %config tests a bit

- Test for actual file content
- Also clean up any .rpm[new|save|orig] files from the testroot

11 years agoAdd a test-case for the shared file timestamp behavior
Panu Matilainen [Fri, 17 Aug 2012 11:14:46 +0000 (14:14 +0300)]
Add a test-case for the shared file timestamp behavior

- Prior to commit f7f5f88f9f3d6587e747b034ccb64a3f00ff4e1e, this
  would've failed: removing the last package to be installed would
  cause timestamp failure on all others. The order is arbitrary in
  this testcase but it matters in real-world situations such as
  secondary arch packages.

11 years agoOnly create the first instance of a file shared between packages
Panu Matilainen [Fri, 17 Aug 2012 11:07:05 +0000 (14:07 +0300)]
Only create the first instance of a file shared between packages

- When packages share an identical file, we only need to create the
  first one we encounter and skip it for the rest (reverse already
  happens, and must happen, on erase). This has the benefit of
  getting the timestamp to match the first file, which often is
  also the last one to get removed. Also when lots of shared files
  are involved (such as in multilib installations), this can give
  several percents worth of speed gain as we dont unnecessarily rewrite
  the same contents over and over.

11 years agoBlargh, more fdFree() braindamage
Panu Matilainen [Fri, 17 Aug 2012 10:09:19 +0000 (13:09 +0300)]
Blargh, more fdFree() braindamage

- Commit 429b933b42d1821f6f0a2a41ae13c504ea6d0657 fixes the fd-leak
  regression in rpm 4.10, but we already have code which relies
  on the new behavior and segfaults with the former one. Adjust
  rpmcpioClose() to the old behavior to get master tree back to
  working shape. TODO: fix this properly some rainy day (oh and see
  http://geekandpoke.typepad.com/geekandpoke/2012/08/likelihood.html)

11 years agoRevert "Always return NULL from fdFree()"
Panu Matilainen [Fri, 17 Aug 2012 08:30:43 +0000 (11:30 +0300)]
Revert "Always return NULL from fdFree()"

- This reverts commit 4c1f7e335de1724661ce63c53186d161ab71a63f:
  various things inside and outside of rpm actually do still depend
  on the old behavior, and leak file descriptors otherwise.
  As an easy backportable band-aid, revert back to the previous
  behavior, to which various callers are tuned to fix the regression
  introduced in rpm 4.10.0. The real fix would be something more like
  "eliminate fdFree() and make Fclose() honor refcounts".

11 years agoRun gcc supported flags test without our stricter warning flags
Panu Matilainen [Tue, 14 Aug 2012 05:44:32 +0000 (08:44 +0300)]
Run gcc supported flags test without our stricter warning flags

- Fixes fallout from commit f9c69f803f74bd458269c7a06def494ea63387e6:
  running these tests with -Wstrict-prototypes causes all these tests
  to fail as AC_LANG_PROGRAM() uses an incomplete prototype for
  main() :(

11 years agoFix bogus "unclosed %if" error when %include is used in conditionals
Panu Matilainen [Wed, 8 Aug 2012 06:43:42 +0000 (09:43 +0300)]
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.

11 years agoAdd test for file verification from originating package
Panu Matilainen [Tue, 7 Aug 2012 09:52:29 +0000 (12:52 +0300)]
Add test for file verification from originating package

11 years agoVerify files from non-installed packages again (RhBug:826589)
Panu Matilainen [Tue, 7 Aug 2012 09:28:56 +0000 (12:28 +0300)]
Verify files from non-installed packages again (RhBug:826589)

- Verifying files against the originating, non-installed package can
  be useful sometimes, eg if rpmdb is broken or cannot be trusted.
  Of course such verification will give false positives on files that
  were intentionally skipped during installation (nodocs, wrong color,
  netshared...), that can't be helped.
- This restores the former behavior that was erroneously changed
  in commit adbd484372cb38aca5aca3c6dba3b2ca9cae93d1 while "fixing"
  an unhandled enumeration in the switch. Doh.

11 years agoAccept em64t architecture as an alias for x86_64 (RhBug:800489)
Panu Matilainen [Tue, 7 Aug 2012 08:29:03 +0000 (11:29 +0300)]
Accept em64t architecture as an alias for x86_64 (RhBug:800489)

- Some vendors insist on calling their x86_64 packages "em64t" instead
  of the more standard x86_64. Minimally support this naming convention
  as those packages aren't going away anytime soon - be liberal in
  what you accept and all, sigh.

11 years agoAdd tests for invalid --relocate detection and --badreloc functionality
Panu Matilainen [Tue, 7 Aug 2012 07:21:36 +0000 (10:21 +0300)]
Add tests for invalid --relocate detection and --badreloc functionality

11 years agoFix RPMPROB_FILTER_FORCERELOCATE aka --badreloc (RhBug:828784)
Panu Matilainen [Tue, 7 Aug 2012 06:52:15 +0000 (09:52 +0300)]
Fix RPMPROB_FILTER_FORCERELOCATE aka --badreloc (RhBug:828784)

- As noted (but since then blissfully forgotten) in the commit message,
  commit e696b409fe836bf39cbf639bac4321d658d0952d broke --badreloc
  so its been broken since rpm >= 4.9.x :-/
- Transaction problem filter is only available during rpmtsRun() so
  we have no clue whether bad relocations should be filtered or not
  during rpmte creation. Instead of creating the problems at rpmteNew()
  time, remember any bad relocations that were found and check +
  create the actual problems (unless filtered) along with other
  problems during rpmtsRun().
- Passing an "allow bad relocations" flag to rpmtsAddInstallElement()
  would be a saner option but this is a back-portable way of handling it.

11 years agoHandle all dependency tags in spec via same switch-case fallthrough
Panu Matilainen [Tue, 7 Aug 2012 05:28:26 +0000 (08:28 +0300)]
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()

11 years ago"prereq" is not a valid qualifier to regular Requires
Panu Matilainen [Tue, 7 Aug 2012 05:18:32 +0000 (08:18 +0300)]
"prereq" is not a valid qualifier to regular Requires

11 years agoExtra qualifiers like (postun) are not valid with legacy PreReq
Panu Matilainen [Tue, 7 Aug 2012 05:17:02 +0000 (08:17 +0300)]
Extra qualifiers like (postun) are not valid with legacy PreReq

11 years agoHonor RPMSENSE_MISSINGOK flag in dependency checking
Panu Matilainen [Fri, 3 Aug 2012 08:59:12 +0000 (11:59 +0300)]
Honor RPMSENSE_MISSINGOK flag in dependency checking

- For now there's no way to set this flag from packages so it doesn't
  actually do anything, but it doesn't hurt anything either, allows
  Suse & friends to drop one patch (greetings Michael :) and there
  are might be some things we could use this for internally.

11 years agoDont silence patch by default (RhBug:678000, RhBug:773503)
Panu Matilainen [Thu, 2 Aug 2012 15:16:09 +0000 (18:16 +0300)]
Dont silence patch by default (RhBug:678000, RhBug:773503)

- Unfortunately patch'es idea of "interesting" output is not ideal for
  our purposes: "patching foo.c" is of little value, but hunks with
  offsets and fuzz can be important and there's no switch to patch
  to get exactly what we want. So let it be chatty... build logs are,
  anyway.

11 years agoAdd --noclean and --nocheck options to rpmbuild
Panu Matilainen [Thu, 2 Aug 2012 08:49:48 +0000 (11:49 +0300)]
Add --noclean and --nocheck options to rpmbuild

- Ability to skip %clean build stage was requested as RhBug:756531,
  --nocheck seems otherwise useful to have as %check can take a lot of
  time, time you might not want to spend for a trivial spec change or such.

11 years agoFix memleak in changelog parsing on error paths
Panu Matilainen [Wed, 1 Aug 2012 16:17:09 +0000 (19:17 +0300)]
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.

11 years agoTurn the invalid date error to warning (related to RhBug:843525)
Panu Matilainen [Wed, 1 Aug 2012 16:03:15 +0000 (19:03 +0300)]
Turn the invalid date error to warning (related to RhBug:843525)

- The strict date validation introduced in commit
  a29e5f9894e4d97322d34b0636e5a37bff509323 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.

11 years agoRefactor the struct stat hacking into a helper function
Panu Matilainen [Wed, 1 Aug 2012 13:38:15 +0000 (16:38 +0300)]
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.

11 years agoPermit non-existent %ghost directories to be packaged (RhBug:839656)
Panu Matilainen [Wed, 1 Aug 2012 13:00:16 +0000 (16:00 +0300)]
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)

11 years agoDont bother asking libmagic about directories
Panu Matilainen [Wed, 1 Aug 2012 09:06:45 +0000 (12:06 +0300)]
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)

11 years agoReport starting line for unclosed %if in specs
Panu Matilainen [Tue, 31 Jul 2012 13:16:15 +0000 (16:16 +0300)]
Report starting line for unclosed %if in specs

11 years agoDynamically grow spec line buffer on line continuations
Panu Matilainen [Tue, 31 Jul 2012 10:36:27 +0000 (13:36 +0300)]
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...

11 years agoMinor cleanups: const pedantry and helper variable scoping
Panu Matilainen [Tue, 31 Jul 2012 10:27:30 +0000 (13:27 +0300)]
Minor cleanups: const pedantry and helper variable scoping

- Make the reading pointers const, push helpers to scope where needed

11 years agoAllocate spec line buffer separately from spec struct
Panu Matilainen [Tue, 31 Jul 2012 08:52:51 +0000 (11:52 +0300)]
Allocate spec line buffer separately from spec struct

- Further preliminaries for dynamic buffer resizing

11 years agoTrack spec parse buffer position by offset instead of pointer
Panu Matilainen [Tue, 31 Jul 2012 08:12:27 +0000 (11:12 +0300)]
Track spec parse buffer position by offset instead of pointer

- Preliminaries for dynamically reallocating the buffer

11 years agoFix (well, loosen up) the valgrind suppression rules
Panu Matilainen [Mon, 30 Jul 2012 14:22:55 +0000 (17:22 +0300)]
Fix (well, loosen up) the valgrind suppression rules

- The previous rules far too specific to glibc + gcc with certain
  optimization levels, eg relying on parse_auxv() getting inlined
  and when it does not, the suppression rules would no longer match.

11 years agoStricter validation of changelog date (RhBug:843525)
Panu Matilainen [Mon, 30 Jul 2012 11:59:35 +0000 (14:59 +0300)]
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.

12 years agoAlways print out package dependencies on build
Panu Matilainen [Thu, 12 Jul 2012 11:51:12 +0000 (14:51 +0300)]
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.

12 years agoRun gcc supported flags test with -Werror
Panu Matilainen [Thu, 12 Jul 2012 09:52:31 +0000 (12:52 +0300)]
Run gcc supported flags test with -Werror

- On gcc versions supporting -fstack-protector, not all platforms
  support this feature, causing gcc to emit only a warning instead
  of an error. Which then causes warning-spew on every compiled file.
  Run all the supported flag tests with -Werror to turn the warnings
  into errors, there could be other similar cases besides stack protector.
- Patch originally from Arnaud Patard according to this Mandriva commit:
  http://svn.mandriva.com/cgi-bin/viewvc.cgi/packages?view=revision&revision=448632

12 years agoReport config and missinok flags in deptype format extension too
Panu Matilainen [Wed, 11 Jul 2012 12:10:08 +0000 (15:10 +0300)]
Report config and missinok flags in deptype format extension too

12 years agoDefault to automatic patch application in %autosetup
Panu Matilainen [Wed, 11 Jul 2012 09:07:46 +0000 (12:07 +0300)]
Default to automatic patch application in %autosetup

- Defaults should be for the common case with disablers for those who want
  to do something special, and typically if you have patches you also
  want to apply them. Change it while we still can: eliminate -A option to
  %autosetup and apply all patches unless -N option is used.

12 years agoAccept "owner" as an alias to "user" %verify attribute (RhBug:838657)
Panu Matilainen [Tue, 10 Jul 2012 09:46:22 +0000 (12:46 +0300)]
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.

12 years agoRecognize relative paths as such in --whatprovides query
Panu Matilainen [Tue, 3 Jul 2012 05:51:09 +0000 (08:51 +0300)]
Recognize relative paths as such in --whatprovides query

12 years agoAlso track large file presence for src.rpm's (RhBug:833427)
Panu Matilainen [Mon, 2 Jul 2012 14:19:03 +0000 (17:19 +0300)]
Also track large file presence for src.rpm's (RhBug:833427)

12 years agoPush payload file size limit checking into cpio code
Panu Matilainen [Mon, 2 Jul 2012 14:11:00 +0000 (17:11 +0300)]
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.

12 years agoReport the actual failure reason on archive create failure (again)
Panu Matilainen [Mon, 2 Jul 2012 13:15:41 +0000 (16:15 +0300)]
Report the actual failure reason on archive create failure (again)

12 years agoCosmetics: remove redundant {} block, fixup indentation
Panu Matilainen [Mon, 2 Jul 2012 12:05:30 +0000 (15:05 +0300)]
Cosmetics: remove redundant {} block, fixup indentation

12 years agoDont use mmap() for anything, axe the code instead
Panu Matilainen [Mon, 2 Jul 2012 11:30:24 +0000 (14:30 +0300)]
Dont use mmap() for anything, axe the code instead

- Commit 4cb02aa928d3e41f636d0e01356c7a3cb51018ee asked to see
  what breaks when mmap() is used, now we know: large package support
  broke when enabling it. Could be fixed of course by eg adding
  a size cap to the fsm part as well, but just doesn't seem worth it:
  I fail to measure any meaningful performance improvement from mmap
  usage in either case, and added complexity for what is close to
  zero benefit just doesn't make sense... and various sources in fact
  note the rpm usage (read through the entire file sequentially) as one
  of the cases where mmap() is NOT beneficial due to mmap() high
  setup + teardown cost + page fault speed (or lack of thereof).

12 years agoArch macro for all supported PowerPC 64 processors (RhBug:818320)
Phil Knirsch [Thu, 28 Jun 2012 07:21:04 +0000 (10:21 +0300)]
Arch macro for all supported PowerPC 64 processors (RhBug:818320)

12 years agoPlain 32bit ppc cannot be a ppc64p7
Phil Knirsch [Thu, 28 Jun 2012 07:15:59 +0000 (10:15 +0300)]
Plain 32bit ppc cannot be a ppc64p7

Signed-off-by: Panu Matilainen <pmatilai@redhat.com>
12 years agoClarify/correct tag usage in rpmdbProvides()
Panu Matilainen [Wed, 27 Jun 2012 08:10:57 +0000 (11:10 +0300)]
Clarify/correct tag usage in rpmdbProvides()

- Refer to RPMTAG_* for rpmds tags, not RPMDBI_*. The values for these
  are the same, only the "intended use" differs (RPMDBI refers to
  rpmdb indexes) so this doesn't change anything in practise.

12 years agoFix obsoletes-thinko in rpmdbProvides()
Panu Matilainen [Wed, 27 Jun 2012 08:08:25 +0000 (11:08 +0300)]
Fix obsoletes-thinko in rpmdbProvides()

- dbtag cannot possibly be on obsoletes here, we need to look at deptag
  instead. This thinko in commit 5f1ec21518078e599b2499cf1ff852837ec33df7
  renders that whole commit useless. Doh.

12 years agoAdd support for quilt (ticket #54) and bzr to %autosetup/patch
Panu Matilainen [Mon, 25 Jun 2012 07:34:22 +0000 (10:34 +0300)]
Add support for quilt (ticket #54) and bzr to %autosetup/patch

- These are both "appears to have roughly the intended effect" level
  tested, but I'm not really familiar with either bzr or quilt so
  any further refinements need to come from people actually familiar
  with these tools.

12 years agoAdd a set of macros to further automate spec %prep tasks
Panu Matilainen [Thu, 21 Jun 2012 10:45:13 +0000 (13:45 +0300)]
Add a set of macros to further automate spec %prep tasks

- This adds two main macros (+ bunch of helpers) to automate the
  common case tasks in %prep:
  1) %autopatch which automatically applies all patches from a spec
  2) %autosetup which (optionally) takes care of it all, and (also
     optionally) sets up a git/hg repository of the unpacked source +
     applied patches as it  goes.
- This should be considered a starting point only, there are various
  things to improve. Eg we'd like to be able to make backups
  with plain patch (based on patch number maybe) and at least with git,
  we'd like to be able be (optionally) use 'git am' patching style
  to preserve original authors + commit messages etc.
- A noteworthy point here is that as these are fully implemented as
  macros, they are compatible with several older rpm versions as well.

12 years agoFall back to using fsync() on systems without fdatasync()
Panu Matilainen [Thu, 21 Jun 2012 06:45:16 +0000 (09:45 +0300)]
Fall back to using fsync() on systems without fdatasync()

- While fdatasync() is widely available on modernish systems,
  OS X doesn't have it

12 years agoAdd valgrind suppression file
Panu Matilainen [Tue, 19 Jun 2012 07:30:08 +0000 (10:30 +0300)]
Add valgrind suppression file

- valgrind is not happy about us now processing /proc/self/auxv on Linux,
  this can be used to suppress the false positives when running
  rpm under valgrind. At least until a better solution is found or
  valgrind is taught to treat /proc/self/auxv specially (see
  https://bugs.kde.org/show_bug.cgi?id=253519)

12 years agoOnly use local mempcpy() if system libraries dont provide one
Panu Matilainen [Thu, 31 May 2012 15:09:23 +0000 (18:09 +0300)]
Only use local mempcpy() if system libraries dont provide one

- Obvious yes, but how come this didn't barf on my other rather
  identical system? Meh.

12 years agoxmalloc() and xrealloc() never fail, remove redundant checks
Panu Matilainen [Thu, 31 May 2012 13:55:37 +0000 (16:55 +0300)]
xmalloc() and xrealloc() never fail, remove redundant checks

12 years agoCall alloca() and stat() by their own names...
Panu Matilainen [Thu, 31 May 2012 13:42:23 +0000 (16:42 +0300)]
Call alloca() and stat() by their own names...

12 years agoEliminate unnecessary glob portability fiddles
Panu Matilainen [Thu, 31 May 2012 13:34:45 +0000 (16:34 +0300)]
Eliminate unnecessary glob portability fiddles

- Flags available to our internal glob implementation do not depend on
  posix/gnu/bsd defines

12 years agoEliminate VMS, MS-DOS, Windows and Amiga compatibility hacks in rpmglob
Panu Matilainen [Thu, 31 May 2012 13:31:42 +0000 (16:31 +0300)]
Eliminate VMS, MS-DOS, Windows and Amiga compatibility hacks in rpmglob

- We'll never run on these platforms, we just dont care...

12 years agoEliminate shell interruptability hack in rpmglob
Panu Matilainen [Thu, 31 May 2012 13:27:49 +0000 (16:27 +0300)]
Eliminate shell interruptability hack in rpmglob

12 years agoWe always have xstrdup() available, eliminate redundant alternatve
Panu Matilainen [Thu, 31 May 2012 13:26:24 +0000 (16:26 +0300)]
We always have xstrdup() available, eliminate redundant alternatve

12 years agoEliminate getpwnam_r() and getlogin_r() uses from rpmglob
Panu Matilainen [Thu, 31 May 2012 13:24:57 +0000 (16:24 +0300)]
Eliminate getpwnam_r() and getlogin_r() uses from rpmglob

- We dont particularly care if rpmGlob() is thread-safe or not,
  just use the simpler code-path

12 years agoEliminate mempcpy() related conditionals from rpmglob
Panu Matilainen [Thu, 31 May 2012 13:21:57 +0000 (16:21 +0300)]
Eliminate mempcpy() related conditionals from rpmglob

- Provide a local copy of the trivial mempcpy() function so we can always
  use the shorter code-path, eliminate now unnecessary ifdef goo.

12 years agoRemove __GNUC__ conditionals on variable sized local arrays
Panu Matilainen [Thu, 31 May 2012 13:19:16 +0000 (16:19 +0300)]
Remove __GNUC__ conditionals on variable sized local arrays

- We require a C99 compiler anyway so these conditionals are not needed

12 years agoEliminate unnecessary libc header typedeffery from rpmglob
Panu Matilainen [Thu, 31 May 2012 13:14:01 +0000 (16:14 +0300)]
Eliminate unnecessary libc header typedeffery from rpmglob

- No doubt important bits in glibc but unnecessary goo for our
  internal implementation.

12 years agoRun indent -kr on the glob implementation
Panu Matilainen [Thu, 31 May 2012 13:02:41 +0000 (16:02 +0300)]
Run indent -kr on the glob implementation

- rpm style isn't exactly K&R but close enuf for goverment work
  and prevent sore eyes now that this is a "real" part of rpm.

12 years agoBury our glob() implementation entirely inside rpmglob.c (RhBug:819680)
Panu Matilainen [Thu, 31 May 2012 12:51:15 +0000 (15:51 +0300)]
Bury our glob() implementation entirely inside rpmglob.c (RhBug:819680)

- Lump glob.h and glob.c into rpmglob.c in all their g(l)ory libc
  decorations and make everything static to stop overriding system
  library symbols with our own glob().

12 years agoExport our own version of glob_pattern_p() as rpmIsGlob()
Panu Matilainen [Thu, 31 May 2012 12:40:51 +0000 (15:40 +0300)]
Export our own version of glob_pattern_p() as rpmIsGlob()

- Further preliminaries to hiding the glob() implementation

12 years agoSplit rpmGlob() to a separate source file
Panu Matilainen [Thu, 31 May 2012 12:37:11 +0000 (15:37 +0300)]
Split rpmGlob() to a separate source file

- As a preliminary step to hiding our internal glob implementation,
  split our only glob() user to a source of its own.

12 years agoAdd a test-case for various %files manifest globbing scenarios
Panu Matilainen [Wed, 30 May 2012 10:40:01 +0000 (13:40 +0300)]
Add a test-case for various %files manifest globbing scenarios

- In particular (aside from basics working) we're interested in
  the broken symlink behavior: at least glibc and Solaris have
  a weird glob() which doesn't return broken symlinks at all,
  yet we need to be able to package them (and that's why rpm
  carries its own copy of a differently broken, old glibc glob)
- Also test for directory-only match (RhBug:505995 cases)

12 years agoParametrize default vs current %verify and %attr parsing
Panu Matilainen [Tue, 29 May 2012 09:56:06 +0000 (12:56 +0300)]
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.

12 years agoInitial support for "special" %license, similar to %doc (ticket #116)
Panu Matilainen [Mon, 28 May 2012 13:31:36 +0000 (16:31 +0300)]
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)

12 years agoGeneralize special doc attribute to "special dir"
Panu Matilainen [Mon, 28 May 2012 12:26:49 +0000 (15:26 +0300)]
Generalize special doc attribute to "special dir"

12 years agoHandle rpmfiNew() failure centrally in genCpioListAndHeader()
Panu Matilainen [Mon, 28 May 2012 09:14:15 +0000 (12:14 +0300)]
Handle rpmfiNew() failure centrally in genCpioListAndHeader()

12 years agoFix spec parsing memleak from source header on buildarch recursion
Panu Matilainen [Mon, 28 May 2012 09:02:47 +0000 (12:02 +0300)]
Fix spec parsing memleak from source header on buildarch recursion

12 years agoEliminate redundant helper variables from src.rpm generation
Panu Matilainen [Mon, 28 May 2012 08:39:45 +0000 (11:39 +0300)]
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

12 years agoMove file list freeing to helper function
Panu Matilainen [Mon, 28 May 2012 08:06:46 +0000 (11:06 +0300)]
Move file list freeing to helper function

12 years agoHardlink detection doesn't need entire filelist, just the actual records
Panu Matilainen [Mon, 28 May 2012 06:56:11 +0000 (09:56 +0300)]
Hardlink detection doesn't need entire filelist, just the actual records

12 years agoisDoc() only needs the doc dirs, not the entire filelist
Panu Matilainen [Mon, 28 May 2012 06:51:29 +0000 (09:51 +0300)]
isDoc() only needs the doc dirs, not the entire filelist

12 years agoClean up file records freeing a bit
Panu Matilainen [Mon, 28 May 2012 06:47:58 +0000 (09:47 +0300)]
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.

12 years agoSplit the actual file records into a struct of their own
Panu Matilainen [Mon, 28 May 2012 06:39:48 +0000 (09:39 +0300)]
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.

12 years agoUse vfaMatch() for %config attributes as well
Panu Matilainen [Mon, 28 May 2012 05:57:09 +0000 (08:57 +0300)]
Use vfaMatch() for %config attributes as well

12 years agoUnify %verify and virtual file attribute handling
Panu Matilainen [Mon, 28 May 2012 05:54:30 +0000 (08:54 +0300)]
Unify %verify and virtual file attribute handling

12 years agoEliminate unused negate field of VFA struct
Panu Matilainen [Mon, 28 May 2012 05:50:55 +0000 (08:50 +0300)]
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

12 years agoPush special %doc handling details out of processPackageFiles()
Panu Matilainen [Fri, 25 May 2012 12:01:19 +0000 (15:01 +0300)]
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.

12 years agoRefactor getSpecialDocDir() so it cannot fail
Panu Matilainen [Fri, 25 May 2012 11:14:42 +0000 (14:14 +0300)]
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.

12 years agoAdd support for 7zip compressed tarballs
Christophe Fergeau [Thu, 10 May 2012 21:27:56 +0000 (23:27 +0200)]
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).

12 years agoSplit prelink checking into a helper function
Panu Matilainen [Mon, 21 May 2012 11:52:19 +0000 (14:52 +0300)]
Split prelink checking into a helper function

- No functional changes, just makes the thing a little bit more readable
  as the ELF details are buried out of sight in the helper

12 years agoRestore basic debug output for fsm operations
Panu Matilainen [Mon, 21 May 2012 10:17:39 +0000 (13:17 +0300)]
Restore basic debug output for fsm operations

- This is close to what we had in the stage-machine days, just to allow
  easily viewing whats going on inside the fsm (create/skip/etc)

12 years agoPush special doc directory generation next to other special doc foobar
Panu Matilainen [Wed, 16 May 2012 14:01:29 +0000 (17:01 +0300)]
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.

12 years agoRefactor special doc handling out of parseForSimple()
Panu Matilainen [Wed, 16 May 2012 12:07:53 +0000 (15:07 +0300)]
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.

12 years agoparseForSimple() doesn't need the entire file list anymore
Panu Matilainen [Wed, 16 May 2012 09:03:56 +0000 (12:03 +0300)]
parseForSimple() doesn't need the entire file list anymore

12 years agoNegation doesn't make sense for any of the virtual file attributes
Panu Matilainen [Wed, 16 May 2012 08:36:53 +0000 (11:36 +0300)]
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.

12 years agoHandle %dir parsing with an internal file attribute
Panu Matilainen [Wed, 16 May 2012 08:29:09 +0000 (11:29 +0300)]
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.

12 years agoHandle %docdir with an internal file attribute
Panu Matilainen [Wed, 16 May 2012 08:05:44 +0000 (11:05 +0300)]
Handle %docdir with an internal file attribute

- Simplifies and cleans up things a bit as parseForSimple() now only
  parses this and processPackageFiles() acts on the result, and
  doesn't need specific argument checking now (only %doc is allowed
  to have more than one file per line)

12 years agoExplicitly differentate internal/exported file attributes
Panu Matilainen [Wed, 16 May 2012 07:40:01 +0000 (10:40 +0300)]
Explicitly differentate internal/exported file attributes

- RPMFILE_EXCLUDE only exists during spec parse, and doesn't "leak"
  into headers only because the file is, well, excluded to start with.
  Unexport the internal-only bit and explicitly strip out any excess
  bits from data going to header. The current 16/16 split is artificial
  of course, RPMTAG_FILEATTRS is 32bit so there's plenty of room
  for growing new file attributes, with internal-only adjustments
  required.
- Eliminate RPMFILE_UNPATCHED while at it, this is a leftover
  from Suse patch rpms which are no longer used anywhere.

12 years agoUnmask %license directive when parsing %files section
Panu Matilainen [Tue, 15 May 2012 11:23:35 +0000 (14:23 +0300)]
Unmask %license directive when parsing %files section

- This always was a rare creature, driven to extinction long time
  ago when Copyright: changed to License: which masks the %license
  directive of %files list with a macro holding the the textual
  description from License tag, causing errors.
- Override %license during %files parsing to bring back its original
  meaning, useless as it might be in its current form.

12 years agoEliminate unused argument to parseForSimple()
Panu Matilainen [Tue, 15 May 2012 08:39:24 +0000 (11:39 +0300)]
Eliminate unused argument to parseForSimple()