summaryrefslogtreecommitdiffstats
path: root/src
AgeCommit message (Collapse)AuthorFilesLines
2009-10-04callback.c : fallback to normal download with bogus sizeXavier Chantry1-4/+14
When using totaldownload, we might get into some weird situations where xfered>total because of bogus CSIZE database entries. This code adds a sanity check and fallbacks to normal download progress if needed. Here is an example using totaldownload on a database with wrong CSIZE, for a total download of ~26 MB. Before : gnome-desktop-2.28.... 1144,3K 678,3K/s 00:00:02 [#################] 4% gnome-panel-2.28.0-... 4,2M 887,7K/s 00:00:05 [#################] 16% gnome-applets-2.28.... 13,6M 1083,0K/s 00:00:13 [#################] 52% gnome-backgrounds-2... 22,9M 964,0K/s 00:00:24 [#################] 87% gnome-settings-daem... 23,6M 938,5K/s 00:00:26 [#################] 90% gnome-control-cente... 26,1M 946,1K/s 00:00:28 [#################] 100% gnome-icon-theme-2.... 27,7M 1465,0K/s 1193046:28:15 [#######----------] gnome-icon-theme-2.... 28,0M 1502,2K/s 1193046:28:15 [########---------] gnome-icon-theme-2.... 28,4M 1582,2K/s 1193046:28:15 [##########-------] gnome-icon-theme-2.... 28,7M 1603,4K/s 1193046:28:15 [############-----] gnome-icon-theme-2.... 29,0M 1604,5K/s 1193046:28:15 [##############---] gnome-icon-theme-2.... 29,3M 1621,0K/s 1193046:28:14 [################-] gnome-icon-theme-2.... 29,6M 1434,8K/s 1193046:28:14 [#################] gnome-icon-theme-2.... 29,6M 974,2K/s 00:00:31 [#################] 113% After : gnome-desktop-2.28.... 1144,3K 1038,7K/s 00:00:01 [#################] 4% gnome-panel-2.28.0-... 4,2M 988,4K/s 00:00:04 [#################] 16% gnome-applets-2.28.... 13,6M 1190,4K/s 00:00:12 [#################] 52% gnome-backgrounds-2... 22,9M 1242,9K/s 00:00:19 [#################] 87% gnome-settings-daem... 23,6M 1193,9K/s 00:00:20 [#################] 90% gnome-control-cente... 2,5M 1347,4K/s 00:00:02 [#################] 100% gnome-icon-theme-2.... 3,5M 1205,4K/s 00:00:03 [#################] 100% Note that gnome-control-center resetted to normal progress mode (2,5M is the package size, not the total size) Signed-off-by: Xavier Chantry <shiningxc@gmail.com> Signed-off-by: Dan McGee <dan@archlinux.org>
2009-09-20Strndup usage and small typo fixLaszlo Papp2-2/+2
./src/pacman/package.c: - small typo fix ./src/pacman/pacman.c: - strdup is changed to strndup, because it's safer like in case of config option Signed-off-by: Laszlo Papp <djszapi2@gmail.com> Signed-off-by: Dan McGee <dan@archlinux.org>
2009-09-19Kill -F option for good in option parsingDan McGee1-1/+1
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-09-17String improvementsXavier Chantry3-6/+6
Add more untranslated strings, improve consistency, etc. Signed-off-by: Xavier Chantry <shiningxc@gmail.com> Signed-off-by: Dan McGee <dan@archlinux.org>
2009-09-15Revert "Fix a memleak involving lazy DB loading"Dan McGee1-1/+4
This doesn't quite work, as can be seen by the pactest results: Total = 179 Pass = 108 ( 60.34%) Expected Fail = 5 ( 2.79%) Unexpected Pass = 0 ( 0.00%) Fail = 66 ( 36.87%) If you peek inside '_alpm_db_new' when it gets called for the sync databases, the base dbpath is still at the default value, causing things like pactest to fail miserably. We need some further work to do fully lazy loading, and that belongs on master, not maint. This reverts commit a2cd48960e33043f75c81e0ecbc2d33b20b695fe. Signed-off-by: Dan McGee <dan@archlinux.org>
2009-09-09Fix a memleak involving lazy DB loadingXavier Chantry1-4/+1
Lazy opening of databases is supported since 34e1413d75. We don't need that setlibpath call each time we register a database. Besides this caused a memleak in case setlibpath failed, because setlibpath exit directly and we did not do the cleanup part (section string was not freed, and a file descriptor remained open). Signed-off-by: Xavier Chantry <shiningxc@gmail.com> Signed-off-by: Dan McGee <dan@archlinux.org>
2009-08-19testdb : less verboseXavier Chantry1-4/+2
http://bbs.archlinux.org/viewtopic.php?id=77396 Signed-off-by: Xavier Chantry <shiningxc@gmail.com> Signed-off-by: Dan McGee <dan@archlinux.org>
2009-08-19query.c : return 1 when no package matchXavier Chantry1-0/+10
For example, if no package is outdated, -Qu will return 1. This implements FS#15938 Signed-off-by: Xavier Chantry <shiningxc@gmail.com> Signed-off-by: Dan McGee <dan@archlinux.org>
2009-08-19Quiet ShowSize with -Ss and -QsXavier Chantry2-2/+2
This fixes FS#15923 PS : duplicated code ftw Signed-off-by: Xavier Chantry <shiningxc@gmail.com> Signed-off-by: Dan McGee <dan@archlinux.org>
2009-08-08Fix for FS#15810Nagy Gabor1-9/+17
Skip the SyncFirst dialog, if all the -S packages are SyncFirst packages. Signed-off-by: Nagy Gabor <ngaba@bibl.u-szeged.hu> Signed-off-by: Xavier Chantry <shiningxc@gmail.com> Signed-off-by: Dan McGee <dan@archlinux.org>
2009-07-28Fix an untranslated message in src/callback.cNagy Gabor1-2/+2
Signed-off-by: Nagy Gabor <ngaba@bibl.u-szeged.hu> Signed-off-by: Dan McGee <dan@archlinux.org>
2009-07-27Ensure version screen fits in 80 colsDan McGee1-2/+2
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-07-26Use lstat instead of stat for -QoXavier Chantry1-1/+1
This fixes: FS#15675 - pacman can not determine ownership of dangling symlinks Using lstat seems more correct than stat for the -Qo operation anyway. 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 Nowicki3-1/+116
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-23Introduce -SuuNagy Gabor2-3/+3
If the user switches from unstable repo to a stable one, it is quite hard to sync its system with the new repo (the user will see many "Local is newer than stable" messages, nothing more). That's why I introduced -Suu, which treats a sync package like an upgrade, iff the package version doesn't match with the local one's. I added a new pactest (sync104.py) to test this, and I updated the documentation of -Su. Signed-off-by: Nagy Gabor <ngaba@bibl.u-szeged.hu> [Dan: slight doc reword] Signed-off-by: Dan McGee <dan@archlinux.org>
2009-07-23New feature: files verificationDan McGee3-12/+81
This implements FS#13877. Add a new option "-Qk" which checks if all of the files for a given package (or packages) are really on the system (i.e. not accidentally deleted). This can be combined with filters and other display options. It also respects both the --quiet and --verbose flags to give varying levels of output. Based on the original patch by Charly Coste <changaco@laposte.net>, thanks for your work! Signed-off-by: Dan McGee <dan@archlinux.org>
2009-07-16Offer to clean up non-package files in cache directory.Xavier Chantry1-6/+8
This implements FS#15142. Signed-off-by: Xavier Chantry <shiningxc@gmail.com> Signed-off-by: Dan McGee <dan@archlinux.org>
2009-07-01Update copyright headers and messagesDan McGee16-16/+32
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-06-09Give sensible feedback when a repo has no configured serversDan McGee1-1/+9
This fixes FS#14899. When running an -Sp operation without servers configured for a repository, we would segfault, so add an assert to the backend method returning the first server preventing a null pointer dereference. In addition, add a new error code to libalpm that indicates we have no servers configured for a repository. This makes -Sy and -S <package> operations fail gracefully and helpfully when a repo is set up with no servers, as the default mirrorlist in Arch is provided this way. Signed-off-by: Dan McGee <dan@archlinux.org>
2009-06-02We don't need root with -SpNagy Gabor3-13/+11
FS#8905 is fixed. The front-end passes PM_TRANS_FLAG_NOLOCK to the back-end, so it doesn't lock the database. That's why we don't need root anymore. I reworked (and renamed) needs_transaction() accordingly. I also added missing -Sc check there (for example, -Sci didn't print non-root error, but pacman wanted to lock the database). Signed-off-by: Nagy Gabor <ngaba@bibl.u-szeged.hu> Signed-off-by: Dan McGee <dan@archlinux.org>
2009-06-02Change package to package(s) and file to file(s) in documentationNagy Gabor1-2/+2
The pacman --help pages and the manual suggested that only one package can be upgraded/removed per transaction. Signed-off-by: Nagy Gabor <ngaba@bibl.u-szeged.hu> Signed-off-by: Dan McGee <dan@archlinux.org>
2009-06-02Remove unused string.h from src/pacman/remove.cGerardo Exequiel Pozzi1-1/+0
This header was used in the code for the function strdup() that is not used anymore. Signed-off-by: Gerardo Exequiel Pozzi <vmlinuz386@yahoo.com.ar> Signed-off-by: Dan McGee <dan@archlinux.org>
2009-05-19Remove unused included headers from testdb.c and testpkg.cGerardo Exequiel Pozzi2-2/+0
libgen.h was used for basename() in function main() from src/util/testdb.c string.h was used for strlen() in function output_cb() from src/util/testpkg.c Signed-off-by: Gerardo Exequiel Pozzi <vmlinuz386@yahoo.com.ar> Signed-off-by: Dan McGee <dan@archlinux.org>
2009-05-19Query documentation updatesNagy Gabor1-5/+5
The old documentation didn't emphasize our filtering options at all, and it was a bit misleading. ("List ALL...") I also clarified the description of -Qu. Signed-off-by: Nagy Gabor <ngaba@bibl.u-szeged.hu> Signed-off-by: Dan McGee <dan@archlinux.org>
2009-05-12Remove version information from -Qqo outputDan McGee1-2/+1
This was the only --quiet operation that showed version information; make it consistent with the rest. Signed-off-by: Dan McGee <dan@archlinux.org>
2009-05-12Introduce -QlqNagy Gabor3-4/+8
With --quiet flag, -Ql doesn't print the package name, just lists the files. I made --quiet documentation up-to-date (I also added -Sgq/-Qgq). Signed-off-by: Nagy Gabor <ngaba@bibl.u-szeged.hu> Signed-off-by: Dan McGee <dan@archlinux.org>
2009-04-11Remove pmsyncpkg_tNagy Gabor2-5/+4
pmsyncpkg_t data sructure was removed: 1. pmpkg_t.reason is used instead of pmsyncpkg_t.newreason. (The target packages come from sync repos, so we can use this field without any problems. Upgrade transaction also uses this field to store this info.) 2. pmsyncpkg_t.removes was moved to pmpkg_t.removes. This step requires careful programming, because we don't duplicate packages when we add them to trans->packages. So we modify sync pkgcache when we add this transaction-only info to our package. Hence it is important to free this list when we remove any package from the target list (remove_unresolvable, remove_conflicts, trans_free), otherwise this could confuse the new sync transactions (with non-pacman GUI). Overall, our code became ~100 line shorter, and we can call our helper functions directly on trans->packages in sync.c, we don't need to maintain parallel package lists. Signed-off-by: Nagy Gabor <ngaba@bibl.u-szeged.hu> Signed-off-by: Dan McGee <dan@archlinux.org>
2009-04-11New error type: PM_ERR_PKG_IGNOREDNagy Gabor1-3/+4
This patch fixes FS#12059. Now sync_addtarget can return with PM_ERR_PKG_IGNORED, which indicates that although the requested package was found it is in ignorepkg, so alpm could not add it to the transaction. So the front-end can decide what to do. Signed-off-by: Nagy Gabor <ngaba@bibl.u-szeged.hu> Signed-off-by: Dan McGee <dan@archlinux.org>
2009-04-06Document --debugNagy Gabor1-0/+1
After some irc/forum experiences, I decided to document this option. However, I left the debug-level undocumented (--debug=2). Signed-off-by: Nagy Gabor <ngaba@bibl.u-szeged.hu> Signed-off-by: Dan McGee <dan@archlinux.org>
2009-02-24Don't prompt the user for unignore of IgnorePkg/IgnoreGroup packagesBryan Ischo1-9/+2
Don't prompt the user for unignore of IgnorePkg/IgnoreGroup packages, except for packages explicitly listed for sync by the user. This eliminates many unnecessary prompts when IgnorePkg/IgnoreGroup is used. Signed-off-by: Bryan Ischo <bryan@ischo.com> Signed-off-by: Dan McGee <dan@archlinux.org>
2009-02-24Enabled new interactive prompt and updated some testsBryan Ischo1-0/+16
Enabled a new prompt to ask the user if they'd like to remove unresolvable packages from the transaction rather than failing it. Many pactest tests that used to fail now return success codes, because pacman now issues a prompt allowing the user to cancel rather than failing many transactions, and the pactest scripts always choose to cancel with no error rather than failing. The only net effect is that the return status of pacman is now 0 in cases where it used to be nonzero. Signed-off-by: Bryan Ischo <bryan@ischo.com> Signed-off-by: Dan McGee <dan@archlinux.org>
2009-01-13Rename alpm_get_md5sum to alpm_compute_md5sum and alpm_dep_get_string to ↵Nagy Gabor5-6/+6
alpm_dep_compute_string This patch introduces the following function name convention: _compute_ in function name: the return value must be freed. _get_ in function name: the return value must not be freed. Signed-off-by: Nagy Gabor <ngaba@bibl.u-szeged.hu> Signed-off-by: Dan McGee <dan@archlinux.org>
2009-01-13HoldPkg reworkNagy Gabor5-5/+23
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-12-03Merge branch 'maint'Dan McGee3-13/+37
Conflicts: lib/libalpm/dload.c
2008-12-02Add flush after downloading messageSimo Leone1-0/+1
When the output is going to a file, glibc seems to buffer way too much making it hard to monitor progress while tailing a file. Signed-off-by: Simo Leone <simo@archlinux.org> Signed-off-by: Dan McGee <dan@archlinux.org>
2008-11-30Give an error message on alpm_db_register_sync() errorNagy Gabor1-12/+34
This patch slightly modifies pacman.c/_parseconfig(): See FS#12148. Now pacman prints the following error message in that case: "error: could not register 'unstable' database (could not open database)" I also added an error message for alpm_db_setserver() error. I changed the "return(1);" scheme to "ret = 1; goto cleanup;" to make sure that we free allocated memory and close open files. Signed-off-by: Nagy Gabor <ngaba@bibl.u-szeged.hu> Signed-off-by: Dan McGee <dan@archlinux.org>
2008-11-18Minor code cleanupsDan McGee1-1/+2
Mostly noticed when compiling libalpm/pacman with ICC. Signed-off-by: Dan McGee <dan@archlinux.org>
2008-11-01-Qu reworkNagy Gabor2-25/+5
From now on -Qu is an "outdated package" filter on local database. (This is a behaviour change.) This patch fixes some memleaks and makes the code cleaner, for details see my comment on FS#7884. FS#11868 is implemented. Signed-off-by: Nagy Gabor <ngaba@bibl.u-szeged.hu> Signed-off-by: Dan McGee <dan@archlinux.org>
2008-10-29testdb : extend the tool to allow checking sync dbs too.Xavier Chantry1-48/+126
Example usage and output : > src/util/testdb -h usage: testdb [-b <pacman db>] : check the local database testdb [-b <pacman db>] core extra ... : check the listed sync databases > src/util/testdb Checking the integrity of the local database in /var/lib/pacman/ > src/util/testdb core extra testing community Checking the integrity of the sync databases in /var/lib/pacman/ missing dependency for archboot : bcm43xx-fwcutter>=006-2 missing dependency for xvattr : xfree86 missing dependency for eclipse-ve : eclipse<3.3 missing dependency for flumotion : twisted-web missing dependency for gg2 : arts missing dependency for man-pages-cs : groff-utf8 missing dependency for qc-usb : kernel26<2.6.26 Signed-off-by: Xavier Chantry <shiningxc@gmail.com> Signed-off-by: Dan McGee <dan@archlinux.org>
2008-10-13Merge branch 'maint'Dan McGee5-27/+54
2008-10-13Make interrupt handler async-safeDan McGee1-8/+22
Calling printf() in a signal handler can be dangerous, so avoid it by writing directly which is guaranteed to be safe according to signal(7). Signed-off-by: Dan McGee <dan@archlinux.org>
2008-10-13Reduce number of calls to getcols()Dan McGee2-8/+9
Every call to getcols() results in two ioctl() calls, which we really didn't need as changing the number of columns in mid-print would be pretty crazy. Signed-off-by: Dan McGee <dan@archlinux.org>
2008-10-13Ensure we don't have double slashes when creating frontend pathsDan McGee1-2/+4
Because libalpm always returns a root path with a trailing slash, when we use it to create our unspecified paths we get double slashes in the result. Use the fix suggested by Jürgen Hötzel to remedy this. 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-09-02Another attempt at fixing totaldownload.Xavier Chantry1-8/+16
This fixes FS#11339, which is a regression of commit 89c2c5196: When totaldownload is enabled, the database downloading percent (-Sy) is always at 0. That is because we have no guarantee that the totaldownload callback was called by libalpm. In particular, it is not called (and it would not make sense to) when a single file is downloaded, like it is the case with databases. So the correct way to detect if totaldownload should be used is checking both config->totaldownload and list_total, like it was already done in several places in the cb_dl_progress function. Signed-off-by: Xavier Chantry <shiningxc@gmail.com> Signed-off-by: Dan McGee <dan@archlinux.org>
2008-08-28Separate targets on -Qi/-Si with a newline.Xavier Chantry1-1/+3
This fixes FS#11331 The newline was lost with commit 9451b2e4f23a3c566fcfe3420c379b3cb3eb1f90. Signed-off-by: Xavier Chantry <shiningxc@gmail.com>
2008-08-27Merge branch 'maint'Dan McGee1-1/+1
2008-08-26Rename alpm_db_get{pkg,grp}cache to alpm_db_get_{pkg,grp}cacheXavier Chantry3-11/+11
This is more consistent with the private functions : _alpm_db_get_{pkg,grp}cache Signed-off-by: Xavier Chantry <shiningxc@gmail.com> Signed-off-by: Dan McGee <dan@archlinux.org>
2008-08-26Change checkdeps and checkdbconflicts to be more flexible.Xavier Chantry1-2/+3
These two functions now take directly a package list rather than a database. checkdbconflicts was renamed to checkconflicts. Signed-off-by: Xavier Chantry <shiningxc@gmail.com>
2008-08-26pacman : smarter optdepends handling.Xavier Chantry3-1/+21
During an upgrade, only the new optdepends will be displayed, to only keep the useful information and not clutter pacman output too much. The whole optdepends list is always available with -Si / -Qi. Signed-off-by: Xavier Chantry <shiningxc@gmail.com> Signed-off-by: Dan McGee <dan@archlinux.org>