summaryrefslogtreecommitdiffstats
path: root/lib/libalpm
AgeCommit message (Collapse)AuthorFilesLines
2009-11-15Refactor do/while cycle and multiple while cyclesLaszlo Papp2-5/+11
* It makes the code clearer to read/understand * Cppcheck tool doesn't show this anymore: [./util.c:215]: (error) Resource leak: fd [Dan: don't change the coding style] Signed-off-by: Dan McGee <dan@archlinux.org>
2009-11-15Add Catalan translationManuel Tortosa2-0/+570
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-11-10Merge branch 'maint'Dan McGee1-1/+2
2009-10-27Fix opendir error condition checksDan McGee1-1/+2
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>
2009-10-24Fix a small typo in alpm_list.cLaszlo Papp1-1/+1
Signed-off-by: Laszlo Papp <djszapi@archlinux.us> Signed-off-by: Dan McGee <dan@archlinux.org>
2009-10-24Reduce unnecessary get_name() function callsDan McGee1-3/+3
alpm_pkg_get_name() gives us little benefit in backend code besides a NULL check on the package passed in; we could do that ourself if necessary. By changing to direct references in the cases where we are sure we have a valid package, we save a function call each time we need a package name. This function can't be inlined because it is externally accessible. This cuts the calls to get_name() from 1.3 million times in a pacman -Qu operation to around 2400. Signed-off-by: Dan McGee <dan@archlinux.org>
2009-10-20dload.c : clear sigaction flag to make valgrind happyXavier Chantry1-0/+1
This fixes the following valgrind warning : ==26831== Syscall param rt_sigaction(act->sa_flags) points to uninitialised byte(s) ==26831== at 0x4282547: __libc_sigaction (in /lib/libc-2.10.1.so) ==26831== by 0x403C693: download_internal (dload.c:152) ==26831== by 0x403D0E4: _alpm_download_single_file (dload.c:311) ==26831== by 0x4033B72: alpm_db_update (be_files.c:319) ==26831== by 0x805205E: pacman_sync (sync.c:257) ==26831== by 0x804EE54: main (pacman.c:1120) ==26831== Address 0xbec6cc04 is on thread 1's stack ==26831== ==26831== Syscall param rt_sigaction(act->sa_restorer) points to uninitialised byte(s) ==26831== at 0x4282547: __libc_sigaction (in /lib/libc-2.10.1.so) ==26831== by 0x403C693: download_internal (dload.c:152) ==26831== by 0x403D0E4: _alpm_download_single_file (dload.c:311) ==26831== by 0x4033B72: alpm_db_update (be_files.c:319) ==26831== by 0x805205E: pacman_sync (sync.c:257) ==26831== by 0x804EE54: main (pacman.c:1120) ==26831== Address 0xbec6cc08 is on thread 1's stack ==26831== Signed-off-by: Xavier Chantry <shiningxc@gmail.com> Signed-off-by: Dan McGee <dan@archlinux.org>
2009-10-19Size handling was changed in fgets() functionsLaszlo Papp2-25/+27
Pacman's fgets function in the API used hardcoded numbers to identify the size. This is not good practice, so replace them with sizeof handling. Signed-off-by: Laszlo Papp <djszapi@archlinux.us> Signed-off-by: Dan McGee <dan@archlinux.org>
2009-10-11use bitwise shift operator in enum "bit field"solsTiCe d'Hiver2-34/+34
This offers a cleaner way to deal with constant in enum and allow easy maintainance Signed-off-by: solsTiCe d'Hiver <solstice.dhiver@gmail.com> Signed-off-by: Dan McGee <dan@archlinux.org>
2009-10-11Fix "-Sd conflict_pkg" bugNagy Gabor1-15/+10
If the -d switch was invoked with -S (or -U), the removes list was simply lost, because trans->remove was computed in an "if(!(trans->flags & PM_TRANS_FLAG_NODEPS))" block. I've added a new pactest file, sync045.py (derived from sync043.py) to test this. Additionally, I did some other minor cleanups in sync_prepare: * preferred list is not needed anymore * I removed a needless alpm_list_remove_dupes line (the target list should not contain dupes at all) * I moved alpm_list_free(remove); to cleanup part to eliminate a possible memleak Signed-off-by: Nagy Gabor <ngaba@bibl.u-szeged.hu> Signed-off-by: Dan McGee <dan@archlinux.org>
2009-10-11alpm_list : add new alpm_list_diff_sorted functionXavier Chantry2-17/+70
This is more efficient than alpm_list_diff since it assumes the two lists are sorted. And also we get the two sides of the diff. Even sorting should more efficient than the current list_diff. Sorting the two lists should be O(n*log(n)+m*log(m)) while the current list_diff is O(n*m). So I also reimplemented list_diff using list_diff_sorted. Signed-off-by: Xavier Chantry <shiningxc@gmail.com> Signed-off-by: Dan McGee <dan@archlinux.org>
2009-10-11Rework the alpm_unpack functionsXavier Chantry4-14/+50
Add support to extract a list of entries Signed-off-by: Xavier Chantry <shiningxc@gmail.com> Signed-off-by: Dan McGee <dan@archlinux.org>
2009-10-11cygwin fix : use unsigned char for ctype functionXavier Chantry3-5/+5
See http://www.nabble.com/-PATCH-RFA--Distinguish-between-EOF-and-character-with-value-0xff-td23161772.html#a23188494 cygwin 1.7 actually displays a warning when using signed char with the ctype function, so that compilation fails when using -Wall -Werror. So we just cast all arguments to unsigned char. Signed-off-by: Xavier Chantry <shiningxc@gmail.com> Signed-off-by: Dan McGee <dan@archlinux.org>
2009-10-11libalpm: clean up lock functionDan McGee1-8/+5
We were doing a lot of manual work; leverage the standard library a bit to do more for us. Signed-off-by: Dan McGee <dan@archlinux.org>
2009-10-11Reduce calls to list_count() in removing packageDan McGee1-4/+4
We don't need to count the number of packages left once per file when removing; we only need to do it once per package. Also move a variable into the correct scope. Signed-off-by: Dan McGee <dan@archlinux.org>
2009-10-11Add missing get_usedelta() methodDan McGee2-0/+10
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-10-11typing: a few more fixes for special int typesDan McGee6-13/+13
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-10-11int typing: s/unsigned short/int/ in libalpmDan McGee10-25/+23
After our recent screwup with size_t and ssize_t in the download code, I found the `-Wsign-conversion` flag to GCC to see if we were doing anything else boneheaded. I didn't find anything quite as bad, but we did have some goofups- most of our public unsigned methods would return -1 on error, which is a bit odd in an unsigned context. Signed-off-by: Dan McGee <dan@archlinux.org>
2009-10-11Merge branch 'maint'Dan McGee21-55/+685
2009-10-11alpm_list : fix a bug in alpm_list_removeXavier Chantry1-0/+1
A NULL list element triggered an infinite loop. Not cool :) Signed-off-by: Xavier Chantry <shiningxc@gmail.com> Signed-off-by: Dan McGee <dan@archlinux.org>
2009-10-11Update Chinese translation甘露(Lu.Gan)1-3/+3
Signed-off-by: Xavier Chantry <shiningxc@gmail.com> Signed-off-by: Dan McGee <dan@archlinux.org>
2009-10-07Update Swedish translationChristian Larsson1-10/+10
Signed-off-by: Xavier Chantry <shiningxc@gmail.com> Signed-off-by: Dan McGee <dan@archlinux.org>
2009-10-07Update chinese translation甘露(Lu.Gan)1-10/+10
Signed-off-by: Xavier Chantry <shiningxc@gmail.com> Signed-off-by: Dan McGee <dan@archlinux.org>
2009-10-07New Greek translationXavier Chantry2-0/+557
Signed-off-by: Xavier Chantry <shiningxc@gmail.com> Signed-off-by: Dan McGee <dan@archlinux.org>
2009-10-07Update translationsXavier Chantry16-48/+48
Signed-off-by: Xavier Chantry <shiningxc@gmail.com> Signed-off-by: Dan McGee <dan@archlinux.org>
2009-10-07Update all pot and po files for 3.3.2 releaseXavier Chantry18-20/+92
Signed-off-by: Xavier Chantry <shiningxc@gmail.com> Signed-off-by: Dan McGee <dan@archlinux.org>
2009-09-29Merge branch 'maint'Dan McGee1-7/+22
Conflicts: lib/libalpm/dload.c
2009-09-29dload : fix infinite download (big type mistake)Xavier Chantry1-7/+22
fetchIO_read returns -1 in case of error, and the return type is ssize_t, not size_t ! So we converted -1 to an unsigned, which led to huge file write. The rest is just changing the error return a bit. Signed-off-by: Xavier Chantry <shiningxc@gmail.com> Signed-off-by: Dan McGee <dan@archlinux.org>
2009-09-22Merge branch 'maint'Dan McGee19-79/+1177
2009-09-22Clean up translation file headersDan McGee18-49/+49
Get them a bit more standardized across the board, as they were quite a mess. Also note the two new translations we received for 3.3.1. Signed-off-by: Dan McGee <dan@archlinux.org>
2009-09-22Add Swedish translationLaszlo Papp2-0/+549
This is for 3.3.0, not for 3.3.1. But since there are only like 10 messages missing, it seems worth including now. Signed-off-by: Christian Larsson <congacx@gmail.com> Signed-off-by: Laszlo Papp <djszapi2@archlinux.us> [Dan: fix some busted translation strings] Signed-off-by: Dan McGee <dan@archlinux.org>
2009-09-23Update Czech translationOndrej Kucera1-9/+9
Signed-off-by: Xavier Chantry <shiningxc@gmail.com>
2009-09-22Update Brazilian translationRodrigo Flores1-12/+13
Signed-off-by: Xavier Chantry <shiningxc@gmail.com>
2009-09-21Add Norwegian translationLaszlo Papp2-0/+549
Signed-off-by: Hans-Kristian Arntzen <maister@archlinux.us> Signed-off-by: Laszlo Papp <djszapi@archlinux.us> Signed-off-by: Dan McGee <dan@archlinux.org>
2009-09-20Update Polish translationMateusz Herych1-13/+12
Signed-off-by: Giovanni Scafora <giovanni@archlinux.org>
2009-09-20Fully implement database lazy loadingDan McGee5-51/+74
Commit 34e1413d75 attempted to implement lazy loading of package databases. Although it took care of my main complaint (creating the database directory if it didn't exist), it didn't allow sync repos to be registered before alpm_option_set_dbpath() had been called. With this patch, we no longer compute the individual repository DB paths until necessary, allowing full lazy loading to work as intended, and allowing us to drop the extra setlibpath() calls from the frontend. This allows the changes introduced in a2cd48960 (but later reverted) to be added back in again. Signed-off-by: Dan McGee <dan@archlinux.org>
2009-09-20Merge branch 'maint'Dan McGee19-147/+284
Message updates made this one a bit messy, but nothing too bad. Conflicts: lib/libalpm/add.c lib/libalpm/remove.c
2009-09-20delta : simple code refactoringXavier Chantry1-26/+41
This will make the code re-usable for other purpose. Signed-off-by: Xavier Chantry <shiningxc@gmail.com> Signed-off-by: Dan McGee <dan@archlinux.org>
2009-09-20sync.c : duplicate the target before modifying itXavier Chantry2-2/+1
It was probably a bad idea to modify the target directly in case of repo/pkg syntax. Duplicating it also allows us to keep the original target string, which is more informative when printing errors. Also remove a duplicated error message from libalpm, and improve the message already returned to the frontend. $ pacman -S foo/bar before error: repository 'foo' not found error: 'bar': no such repository after error: 'foo/bar': could not find repository for target Signed-off-by: Xavier Chantry <shiningxc@gmail.com> Signed-off-by: Dan McGee <dan@archlinux.org>
2009-09-18Update Italian translationGiovanni Scafora1-17/+19
Signed-off-by: Giovanni Scafora <giovanni@archlinux.org>
2009-09-18Update Ukrainian translationRoman Kyrylych1-28/+28
Signed-off-by: Giovanni Scafora <giovanni@archlinux.org>
2009-09-18Update Turkish translationSamed Beyribey1-10/+10
Signed-off-by: Giovanni Scafora <giovanni@archlinux.org>
2009-09-18Update Spanish translationJuan Pablo González Tognarelli1-18/+22
Signed-off-by: Giovanni Scafora <giovanni@archlinux.org>
2009-09-18Update Russian translationSergey Tereschenko1-10/+10
Signed-off-by: Giovanni Scafora <giovanni@archlinux.org>
2009-09-18Update Romanian translationVolodia Macovei1-8/+8
Signed-off-by: Giovanni Scafora <giovanni@archlinux.org>
2009-09-18Update Kazakh translationBaurzhan Muftakhidinov1-12/+10
Signed-off-by: Giovanni Scafora <giovanni@archlinux.org>
2009-09-18Update Hungarian translationNagy Gabor1-9/+9
Signed-off-by: Giovanni Scafora <giovanni@archlinux.org>
2009-09-18Update German translationMatthias Gorissen1-11/+12
Signed-off-by: Giovanni Scafora <giovanni@archlinux.org>
2009-09-16Update en_GB translationDan McGee1-12/+12
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-09-16Update french translationXavier Chantry1-9/+9
Signed-off-by: Xavier Chantry <shiningxc@gmail.com> Signed-off-by: Dan McGee <dan@archlinux.org>