summaryrefslogtreecommitdiffstats
path: root/src/pacman/conf.c
AgeCommit message (Collapse)AuthorFilesLines
2011-10-12Remove alpm_list_getdata wrapper functionDan McGee1-1/+1
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-09-28Keep track of explicitly added and removed packagesDan McGee1-1/+3
This allows us to sort the output list by showing all pulled dependencies first, followed by the explicitly specified targets. Signed-off-by: Dan McGee <dan@archlinux.org>
2011-09-22config parsing: add note if libcurl disabled and no XferCommandDan McGee1-0/+2
Just a helpful warning for those users in this unenviable position. Signed-off-by: Dan McGee <dan@archlinux.org>
2011-09-22config parsing: include file and line number in more errorsDan McGee1-12/+20
Before: $ pacman -Si pacman error: invalid value for 'SigLevel' : 'FooValue' After: $ ./src/pacman/pacman -Si pacman error: config file /etc/pacman.conf, line 88: invalid value for 'SigLevel' : 'FooValue' Signed-off-by: Dan McGee <dan@archlinux.org>
2011-09-22Pull option names out of messages in config parsingDan McGee1-7/+9
This allows some message reuse, as well as making it clear to translators what *not* to translate. Signed-off-by: Dan McGee <dan@archlinux.org>
2011-09-22Check capabilities in SigLevel option parsingDan McGee1-2/+11
Only allow turning it on if the backend library has support for it. Signed-off-by: Dan McGee <dan@archlinux.org>
2011-09-22Move default siglevel value from backend to frontendDan McGee1-7/+3
This takes the libraries hidden default out of the equation: hidden in the sense that we can't even find out what it is until we create a handle. This is a chicken-and-egg problem where we have probably already parsed the config, so it is hard to get the bitmask value right. Move it to the frontend so the caller can do whatever the heck they want. This also exposes a shortcoming where the frontend doesn't know if the library even supports signatures, so we should probably add a alpm_capabilities() method which exposes things like HAS_DOWNLOADER, HAS_SIGNATURES, etc. Signed-off-by: Dan McGee <dan@archlinux.org>
2011-09-20Flip getcwd()/chdir() for open()/fchdir() in the frontendDan McGee1-10/+14
Just like we did in libalpm in commit 288a81d8470b1. Signed-off-by: Dan McGee <dan@archlinux.org>
2011-09-03Former transaction callback rename refactorDan McGee1-3/+3
Put all the callback stuff in alpm.h in one spot, and make the following renames for clarity with the new structure: ALPM_TRANS_EVT_* --> ALPM_EVENT_* ALPM_TRANS_CONV_* --> ALPM_QUESTION_* ALPM_TRANS_PROGRESS_* --> ALPM_PROGRESS_* alpm_option_get_convcb() --> alpm_option_get_questioncb() alpm_option_set_convcb() --> alpm_option_set_questioncb() Signed-off-by: Dan McGee <dan@archlinux.org>
2011-09-03Move all callbacks up to the handle levelDan McGee1-0/+3
This was just disgusting before, unnecessary to limit these to only usage in a transaction. Still a lot of more room for cleanup but we'll start by attaching them to the handle rather than the transaction we may or may not even want to use these callbacks. Signed-off-by: Dan McGee <dan@archlinux.org>
2011-08-23Retrieve default SigLevel value from backend after initial settingDan McGee1-0/+3
This ensures we grab and use the library default once we have processed the global SigLevel setting, but before processing the repo-specific settings. This means the following two configs will now evaluate the same, as the backend currently defaults to 'Optional': Config 1: [options] # nothing here [repo] SigLevel = TrustAll Config 2: [options] SigLevel = Optional [repo] SigLevel = TrustAll Signed-off-by: Dan McGee <dan@archlinux.org>
2011-08-08Check return value of rename() callsDan McGee1-2/+6
We did a good job checking this in add.c, but not necessarily anywhere else. Fix this up by adding checks into dload.c, remove.c, and conf.c in the frontend. Also add loggers where appropriate and make the message syntax more consistent. Signed-off-by: Dan McGee <dan@archlinux.org>
2011-08-02Implement parsing of the new SigLevel directiveDan McGee1-31/+105
Add code to conf.c that parses the new SigLevel directive. An overwhelming number of options are presented, but most users will still be fine with the Never/Optional/Required trio. More advanced users can combine these or any of the other options on a 'SigLevel = ' line, which is parsed in a left-to-right fashion and flags turned on and off accordingly. For example, all three of these will net the same config: SigLevel = Required PackageOptional SigLevel = Optional DatabaseRequired SigLevel = DatabaseRequired PackageOptional Additionally, database-specific lines assume you wish to start with any global default that has been set. For example, if any of the above lines were in the [options] section, something such as: SigLevel = PackageRequired PackageAllowMarginal Would continue to enforce required database signatures. Inspiration-by: Kerrick Staley <mail@kerrickstaley.com> Signed-off-by: Dan McGee <dan@archlinux.org>
2011-07-06fix segfault if pacman.conf can't be readFlorian Pritz1-1/+3
Signed-off-by: Florian Pritz <bluewind@xinu.at> Signed-off-by: Dan McGee <dan@archlinux.org>
2011-07-05signing: move to new signing verification and return schemeDan McGee1-18/+20
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_errno_t members with ALPMAllan McRae1-1/+1
Signed-off-by: Allan McRae <allan@archlinux.org>
2011-07-01Prefix alpm_loglevel_t members with ALPMAllan McRae1-54/+54
Signed-off-by: Allan McRae <allan@archlinux.org>
2011-06-29Rename public functions with grp in their nameAllan McRae1-1/+1
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>
2011-06-28Rename pmerrno_t to alpm_errno_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-24Add a 'valid' flag to the database objectDan McGee1-1/+1
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>
2011-06-24Move database 'version' check to registration timeDan McGee1-0/+3
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>
2011-06-24Do database signature checking at load timeDan McGee1-13/+3
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-15API: change 'signaturedir' to 'gpgdir'Dan McGee1-1/+1
This is more in line with reality and what we have our makepkg, etc. options named anyway. Original-patch-by: Kerrick Staley <mail@kerrickstaley.com> Signed-off-by: Dan McGee <dan@archlinux.org>
2011-06-14Avoid setting sigverify option twiceDan McGee1-1/+0
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-06-14conf: do batch processing of repo sectionsDan McGee1-49/+100
We now parse an entire repo section and store all information about it. When the next section is encountered or the end of the root config file is reached, we will then process the stored information. Signed-off-by: Dan McGee <dan@archlinux.org>
2011-06-14conf: _parseconfig() cleanups and documentationDan McGee1-19/+38
* Function doxygen documentation * Reuse a single strlen() call * Prevent infinite recursion (limit to 10 levels) * Other small cleanups Signed-off-by: Dan McGee <dan@archlinux.org>
2011-06-14Move pm_errno onto the handleDan McGee1-5/+5
This involves some serious changes and a very messy diff, unfortunately. 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-20/+22
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-09Kill all remaining 'PATH_MAX + 1' usagesDan McGee1-1/+1
The few remaining instances were utilized for buffers in calls to snprintf() and realpath(). Both of these functions will always ensure the returned value is padded with '\0', so there is no need for the extra byte. Signed-off-by: Dan McGee <dan@archlinux.org>
2011-06-07Revamp pacman setup code to handle new alpm initialize routineDan McGee1-91/+114
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-05-05Rework config parsing to reduce variable duplicationDan McGee1-32/+25
This removes the need to strdup() the section name at every decent into an Include statement, as well as having duplicate DB pointers around that are never used independently. Signed-off-by: Dan McGee <dan@archlinux.org>
2011-05-05Refactor VerifySig option value parsing into standalone methodDan McGee1-21/+32
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-05-05Improve database server APIDan McGee1-1/+1
Currently we have one call that has all sorts of crazy behavior and doesn't make a whole lot of sense. Go from one method to the normal four methods we have for all of our other lists we use in the library to make it a lot easier for a frontend to manipulate server lists. Signed-off-by: Dan McGee <dan@archlinux.org>
2011-05-05Make config parsing a two-part affairDan McGee1-71/+91
This ensures we call any alpm_option type functions before registering databases, making sure all paths and other defaults (e.g. sig verification levels) have been set first. This will ensure we can continue to allow crazy config files where [options] doesn't come first. The diffstat on this commit is misleading; view with -w/--ignore-all-space to get a better idea of what needed to be touched. Signed-off-by: Dan McGee <dan@archlinux.org>
2011-05-05Move parseconfig to conf.cDan McGee1-0/+600
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-03-21Style change: return(x) --> return xDan McGee1-4/+4
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-01-08Update copyright years for 2011Allan McRae1-1/+1
Signed-off-by: Allan McRae <allan@archlinux.org> Signed-off-by: Dan McGee <dan@archlinux.org>
2010-03-15Bump copyright dates to 2010Dan McGee1-1/+1
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-03-15Add new --print operation for all operationsXavier Chantry1-0/+1
And a new --print-format option to configure the output. This implements FS#14208 Example usage : pacman -Sp --print-format "%r/%n-%v : %l [%s]" kdelibs extra/kdelibs-4.3.2-4 : ftp://mir2.archlinuxfr.org/archlinux/extra/os/i686/kdelibs-4.3.2-4-i686.pkg.tar.gz [0,00] Signed-off-by: Xavier Chantry <shiningxc@gmail.com> Signed-off-by: Dan McGee <dan@archlinux.org>
2009-07-23Add a fetch callback to allow front-end download supportSebastian Nowicki1-0/+1
This allows a frontend to define its own download algorithm so that the libfetch dependency can be omitted without using an external process. The callback will be used when if it is defined, otherwise the old behavior applies. Signed-off-by: Sebastian Nowicki <sebnow@gmail.com> [Dan: minor cleanups] Signed-off-by: Dan McGee <dan@archlinux.org>
2009-07-01Update copyright headers and messagesDan McGee1-1/+2
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-01-13HoldPkg reworkNagy Gabor1-0/+1
The HoldPkg feature is even more important when the packages to be held are pulled automatically by pacman, in a -Rc and -Rs operation. Before, it only applied when the packages were explicitly requested by the user to be removed. This patch extends holdpkg to -Rc and -Rs by doing the HoldPkg check just before trans_commit. Additionally, the whole HoldPkg stuff was moved to the front-end. I changed the default behavior to "don't remove", so I modified remove030.py pactest as well. See also: FS#9173. Original-work-by: Xavier Chantry <shiningxc@gmail.com> Signed-off-by: Nagy Gabor <ngaba@bibl.u-szeged.hu> Signed-off-by: Dan McGee <dan@archlinux.org>
2008-09-03Remove unnecessary initialization in new functionsDan McGee1-4/+0
We don't need to zero things out, we are already using calloc for this purpose. Signed-off-by: Dan McGee <dan@archlinux.org>
2008-05-13Add SyncFirst option.Chantry Xavier1-0/+2
This patch offers a way to fix FS#9228. By putting "SyncFirst = pacman" in pacman.conf, the version check will happen before the transaction really starts, and before any replacements is made. Otherwise, no version check is done. The sync301 pactest was updated to use this SyncFirst option. Example session with SyncFirst = pacman, and a newer pacman version available : $ pacman -Su (or pacman -S <any targets>) :: the following packages should be upgraded first : pacman :: Do you want to cancel the current operation :: and upgrade these packages now? [Y/n] resolving dependencies... looking for inter-conflicts... Targets: pacman-x.y.z-t Total Download Size: x.xx MB Total Installed Size: x.xx MB Proceed with installation? [Y/n] n As Nagy previously noted, doing this check on any -S operations might look intrusive, but it can be required. For example, the case where you want to install a package with versioned provisions, using a pacman version which didn't support that feature yet (and there is already a newer pacman in sync db supporting it). Signed-off-by: Chantry Xavier <shiningxc@gmail.com> Signed-off-by: Dan McGee <dan@archlinux.org>
2008-05-12Make all error messages use pm_fprintfAllan McRae1-2/+4
Tested using many easily generated error conditions. Also added "malloc failure" (conf.c) and "segmentation fault" (pacman.c) error messages for translation. Signed-off-by: Allan McRae <mcrae_allan@hotmail.com> [Dan: fix trailing whitespace errors, other compilation issues] Signed-off-by: Dan McGee <dan@archlinux.org>
2007-12-11Update GNU GPL boilerplate and copyright datesDan McGee1-4/+2
Update the GPL boilerplate to direct people to the GNU website for a copy of the license, as well as bump all of Judd's copyrights to 2007. Signed-off-by: Dan McGee <dan@archlinux.org>
2007-12-02Make pacman path handling (hopefully) a bit more intuitiveDan McGee1-0/+6
I made pacman path handling a bit odd with my rootdir changes a while back in order to increase flexability. However, it had a bit of a drawback in that dbpath/logfile/etc. would not default to being under the rootdir if that was the only parameter you specified in the config file or on the command line. (Note: logfile handling was always broken due to the explicit logfile line required in config files) Pacman now works as follows: if a rootdir is specified but not dbpath or logfile: attempt to place the logfile and dbpath in their default locations under root if an explicit dbpath/logfile is specified: interpret these as absolute paths, regardless of the rootdir setting if nothing is specified: fall back to configured defaults Signed-off-by: Dan McGee <dan@archlinux.org>