Age | Commit message (Collapse) | Author | Files | Lines |
|
Signed-off-by: Allan McRae <allan@archlinux.org>
|
|
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>
|
|
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>
|
|
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>
|
|
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>
|
|
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>
|
|
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>
|
|
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>
|
|
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>
|
|
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>
|
|
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>
|
|
Signed-off-by: Dan McGee <dan@archlinux.org>
|
|
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>
|
|
Signed-off-by: Allan McRae <allan@archlinux.org>
|
|
Signed-off-by: Allan McRae <allan@archlinux.org>
|
|
Signed-off-by: Allan McRae <allan@archlinux.org>
|
|
Signed-off-by: Allan McRae <allan@archlinux.org>
|
|
Signed-off-by: Allan McRae <allan@archlinux.org>
|
|
Signed-off-by: Allan McRae <allan@archlinux.org>
|
|
Signed-off-by: Allan McRae <allan@archlinux.org>
|
|
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>
|
|
Signed-off-by: Dan McGee <dan@archlinux.org>
|
|
Signed-off-by: Dan McGee <dan@archlinux.org>
|
|
This involves some serious changes and a very messy diff, unfortunately.
Signed-off-by: Dan McGee <dan@archlinux.org>
|
|
This takes care of alpm_checkdeps() and alpm_find_dbs_satisfier().
Signed-off-by: Dan McGee <dan@archlinux.org>
|
|
Signed-off-by: Dan McGee <dan@archlinux.org>
|
|
Signed-off-by: Dan McGee <dan@archlinux.org>
|
|
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>
|
|
Signed-off-by: Dan McGee <dan@archlinux.org>
|
|
These are places where we stuck a string constant in a variable not
marked as const.
Signed-off-by: Dan McGee <dan@archlinux.org>
|
|
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>
|
|
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>
|
|
This avoids needless breakage of the public API.
Signed-off-by: Dave Reisner <d@falconindy.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
|
|
Signed-off-by: Dan McGee <dan@archlinux.org>
|
|
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>
|
|
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>
|
|
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>
|
|
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>
|
|
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>
|
|
* 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>
|
|
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>
|
|
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>
|
|
http://bbs.archlinux.org/viewtopic.php?id=77396
Signed-off-by: Xavier Chantry <shiningxc@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
|
|
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>
|
|
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>
|
|
Example usage and output :
> src/util/testdb -h
usage:
testdb [-b <pacman db>] : check the local database
testdb [-b <pacman db>] core extra ... : check the listed sync databases
> src/util/testdb
Checking the integrity of the local database in /var/lib/pacman/
> src/util/testdb core extra testing community
Checking the integrity of the sync databases in /var/lib/pacman/
missing dependency for archboot : bcm43xx-fwcutter>=006-2
missing dependency for xvattr : xfree86
missing dependency for eclipse-ve : eclipse<3.3
missing dependency for flumotion : twisted-web
missing dependency for gg2 : arts
missing dependency for man-pages-cs : groff-utf8
missing dependency for qc-usb : kernel26<2.6.26
Signed-off-by: Xavier Chantry <shiningxc@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
|
|
This is more consistent with the private functions :
_alpm_db_get_{pkg,grp}cache
Signed-off-by: Xavier Chantry <shiningxc@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
|
|
These two functions now take directly a package list rather than a database.
checkdbconflicts was renamed to checkconflicts.
Signed-off-by: Xavier Chantry <shiningxc@gmail.com>
|
|
We were using the stat() system call in quite a few places when we didn't
actually need anything the stat struct returned- we were simply checking for
file existence. access() will be more efficient in those cases.
Before (strace pacman -Ss pacman):
% time seconds usecs/call calls errors syscall
------ ----------- ----------- --------- --------- ----------------
33.16 0.005987 0 19016 stat64
After:
% time seconds usecs/call calls errors syscall
------ ----------- ----------- --------- --------- ----------------
34.85 0.003863 0 12633 1 access
7.95 0.000881 0 6391 7 stat64
Signed-off-by: Dan McGee <dan@archlinux.org>
|
|
Testdb will now scan the local database to check there are no conflicts.
I'm not sure how it's possible to get this situation. At least pacman
doesn't allow installing a package that conflicts with a local one, without
removing the local one. But maybe in a very weird situation, or because of
a bug, it could be possible. But anyway, this only requires 5 lines of
code.
Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
|