summaryrefslogtreecommitdiff
path: root/lib/libalpm
Commit message (Collapse)AuthorAge
* Update Turkish translationSamed Beyribey2010-06-04
| | | | Signed-off-by: Dan McGee <dan@archlinux.org>
* translation: update pot/po files for libalpm in prep for releaseDan McGee2010-06-04
| | | | Signed-off-by: Dan McGee <dan@archlinux.org>
* fix memory leak in _alpm_sync_commitJonathan Conder2010-05-18
| | | | | Signed-off-by: Jonathan Conder <j@skurvy.no-ip.org> Signed-off-by: Dan McGee <dan@archlinux.org>
* Partial fix for the phonon/qt issueNagy Gabor2010-05-18
| | | | | | | | | | | | | | | | | 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>
* Fix a serious bug in the download codeNagy Gabor2010-05-14
| | | | | | | | | | | | 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>
* Compute package download size outside _alpm_sync_prepareJonathan Conder2010-05-05
| | | | | | | 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>
* Introduce -D, --databaseNagy Gabor2010-05-05
| | | | | | | | | | | | | 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>
* Remove call to function loggerDan McGee2010-05-04
| | | | | | | 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>
* Move vercmp code into a separate fileDan McGee2010-05-04
| | | | | | | | 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>
* More consistent printing of off_t and time_tXavier Chantry2010-03-25
| | | | | | | | 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>
* Sort and avoid duplicates in -Sii outputAllan McRae2010-03-25
| | | | | Signed-off-by: Allan McRae <allan@archlinux.org> Signed-off-by: Dan McGee <dan@archlinux.org>
* alpm_list_diff_sorted - make some arguments constAllan McRae2010-03-25
| | | | | Signed-off-by: Allan McRae <allan@archlinux.org> Signed-off-by: Dan McGee <dan@archlinux.org>
* Show 'Required By' in -Sii outputDan McGee2010-03-23
| | | | | | | | | | 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>
* Unbreak the database partial extraction codeDan McGee2010-03-15
| | | | | | | | | | | | | 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>
* Bump copyright dates to 2010Dan McGee2010-03-14
| | | | Signed-off-by: Dan McGee <dan@archlinux.org>
* fix a few warnings reported by clangXavier Chantry2010-03-14
| | | | | | | | | - 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>
* Reduce duplicate code in DB extractionDan McGee2010-03-14
| | | | | | | | 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>
* Only extract new DB entriesXavier Chantry2010-03-14
| | | | | | | | | | | | | | | | | | | | | | | | 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>
* delta : add external cleanup scriptXavier Chantry2010-03-14
| | | | | Signed-off-by: Xavier Chantry <shiningxc@gmail.com> Signed-off-by: Dan McGee <dan@archlinux.org>
* Merge branch 'maint'Dan McGee2010-01-19
|\ | | | | | | | | | | | | | | Just a slight touchup in makepkg due to the [ -> [[ conversion, so nothing to see here. Conflicts: scripts/makepkg.sh.in
| * NULL out handle after releaseDan McGee2010-01-19
| | | | | | | | | | | | | | | | 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>
* | improve download_internal error messagesXavier Chantry2009-12-13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* | Print error on duplicated database entriesNagy Gabor2009-12-13
| | | | | | | | | | | | | | | | | | | | | | | | 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>
* | Fix requiredby outputDan McGee2009-12-07
| | | | | | | | | | | | | | | | | | | | | | | | 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>
* | download: major refactor to address lingering issuesDan McGee2009-11-15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* | Refactor do/while cycle and multiple while cyclesLaszlo Papp2009-11-15
| | | | | | | | | | | | | | | | * 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>
* | Add Catalan translationManuel Tortosa2009-11-15
| | | | | | | | Signed-off-by: Dan McGee <dan@archlinux.org>
* | Merge branch 'maint'Dan McGee2009-11-10
|\|
| * 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>
* | Fix a small typo in alpm_list.cLaszlo Papp2009-10-24
| | | | | | | | | | Signed-off-by: Laszlo Papp <djszapi@archlinux.us> Signed-off-by: Dan McGee <dan@archlinux.org>
* | Reduce unnecessary get_name() function callsDan McGee2009-10-24
| | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* | dload.c : clear sigaction flag to make valgrind happyXavier Chantry2009-10-20
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* | Size handling was changed in fgets() functionsLaszlo Papp2009-10-19
| | | | | | | | | | | | | | | | 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>
* | use bitwise shift operator in enum "bit field"solsTiCe d'Hiver2009-10-11
| | | | | | | | | | | | | | | | 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>
* | Fix "-Sd conflict_pkg" bugNagy Gabor2009-10-11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* | alpm_list : add new alpm_list_diff_sorted functionXavier Chantry2009-10-11
| | | | | | | | | | | | | | | | | | | | | | | | 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>
* | Rework the alpm_unpack functionsXavier Chantry2009-10-11
| | | | | | | | | | | | | | Add support to extract a list of entries Signed-off-by: Xavier Chantry <shiningxc@gmail.com> Signed-off-by: Dan McGee <dan@archlinux.org>
* | cygwin fix : use unsigned char for ctype functionXavier Chantry2009-10-11
| | | | | | | | | | | | | | | | | | | | | | | | 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>
* | libalpm: clean up lock functionDan McGee2009-10-11
| | | | | | | | | | | | | | 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>
* | Reduce calls to list_count() in removing packageDan McGee2009-10-11
| | | | | | | | | | | | | | | | 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>
* | Add missing get_usedelta() methodDan McGee2009-10-11
| | | | | | | | Signed-off-by: Dan McGee <dan@archlinux.org>
* | typing: a few more fixes for special int typesDan McGee2009-10-11
| | | | | | | | Signed-off-by: Dan McGee <dan@archlinux.org>
* | int typing: s/unsigned short/int/ in libalpmDan McGee2009-10-11
| | | | | | | | | | | | | | | | | | | | 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>
* | Merge branch 'maint'Dan McGee2009-10-11
|\|
| * alpm_list : fix a bug in alpm_list_removeXavier Chantry2009-10-11
| | | | | | | | | | | | | | 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>
| * Update Chinese translation甘露(Lu.Gan)2009-10-11
| | | | | | | | | | Signed-off-by: Xavier Chantry <shiningxc@gmail.com> Signed-off-by: Dan McGee <dan@archlinux.org>
| * Update Swedish translationChristian Larsson2009-10-07
| | | | | | | | | | Signed-off-by: Xavier Chantry <shiningxc@gmail.com> Signed-off-by: Dan McGee <dan@archlinux.org>
| * Update chinese translation甘露(Lu.Gan)2009-10-07
| | | | | | | | | | Signed-off-by: Xavier Chantry <shiningxc@gmail.com> Signed-off-by: Dan McGee <dan@archlinux.org>
| * New Greek translationXavier Chantry2009-10-07
| | | | | | | | | | Signed-off-by: Xavier Chantry <shiningxc@gmail.com> Signed-off-by: Dan McGee <dan@archlinux.org>
| * Update translationsXavier Chantry2009-10-07
| | | | | | | | | | Signed-off-by: Xavier Chantry <shiningxc@gmail.com> Signed-off-by: Dan McGee <dan@archlinux.org>