Commit Graph

124 Commits

Author SHA1 Message Date
Dan McGee 7bd2ff6851 Move DB and cache dirs away from there dependence on ROOTDIR
This change allows us to use all autoconf specified paths, most notably
$(localstatedir). It is quite a change and touches a lot of files, as
all references to the DB and cache were done with the ROOTDIR as a prefix.

* add --lock command-line option to pacman to specify the location of the
  lockfile (this can now be specified at configure time by setting the
  $localstatedir path).
* Rip quite a few settings out of configure.ac as they are now picked by
  setting the paths during configure or make.
* Fix bug with /tmp fallback for sync downloads not working correctly
  (related to root location, now the system tmp dir is used).
* Simplified the parameters to some libalpm functions, and added get/set
  for the new lockfile option.
* Renamed several of the DEFS to names without the PM_ prefix.

Signed-off-by: Dan McGee <dan@archlinux.org>
2007-05-31 02:51:28 -04:00
Dan McGee 2bcecbd62c Remove unnecessary casts on malloc and elsewhere
We had many unnecessary casts, most of them dealing with malloc and
other memory allocations. The variable type should take care of it;
no need to do it explicitly. In addition, I caught a const error while
removing the casts.

Signed-off-by: Dan McGee <dan@archlinux.org>
2007-05-14 03:16:55 -04:00
Aaron Griffin 1213212c31 Fix IgnorePkg handling with replacement packages
Allow IgnorePkg (or --ignore) to work for _either_ side of a
replacement.  For example, if 'foo' is set to replace 'bar',
ignoring either package will skip this replacement.

Signed-off-by: Aaron Griffin <aaronmgriffin@gmail.com>
2007-05-09 23:11:39 -05:00
Dan McGee 8bbb5dd078 libalpm util.c and util.h cleanup
* Remove some unnecessary conditional compiling in util.h- move the
  functions tha required it to trans.c (along with a bunch of new header
  includes).
* Clean up util.h a bit- remove some header includes, remove universal
  libarchive include and only put it in the files that need it.

Signed-off-by: Dan McGee <dan@archlinux.org>
2007-04-29 12:47:02 -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 a57b2f233f Remove FREELISTPTR macro
Signed-off-by: Dan McGee <dan@archlinux.org>
2007-04-28 03:54:25 -04:00
Dan McGee a3491224df Remove FREEPKG macro and correctly type _alpm_pkg_free
Signed-off-by: Dan McGee <dan@archlinux.org>
2007-04-28 02:59:58 -04:00
Dan McGee 3cf8a333d0 Remove FREEGRP macro and correctly type _alpm_grp_free
Signed-off-by: Dan McGee <dan@archlinux.org>
2007-04-27 20:38:54 -04:00
Dan McGee ec7d6955b8 Remove FREESYNC macro and correctly type _alpm_sync_free
Signed-off-by: Dan McGee <dan@archlinux.org>
2007-04-27 14:53:01 -04:00
Dan McGee db9e10f142 Remove FREETRANS macro and correctly type _alpm_trans_free
Remove an unnecessary macro, and get rid of the void pointer.

Signed-off-by: Dan McGee <dan@archlinux.org>
2007-04-27 14:29:23 -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 4a0aac3862 Fix --ignore behavior on sysupgrade
* --ignore was being ignored (haha) on sysupgrade when a package was listed
  as being a force upgrade. This adds a prompt to the user in this case asking
  what to do.

Signed-off-by: Dan McGee <dan@archlinux.org>
2007-03-28 00:35:17 -04:00
Aaron Griffin 941c23025c * Fix asking the user to upgrade when using -Sp
* More significant error messages when -Qo fails
* Potential fix for reported error that pacman indicates corrupt packages
  when space is full on the cache dir
2007-03-21 03:08:19 +00:00
Aaron Griffin 9b08a5aa97 * Fix pacman -Se which installs depends only, as it was broken
(Is this useful to anyone?)
2007-03-20 02:36:21 +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
Aaron Griffin cdb46ef3fa * Fixed a whole mess of extra '/' pathing issues when a different root is
specified
* Use db->path when appropriate
* Commented out the FAKEROOT checks in libalpm.  This should never ever be done.
  TODO test this quite a bit, as this will never cause the transactions to fail
  if RW operations are requested... right now it is totally up to the front end
  to decide when to fail
* Use realpath() to canonicalize the root path when specified, so
  _alpm_makepath() doesn't freak out
* Fixed some output/indent of MDFile and SHAFile algorithms
* More efficient sprintf() usage in MDFile/SHAFile
* Added real error output to _alpm_makepath
2007-03-04 09:08:54 +00:00
Dan McGee 8178c2f986 * Maybe that call to _alpm_trans_update_depends was necessary. Added it back
in but did it right by duplicating the package first.
2007-03-04 01:22:57 +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
Dan McGee efca1cc010 * Modified values of INFRQ_* options so we start at 0x01 and not 0x00. This
allows for the same bit operators to be used across the board on pkg_get
  operations.
* Changed name of INFRQ_NONE -> INFRQ_BASE to more clearly reflect what it
  does (loads pkg name and version).
* Added a few missing things on package functions, such as SYMEXPORT and
  ALPM_LOG_FUNC.
* Slight updates to pmenv to print 'pass' and 'fail' instead of 'passed' and
  'failed'. Keeps output a bit more concise.
