summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAge
* Pull option names out of messages in config parsingDan McGee2011-09-22
| | | | | | | This allows some message reuse, as well as making it clear to translators what *not* to translate. Signed-off-by: Dan McGee <dan@archlinux.org>
* Check capabilities in SigLevel option parsingDan McGee2011-09-22
| | | | | | Only allow turning it on if the backend library has support for it. Signed-off-by: Dan McGee <dan@archlinux.org>
* Add alpm_capabilities() method and enumerationDan McGee2011-09-22
| | | | | | | | This allows a frontend program to query, at runtime, what the library supports. This can be useful for sanity checking during config- requiring a downloader or disallowing signature settings, for example. Signed-off-by: Dan McGee <dan@archlinux.org>
* Move default siglevel value from backend to frontendDan McGee2011-09-22
| | | | | | | | | | | | | | | This takes the libraries hidden default out of the equation: hidden in the sense that we can't even find out what it is until we create a handle. This is a chicken-and-egg problem where we have probably already parsed the config, so it is hard to get the bitmask value right. Move it to the frontend so the caller can do whatever the heck they want. This also exposes a shortcoming where the frontend doesn't know if the library even supports signatures, so we should probably add a alpm_capabilities() method which exposes things like HAS_DOWNLOADER, HAS_SIGNATURES, etc. Signed-off-by: Dan McGee <dan@archlinux.org>
* validate_deltas: split verify/check errors loopsDan McGee2011-09-22
| | | | | | | | | | | | | | | | This allows us to do all delta verification up front, followed by whatever needs to be done with any found errors. In this case, we call prompt_to_delete() for each error. Add back the missing EVENT(ALPM_EVENT_DELTA_INTEGRITY_DONE) that accidentally got removed in commit 062c391919e93f1d6. Remove use of *data; we never even look at the stuff in this array for the error code we were returning and this would be much better handled by one callback per error anyway, or at least some strongly typed return values. Signed-off-by: Dan McGee <dan@archlinux.org>
* Fix possible segfault if siglist was emptyDan McGee2011-09-22
| | | | | | | | If siglist->results wasn't a NULL pointer, we would try to free it anyway, even if siglist->count was zero. Only attempt to free this pointer if we had results and the pointer is valid. Signed-off-by: Dan McGee <dan@archlinux.org>
* Remove noisy debug loggerDan McGee2011-09-21
| | | | | | | | This one can be overwhelming when reading debug output from a very large package. We already have the output of each extracted file so we probably can do without this in 99.9% of cases. Signed-off-by: Dan McGee <dan@archlinux.org>
* Fix int/size_t type in alpm_list_count() callDan McGee2011-09-20
| | | | | | | alpm_list_count() returns size_t, which we should use to store the result since it is easy enough to format for printing. Signed-off-by: Dan McGee <dan@archlinux.org>
* _alpm_sync_commit: extract two static methodsDan McGee2011-09-20
| | | | | | | | This adds two new static methods, check_validity() and load_packages(), to sync.c which are simply code fragments pulled out of our do-everything sync commit code. Signed-off-by: Dan McGee <dan@archlinux.org>
* Pass package signature data up one more levelDan McGee2011-09-20
| | | | Signed-off-by: Dan McGee <dan@archlinux.org>
* signing: add a process and retry loop for database signaturesDan McGee2011-09-20
| | | | | | | | | | | | | | | | | | | | | | | In reality, there is no retrying that happens as of now because we don't have any import or changing of the keyring going on, but the code is set up so we can drop this in our new _alpm_process_siglist() function. Wire up the basics to the sync database validation code, so we see something like the following: $ pacman -Ss unknowntrust error: core: signature from "Dan McGee <dpmcgee@gmail.com>" is unknown trust error: core: signature from "Dan McGee <dpmcgee@gmail.com>" is unknown trust error: database 'core' is not valid (invalid or corrupted database (PGP signature)) $ pacman -Ss missingsig error: core: missing required signature error: core: missing required signature error: database 'core' is not valid (invalid or corrupted database (PGP signature)) Yes, there is some double output, but this should be fixable in the future. Signed-off-by: Dan McGee <dan@archlinux.org>
* Allow our PGP helper method to pass back the signature resultsDan McGee2011-09-20
| | | | | | | This will make its way up the call chain eventually to allow trusting and importing of keys as necessary. Signed-off-by: Dan McGee <dan@archlinux.org>
* Split package validation and load loopsDan McGee2011-09-20
| | | | | | | | | | This adds a some new callback event and progress codes for package loading, which was formerly bundled in with package validation before. The main sync.c loop where loading occurred is now two loops running sequentially. The behavior should not change with this patch outside of progress and event display; more changes will come in following patches. Signed-off-by: Dan McGee <dan@archlinux.org>
* Extract an _alpm_pkg_validate_internal() methodDan McGee2011-09-20
| | | | | | | | | _alpm_pkg_load_internal() was becoming a monster. Extract the top bit of the method that dealt with checksum and signature validation into a separate method that should be called before one loads a package to ensure it is valid. Signed-off-by: Dan McGee <dan@archlinux.org>
* pacman/upgrade: print 'loading packages...' only onceDave Reisner2011-09-20
| | | | | | | | Do this outside the loop to prevent the message from being displayed (and pluralized!) for each individual package. Signed-off-by: Dave Reisner <dreisner@archlinux.org> Signed-off-by: Dan McGee <dan@archlinux.org>
* pacman: use dynamic string allocation where it makes senseDan McGee2011-09-20
| | | | | | | | None of these are hot-code paths, and at least the target reading has little need for an arbitrary length limitation (however crazy it might be to have longer arguments). Signed-off-by: Dan McGee <dan@archlinux.org>
* utils/cleanupdelta: remove unneeded syncdbpathDan McGee2011-09-20
| | | | | | This variable was totally unused. Signed-off-by: Dan McGee <dan@archlinux.org>
* Remove all usages of alpm_list_getdata() from the libraryDan McGee2011-09-20
| | | | | | No need for the indirection; just access ->data instead. Signed-off-by: Dan McGee <dan@archlinux.org>
* _alpm_runscriptlet(): remove clean_tmpdir variableDan McGee2011-09-20
| | | | | | | This is always true at the end since we return early if we couldn't create the tmpdir, so it is totally unnecessary. Signed-off-by: Dan McGee <dan@archlinux.org>
* Access db->pkgcache directly in db_free_pkgcache()Dan McGee2011-09-20
| | | | | | | | We shouldn't be going through the accessor that does a bunch of unnecessary legwork, including potentially loading the pkgcache right before we free it. Signed-off-by: Dan McGee <dan@archlinux.org>
* Flip getcwd()/chdir() for open()/fchdir() in the frontendDan McGee2011-09-20
| | | | | | Just like we did in libalpm in commit 288a81d8470b1. Signed-off-by: Dan McGee <dan@archlinux.org>
* Use more efficient way of restoring working directoryDan McGee2011-09-19
| | | | | | | | | | | | Rather than using a string-based path, we can restore the working directory via a file descriptor and use of fchdir(). From the getcwd manpage: Opening the current directory (".") and calling fchdir(2) to return is usually a faster and more reliable alternative when sufficiently many file descriptors are available. Signed-off-by: Dan McGee <dan@archlinux.org>
* Reduce path allocation on the stack in local databaseDan McGee2011-09-19
| | | | | | | | | We did a lot of both malloc-ing and stack printing to form some paths in this code. Attempt to unify it all into the one get_pkgpath() method by adding an optional third "filename" parameter, and form the necessary path string all in one go. Signed-off-by: Dan McGee <dan@archlinux.org>
* Be smarter about running ldconfig during removal transactionsDan McGee2011-09-19
| | | | | | | | | | 1. Don't run it if something failed in package removal- this mirrors what we already do in sync transactions. 2. Don't run it if we are invoking it for the replaces removal bit of a sync transaction- it doesn't make sense to run ldconfig halfway through a sync install; we should only run it once at the end. Signed-off-by: Dan McGee <dan@archlinux.org>
* Search for non-prefixed paths in skip_remove listDan McGee2011-09-19
| | | | | | | We add them to this list with the root path not appended; we should be searching for them this way as well. Signed-off-by: Dan McGee <dan@archlinux.org>
* be_local: cope with a desc file without trailing newlineDan McGee2011-09-18
| | | | | | | | We checked the (fgets == NULL and !feof) case, but never actually bailed out of the loop if we were at the end of the file, causing infinite looping. Signed-off-by: Dan McGee <dan@archlinux.org>
* Remove const specifier from changelog_read() void parameterDan McGee2011-09-18
| | | | | | | | | | This shouldn't really be declared with const, and causes a compile error when -Wcast-qual is used. Remove the const specifier from the function specification and all implementations. Also fix one other trivial -Wcast-qual warning in _alpm_db_cmp(). Signed-off-by: Dan McGee <dan@archlinux.org>
* Remove dead changelog_feof() codeDan McGee2011-09-18
| | | | | | | We never ended up using or really needing this; kill it for now knowing it is in git history if ever needed again. Signed-off-by: Dan McGee <dan@archlinux.org>
* Add a random pactestDan McGee2011-09-18
| | | | Signed-off-by: Dan McGee <dan@archlinux.org>
* src/util: provide strndup definitions where neededDave Reisner2011-09-18
| | | | | Signed-off-by: Dave Reisner <dreisner@archlinux.org> Signed-off-by: Dan McGee <dan@archlinux.org>
* dload: avoid using memrchrDave Reisner2011-09-18
| | | | | | | | This function doesn't exist on OSX. Since there aren't any other candidates in alpm for which this function would make sense to use, simply replace the function call with a loop that does the equivalent. Signed-off-by: Dave Reisner <dreisner@archlinux.org>
* Ensure entire struct is zeroed in _alpm_parsedate()Dan McGee2011-09-18
| | | | | Signed-off-by: Dan McGee <dan@archlinux.org> Signed-off-by: Dave Reisner <dreisner@archlinux.org>
* pactree: include missing ctype.h headerDave Reisner2011-09-18
| | | | | | | needed for isspace() -- avoids warnings on OSX. Signed-off-by: Dave Reisner <dreisner@archlinux.org> Signed-off-by: Dan McGee <dan@archlinux.org>
* configure: Fix quoting in SEDINPLACE on DarwinDave Reisner2011-09-18
| | | | | | | | | single quotes expanded to nothing, leaving us with a command that assumed the sed expression was the backup suffix. Use a pair of escaped double quotes, which survives automake and ends up properly in makepkg. Signed-off-by: Dave Reisner <dreisner@archlinux.org> Signed-off-by: Dan McGee <dan@archlinux.org>
* dload: remove user:pass@ definition from hostnameDave Reisner2011-09-18
| | | | Signed-off-by: Dave Reisner <dreisner@archlinux.org>
* paccache: remove unnecessary if checkDave Reisner2011-09-18
| | | | | | | This is superfluous as the ensuing for loop will exit immediately on the same condition avoided by the if. Signed-off-by: Dave Reisner <dreisner@archlinux.org>
* Fix build without gpgmeDan McGee2011-09-18
| | | | Signed-off-by: Dan McGee <dan@archlinux.org>
* pacman: add short opt '-p' for --print to -{S,R}hDave Reisner2011-09-14
| | | | | Signed-off-by: Dave Reisner <dreisner@archlinux.org> Signed-off-by: Dan McGee <dan@archlinux.org>
* include ldconfig.stub in EXTRA_DISTDave Reisner2011-09-14
| | | | | | | | Since c51b9ca, ldconfig.stub is required by pactest so we need to include it as part of the dist tarball. Signed-off-by: Dave Reisner <dreisner@archlinux.org> Signed-off-by: Dan McGee <dan@archlinux.org>
* buildsys: remove existing symlinks before installingDave Reisner2011-09-14
| | | | | | | | | This fixes build errors when performing a manual install straight to a filesystem where the files already exist. Reported-by: Sergej Pupykin <ml@sergej.pp.ru> Signed-off-by: Dave Reisner <dreisner@archlinux.org> Signed-off-by: Dan McGee <dan@archlinux.org>
* Don't duplicate header stringsDan McGee2011-09-14
| | | | | | | There is no need to print them into buffers; we can use the values returned by gettext() directly without issue. Signed-off-by: Dan McGee <dan@archlinux.org>
* makepkg: fix recreation of hardlinks to .gz manpagesDave Reisner2011-09-14
| | | | | | | | | | | | | | | | | | | | 4ed12ae tightened up the logic to use only find, but ignored the fact that since the manpage hard link names were no longer captured. They were created as separate compressed manpages, rather than as hardlinks. This also introduces a minor efficiency of deleting all hardlinks at once and using proper iteration over an array rather than a string. Note to anyone else touching this code: e2fsprogs and libpcap are useful for testing this. If that changes in the future, you can use the below bash to locate others: IFS=$'\n' read -rd '' -a a < <(find /usr/share/man -type f \! -links 1) pacman -Qqo "${a[@]}" | sort -u I broke it! Signed-off-by: Dave Reisner <dreisner@archlinux.org>
* makepkg: add missing newline on passing gpg sourcecheckDave Reisner2011-09-14
| | | | | | | | When a sourceball passes this check without any warnings, a newline is omitted. Similar to the if clause of this else block, print a single new line at the end of the clause instead of accounting for each output. Signed-off-by: Dave Reisner <dreisner@archlinux.org>
* makepkg: check for var existance before file existanceDave Reisner2011-09-12
| | | | | | | This prevents makepkg from aborting with 'file not found' when changelog= or install= are declared in a PKGBUILD, but empty. Signed-off-by: Dave Reisner <dreisner@archlinux.org>
* account for partial delta files in download sizeDave Reisner2011-09-11
| | | | | | | | | Similar to an earlier commit which accounts for .part files for full packages, calculate the download_size for deltas keeping mind the possibility of a partial transfer. Signed-off-by: Dave Reisner <dreisner@archlinux.org> Signed-off-by: Dan McGee <dan@archlinux.org>
* make compute_download_size consider .part filesDave Reisner2011-09-11
| | | | | | | | | | | Check for the existance of a partial download of a package file before jumping to delta calculations. Currently, if there were 10MiB remaining in a 100MiB the values passed to the front end do not reflect this. Refactored from an old patch originally by Dan. Signed-off-by: Dave Reisner <dreisner@archlinux.org> Signed-off-by: Dan McGee <dan@archlinux.org>
* dload: provide optional netrc supportDave Reisner2011-09-11
| | | | | | | | | if ~/.netrc exists and has credentials for the hostname requested in a download, they will be provided in an http auth request. This can still be overridden by explcitly declaring user:pass in the URL. Signed-off-by: Dave Reisner <dreisner@archlinux.org> Signed-off-by: Dan McGee <dan@archlinux.org>
* makepkg: unset errexit when sourcing /etc/profileDave Reisner2011-09-11
| | | | | | | | | This is a fix for a bash3 specific bug, where a file sourced by /etc/profile would exit non-zero and make its way back up to makepkg, forcing it to exit after package installation. Along with unsetting the ERR handler, temporarily unset errexit to avoid this. Signed-off-by: Dave Reisner <dreisner@archlinux.org>
* paccache: escape . in trimming of diskspace stringDave Reisner2011-09-11
| | | | | | | | | | Before: ==> finished dry run: 2 candidates (diskspace saved: 7. MiB) After: ==> finished dry run: 2 candidates (diskspace saved: 7.8 MiB) Signed-off-by: Dave Reisner <dreisner@archlinux.org>
* download callback: show decimal places in rate if we have roomDan McGee2011-09-11
| | | | | | | | | | | | | | | | Display now looks like this, whereas before we would have just showed '2M/s' for the extra repository download. The cutoff is placed at 100.0 to ensure we only use 4 character slots of width (e.g. '99.9', '100'). :: Synchronizing package databases... testing 39.9 KiB 470K/s 00:00 [######################] 100% core 51.4 KiB 469K/s 00:00 [######################] 100% extra 768.8 KiB 2.1M/s 00:00 [######################] 100% community-testing 1941.0 B 54.4M/s 00:00 [######################] 100% multilib 26.6 KiB 458K/s 00:00 [######################] 100% community 449.8 KiB 1649K/s 00:00 [######################] 100% Signed-off-by: Dan McGee <dan@archlinux.org>