1
0
mirror of https://github.com/moparisthebest/pacman synced 2024-10-31 23:55:04 -04:00
Commit Graph

128 Commits

Author SHA1 Message Date
Dan McGee
cacf968970 Update Doxyfile and add a few missing parts of documentation
Signed-off-by: Dan McGee <dan@archlinux.org>
2007-06-17 13:20:17 -04:00
VMiklos
dfc85cb5f5 Add a alpm_db_test() function to the backend for checking DB consistency
Signed-off-by: Dan McGee <dan@archlinux.org>
2007-06-09 12:58:12 -04:00
Dan McGee
f7912e9dc6 Const correctness!
Add some 'const' keywords all over the code to make it a bit more strict on
what you can and can't do with data. This is especially important when we
return pointers to the pacman frontend- ideally this would always be
untouchable data.

Signed-off-by: Dan McGee <dan@archlinux.org>
2007-06-05 17:34:33 -04:00
Dan McGee
26e3db423a Merge branch 'alpm.c_cleanup' into frontend_config
Conflicts:

	lib/libalpm/alpm.c
2007-06-04 23:32:38 -04:00
Dan McGee
466b79bf8f Fix up outstanding parseconfig issues
The db variable was left unset when calling alpm_db_register, leading
to a failure to ever register a sync db. Also added a check to ensure
DBPath was set when trying to register a database.

Signed-off-by: Dan McGee <dan@archlinux.org>
2007-06-04 23:10:49 -04:00
Dan McGee
358cc5804a Rip alpm_parse_config out of libalpm
Switch over to the new frontend parseconfig.

* Fix a few issues in parseconfig
* Remove unused callback upon database registration
* Remove conf file related errors from error.c/alpm.h

Signed-off-by: Dan McGee <dan@archlinux.org>
2007-06-04 23:10:49 -04:00
Dan McGee
64d36db5f4 Move functions out of alpm.c to where they belong
alpm.h is the only "publically viewable" file, so there is no reason to have
functions in alpm.c that belong in package.c, db.c, etc. Move the functions
where they belong and leave only the library init functions in alpm.c.

Signed-off-by: Dan McGee <dan@archlinux.org>
2007-06-04 22:52:04 -04:00
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
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
69bc2e62fe Remove FREESERVER macro and correctly type _alpm_server_free
Signed-off-by: Dan McGee <dan@archlinux.org>
2007-04-27 20:40:29 -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
Aaron Griffin
6f870968ed * Two fixes when running under a new root (-r|--root)
- Check EACCES in can_remove_file, to verify - we're only checking for a
      read-only FS here... if write permissions fail, we can still remove it
    - Switched the message when creating DB directories from an error to a debug
      message
* Fix the dep tests once and for all (it wasn't working for provides=()
  packages)
2007-03-09 05:33:06 +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
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
4a45a273ea * Fix up _alpm_db_free, remove use of void*. 2007-03-01 03:08:41 +00:00
Dan McGee
cb311adeab * db search optimization- why don't we compile the regex once instead of once
per package.
2007-02-26 23:32:08 +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
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
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
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
4db24ca28a * Added some calloc calls to replace the malloc-then-set-to-zero functionality
* Fixed -Ss output so as not to call alpm_list_getdata with a NULl list
* Added a NULL check in alpm_list_getdata
* Fixed alpm_list_add_sorted to properly handle a new / beginning insertions
2007-01-23 01:34:58 +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
726e90dc2c Jürgen Hötzel <juergen@hoetzel.info>
* avoid repeated regex compilations (regex for search string do not
 change while scanning the package database)

* remove needless string duplication (regex function do not change target
 string nor free them)

* code cleanup

This patch improves search performance:

bash-3.2$ time ./src/pacman/pacman.static.old -Ss "(database|web).*server" >/dev/null

real    0m1.026s
user    0m0.544s
sys     0m0.208s
bash-3.2$ time ./src/pacman/pacman.static -Ss "(database|web).*server" >/dev/null

real    0m0.777s
user    0m0.456s
sys     0m0.128s
bash-3.2$
2007-01-17 03:57:53 +00:00
Aaron Griffin
74e347f09b * modeline fixes / reformatting
* formatting / indentation fixes
* makepkg:
    Dan McGee <dpmcgee@gmail.com> - integrity check fix
    Jürgen Hötzel <juergen@hoetzel.info> - EUID usage and "x$foo" check revamp
