summaryrefslogtreecommitdiff
path: root/lib
Commit message (Collapse)AuthorAge
* Reorganize code for one-at-a-time resolvingBryan Ischo2009-02-18
| | | | | | | | | | | | This change reorganizes the internal code so that packages are resolved one at a time instead of all at once from a list. This will allow a future checkin to prompt the user to see if they'd rather remove unresolvable packages from the transaction and continue, or fail the transaction. This change does not affect the actual behavior of libalpm and all tests pass without changes. Signed-off-by: Bryan Ischo <bryan@ischo.com> Signed-off-by: Dan McGee <dan@archlinux.org>
* Delay the creation of local and sync db dir.Xavier Chantry2009-01-20
| | | | | | | | | | | | | | We don't need to create the directories when local or sync dbs are registered. For example, if a sync db does not exist, we cannot even do "pacman -Q" as an user. Instead, we can create the local db if needed during the db_prepare operation, and sync dbs on db_update. Also remove some more useless abstractions in db_update and switch to a much more efficient way to remove a sync db : rm -rf. Signed-off-by: Xavier Chantry <shiningxc@gmail.com>
* Remove some db abstraction crap.Xavier Chantry2009-01-20
| | | | | | | | These db_open and db_close looked quite useless. And they caused the db directory to be opened on a simple registering of a database. This is totally unneeded, this opening can be delayed to when we actually need it. Signed-off-by: Xavier Chantry <shiningxc@gmail.com>
* alpm_unpack : change prefix handling to workaround FS#12148.Xavier Chantry2009-01-20
| | | | | | | | | Instead of appending the prefix to each entry name, we can chdir to the prefix before extracting, and restoring when it is done. This seems to work better with the strange and special case of FS#12148 where an archive contained the "./" entry. Signed-off-by: Xavier Chantry <shiningxc@gmail.com>
* Merge branch 'maint'Dan McGee2009-01-18
|\
| * Use archive_entry_set_perm instead of archive_entry_set_modeNagy Gabor2009-01-18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch fixes FS#12148 ('unstable' regular file). I also changed the other archive_entry_set_mode usage in add.c to archive_entry_set_perm. Since I cannot find any relevant info in libarchive manual, I quote Tim Kientzle (the author of libarchive) here, and I say thank you for his help. *** Tim Kientzle wrote ************************************* This is the problem in libalpm/util.c: 323 if(S_ISREG(st->st_mode)) { 324 archive_entry_set_mode(entry, 0644); 325 } else if(S_ISDIR(st->st_mode)) { 326 archive_entry_set_mode(entry, 0755); 327 } Your example unstable.db.tar.gz is not empty. It has one entry in it, called "./". That entry is marked as a directory. But, when you call archive_entry_set_mode(), you are changing the file type! archive_read_extract() then creates the file /var/unstable as you requested. (archive_read_extract() will replace an empty directory with a file.) You should either set the mode value correctly: 323 if(S_ISREG(st->st_mode)) { 324 archive_entry_set_mode(entry, IFREG | 0644); 325 } else if(S_ISDIR(st->st_mode)) { 326 archive_entry_set_mode(entry, IFDIR | 0755); 327 } Or use archive_entry_set_perm(), which does not change the file type: 323 if(S_ISREG(st->st_mode)) { 324 archive_entry_set_perm(entry, 0644); 325 } else if(S_ISDIR(st->st_mode)) { 326 archive_entry_set_perm(entry, 0755); 327 } ************************************************************ Signed-off-by: Nagy Gabor <ngaba@bibl.u-szeged.hu> Signed-off-by: Dan McGee <dan@archlinux.org>
* | db->pkgcache_loaded and db->grpcache_loadedNagy Gabor2009-01-12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Clearly the old code was more elegant (NULL cache indicated "not loaded"), but it had some drawbacks, so from now on we indicate the state of caches explicitly. Old drawbacks: When we had an empty database (unstable), libalpm called db_populate after every pkgcache access, because NULL pkgcache indicated "not loaded" state. This is not a common case, but the same situation can happen with grpcache, which is more problematic: If the user had a custom repo with no groups, grpcache was always NULL. (grpcache is also loaded per database.) Thus every get_grpcache call induced a load_grpcache operation, so the benefits of grpcache was completely lost. Signed-off-by: Nagy Gabor <ngaba@bibl.u-szeged.hu> 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>
* | Remove libdownload support and fix libfetch one.Xavier Chantry2009-01-12
| | | | | | | | | | | | | | | | | | | | | | | | | | Aaron said to consider libdownload a dead project so libdownload support was removed to more easily fix libfetch one (otherwise many ifdef needed). There was no direct replacement for ferror to detect an error while downloading. So instead, I added a check at the end to see if the file was fully downloaded, which is just a small chunk of code taken from here: http://cvsweb.netbsd.org/bsdweb.cgi/pkgsrc/net/libfetch/files/fetch.c?only_with_tag=MAIN Signed-off-by: Xavier Chantry <shiningxc@gmail.com> Signed-off-by: Dan McGee <dan@archlinux.org>
* | Merge branch 'maint'Dan McGee2009-01-06
|\|
| * Update Czech translationVojtěch Gondžala2009-01-05
| | | | | | | | Signed-off-by: Dan McGee <dan@archlinux.org>
* | Merge branch 'maint'Dan McGee2009-01-04
|\| | | | | | | | | Conflicts: po/it.po
| * Update Polish translationMateusz Herych2009-01-03
| | | | | | | | Signed-off-by: Dan McGee <dan@archlinux.org>
| * Update Turkish translationSamed Beyribey2009-01-03
| | | | | | | | Signed-off-by: Dan McGee <dan@archlinux.org>
| * Update Russian translationSergey Tereschenko2009-01-03
| | | | | | | | Signed-off-by: Dan McGee <dan@archlinux.org>
| * Update Unkranian translationRoman Kyrylych2009-01-03
| | | | | | | | Signed-off-by: Dan McGee <dan@archlinux.org>
| * Update Italian translationGiovanni Scafora2009-01-03
| | | | | | | | Signed-off-by: Dan McGee <dan@archlinux.org>
| * Update German translationMatthias Gorissen2009-01-03
| | | | | | | | Signed-off-by: Dan McGee <dan@archlinux.org>
| * Update Spanish translationJuan Pablo González Tognarelli2009-01-03
| | | | | | | | Signed-off-by: Dan McGee <dan@archlinux.org>
* | Merge branch 'maint'Dan McGee2009-01-03
|\|
| * Separate local db directory creation and db writeAllan McRae2009-01-02
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Changelogs and install files were getting extracted into the local db folder before it was manually created. This created issues for uses with 0077 umasks and was highlighted with the new sudo handling of umasks (FS#12263). This moves the local db creation to its own function which is called before the start of package archive extraction. Also, added a check that the folder is actually created. Signed-off-by: Allan McRae <allan@archlinux.org> [Dan: rename to _alpm_db_prepare()] Signed-off-by: Dan McGee <dan@archlinux.org>
| * Log pacsave warnings to pacman.logSterling Winter2009-01-02
| | | | | | | | | | | | | | | | | | | | | | Pacman currently logs .pacnew warnings to pacman.log but a similar history of .pacsave warnings isn't kept. The user should be able to search pacman.log to discover when and where all .pac* files were created by pacman. Addresses FS#12531. Signed-off-by: Dan McGee <dan@archlinux.org>
* | libalpm: add PID to db.lckAllan McRae2009-01-03
| | | | | | | | | | | | | | | | | | This is the first step in being able to automatically remove phantom lock files. Signed-off-by: Allan McRae <allan@archlinux.org> [Dan: fix compilation warnings] Signed-off-by: Dan McGee <dan@archlinux.org>
* | Merge branch 'maint'Dan McGee2009-01-02
|\| | | | | | | | | | | | | Conflicts: lib/libalpm/dload.c po/it.po scripts/makepkg.sh.in
| * Print proxy information when downloadingDan McGee2008-12-10
| | | | | | | | | | | | | | | | May help debug issues we come across with proxy behavior (e.g. those pesky segfaults) as well as be informative to the user when things aren't working quite right. Addresses FS#12396. Signed-off-by: Dan McGee <dan@archlinux.org>
* | Merge branch 'maint'Dan McGee2008-12-02
|\| | | | | | | | | Conflicts: lib/libalpm/dload.c
| * Add regex to delta code so we don't segfault when reading lineDan McGee2008-11-30
| | | | | | | | | | | | | | If the delta line doesn't match our regex, we won't go and process it, possibly walking off the end of the string. 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>
* | Set SIGPIPE handler to SIG_IGN when downloadingDan McGee2008-10-31
| | | | | | | | | | | | | | | | We don't want a failed write to kill our whole program when we are downloading things, so set the SIGPIPE handler to ignore when downloading and restore any previous signal handler when we complete the download. Signed-off-by: Dan McGee <dan@archlinux.org>
* | Make libfetch the 'native' download libraryDan McGee2008-10-31
| | | | | | | | | | | | | | | | Use libfetch naming in the code in place of libdownload names. This is in preparation for dropping support for libdownload at some point as libfetch can run on Linux. 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>
* | Merge branch 'maint'Dan McGee2008-10-28
|\|
| * Update Chinese translationLyman Li2008-10-28
| | | | | | | | Signed-off-by: Dan McGee <dan@archlinux.org>
| * Correctly close the pipe used for scriptlet executionDan McGee2008-10-18
| | | | | | | | | | | | | | | | | | | | We never had a call to pclose() in here before, leaving our file descriptor in some sort of limbo state. In addition, clean up some of the other logic such as directly calling exit(1) on a popen() failure rather than going to our cleanup block, and handling and respecting the exit status of the subprocess correctly. Signed-off-by: Dan McGee <dan@archlinux.org>
| * Minor updates to Russian translationSergey Tereschenko2008-10-12
| | | | | | | | Signed-off-by: Dan McGee <dan@archlinux.org>
* | Merge branch 'maint'Dan McGee2008-10-12
|\|
| * Remove unnecessary unistd.h header inclusionDan McGee2008-10-12
| | | | | | | | Signed-off-by: Dan McGee <dan@archlinux.org>
| * libalpm: handle syscall interruption correctlyDan McGee2008-10-12
| | | | | | | | | | | | | | | | | | | | | | | | | | It is possible to throw EINTR from a system call such as open(), close(), or waitpid() if custom signal handlers are set up and they are not initialized with the SA_RESTART flag. This was noticed by Andreas Radke when ^C (SIGINT) was given during the call to waitpid(), causing it to throw the EINTR error and we could not accommodate it. Simply wrap these calls in a simple loop that allows us to retry the call if interrupted. Signed-off-by: Dan McGee <dan@archlinux.org>
* | 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
|\|
| * New Ukrainian translationRoman Kyrylych2008-08-26
| | | | | | | | Signed-off-by: Dan McGee <dan@archlinux.org>
| * Final updates on all translation for 3.2.1Xavier Chantry2008-08-25
| | | | | | | | | | | | | | | | | | | | * Update all .po files because of the last "-q,--quiet" fix. Also for some strange reason, en_GB was missing a few c-format tags. * Finally, delete all unused translations. Signed-off-by: Xavier Chantry <shiningxc@gmail.com> Signed-off-by: Dan McGee <dan@archlinux.org>
| * Update Portuguese (Brazil) translationHugo Doria2008-08-25
| | | | | | | | Xav : alignment fixes
| * Update Turkish translationSamed Beyribey2008-08-25
| |
| * Update Chinese Simplified translation甘露(Lu.Gan)2008-08-25
| |
| * Update Czech translationVojtěch Gondžala2008-08-24
| |
| * Update German translationMatthias Gorissen2008-08-24
| |
| * Update Russian translationSergey Tereschenko2008-08-24
| | | | | | | | [Xav: one minor fix to libalpm po file]
* | 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>