summaryrefslogtreecommitdiff
path: root/lib
Commit message (Collapse)AuthorAge
* libalpm/dload: major refactor of signature downloadingDan McGee2011-04-22
| | | | | | | | | | | | | | | | | | There's a lot of related moving parts here: * Iteration through mirrors is moved back to the calling functions. This allows removal of _alpm_download_single_file and _alpm_download_files. * The download function gets a few more arguments to influence behavior. This allows several different scenarios to customize behavior: - database - database signature (req'd and optional) - package - package via direct URL - package signature via direct URL (req'd and optional) * For databases, we need signatures from the same mirror, so structure the code accordingly. Some-inspiration-from: Dave Reisner <d@falconindy.com> Signed-off-by: Dan McGee <dan@archlinux.org>
* libalpm/dload: add allow_resume and reorder error checksDan McGee2011-04-22
| | | | | | | | | | | | | | | | | | | | | | | | | | | The allow_resume is the start of the fix to the "don't ever resume database downloads" problem, as well as being useful for '.sig' downloads as well. For now, we say "always allow resume", but this will eventually get pushed down as necessary. Error checks are reworked in order to correctly error out when a file is not found on the remote end and reports 0 bytes downloaded. In addition, the two error messages printed are now different as one reports a more specific error message provided via the cURL error buffer. Some example output from an -Sy run with [testing], [community], [community2], [eee], and [nonexistant] defined as repos. [community2] and [nonexistant] are both invalid, one using FTP and one using HTTP. :: Synchronizing package databases... testing is up to date community is up to date error: failed retrieving file 'community2.db' from ftp.archlinux.org : Given file does not exist error: failed to update community2 (FTP: couldn't retrieve (RETR failed) the specified file) eee is up to date error: failed retrieving file 'nonexistant.db' from code.toofishes.net : The requested URL returned error: 404 error: failed to update nonexistant (HTTP response code said error) Signed-off-by: Dan McGee <dan@archlinux.org>
* cleanup: add_pkg() and remove_pkg()Dan McGee2011-04-22
| | | | Signed-off-by: Dan McGee <dan@archlinux.org>
* libalpm/dload: const and static correctnessDan McGee2011-04-22
| | | | Signed-off-by: Dan McGee <dan@archlinux.org>
* be_sync: use _alpm_db_get_sigverify_level()Dan McGee2011-04-22
| | | | Signed-off-by: Dan McGee <dan@archlinux.org>
* sync.c: remove unnecessary check for PM_PGP_VERIFY_UNKNOWNRémy Oudompheng2011-04-21
| | | | | | | | | | The value PM_PGP_VERIFY_UNKNOWN is reserved to error cases, now that the signature verification level defaults to the globally set level. The only error case is when handle == NULL, which is false in the context of _alpm_sync_commit(). Signed-off-by: Rémy Oudompheng <remy@archlinux.org> Signed-off-by: Dan McGee <dan@archlinux.org>
* handle.c: force sigverify level not to be PM_PGP_VERIFY_UNKNOWNRémy Oudompheng2011-04-21
| | | | | Signed-off-by: Rémy Oudompheng <remy@archlinux.org> Signed-off-by: Dan McGee <dan@archlinux.org>
* alpm.h: add several missing documentation stringsRémy Oudompheng2011-04-21
| | | | Signed-off-by: Rémy Oudompheng <remy@archlinux.org>
* alpm.h: rationalize option getters/setters documentationRémy Oudompheng2011-04-21
| | | | Signed-off-by: Rémy Oudompheng <remy@archlinux.org>
* alpm.h: add/improve function documentationRémy Oudompheng2011-04-21
| | | | Signed-off-by: Rémy Oudompheng <remy@archlinux.org>
* Rename gpgsig struct fields for clarityDan McGee2011-04-20
| | | | Signed-off-by: Dan McGee <dan@archlinux.org>
* Form the signature file location in one placeDan McGee2011-04-20
| | | | | | Since we do this for all cases anyway. Signed-off-by: Dan McGee <dan@archlinux.org>
* Header inclusion cleanupDan McGee2011-04-20
| | | | | | | | This does touch a lot of things, and hopefully doesn't break things on other platforms, but allows us to also clean up a bunch of crud that no longer needs to be there. Signed-off-by: Dan McGee <dan@archlinux.org>
* syntax: if/while statements should have no trailing spaceDan McGee2011-04-20
| | | | | | | | | | | This is the standard, and we have had a few of these introduced lately that should not be here. Done with: find -name '*.c' | xargs sed -i -e 's#if (#if(#g' find -name '*.c' | xargs sed -i -e 's#while (#while(#g' Signed-off-by: Dan McGee <dan@archlinux.org>
* Allow VerifySig to act as a default verification in [options]Dave Reisner2011-04-20
| | | | | | | | | | * add _alpm_db_get_sigverify_level * add alpm_option_{get,set}_default_sigverify And set the default verification level to OPTIONAL if not set otherwise. Signed-off-by: Dave Reisner <d@falconindy.com> Signed-off-by: Dan McGee <dan@archlinux.org>
* alpm.h: forward-declare shared enumerationsDan McGee2011-04-20
| | | | Signed-off-by: Dan McGee <dan@archlinux.org>
* style cleanup: cast as (type *) not (type*)Dave Reisner2011-04-20
| | | | | Signed-off-by: Dave Reisner <d@falconindy.com> Signed-off-by: Dan McGee <dan@archlinux.org>
* lib: remove dead code in be_local and be_packageDave Reisner2011-04-20
| | | | Signed-off-by: Dave Reisner <d@falconindy.com>
* Put comments on their own lineDan McGee2011-04-20
| | | | Signed-off-by: Dan McGee <dan@archlinux.org>
* Merge branch 'maint'Dan McGee2011-04-20
|\
| * 3.5.2 translation updates from TransifexDan McGee2011-04-18
| | | | | | | | | | | | And also a POT version and package version update. Signed-off-by: Dan McGee <dan@archlinux.org>
* | Merge branch 'maint'Dan McGee2011-04-15
|\| | | | | | | | | | | | | | | Conflicts: lib/libalpm/alpm.h lib/libalpm/trans.c Signed-off-by: Dan McGee <dan@archlinux.org>
| * alpm.h: fix typos in documentationRémy Oudompheng2011-04-13
| | | | | | | | Signed-off-by: Rémy Oudompheng <remy@archlinux.org>
| * Remove Korean language translation filesDan McGee2011-04-12
| | | | | | | | | | | | | | There is no actual translation done here yet, just a dormant Transifex language with nothing checked in. Signed-off-by: Dan McGee <dan@archlinux.org>
| * alpm.h: document transaction flagsRémy Oudompheng2011-04-09
| | | | | | | | Signed-off-by: Rémy Oudompheng <remy@archlinux.org>
| * More documentation for option getters/setters.Rémy Oudompheng2011-04-09
| |
| * alpm.h: more documentation for pkgreason, depend and errno.Rémy Oudompheng2011-04-09
| |
| * Move documentation for public package function to alpm.hRémy Oudompheng2011-04-09
| |
| * alpm.h: organize doxygen documentation in groupsRémy Oudompheng2011-04-09
| |
| * Move documentation of public database functions to alpm.hRémy Oudompheng2011-04-09
| |
| * alpm.h: add documentation for package property accessorsRémy Oudompheng2011-04-09
| |
| * Move documentation of public transaction functions to alpm.hRémy Oudompheng2011-04-09
| |
| * Fix broken documentation for alpm_trans_prepare()Rémy Oudompheng2011-04-09
| | | | | | | | | | | | | | The current state of the code does not allow to see immediately that it returns a list of pmdepmissing_t structures. Signed-off-by: Dan McGee <dan@archlinux.org>
| * libalpm: set pm_errno correctly in alpm_trans_get_flags()Rémy Oudompheng2011-04-09
| | | | | | | | Signed-off-by: Dan McGee <dan@archlinux.org>
| * diskspace: add the actually used statfs type in ifdefsRémy Oudompheng2011-04-06
| | | | | | | | | | | | | | | | | | | | Some systems, like FreeBSD might define both statfs and statvfs: however if statvfs exists whereas getmntinfo() uses a statfs struct, the current ifdefs would select the wrong line of code. Signed-off-by: Rémy Oudompheng <remy@archlinux.org> Signed-off-by: Dan McGee <dan@archlinux.org>
* | Include "config.h" in header files using off_tDan McGee2011-04-15
| | | | | | | | | | | | | | | | This makes it absolutely dead easy to ensure off_t has the same length in all compilation units. I just spent 2.5 hours bashing my head on an issue related to this so damn it I'm fixing it for good. Signed-off-by: Dan McGee <dan@archlinux.org>
* | libalpm: consistently use int as return type for option settersRémy Oudompheng2011-04-15
| | | | | | | | | | | | | | | | Currently the only error case then when handle == NULL. However several handle functions return -1 on this error, and a uniform API makes things simpler. Signed-off-by: Rémy Oudompheng <remy@archlinux.org>
* | Remove indirection on get_name and get_version operationsDan McGee2011-04-15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | For a package to be loaded from any of our backends, these two fields are always required upfront. Due to this fact, we don't need them to be backend-specific operations and can just refer to the field directly. Additionally, our static (and thus private) cache package accessors had a NULL check on pkg before returning the relevant field. Eliminate this since they only way they are ever called is via the packages attached callback struct, which would have caused the NULL pointer dereference in the first place. Signed-off-by: Dan McGee <dan@archlinux.org>
* | Move graph.h functions into graph.cDan McGee2011-04-15
| | | | | | | | | | | | | | | | | | | | | | | | | | So we only need one copy in the final library, not one copy per time used. Ensure all necessary includes are in place (especially to get the right size of off_t each time it is compiled) by including "config.h" in the new graph.c. One small adjustment here makes the graph_free code more robust- ensure we don't have invalid pointers after each iteration by looking at the parents and children and adjusting accordingly. Signed-off-by: Dan McGee <dan@archlinux.org>
* | Don't create two pmpkg_t objects in be_packageDan McGee2011-04-11
| | | | | | | | | | | | | | | | | | Ensure we only have one- this looks like the result of a bad merge from old 2008 signing code with the current stuff which has changed quite a bit. Originally-seen-by: Rémy Oudompheng <remyoudompheng@gmail.com> Signed-off-by: Dan McGee <dan@archlinux.org>
* | Merge branch 'maint'Dan McGee2011-04-05
|\| | | | | | | | | | | | | Conflicts: lib/libalpm/be_sync.c lib/libalpm/db.c src/pacman/util.c
| * libalpm/be_local.c: unused variable entXavier Chantry2011-04-04
| | | | | | | | | | | | spotted by clang analyzer Signed-off-by: Xavier Chantry <chantry.xavier@gmail.com>
| * libalpm/pkghash.c: unused variable ptrXavier Chantry2011-04-04
| | | | | | | | | | | | spotted by clang analyzer Signed-off-by: Xavier Chantry <chantry.xavier@gmail.com>
| * db.c: set pm_errno appropriately in alpm_db_set_pkgreason()Rémy Oudompheng2011-04-04
| | | | | | | | | | Signed-off-by: Rémy Oudompheng <remy@archlinux.org> Signed-off-by: Dan McGee <dan@archlinux.org>
| * util.c: include limits.h for PATH_MAX macroRémy Oudompheng2011-04-02
| | | | | | | | | | Signed-off-by: Rémy Oudompheng <remy@archlinux.org> Signed-off-by: Dan McGee <dan@archlinux.org>
| * Fix compatibility with older versions of libarchive.Rémy Oudompheng2011-04-02
| | | | | | | | | | | | | | | | | | There is no reason to not support versions of libarchive that lack ARCHIVE_COMPRESSION_UU. Distributions should work properly without this. Signed-off-by: Rémy Oudompheng <remy@archlinux.org> Signed-off-by: Dan McGee <dan@archlinux.org>
| * Add default changelog functions to pkg_operationsDan McGee2011-04-01
| | | | | | | | | | | | | | | | So we don't segfault when calling this on be_sync loaded packages. They return logical values as much as possible for indicating there is no changelog available. Signed-off-by: Dan McGee <dan@archlinux.org>
| * Ensure dbpath is not null when populating sync databaseDan McGee2011-04-01
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We didn't do this sanity check before trying to open an archive. If the alpm dbpath wasn't set, the sync database dbpath would be NULL, causing us to hang indefinitely in archive_read_open_filename() rather than erroring out. We already have a corresponding check in local_db_populate(). The following program will test this case, and hangs before this patch without the call to set_dbpath: int main(int argc, char *argv[]) { alpm_initialize(); // alpm_option_set_dbpath("/var/lib/pacman/"); pmdb_t *core = alpm_db_register_sync("core"); pmpkg_t *pkg = alpm_db_get_pkg(core, "pacman"); return 0; } Signed-off-by: Dan McGee <dan@archlinux.org>
| * Ignore upcoming new values in sync backendDan McGee2011-04-01
| | | | | | | | | | | | | | PGPSIG and SHA256SUM are new and we can safely ignore them for now if we come across them. Signed-off-by: Dan McGee <dan@archlinux.org>
* | dload: dont forget to initialize open_modeXavier Chantry2011-04-02
| | | | | | | | | | | | | | | | | | | | | | That's a funny one, building with optimization levels (with both gcc and clang) caused open_mode to always be set to "ab", which worked. This was spotted both with clang-analyzer, and by Jakob who reported a segfault as he was using an un-optimized build. Signed-off-by: Xavier Chantry <chantry.xavier@gmail.com> Signed-off-by: Dan McGee <dan@archlinux.org>