Commit Graph

64 Commits

Author SHA1 Message Date
Dan McGee 2322909703 War on whitespace
Run the kernel's cleanfile script on all of our source files.

Signed-off-by: Dan McGee <dan@archlinux.org>
2007-11-16 20:18:45 -06:00
Dan McGee 8236be9fd8 Add a horrible little hack to get symlink001.py to pass again
This really doesn't give us any regressions in behavior, so it is safe to
do although quite ugly. Tell the conflict checking code to ignore symlinks
to dirs so that they are not seen as conflicts.

Hopefully this entire commit will get factored out soon enough.

Signed-off-by: Dan McGee <dan@archlinux.org>
2007-11-11 11:30:16 -06:00
Dan McGee b55abdce7a libalpm: use an lstat wrapper so we never dereference dir symlinks
Linux lstat follows POSIX standards and dereferences a symlink pointing
to a directory if there is a trailing slash. For purposes of libalpm, we
don't want this so make a lstat wrapper that suppresses this behavior.

Signed-off-by: Dan McGee <dan@archlinux.org>
2007-11-04 18:02:25 -06:00
Dan McGee cc754bc6e3 libalpm: introduce MALLOC and CALLOC macros
These macros take the place of the common 4 or 5 line blocks of code we had
in most places that called malloc or calloc. This should reduce some code
duplication and make memory allocation more standard in libalpm.

Highlights:
* Note that the MALLOC macro actually uses calloc, this is just for safety
  so that memory is initialized to 0. This can be easily changed in one
  place.
* One malloc call was completely eliminated- it made more sense to do it
  on the stack.
* The use of RET_ERR in public functions (mainly the alpm_*_new functions)
  was standardized, this makes sense so pm_errno is set.

Signed-off-by: Dan McGee <dan@archlinux.org>
2007-10-29 01:00:52 -05:00
Dan McGee 5c9eec5570 libalpm: add newlines to all strings passed to log callback
This allows us to remove the hack in the frontend where we added a newline
to everything coming out of the pm_printf functions, and instead let the
developer put newlines where they want them. This should be the last hangover
of that auto-newline stuff.

Signed-off-by: Dan McGee <dan@archlinux.org>
2007-08-23 22:26:55 -04:00
Dan McGee c22e381a8b Post trial install changes, round one
A bunch of changes related to my first "real" install of pacman-git into
/usr/local and trying to use it.

* Shift some uses of free -> FREE in libalpm.
* Move stat and sanity checks of config paths into libalpm from the
  config and argument parsing in pacman.c.
* Fix issue where dbpath still was not defined early enough due to its
  requirement for being used in alpm_db_register. This should be rewritten
  so it doesn't have this dependency, but this will work for now.

Signed-off-by: Dan McGee <dan@archlinux.org>
2007-08-21 21:28:05 -04:00
Dan McGee 49c29e16b3 Code cleanup
Remove the commented desc_localized stuff, we can find it later in version
control. Also remove some unnecessary includes of the stat header and
use -fstack-protector-all which is a bit more broad.

Signed-off-by: Dan McGee <dan@archlinux.org>
2007-08-14 09:33:55 -04:00
Nagy Gabor 3a0a4db129 libalpm/conflict.c : small speed-up and fix.
Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
2007-08-12 21:15:37 -04:00
Nagy Gabor ab06221521 libalpm/conflict.c : small memleak fix.
Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
2007-08-12 21:14:14 -04:00
Nagy Gabor b96922679e Add two pactest for versioned conflicts.
A side effect of the previous commit ( ea9a756eea )
is that it's now possible to use versioned conflicts.
Add two new conflict pactests for showing it.

Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
2007-08-12 21:14:05 -04:00
Chantry Xavier ea9a756eea libalpm/conflict.c : cleanup + fix for conflict001.
Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2007-07-20 11:58:52 -04:00
Chantry Xavier 8d62835ba1 Remove conflict message for non-existent files (reworked)
Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2007-07-13 10:18:52 -04:00
Chantry Xavier cb164c3130 conflict.c: start cleaning conflict check functions
The three chk_ functions overlap for packages both in targets and in the
database. This caused the same conflict to be found in both direction
(A conflicts with B, and B conflicts with A).