* Fixed a doxygen comment spelling error. :P
2007-03-01 19:07:38 +00:00
Aaron Griffin 8fbdd03cce * Enforce const char* params when using strings
* Unified some functions names "package" -> "pkg" for consistency
* Removed the goofy 'faketarget' stuff used for dep testing
* Renamed alpm_pkg_isin -> alpm_pkg_find
* Renamed alpm_db_readpkg -> alpm_db_get_pkg
2007-02-26 08:38:48 +00:00
Aaron Griffin faad70aa54 * Too much debugging output in the alpm_pkg_compare_versions function
* Using the wrong info level for replacements
2007-02-23 07:53:25 +00:00
Aaron Griffin d584d8c068 * Modified the handling and output w.r.t. IgnorePkg entries. -Sy always ignores
these packages, but -S explicitly asks for confirmation.
2007-02-23 02:10:56 +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
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 6c5066471c Cleanup and more debug info for alpm_pkg_compare_versions 2007-02-07 05:57:28 +00:00
Aaron Griffin 67ea493ec2 Attempt to unify the -S and -Su version comparissons for when a package is newer
See FS#5388
2007-02-06 17:39:32 +00:00
Aaron Griffin 63000584b6 Implemented a crappy version of -Qu (query upgrades). This simply outputs the
packages to be upgraded in a -Su operation.  Much of the code is duplicated from
sync.c.
TODO: move the implementation to upgrades.c, and reimplement the sync_sysupgrade
function in terms of this:
    trans->packages = alpm_get_upgrades();
2007-02-04 08:26:52 +00:00
Aaron Griffin 616620ad5c * Minor output fix (move colon so it's not part of the URL)
* Added ldconfig on --sync operations too
2007-02-01 03:31:46 +00:00
Aaron Griffin 670319c2fb Debug logging changes:
* The --debug params were goofy.  New setup allows --debug without params,
  --debug=<level> where level 1=debug output, 2=debug and download output,
  3=debug, download, and function tracing output.  This seems more sane to me.
* Removed PM_LOG_FLOW1 and PM_LOG_FLOW2.  They were just confusing.  When adding
  new functions, it is near impossible to determin if your output should be
  "flow1" or "flow2" without tracking all the way up the call chain.  Rarely
  would one ever say "ok, lets just show "flow2" output.  These have both been
  replaced with PM_LOG_DEBUG
* Removed the need for the root parameter on alpm_initialize. it is now
  defaulted to PM_ROOT just like dbpath and cachedir.  This allows alpm to be
  initialized BEFORE option parsing in the front end, saving us some duplicate
  variables in the frontend.
* Cleaned up front end variables due to early alpm_initialize call.
2007-01-31 06:10:21 +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 043a49701f * bug fix FS#6100 - fix --print-uris output 2007-01-03 08:05:13 +00:00
Aaron Griffin 61d03cc345 * Missing error label in sync.c
* Additional debug output for db_write
2007-01-02 22:29:48 +00:00
Aaron Griffin 07c1309009 * Removed latest fix from TODO.autoconf
* Attempted fix for FS#6100 - "-Spd foo" failure
* Beginning of refactoring from Dan McGee <dpmcgee@gmail.com>
2006-12-29 17:04:58 +00:00
Aaron Griffin e3aace4a4d Cleanup from Dan McGee <dpmcgee@gmail.com> and Jürgen Hötzel <juergen@hoetzel.info>
* configure swig check
* misc libalpm cleanup
2006-12-22 19:38:55 +00:00
Aaron Griffin 08dca1593f * Cosmetic changes and typo fixes
* IgnorePkg and --ignore work again
* Partial changes to support removal of conflicts for -U and -A (INCOMPLETE)
2006-12-01 09:32:29 +00:00
Aaron Griffin 9918d43ab9 * Fixed some error output for "-Sd" and "-Rsc" dealing with missing/ignored
depends
* Added valgrind suppression file
2006-11-24 07:01:27 +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 00ce9ea739 * Initial changes to gensync - makepkg changes were not checked in from another
machine - still pending
* Addition of _alpm_pkg_makefilename to simplify the with/without -ARCH prefix
  scheme we're going with for the interim
2006-11-15 07:50:37 +00:00
Aaron Griffin 7d6161ccc3 * has_archname changes
* makepkg attempt at multiple file integrity checks
* honor "force" option on -S packages (not just -Su)
2006-11-14 17:26:19 +00:00
Aaron Griffin 4470e5ce01 * Numerous mini valgrind fixes.
* Addition of hacky architecture check in the _splitname function
* Removal of libfetch from the archlinux proper - it has been renamed to
  libdownload and can be found at http://phraktured.net/libdownload
* Merge of _some_ of the Frugalware makepkg change - this may still be
  incomplete
* Removal of libftp from cvs proper
* PKGBUILD manpage now says 'PKGBUILD' instead of FrugalBuild (he he)
2006-11-14 07:58:42 +00:00
Aaron Griffin 3bf918dc4e Fixed pacman -U:
* Accidental database read of a file-based package (whoops)
    * Proper fetching of url-based -U or -A
Removed some newlines from _alpm_log calls, to make debug output more concise
2006-11-01 06:30:47 +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 1568fd98d8 Minor changes:
* Moved the pmhandle_t extern decl around
    * Fixed a doxygen complaint
2006-10-21 01:27:35 +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