summaryrefslogtreecommitdiff
path: root/lib
Commit message (Collapse)AuthorAge
* Make local_db_read() private to the local backendDan McGee2011-06-30
| | | | | | | | | | | | | | | | | | | There is little need to expose the guts of this function even within the library. Make it static in be_local.c, and clean up a few other things since we know exactly where it is being called from: * Remove unnecessary origin checks in _cache_get_*() methods- if you are calling a cache method your package type will be correct. * Remove sanity checks within local_db_read() itself- packages will always have a name and version if they get this far, and the package object will never be NULL either. The one case calling this from outside the backend was in add.c, where we forced a full load of a package before we duplicated it. Move this concern elsewhere and have pkg_dup() always force a full package load via a new force_load() function on the operations callback struct. Signed-off-by: Dan McGee <dan@archlinux.org>
* Fix a few warnings pointed out via clang scan-buildDan McGee2011-06-30
| | | | | | | | | Some of these are legit (the backup hash NULL checks), while others are either extemely unlikely or just impossible for the static code analysis to prove, but are worth adding anyway because they have little overhead. Signed-off-by: Dan McGee <dan@archlinux.org>
* Merge remote-tracking branch 'allan/breakshit'Dan McGee2011-06-30
|\
| * Use ignoregroup rather than ignoregrp in the handleAllan McRae2011-06-29
| | | | | | | | | | | | This matches the naming in pacman.conf. Signed-off-by: Allan McRae <allan@archlinux.org>
| * Rename internal functions with grp in their nameAllan McRae2011-06-29
| | | | | | | | | | | | | | | | | | | | | | | | The following function renames take place for the same reasoning as the previous commit: _alpm_grp_new -> _alpm_group_new _alpm_grp_free -> _alpm_group_free _alpm_db_free_grpcache -> _alpm_db_free_groupcache _alpm_db_get_grpfromcache -> _alpm_db_get_groupfromcache Signed-off-by: Allan McRae <allan@archlinux.org>
| * Rename public functions with grp in their nameAllan McRae2011-06-29
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Using grp instead of group is a small saving at the cost of clarity. Rename the following functions: alpm_option_get_ignoregrps -> alpm_option_get_ignoregroups alpm_option_add_ignoregrp -> alpm_option_add_ignoregroup alpm_option_set_ignoregrps -> alpm_option_set_ignoregroups alpm_option_remove_ignoregrp -> alpm_option_remove_ignoregroup alpm_db_readgrp -> alpm_db_readgroup alpm_db_get_grpcache -> alpm_db_get_groupcache alpm_find_grp_pkgs -> alpm_find_group_pkgs Signed-off-by: Allan McRae <allan@archlinux.org>
| * Rename _pmdbstatus_t to _alpm_dbstatus_tAllan McRae2011-06-28
| | | | | | | | Signed-off-by: Allan McRae <allan@archlinux.org>
| * Rename pmdbinfrq_t to alpm_dbinfrq_tAllan McRae2011-06-28
| | | | | | | | Signed-off-by: Allan McRae <allan@archlinux.org>
| * Rename pmtransstate_t to alpm_transstate_tAllan McRae2011-06-28
| | | | | | | | Signed-off-by: Allan McRae <allan@archlinux.org>
| * Rename pmpkghash_t to alpm_pkghash_tAllan McRae2011-06-28
| | | | | | | | Signed-off-by: Allan McRae <allan@archlinux.org>
| * Rename pmgraph_t to alpm_graph_tAllan McRae2011-06-28
| | | | | | | | Signed-off-by: Allan McRae <allan@archlinux.org>
| * Rename pmpkgfrom_t to alpm_pkgfrom_tAllan McRae2011-06-28
| | | | | | | | Signed-off-by: Allan McRae <allan@archlinux.org>
| * Rename pmerrno_t to alpm_errno_tAllan McRae2011-06-28
| | | | | | | | Signed-off-by: Allan McRae <allan@archlinux.org>
| * Rename pmtransprog_t to alpm_transprog_tAllan McRae2011-06-28
| | | | | | | | Signed-off-by: Allan McRae <allan@archlinux.org>
| * Rename pmtransconv_t to alpm_transconv_tAllan McRae2011-06-28
| | | | | | | | Signed-off-by: Allan McRae <allan@archlinux.org>
| * Rename pmtransevt_t to alpm_transevt_tAllan McRae2011-06-28
| | | | | | | | Signed-off-by: Allan McRae <allan@archlinux.org>
| * Rename pmtransflag_t to alpm_transflag_tAllan McRae2011-06-28
| | | | | | | | Signed-off-by: Allan McRae <allan@archlinux.org>
| * Rename pmloglevel_t to alpm_loglevel_tAllan McRae2011-06-28
| | | | | | | | Signed-off-by: Allan McRae <allan@archlinux.org>
| * Rename pmbackup_t to alpm_backup_tAllan McRae2011-06-28
| | | | | | | | Signed-off-by: Allan McRae <allan@archlinux.org>
| * Rename pmdelta_t to alpm_delta_tAllan McRae2011-06-28
| | | | | | | | Signed-off-by: Allan McRae <allan@archlinux.org>
| * Rename pmgrp_t to alpm_group_tAllan McRae2011-06-28
| | | | | | | | Signed-off-by: Allan McRae <allan@archlinux.org>
| * Rename pmfileconflict_t to alpm_fileconflict_tAllan McRae2011-06-28
| | | | | | | | Signed-off-by: Allan McRae <allan@archlinux.org>
| * Rename pmconflict_t to alpm_conflict_tAllan McRae2011-06-28
| | | | | | | | Signed-off-by: Allan McRae <allan@archlinux.org>
| * Rename pmdepmissing_t to alpm_depmissing_tAllan McRae2011-06-28
| | | | | | | | Signed-off-by: Allan McRae <allan@archlinux.org>
| * Rename pmdepend_t to alpm_depend_tAllan McRae2011-06-28
| | | | | | | | Signed-off-by: Allan McRae <allan@archlinux.org>
| * Rename pmtrans_t to alpm_trans_tAllan McRae2011-06-28
| | | | | | | | Signed-off-by: Allan McRae <allan@archlinux.org>
| * Rename pmpkg_t to alpm_pkg_tAllan McRae2011-06-28
| | | | | | | | Signed-off-by: Allan McRae <allan@archlinux.org>
| * Rename pmdb_t to alpm_db_tAllan McRae2011-06-28
| | | | | | | | Signed-off-by: Allan McRae <allan@archlinux.org>
| * Rename pmhandle_t to alpm_handle_tAllan McRae2011-06-28
| | | | | | | | Signed-off-by: Allan McRae <allan@archlinux.org>
| * Rename pmfileconflicttype_t to alpm_fileconflicttype_tAllan McRae2011-06-28
| | | | | | | | Signed-off-by: Allan McRae <allan@archlinux.org>
| * Rename pmdepmod_t to alpm_depmod_tAllan McRae2011-06-28
| | | | | | | | Signed-off-by: Allan McRae <allan@archlinux.org>
| * Rename pmpkgreason_t to alpm_pkgreason_tAllan McRae2011-06-28
| | | | | | | | Signed-off-by: Allan McRae <allan@archlinux.org>
* | lib/util: modify entry_prefix, not prefixDave Reisner2011-06-30
| | | | | | | | | | | | | | | | | | Modifying prefix caused tmp directories to be left behind after running scriptlets, and the path '/' to be passed to _alpm_rmrf. Broken in f01c6f. Signed-off-by: Dave Reisner <dreisner@archlinux.org> Signed-off-by: Dan McGee <dan@archlinux.org>
* | lib/alpm: unlock the handle before freeing itDave Reisner2011-06-30
|/ | | | | | | | | | This avoids, probably among other things, leaving the lock file in place after a SIGINT'd sync DB update. Fixes regression introduced in 4f8ae2b. Signed-off-by: Dave Reisner <dreisner@archlinux.org> Signed-off-by: Dan McGee <dan@archlinux.org>
* Remove setter for DB signature levelDan McGee2011-06-27
| | | | | | | This should have been removed with commit db3b86e7f34f but was erroniously left behind. Signed-off-by: Dan McGee <dan@archlinux.org>
* Fix several -Wshadow warningsDan McGee2011-06-27
| | | | | | | | | | Only one of these looked like a real red flag, in find_requiredby(), but it doesn't hurt to fix several of them up anyway. Unfortunately, we can't turn this on universally due to things like the sync(), remove(), etc. builtins which we often use as variable names. Signed-off-by: Dan McGee <dan@archlinux.org>
* Merge branch 'maint'Dan McGee2011-06-27
|\ | | | | | | | | Conflicts: lib/libalpm/conflict.c
| * Ensure a file can be replaced by a directoryDan McGee2011-06-27
| | | | | | | | | | | | | | | | | | | | | | | | This addresses FS#24904. In a normal upgrade case, this replacement seems to work just fine. However, when doing a sync "replace" type upgrade, we weren't properly handling this edge case due to path comparison not ignoring trailing slashes. Fix this by pruning any trailing slashes past a certain point of file conflict resolution where we no longer need them, which allows us to safely detect cases such as now tested in the new pactest. Signed-off-by: Dan McGee <dan@archlinux.org>
| * File conflict code cleanupsDan McGee2011-06-27
| | | | | | | | | | | | | | | | While researching the root cause of FS#24904, I couldn't help but clean up some of the cruft in here. A few whitespace/line-wrapping issues, but also fix shadowed variables and add some const where applicable. Signed-off-by: Dan McGee <dan@archlinux.org>
* | Remove two alpm_list_count usagesAllan McRae2011-06-27
| | | | | | | | | | | | | | | | We have just looped through the list of files, so might as well get the count as we go. Signed-off-by: Allan McRae <allan@archlinux.org> Signed-off-by: Dan McGee <dan@archlinux.org>
* | Make sync DB reading a bit more flexibleDan McGee2011-06-24
| | | | | | | | | | | | | | | | | | | | | | We can reorganize things a bit to not require reading a directory-only entry first (or at all). This was noticed while working on some pactest improvements, but should be a good step forward anyway. Also make _alpm_splitname() a bit more generic in where it stores the data it parses. Signed-off-by: Dan McGee <dan@archlinux.org>
* | archive_fgets(): ensure we return any trailing text with no newlineDan McGee2011-06-24
| | | | | | | | | | | | | | | | | | | | Discovered this when doing some pactest rewrite work to generate archives in memory only. If a sync database file or PKGINFO file is missing a newline on the final line, the text from that line gets tossed aside and never read into the package struct. This is pretty critical when that last line is a depend or something. Signed-off-by: Dan McGee <dan@archlinux.org>
* | Don't require a transaction for sync DB updatesDan McGee2011-06-24
| | | | | | | | | | | | | | Instead, just do the required locking directly in the backend in calls to alpm_db_update(). Signed-off-by: Dan McGee <dan@archlinux.org>
* | Move locking functions to handleDan McGee2011-06-24
| | | | | | | | | | | | | | | | | | These operate on the handle, and the state is stored on the handle, so move them where they belong. Up until now only the transaction stuff calls them, but this will soon change and alpm_db_update() will handle locking all on its own. Signed-off-by: Dan McGee <dan@archlinux.org>
* | Add a 'valid' flag to the database objectDan McGee2011-06-24
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Start by converting all of our flags to a 'status' bitmask (pkgcache status, grpcache status). Add a new 'valid' flag as well. This will let us keep track if the database itself has been marked valid in whatever fashion. For local databases at the moment we ensure there are no depends files; for sync databases we ensure the PGP signature is valid if required/requested. The loading of the pkgcache is prohibited if the database is invalid. Signed-off-by: Dan McGee <dan@archlinux.org>
* | Move database 'version' check to registration timeDan McGee2011-06-24
| | | | | | | | | | | | | | | | This is another step toward doing both local database validation (ensuring we don't have depends files) and sync database validation (via signatures if present) when the database is registered. Signed-off-by: Dan McGee <dan@archlinux.org>
* | Do database signature checking at load timeDan McGee2011-06-24
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is the ideal place to do it as all clients should be checking the return value and ensuring there are no errors. This is similar to pkg_load(). We also add an additional step of validation after we download a new database; a subsequent '-y' operation can potentially invalidate the original check at registration time. Note that this implementation is still a bit naive; if a signature is invalid it is currently impossible to refresh and re-download the file without manually deleting it first. Similarly, if one downloads a database and the check fails, the database object is still there and can be used. These shortcomings will be addressed in a future commit. Signed-off-by: Dan McGee <dan@archlinux.org>
* | Remove three unnecessary usages of alpm_list_count()Dan McGee2011-06-24
| | | | | | | | | | | | | | | | For the files count when loading from a package, we can keep a counter. The two in the frontend were completely useless due to the fact that if sync_dbs is non-NULL, alpm_list_count() will always be greater than 0. Signed-off-by: Dan McGee <dan@archlinux.org>
* | Prevent segfault when parsing unexpected sync database fileDan McGee2011-06-24
| | | | | | | | | | | | | | | | | | This doesn't fix the real (bigger) problem of failing to parse sync databases without directory entries, but it does prevent the parser from segfaulting when the first desc file encountered did not have a directory entry, among other conditions. Signed-off-by: Dan McGee <dan@archlinux.org>
* | Merge branch 'po-split'Dan McGee2011-06-23
|\ \