This patch avoids this duplication. which shouldn't be needed, but other
changes might be required for that to work correctly.

This also has the unexpected side effect to hide the failure of sync022
pactest, for FS #7415. That's maybe not a good thing though..

Note from Dan: sync022 does succeed, but a sync023 pactest added to check
regressions also seems to pass. This may be a valid fix to this 'problem'
sync022 was meant to find.

Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2007-07-11 00:48:03 -04:00
Dan McGee ea1fef69ad Remove gettext calls from all PM_LOG_DEBUG messages
There is no real reason to burden our translators with these messages, as
anyone helping to debug these will probably want them in English.

Signed-off-by: Dan McGee <dan@archlinux.org>
2007-07-10 14:24:58 -04:00
Andrew Fyfe 9a9928f1b8 Remove conflict message for no-existent files.
Signed-off-by: Andrew Fyfe <andrew@neptune-one.net>
2007-07-10 11:35:32 -04:00
Dan McGee a58e17a1d7 Remove STRNCPY macro from libalpm
Replaced calls to the STRNCPY macro with the actual strncpy function, and
pacman passes all pactests.

Signed-off-by: Dan McGee <dan@archlinux.org>
2007-04-29 12:03:09 -04:00
Dan McGee 75efcbbff6 Clean up gettext on the libalpm side
Remove inclusion of libintl.h from all files, because we can do it once
in util.c where the _() macro is defined.

Signed-off-by: Dan McGee <dan@archlinux.org>
2007-04-26 19:39:53 -04:00
Dan McGee d763017233 * Fix conflict checking to ignore symlinks that were in previous version of
package. Regression from 2.9.8.
2007-03-22 06:25:26 +00:00
Dan McGee 869e81e1cf This commit looks much more monumental than it is. Almost all just #include
reordering and adding ones that were forgotten (noticed when trying to
compile after reordering).

* Updated the HACKING file to include information on #include usage.
* print -> vprint in "making dir" function in pactest.
2007-03-05 22:13:33 +00:00
Dan McGee fd2167131f * Remove unnecessary call to _alpm_trans_update_depends that was erroring
anyway.
* Spelling/commenting etc.
2007-03-03 20:22:48 +00:00
Dan McGee e24c22e308 * A little more hacking with wchar_t output, but nothing really changed in
it. Eventually we'll make progress.
* Rewrote the _alpm_splitdep function to behave more like all our other
  function calls. Use heap instead of stack allocation for the depend struct,
  so now it needs to be freed by the caller.
2007-03-03 09:43:16 +00:00
Aaron Griffin 7f5dada885 Big commit this time:
* Moved entirely to alpm_pkg_get_* accessors, to read data on demand
* Mostly removed the INFRQ_ parameters from outside the be_files backend (making
  the backend more extensible in the long run)
* packages created from _alpm_db_scan now have the db and origin set (making
  accessors actually work for these packages)
* removed _alpm_db_ensure_pkgcache

* totally revamped the _alpm_checkconflicts function, making it cleaner and
  easier to read (and thus fix in the long run) - maintainable code ftw
  NOTE: feel free to rename the functions... I couldn't think of anything better

* removed an extra loop in sync.c:find_replacements - no sense in looping over
  an entire DB while strcmp'ing the name, when we have get_pkgfromcache

