summaryrefslogtreecommitdiff
path: root/src
Commit message (Collapse)AuthorAge
* Fix opendir error condition checksDan McGee2009-10-27
| | | | | | | | | | Thanks to Laszlo Papp <djszapi@archlinux.us> for the following catch: opendir(path)) == (DIR *)-1; is maybe the result of misunderstanding the manpage. If an opendir() call isn't successful it returns NULL rather than '(DIR *)-1'. Noticed-by: Laszlo Papp <djszapi@archlinux.us> Signed-off-by: Dan McGee <dan@archlinux.org>
* callback.c : fallback to normal download with bogus sizeXavier Chantry2009-10-04
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* Strndup usage and small typo fixLaszlo Papp2009-09-20
| | | | | | | | | | | ./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>
* Kill -F option for good in option parsingDan McGee2009-09-18
| | | | Signed-off-by: Dan McGee <dan@archlinux.org>
* String improvementsXavier Chantry2009-09-16
| | | | | | | Add more untranslated strings, improve consistency, etc. Signed-off-by: Xavier Chantry <shiningxc@gmail.com> Signed-off-by: Dan McGee <dan@archlinux.org>
* Revert "Fix a memleak involving lazy DB loading"Dan McGee2009-09-14
| | | | | | | | | | | | | | | | | | | 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>
* Fix a memleak involving lazy DB loadingXavier Chantry2009-09-08
| | | | | | | | | | | | 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>
* testdb : less verboseXavier Chantry2009-08-18
| | | | | | | http://bbs.archlinux.org/viewtopic.php?id=77396 Signed-off-by: Xavier Chantry <shiningxc@gmail.com> Signed-off-by: Dan McGee <dan@archlinux.org>
* query.c : return 1 when no package matchXavier Chantry2009-08-18
| | | | | | | | | 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>
* Quiet ShowSize with -Ss and -QsXavier Chantry2009-08-18
| | | | | | | | | This fixes FS#15923 PS : duplicated code ftw Signed-off-by: Xavier Chantry <shiningxc@gmail.com> Signed-off-by: Dan McGee <dan@archlinux.org>
* Fix for FS#15810Nagy Gabor2009-08-08
| | | | | | | | 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>
* Fix an untranslated message in src/callback.cNagy Gabor2009-07-28
| | | | | Signed-off-by: Nagy Gabor <ngaba@bibl.u-szeged.hu> Signed-off-by: Dan McGee <dan@archlinux.org>
* Ensure version screen fits in 80 colsDan McGee2009-07-26
| | | | Signed-off-by: Dan McGee <dan@archlinux.org>
* Use lstat instead of stat for -QoXavier Chantry2009-07-25
| | | | | | | | | | 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>
* Add a fetch callback to allow front-end download supportSebastian Nowicki2009-07-22
| | | | | | | | | | | 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>
* Introduce -SuuNagy Gabor2009-07-22
| | | | | | | | | | | | | | | 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>
* New feature: files verificationDan McGee2009-07-22
| | | | | | | | | | | | | 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>
* Offer to clean up non-package files in cache directory.Xavier Chantry2009-07-16
| | | | | | | This implements FS#15142. Signed-off-by: Xavier Chantry <shiningxc@gmail.com> Signed-off-by: Dan McGee <dan@archlinux.org>
* Update copyright headers and messagesDan McGee2009-07-01
| | | | Signed-off-by: Dan McGee <dan@archlinux.org>
* Give sensible feedback when a repo has no configured serversDan McGee2009-06-08
| | | | | | | | | | | | | | 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>
* We don't need root with -SpNagy Gabor2009-06-01
| | | | | | | | | | | | 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>
* Change package to package(s) and file to file(s) in documentationNagy Gabor2009-06-01
| | | | | | | | 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>
* Remove unused string.h from src/pacman/remove.cGerardo Exequiel Pozzi2009-06-01
| | | | | | | | 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>
* Remove unused included headers from testdb.c and testpkg.cGerardo Exequiel Pozzi2009-05-18
| | | | | | | | 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>
* Query documentation updatesNagy Gabor2009-05-18
| | | | | | | | | | 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>
* Remove version information from -Qqo outputDan McGee2009-05-11
| | | | | | | This was the only --quiet operation that showed version information; make it consistent with the rest. Signed-off-by: Dan McGee <dan@archlinux.org>
* Introduce -QlqNagy Gabor2009-05-11
| | | | | | | | 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>
* Remove pmsyncpkg_tNagy Gabor2009-04-11
| | | | | | | | | | | | | | | | | | | | | 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>
* New error type: PM_ERR_PKG_IGNOREDNagy Gabor2009-04-11
| | | | | | | | | | 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>
* Document --debugNagy Gabor2009-04-05
| | | | | | | | 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>
* Don't prompt the user for unignore of IgnorePkg/IgnoreGroup packagesBryan Ischo2009-02-23
| | | | | | | | | | 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>
* Enabled new interactive prompt and updated some testsBryan Ischo2009-02-23
| | | | | | | | | | | | | | | 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>
* Rename alpm_get_md5sum to alpm_compute_md5sum and alpm_dep_get_string to ↵Nagy Gabor2009-01-12
| | | | | | | | | | | 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>
* HoldPkg reworkNagy Gabor2009-01-12
| | | | | | | | | | | | | | | | | | | 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>
* Merge branch 'maint'Dan McGee2008-12-02
|\ | | | | | | | | Conflicts: lib/libalpm/dload.c
| * Add flush after downloading messageSimo Leone2008-12-02
| | | | | | | | | | | | | | | | 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>
| * Give an error message on alpm_db_register_sync() errorNagy Gabor2008-11-30
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
| * Minor code cleanupsDan McGee2008-11-17
| | | | | | | | | | | | Mostly noticed when compiling libalpm/pacman with ICC. Signed-off-by: Dan McGee <dan@archlinux.org>
* | -Qu reworkNagy Gabor2008-10-31
| | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* | testdb : extend the tool to allow checking sync dbs too.Xavier Chantry2008-10-28
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* | Merge branch 'maint'Dan McGee2008-10-12
|\|
| * Make interrupt handler async-safeDan McGee2008-10-12
| | | | | | | | | | | | | | 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>
| * Reduce number of calls to getcols()Dan McGee2008-10-12
| | | | | | | | | | | | | | 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>
| * Ensure we don't have double slashes when creating frontend pathsDan McGee2008-10-12
| | | | | | | | | | | | | | | | 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>
| * Another attempt at fixing totaldownload.Xavier Chantry2008-09-02
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
| * Separate targets on -Qi/-Si with a newline.Xavier Chantry2008-08-28
| | | | | | | | | | | | | | | | This fixes FS#11331 The newline was lost with commit 9451b2e4f23a3c566fcfe3420c379b3cb3eb1f90. Signed-off-by: Xavier Chantry <shiningxc@gmail.com>
* | Remove unnecessary initialization in new functionsDan McGee2008-09-03
| | | | | | | | | | | | | | We don't need to zero things out, we are already using calloc for this purpose. Signed-off-by: Dan McGee <dan@archlinux.org>
* | Merge branch 'maint'Dan McGee2008-08-26
|\|
| * Add missing comma to -S --help messageRoman Kyrylych2008-08-25
| | | | | | | | | | Signed-off-by: Xavier Chantry <shiningxc@gmail.com> Signed-off-by: Dan McGee <dan@archlinux.org>
* | Rename alpm_db_get{pkg,grp}cache to alpm_db_get_{pkg,grp}cacheXavier Chantry2008-08-25
| | | | | | | | | | | | | | | | 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>