summaryrefslogtreecommitdiff
path: root/src
AgeCommit message (Collapse)Author
2007-12-09Improve changelog handling through addition of open/read/close functionsDan McGee
Thanks to Allan for inspiring all this work on what was one little TODO item in the codebase. :) Change changelog handling so we can now dump a changelog from both installed packages and package files (fixes FS#7371). We do this by moving all of the machinery to the backend where it should have been in the first place. The changelog reading is now done through a open/read/close interface similar to the fopen/fread/fclose functions (can you guess how it is done?). It is buffered by the frontend, so programs using the library can read as much or as little as they want at a time. Unfortunately, I could not implement a changelog_feof function due to some shortcomings of libarchive. However, I left the stub code in there, commented out, in case it becomes possible later or anyone wants to take a stab at it. Original-work-by: Allan McRae <mcrae_allan@hotmail.com> Improved-by: Chantry Xavier <shiningxc@gmail.com> Signed-off-by: Dan McGee <dan@archlinux.org>
2007-12-08src/pacman/: use the FREELIST macro when possible.Chantry Xavier
Signed-off-by: Chantry Xavier <shiningxc@gmail.com> Signed-off-by: Dan McGee <dan@archlinux.org>
2007-12-08testdb.c : add vim modeline according to HACKING, and reindent the file.Chantry Xavier
Signed-off-by: Chantry Xavier <shiningxc@gmail.com> Signed-off-by: Dan McGee <dan@archlinux.org>
2007-12-05pacman/sync.c : improve the sync db cleanup feature.Chantry Xavier
This feature (introduced by b118ce55bd01c7ebd42b5b6d4a0f34aa925701d8 as a part of -Sc) could actually be helpful in the 3.0 -> 3.1 transition, because all sync dbs will be left in /var/lib/pacman/, while the updated ones will go to /var/lib/pacman/sync/. So it'll now clean everything in /var/lib/pacman/, and only the unused databases in /var/lib/pacman/sync/ (with the exception of local/ and sync/ in both cases). Note: This feature is undocumented. I wonder if moving it to another option, something like -S --dbclean, wouldn't help for documenting it. Signed-off-by: Chantry Xavier <shiningxc@gmail.com> Signed-off-by: Dan McGee <dan@archlinux.org>
2007-12-04Update some errors in messages found during localizationDan McGee
Also perform the updates in the message files so we don't break translations. Signed-off-by: Dan McGee <dan@archlinux.org>
2007-12-03pacman/sync.c: mark sync_trans as staticDan McGee
Signed-off-by: Dan McGee <dan@archlinux.org>
2007-12-03Oops- forgot to ever set init to 1 in setlibpaths()Dan McGee
Signed-off-by: Dan McGee <dan@archlinux.org>
2007-12-03Delay output during progress barChantry Xavier
This fixes the output issue related to the progress bar by delaying the output. We can decide later (post-release) if we like this method or we want to switch to something else. Signed-off-by: Chantry Xavier <shiningxc@gmail.com> [Dan: just some minor cleanups] Signed-off-by: Dan McGee <dan@archlinux.org>
2007-12-02parseconfig: refactor duplicate code out into a functionDan McGee
Signed-off-by: Dan McGee <dan@archlinux.org>
2007-12-02Remove "done" messages from frontend callback functionDan McGee
This should simplify our output a bit when it comes to determining whether or not we need a newline in our output. A "done" message was almost always immediately followed by another start message anyway (or some other output), so it really isn't necessary. Signed-off-by: Dan McGee <dan@archlinux.org>
2007-12-02Fixes for the ineptitude of libalpm DB registrationDan McGee
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>
2007-12-02Make pacman path handling (hopefully) a bit more intuitiveDan McGee
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>
2007-12-02Add new --needed option for -S.Chantry Xavier
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>
2007-12-01Unify dump_pkg_full in pacman [-Si, -Qip, -Qi and -Qii]Nagy Gabor
dump_pkg_sync is now a trivial wrapper for dump_pkg_full Some smaller changes: * string_display function added to util.c [prints None in case of empty string] * Filename field added to -Qip * rename License to Licenses * 'Compressed Size' used instead of 'Download Size' for -Qip Signed-off-by: Nagy Gabor <ngaba@bibl.u-szeged.hu> [Dan: fix whitespace errors, spacing issues, const modifiers] Signed-off-by: Dan McGee <dan@archlinux.org>
2007-11-29Move requiredby computation before any display startsDan McGee
This should reduce the chances of people thinking pacman hung during the middle of something. Signed-off-by: Dan McGee <dan@archlinux.org>
2007-11-25pacman/query.c : -Qo optimization.Chantry Xavier
I didn't understand why realpath was called on every files of every filelist in query_fileowner : ppath = resolve_path(path); It turns out this is needed for the diverted files. For example, cddb_get installs /usr/lib/perl5/site_perl/5.8.8/CDDB_get.pm which actually ends in /usr/lib/perl5/site_perl/current/CDDB_get.pm . And for making pacman -Qo /usr/lib/perl5/site_perl/current/CDDB_get.pm , realpath has to be called on both the target, and the file in the filelist. However, realpath is costly, and calling it on every single file resulted in a poor -Qo performance. Worst case : pacman -Qo /lib/libz.so.1 0.35s user 1.51s system 99% cpu 1.864 total So I did a little optimization to avoid calling realpath as much as possible: first compare the basename of each file. Result: src/pacman/pacman -Qo /lib/libz.so.1 0.24s user 0.05s system 99% cpu 0.298 total Obviously, the difference will be even bigger at the first run (no fs cache), though it's quite scary on my system : 1.7s vs 40s previously. Signed-off-by: Chantry Xavier <shiningxc@gmail.com> Signed-off-by: Dan McGee <dan@archlinux.org>
2007-11-25Move mbasename from pacman.c to util.cChantry Xavier
This function can be useful in other places. Signed-off-by: Chantry Xavier <shiningxc@gmail.com> Signed-off-by: Dan McGee <dan@archlinux.org>
2007-11-25Fix for sync1003 and sync1004 pactestsNagy Gabor
checkdeps and resolvedeps now take both a remove list and an install list as arguments, allowing dependencies to be calculated correctly. This broke the sync990 pactest, but this pactest used dependencies and provides in an unusual way, so it has been changed. Dan: the sync990 pactest was just plain wrong. It didn't satisfy the dependencies correctly, so should never have succeeded. Signed-off-by: Chantry Xavier <shiningxc@gmail.com> [Dan: some variable renaming, clarification in commit message] Signed-off-by: Dan McGee <dan@archlinux.org>
2007-11-25Add -q/--quiet option for controlling output.Artyom
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>
2007-11-25Fix memleak when querying package file(s)Dan McGee
Signed-off-by: Dan McGee <dan@archlinux.org>
2007-11-25Fix several memleaks, mostly related to errors handling.Chantry Xavier
* The frontend calls alpm_trans_prepare(&data), and in case of errors, receive the missing dependencies / conflicts / etc in the data pointer. It apparently needs to free this structure totally with : alpm_list_free_inner(data, free) alpm_list_free(data) So I added alpm_list_free_inner(data, free) in pacman/{sync.c,remove.c,add,c} * in _alpm_sync_prepare, the deps and asked lists were not freed in case of errors (unresolvable conflicts). Besides the code for handling this case was duplicated. * in _alpm_remove_commit, free was used instead of alpm_list_free for newfiles. * newline fix in pacman/sync.c Signed-off-by: Chantry Xavier <shiningxc@gmail.com> Signed-off-by: Dan McGee <dan@archlinux.org>
2007-11-21Remove -F/--freshen operationDan McGee
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>
2007-11-21Remove duplicated get_upgrades function, use sysupgrade instead.Chantry Xavier
The alpm_get_upgrades was exactly the same as find_replacements + _alpm_sync_sysupgrade, except that it automatically made the eventual replacements, without asking the user : Replace %s with %s/%s? [Y/n] The replace question, asked in find_replacements. can now be skipped by using a NULL trans argument, so that we get the same behavior as with alpm_get_upgrades. So alpm_db_get_upgrades() can now be replaced by alpm_sync_sysupgrade(db_local, syncdbs). Signed-off-by: Chantry Xavier <shiningxc@gmail.com> Signed-off-by: Dan McGee <dan@archlinux.org>
2007-11-18Add the pmconflict_t type.Nagy Gabor
pmdepmissing_t was used for two totally different things : missing dependencies, and dependency conflicts. So this patch simply adds a type for dep conflicts, and convert the code to use it. This fix the TODO in conflict.c : /* TODO WTF is a 'depmissing' doing indicating a conflict? */ Additionally, the code in conflict.c now eliminates the duplicated conflicts. If pkg1 conflicts with pkg2, and pkg2 conflicts with pkg1, only one of them will be stored. However the conflict handling in sync_prepare (sync.c) is still very asymetrical, and very ugly too. This should be improved in the future (there is already a pending patch from Nagy that cleans it a lot). Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
2007-11-18Simple s/conflict/fileconflict/ renaming.Chantry Xavier
The names related to conflicts are misleading : For dependencies conflicts, the type is pmdepmissing, and the function names contain just "conflict". For file conflicts, the type is pmconflict, and some functions contained just "conflict", some others "fileconflict". So this is the first step for improving the situation. Original idea/patch from Nagy, but the patch already didn't apply anymore, so I did it again. The main difference is that I kept the conflictype, with the following renaming : pmconflicttype_t -> pmfileconflicttype_t PM_CONFLICT_TYPE_TARGET -> PM_FILECONFLICT_TARGET PM_CONFLICT_TYPE_FILE -> PM_FILECONFLICT_FILESYSTEM Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
2007-11-18Minor rephrasing of the question asked by -Sc.Chantry Xavier
Suggested by stonecrest on irc : 'I think "uninstalled" would be better, as it implies that the package was once installed and since removed. Otherwise a user might wonder why there are non-installed pkgs in cache' Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
2007-11-18Extend the -Sc operation to also clean up unused sync databases.Chantry Xavier
We discussed this with stonecrest on IRC : 20:46 stonecrest >> someone brings up a good point.. why aren't repos that aren't in the pacman.conf removed from /var/lib/pacman? 20:46 stonecrest >> i have 118mb and 24 dirs in there, but only 5 repos at present 21:26 stonecrest >> shining: i guess you could prompt the user on deleting every dir in /var/lib/pacman.. since it shouldn't happen that often except for the first time 21:30 stonecrest >> could be part of pacman -Sc.. what else were you thinking? I already heard about this before, but it sounded dangerous to me. I didn't even think about a simple prompt. I also didn't know where this code would fit. And it fits well with -Sc, I borrowed most of the code from sync_cleancache. Example session : Cache directory: /var/cache/pacman/pkg/ Do you want to remove non-installed packages from cache? [Y/n] n Database directory: /var/lib/pacman/ Do you want to remove unused repositories? [Y/n] Do you want to remove /var/lib/pacman/sync/pacman-git? [Y/n] Do you want to remove /var/lib/pacman/sync/deltatest? [Y/n] Database directory cleaned up Signed-off-by: Chantry Xavier <shiningxc@gmail.com> Signed-off-by: Dan McGee <dan@archlinux.org>
2007-11-18Don't filter package files output based on dir/file statusDan McGee
This caused more problems than it solved, especially with -Qlp output and files that are new to the new package. Signed-off-by: Dan McGee <dan@archlinux.org>
2007-11-17pacman/sync.c : remove duplicated fallback on providers.Chantry Xavier
The fallback on providers when a target is not found was already made in the backend : libalpm/sync.c , _alpm_sync_addtarget . So I removed it from the frontend. The sync500 pactest proves this fallback still works correctly. Signed-off-by: Chantry Xavier <shiningxc@gmail.com> Signed-off-by: Dan McGee <dan@archlinux.org>
2007-11-17Two memleak fixes in pacman.Nagy Gabor
Both memleak was an unfreed alpm_db_whatprovides list. Signed-off-by: Nagy Gabor <ngaba@bibl.u-szeged.hu>
2007-11-16War on whitespaceDan McGee
Run the kernel's cleanfile script on all of our source files. Signed-off-by: Dan McGee <dan@archlinux.org>
2007-11-14Ensure -Si and -Qi output show correct dependenciesDan McGee
Because alpm_pkg_get_depends() no longer returns strings as the data, we need to first convert the returned structures to printable strings before we can print the list. Signed-off-by: Dan McGee <dan@archlinux.org>
2007-11-14testdb: remove requiredby checkingDan McGee
Signed-off-by: Dan McGee <dan@archlinux.org>
2007-11-14Remove REQUIREDBY usage from libalpmDan McGee
Instead of using the often-busted REQUIREDBY entries in the pacman database, compute them each time they are required. This should help many things: 1. Simplify the codebase 2. Prevent future database corruption 3. Ensure when we do use requiredby, it is always correct 4. Shrink the pmpkg_t memory overhead Signed-off-by: Dan McGee <dan@archlinux.org>
2007-11-13Make it easier to ignore multiple packages.Nathan Jones
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>
2007-11-13Add help for --ignoregroup.Nathan Jones
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>
2007-11-13Fix display of -Qip output when a package file is givenDan McGee
Too many fields were being shown on -Qip output, and sizes were not always correct (-Qi and -Qip output on the same package did not agree). Signed-off-by: Dan McGee <dan@archlinux.org>
2007-11-11Remove 'Total Package Size'Dan McGee
Having 'Total Installed Size' and 'Total Download Size' makes this size unnecessary. Signed-off-by: Dan McGee <dan@archlinux.org>
2007-11-11Typo fix (sepArately)Aaron Griffin
Found by Giovanni Scafora <linuxmania@gmail.com> Signed-off-by: Aaron Griffin <aaronmgriffin@gmail.com>
2007-11-11Missing quote in outputAaron Griffin
Found by Giovanni Scafora <linuxmania@gmail.com> Signed-off-by: Aaron Griffin <aaronmgriffin@gmail.com>
2007-11-11Add a missing newline in sync confirmation outputDan McGee
Signed-off-by: Dan McGee <dan@archlinux.org>
2007-11-11pacman: remove leftover help string for -RhDan McGee
Signed-off-by: Dan McGee <dan@archlinux.org>
2007-11-11Implement TotalDownload option.Nathan Jones
Setting this option will change the download progress to show the amount downloaded, download rate, ETA, and download percent of the entire download list rather than per each individual file. The progress bar is still based on the completion of the current file regardless if the TotalDownload option is set. This closes FS#7205. Signed-off-by: Nathan Jones <nathanj@insightbb.com> Signed-off-by: Dan McGee <dan@archlinux.org>
2007-11-11Add TotalDownload option.Nathan Jones
This will be used in the next commit. Signed-off-by: Nathan Jones <nathanj@insightbb.com> Signed-off-by: Dan McGee <dan@archlinux.org>
2007-11-11Implement IgnoreGroup.Nathan Jones
This option acts as if IgnorePkg was set on each package in the group. This closes FS#1592. Signed-off-by: Nathan Jones <nathanj@insightbb.com> Signed-off-by: Dan McGee <dan@archlinux.org>
2007-11-11Add IgnoreGroup and --ignoregroup option.Nathan Jones
This will be used in the next commit. Signed-off-by: Nathan Jones <nathanj@insightbb.com> Signed-off-by: Dan McGee <dan@archlinux.org>
2007-11-08Simplify callback DONE event handlingDan McGee
Move them all to a single fallthrough case statement since they all print "done". Signed-off-by: Dan McGee <dan@archlinux.org>
2007-11-08Add missing 'done' printoutDan McGee
Signed-off-by: Dan McGee <dan@archlinux.org>
2007-11-08Fix some issues with localized dates/epoch usageDan McGee
Commit 47622eef4dd8fd86a0aa0e3ebdb7b33f7c9d6804 introduced localized times in the metadata by way of storing the UNIX epoch value instead of a hard coded date string. However, it missed a few things: * If we weren't in the C/POSIX/en_US locale, the date parsing would fail as it tried to use the abbreviations of the locale being used. Fix this by switching the LC_TIME value before we parse a date. * We used ctime to print the date value, which is always the C locale string. Instead, use strftime to print a localized date string. Signed-off-by: Dan McGee <dan@archlinux.org>
2007-11-05Add LOGFILE as a define at compile time for pacmanDan McGee
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>