summaryrefslogtreecommitdiffstats
path: root/lib
AgeCommit message (Collapse)AuthorFilesLines
2011-03-31Unify filelist operation functions in conflict checkingDan McGee1-51/+25
We had two functions that were oh so similar but slightly different. We can combine them and add some conditional operation stuff to decide what to return. Signed-off-by: Dan McGee <dan@archlinux.org>
2011-03-29Merge branch 'maint'Dan McGee3-4/+28
2011-03-29alpm/handle.c: ensure handle is not NULL before proceedingRémy Oudompheng2-0/+27
Many alpm_option_get/set_*() functions already check this and set pm_errno to the right value, but not all, so this improves consistency. Signed-off-by: Rémy Oudompheng <remy@archlinux.org> Signed-off-by: Dan McGee <dan@archlinux.org>
2011-03-29Fix an outdated commentDan McGee1-4/+1
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-03-28Temporary fix for new warnings from gcc 4.6Dan McGee2-2/+4
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-03-28Merge branch 'maint'Dan McGee3-99/+99
Conflicts: lib/libalpm/deps.c
2011-03-28lib/dload: abstract out helper function to set utimesDave Reisner1-22/+22
This greatly simplifies the cleanup fallthrough in our download function and we'll be able to reuse this for signatures. Signed-off-by: Dave Reisner <d@falconindy.com> Signed-off-by: Dan McGee <dan@archlinux.org>
2011-03-28lib/dload: remove proxy debug outputDave Reisner1-6/+0
Signed-off-by: Dave Reisner <d@falconindy.com> Signed-off-by: Dan McGee <dan@archlinux.org>
2011-03-28lib/dload: code simplificationDave Reisner1-11/+8
Based on the fact that localf always points to the same file, there's no need to code in multiple fopen calls with varying results. Instead, track the desired file open mode and make a single call to fopen. Signed-off-by: Dave Reisner <d@falconindy.com> Signed-off-by: Dan McGee <dan@archlinux.org>
2011-03-28lib/dload: merge get_{destfile,tempfile} into get_fullpathDave Reisner1-20/+13
Create a more general function that allows appending a suffix to a filepath. Signed-off-by: Dave Reisner <d@falconindy.com> Signed-off-by: Dan McGee <dan@archlinux.org>
2011-03-28pacman/pacman.c: fix setting of useragent stringDave Reisner1-1/+6
libcurl doesn't natively honor the HTTP_USER_AGENT environment variable. Signed-off-by: Dave Reisner <d@falconindy.com> Signed-off-by: Dan McGee <dan@archlinux.org>
2011-03-28lib/dload: pass a struct with filename and size to curl_progressDave Reisner2-13/+27
This lets us determine the real size of the file on disk so that we can properly bump the progress bar when we're resuming a download. Signed-off-by: Dave Reisner <d@falconindy.com> Signed-off-by: Dan McGee <dan@archlinux.org>
2011-03-25Ensure reported missing dependencies show correct version comparisonDan McGee2-35/+38
This addresses FS#23424. The -dd backend code was introduced in commit b6ec9019d77, and unfortunately the munged depend used for comparison did not carry through to the eventual display of this version. To fix this, we undo some of the depcmp_tolerant() business introduced, and instead make a new pmdepend_t object if necessary when the no dependency version flag is set. This results in the correct depend being copied to the missing depend passed onto the frontend. Signed-off-by: Dan McGee <dan@archlinux.org>
2011-03-25Mark various functions in deps.c staticDan McGee2-32/+27
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-03-25Move alpm_find_dbs_satisfier() function down in deps.cDan McGee1-23/+24
This will make sense for a later commit when static/non-static properties of other functions are changed. Signed-off-by: Dan McGee <dan@archlinux.org>
2011-03-25Rework find_requiredby() to not use _alpm_dep_edge()Dan McGee1-8/+8
And move the sort after the final loop; we don't need to sort once for each database we look at. Signed-off-by: Dan McGee <dan@archlinux.org>
2011-03-25Don't include version in dep string if mod == ANYDan McGee1-2/+3
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-03-25Merge branch 'maint'Dan McGee2-6/+11
2011-03-24alpm/db: do not close local DB in alpm_db_unregister_allDave Reisner2-6/+11
pacman 3.5.0 removed alpm_db_register_local, so calling alpm_db_unregister_all leaves the front end in a position where there's no local db, and no way to re-register it. Signed-off-by: Dave Reisner <d@falconindy.com> Signed-off-by: Dan McGee <dan@archlinux.org>
2011-03-24Do not reuse old signatureAllan McRae2-3/+10
After updating a database, remove the old signature to prevent it being used in validation if the new signature fails to download. Signed-off-by: Allan McRae <allan@archlinux.org>
2011-03-24Download and verify package database signaturesAllan McRae1-6/+38
If signature verification is needed, attempt to download a signature file for a repo when it is updated. Return an error if unable to download signature only when checking is mandatory, or if signature is invalid. TODO: At the moment the database signature is only checked on download. Should we do anything with a database if it fails to be verified to prevent its future usage? Signed-off-by: Allan McRae <allan@archlinux.org>
2011-03-24Refactor signature loading code into common functionDan McGee4-81/+65
We can use this for both standalone package signatures as well as standalone database signatures. Signed-off-by: Dan McGee <dan@archlinux.org>
2011-03-24Add functions for verifying database signatureAllan McRae6-37/+124
Add a pmpgpsig_t struct to the database entry struct and functions for the lazy loading of database signatures. Add a function for checking database signatures, reusing (and generalizing) the code currently used for checking package signatures. TODO: The code for reading in signature files from the filesystem is duplicated for local packages and database and needs refactoring. Signed-off-by: Allan McRae <allan@archlinux.org>
2011-03-23lib/dload.c: Check for dlcb == NULL earlierDave Reisner1-10/+12
Our curl callback does a whole lot of work for nothing if the front end never defined a callback to receive the data we'd calculate for it. Signed-off-by: Dave Reisner <d@falconindy.com> Signed-off-by: Dan McGee <dan@archlinux.org>
2011-03-23lib/dload.c: don't use deprecated curl symbolsDave Reisner1-1/+1
CURLINFO_HTTP_CODE is deprecated in favor of CURLINFO_RESPONSE_CODE. Both yield the same values. Signed-off-by: Dave Reisner <d@falconindy.com> Signed-off-by: Dan McGee <dan@archlinux.org>
2011-03-23lib/dload.c: don't request compressed transportDave Reisner1-1/+0
The files we transfer are generally compressed already, so this just adds unnecessary overhead. Signed-off-by: Dave Reisner <d@falconindy.com> Signed-off-by: Dan McGee <dan@archlinux.org>
2011-03-23lib/dload.c: Fix progress callback issues on downloadDave Reisner1-5/+15
Use a static variable to effectively track the initialization state of the progress callback via the last byte amount reported as downloaded by libcurl. Signed-off-by: Dave Reisner <d@falconindy.com> Signed-off-by: Dan McGee <dan@archlinux.org>
2011-03-23lib/dload.c: fix compiler warnings generated by -Wfloat-equalDave Reisner2-3/+8
* introduces new macro in util.h (DOUBLE_EQ) for properly comparing floating point values Signed-off-by: Dave Reisner <d@falconindy.com> Signed-off-by: Dan McGee <dan@archlinux.org>
2011-03-23buildsys: use libcurl's m4 macro for buildtime detectionDave Reisner1-1/+1
Signed-off-by: Dave Reisner <d@falconindy.com> Signed-off-by: Dan McGee <dan@archlinux.org>
2011-03-23Report output from signature checking to debug logAllan McRae1-11/+11
Move the (possibly still temporary) output generated during signature checking into the --debug output. Signed-off-by: Allan McRae <allan@archlinux.org> Signed-off-by: Dan McGee <dan@archlinux.org>
2011-03-23Added gpg verification options per repo to the config file.Xavier Chantry5-5/+44
Once we do this, add support for VerifySig to pactest. We just check if the repo name contains Always, Never or Optional to determine the value of VerifySig. The default is Never. pacman uses Always by default but this is not suitable for pactest. Original-work-by: shankar <jatheendra@gmail.com> Signed-off-by: Xavier Chantry <shiningxc@gmail.com> Signed-off-by: Dan McGee <dan@archlinux.org>
2011-03-23Remove unnecessary sanity check on db->setserverDan McGee1-12/+0
We pass in a db object, so no need to go looking for it in the list on the handle. This is a remnant of when we passed in a treename, more than likely. Signed-off-by: Dan McGee <dan@archlinux.org>
2011-03-23Integrate GPGME into libalpmDan McGee6-16/+282
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-03-23Add some error codes for signature verificationDan McGee2-0/+8
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-03-23Add signature directory as option on libalpm handleDan McGee3-0/+32
This will serve as the home directory we pass to GPGME when making calls so we can have a libalpm-utilized keyring. Signed-off-by: Dan McGee <dan@archlinux.org>
2011-03-23Actually read PGPSIG field in sync DB codeDan McGee1-0/+2
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-03-23Merge branch 'gpg-libalpm-basics'Dan McGee7-1/+360
2011-03-23Remove libfetch error codeDan McGee1-1/+0
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-03-23Read in .sig files when opening a package fileDan McGee1-1/+48
If a .sig file sits side-by-side on the filesystem with a package archive, read it in during the package struct creation process so we can verify it at a later time if necessary. Signed-off-by: Dan McGee <dan@archlinux.org> Signed-off-by: Allan McRae <allan@archlinux.org>
2011-03-23Allow PGP signature to be read from sync databaseDan McGee3-0/+53
Add a new field to the package struct to hold PGP information and instruct db_read to pick it up from the database. It is currently unused internally but this is the first step. Due to the fact that we store the PGP sig as binary data, we need to store both the data and the length so we have a small utility struct to assist us. Signed-off-by: Dan McGee <dan@archlinux.org> Signed-off-by: Allan McRae <allan@archlinux.org>
2011-03-23Add base64 algorithms from PolarSSL to libalpmDan McGee3-0/+259
We will need these for GPG functionality (decoding the base64 encoded signature stored in the databases). Signed-off-by: Dan McGee <dan@archlinux.org> Signed-off-by: Allan McRae <allan@archlinux.org>
2011-03-23Merge branch 'gpg-build-tools'Dan McGee1-0/+3
2011-03-23repo-add: add sha256sum values to repo databaseDan McGee1-0/+3
Implements FS#23103. Also modify libalpm so it ignores this value without any warning as we know it is likely to exist. Signed-off-by: Dan McGee <dan@archlinux.org>
2011-03-23Merge branch 'maint'Dan McGee30-140/+1351
2011-03-23Updated 3.5.1 translations from TransifexDan McGee25-136/+231
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-03-23Add new Serbian translation from TransifexSlobodan Terzić3-0/+1106
Thanks! Signed-off-by: Dan McGee <dan@archlinux.org>
2011-03-21Minor code cleanupsDan McGee1-3/+6
Wrap lines of long length, noticed while creating and messing around with some of the other maint branch patches. Signed-off-by: Dan McGee <dan@archlinux.org>
2011-03-21Ensure package removal list does not contain duplicatesDan McGee1-1/+5
Noticed with the openoffice/libreoffice replacement scheme where many packages are listed as replacements to one package, thus electing it for removal multiple times. Ensure a given package is not already present before placing it in the removal list. Signed-off-by: Dan McGee <dan@archlinux.org>
2011-03-21Fix line_offset not being reset in _alpm_archive_fgets()Dan McGee1-0/+3
This is a rather serious data corruption issue that luckily manifested itself today in a noticable way. A package in testing had replaces entries read in as ["%RE pkgname", "%RE"] which was clearly wrong. This happens when we hit the end of an archive block, do not have a newline, and have to continue reading from the next block to complete the line. Signed-off-by: Dan McGee <dan@archlinux.org>
2011-03-21Merge branch 'maint'Dan McGee3-4/+8
Conflicts due to change in return calling style. Conflicts: src/pacman/pacman.c src/pacman/sync.c