Commit Graph

445 Commits

Author SHA1 Message Date
Panu Matilainen e65e27ab25 Make macro deletion in freeArgs() optional
- Not used yet, but using this for issuing warnings only
2014-02-28 16:12:33 +02:00
Panu Matilainen ae58c96248 Move macro usage tracking to flags
- We dont really care how many times a macro has been used, just
  whether it has been used or not...
2014-02-28 16:10:14 +02:00
Panu Matilainen fae7325f8d Add + use a flag for identifying automatic macros
- In practise doesn't change anything visible as the "macro not used"
  message is disabled, but tracking a flag bit is saner than
  strlen() + strchr() + bunch of other stuff which isn't even correct:
  prior to this %## would've triggered "unused" errors which is plain
  wrong, and complaining about unused %1 %2 ... isn't really right
  either.
2014-02-28 15:57:09 +02:00
Panu Matilainen 647f0d488f Revert stricter macro substitution syntax entirely, for now
- Revert back to pre commit c22d5b1299
  state wrt macro substitution. The commit does have fixes we want
  but it also breaks valid cases which is not okay. We really need
  a far more thorough macro test suite before these kind of changes,
  and also need to do the changes in more controlled pieces.
2014-02-25 16:17:37 +02:00
Panu Matilainen df686992d7 Perform as-is substitution for %{name} form too, again
- Commit c22d5b1299 changed the parsing
  to require a valid name in %{name} macro, but this outlaws existing
  uses such as %{foo_%{bar}_something}. Relaxing the %{name} form
  to use as-is substitution as well allows these to work again.
2014-02-20 10:42:09 +02:00
Panu Matilainen 1bdcd05008 Dont eat newlines on parametrized macro invocations (RhBug:1045723)
- Makes the testcase from commit f082b5baa4
  succeed. While the old behavior is non-sensical and most likely entirely
  unintentional, we're changing a very long-standing behavior here (tested
  back to rpm 4.4.x and almost certainly much much older than that) so
  its entirely possible people are actually relying on the old
  behavior. Lets see what breaks...
2014-02-19 14:24:54 +02:00
Panu Matilainen 784dfb4219 Port %{load:<path>} macro from rpm5.org
- Allow loading custom macro files from eg specs. This is quite different
  from %include which inlines arbitrary content into a spec, but which
  cannot be used for including macro files as their syntax is entirely
  different. Both have their uses.
- rpm5.org also supports %load within macro files, we dont as I find the
  imperative %load very alien in what's otherwise an entirely declarative
  file "format"
2014-01-30 14:57:52 +02:00
Panu Matilainen ae57958971 Fix ages old segfault on trying to expand %{lua} (RhBug:972646)
- Using the already calculated macro arg + arglen for copying the
  buffer instead of buggy local variant helps... This is as old as
  the embedded lua interpreter in rpm, close to a decade.
- Besides fixing the segfault, this actually makes it behave like
  other built-ins, evaluating to empty string when an empty arguments
  or no arguments are passed.
2013-06-11 11:33:53 +03:00
Panu Matilainen 99b40fe5ab Dont try to expand zero-length arguments to built-in macros
- Previously various built-in macros without an actual argument,
  eg %{basename:} would evaluate to "}" which makes no sense
  whatsoever. With this, they evaluate to an empty string similarly
  to when no argument is passed, eg %{basename}. Arguably these
  should emit an error/warning instead but for now...
2013-06-11 10:46:50 +03:00
Panu Matilainen f173f747cd Revert "Fix segfault trying to expand %{lua} (RhBug:972646)"
- This reverts commit 43a34e1554,
  contrary to what the comment said the is NOT how other built-ins
  behave, they evaluate to an empty string without an argument.
  Better fix needed...
2013-06-10 15:31:01 +03:00
Panu Matilainen 43a34e1554 Fix segfault trying to expand %{lua} (RhBug:972646)
- %{lua:...} is used for invoking the embedded Lua interpreter, in
  which case the script must be passed as the macro argument. If
  no argument is passed, let it fall through to normal macro expansion.
  This might not be the most sensible behavior possible but at least
  its in line with what currently happens with other similar built-in
  macros.
2013-06-10 14:44:55 +03:00
Panu Matilainen 71e2d38e3d Make macros thread-safe ... sort of
- Add the actual locking into macro context acquire + release. We're
  using a mutex instead of rwlock because currently any macro can
  involve defines and undefines and we dont know it beforehand. So
  we just use a bigger hammer...
- The macro engine internals shouldn't need recursive mutexes but
  unfortunately Lua macro bindings, which are limited to the
  lock-on-entry interfaces can and do get called recursively
  from macros so currently there's not much choice but to use
  recursive mutex for the macro contexts. What makes it even uglier
  is that there's no portable static initializer for recursive mutex
  so we need to add yet another pthread-construct to safely dynamically
  initialize the mutexes :(
- Of course this doesn't make bunch of threads simultaneously messing
  with macros behave sane: if one thread tries to load new macros
  and the other one frees them, they shouldn't crash but the
  results are unlikely to be what the caller intended. The purpose
  here is just to allow the occasional rpmExpand() and such to
  complete without crashing and burning when multiple threads are
  doing stuff like trying to read packages from disk.
2013-05-22 15:35:29 +03:00
Panu Matilainen 09499d994b Add and use internal (lockless) function for copying macro contexts
- rpmLoadMacros() is a dumb name for what it does: it copies macros
  from one context to another. The only actual use within rpm is
  to copy back the cli macros to global context, but make the
  internal helper more flexible by allowing copying to any context.
- rpmLoadMacros() is mostly just a dumb wrapper around copyMacros()
  to grab locks and guard against copying global context to itself.
  Adjust rpmInitMacros() to use copyMacros() as it already has a
  lock on the global table, it just needs a lock on the cli contexts
  as well.
2013-05-22 11:43:40 +03:00
Panu Matilainen 62d36cce61 Add and use internal (lockless) version of rpmLoadMacroFile()
- rpmInitMacros() already grabs the (theoretical) lock on entry
  so we shouldn't try to grab it again, use the new lockless
  loadMacroFile() version for the purpose.
- rpmLoadMacroFile() is now just a simple lock-wrapper around
  loadMacroFile()
2013-05-22 11:27:29 +03:00
Panu Matilainen bfda1b6013 Add and use internal (lockless) version of rpmDefineMacro()
- rpmLoadMacroFile() already grabs the (theoretical) lock on entry
  so we shouldn't try to grab it again, use the new lockless
  defineMacro() version for the purpose.
- rpmDefineMacro() is now just a simple lock-wrapper around defineMacro()
2013-05-22 11:22:08 +03:00
Panu Matilainen 1036601e3e Add and use dummy macro context lock acquire + release functions
- Add and use dummy macro context lock acquire + release functions,
  ATM these only centralize the NULL -> rpmGlobalMacroContext translation.
- Eliminate the NULL context translation from internal interfaces,
  ensure its always done at the outer levels already.
- At least rpmLoadMacros() and rpmLoadMacroFile() are fishy wrt
  theoretical locking at this point and will require further internal
  helpers...
2013-05-22 11:10:15 +03:00
Panu Matilainen acead93927 Group exported functions to end of macro.c, no functional changes
- Having the external interfaces together makes it easier to keep
  tracking of locks and all..
2013-05-22 10:29:19 +03:00
Panu Matilainen b823075695 Separate internal vs external macro add and delete functions
- Rename addMacro() and delMacro() to pushMacro() and popMacro()
  respectively, change all internal callers to use the push/pop
  variants. Make addMacro() and delMacro() just dummy wrappers
  for the internal variants.
- No functional changes, just paving way for adding thread-safety
  mutex: we'll be locking at the external API boundary to keep
  things simple, avoid nested locking etc.
2013-05-22 10:18:42 +03:00
Panu Matilainen c012a76985 Optimize expandMacro() a bit, based on patch by Alexey Tourbin
- Avoid the expensive calloc() when creating a macro expansion buffer,
  malloc() suffices just as well as long as we initialize the first
  byte in the buffer. This is easily visible on wall-clock times.
- Avoid recalculating source string length: when caller doesn't
  pass slen, we always calculate the string length for creating
  a terminated copy, no need to redo it...
- Add a warning comment about the seemingly obvious optimization
  breaking macro undefining itself, this is starting to look like
  a recurring theme :)
