summaryrefslogtreecommitdiff
path: root/src/pacman
AgeCommit message (Collapse)Author
2011-01-12Merge branch 'maint'Dan McGee
Conflicts: lib/libalpm/be_files.c
2011-01-11Make debug config messages consistent in capitalizationDan McGee
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-01-11Add a progressbar for package integrity checkingDan McGee
This can take a while too, and it is really easy to add the necessary callback stuff for adding a progressbar. Signed-off-by: Dan McGee <dan@archlinux.org>
2011-01-11Small fix to download size lookup and a loggerDan McGee
These were just two small things I came across today and found could be fixed or helpful, so I've added them and I'm not sure what else to bundle them with. commit_count++ Signed-off-by: Dan McGee <dan@archlinux.org>
2011-01-10Use double rather than float everywhereDan McGee
No real need to use the smaller floating point types here. Signed-off-by: Dan McGee <dan@archlinux.org>
2011-01-10Progress callback cleanups and fixesDan McGee
* Remove a stale comment * Fix a logic error- the conditional disagreed with the comments * Remove some unnecessary floating point casts Signed-off-by: Dan McGee <dan@archlinux.org>
2011-01-07Fix some more simple conversion "errors"Dan McGee
None of these warn at the normal "-Wall -Werror" level, but casts do occur that we are fine with. Make them explicit to silence some warnings when using "-Wconversion". Signed-off-by: Dan McGee <dan@archlinux.org>
2011-01-07Use size_t for alpm_list sizesAllan McRae
There is a lot of swtiching between size_t and int for alpm_list sizes in the codebase. Start converting these to all be size_t by adjusting the return type of alpm_list_count and fixing all additional warnings given by -Wconversion that are generated by this change. Dan: a few more small changes to ensure things compile, adjusting some printf format string characters to accommodate the larger size on x86_64. Signed-off-by: Allan McRae <allan@archlinux.org> Signed-off-by: Dan McGee <dan@archlinux.org>
2011-01-07Update copyright years for 2011Allan McRae
Signed-off-by: Allan McRae <allan@archlinux.org> Signed-off-by: Dan McGee <dan@archlinux.org>
2010-12-30Declare all local functions staticAllan McRae
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-20Always specify arguement type in function delcarationsAllan McRae
Always declare a function with (void) rather than () when we expect no arguements. Fixes all warnings with -Wstrict-prototypes. Signed-off-by: Allan McRae <allan@archlinux.org> Signed-off-by: Dan McGee <dan@archlinux.org>
2010-12-12Explicitly test time difference is greater than zeroAllan McRae
We are comparing a floating point number so should use an inequality rather than implicitly testing != 0. Prevents warning given by -Wfloat-equal. Signed-off-by: Allan McRae <allan@archlinux.org> Signed-off-by: Dan McGee <dan@archlinux.org>
2010-12-12Display progress bar for disk space checkingAllan McRae
Checking disk space needed for a transaction can take a while so add an informative progress bar. Signed-off-by: Allan McRae <allan@archlinux.org> Signed-off-by: Dan McGee <dan@archlinux.org>
2010-12-12Add configuration option to control disk space checkingAllan McRae
Disk space checking is likely to be an unnecessary bottleneck to people with reasonable partition sizes so add a configuration option to allow it to be disabled/enabled as wanted. Signed-off-by: Allan McRae <allan@archlinux.org> Signed-off-by: Dan McGee <dan@archlinux.org>
2010-12-12Remove AC_TYPE_SIGNAL usageDan McGee
This macro is deemed unnecessary by even the autoconf guys, so we really don't need to use it. Signed-off-by: Dan McGee <dan@archlinux.org> Signed-off-by: Allan McRae <allan@archlinux.org> Signed-off-by: Dan McGee <dan@archlinux.org>
2010-12-12dirent usage cleanupDan McGee
We were including the header in a lot of places it is no longer used. Additionally, use the correct autoconf macro for determining whether d_type is available as a member: HAVE_STRUCT_DIRENT_D_TYPE. Signed-off-by: Dan McGee <dan@archlinux.org> Signed-off-by: Allan McRae <allan@archlinux.org> Signed-off-by: Dan McGee <dan@archlinux.org>
2010-12-12alpm/remove.c : respect --dbonly during remove-upgradeXavier Chantry
When a -Sk or -Uk operation induced a removal of an existing local package, --dbonly was not in effect and the files were all removed. Fixing this behavior was already marked as TODO in database012 pactest ------------ TODO: I honestly think the above should NOT delete the original les, it hould upgrade the DB entry without touching anything on the file stem. E.g. this test should be the same as: pacman -R --dbonly dummy && pacman -U --dbonly dummy.pkg.tar.gz ------------ Signed-off-by: Xavier Chantry <chantry.xavier@gmail.com> [Dan: small coding style touchup] Signed-off-by: Dan McGee <dan@archlinux.org>
2010-12-12pacman: sort --help outputXavier Chantry
Example with pacman -Uh : $ pacman -Uh options: -b, --dbpath <path> set an alternate database location -d, --nodeps skip dependency checks -f, --force force install, overwrite conflicting files -k, --dbonly only modify database entries, not package files -r, --root <path> set an alternate installation root -v, --verbose be verbose --arch <arch> set an alternate architecture --asdeps install packages as non-explicitly installed --asexplicit install packages as explicitly installed --cachedir <dir> set an alternate package cache location --config <path> set an alternate configuration file --debug display debug messages --ignore <pkg> ignore a package upgrade (can be used more than once) --ignoregroup <grp> ignore a group upgrade (can be used more than once) --logfile <path> set an alternate log file --noconfirm do not ask for any confirmation --noprogressbar do not show a progress bar when downloading files --noscriptlet do not execute the install scriptlet if one exists --print only print the targets instead of performing the operation --print-format <string> specify how the targets should be printed Signed-off-by: Xavier Chantry <chantry.xavier@gmail.com> [Dan: small coding style touchups] Signed-off-by: Dan McGee <dan@archlinux.org>
2010-12-12CLI args: update --help and manpageXavier Chantry
The three parts (help, manpage and code) are now organized in the same way and much easier to compare : - specific options - install/upgrade options for -S and -U - transaction options for -S -R and -U - global options After this re-organization, it was easy to update and sync the three components together. Duplication is also avoided. Signed-off-by: Xavier Chantry <chantry.xavier@gmail.com> Signed-off-by: Dan McGee <dan@archlinux.org>
2010-12-12pacman/deptest: reimplement with alpm_find_satisfierXavier Chantry
It's very easy to re-implement the -T feature with the more generic alpm_find_satisfier rather then the more specific and less useful alpm_deptest. Signed-off-by: Xavier Chantry <chantry.xavier@gmail.com> Signed-off-by: Dan McGee <dan@archlinux.org>
2010-12-12Fix a few problems reported by clang-analyzerXavier Chantry
One missing NULL-check and 3 dead assignments. Signed-off-by: Xavier Chantry <chantry.xavier@gmail.com> Signed-off-by: Dan McGee <dan@archlinux.org>
2010-12-12Ensure stdin args are correctly terminatedDan McGee
And don't require pm_targets to be empty to read from stdin either. Signed-off-by: Dan McGee <dan@archlinux.org>
2010-11-04Support reading package args from stdinDave Reisner
Only occurs if no arguments were provided directly. Arguments can be separated by any amount of valid whitespace. This allows for piping into pacman from other programs or from itself, e.g.: pacman -Qdtq | pacman -Rs This is better than using xargs, as xargs will not reconnect stdin to the terminal. The above operation performed using xargs would require the --noconfirm flag to be passed to pacman. Signed-off-by: Dave Reisner <d@falconindy.com>
2010-10-14Clean up all old database files and directoriesAllan McRae
Clean-up the previous download location of the sync database and any old extracted sync database directories which are unneeded with the tar-db backend. Signed-off-by: Allan McRae <allan@archlinux.org>
2010-10-11CLI args: stricter/better parsingJakob Gruber
In the following, the letters SRUDQ refer to the corresponding pacman operations. Most of the work in this commit is about removing as many options as possible from the global section and moving them to where they actually belong. Additionally, --ignore{,group} are added to U and --dbonly is added to S. --dbonly added to S --asdeps moved to S/U/D --asexplicit moved to S/U/D --print-format moved to S/U/R --noprogressbar moved to S/U/R --noscriptlet moved to S/U/R --ignorepkg added to U --ignoregrp added to U -d moved to S/U/R (--nodeps) and Q (--deps) -p moved to S/U/R (--print) and Q (--file) -f moved to S/U Signed-off-by: Xavier Chantry <chantry.xavier@gmail.com> Signed-off-by: Dan McGee <dan@archlinux.org>
2010-10-11CLI args: reorganize parsingJakob Gruber
Split parsing of CLI arguments into separate functions: parsearg_op (operations) parsearg_global (global options) parsearg_{database,query,remove,sync,deptest,upgrade} Organization strictly follows the manpage (even where the manpage is incorrect) - these cases will be fixed in the following commits. Switch cases are copy/pasted and statements unrelated to chosen operation are deleted. Parsing logic adjusted as follows: 1) Parse operation 2) If we can bail out early (duplicate op, help/version requested) do so 3) Parse arguments again: foreach arg: if arg is operation: continue tryparse_args_specific_to_op if unsuccessful tryparse_args_global if unsuccessful print error message and exit Signed-off-by: Xavier Chantry <chantry.xavier@gmail.com> Signed-off-by: Dan McGee <dan@archlinux.org>
2010-09-27Add wrapper around asprintf callsAllan McRae
Not checking the return value of asprintf calls reuslts in a warning when using -D_FORTIRFY_SOURCE=2. This adds a simple wrapper around asprintf calls which checks the return value. Currently the check does nothing more than outputing a message to stderr on failure, but that is at least an improvement over silent failures. Signed-off-by: Allan McRae <allan@archlinux.org>
2010-09-07Restore trimming of db and pkg extensionsDan McGee
These keep having to change because we are getting really good at changing the downloaded filename. Shorten the match sequences to just .db and .pkg and trim everything after and including these strings. Signed-off-by: Dan McGee <dan@archlinux.org>
2010-08-23Fix some whitespace issuesAllan McRae
The combination of tabs and spaces is annoying in any editor that does not use a tab width of 2 spaces. Signed-off-by: Allan McRae <allan@archlinux.org> Signed-off-by: Dan McGee <dan@archlinux.org>
2010-08-23fgets invocation cleanupDan McGee
From the fgets manpage: fgets() reads in at most one less than size characters from stream and stores them into the buffer pointed to by s. Reading stops after an EOF or a newline. If a newline is read, it is stored into the buffer. A '\0' is stored after the last character in the buffer. This means there is no need at all to do 'size - 1' math. Remove all of that and just use sizeof() for simplicity on the buffer we plan on reading into. Signed-off-by: Dan McGee <dan@archlinux.org>
2010-07-27Use the plural features of gettextDan McGee
Gettext has this whole 'Plural-Form' thing that until now we haven't taken advantage of. Given that not all languages have the same plural form rules as English, take advantage of it by defining a new _n() macro which will normally define to ngettext(), and adjust a few messages as an example of how to use. There are surely other places where we do singular/plural logic without me having noticed, so further patches are welcome to fix those up too. Signed-off-by: Dan McGee <dan@archlinux.org>
2010-07-27Merge branch 'maint'Dan McGee
2010-07-27Fix compile error in certain casesDan McGee
I'm not sure why it doesn't happen everywhere, but we need <sys/stat.h> for umask and mkdir in this file. I hit this today: cc1: warnings being treated as errors util.c: In function ‘makepath’: util.c:128:2: error: implicit declaration of function ‘umask’ util.c:141:5: error: implicit declaration of function ‘mkdir’ make[2]: *** [util.o] Error 1 Signed-off-by: Dan McGee <dan@archlinux.org>
2010-07-01Check return value of chdir and getcwdAllan McRae
Prevents compiler warnings when building with -D_FORTIFY_SOURCE=2 Signed-off-by: Allan McRae <allan@archlinux.org> Signed-off-by: Dan McGee <dan@archlinux.org>
2010-06-30Do not compare signed and unsigned typesAllan McRae
The casting of nread is safe as it is tested to be >0 when it is initally assigned. It is also being implicitly cast in the fwrite call in the line above. Signed-off-by: Allan McRae <allan@archlinux.org> Signed-off-by: Dan McGee <dan@archlinux.org>
2010-06-21Clarify testing within conditional statementsAllan McRae
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>
2010-06-05Remove unnecessary gettext callDan McGee
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-05-18Allow to include a path containing wildcardsMarc-A. Dahlhaus
Dan: line wrapping and man page touchup. Signed-off-by: Marc-A. Dahlhaus <mad@wol.de> Signed-off-by: Dan McGee <dan@archlinux.org>
2010-05-17Allow Include directive in any sectionsXavier Chantry
Fix a regression of 51f9e5e40a7 that only allowed Include in repo sections. Thanks to Marc - A. Dahlhaus for reporting the issue. Signed-off-by: Xavier Chantry <chantry.xavier@gmail.com> Signed-off-by: Dan McGee <dan@archlinux.org>
2010-05-11Allow -Qo to perform a functional 'which'Allan McRae
When pacman queries the ownership of an object that is not a path, it will check in the users PATH for a match. Implements FS#8798. Dan: did some small refactoring and error message changes when PATH is searched and nothing is found. Original-patch-by: Shankar <jatheendra@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org> Signed-off-by: Dan McGee <dan@archlinux.org>
2010-05-05Improve documentation of -k/--dbonlyDan McGee
We had the long option wrong in some places and its behavior wasn't documented at all with regards to -U/--upgrade. Signed-off-by: Dan McGee <dan@archlinux.org>
2010-05-05Remove unused 'z' option from getopt_long's optstringNagy Gabor
In addition, I permuted shortopts to make it more readable. Signed-off-by: Nagy Gabor <ngaba@bibl.u-szeged.hu> Signed-off-by: Dan McGee <dan@archlinux.org>
2010-05-05Introduce -D, --databaseNagy Gabor
The request of FS#12950 is implemented. On the backend side, I introduced a new function, alpm_db_set_pkgreason(), to modify the install reason of a package in the local database. On the front-end side, I introduced a new main operation, -D/--database, which has two options, --asdeps and --asexplicit. I documented this in pacman manual. I've created two pactests to test -D: database001.py and database002.py. Signed-off-by: Nagy Gabor <ngaba@bibl.u-szeged.hu> Signed-off-by: Dan McGee <dan@archlinux.org>
2010-04-26check for valid optarg before using strdupSerge Ziryukin
Signed-off-by: Serge Ziryukin <ftrvxmtrx@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org> Signed-off-by: Dan McGee <dan@archlinux.org>
2010-03-25Show --print and --print-format options with -Rh, -Sh and -Uh onlyNagy Gabor
http://mailman.archlinux.org/pipermail/pacman-dev/2010-March/010519.html Signed-off-by: Nagy Gabor <ngaba@bibl.u-szeged.hu> Signed-off-by: Dan McGee <dan@archlinux.org>
2010-03-23Show 'Required By' in -Sii outputDan McGee
Just as we do in -Qi, we can compute required by information for sync database packages. The behavior seems sane; for a given package, the -Sii required by will show all packages in *any* sync database that require it. Implements FS#16244. Signed-off-by: Dan McGee <dan@archlinux.org>
2010-03-18Strip extension off all package compression typesDan McGee
Since we were searching for '.pkg.tar.gz' before, we now have started to show extensions during the download when we have a '.pkg.tar.xz' package. Just look for '.pkg.tar.' (or '.db.tar.') instead and suppress anything found from that point on. Signed-off-by: Dan McGee <dan@archlinux.org>
2010-03-14Bump copyright dates to 2010Dan McGee
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-03-14fix a few warnings reported by clangXavier Chantry
- remove unused variables - some more sanity checks - safer printf Signed-off-by: Xavier Chantry <shiningxc@gmail.com> Signed-off-by: Dan McGee <dan@archlinux.org>
2010-03-14Mark two functions staticDan McGee
These were just introduced in the `--print` patch, and don't need to be exposed outside of util.c. Signed-off-by: Dan McGee <dan@archlinux.org>