summaryrefslogtreecommitdiff
path: root/src
AgeCommit message (Collapse)Author
2008-05-29Remove PM_TRANS_EVT_EXTRACT_START.Xavier Chantry
This event was unused, was missing the equivalent EXTRACT_DONE event, and was useless because we already have ADD / UPGRADE START and DONE events. Signed-off-by: Xavier Chantry <shiningxc@gmail.com> Signed-off-by: Dan McGee <dan@archlinux.org>
2008-05-14Disable geteuid in cygwin.Xavier Chantry
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>
2008-05-13Add SyncFirst option.Chantry Xavier
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-13Cleanup usages of alpm_list_find and alpm_list_remove.Chantry Xavier
* remove obsolete and unused *_cmp helper functions like deppkg_cmp and _alpm_grp_cmp * new alpm_list_remove_str function, used 6 times in handle.c * remove _alpm_prov_cmp / _alpm_db_whatprovides and replace them by a more general alpm_find_pkg_satisfiers with a cleaner implementation. before: alpm_db_whatprovides(db, targ) after: alpm_find_pkg_satisfiers(alpm_db_getpkgcache(db), targ) * remove satisfycmp and replace alpm_list_find + satisfycmp usage by _alpm_find_dep_satisfiers. before : alpm_list_find(_alpm_db_get_pkgcache(db), dep, satisfycmp) after : _alpm_find_dep_satisfiers(_alpm_db_get_pkgcache(db), dep) * remove _alpm_pkgname_pkg_cmp, which was used with alpm_list_remove, and use _alpm_pkg_find + alpm_list_remove with _alpm_pkg_cmp instead. This commit actually get rids of all complicated and asymmetric _cmp functions. I first thought these functions were worth it, be caused it allowed us to reuse list_find and list_remove. But this was at the detriment of the clarity and also the ease of use of these functions, dangerous because of their asymmetricity. Signed-off-by: Chantry Xavier <shiningxc@gmail.com> Signed-off-by: Dan McGee <dan@archlinux.org>
2008-05-11Make all error messages use pm_fprintfAllan McRae
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>
2008-05-10Update makepath to remove PATH_MAX usageDan McGee
The start of a few commits to remove some PATH_MAX usage from our code. Use a dynamically allocated string instead. Signed-off-by: Dan McGee <dan@archlinux.org>
2008-05-08pacman-side code cleanupsDan McGee
When taking a look at PATH_MAX usage, I found a few small things we can clean up or fix. Signed-off-by: Dan McGee <dan@archlinux.org>
2008-04-26Completely rework delta algorithmChantry Xavier
Using the graph structures that Nagy set up for dependency sorting, we now do a similar process for deltas. Load up all of the deltas into a graph object on which we can then apply Dijkstra's algorithm, using the new weight field of graph struct. We initialize the nodes weight using the base files that we can use in our filecache (both filename and md5sum must match). The algorithm then picks the best path among those that can be resolved. Note that this algorithm has a few advantages over the old one: 1. It is completely file agnostic. These delta chains do not have to consist of package files- this could be adopted to do delta-fied DBs. 2. It does not use the local_db anymore, or even care if a package or file is currently installed. Instead, it only looks in the filecache for files and packages that match delta chain entries. Original-work-by: Dan McGee <dan@archlinux.org> Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
2008-04-26Refactor the trans init and release code.Chantry Xavier
The calls to alpm_trans_init and alpm_trans_release (+ error checking) were duplicated between remove.c, sync.c and upgrade.c This patch introduces trans_init and trans_release functions in util.c to have this code just once. So instead of having to do the same change 3 times for fixing FS#10273, I just had to do it once (so I did it too :)) Signed-off-by: Chantry Xavier <shiningxc@gmail.com> Signed-off-by: Dan McGee <dan@archlinux.org>
2008-04-15Merge branch 'maint'Dan McGee
2008-04-15More non-Linux build updates, mostly DarwinDan McGee
Darwin's binary format does support symbols with differing visibilities, but it does not support the protected or internal visibilities- only hidden. For Darwin only, we should fall back to this visibility to prevent warnings from the compiler and because it is close enough for our library purposes. See http://gcc.gnu.org/viewcvs/*checkout*/trunk/gcc/config/darwin.c, search for the "darwin_assemble_visibility" function for more details. Also add pacman.static.exe to gitignore. Signed-off-by: Dan McGee <dan@archlinux.org>
2008-04-14Fix gettext on non-Linux platformsDan McGee
Linux includes all the gettext stuff in glibc, so there is no need for the libintl links which we failed to include in our linker variables. Update the makefiles which should enable NLS support on all platforms, including OS X and Cygwin. Signed-off-by: Dan McGee <dan@archlinux.org>
2008-04-07Update configure.ac to current codeDan McGee
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>
2008-04-07Merge branch 'maint'Dan McGee
2008-04-07Add check for swprintf() and a workaround when it is missingDan McGee
We use this function once in our codebase, but fortunately the workaround is relatively easy. swprintf() is not available on Cygwin so the compile failed there, but we can do a series of mbstowcs() calls that produce the same end result as the swprintf() call. Signed-off-by: Dan McGee <dan@archlinux.org>
2008-04-07Add *.exe ignores for certain other platformsDan McGee
Signed-off-by: Dan McGee <dan@archlinux.org>
2008-04-06libalpm error cleanup, step 1Dan McGee
Remove unused error codes, begin refactoring some of the others. Signed-off-by: Dan McGee <dan@archlinux.org>
2008-04-06Remove libdownload reference from pacman frontendDan McGee
Signed-off-by: Dan McGee <dan@archlinux.org>
2008-04-06Add quiet printout to --owns functionalityDan McGee
If we specify -q/--quiet on an --owns operation, only print a matching package name rather than the verbose human-readable message. Signed-off-by: Dan McGee <dan@archlinux.org>
2008-03-30Enable display of multiple groups in -Ss and -Qs outputDan McGee
Not too complicated of a fix, but just adds some code to loop over the entire group list and space it out. Signed-off-by: Dan McGee <dan@archlinux.org>
2008-03-30Fix segfault on -Qs usageDan McGee
This segfault creeped in as a result of commit bf867003. We were incorrectly assuming the group member of our package was a pmgrp_t list when in fact it is just a string list, which caused a segfault on any -Qs operation. Also slightly cleanup the -Ss code (which was originally correct unlike the -Qs code). Signed-off-by: Dan McGee <dan@archlinux.org>
2008-03-23Merge branch 'maint'Dan McGee
2008-03-23strsplit(): memleak fixDan McGee
We dup-ed the string but then duped it again. Fix it. Signed-off-by: Dan McGee <dan@archlinux.org>
2008-03-23Switch pmgrp_t to dynamic allocation, general group cleanupDan McGee
Signed-off-by: Dan McGee <dan@archlinux.org>
2008-03-23Add new CleanMethod option.Chantry Xavier
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>
2008-03-22Kill the dependsonly option.Chantry Xavier
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>
2008-03-17Drop case insensitive comparisons in the config parsing.Chantry Xavier
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>
2008-03-10Add -Rss optionNagy Gabor
* -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>
2008-03-09Merge branch 'maint'Dan McGee
Conflicts: configure.ac
2008-03-09Use sigaction instead of signal.Chantry Xavier
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>
2008-03-09src/pacman/pacman.c : split cleanup function.Chantry Xavier
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>
2008-03-08Remove frontend add code that is no longer necessaryDan McGee
Change the pacman_upgrade stub function to do what pacman_add used to do so we can eliminate pacman_add. Move the code to the more-descriptive name of upgrade.c. Note that we have made no changes to the backend libalpm, where an ADD type transaction could still be supported. Signed-off-by: Dan McGee <dan@archlinux.org>
2008-03-08Remove the Add option from the command lineDan McGee
There is still a lot of code that could be cleaned up internally. Signed-off-by: Dan McGee <dan@archlinux.org>
2008-03-06New alpm_version functionNagy Gabor
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)
2008-03-01New alpm_version functionNagy Gabor
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>
2008-03-01testpkg reworkNagy Gabor
* mainly code cosmetics (indent fixes) * remove debug message "spam" * print also user friendly result Signed-off-by: Nagy Gabor <ngaba@bibl.u-szeged.hu> [Dan: a few more whitespace/linebreak cleanups added] Signed-off-by: Dan McGee <dan@archlinux.org>
2008-02-27libalpm: clean up of md5sum functions.Chantry Xavier
test_delta_md5sum and test_pkg_md5sum were simple wrappers to test_md5sum, and only used once, so not very useful. I removed them. Also, test_md5sum and alpm_pkg_checkmd5sum functions were a bit duplicated, so I refactored them with a new _alpm_test_md5sum function in libalpm/util.c Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
2008-02-27Start removing some junk from the function templateDan McGee
I screwed up originally when I accepted the TotalDownload patch, 8ec27835f40e3df1ce409bc3d913587c474a30c3. I didn't realize how deeply it modified libalpm and I probably shouldn't have let it do what it did. This commit reverts much of what that patch added in order to clean up our internal function calls. We can find another way to do it right down the road here but for now it has to go. Signed-off-by: Dan McGee <dan@archlinux.org>
2008-02-25Merge branch 'maint'Dan McGee
Also bump the devel version on the master branch to 3.2.0devel.
2008-02-25Remove done and failed msg when loading targets.Chantry Xavier
This change is similar to the one made in 3017b71cb5cde3aef7e0efb5f49843cccf759956. We had a "loading package data..." message, followed by either "failed" or "done", but it didn't take into account that other warnings / questions could be displayed between. Ref: http://archlinux.org/pipermail/pacman-dev/2008-January/010971.html Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
2008-02-24Improve yesno function.Chantry Xavier
Add a preset paramater to yesno function saying which answer should be the default. Ref: http://www.archlinux.org/pipermail/pacman-dev/2007-June/008470.html This allows us to answer no by default to some questions, like the -Scc one mentioned in the above thread, and implemented by this patch. Another advantage is that we don't have to repeat the [Y/n] in every questions. It's only put once in yesno function. This highly reduces the chances that YES and NO strings are translated, but not some questions, which lead to obvious confusions. Finally, the noconfirm variable only needs to be used in that yesno function. So all other usages of it were removed. Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
2008-02-24Merge branch 'maint'Dan McGee
Conflicts: src/pacman/callback.c
2008-02-24Add some NULL checks into recently modified output functionsDan McGee
After a merge with master where some strings we print (such as descriptions) could be NULL, a few segfaults popped up due to strlen() calls on null pointers. Fix this by doing some preemptive checks and returning from functions early if the string was null. Signed-off-by: Dan McGee <dan@archlinux.org>
2008-02-24Remove all unnecessary snprintf usageDan McGee
Both alpm_logaction() and yesno() are vararg functions, so we might as well use this functionality and take advantage of it. Remove all of the snprintf() calls and the LOG_STR_LEN constant that never seemed quite right. Signed-off-by: Dan McGee <dan@archlinux.org>
2008-02-22A few more wide character output fixesDan McGee
Fix up the indentprint and list printing functions so they work properly. This output can be seen in places such as -Ss, -Si, -Qs, and -Qi. Signed-off-by: Dan McGee <dan@archlinux.org>
2008-02-22Fix wide character output for add/remove/upgrade/conflict progressDan McGee
Due to the addition of the Chinese translation, our column widths were all messed up as mentioned in the download progress commit fixing this same problem there. This is a port of the code and ideas from that fix to the installation progress bars. Once again, a handful of examples were tested to ensure we work in all locales and with varying byte and char widths. English (before & after): (1/1) checking for file conflicts [-----------------] 100% (1/1) upgrading man-pages [-----------------] 100% German (before & after): (1/1) Prüfe auf Dateikonflikte [-----------------] 100% (1/1) Aktualisiere man-pages [-----------------] 100% Chinese (before): (1/1) 正在检查文件冲突 [-----------------] 100% (1/1) 生在升级 man-pages [c o o o o o ] (1/1) 生在升级 man-pages [----------C o o ] (1/1) 生在升级 man-pages [-----------------] 100% Chinese (after): (1/1) 正在检查文件冲突 [-----------------] 100% (1/1) 生在升级 man-pages [-----------------] 100% Signed-off-by: Dan McGee <dan@archlinux.org>
2008-02-22Fix wide character output for download progressDan McGee
Now that we have a Chinese translation, all of the problems with new character sets crop up. Assumptions were made in the past that all characters occupied one column, which is not true with a Chinese character set. In addition, the download code even failed on such things as 'ö', which is two bytes wide but only 1 column. This code will need to also be ported to the add/remove/upgrade/conflicts progress printouts. Note that the tests below try to incorporate a number of things: 1. download filenames too long to fit 2. download filenames cut off in the middle of a multibyte sequence 3. download filenames incorporating multicolumn chars 4. download filenames incorporating multibyte, single-column chars 5. 'plain' download filenames that have always worked Before: :: 正在同步软件包数据库…… 正在解决倚赖��... 0.0K 199.8K/s 00:00:00 [-----------------] 100% 错误:无法升级正在解决倚赖关系junköëjunköëjunköëäää (未预计的系统错误) 正在解决倚赖��... 0.0K 308.4K/s 00:00:00 [-----------------] 100% 错误:无法升级正在解决倚赖关系 (未预计的系统错误) junköëä 0.0K 390.6K/s 00:00:00 [-----------------] 100% 错误:无法升级junköëä (未预计的系统错误) pacman-git 0.5K 4.3M/s 00:00:00 [-----------------] 100% 本地数据库已是最新的 After: :: 正在同步软件包数据库…… 正在解决倚赖关系jun... 0.0K 89.7K/s 00:00:00 [-----------------] 100% 错误:无法升级正在解决倚赖关系junköëjunköëjunköëäää (未预计的系统错误) 正在解决倚赖关系 0.0K 147.7K/s 00:00:00 [-----------------] 100% 错误:无法升级正在解决倚赖关系 (未预计的系统错误) junköëä 0.0K 156.9K/s 00:00:00 [-----------------] 100% 错误:无法升级junköëä (未预计的系统错误) pacman-git 0.5K 1515.9K/s 00:00:00 [-----------------] 100% 本地数据库已是最新的 Signed-off-by: Dan McGee <dan@archlinux.org>
2008-02-20Move -Sy operation into its own transactionChantry Xavier
This allows us to remove the sync_only flag, and also do the following steps in the future : 1) refresh the database (if asked) 2) do other stuff (eg checking if a newer pacman version is available) 3) start the actual transaction Currently when we detect a newer pacman version, we have to release the current transaction and start a new one. Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
2008-02-20Merge branch 'maint'Dan McGee
Remove gettext() function addition from gensync and updatesync in master as gettext is no longer used in them anyway.
2008-02-19Lock the database on -Sc operation.Chantry Xavier
This partly fixes FS#9609. Weird things could happen when running -Sc while another instance was already running. The cleancache function could delete packages that were just being downloaded. Signed-off-by: Chantry Xavier <shiningxc@gmail.com>