2013-04-16 11:07:03 +03:00
Panu Matilainen a944143cf5 Clarify the macro entry struct a bit
- Macro name, opts and body must not be freed or otherwise written
  to after initialization, make them const pointers to clarify
  (and enforce) this. Arena is used to store whatever we need: it
  always contains the macro body, sometimes also name and/or opts,
  but these can be pointers to elsewhere too.
2013-04-04 11:24:01 +03:00
Alexey Tourbin 301d5450a1 Improve macro table performance
In the existing implementation, when a new macro is added, the whole
table has to be sorted again.  Hence the cost of adding n macros is
worse than O(n^2), due to arithmetic progression.

This change drops all qsort(3) stuff altogether, by carefully preserving
table in sorted order.  In findEntry routine, bsearch(3) is replaced
with customized binary search which tracks position for insertion.
In the addMacro routine, if a matching entry is not found, this
position is used for direct insertion, after the rest of the elements
are "shifted to the right" with memmove(3).  Likewise, in delMacro
routine, the elements are shifted back to the left when the last macro
definition is popped.  Technically, shifting half of the array with
memmove(3) is still O(n^2); however, modern CPUs process contiguous
memory in a very efficient manner, and glibc provides a fine-tuned
memmove(3) implementation.

Also, macro table entries are now allocated in a single chunk.

This change reduces rpm startup costs by factor of 6.  Also, this change
improves specfile parser performance by a factor of 2 (e.g. the parse
time of texlive.spec is reduced from 67s to 35s).

Signed-off-by: Panu Matilainen <pmatilai@redhat.com>
2013-04-04 11:10:40 +03:00
Alexey Tourbin c22d5b1299 Stricter macro substitution syntax
This change introduces a separate routine to parse for valid macro
names.  Valid macro names are either regular 3+ character identifiers,
or special names: "S", "P", "0", "#", "*", "**", macro options such as
"-o" and "-o*", and macro arguments such as "1".  Other names are not
valid.  This fixes a number of bugs seen earlier due to sloppy name
parsing: "%_libdir*" and "%01" were not expanded (these are now expanded
to e.g. "/usr/lib64*" and "<name>1", as expected).  This also fixes
bugs in as-is substitution: "%!foo" was expanded to "%foo", and likewise
"%!!!" was expanded to "%" (and to "%<garbage>" at EOL).

Also, bad names in %name and %{name...} substitutions are now handled
differently.  In %name form, the name is parsed tentatively; a silent
fall-back to as-is substitution is provisioned when no valid name can
be obtain.  In %{name...} form, a failure to obtain a valid name is now
a syntax error.  Furthermore, only 3 variants are syntactically valid:
%{name} proper, %{name:...}, and %{name ...}.  This renders invalid
ambiguous macro substitutions such as the one found in FC18 lvm2.spec:

Requires: util-linux >= %{util-linux_version}
error: Invalid macro syntax: %{util-linux_version}
Signed-off-by: Panu Matilainen <pmatilai@redhat.com>
2013-02-12 15:53:04 +02:00
Alexey Tourbin 2d647098c8 Fixed buffer problems in doShellEscape
When the output from a command is empty, nothing stops doShellEscape from
chopping newlines past the beginning of the buffer.  This problem was first
identified by Dmitry V. Levin in July 2009.

Also, there is an off-by-one error in replacing trailing '\n' with '\0'.
This problem, however, escaped the attention of Dmitry V. Levin in July 2009.

Signed-off-by: Panu Matilainen <pmatilai@redhat.com>
2013-02-12 08:30:33 +02:00
Alexey Tourbin 0eb0da9af9 Warn when whitespace is missing before macro body
This will now issue a warning when macro definition is possibly
incorrect or ambigous, such as the one found in FC18 lvm2.spec:

%define util-linux_version 2.22.1
warning: Macro %util needs whitespace before body

Signed-off-by: Panu Matilainen <pmatilai@redhat.com>
2013-02-09 14:36:30 +02:00
Thierry Vignaud 8192e580a0 display the actual unknown option instead of '?'
'?' is returned by getopt when option is unknown, making hard to
pinpoint the actual bogus option...

Signed-off-by: Panu Matilainen <pmatilai@redhat.com>
2012-12-18 10:38:36 +02:00
Panu Matilainen 1fdcb341cd Enable built-in %dirname macro
- This might've clashed with %dir in spec %files at some point as
  indicated by the comments, but that should no longer be the case.
2012-11-01 12:12:51 +02: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 db782b4b62 Keep the macro buffer terminated on append
- This isn't strictly needed as we're terminating the buffers "just in
  case" all over the place but handling this centrally might allow
  some day eliminating the other fluff...
2012-05-10 11:49:24 +03:00
Panu Matilainen 6101cac6b3 Fix off-by-ones in mbAppend() and mbAppendStr()
- Oops, remember to reserve space for the trailing \0 when appending.
  mb->nb holds the number of actual characters left in the buffer,
  not the terminator. Fixes a regression introduced in rpm 4.9.x
  dynamic macro realloction work (RhBug:431009 reprise)
2012-05-10 11:28:39 +03:00
Panu Matilainen bd4fc30884 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
2011-05-31 11:38:38 +03:00
Panu Matilainen 6c391a88fa Use popMacro() when freeing the entire macro table
- We already have a function to free macro entries, use it to
  remove code duplication
2011-05-31 11:03:43 +03:00
Panu Matilainen 182e9f8a64 Eliminate bunch of obvious dead NULL-assignments around librpmio 2011-05-28 19:43:52 +03:00
Panu Matilainen ecfece7ec0 Add support for nested Lua macro expansion (RhBug:490740)
- Lift the printbuffer accounting out of rpmlua into a struct of
  its own (Funny thing, this looks a whole lot like the macro
  expansion buffer and Good Ole StringBuf Brothers ... Boys ... Mam.
  Unify them one of these days maybe)
- Replace the simplistic on/off printbuffer with a stack of buffers,
  fixup the lone caller to use the new internal push/pop API.
2011-05-24 20:41:38 +03:00
Panu Matilainen 0b36a1f18e Eliminate bogus ferror() checks
- 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.
2011-05-18 10:59:54 +03:00
Michael Schroeder f4c79584d0 Always copy macro source when expanding it
- A macro can undefine itself, and unless we grab a copy of it we'll
  end up accessing already freed memory. Fixes a regression from
  commit ebc4ceaaeb which assumed
  a copy is not always needed.

Signed-off-by: Panu Matilainen <pmatilai@redhat.com>
2011-05-18 09:10:11 +03:00
Ville Skyttä e254f9b9d4 Add lrzip support.
Signed-off-by: Panu Matilainen <pmatilai@redhat.com>
2011-04-29 08:49:05 +03:00
Ville Skyttä bcad08867d Add lzip support.
Signed-off-by: Panu Matilainen <pmatilai@redhat.com>
2011-04-29 08:48:56 +03:00
Panu Matilainen 1817ac020e Plug memory leaks on macro definition error cases 2011-03-17 15:35:42 +02:00
Panu Matilainen 131d082aab Handle non-terminated substrings centrally in expandMacro()
- expandMacro() is big and ugly already, but handling the non-terminated
  substrings there once and for all avoids having to ping-pong recurse
  through couple of helpers to get there.
