summaryrefslogtreecommitdiffstats
path: root/lib/libalpm
AgeCommit message (Collapse)AuthorFilesLines
2010-06-05Update Chinese translation甘露(Gan Lu)1-12/+12
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-06-05Update Turkish translationSamed Beyribey1-12/+12
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-06-04translation: update pot/po files for libalpm in prep for releaseDan McGee20-1360/+1396
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-05-18fix memory leak in _alpm_sync_commitJonathan Conder1-1/+2
Signed-off-by: Jonathan Conder <j@skurvy.no-ip.org> Signed-off-by: Dan McGee <dan@archlinux.org>
2010-05-18Partial fix for the phonon/qt issueNagy Gabor3-9/+9
This patch fixes the phonon/qt issue, if all to-be-upgraded packages are explicit targets (ie. only not-yet-installed packages are pulled by resolvedeps). This condition covers the most common situations, for example it should hold with every -Su operation. After this patch sync405.py passes, but sync406.py doesn't. The work is inspired by the patch of Henning Garus, thanks for his work: http://mailman.archlinux.org/pipermail/pacman-dev/2010-February/010429.html (I moved the alpm_list_diff computation to sync.c in order to compute it only once.) Signed-off-by: Nagy Gabor <ngaba@bibl.u-szeged.hu> Signed-off-by: Dan McGee <dan@archlinux.org>
2010-05-14Fix a serious bug in the download codeNagy Gabor1-6/+6
After commit df99495b82 pacman downloaded files from the first repo only, and reported corrupted packages for all files from other repos. The download_size was set to 0 for _all_ transaction packages after downloading some files from the first repo. This code-block was moved to its correct place. Signed-off-by: Nagy Gabor <ngaba@bibl.u-szeged.hu> Signed-off-by: Dan McGee <dan@archlinux.org>
2010-05-06Compute package download size outside _alpm_sync_prepareJonathan Conder2-2/+16
And add a new info level for this piece of data. Signed-off-by: Jonathan Conder <j@skurvy.no-ip.org> Signed-off-by: Dan McGee <dan@archlinux.org>
2010-05-05Introduce -D, --databaseNagy Gabor2-6/+48
The request of FS#12950 is implemented. On the backend side, I introduced a new function, alpm_db_set_pkgreason(), to modify the install reason of a package in the local database. On the front-end side, I introduced a new main operation, -D/--database, which has two options, --asdeps and --asexplicit. I documented this in pacman manual. I've created two pactests to test -D: database001.py and database002.py. Signed-off-by: Nagy Gabor <ngaba@bibl.u-szeged.hu> Signed-off-by: Dan McGee <dan@archlinux.org>
2010-05-05Remove call to function loggerDan McGee1-3/+0
It isn't really necessary here and it helps us get rid of some link pollution so we can have a slim vercmp binary. Signed-off-by: Dan McGee <dan@archlinux.org>
2010-05-05Move vercmp code into a separate fileDan McGee3-172/+200
This will facilitate using this object file on its own in the vercmp tool which will be done in a future commit. The net impact on the generated binaries should not be noticeable after this commit. Signed-off-by: Dan McGee <dan@archlinux.org>
2010-03-26More consistent printing of off_t and time_tXavier Chantry3-7/+7
time_t : %ld off_t : %jd and cast to intmax_t Signed-off-by: Xavier Chantry <shiningxc@gmail.com> Signed-off-by: Dan McGee <dan@archlinux.org>
2010-03-26Sort and avoid duplicates in -Sii outputAllan McRae1-1/+4
Signed-off-by: Allan McRae <allan@archlinux.org> Signed-off-by: Dan McGee <dan@archlinux.org>
2010-03-26alpm_list_diff_sorted - make some arguments constAllan McRae2-5/+5
Signed-off-by: Allan McRae <allan@archlinux.org> Signed-off-by: Dan McGee <dan@archlinux.org>
2010-03-24Show 'Required By' in -Sii outputDan McGee1-9/+31
Just as we do in -Qi, we can compute required by information for sync database packages. The behavior seems sane; for a given package, the -Sii required by will show all packages in *any* sync database that require it. Implements FS#16244. Signed-off-by: Dan McGee <dan@archlinux.org>
2010-03-16Unbreak the database partial extraction codeDan McGee1-13/+9
Basically I'm the idiot that thought I could make it better and completely forgot how freeing the contents of the original lists would screw up our nice little diff extraction lists. This caused segfaults among other problems. Last time I try to do that... Program received signal SIGSEGV, Segmentation fault. 0x00007ffff627ce26 in strcmp () from /lib/libc.so.6 (gdb) bt Signed-off-by: Dan McGee <dan@archlinux.org>
2010-03-15Bump copyright dates to 2010Dan McGee56-56/+56
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-03-15fix a few warnings reported by clangXavier Chantry4-4/+5
- remove unused variables - some more sanity checks - safer printf Signed-off-by: Xavier Chantry <shiningxc@gmail.com> Signed-off-by: Dan McGee <dan@archlinux.org>
2010-03-15Reduce duplicate code in DB extractionDan McGee1-37/+26
Follow-up to the previous "Only extract new DB entries" patch; move the partial extraction code inside one side of the loop so we can use the same code for actually doing file extraction. Signed-off-by: Dan McGee <dan@archlinux.org>
2010-03-15Only extract new DB entriesXavier Chantry2-13/+156
This implements FS#15198. The idea apparently came from Csaba Henk <csaba-ml <at> creo.hu> which submitted a patch to Frugalware, so thanks to him, even though I did not look at the code :) The idea is to only extract folders for new packages into the package database and clean up the old directories. This is essentially implementing Xyne's "rebase" script within pacman. If using -Syy, just remove and extract everything. If using -Sy : 1. Generate list of directories in DB 2. Generate list of directories in archive 3. Compare both 4. Clean up old directories 5. Extract new directories Original-work-by: Allan McRae <allan@archlinux.org> Signed-off-by: Xavier Chantry <shiningxc@gmail.com> [Dan: fix compile error, s/int/size_t/] Signed-off-by: Dan McGee <dan@archlinux.org>
2010-03-15delta : add external cleanup scriptXavier Chantry2-3/+44
Signed-off-by: Xavier Chantry <shiningxc@gmail.com> Signed-off-by: Dan McGee <dan@archlinux.org>
2010-01-20Merge branch 'maint'Dan McGee1-0/+1
Just a slight touchup in makepkg due to the [ -> [[ conversion, so nothing to see here. Conflicts: scripts/makepkg.sh.in
2010-01-20NULL out handle after releaseDan McGee1-0/+1
We free'd the handle but didn't NULL out the global variable, leading to problems if you try to reinitialize the library. Make sure we clean up after ourselves. Signed-off-by: Dan McGee <dan@archlinux.org>
2009-12-14improve download_internal error messagesXavier Chantry1-2/+8
download_internal is supposed to always set pm_errno but did not in many cases. The most important (and tested) change is the one concerning fetchStat. This is typically where the code will fail when the network is down for example. Before commit d2dbb04a9af7a18da, this fetchStat call did not exist and the same kind of errors would be encountered in the fetchXGet call that follows. I just copied the error printing to restore the old behavior. Signed-off-by: Xavier Chantry <shiningxc@gmail.com> Signed-off-by: Dan McGee <dan@archlinux.org>
2009-12-14Print error on duplicated database entriesNagy Gabor1-0/+7
Some users reported duplicated database entries in /var/lib/pacman/local/, for example, both foo-1.0-1 and foo-2.0-1 subdirectories existed. (Bogus 3rd-party scripts, backup?) In this case pacman reported no error and its behaviour was mysterious. From now on, pacman detects this situation and prints an error message. Signed-off-by: Nagy Gabor <ngaba@bibl.u-szeged.hu> Signed-off-by: Dan McGee <dan@archlinux.org>
2009-12-08Fix requiredby outputDan McGee1-1/+1
This is a bit embarrassing. For example: $ pacman -Qi mesa ... Required By : mesa mesa mesa mesa mesa mesa Something is clearly not right, and the problem was introduced in commit 0bc961. Fix the issue by getting the package name off the correct variable. Signed-off-by: Dan McGee <dan@archlinux.org>
2009-11-16download: major refactor to address lingering issuesDan McGee4-154/+131
Sorry for this being such a huge patch, but I believe it is necessary for quite a few reasons which I will attempt to explain herein. I've been mulling this over for a while, but wasn't super happy with making the download interface more complex. Instead, if we carefully order things in the internal download code, we can actually make the interface simpler. 1. FS#15657 - This involves `name.db.tar.gz.part` files being left around the filesystem, and then causing all sorts of issues when someone attempts to rerun the operation they canceled. We need to ensure that if we resume a download, we are resuming it on exactly the same file; if we cannot be almost postive of that then we need to start over. 2. http://www.mail-archive.com/pacman-dev@archlinux.org/msg03536.html - Here we have a lighttpd bug to ruin the day. If we send both a Range: header and If-Modified-Since: header across the wire in a GET request, lighttpd doesn't do what we want in several cases. If the file hadn't been modified, it returns a '304 Not Modified' instead of a '206 Partial Content'. We need to do a stat (e.g. HEAD in HTTP terms) operation here, and the proceed accordingly based off the values we get back from it. 3. The mtime stuff was rather ugly, and relied on the called function to write back to a passed in reference, which isn't the greatest. Instead, use the power of the filesystem to contain this info. Every file downloaded internally is now carefully timestamped with the remote file time. This should allow the resume logic to work. In order to guarantee this, we need to implement a signal handler that catches interrupts, notifies the running code, and causes it to set the mtimes on the file. It then rethrows the signal so the pacman signal handler (or any frontend) works as expected. 4. We did a lot of funky stuff in trying to track the DB last modified time. It is a lot easier to just keep the downloaded DB file around and track the time on that rather than in a funky dot file. It also kills a lot of code. 5. For GPG verification of the databases down the road, we are going to need the DB file around for at least a short bit of time anyway, so this gets us closer to that. Signed-off-by: Dan McGee <dan@archlinux.org> [Xav: fixed printf with off_t] Signed-off-by: Xavier Chantry <shiningxc@gmail.com>
2009-11-16Refactor 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-16Add Catalan translationManuel Tortosa2-0/+570
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-11-11Merge branch 'maint'Dan McGee1-1/+2
2009-10-28Fix 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-21dload.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-12use 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-08Update Swedish translationv3.3.2Christian Larsson1-10/+10
Signed-off-by: Xavier Chantry <shiningxc@gmail.com> Signed-off-by: Dan McGee <dan@archlinux.org>
2009-10-08Update 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-08New Greek translationXavier Chantry2-0/+557
Signed-off-by: Xavier Chantry <shiningxc@gmail.com> Signed-off-by: Dan McGee <dan@archlinux.org>