Other:
* package struct "license" -> "licenses"
* Created _alpm_sync_find (duplicate code in some places, find_pkginsync
* Minor const correctness changes along the way
* fixed a couple extra '/' pathing issues (non-issues really)
* removed a duplicate pkg_cmp function
2007-03-03 08:13:59 +00:00
Aaron Griffin cd2309eb73 * debug cleanup (more)
* Fixed conflict checking.  I had mistakenly assumed that the transaction
  packages were of type 'pmsyncpkg_t', but that is not the case.  Reverted back
  to pmpkg_t's and fixed some checking a bit.

* pactest results: PASSED =  71 (100.00%)
2007-02-22 06:36:05 +00:00
Aaron Griffin 871e123cf3 * Cleaned up some debug output
* Fixed a segfault in the conflict checking code
* Added an automatic failure in the case of -A/-U for a replacement of an
  existing package.  This requires a large amount of work and is postponed for
  now.  Example:
    If ncmpc is installed, pacman -U /path/to/ncmpc-svn.pkg.tar.gz will fail
    with and appropriate error message
2007-02-22 04:42:59 +00:00
Aaron Griffin 436f36c76b * Re-added a compare function for syncpkg's - it was removed without thinking
properly
* Error when re-reading the DB for replacements, wrong info level
* Removed an duplicate debug message "checking for package replacements"
* Check ignorepkg for REAL upgrades...
* Properly check the NOSAVE flag
* some unlink_file (remove.c) cleanup
* fix indent level on handle.c
* Force libalpm paths to end with a '/' char
* Fixed 'target' looping in conflict.c (pmsyncpkg_t, not pmpkg_t)
* Added some debug output to cache and db scanning

** All pactest tests succeed again, yay **
2007-02-21 06:44:14 +00:00
Dan McGee 03f034ef0e * Updated conflict checking one last time. You can finally have a file move
from one package to another seemlessly (knock on wood). This is implemented
  through the use of two skip lists in the trans struct- skip_add and
  skip_remove, which replace the former trans->skiplist.
* Removed an unnecessary function parameter, added a necessary one.
* If a package has no backup files, print '(none)' under the heading so it is
  more obvious.
* Updated my TODO list.
2007-02-20 02:14:27 +00:00
Dan McGee d86bea5c8d * Added some improved debug output to file conflict checking.
* Small change to string in remove.c (translators may or may not have to worry
  about this, depending on their already existing translation).
2007-02-19 03:18:59 +00:00
Dan McGee 7e6350a9af * Updated a too-verbose message in pacman/add.c. (shouldn't be an issue withi
translations, but may want to update at some point)
* More libalpm/conflict.c changes. Optimized more, hopefully won't need too
  much more than this.
2007-02-14 04:52:17 +00:00
Dan McGee d871b841fb Slightly optimized to remove duplicate strcmp operation. 2007-02-14 02:58:35 +00:00
Aaron Griffin 103dbb9fd1 * Refactored conflict checking within packages. Profiling from Dan showed an
unbelievable amount of strcmp() calls (25 million) due to the list searching.
  This has been reimplemented with a set-intersection scheme, due to the fact
  that file lists are always ordered. - NEEDS TESTING
* Minor clean up, "globalized" the str_cmp helper to match the alpm comparison
  signature, so we can use it elsewhere.
2007-02-13 08:15:38 +00:00
Aaron Griffin da648bc24c K. Piche <kevin.piche@cgi.com>
* ALPM_LOG_FUNCTION macro and all the great work to add this macro everywhere
2007-01-30 08:14:10 +00:00
Aaron Griffin 195e30e8aa K. Piche <kpiche@rogers.com>
* gcc visiblity changes

Also modified _alpm_versioncmp -> alpm_versioncmp (public function) as per K.
Piche's suggestions
2007-01-30 07:47:19 +00:00
Dan McGee 1799afc9c1 Discussed on IRC for a bit, this makes the following changes for clarity:
* alpm_list_is_in    --> alpm_list_find
* alpm_list_is_strin --> alpm_list_find_str
* Flip parameters of both functions to be inline with rest of alpm_list.

First commit, woohoo.
2007-01-30 03:46:33 +00:00
Aaron Griffin 1b61cc8c69 This mainly deals with code clarity- removing currently unneeded
optimizations in order to make the code much more readable and
type-checkable. Every enum in the library now has it's own type that
should be used instead of the generic 'unsigned char'. In addition,
several #define statements dealing with constants were converted to
enums.

Signed-off-by: Dan McGee <dpmcgee@gmail.com>
2007-01-24 03:02:53 +00:00
Aaron Griffin 6167017264 Preliminary checkin for alpm_list conversion
* renamed pmlist_t -> alpm_list_t
* made alpm_list_t a public type (alpm_list.h header)
* removed additional storage for registered DBs in pacman source
* some code cleanup
* removed duplicate (pm)list_display functions from pacman source
* misc code cleanup
2007-01-19 09:28:44 +00:00
Aaron Griffin 86b136bb59 Dan McGee <dpmcgee@gmail.com>
* Removed some unnecessary headers and library links
* Made things static if possible
* Cleaned up makefiles a bit
* Fixed some old comments in the code
* Fixed some errors the static code checker splint pointed out
* Backwards arguments in a memset call in _alpm_db_read (could have been worse)
* Other various small fixes

Other:
* Default to 80 columns when getcols cannot determine display width
* Removal of ._install as a valid install file in packages
2007-01-18 16:52:57 +00:00
Aaron Griffin 986409f9bd * Completed getinfo api changes (pmmissing_t, pmtrans_t, etc)
* Modified some dependancy checking
* Changed "performing local database upgrade" message to be more clear
* Change 'usize' to 'isize' in database files
* Scriptlet output is now sent to pacman's log file
* Limited some debugging output to be more clear
2006-11-22 09:03:41 +00:00
Aaron Griffin aa1c0ba9f8 * repo-add script - to add entries to a db file directly from package data (no PKGBUILD)
* libalpm api changes - move from a _getinfo(p, WHAT_WE_WANT) scheme to a
  typesafe _get_what_we_want(p) scheme [not 100% complete yet]
* some const correctness changes
* removal of PM_* types in alpm.h in favor of the pm*_t types used throughout
  libalpm
2006-11-20 09:10:23 +00:00
Aaron Griffin af2fb3324a Numerous changes:
*   Furthered the "lazy caching" to force the pkgcache to read nothing
    (INFRQ_NONE) by default.  Anything requiring package data should now check
    the infolevel of each package and attempt to update it.  This could be
    ironed out a bit more later (by using the front-end get_info function
*   Switched to libfetch.  Drastic changes to the download code and the callback
    progress bar functions.  Also fixed the return value of
    _alpm_downloadfiles_forreal.  Downloading now supports http, ftp, https, and
    files urls, along with 'mtime's and numerous other fancy features from
    libfetch.
2006-10-31 06:39:59 +00:00
Aaron Griffin 7131b7ac87 A handful of minor changes:
* Removed the PMList typedef, in favor of the same naming scheme other
      structs use 'pmlist_t'
    * Added a time stamp on debug output, to make it more informational
    * Moved alpm_db_register to _alpm_db_register, making the public function
      not take a callback parameter
2006-10-20 06:26:55 +00:00
Aaron Griffin 558e49698d Copyright changes 2006-10-16 00:05:10 +00:00
Aaron Griffin ac30eb2c1e Applied Frugalware patch from Christian Hamar alias krix <krics@linuxforum.hu>
for file-conflict progress bar
Also did some CVS cleanup, removing some of the autogenerated files that
shouldn't have been there
2006-10-15 23:54:43 +00:00
Aaron Griffin 42aae4aa7b Applied changes from frugalware:
http://darcs.frugalware.org/darcsweb/darcsweb.cgi?r=pacman;a=commitdiff;h=20061009002226-e2957-93b82621b6b060312559ea0539699f659bd9cb97.gz
2006-10-15 23:31:21 +00:00
Aaron Griffin d37ad04873 Merged frugalware changes (too many to list). Also added some config file
handling changes (support [sections] to carry over to included files - this
helps with backwards compatibility with existing pacman config files)
2006-10-15 19:31:03 +00:00
Judd Vinet bb787e26ee first stage of i18n stuff from VMiklos 2006-05-15 02:19:57 +00:00
Aurelien Foret 3a08d20b37 removed db_scan calls - take 2 2006-03-07 21:09:16 +00:00
Aurelien Foret 5d7dcdd22c removed db_scan calls 2006-03-07 21:01:02 +00:00
Aurelien Foret fdc0433d32 added more debug logs 2006-03-04 10:16:12 +00:00
Aurelien Foret 5261c7fafb code cleanup 2006-03-02 19:04:40 +00:00
Judd Vinet 7706188979 conflict checks: when doing db-vs-target checks, opt to use the NEWER, to-be-installed package instead of the local db version if there's one available 2006-02-21 23:55:59 +00:00