2010-09-27 17:15:15 +03:00
Panu Matilainen b1dbdf50af Dynamic expansion buffer reallocation for lua macros too 2010-09-27 16:32:15 +03:00
Panu Matilainen 800a1daa23 Whoops, fix typo/thinko from commit dc258bac41 2010-09-27 16:22:38 +03:00
Panu Matilainen 46f32d25ce Eliminate the internal in-place-expansion buffer limitation
- Return the dynamically allocated expansion buffer to callers from
  expandU(), except using a slightly less cryptic expandThis() name
  for it now. Also deal with non-terminated strings centrally in
  expandThis() instead of doing alloc + copy to terminate in every caller.
2010-09-27 16:10:36 +03:00
Panu Matilainen d8777387db Simplify / sanitize expandU() a bit
- Instead of saving and restoring the bits we'll mess with, just
  make a temporary expansion state struct with non-buffer state
  copied from "parent".
2010-09-27 14:55:12 +03:00
Panu Matilainen 49f99b8656 Dynamically reallocate macro expansion buffer (ticket #45)
- Eliminate the underlying limitation of macro expansion limit by
  growing the buffer as needed when adding characters to it. This
  doesn't fix the entire issue yet however: expandU() and expandMacros()
  are still limited to caller-specified buffer size, and output
  from lua-macros isn't dynamically resized. One step at a time...
2010-09-27 14:55:12 +03:00
Panu Matilainen 61a3fc4523 Let expandMacro() allocate its own buffer
- More pre-requisites for dynamic buffer resizing, callers have no
  clue how much expandMacro() is going to need.
2010-09-27 14:55:12 +03:00
Panu Matilainen dc258bac41 Track current expansion point via distance to buffer start
- Supposedly no functional changes, just paving way for dynamic
  buffer resizing which is impossible when accessing pointers directly.
2010-09-27 14:55:12 +03:00
Panu Matilainen 568ba0d242 Push the macro buffer size limit down by one level
- Turn expandMacros() into a wrapper around internal doExpandMacros()
  which returns the expanded string in a newly allocated buffer, use
  the internal version for rpmExpand() too.
2010-09-27 14:55:12 +03:00
Panu Matilainen a931202422 Eliminate unused spec field from macro expansion state struct 2010-09-27 14:55:11 +03:00
Panu Matilainen 8082eb48db Avoid calloc() in macro findEntry()
- It's just the macro name we're grabbing here, that ought to fit
  on stack comfortably enough.
2010-09-27 14:55:11 +03:00
Panu Matilainen ebc4ceaaeb Avoid unnecessary round-trip through expandT() where possible
- In the cases where expandT() was called with strlen(source) we can
  now just bypass it and call expandMacro() directly, avoiding an
  unnecessary string copy.
2010-09-27 14:55:11 +03:00
Panu Matilainen ccba5236a0 Use function arguments to pass, duh, arguments into functions. Duh.
- No functional changes, just eliminating mindless save-and-restore
  ping-pong through macro expansion state struct.
2010-09-27 14:55:11 +03:00
Jindrich Novy 7f220202f2 Redirect macro stack backtrace printing to debug log. 2010-07-13 13:35:22 +02:00
Jindrich Novy 60be56e317 Fix cryptic macro evaluation error message (RhBug:613010) 2010-07-13 13:34:05 +02:00
Panu Matilainen c16cde7a4d Revert "Always free locally defined macros when they go out of scope"
- the "fix" breaks seemingly legitimate use in fedora font package
  macros, possibly some funky interaction with %{lua: } macros or something
- this reverts commit f895acd285.
2010-01-07 12:04:53 +02:00
Panu Matilainen f895acd285 Always free locally defined macros when they go out of scope
- Prior to this, local defines in constructs like %{!?foo: %define foo bar}
  would remain defined until a parametrized macro gets called, causing
  obscure and confusing errors in specs such as RhBug:551971 and countless
  others. Use of %global is now always required for such constructs.
2010-01-04 12:45:18 +02:00
Panu Matilainen 2c5ea0b188 Remove -98 vintage ifdef'ed dead code 2010-01-04 10:52:22 +02:00
Panu Matilainen 2553ca2fe3 Move getopt() portability fiddles out of system.h
- only macro.c needs, no point polluting includes everywhere
2009-12-23 14:02:19 +02:00
Ville Skyttä 1892984f02 Decompress lzma files with xz. 2009-10-06 10:47:36 +03:00
Panu Matilainen f634253b32 Eliminate unused variable 2009-09-07 17:50:43 +03:00
Panu Matilainen f4b39519d3 Replace equal/not equal uses of str[n]cmp() with rstreq[n] in io code 2009-08-31 11:15:16 +03:00
Panu Matilainen 3d63df6220 Handle XZ in %uncompress macro
- should've been in commit 8078d0ba24
2009-03-27 14:11:43 +02:00
Panu Matilainen 2d2bda29c1 Add built-in %getconfdir macro for getting rpmConfigDir() value
- define %_rpmconfigdir via %getconfdir in the main macro config, this
  avoids it getting lost on macro reloads as happens when building
  several packages at once
2009-03-27 14:01:47 +02:00
Panu Matilainen 947ad7acb3 Add getenv macro, use instead of $(echo $HOME) for defauls
- inspired by http://lists.rpm.org/pipermail/rpm-maint/2009-January/002332.html
2009-01-16 09:09:40 +02:00
Panu Matilainen da83a562e1 Add function to retrieve rpm config base directory
- one-shot to determine configuration base directory path from
  RPM_CONFIGDIR environement or build-time default
- rpmfileutil is a bit strange place, this would really belong to librpm
  but Lua initialization needs the path so...
2008-11-22 18:06:31 +02:00
Panu Matilainen 49c515179a Permit tab as whitespace between macro arguments (rhbz#467567)
- another dumb regression from macro handling cleanups
2008-10-19 01:53:03 +03:00
Panu Matilainen 9f85707825 Macro argument handling regression regression (rhbz#461180)
- commit f366011c42 is too simplistic and
  broke other stuff in turn...
2008-09-11 16:56:50 +03:00
Panu Matilainen 1d9b4d00d7 Make rpmExpand() smarter wrt memory allocations
- precalculate unexpanded size and allocate enough for that plus MACROBUFSIZ
  for expansion
- typical allocation is way smaller than what gets allocated "just in case",
  calculate expanded size and realloc to actual size to avoid wasting
  memory
2008-07-16 10:52:33 +03:00
Panu Matilainen 889f9f5b41 Eliminate another unnecessary temp variable
- do all the copying inside a loop
2008-07-16 10:33:57 +03:00
Panu Matilainen 1b19676027 Eliminate unnecessary variable
- leftover from static buffer times..
2008-07-16 10:24:05 +03:00
Panu Matilainen f366011c42 Macro argument handling regression (rhbz#455333)
- expandMacro() wants the next \0 character to be returned, which might
  or might not be the same as lastc passed to grabArgs()
- use memcpy() instead of memmove() for the copy, the areas can't overlap
2008-07-16 09:40:10 +03:00
Panu Matilainen af9518dce2 Use correct type for strlen() 2008-06-10 10:02:52 +03:00
Panu Matilainen 485d195488 Plug memleak in macro doFoo() 2008-04-29 17:39:02 +03:00
Panu Matilainen 9ae911eefe Further simplify rpmInitMacros()
- Use argvSplit() for splitting the macro path to components instead of
  manual pointer-parsery.
- If URL's are to be supported or accepted at all (previous code attempted
  to skip them), ':' is a very poor delimiter character.
2008-04-19 16:42:56 +03:00
Panu Matilainen e336146a9e Use argvFree() to free, well, an argv, instead of manual freeing 2008-04-19 16:04:11 +03:00
Panu Matilainen 601b4d0e6a Avoid entirely silly rpmio FD_t use
- rdcl() converts to FILE internally anyway, might as well use fopen()
  to begin with...
2008-04-18 16:14:15 +03:00
Panu Matilainen 38a975b157 Remove unnecessary xstrdup() of dynamically allocated buffer
- leftover from when target buffer was static...
2008-04-18 15:39:07 +03:00
Panu Matilainen 94e64fec18 Cosmetics: group operations more logically... 2008-04-18 15:15:05 +03:00
Panu Matilainen 2d8a27ed16 Simplify macro option + argument processing
- eliminate ninja-voodoo pointer-hackery parsing, replace argvSplit() +
  argvJoin() and friends
- eliminate static sized buffers from the processing
2008-04-18 14:59:03 +03:00
Panu Matilainen 02939c15fa More accurate filtering of .rpmnew etc when reading macros
- strstr() can give false positives, use rpmFileHasSuffix() instead
2008-04-17 17:33:30 +03:00
Panu Matilainen 3c1126b2a5 Missing decompression arguments for bzip in uncompress macro 2008-04-04 15:52:52 +03:00
Panu Matilainen 7ddab3ab8d Dead code removal (macro stuff) 2008-03-31 10:44:23 +03:00
Panu Matilainen c908277be2 Minimal namespacing for locale-insensitive x*() string functions 2008-03-18 09:10:13 +02:00
Panu Matilainen 05129f83dc Make bunch of macro internal variables static 2008-02-26 22:24:28 +02:00
Panu Matilainen cc69dd20b8 Allocate macro buffers dynamically
- avoids some entirely needless overflow cases
- somewhat similarly to rpm5.org but use heap instead of stack
2008-02-01 13:00:40 +02:00
Panu Matilainen 56405587f4 Allocate various macro buffers from heap not stack 2008-02-01 12:11:03 +02:00
Panu Matilainen 54ab76019e Define + use MACROBUFSIZ for macro expansion buffer size
- double the buffer size while at it...
2008-02-01 11:36:13 +02:00
Panu Matilainen d3d60512bd Macro shell expansion fixes (rhbz#431009) 2008-02-01 11:09:13 +02:00
Panu Matilainen eb5dc35c19 Include spring-cleaning
- put some consistency into include ordering
- everything (apart from bits missed ;) is now ordered like this
  1. "system.h"
  2. other system includes
  3. rpm public headers
  4. rpm private headers
  5. "debug.h"
2008-01-30 17:05:29 +02:00
Panu Matilainen 95b03441cc Rename isCompressed() -> rpmFileIsCompressed() for namespacing 2008-01-27 16:39:40 +02:00
Panu Matilainen eec03952be Make uncompress macros match reality (_ vs __ prefix) 2008-01-23 07:56:51 +02:00
Panu Matilainen 8e00018c88 Fix some const issues in macros 2007-12-19 12:49:52 +02:00
Panu Matilainen 78ad426f04 Remove bogus const from rpmGlob argv return type
- it's malloced and must be freed by caller
2007-12-18 10:17:18 +02:00
Panu Matilainen c41f61369e Unconstify macro contents, fully contained within macro module 2007-12-16 21:28:37 +02:00
Panu Matilainen f5a712db5b Remove bogus consts.. 2007-12-14 15:50:17 +02:00
Panu Matilainen 9ce13e09ef Switch to <rpm/foo.h> style for public headers
- adjust include paths accordingly
2007-12-08 14:02:32 +02:00
Panu Matilainen 89527785bb Move logging related macros rpmlog, adjust includes 2007-11-30 23:08:38 +02:00
Ralf Corsépius 8ef0ca213f Expand private include file names to be relative to $(top_srcdir) 2007-11-23 11:41:29 +01:00
Panu Matilainen 7b2a9b3c24 Move rpmGlob() from macros to rpmfileutil.h
- macros is all just macros now
- internal copy of popt stuff needs to go...
2007-11-23 10:27:29 +02:00
Panu Matilainen 2c6905dd9f Move rpmGetPath and rpmGenPath to rpmfileutil.h 2007-11-23 10:20:19 +02:00
Panu Matilainen 178e32a0ba Move rpmCleanPath from macros to rpmfileutil.h 2007-11-23 10:10:19 +02:00
Panu Matilainen ff77bfa2a1 Move file compression stuff from rpmmacro.h to rpmfileutil.h 2007-11-23 10:05:49 +02:00
Panu Matilainen 4ad615daf5 Move the xstr*() string variants from rpmio.h to rpmstring.h 2007-11-23 08:32:08 +02:00
Ralf Corsépius abeea80a38 Use #include <x.h> syntax to include public headers. 2007-11-23 06:46:19 +01:00
Panu Matilainen 17ef8a3082 Lose rpmerr.h for good 2007-11-19 16:32:15 +02:00
Panu Matilainen 43c5de66fb Replace all RPMERR_* etc uses with corresponding RPMLOG_* levels 2007-11-19 16:25:24 +02:00
Panu Matilainen 0781adb1cb Eliminate macro struct internals from the API 2007-11-02 10:40:45 +02:00
Panu Matilainen bdd3cd3ed6 Macros don't need rpmio_internal 2007-10-29 12:55:43 +02:00
Panu Matilainen 46e669f06e Remove bunch of long-dead macro debug stuff 2007-10-29 09:30:45 +02:00
Ralf Corsépius 9735f83012 Include "rpmio_internal.h" instead of <rpmio_internal.h>. 2007-10-28 06:43:19 +01:00
Ralf Corsépius d7c7203182 Include "rpmerr.h" instead of <rpmerr.h>. 2007-10-28 06:43:10 +01:00
Ralf Corsépius b1f8da9252 Include "rpmlua.h" instead of <rpmlua.h>. 2007-10-28 06:36:11 +01:00
Ralf Corsépius e36a2ac8da Include "rpmmacro.h" instead of <rpmmacro.h>. 2007-10-28 06:32:05 +01:00
Ralf Corsépius 942da02937 Include "rpmmessages.h" instead of <rpmmessages.h>. 2007-10-28 06:17:49 +01:00
Ralf Corsépius 272d591973 Add support for lzma compressed "Sources". 2007-10-10 08:39:01 +02:00
Panu Matilainen d709195c3a Replace all rpmError() uses with rpmlog() 2007-10-09 14:06:06 +03:00
Ralf Corsépius 6ea5c0023f Use enums instead of ints for processing isCompressed ret-val. 2007-10-09 10:02:49 +02:00
Panu Matilainen 8c7b929a14 Never glob non-local paths in rpmGlob() 2007-10-01 14:29:10 +03:00
Panu Matilainen 83f0947586 Rename MacroContext and -Entry to rpmMacro* for namespacing 2007-09-20 15:52:03 +03:00
Panu Matilainen 154a7f7603 Move _free() into system.h for now
- get rid of dozen _free() definitions
- get _free() out of public headers
2007-09-20 15:37:48 +03:00
Ralf Corsépius 8fa3c5becf Remove splint remnants. 2007-09-20 07:36:41 +02:00
Ralf Corsépius e9f3a5c89d Remove splint tags. 2007-09-11 19:23:32 +02:00
Ralf Corsépius f982bbaa79 Remove splint tags. 2007-09-11 16:48:54 +02:00
Ralf Corsépius bc5bbd543f Remove __LCLINT__-ifdef'ed blocks. 2007-09-03 13:29:05 +02:00
Panu Matilainen 8d0ad625b9 Don't read *.rpmnew etc macro files 2007-08-30 13:02:12 +03:00
Panu Matilainen de9061b214 Fix monday morning thinkos wrt macro buffer changes.
The expanded size is of course not known beforehand.. check for size
before copying instead.
2007-08-27 11:01:39 +03:00
Panu Matilainen 40d25ee3ea Fix potential buffer overflow in macro primitive execution
Use dynamic buffer, we know the needed size here...
2007-08-27 09:55:42 +03:00
Panu Matilainen ad7c8e98c9 Fix potential buffer overflow in macro findEntry()
Avoid static buffer, we know the size...
2007-08-27 09:51:52 +03:00
Panu Matilainen 0e74bc98be Fix potential buffer overflow by using dynamic buffer size. 2007-08-27 09:48:00 +03:00
Panu Matilainen ca7b28eb35 Fix buffer overflow in macro shell escaping (#253971)
We know the required buffer size here, no point in using static buffer.
2007-08-27 09:45:53 +03:00
Panu Matilainen de50397c71 Plug some memory leaks.
Patches from rpm5.org / JBJ.
2007-07-02 15:02:15 +03:00
jbj 6aed9338a6 - fix: % at end-of-line overflow (#161091).
CVS patchset: 7874
CVS date: 2005/07/13 09:52:45
2005-07-13 09:52:45 +00:00
jbj 84d6a9cac5 macosx/opendarwin hackery, take 1.
CVS patchset: 7710
CVS date: 2005/01/25 05:24:40
2005-01-25 05:24:40 +00:00
jbj f5203aea8b - add support for automagic pubkey retrieval using HKP.
CVS patchset: 7617
CVS date: 2004/11/28 21:14:41
2004-11-28 21:14:41 +00:00
jbj 13b145b6af Functional http remote globbing through WebDAV.
BUG: Something goofy with Keepalive On still.

CVS patchset: 7573
CVS date: 2004/11/11 02:29:51
2004-11-11 02:29:51 +00:00
jbj afeddbf68d Stub in URL_IS_HTTPS everywhere.
CVS patchset: 7536
CVS date: 2004/11/04 13:29:11
2004-11-04 13:29:11 +00:00
jbj 8faa61c020 Doxygen fiddles.
CVS patchset: 7495
CVS date: 2004/10/20 10:19:34
2004-10-20 10:19:34 +00:00
jbj b831315e41 Splint fiddles.
CVS patchset: 7435
CVS date: 2004/10/09 17:29:22
2004-10-09 17:29:22 +00:00
jbj 9f035a4d8a - fix: "/path/foo.../bar" was losing a dot (#123844).
CVS patchset: 7287
CVS date: 2004/06/01 13:58:57
2004-06-01 13:58:57 +00:00
jbj f748bc43d9 Splint fiddles.
CVS patchset: 7242
CVS date: 2004/04/19 12:12:12
2004-04-19 12:12:12 +00:00
niemeyer 70905ee4c6 Implemented multiline macro support.
CVS patchset: 7231
CVS date: 2004/04/08 20:27:53
2004-04-08 20:27:53 +00:00
jbj 84573a3571 Splint fiddles.
CVS patchset: 7219
CVS date: 2004/04/07 18:07:08
2004-04-07 18:07:08 +00:00
arekm f1dab7350d Make rpmGlob() locale independent to get stable behaviour whatever locale is used when building (Artur Frysiak <wiget/at/pld-linux.org>).
Modified Files: rpmio/macro.c

CVS patchset: 7207
CVS date: 2004/03/30 00:40:26
2004-03-30 00:40:26 +00:00
jbj 94c663d938 Sanity.
CVS patchset: 7200
CVS date: 2004/03/28 13:49:19
2004-03-28 13:49:19 +00:00
joden a8b1e86048 Made it so %* does not evaluate with a leading space. For instance:
%define xxx() "%{*}"
	%xxx 1 2 3
would evaluate to:
	" 1 2 3"
and now evaluates to:
   "1 2 3"

CVS patchset: 7196
CVS date: 2004/03/27 11:34:14
2004-03-27 11:34:14 +00:00
jbj 60057a2de1 Splint fiddles.
CVS patchset: 7195
CVS date: 2004/03/26 17:27:57
2004-03-26 17:27:57 +00:00
niemeyer c096a690b8 - Now Lua interface is using a global state.
- /usr/lib/rpm/init.lua is called during intialization.

CVS patchset: 7188
CVS date: 2004/03/24 19:47:11
2004-03-24 19:47:11 +00:00
jbj 58c9db0b19 Spint fiddles.
CVS patchset: 7184
CVS date: 2004/03/23 07:18:55
2004-03-23 07:18:55 +00:00
niemeyer 635edd9523 - New internal Lua support scheme, laying under rpmio.
- New API abstracting access to Lua state (rpmlua is
  abstract to everyone but rpmlua.c).
- New %{lua: ... } macro.
Modified Files:
	lib/Makefile.am lib/psm.c lib/rpmts.c lua/local/linit.lch
	lua/local/linit.lua rpmio/Makefile.am rpmio/macro.c
Added Files:
	rpmio/rpmlua.c rpmio/rpmlua.h
Removed Files:
	lib/rpmlua.c lib/rpmlua.h

CVS patchset: 7178
CVS date: 2004/03/19 20:08:20
2004-03-19 20:08:20 +00:00
jbj 0e3c5edc64 Typo.
CVS patchset: 7145
CVS date: 2004/03/03 01:58:36
2004-03-03 01:58:36 +00:00
jbj 5ef0bf77c2 - permit globs in macrofiles: directive (#117217).
CVS patchset: 7139
CVS date: 2004/03/02 01:31:01
2004-03-02 01:31:01 +00:00
jbj a3bf9b96f9 - use -fPIC -DPIC on all platforms, not just mandatory (#112713).
CVS patchset: 7051
CVS date: 2003/12/30 15:12:50
2003-12-30 15:12:50 +00:00
jbj 59f6e1d78f - fix: wrong package count for trigger scriptlet 1st arg (#100509).
- fix: don't break header SHA1 if non-existent user/group (#97727).
- remove fuids/fgids from rpmfi, easier to lookup fuser/fgroup instead.
- merge sensible parts of openpkg rpm.patch.bugfix (#104780).

CVS patchset: 7024
CVS date: 2003/12/27 01:37:56
2003-12-27 01:37:56 +00:00
jbj bf8cae09c8 - fix: nested %if handling, optind initialization posix vs. gloibc.
CVS patchset: 6839
CVS date: 2003/05/15 13:44:18
2003-05-15 13:44:18 +00:00
jbj 9c5529608e - don't use error string after gzclose (Dmitry V. Levin).
Spliddles for rpmio, drill h_errno all the way through.

CVS patchset: 6826
CVS date: 2003/05/08 20:39:29
2003-05-08 20:39:29 +00:00
jbj cec67caee6 Splint fiddles.
CVS patchset: 6724
CVS date: 2003/04/01 22:20:45
2003-04-01 22:20:45 +00:00
jbj 0ef682d77e - lclint clean.
CVS patchset: 5715
CVS date: 2002/09/17 15:21:03
2002-09-17 15:21:03 +00:00
jbj c7881d8017 - python: explicit method to set transFlags.
- python: stuff package name into a string for repackage callbacks.
- rollback: re-create empty transaction set for multiple rollbacks.
- fix: %%basename typo (Dmitry V. Levin<ldv@altlinux.org>).
- fix: queryformat segfaults (Dmitry V. Levin<ldv@altlinux.org>).

CVS patchset: 5639
CVS date: 2002/08/15 18:50:46
2002-08-15 18:50:46 +00:00
jbj e5fb770e7d Add boundsread annotations throughout, enable +bounds checking.
Start narrowing the scope of bounds annotations by adding more annotations.

CVS patchset: 5537
CVS date: 2002/07/02 23:54:35
2002-07-02 23:54:35 +00:00
jbj 13d177beb2 Add boundswrite annotations everywhere.
CVS patchset: 5522
CVS date: 2002/06/23 19:47:08
2002-06-23 19:47:08 +00:00
jbj 2933d0ec0c - fix: reading macro files can corrupt memory if BUFSIZ is teensy.
- fix: assertion failure iff incomplete package install (#66837).

CVS patchset: 5519
CVS date: 2002/06/21 18:00:50
2002-06-21 18:00:50 +00:00
jbj 076a6e29c5 - opaque (well mostly) rpmTransactionSet using methods.
CVS patchset: 5437
CVS date: 2002/05/16 16:55:21
2002-05-16 16:55:21 +00:00
jbj b45c27e2ab doxygen cleanup.
CVS patchset: 5379
CVS date: 2002/04/08 18:56:01
2002-04-08 18:56:01 +00:00
jbj 30b9428ce0 - make peace with gcc-3.1, remove compiler cruft.
CVS patchset: 5313
CVS date: 2002/02/10 19:00:16
2002-02-10 19:00:16 +00:00
jbj 69e97f28a0 Merge from rpm-4.0.4.
- trap SIGILL for ppc64 inline asm voodoo fix from cross-dressed ppc32.
- fix: fancy hash fiddles if not a tty.
- fix: handle /.../ correctly in rpmCleanPath().

CVS patchset: 5274
CVS date: 2002/01/27 16:49:06
2002-01-27 16:49:06 +00:00
jbj c74fa24965 - missing key(s) on keyring when verifying a signature is now an error.
- remove dependency whiteout.
- splint fiddles.

CVS patchset: 5255
CVS date: 2002/01/18 22:51:30
2002-01-18 22:51:30 +00:00
jbj 308f022df4 Rewire digests, step 1.
CVS patchset: 5120
CVS date: 2001/10/19 01:24:21
2001-10-19 01:24:21 +00:00
jbj d57a29baac Converging on lclint-3.0.17 strict level.
CVS patchset: 5118
CVS date: 2001/10/17 16:43:36
2001-10-17 16:43:36 +00:00
jbj 9f45bcd3ec More lclint annotations.
CVS patchset: 5116
CVS date: 2001/10/16 14:58:57
2001-10-16 14:58:57 +00:00
jbj 72471f2e54 Explicit branchstate annotations.
CVS patchset: 5113
CVS date: 2001/10/15 17:53:34
2001-10-15 17:53:34 +00:00
jbj d8dc44f363 lclint fiddles to annotate globals.
CVS patchset: 5106
CVS date: 2001/10/15 03:22:10
2001-10-15 03:22:10 +00:00
jbj 4b67d7621c More lclint annotations.
CVS patchset: 5105
CVS date: 2001/10/13 22:01:38
2001-10-13 22:01:38 +00:00
jbj 525f4cb8b1 - ratchet up to lclint "strict" level.
CVS patchset: 5104
CVS date: 2001/10/13 19:35:58
2001-10-13 19:35:58 +00:00
jbj 1eef0782f6 - lclint-3.0.0.15 fiddles.
CVS patchset: 5067
CVS date: 2001/09/21 15:07:11
2001-09-21 15:07:11 +00:00
jbj da9b21485c Sync with rpm-4_0 branch.
CVS patchset: 5048
CVS date: 2001/09/15 13:49:11
2001-09-15 13:49:11 +00:00
jbj 4ae69250a2 - fix typos in linux.{req,prov}.
CVS patchset: 4834
CVS date: 2001/06/05 19:26:22
2001-06-05 19:26:22 +00:00
jbj 750d54d8a3 lclint fiddles.
CVS patchset: 4833
CVS date: 2001/06/04 13:55:58
2001-06-04 13:55:58 +00:00
jbj 8f75bbc17d - enough lclint annotations and fiddles already.
CVS patchset: 4741
CVS date: 2001/05/05 19:28:32
2001-05-05 19:28:32 +00:00
jbj d78e027808 - still more boring lclint annotations and fiddles.
CVS patchset: 4738
CVS date: 2001/05/03 21:00:18
2001-05-03 21:00:18 +00:00
jbj 0ecdbba935 - yet more boring lclint annotations and fiddles.
CVS patchset: 4732
CVS date: 2001/04/30 22:32:22
2001-04-30 22:32:22 +00:00
jbj 3b5820c420 - globalize _free(3) wrapper in rpmlib.h, consistent usage throughout.
- internalize locale insensitive ctype(3) in rpmio.h
- boring lclint annotations and fiddles.

CVS patchset: 4721
CVS date: 2001/04/29 01:05:43
2001-04-29 01:05:43 +00:00
jbj 075607676d - fix: parameterized macro segfault (Jakub Bogusz <qboosh@pld.org.pl>).
fix: off by 1 with rpmGlob when presented with multiple non-globbed items.
fix: rpmReadPackageManifest actually works now.

CVS patchset: 4653
CVS date: 2001/03/23 20:27:48
2001-03-23 20:27:48 +00:00
jbj 1f44236f64 - fix: insure that %lang scopes over hard links correctly.
- fix: rpmCleanPath was nibbling at .. in macrofiles incorrectly.

CVS patchset: 4464
CVS date: 2001/01/19 01:38:55
2001-01-19 01:38:55 +00:00
jbj c74cc1df1c - fix: extra newline in many error messages (#23947).
- fix: rpm -Va with db1 needs per-iterator, not per-index, offset.
- add install/remove transaction id tags.

CVS patchset: 4441
CVS date: 2001/01/15 23:09:42
2001-01-15 23:09:42 +00:00
jbj db32ab6bea Sync with rpm-4_0 branch.
CVS patchset: 4338
CVS date: 2000/12/12 20:03:45
2000-12-12 20:03:45 +00:00
jbj 2885f536b6 Bring header reggions mods back to top of stack.
CVS patchset: 4305
CVS date: 2000/12/02 21:53:44
2000-12-02 21:53:44 +00:00
jbj 62c5a91930 - add support for unzip rodrigob@conectiva.com.br>
CVS patchset: 4243
CVS date: 2000/11/02 17:57:25
2000-11-02 17:57:25 +00:00
jbj ce1e8d26ec - add support for SHA1 as well as MD5 message digests.
lclint annotations.

CVS patchset: 4234
CVS date: 2000/10/31 16:18:34
2000-10-31 16:18:34 +00:00
jbj 3ad99fcba5 - add cscope/ctags (Rodrigo Barbosa<rodrigob@conectiva.com.br>).
- remove getMacroBody() from rpmio API.
- hide libio lossage in prototype, not API.
lclint annotations.

CVS patchset: 4230
CVS date: 2000/10/28 17:16:25
2000-10-28 17:16:25 +00:00
jbj 68ff87361d doxygen annotations.
- fix: more (possible) xstrdup side effects.

CVS patchset: 4186
CVS date: 2000/09/29 19:50:29
2000-09-29 19:50:29 +00:00
jbj 4920a3b122 - don't trim leading ./ in rpmCleanPath() (#14961).
CVS patchset: 4169
CVS date: 2000/09/16 14:05:26
2000-09-16 14:05:26 +00:00
jbj f2efc7263e - unify rpmError and rpmMessge interfaces through rpmlog.
- collect and display rpm build error messages at end of build.

CVS patchset: 4149
CVS date: 2000/09/01 21:15:40
2000-09-01 21:15:40 +00:00
jbj 918188a90c Doxygen annotations.
CVS patchset: 4129
CVS date: 2000/08/27 18:34:02
2000-08-27 18:34:02 +00:00
jbj fab0493dbe - fix: don't expand macros in false branch of %if (kasal@suse.cz).
- fix: macro expansion problem and clean up (#11484) (kasal@suse.cz).

CVS patchset: 3885
CVS date: 2000/06/21 23:28:50
2000-06-21 23:28:50 +00:00
jbj 4afe94756b - make librpmio standalone.
CVS patchset: 3824
CVS date: 2000/06/09 21:24:37
2000-06-09 21:24:37 +00:00
jbj c38a7cdcfb Move low level support routines to librpmio.
CVS patchset: 3822
CVS date: 2000/06/09 18:57:23
2000-06-09 18:57:23 +00:00
jbj 7b1e9c5a02 Avoid segfault on malformed %{!?FOO:} expansion (#9581).
CVS patchset: 3571
CVS date: 2000/02/21 10:32:01
2000-02-21 10:32:01 +00:00
jbj 0d185e8fb5 fix: resurrect relative path's in fprint lookup queries.
CVS patchset: 3518
CVS date: 2000/01/12 21:48:58
2000-01-12 21:48:58 +00:00
jbj 8f481702d8 reload macros from cmd line when re-reading config files.
CVS patchset: 3479
CVS date: 1999/12/12 21:14:05
1999-12-12 21:14:05 +00:00
jbj 8289346751 Add underscore in front of (possibly) non-supported FDIO_t vectors.
Make buildFileList() part of rpmlib API as rpmBuildFileList().
lib/rpmdb.c: Compare fingerprints from different caches by value.

CVS patchset: 3448
CVS date: 1999/12/01 19:57:17
1999-12-01 19:57:17 +00:00
jbj c8406c80d2 lib/macro.c: Create rpmCleanPath().
build/misc.c: Delete cleanFileName().

CVS patchset: 3435
CVS date: 1999/11/26 16:19:30
1999-11-26 16:19:30 +00:00
jbj 4221ce1aa1 lib/macro.c: Canonicalize paths in rpmGetPath().
build.c: ditto.
build/build.c: ditto.
build/files.c: ditto.
build/parsePreamble.c: ditto.
build/parseSpec.c: ditto.
build/myftw.c: Use Opendir/Readdir/Closedir wrappers.
lib/cpio.c: Use Readlink/Stat/Lstat wrappers while building archive.
lib/rpmio.c: functional ftpLstat, ftpStat and ftpReadlink.

CVS patchset: 3432
CVS date: 1999/11/24 00:03:54
1999-11-24 00:03:54 +00:00
jbj c6d768583e macros.in: Add buildsubdir and scriptlet template macros.
build/build.c: Rewrite to use scriptlet templates.
build/files.c: Rename variables to prepare for (possibly) URL's in %files.
build/myftw.c: Use Lstat.
build/parsePreamble.c: Permit URL's in BuildRoot tag if not from spec file.
build/parseSpec.c: ditto
build/parsePrep.c: Add buildsubdir macro.
lib/macro.c: Add url2path (nickname u2p) and verbose macro primitives.
lib/url.c: urlPath returns "" if url is NULL (rpmGenPath memory corruption).

CVS patchset: 3430
CVS date: 1999/11/19 18:19:41
1999-11-19 18:19:41 +00:00
jbj 4e62a322a2 lib/rpmio.c: Implement per-fd layers as a stack, add fdPush/fdPop.
lib/rpmio.c: Add fd{Get,Set}{Io,Fp,Fdno} abstraction wrappers.
lib/rpmio.c: Start rationalizing debug output by using fdbg to display the
	fd layer stack.
rpm.c: Add --nolibio to disable libio if desired.
rpm2cpio.c: Use Fdopen(..., gzdio) and ufdCopy().
build/build.c: Use Fdopen(..., fpio) rather than fdio.
build/files.c: Use Fdopen(..., fpio) rather than ufdio.
build/parseSpec.c: ditto.
lib/macro.c: ditto.
lib/rpmrc.c: ditto
lib/macro.c: Use Fopen(..., ufdio) in isCompressed() rather that fdOpen().
lib/misc.c: ditto.
lib/misc.c: Avoid fstat by using Stat.
build/pack.c: Add persist fdLink() and use fdFree() in package{Sources,Binaries}
build/pack.c: Try to remove the fdDup before cpioBuildArchive() call.
build/pack.c: Use rpmGenPath with %{_builddir}.
build/parsePreamble.c: Use fdSize rather than Stat to get icon file size.
lib/rpmrc.c: ditto
lib/ftp.c: start capturing ufdio layer syserrno/errcookie.

CVS patchset: 3424
CVS date: 1999/11/14 19:15:18
1999-11-14 19:15:18 +00:00
jbj 8ce88756fd Use Fstrerror on ufdio throughut.
rpm.c: add --rmspec to usage output.
build/files.c: use ufdio to permit '%files -f <url>' (untested).
build/pack.c: use ufdio in readRPM(), writeRPM(), and addFileToTag().
build/parsePreamble.c: use ufdio in readIcon().
lib/ftp.c: httpOpen() now takes FD_t ctrl arg to uncouple from u->ctrl.
lib/install.c: usr rpmGenPath() to identify first found url in file path concat.
lib/install.c: permit url's in files[i].relativePath.
lib/macro.c: use ufdio, diddle macros for tmacro standalone build.
lib/macro.c: Create rpmGenPath().
lib/macro.c: diddle macro files path to permit url's.
lib/rpmchecksig.c: use Fopen on fdio.
lib/rpmio.c: replace copyData() with ufdCopy().
lib/rpmio.c: replace httpGetFile() with ufdGetFile().
lib/rpmio.c: add ufdWrite().
lib/rpmio.c: permit 2 simultaneous persistent malloc/open HTTP/1.1 connections.
lib/rpmio.c: Add Lstat(), Stat(), and Access().
lib/rpmio.c: assume paths in syscall stubs are loopback (WRONG).
lib/url.c: add urlPath().

CVS patchset: 3422
CVS date: 1999/11/12 17:20:49
1999-11-12 17:20:49 +00:00
jbj e0b1d0be36 Swap 2nd and 3rd arg to Fread/Fwrite to preserve read/write type return.
Use Fstrerror to retrieve fd->syserrno.
Make ftpFileDoneNeeded per-fd rather than per-url.
Make data fd unique rather than per-url.
Use appropriate protocol commands for ufdio writing.

CVS patchset: 3421
CVS date: 1999/11/10 22:09:49
1999-11-10 22:09:49 +00:00
jbj 7fc3a97733 Add ref/deref/new/fileno/open vectors to FDIO_t.
Hide fdOpen/ufdOpen, use {fdio,ufdio}->open throughout.
url.c: Create ref counted abstract urlinfo type with debugging.
url.c: Rename functions to urlNew/urlFree/urlFreeCache for consistency.
rpmio.c: Create ref counted abstract FD_t type with debugging.
rpmio.c: Create private struct _FD_s type.
cpio.c: Create fd[GS]etCpioPos to preserve FD_t abstraction.

CVS patchset: 3414
CVS date: 1999/11/02 14:33:14
1999-11-02 14:33:14 +00:00
jbj 3d087dcf52 Rename faFoo() routines, use FD_t I/O with fadio cookie throughout.
Try to be URL sensitive on filename arguments throughout.
falloc.c: Eliminate faFile, use FD_t.
falloc.c: preserve abstract FD_t by creating fadGet*()/fadSet*().
macro.c: rpmGetPath() expansions were clobbering URL's.
rpmio.c: create Fcntl(), Pread(), Pwrite() from previous faFoo().
rpmio.c: attempt per FD_t debugging.
rpm.c: permit --dbpath with --rebuild.

CVS patchset: 3408
CVS date: 1999/10/30 21:26:45
1999-10-30 21:26:45 +00:00
jbj 2b84d36c2e Make fdFileno() static, use Fileno()/Ferror() analogues throughout.
Make ufdClose() static, use Fclose() with ufdio cookie throughout.
rpm.c: Clean urlinfoCache and rpmBuildArgs leaks.
url.c: urlIsURL() should be here, not in rpmio.c.
url.c: Preserve FD_t abstraction by creating ufdGetUrlinfo().
url.c: Create freeUrlinfoCache().
rpmio.c: Create ufdio cookie.

CVS patchset: 3407
CVS date: 1999/10/30 16:43:29
1999-10-30 16:43:29 +00:00
jbj 7b4cf4bf19 fix: resurrect multiple target platform builds.
CVS patchset: 3404
CVS date: 1999/10/29 23:03:12
1999-10-29 23:03:12 +00:00
jbj 1e0138188b check for memory leaks (almost all leaks are plugged).
CVS patchset: 3403
CVS date: 1999/10/29 16:06:01
1999-10-29 16:06:01 +00:00
jbj 0d0b405c20 use compressed filenames on install side.
start unifying FD types, CFD_t now gone.

CVS patchset: 3402
CVS date: 1999/10/27 23:18:10
1999-10-27 23:18:10 +00:00
jbj 6defa683eb lclint annotations.
CVS patchset: 3387
CVS date: 1999/10/20 21:40:10
1999-10-20 21:40:10 +00:00
jbj 20d78e939a fix: command line install had header memory leak.
check for NULL on all memory allocations.
free rpmrc mallocs on exit.
permit run time leak detection.

CVS patchset: 3311
CVS date: 1999/09/21 03:22:53
1999-09-21 03:22:53 +00:00
jbj dde031db23 tmacro was broke.
CVS patchset: 3231
CVS date: 1999/08/16 20:14:34
1999-08-16 20:14:34 +00:00
jbj 06689265dd fix: last char in rpmrc w/o terminating newline lost (#4361).
prepare for handling \r in macro exapnsions.

CVS patchset: 3230
CVS date: 1999/08/16 18:57:37
1999-08-16 18:57:37 +00:00
jbj 96114b6bf2 fix: macro table cannot contain NULL pointers (#4263).
CVS patchset: 3229
CVS date: 1999/08/16 16:18:25
1999-08-16 16:18:25 +00:00
jbj f9ed8f7bdc macro fixes (Benedict Lofstedt, #4220):
expand %# just like %{#} (and with same value as shell analogues).
  macro defaults for *, 0, and # if no args specified.
  getopt on non-linux requires optind to be saved/restored.

CVS patchset: 3209
CVS date: 1999/07/29 12:36:03
1999-07-29 12:36:03 +00:00
jbj 587dab926c fix: getopt on non-linux requires optind to be saved/restored
rather than just set to 0 (Benedict Lofstedt, #4220).

CVS patchset: 3208
CVS date: 1999/07/29 11:20:20
1999-07-29 11:20:20 +00:00
jbj 8bd997f2e0 Perl bindings need
#include <foo.h>
not
	#include "foo.h"

CVS patchset: 3143
CVS date: 1999/07/13 21:37:57
1999-07-13 21:37:57 +00:00
jbj 25643f9764 Add includes for more robust standalone behavior.
CVS patchset: 3121
CVS date: 1999/07/02 21:15:25
1999-07-02 21:15:25 +00:00
jbj 56496ce088 Quick 'n dirty macro evaluation.
CVS patchset: 3120
CVS date: 1999/07/02 20:56:04
1999-07-02 20:56:04 +00:00
jbj 7f5a4a4aed fix: bsearch needs macro table sorted after undefine.
CVS patchset: 3109
CVS date: 1999/06/24 22:23:46
1999-06-24 22:23:46 +00:00
jbj a0d3acc8a3 Add -C dir and -M options to %GNUconfigure.
CVS patchset: 3024
CVS date: 1999/04/20 22:45:52
1999-04-20 22:45:52 +00:00
jbj 0cf9b0bdfe fix: % before non-alphabetic non-macro special now passed unscathed.
CVS patchset: 3023
CVS date: 1999/04/20 19:17:23
1999-04-20 19:17:23 +00:00
jbj 8dfb93f84f non-linux, non-gcc portability fixes (Tim Mooney).
CVS patchset: 2973
CVS date: 1999/04/08 20:53:45
1999-04-08 20:53:45 +00:00
jbj 90ac221132 Better diagnostic message for unparseable macro error.
CVS patchset: 2971
CVS date: 1999/04/08 19:24:56
1999-04-08 19:24:56 +00:00
jbj 6266b08a66 add per-target macrofiles to search path.
take globalMacroContext out of macro api.
fix: flush all macros between builds.

CVS patchset: 2936
CVS date: 1999/04/01 22:26:44
1999-04-01 22:26:44 +00:00
jbj f0a088596e expand twiddles in macrofiles list.
CVS patchset: 2931
CVS date: 1999/03/31 16:57:01
1999-03-31 16:57:01 +00:00
jbj 9b94f186e6 fix: avoid segfault using --prefix until ewt fixes.
add --define "%foo %bar" option.
dump macros to same fd as --showrc uses.
add %GNUconfigure for full-blown package regeneration.
fix: RPM_ARCH/RPM_OS had wrong values.
fix: create ppc directories correctly.

CVS patchset: 2922
CVS date: 1999/03/28 00:47:40
1999-03-28 00:47:40 +00:00
jbj 8af5b5af87 Expand path macros with rpmGetPath(path, ...).
CVS patchset: 2652
CVS date: 1999/01/05 23:13:56
1999-01-05 23:13:56 +00:00
jbj 9b362a451a Compile in default macro values sufficient to pass make check.
CVS patchset: 2575
CVS date: 1998/12/02 19:55:36
1998-12-02 19:55:36 +00:00
jbj b3179e6de3 Set max_macro_depth to 16 always.
CVS patchset: 2574
CVS date: 1998/12/02 18:09:41
1998-12-02 18:09:41 +00:00
jbj d13e728542 More build popts moved to build.c
Fix access of freed memory.

CVS patchset: 2571
CVS date: 1998/12/01 23:28:26
1998-12-01 23:28:26 +00:00
jbj 2578b7fc84 implement abstract fd type almost everywhere.
CVS patchset: 2542
CVS date: 1998/11/18 21:41:05
1998-11-18 21:41:05 +00:00
jbj 28c4ae83a3 LCLINT pass 0.
CVS patchset: 2540
CVS date: 1998/11/16 21:40:28
1998-11-16 21:40:28 +00:00
jbj 5fc8cb62a5 First attempt at "make check".
CVS patchset: 2465
CVS date: 1998/10/20 11:54:13
1998-10-20 11:54:13 +00:00
jbj 9f20ee028b augment --showrc with -v, only display set variables without -v.
add macrofiles variable, permit second entry to initMacros().

CVS patchset: 2463
CVS date: 1998/10/15 23:29:25
1998-10-15 23:29:25 +00:00
jbj 1607fbe7a3 Consolidate i18n baggage into AM_GNU_GETTEXT and system.h.
CVS patchset: 2425
CVS date: 1998/10/08 14:59:17
1998-10-08 14:59:17 +00:00
jbj d93b2ada11 egcs warning removal.
CVS patchset: 2422
CVS date: 1998/10/08 11:55:37
1998-10-08 11:55:37 +00:00
jbj fd068345e6 add Slovak translation (Stanislav Meduna <stano@trillian.eunet.sk>)
gettextify rpmMessage/rpmError/fprintf messages.

CVS patchset: 2368
CVS date: 1998/09/27 22:03:52
1998-09-27 22:03:52 +00:00
jbj dd573c5a8a diagnostic message if unreadable/short source or patch file.
CVS patchset: 2287
CVS date: 1998/09/10 16:25:15
1998-09-10 16:25:15 +00:00
jbj 0a4e182e40 Integrate shell and macro enviroments for scripts.
CVS patchset: 2282
CVS date: 1998/09/05 23:13:35
1998-09-05 23:13:35 +00:00
jbj 145d77b79d initMacros must be called someplace to enable full reursion.
Suggestions for further arch/os decimation.

CVS patchset: 2238
CVS date: 1998/08/07 18:35:05
1998-08-07 18:35:05 +00:00
jbj f33efd0cc4 String substitution macro file.
CVS patchset: 2223
CVS date: 1998/08/02 15:14:38
1998-08-02 15:14:38 +00:00
jbj f005d723a5 Macro handling in rpmlib -- rework include: tag with macro expansion.
CVS patchset: 2215
CVS date: 1998/07/31 20:11:49
1998-07-31 20:11:49 +00:00