summaryrefslogtreecommitdiff
path: root/src/pacman/pacman.c
Commit message (Collapse)AuthorAge
* Disable geteuid in cygwin.Xavier Chantry2008-05-14
| | | | | | | | | | This is one of those rare cases where we actually want to code in a platform-specific #ifdef. Because you don't need to be the root user on a Windows box, and fakeroot doesn't exist so we can do easy testing, lets disable any checking of the UID. Signed-off-by: Xavier Chantry <shiningxc@gmail.com> Signed-off-by: Dan McGee <dan@archlinux.org>
* Add SyncFirst option.Chantry Xavier2008-05-13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* Make all error messages use pm_fprintfAllan McRae2008-05-11
| | | | | | | | | | 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>
* Update configure.ac to current codeDan McGee2008-04-07
| | | | | | | | Remove a few functions and things that were unnecessary, update the help line calls to the current function name, and make the small change to pacman.c for the signal handler return type that is defined in config.h. Signed-off-by: Dan McGee <dan@archlinux.org>
* Add new CleanMethod option.Chantry Xavier2008-03-23
| | | | | | | | | | | | | | | | As it was already mentioned several times, the new -Sc behavior in 3.1 is great, but only when the package cache is not shared. This option has two possible values : KeepInstalled and KeepCurrent With KeepCurrent, -Sc will clean packages that are no longer available in any sync db, rather than packages that are no longer in the local db. The resulting behavior should be better for shared cache. Ref : http://www.archlinux.org/pipermail/pacman-dev/2008-February/011140.html Signed-off-by: Chantry Xavier <shiningxc@gmail.com> Signed-off-by: Dan McGee <dan@archlinux.org>
* Kill the dependsonly option.Chantry Xavier2008-03-22
| | | | | | | From the man page : "This is pretty useless and we're not sure why it even exists." Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
* Drop case insensitive comparisons in the config parsing.Chantry Xavier2008-03-17
| | | | | | | | | | | | | | | These case insensitive comparisons didn't work in some locales, like tr_TR where upper(i) != I. So a second case sensitive comparison had to be made for each directive. Only keeping case sensitive comparisons make the code cleaner and treat all locales equally. Ref: http://www.archlinux.org/pipermail/pacman-dev/2008-March/011445.html Also fix pactests to use the correct case. Signed-off-by: Chantry Xavier <shiningxc@gmail.com> Signed-off-by: Dan McGee <dan@archlinux.org>
* Add -Rss optionNagy Gabor2008-03-10
| | | | | | | | * -Rss removes all dependencies (including explicitly installed ones). * updated documentation * two pactest files added to test the difference between -Rs and -Rss Signed-off-by: Nagy Gabor <ngaba@bibl.u-szeged.hu>
* Merge branch 'maint'Dan McGee2008-03-09
|\ | | | | | | | | | | Conflicts: configure.ac
| * Use sigaction instead of signal.Chantry Xavier2008-03-09
| | | | | | | | | | | | | | | | | | | | | | | | | | From signal man page : "The behavior of signal() varies across Unix versions, and has also varied historically across different versions of Linux. Avoid its use: use sigaction(2) instead. See Portability below." The code was taken from there : http://www.gnu.org/software/libtool/manual/libc/Sigaction-Function-Example.html Signed-off-by: Chantry Xavier <shiningxc@gmail.com> Signed-off-by: Dan McGee <dan@archlinux.org>
| * src/pacman/pacman.c : split cleanup function.Chantry Xavier2008-03-09
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This function was used in two different ways : - as a signal handler : the argument was the signal number - called manually for freeing the resources : the argument was the return value So the first part is now handler(int), and the second cleanup(int). Ref: http://www.archlinux.org/pipermail/pacman-dev/2008-March/011388.html Remaining problems : - the return values are messy. for example, 2 can mean both that it was interrupted (SIGINT == 2), or that --help or -V was used (returned by parseargs). - apparently signal is not portable and sigaction should be used instead Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
| * New alpm_version functionNagy Gabor2008-03-06
| | | | | | | | | | | | | | | | | | | | Now pacman frontend uses this function instead of the compile-time libalpm version number. Signed-off-by: Nagy Gabor <ngaba@bibl.u-szeged.hu> [Dan: fix one more spot where LIB_VERSION was used] Signed-off-by: Dan McGee <dan@archlinux.org> (cherry picked from commit 49197b7492d61bf1fc6bef59a708f4f586f32edb)
* | Remove the Add option from the command lineDan McGee2008-03-08
| | | | | | | | | | | | There is still a lot of code that could be cleaned up internally. Signed-off-by: Dan McGee <dan@archlinux.org>
* | New alpm_version functionNagy Gabor2008-03-01
| | | | | | | | | | | | | | | | | | Now pacman frontend uses this function instead of the compile-time libalpm version number. Signed-off-by: Nagy Gabor <ngaba@bibl.u-szeged.hu> [Dan: fix one more spot where LIB_VERSION was used] Signed-off-by: Dan McGee <dan@archlinux.org>
* | Merge branch 'maint'Dan McGee2008-02-15
|\| | | | | | | | | | | | | Conflicts: lib/libalpm/be_files.c lib/libalpm/package.c
| * setlibpaths(): remove a stray set_option lineDan McGee2008-02-11
| | | | | | | | | | | | | | | | | | For some reason, we set our dbpath to the logfile path, which was completely broken, and we didn't even check the return value coming back (which of course was -1 meaning the set failed). Add some comments so people can understand what is going on here now too. Signed-off-by: Dan McGee <dan@archlinux.org>
* | New remove option : -u / --unneeded (FS#6505).Nagy Gabor2008-02-06
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | With --unneeded option 'pacman -R' doesn't stop in case of dependency error; it removes the needed-dependency targets from the target-list instead. See also: http://archlinux.org/pipermail/pacman-dev/2007-October/009653.html . The patch also adds a new causingpkg field to pmdepmissing_t which indicates the to-be-removed package which would cause a dependency break. This is needed, because miss->depend.name may be a provision. miss->causingpkg will be useful in -R dependency error messages too. [Xavier: renamed inducer to causingpkg, removed the _alpm_pkgname_pkg_cmp helper function as requested by Aaron. This might be added by a further commit. Other small cleanups, updated manpage and bash completion.] Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
* | New --asexplicit optionNagy Gabor2008-01-21
|/ | | | | | | | | | | This is the symmetric of --asdeps, install packages explicitly. Documentation and completion files were updated accordingly. Added sync301.py and upgrade032.py pactest files to test this. I also made a little modification in ALLDEPS handling too. Signed-off-by: Nagy Gabor <ngaba@bibl.u-szeged.hu> Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
* Disallow a NULL section in _parseconfigDan McGee2008-01-13
| | | | | | | | | | | | | If we allow _parseconfig to continue processing when section is not defined, then we have the potential to segfault during strcmp calls. This is no good. For some reason, we had existing logic that tested this case but only if it was processing and 'Include' directive. Expand the check to check for a NULL section in all cases, and print an error message if this is the case. Reported here: http://bbs.archlinux.org/viewtopic.php?id=42235 Signed-off-by: Dan McGee <dan@archlinux.org>
* Make the user-agent string a bit less verboseDan McGee2008-01-11
| | | | | | | | | We shouldn't pass things like the kernel version in the user agent string, as it may be a bit too revealing and is not really necessary. Reference: https://bugzilla.mozilla.org/show_bug.cgi?id=57555 Signed-off-by: Dan McGee <dan@archlinux.org>
* Output a single newline on receipt of a SIGINTDan McGee2008-01-10
| | | | | | | | | | | Fixes FS#9147, where issuing a ctrl-C at a prompt puts the users prompt on the same line as our question. This can also occur during download bars. Although we might end up putting one too many newlines to the screen now, it is better than not putting one at all. Also update the copyright in pacman.c. Signed-off-by: Dan McGee <dan@archlinux.org>
* Rename -t --orphans to -t --unrequired (FS#9144).Chantry Xavier2008-01-10
| | | | | | | | | | It turns out the orphan name was misleading. Real orphans are packages installed as dependency no longer required by any others (-Qtd). The -t option only shows package not required by any others, so --unrequired describes it better. Signed-off-by: Chantry Xavier <shiningxc@gmail.com> Signed-off-by: Dan McGee <dan@archlinux.org>
* Remove upgradedelay and all code associated with itDan McGee2008-01-08
| | | | | | | | It wasn't even implemented correctly, and it really doesn't have a use if packagers just do their job correctly anyway for a distro. Let's not try to solve a problem with the wrong solution now. Signed-off-by: Dan McGee <dan@archlinux.org>
* Allow unreadable Include files to be non-fatalAaron Griffin2007-12-17
| | | | | | Signed-off-by: Aaron Griffin <aaronmgriffin@gmail.com> [Dan: remove unused variable, make parseconfig static] Signed-off-by: Dan McGee <dan@archlinux.org>
* Update GNU GPL boilerplate and copyright datesDan McGee2007-12-10
| | | | | | | 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>
* Update some errors in messages found during localizationDan McGee2007-12-04
| | | | | | | Also perform the updates in the message files so we don't break translations. Signed-off-by: Dan McGee <dan@archlinux.org>
* Oops- forgot to ever set init to 1 in setlibpaths()Dan McGee2007-12-03
| | | | Signed-off-by: Dan McGee <dan@archlinux.org>
* parseconfig: refactor duplicate code out into a functionDan McGee2007-12-02
| | | | Signed-off-by: Dan McGee <dan@archlinux.org>
* Fixes for the ineptitude of libalpm DB registrationDan McGee2007-12-02
| | | | | | | | | When a DB is "registered" in libalpm, it goes and tries to create paths and other BS which is stupid, but a pain in the butt to fix. For now, work around this terrible behavior by ensuring our paths are always set before we call any alpm_db_register function. Signed-off-by: Dan McGee <dan@archlinux.org>
* Make pacman path handling (hopefully) a bit more intuitiveDan McGee2007-12-02
| | | | | | | | | | | | | | | | | | | | 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>
* Add new --needed option for -S.Chantry Xavier2007-12-02
| | | | | | | | | | | | | | | | | During a pacman operation such as a group install, pacman can ask several questions such as "local version is up to date. Upgrade anyway?". They are usually all answered either by yes or by no: * yes when you want to reinstall all the targets. * no when you only want to install the missing ones (either because you are installing a group, or because you are copying a pacman -S line from wiki or whatever). So instead of asking this question for each target, it is now now configured with a flag. Yes will be the default -S behavior, No will be achieved with the --needed flag. Signed-off-by: Chantry Xavier <shiningxc@gmail.com> Signed-off-by: Dan McGee <dan@archlinux.org>
* Move mbasename from pacman.c to util.cChantry Xavier2007-11-25
| | | | | | | This function can be useful in other places. Signed-off-by: Chantry Xavier <shiningxc@gmail.com> Signed-off-by: Dan McGee <dan@archlinux.org>
* Add -q/--quiet option for controlling output.Artyom2007-11-25
| | | | | | | | | | | | Currently this only affects -Ss, -Sl, and -Q to output less information (only package names). In the future, we can reuse this flag for other things as well. [Aaron: rewritten as a front-end flag] Signed-off-by: Aaron Griffin <aaronmgriffin@gmail.com> [Dan: squashed commits together] Signed-off-by: Dan McGee <dan@archlinux.org>
* Remove -F/--freshen operationDan McGee2007-11-21
| | | | | | | | | | This operation made sense in the days before sync DBs existed, but it no longer has the same usefulness it once did. Signed-off-by: Dan McGee <dan@archlinux.org> Signed-off-by: Chantry Xavier <shiningxc@gmail.com> Signed-off-by: Nagy Gabor <ngaba@bibl.u-szeged.hu> Signed-off-by: Aaron Griffin <aaronmgriffin@gmail.com>
* Make it easier to ignore multiple packages.Nathan Jones2007-11-13
| | | | | | | | | | | | This makes --ignore and --ignoregroup able to accept multiple packages/groups by separating each with a comma. For instance: pacman -Su --ignore kernel26,udev,glibc This was requested in the comments of FS#8054. Signed-off-by: Nathan Jones <nathanj@insightbb.com> Signed-off-by: Dan McGee <dan@archlinux.org>
* Add help for --ignoregroup.Nathan Jones2007-11-13
| | | | | | Signed-off-by: Nathan Jones <nathanj@insightbb.com> [Dan: split usage line into two lines for clarity] Signed-off-by: Dan McGee <dan@archlinux.org>
* pacman: remove leftover help string for -RhDan McGee2007-11-11
| | | | Signed-off-by: Dan McGee <dan@archlinux.org>
* Add TotalDownload option.Nathan Jones2007-11-11
| | | | | | | This will be used in the next commit. Signed-off-by: Nathan Jones <nathanj@insightbb.com> Signed-off-by: Dan McGee <dan@archlinux.org>
* Add IgnoreGroup and --ignoregroup option.Nathan Jones2007-11-11
| | | | | | | This will be used in the next commit. Signed-off-by: Nathan Jones <nathanj@insightbb.com> Signed-off-by: Dan McGee <dan@archlinux.org>
* Add LOGFILE as a define at compile time for pacmanDan McGee2007-11-05
| | | | | | | | | It has always been a bit odd that logfile had to be specified in the config file, but no other paths did. Add LOGFILE as a preprocessor definition, and make a call to alpm_option_set_logfile() to set the default location so no logfile parameter is necessary in pacman.conf. Signed-off-by: Dan McGee <dan@archlinux.org>
* Clean up usage of extern variablesDan McGee2007-11-04
| | | | | | | | Instead of declaring the extern variable in every *.c file, include it in the header file that makes sense. This means handle.h for the handle, and conf.h for the pacman side config object. Signed-off-by: Dan McGee <dan@archlinux.org>
* Fix basename usage in pacman and utilitiesDan McGee2007-11-04
| | | | | | | | | basename() is a rather untrusty function call on a lot of platforms as it does some weird and different things. To solve this, I added a mbasename fuction to pacman to take its place, and simply removed its usage in the utilities (it isn't worth dealing with there). Signed-off-by: Dan McGee <dan@archlinux.org>
* Fix mcheck detection and usageDan McGee2007-10-26
| | | | Signed-off-by: Dan McGee <dan@archlinux.org>
* Ensure all localization stuff is correctly guardedDan McGee2007-10-22
| | | | | | | Anything dealing with libintl and localization should be correctly guarded inside an ENABLE_NLS block on both the pacman and libalpm sides. Signed-off-by: Dan McGee <dan@archlinux.org>
* Download delta files if UseDelta is set.Nathan Jones2007-10-19
| | | | | | | | Delta files will be used if the size is smaller than a percent (MAX_DELTA_RATIO) of the package size. Signed-off-by: Nathan Jones <nathanj@insightbb.com> Signed-off-by: Dan McGee <dan@archlinux.org>
* pacman/pacman.c : put back root check even if -r is specified.Chantry Xavier2007-10-14
| | | | | | | Root is needed for most install / remove operation, because it's needed for chrooting, for running scriptlets. Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
* pacman/pacman.c : add --logfile option.Chantry Xavier2007-10-08
| | | | Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
* Remove the non-user friendly --ask optionDan McGee2007-10-08
| | | | Signed-off-by: Dan McGee <dan@archlinux.org>
* needs_transaction adjustmentsChantry Xavier2007-10-03
| | | | | | | | | | | | | | | I just moved the root path check out of needs_transaction, and put it directly in pacman.c . I think this part is alright. For the other problems, I thought about doing the transaction first, in a new sync trans function, which will init and release a transaction. And then doing the commands like -Ss / -Sl / -Sg / -Si. The problem is that for commands like -Sys / -Syl / etc, only the refresh part of the transaction should be done. So I had to introduce an ugly sync_only hack. Signed-off-by: Aaron Griffin <aaronmgriffin@gmail.com>
* Break out transaction test to a separate functionAaron Griffin2007-09-28
| | | | | | Added needs_transaction, putting out "hey do we need root?" tests in one place. Signed-off-by: Aaron Griffin <aaronmgriffin@gmail.com>