2006-12-21 01:53:40 +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
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
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
93311212bd Fixes from frugalware: few 'typos' included while patching
Also re-added Judd's dependancy fix in libalpm/deps.c
2006-10-21 20:16:55 +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
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
ad2c7463c9 put back treename in db->path 2006-03-14 22:53:42 +00:00
Aurelien Foret
4f42a0accb all _alpm_XXX_cmp functions are now public 2006-03-08 18:07:58 +00:00
Aurelien Foret
e2faeb46e1 reworked the db object to prepare future integration with different backends 2006-03-02 19:06:52 +00:00
Aurelien Foret
16ff7cfa8e improved _alpm_list_free handling 2006-02-22 20:49:33 +00:00
Aurelien Foret
590f610d6b dropped the MALLOC macro 2006-02-20 20:41:40 +00:00
Judd Vinet
ef04c832f7 FW: spaces -> tabs cosmetic fix 2006-02-20 18:45:26 +00:00
Aurelien Foret
be39f49a54 prepend library function names with _alpm (helped with the patch from VMiklos <vmiklos@frugalware.org>)
added log and event callbacks to sync_commit internal transactions
2006-02-17 22:35:26 +00:00
Aurelien Foret
58a7e85534 - db_write: add support to write both local and sync entries
- code cleanup
2006-02-16 21:02:39 +00:00
Aurelien Foret
6e76fd8af3 - merged db_open and db_create into one single function
- moved the .lastupdate support to the frontend
2006-02-15 22:51:28 +00:00
Aurelien Foret
3a82992b59 db_write: only write non-empty fields to database 2006-02-11 07:53:36 +00:00
Aurelien Foret
c3ffe4367a cleaned up db_write error cases handling 2006-01-27 19:12:15 +00:00
Aurelien Foret
299d708b0d fixed potential file descriptor leaks 2006-01-27 19:08:35 +00:00
Aurelien Foret
fd6ce1f4cb - merged pkg_new and pkg_dummy functions
- renamed _alpm_log_action to _alpm_logaction
2006-01-09 20:16:00 +00:00
Judd Vinet
96de3501ab patch from VMiklos - use PACKAGE_VERSION instead of PACMAN_VERSION 2006-01-02 19:55:35 +00:00
Judd Vinet
58c9d5d663 applied first try at sync conflict handling (VMiklos) plus a couple changes 2005-12-26 06:40:29 +00:00
Aurelien Foret
8ffb82a691 Code update to make use of PKG_FULLNAME_LEN 2005-10-08 21:36:47 +00:00
Aurelien Foret
05ab859eab Reworked the cache handling to only load DEPENDS info by default 2005-10-08 21:32:14 +00:00
Aurelien Foret
0d6a2edaa8 Moved the REPLACES and FORCE package fields from DESC to DEPENDS db entry 2005-10-08 20:43:25 +00:00
Aurelien Foret
543940173d Added a missing include for CYGWIN target 2005-10-06 07:39:44 +00:00
Aurelien Foret
effbe50ffd Fixed an error log 2005-10-06 07:24:33 +00:00
Aurelien Foret
dacf0eccac changed license package field to a list 2005-08-20 05:54:45 +00:00
Aurelien Foret
80a5ffa8d8 added some debug logs 2005-05-03 17:41:19 +00:00
Aurelien Foret
4b11a9b1ce code cleanup 2005-05-02 07:50:51 +00:00
Aurelien Foret
5a13de80a1 fixed the format of %REASON% entry when writing it 2005-04-24 11:27:35 +00:00
Aurelien Foret
cdd81bf177 - fixed a cut'n'paste bug with %REASON% entry
- factorized code between %SIZE% and %CSIZE% reading
2005-04-24 11:24:18 +00:00
Aurelien Foret
80bae750cd - added 'lastupdate' field to pmdb_t
- added a new public function alpm_db_getinfo
- added a public parameter PM_PKG_DB for PM_PKG struct
2005-04-02 23:20:00 +00:00
Aurelien Foret
d30333756a put back 3 _alpm_log() calls 2005-03-29 20:58:43 +00:00
Aurelien Foret
e5389ddc62 clearer string length for a strncpy call 2005-03-29 17:20:43 +00:00
Aurelien Foret
6063424c82 Replaced snprintf calls by the SNPRINTF macro to avoid buffer overflows when copying strings 2005-03-29 17:18:59 +00:00
Aurelien Foret
56917dc304 improved logs (use _alpm_log instead of fprintf) 2005-03-28 08:21:17 +00:00
Aurelien Foret
221bda7972 moved db_find_conflicts from db.c to conflict.c 2005-03-22 20:21:12 +00:00
Aurelien Foret
8179f7cbaa - added db_setlastupdate to db.c
- moved db_update from db.c to alpm.c
2005-03-22 20:14:49 +00:00
Aurelien Foret
1b7b6e47a1 replaced rewinddir() calls by db_rewind() 2005-03-20 14:21:19 +00:00
Aurelien Foret
72c2439576 Added support for .lastupdate files (from pacman 2.9.1) 2005-03-20 09:22:03 +00:00
Aurelien Foret
0a072b57c5 Removed an hardcoded string length 2005-03-19 17:56:22 +00:00
Aurelien Foret
0d69a4aeb0 Removed an hardcoded string length 2005-03-19 17:55:57 +00:00
Aurelien Foret
ad4ab9e50c Bring back db_scan() modifications from pacman 2.9.1
(to cope with .lastupdate files in the db path)
2005-03-16 21:49:18 +00:00
Aurelien Foret
22c0037a08 Added DB_TREENAME_LEN define to avoid hardcoded length for database string 2005-03-16 20:23:50 +00:00
Aurelien Foret
49415cb675 Added a missing argument in db_create() 2005-03-16 20:04:17 +00:00
Aurelien Foret
fac045a958 Removed a hardcoded reference to the 'local' database in db_create() 2005-03-16 19:36:15 +00:00
Aurelien Foret
606c70fdc9 Added a db_update() function to manage sync databases updates.
The API provides a wrapper alpm_db_update().
2005-03-16 19:31:20 +00:00
Judd Vinet
d04baabafa Initial revision 2005-03-15 01:51:43 +00:00