summaryrefslogtreecommitdiffstats
path: root/src
AgeCommit message (Collapse)AuthorFilesLines
2011-04-15libalpm: consistently use int as return type for option settersRémy Oudompheng1-5/+8
Currently the only error case then when handle == NULL. However several handle functions return -1 on this error, and a uniform API makes things simpler. Signed-off-by: Rémy Oudompheng <remy@archlinux.org>
2011-04-15pacman/query: correctly handle root files with -QoXavier Chantry1-16/+32
spotted by clang-analyzer (strcmp with NULL rpath is bad) Signed-off-by: Xavier Chantry <chantry.xavier@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org> Signed-off-by: Dan McGee <dan@archlinux.org>
2011-04-05Merge branch 'maint'Dan McGee1-5/+13
Conflicts: lib/libalpm/be_sync.c lib/libalpm/db.c src/pacman/util.c
2011-04-04pacman.c : useless extra parenthesisXavier Chantry1-1/+1
clang 3.0 git complained about these Signed-off-by: Xavier Chantry <chantry.xavier@gmail.com> Signed-off-by: Dan McGee <dan@archlinux.org>
2011-04-04Coding style cleanupsDan McGee1-5/+8
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-04-01Ensure stdout/stderr are flushed when asking questionsDan McGee1-0/+5
Addresses FS#23492, where the question was shown without knowing what one was answering to. Ensure we flush our output streams before printing the question, and flush the stream on which we ask the question before waiting for an answer. Signed-off-by: Dan McGee <dan@archlinux.org>
2011-03-29Merge branch 'maint'Dan McGee1-1/+2
2011-03-29call alpm_option_get_localdb once in syncfirst()Andrea Scarpino1-1/+2
Signed-off-by: Andrea Scarpino <andrea@archlinux.org> Signed-off-by: Dan McGee <dan@archlinux.org>
2011-03-28pacman/util: flush terminal input before reading responseDave Reisner1-0/+21
Addresses FS#20538 Signed-off-by: Dave Reisner <d@falconindy.com> Signed-off-by: Dan McGee <dan@archlinux.org>
2011-03-27Merge branch 'maint'Dan McGee1-8/+9
Conflicts: lib/libalpm/deps.c
2011-03-25Update usage instruction stringsDan McGee1-8/+9
* Address FS#23433 by documenting -d vs. -dd * Drop the useless "as well", "also", "too", and "that won't break packages" strings from -R usage * Fix alignment of multiline strings in source (no string change) Signed-off-by: Dan McGee <dan@archlinux.org>
2011-03-24Merge branch 'maint'Dan McGee1-0/+4
2011-03-24Add -T, --deptest to usage messageRay Kohler1-0/+4
Fixes FS #23369 Signed-off-by: Ray Kohler <ataraxia937@gmail.com> Signed-off-by: Dan McGee <dan@archlinux.org>
2011-03-23Added gpg verification options per repo to the config file.Xavier Chantry1-0/+18
Once we do this, add support for VerifySig to pactest. We just check if the repo name contains Always, Never or Optional to determine the value of VerifySig. The default is Never. pacman uses Always by default but this is not suitable for pactest. Original-work-by: shankar <jatheendra@gmail.com> Signed-off-by: Xavier Chantry <shiningxc@gmail.com> Signed-off-by: Dan McGee <dan@archlinux.org>
2011-03-23Let pacman specify GnuPG's home directory.Chris Brannon3-1/+27
GnuPG looks for configuration files and keyrings in its home directory. For a user, that is typically ~/.gnupg. This patch causes pacman to use /etc/pacman.d/gnupg/ as the default GnuPG home. One may override the default using --gpgdir on the command-line or GPGDir in pacman's configuration file. Signed-off-by: Chris Brannon <cmbrannon@cox.net> Signed-off-by: Xavier Chantry <shiningxc@gmail.com> Signed-off-by: Dan McGee <dan@archlinux.org>
2011-03-21Merge branch 'maint'Dan McGee2-24/+34
Conflicts due to change in return calling style. Conflicts: src/pacman/pacman.c src/pacman/sync.c
2011-03-21Do not query group selection when using -SpAllan McRae1-14/+26
Remove unnecessary output when using -Sp. Fixes FS#23340. Signed-off-by: Allan McRae <allan@archlinux.org> Signed-off-by: Dan McGee <dan@archlinux.org>
2011-03-21Restore --debug/--verbose output without a primary operationDan McGee1-7/+7
This is by no means a guarantee of this behavior remaining the same in the future, but it is easy enough to do what we used to in this case by delaying any sort of error condition until after we are completely done parsing options. Addresses FS#23370. Signed-off-by: Dan McGee <dan@archlinux.org>
2011-03-20Remove unnecessary NULL checkDan McGee1-3/+1
fp can never be NULL at this point in the code, proven by Coccinelle. Signed-off-by: Dan McGee <dan@archlinux.org>
2011-03-20Style change: return(x) --> return xDan McGee16-244/+244
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-03-20Fix handling of ignored packagesPang Yan Han1-0/+7
Noted in FS#23342. When the user attempts to install an ignored package and answers no when asked whether to install it, pacman bails out with: "error: target not found: packagename" This is because satisfiers are not found for the package and execution continues to process_group(), where the package is treated as a group (which does not exist). In addition, test ignore006.py is updated with PACMAN_RETCODE=0 since saying no to installing an ignored package should not be considered an error. Signed-off-by: Pang Yan Han <pangyanhan@gmail.com> Signed-off-by: Xavier Chantry <chantry.xavier@gmail.com> Signed-off-by: Dan McGee <dan@archlinux.org>
2011-03-16Warn but don't error for unknown pacman.conf directivesDan McGee1-26/+24
This makes all the pacman developers' jobs harder as we have to switch files whenever running multiple pacman versions and are using newly introduced options. Instead of erroring out, print warnings and continue on. This patch also fixes a const-correctness issue. We immediately cast a 'const char *' to a 'char *' in setrepeatingoption(), which is just plain wrong as we manipulate the underlying string. Fix the types and remove the now unnecessary variable. Finally, a few messages change here for consistency and clarity and because we continue parsing rather than bailing out on a problem. Signed-off-by: Dan McGee <dan@archlinux.org>
2011-03-16Only read from stdin if '-' is provided as a targetDave Reisner1-2/+6
This prevents a regression for people who enjoy piping yes to pacman to avoid prompts. Signed-off-by: Dave Reisner <d@falconindy.com> Signed-off-by: Dan McGee <dan@archlinux.org>
2011-03-07Fix value of ngettext() count parameter in callbackDan McGee1-1/+2
I was awesome and ran alpm_list_count() on an empty list. Fail. Signed-off-by: Dan McGee <dan@archlinux.org>
2011-02-28Fix some easy to find double translationsDan McGee2-13/+12
A lot of these were places that should have used the same message but didn't, or were very easy to convert to using the same message and letting some of the burden off of the translators. Signed-off-by: Dan McGee <dan@archlinux.org>
2011-02-28--print-format displays size in bytesJakob Gruber1-2/+2
Printing the exact size seems to make more sense for scripting contexts. Signed-off-by: Jakob Gruber <jakob.gruber@gmail.com> [Dan: adjust for master before VerbosePkgLists patches, fix type] Signed-off-by: Dan McGee <dan@archlinux.org>
2011-02-28Check local DB version before continuing transactionDan McGee1-0/+4
Ensure we have a local DB version that is up to par with what we expect before we go down any road that might modify it. This should prevent stupid mistakes with the 3.5.X upgrade and people not running pacman-db-upgrade after the transaction as they will need to. Signed-off-by: Dan McGee <dan@archlinux.org>
2011-02-25Add directory name to ownership error messageDan McGee1-1/+1
If you were doing a -Qo via xargs, it is at least nice to see what input caused the error message to occur rather than having a bunch of plain messages. This matches the style when we can't find the owner of a file. Signed-off-by: Dan McGee <dan@archlinux.org>
2011-02-25alpm: alpm_db_get_pkgcache_list => alpm_db_get_pkgcacheDave Reisner6-14/+14
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 McGee5-5/+5
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-02-04Merge remote-tracking branch 'allan/hash'Dan McGee6-14/+14
2011-02-04Add more error checking and loggingDan McGee1-0/+2
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-02-04Read pkgcache into hashAllan McRae6-14/+14
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-31make -d less strict; add -dd optionFlorian Pritz1-1/+7
-d skips checking the version of a dependency. -dd skips the whole dependency check. Signed-off-by: Xavier Chantry <chantry.xavier@gmail.com> Signed-off-by: Florian Pritz <bluewind@server-speed.net> Signed-off-by: Dan McGee <dan@archlinux.org>
2011-01-31Allow both cleanmethod values to be specified at the same timeDan McGee3-48/+54
No reason to disallow this- it allows keeping even more packages around in the cache. Test cases included for this case and to ensure the default behavior is preserved. Signed-off-by: Dan McGee <dan@archlinux.org>
2011-01-31Style cleanups in clean cache codeDan McGee1-7/+9
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-01-29Call count() once in callbackDan McGee1-2/+3
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-01-29select_display: per-database outputXavier Chantry1-2/+22
This function is used both for provision and group selection. Now the database name will be displayed. $ pacman -S base-devel :: There are 11 members in group base-devel: :: Repository testing 1) make :: Repository core 2) autoconf 3) automake 4) bison 5) fakeroot 6) flex 7) gcc 8) libtool 9) m4 10) patch 11) pkg-config Which ones do you want to install? Enter a number (default=all): Signed-off-by: Xavier Chantry <chantry.xavier@gmail.com>
2011-01-29pacman: improve select-questionXavier Chantry2-16/+16
Make use of parseindex like in multiselect, and loop until we get a valid answer like in multiselect. Signed-off-by: Xavier Chantry <chantry.xavier@gmail.com>
2011-01-29pacman/sync: implement interactive group selectionXavier Chantry3-2/+110
Signed-off-by: Xavier Chantry <chantry.xavier@gmail.com>
2011-01-29pacman/remove: switch to new alpm_remove_pkg interfaceXavier Chantry2-4/+32
Signed-off-by: Xavier Chantry <chantry.xavier@gmail.com>
2011-01-29pacman/upgrade: switch to new interfaceXavier Chantry1-1/+10
Note that there is a behavior change here : if the same package name appeared several times in the target list, the alpm_add_target interface chooses the new package, while alpm_add_pkg returns PKG_DUP. I don't see why we cannot unify the behavior of -S and -U, and just choose one behavior that applies to both. Otherwise, it's always possible to handle these different behaviors in the frontend, it just requires more work. Signed-off-by: Xavier Chantry <chantry.xavier@gmail.com>
2011-01-29pacman/sync: rewrite target handlingXavier Chantry1-15/+95
This uses the new public functions to handle targets from the frontend, like it used to be : 1) alpm_find_dbs_satisfier to find (optionally versioned) package or provision 2) alpm_find_grp_pkgs to find members for a groups 3) alpm_add_pkg to finally add the pmpkg_t from 1 or 2 Of course, this adds more code to the frontend, but it completely deprecates sync_target and sync_dbtarget interfaces. This all-in-one interfaces felt wrong and left no control to the frontend. A good frontend should just use alpm_add_pkg, with pkg coming from alpm_db_get_pkg (for normal targets), alpm_find_dbs_satisfier (for versioned provisions) or alpm_find_grp_pkgs (for groups). This also opens the way to provide a better group handling in pacman without constraint from libalpm and callbacks. In ignore006, only the retcode changes, because no package was found to satisfy the target (the only possible package is ignored). Signed-off-by: Xavier Chantry <chantry.xavier@gmail.com>
2011-01-29Add interactive provider selectionXavier Chantry3-0/+70
If there are multiple providers in one db, pacman used to just stop at the first one (both during dependency resolution or for pacman -S 'provision' which uses the same code). This adds a new conversation callback so that the user can choose which provider to install. By default (user press enter or --noconfirm), the first provider is still chosen, so for example the behavior of sync402 and 403 is preserved. But at least the user now has the possibility to make the right choice in a manual run. If one of the provider is already installed, it is picked for reinstall/upgrade, so that provision 002/003 pactest now pass. $ pacman -S community/smtp-server :: There are 3 providers available for smtp-server: 1) courier-mta 2) esmtp 3) exim Which one do you want to install? Enter a number (default=1): Signed-off-by: Xavier Chantry <chantry.xavier@gmail.com>
2011-01-29Remove need to explicitly register the local DBDan McGee7-22/+19
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>
2011-01-22Query fileowner performance improvementsDan McGee1-15/+33
Clean up some of the code by doing less string copying and printing. This is accomplished by either doing it after we know we need it, or taking advantage of the fact that some strings never change such as the root directory prefix. Also, fix an issue where a file at the root level (e.g. /foobar) could not be queried. End result is a much faster user experience when combined with the mbasename() changes. These timings are for looking up 113 files in /etc/, some of which are owned and some which are not. $ find /etc -maxdepth 1 -type f | xargs time pacman -Qo >/dev/null 6.10user 0.05system 0:06.17elapsed 99%CPU (0avgtext+0avgdata 131040maxresident)k 0inputs+0outputs (0major+9436minor)pagefaults 0swaps $ find /etc -maxdepth 1 -type f | xargs time ./src/pacman/.libs/lt-pacman -Qo >/dev/null 0.86user 0.04system 0:00.92elapsed 99%CPU (0avgtext+0avgdata 131120maxresident)k 0inputs+0outputs (0major+9436minor)pagefaults 0swaps I'll take a 600% increase in speed. Signed-off-by: Dan McGee <dan@archlinux.org>
2011-01-22Improve mbasename performanceDan McGee3-16/+8
Rather than roll our own, use strrchr() instead, which glibc may have a better implementation than the simple iteration method we were using. Signed-off-by: Dan McGee <dan@archlinux.org>
2011-01-22Be smarter about failure to read backup file contentsDan McGee1-1/+11
Instead of always printing MISSING, we can switch on the errno value set by access() and print a more useful string. In this case, handle files we can't read by printing UNREADABLE, print MISSING on ENOENT, and print UNKNOWN for anything else. Fixes FS#22546. Signed-off-by: Dan McGee <dan@archlinux.org>
2011-01-22Mark backup status strings as untranslatedDan McGee1-3/+3
And also change "Not Modified" -> "UNMODIFIED" for consistency. This makes it a lot easier to machine-parse this and not worry about locale differences. Signed-off-by: Dan McGee <dan@archlinux.org>
2011-01-22Refactor backup file status check into separate functionDan McGee1-24/+35
This will make it a lot easier to use this stuff elsewhere. Signed-off-by: Dan McGee <dan@archlinux.org>