summaryrefslogtreecommitdiffstats
path: root/src/util/testdb.c
AgeCommit message (Collapse)AuthorFilesLines
2015-01-02Remove testdbAllan McRae1-297/+0
Replaced by pacman -Dk / -Dkk Signed-off-by: Allan McRae <allan@archlinux.org>
2014-10-19testdb: ignore ALPM_DB_VERSIONAndrew Gregory1-1/+1
Replaces the test for hidden files which appears to be leftover from 2e431e1cc before sync db checking was moved to a separate function. Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
2014-09-30Revert "Remove log_cb, add ALPM_EVENT_LOG instead"Andrew Gregory1-8/+6
Moving logging to the event callback caused warnings under clang due to non-literal format strings and silenced all log messages when --print was used. This reverts commit cd793c5ab7689cc8cbc18277375b368060e5acfe. Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com> Conflicts: lib/libalpm/alpm.h src/pacman/callback.c Signed-off-by: Allan McRae <allan@archlinux.org>
2014-03-03Remove log_cb, add ALPM_EVENT_LOG insteadOlivier Brunel1-6/+8
When ALPM emits a log message, it still goes through _alpm_log() but instead of calling a specific log callback, it goes as an event. Signed-off-by: Olivier Brunel <jjk@jjacky.com> Signed-off-by: Allan McRae <allan@archlinux.org>
2014-01-28Remove ts and sw from vim modeline when noet is setFlorian Pritz1-1/+1
Forcing vim users to view files with a tabstop of 2 seems really unnecessary when noet is set. I find it much easier to read code with ts=4 and I dislike having to override the modeline by hand. Command run: find . -type f -exec sed -i '/vim.* noet/s# ts=2 sw=2##' {} + Signed-off-by: Florian Pritz <bluewind@xinu.at> Signed-off-by: Allan McRae <allan@archlinux.org>
2014-01-06Update copyright years for 2014Allan McRae1-0/+1
Signed-off-by: Allan McRae <allan@archlinux.org>
2013-09-04Improve --help switch output for pacman utilsJason St. John1-7/+5
Unify the formatting of the --help switch for pacman utils, if it exists. All of the pacman utils will now output help text using the following format: util-name (pacman) v<pacman version> one line description of util's purpose Usage: util-name [options] -b, --bar whatever --bar does -f, --foo whatever --foo does -h, --help display this help message The --help switch does not exist for a couple of the utils, so the help/usage text for those will be displayed when the util is run with no arguments. Reported-by: Karol Błażewicz <karol.blazewicz at gmail.com> Signed-off-by: Jason St. John <jstjohn@purdue.edu> Signed-off-by: Allan McRae <allan@archlinux.org>
2013-03-10testdb: quote output substitutionsAndrew Gregory1-6/+6
Quoting output substitutions makes whitespace errors such as FS#30101 much more obvious: old: missing perl-test-pod dependency for perl-test-output new: missing 'perl-test-pod ' dependency for 'perl-test-output' Several of the quoted substitutions should not be capable of containing whitespace in theory, but this errs on the side of caution as the point of the tool is to find error conditions. Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
2013-03-10testdb: pass empty local pkglist to alpm_checkdepsAndrew Gregory1-1/+1
Passing the local package list to alpm_checkdeps as both the local packages and packages to be upgraded did nothing but cause extra overhead as the packages were all removed from the installed package list because they were being upgraded. Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
2013-02-13Add format attributes to all required functionsAllan McRae1-0/+1
Fixes all clang warnings with -Wformat-literal. Also, fix genuine formating issue discovered once adding these attributes and add a cast to prevent a gcc warning. Signed-off-by: Allan McRae <allan@archlinux.org>
2012-04-25util/testdb: don't return crazy error valuesDan McGee1-4/+4
With some contrived examples, you could easily make testdb return a very high error count, which could easily overflow the 8-bit unsigned integer limit. Instead, simply return 1 or 0 based on whether errors were found. Signed-off-by: Dan McGee <dan@archlinux.org>
2012-02-06ALPM API adjustments for sanity and consistencyDan McGee1-2/+2
This makes several small adjustments to our exposed method names, and in one case, parameters. The justification here is to make methods less odd in their naming convention. If a method takes an alpm_db_t argument, the method should be named 'alpm_db_*', but perhaps more importantly, if it doesn't take a database as the first parameter, it should not. Summary of changes: alpm_db_register_sync -> alpm_register_syncdb alpm_db_unregister_all -> alpm_unregister_all_syncdbs alpm_option_get_localdb -> aplpm_get_localdb alpm_option_get_syncdbs -> aplpm_get_syncdbs alpm_db_readgroup -> alpm_db_get_group alpm_db_set_pkgreason -> alpm_pkg_set_reason All methods keep the same argument list except for alpm_pkg_set_reason; there we drop the 'handle' argument as it can be retrieved from the passed in package object. Signed-off-by: Dan McGee <dan@archlinux.org>
2012-01-07testdb: check local database for duplicate filesDan McGee1-7/+78
This adds an additional check step to find files in the local database that claim to be owned by more than one package at once, which is definitely not a supported setup. Signed-off-by: Dan McGee <dan@archlinux.org>
2011-12-22include config.h via MakefilesDave Reisner1-2/+0
Ensures that config.h is always ordered correctly (first) in the includes. Also means that new source files get this for free without having to remember to add it. We opt for -imacros over -include as its more portable, and the added constraint by -imacros doesn't bother us for config.h. This also touches the HACKING file to remove the explicit mention of config.h as part of the includes. Signed-off-by: Dave Reisner <dreisner@archlinux.org> Signed-off-by: Dan McGee <dan@archlinux.org>
2011-11-14create a typedef for enum _alpm_errno_tJonathan Conder1-1/+1
This is consistent with the other enums and structs, and should be slightly more readable. Signed-off-by: Jonathan Conder <jonno.conder@gmail.com> Signed-off-by: Dan McGee <dan@archlinux.org>
2011-10-12Remove alpm_list_getdata wrapper functionDan McGee1-3/+3
This one is pretty darn useless. Just derefence the ->data attribute since the type is public anyway and save yourself the function call. Signed-off-by: Dan McGee <dan@archlinux.org>
2011-07-28Tidy up testdb to match coding stylesDan McGee1-4/+8
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-07-05signing: move to new signing verification and return schemeDan McGee1-1/+2
This gives us more granularity than the former Never/Optional/Always trifecta. The frontend still uses these values temporarily but that will be changed in a future patch. * Use 'siglevel' consistenly in method names, 'level' as variable name * The level becomes an enum bitmask value for flexibility * Signature check methods now return a array of status codes rather than a simple integer success/failure value. This allows callers to determine whether things such as an unknown signature are valid. * Specific signature error codes mostly disappear in favor of the above returned status code; pm_errno is now set only to PKG_INVALID_SIG or DB_INVALID_SIG as appropriate. Signed-off-by: Dan McGee <dan@archlinux.org>
2011-07-01Prefix alpm_loglevel_t members with ALPMAllan McRae1-2/+2
Signed-off-by: Allan McRae <allan@archlinux.org>
2011-06-28Rename pmerrno_t to alpm_errno_tAllan McRae1-1/+1
Signed-off-by: Allan McRae <allan@archlinux.org>
2011-06-28Rename pmloglevel_t to alpm_loglevel_tAllan McRae1-1/+1
Signed-off-by: Allan McRae <allan@archlinux.org>
2011-06-28Rename pmconflict_t to alpm_conflict_tAllan McRae1-1/+1
Signed-off-by: Allan McRae <allan@archlinux.org>
2011-06-28Rename pmdepmissing_t to alpm_depmissing_tAllan McRae1-1/+1
Signed-off-by: Allan McRae <allan@archlinux.org>
2011-06-28Rename pmdb_t to alpm_db_tAllan McRae1-2/+2
Signed-off-by: Allan McRae <allan@archlinux.org>
2011-06-28Rename pmhandle_t to alpm_handle_tAllan McRae1-1/+1
Signed-off-by: Allan McRae <allan@archlinux.org>
2011-06-24Do database signature checking at load timeDan McGee1-1/+1
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>
2011-06-16Make pmdepend_t and pmdepmissing_t publicDan McGee1-3/+2
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-06-16Make struct pmconflict_t publicDan McGee1-2/+2
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-06-14Move pm_errno onto the handleDan McGee1-1/+1
This involves some serious changes and a very messy diff, unfortunately. Signed-off-by: Dan McGee <dan@archlinux.org>
2011-06-14Add handle argument to two more alpm methodsDan McGee1-1/+1
This takes care of alpm_checkdeps() and alpm_find_dbs_satisfier(). Signed-off-by: Dan McGee <dan@archlinux.org>
2011-06-14Require handle for alpm_checkconflicts()Dan McGee1-1/+1
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-06-09Require handle for alpm_db_register_sync()Dan McGee1-1/+1
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-06-09Require handle argument to all alpm_option_(get|set)_*() methodsDan McGee1-8/+3
This requires a lot of line changes, but not many functional changes as more often than not our handle variable is already available in some fashion. Signed-off-by: Dan McGee <dan@archlinux.org>
2011-06-07Update utilities for new initialize/release methodsDan McGee1-9/+8
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-05-04Fix warnings reported by -Wwrite-stringsDan McGee1-1/+1
These are places where we stuck a string constant in a variable not marked as const. Signed-off-by: Dan McGee <dan@archlinux.org>
2011-04-21syntax: if/while statements should have no trailing spaceDan McGee1-1/+1
This is the standard, and we have had a few of these introduced lately that should not be here. Done with: find -name '*.c' | xargs sed -i -e 's#if (#if(#g' find -name '*.c' | xargs sed -i -e 's#while (#while(#g' Signed-off-by: Dan McGee <dan@archlinux.org>
2011-03-21Style change: return(x) --> return xDan McGee1-10/+10
This was discussed and more or less agreed upon on the mailing list. A huge checkin, but if we just do it and let people adjust the pain will end soon enough. Rebasing should be relatively straighforward for anyone that sees conflicts; just be sure you use the new return style if possible. The following semantic patch was used to do the change, along with some hand-massaging in order to preserve parenthesis where appropriate: The semantic match that finds this problem is as follows, although some hand-massaging was done in order to keep parenthesis where appropriate: (http://coccinelle.lip6.fr/) // <smpl> @@ expression a; @@ - return(a); + return a; // </smpl> A macros_file was also provided with the following content: Additional steps taken, mainly for ASSERT() macros: $ sed -i -e 's#return(NULL)#return NULL#' lib/libalpm/*.c $ sed -i -e 's#return(-1)#return -1#' lib/libalpm/*.c Signed-off-by: Dan McGee <dan@archlinux.org>
2011-02-25alpm: alpm_db_get_pkgcache_list => alpm_db_get_pkgcacheDave Reisner1-2/+2
This avoids needless breakage of the public API. Signed-off-by: Dave Reisner <d@falconindy.com> Signed-off-by: Dan McGee <dan@archlinux.org>
2011-02-24Mark log callback format string constDan McGee1-1/+1
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-02-04Read pkgcache into hashAllan McRae1-2/+2
Read the package information for sync/local databases into a pmpkghash_t structure. Provide a alpm_db_get_pkgcache_list() method that returns the list from the hash object. Most usages of alpm_db_get_pkgcache are converted to this at this stage for ease of implementation. Review whether these are better accessing the hash table directly at a later stage. Signed-off-by: Allan McRae <allan@archlinux.org>
2011-01-29Remove need to explicitly register the local DBDan McGee1-1/+1
Perform the cheap struct and string setup of the local DB at handle initialization time to match the teardown we do when releasing the handle. If the local DB is not needed, all real initialization is done lazily after DB paths and other things have been configured anyway. Signed-off-by: Dan McGee <dan@archlinux.org>
2010-12-30Declare all local functions staticAllan McRae1-1/+1
All functions that are limited to the local translation unit are declared static. This exposed that the _pkg_get_deltas declaration in be_local.c was being satified by the function in packages.c which when declared static caused linker failures. Fixes all warnings with -Wmissing-{declarations,prototypes}. Signed-off-by: Allan McRae <allan@archlinux.org> Signed-off-by: Dan McGee <dan@archlinux.org>
2010-12-30Detect undefined PATH_MAXAllan McRae1-0/+2
POSIX does not require PATH_MAX be defined when there is not actual limit to its value. This affects HURD based systems. Work around this by defining PATH_MAX to 4096 (as on Linux) when this is not defined. Also, clean up inclusions of limits.h and remove autoconf check for this header as we do not use macro shields for its inclusion anyway. Signed-off-by: Allan McRae <allan@archlinux.org> Signed-off-by: Dan McGee <dan@archlinux.org>
2010-12-21testdb: update for new database formatDan McGee1-33/+21
Sync DB's no longer have an extracted directory, so remove the files check for those. Local databases no longer have a 'depends' file, so kill that check as well. Finally, do a little other cleanup and remove the need for PATH_MAX. Signed-off-by: Dan McGee <dan@archlinux.org>
2010-10-12util: fall cleaning on single file programsDan McGee1-11/+6
* Add a bunch of static declarations where possible * Fix void functions to be proper syntax, e.g. void func(void) * Consistency fixes (such as argv references) * Remove dead str_cmp() function from testdb * Remove unneeded config.h header includes * vercmp: remove completely unnecessary string copying Signed-off-by: Dan McGee <dan@archlinux.org>
2010-06-20Clarify testing within conditional statementsAllan McRae1-1/+1
Follow the HACKING guidelines and always use != 0 or == 0 rather than negation within conditional statements to improve clarity. Most of these are !strcmp usages which is the example of what not to do in the HACKING document. Signed-off-by: Allan McRae <allan@archlinux.org>
2009-09-23testdb : fix many memleaksXavier Chantry1-4/+14
Yes, it was that bad :P We still have memleaks left because we cannot free the error data returned by libalpm, but pacman has the same issue. Signed-off-by: Xavier Chantry <shiningxc@gmail.com> Signed-off-by: Dan McGee <dan@archlinux.org>
2009-08-19testdb : less verboseXavier Chantry1-4/+2
http://bbs.archlinux.org/viewtopic.php?id=77396 Signed-off-by: Xavier Chantry <shiningxc@gmail.com> Signed-off-by: Dan McGee <dan@archlinux.org>
2009-05-19Remove unused included headers from testdb.c and testpkg.cGerardo Exequiel Pozzi1-1/+0
libgen.h was used for basename() in function main() from src/util/testdb.c string.h was used for strlen() in function output_cb() from src/util/testpkg.c Signed-off-by: Gerardo Exequiel Pozzi <vmlinuz386@yahoo.com.ar> Signed-off-by: Dan McGee <dan@archlinux.org>
2009-01-13Rename alpm_get_md5sum to alpm_compute_md5sum and alpm_dep_get_string to ↵Nagy Gabor1-1/+1
alpm_dep_compute_string This patch introduces the following function name convention: _compute_ in function name: the return value must be freed. _get_ in function name: the return value must not be freed. Signed-off-by: Nagy Gabor <ngaba@bibl.u-szeged.hu> Signed-off-by: Dan McGee <dan@archlinux.org>