summaryrefslogtreecommitdiffstats
AgeCommit message (Collapse)AuthorFilesLines
2011-08-22dload: prevent need to copy struct in mask_signal()Dan McGee1-7/+6
Since we store this directly in the download function, just rework mask_signal() to take a pointer to a location to store the original. Signed-off-by: Dan McGee <dan@archlinux.org>
2011-08-22dload: extract tempfile creation to its own functionDave Reisner1-17/+28
Signed-off-by: Dave Reisner <dreisner@archlinux.org> Signed-off-by: Dan McGee <dan@archlinux.org>
2011-08-22dload: move (un)masking of signals to separate functionsDave Reisner1-17/+24
Signed-off-by: Dave Reisner <dreisner@archlinux.org> Signed-off-by: Dan McGee <dan@archlinux.org>
2011-08-22dload: move curl option setting to static functionDave Reisner1-42/+48
Signed-off-by: Dave Reisner <dreisner@archlinux.org> Signed-off-by: Dan McGee <dan@archlinux.org>
2011-08-22dload: add open_mode to payload structDave Reisner2-4/+6
This is a precursor to a following patch which will move the setting of options to a separate function. With the open mode as part of the struct, we can avoid modifying stack allocated variables. Signed-off-by: Dave Reisner <dreisner@archlinux.org> Signed-off-by: Dan McGee <dan@archlinux.org>
2011-08-22dload: rename cd_filename to content_disp_nameDave Reisner2-5/+5
This is more in line with the menagerie of file name members that we now have on the payload struct. Signed-off-by: Dave Reisner <dreisner@archlinux.org> Signed-off-by: Dan McGee <dan@archlinux.org>
2011-08-22dload: move tempfile and destfile to payload structDave Reisner2-26/+31
These are private to the download operation already, so glob them onto the struct. This is an ugly rename patch, with the only logical change being that destfile and tempfile are now freed by the payload_free function. Signed-off-by: Dave Reisner <dreisner@archlinux.org> Signed-off-by: Dan McGee <dan@archlinux.org>
2011-08-22pacman/util: use string_length to calculate line lengthDave Reisner1-1/+1
This is measuring strings that are potentially localized, so we need a multibyte aware function to count characters instead of bytes. Signed-off-by: Dave Reisner <dreisner@archlinux.org> Signed-off-by: Dan McGee <dan@archlinux.org>
2011-08-22Print callback messages to stderrAllan McRae1-1/+1
Fixes FS#25099. Signed-off-by: Allan McRae <allan@archlinux.org> Signed-off-by: Dan McGee <dan@archlinux.org>
2011-08-22Print debug timestamps to same stream as rest of outputDan McGee1-1/+1
We used fprintf() elsewhere in this function, but we didn't use it on the debug timestamp printing. Use fprintf() instead of printf() to fix this. Signed-off-by: Dan McGee <dan@archlinux.org>
2011-08-22pacsort: correct list freeingPang Yan Han1-1/+1
Signed-off-by: Pang Yan Han <pangyanhan@gmail.com> Signed-off-by: Dan McGee <dan@archlinux.org>
2011-08-22pacsort: ensure list is freed if size is 0Dan McGee1-1/+1
Found using: `valgrind ./src/util/.libs/lt-pacsort /dev/null` Signed-off-by: Dan McGee <dan@archlinux.org>
2011-08-22pacsort: correct pointer type in list_newPang Yan Han1-2/+2
Pointer sizes are the same but this makes intention clearer. Signed-off-by: Pang Yan Han <pangyanhan@gmail.com> Signed-off-by: Dan McGee <dan@archlinux.org>
2011-08-19Remove alpm_option_get_* usage from backendDan McGee6-13/+11
These are all available directly on the handle without indirection. Signed-off-by: Dan McGee <dan@archlinux.org>
2011-08-19dload: remove unused macroDave Reisner1-1/+0
This was a vestige leftover from the libfetch days of yore. Signed-off-by: Dave Reisner <dreisner@archlinux.org> Signed-off-by: Dan McGee <dan@archlinux.org>
2011-08-19dload: delete zero length downloads on curl errorDave Reisner1-0/+4
In the case of a non-operation (e.g. DNS resolver error), delete the leftover 0 byte .part file. Signed-off-by: Dave Reisner <dreisner@archlinux.org> Signed-off-by: Dan McGee <dan@archlinux.org>
2011-08-19dload: rename payload->filename to payload->remote_nameDave Reisner3-17/+17
This is a far more accurate description of what this is, since it's more than likely not really a filename at all, but the name after a final slash on a URL. Signed-off-by: Dave Reisner <dreisner@archlinux.org> Signed-off-by: Dan McGee <dan@archlinux.org>
2011-08-19dload: remove code duplicationDave Reisner1-5/+5
Signed-off-by: Dave Reisner <dreisner@archlinux.org> Signed-off-by: Dan McGee <dan@archlinux.org>
2011-08-19bash_completion: add dbonly to sync optionsDave Reisner1-1/+1
Signed-off-by: Dave Reisner <dreisner@archlinux.org> Signed-off-by: Dan McGee <dan@archlinux.org>
2011-08-19Rework finding a writable cache directoryDan McGee1-15/+29
This is a refactor and refresh of the code used to find where we should download packages. * Incorporate suggestions from FS#25435 to use TMPDIR from the environment if set, otherwise fall back to /tmp as before. * Make the writability tests a bit more in depth. We now do a three part check consisting of: - S_ISDIR(): is this even a directory - access(W_OK): is this directory writable by the current user. Unfortunately for root, this almost always returns that it is, but in the case of a RO mount or NFS share inaccessible to root, this check will exclude the directory. - mode & (any write bit): is there a writable bit set on this directory. This makes it possible to enforce a read-only cache directory by setting permissions to 0555, for example. Signed-off-by: Dan McGee <dan@archlinux.org>
2011-08-19Be more robust when copying package dataDan McGee8-25/+74
This changes the signature of _alpm_pkg_dup() to return an integer error code and provide the new package in a passed pointer argument. All callers are now more robust with checking the return value of this function to ensure a fatal error did not occur. We allow load failures to proceed as otherwise we have a chicken and egg problem- if a 'desc' local database entry is missing, the best way of restoring said file is `pacman -Sf --dbonly packagename`. This patch fixes a segfault that was occurring in this case. Fixes the segfault reported in FS#25667. Signed-off-by: Dan McGee <dan@archlinux.org>
2011-08-19lib/dload: unlink on response code >=400Dave Reisner1-1/+7
ftp and http both define >=400 as being "something bad happened" Signed-off-by: Dave Reisner <dreisner@archlinux.org> Signed-off-by: Dan McGee <dan@archlinux.org>
2011-08-19dload: add 'unlink_on_fail' to payload structDave Reisner3-5/+5
Let callers of _alpm_download state whether we should delete on fail, rather than inferring it from context. We still override this decision and always unlink when a temp file is used. Signed-off-by: Dave Reisner <dreisner@archlinux.org> Signed-off-by: Dan McGee <dan@archlinux.org>
2011-08-19makepkg: quote re-evaluation of simple varsDave Reisner1-6/+6
This is a safety measure to prevent simple code injection. $ i="foo bar" $ eval i="$i" bash: bar: command not found $ eval i=\"$i\" $ echo "|$i|" |foo bar| Signed-off-by: Dave Reisner <dreisner@archlinux.org> Signed-off-by: Dan McGee <dan@archlinux.org>
2011-08-19lib/dload: prevent possible NULL dereferenceDave Reisner1-1/+1
Signed-off-by: Dave Reisner <dreisner@archlinux.org> Signed-off-by: Dan McGee <dan@archlinux.org>
2011-08-19sync: fix garbled output in conflict promptDave Reisner1-1/+1
$ pacman -S cronie resolving dependencies... looking for inter-conflicts... :: cronie and fcron are in conflict (@.). Remove fcron? [y/N] n $ sudo pacman -S pacman resolving dependencies... looking for inter-conflicts... :: pacman and pacman-git are in conflict (pKÈ). Remove pacman-git? [y/N] Signed-off-by: Dave Reisner <dreisner@archlinux.org> Signed-off-by: Dan McGee <dan@archlinux.org>
2011-08-18makepkg: deal with variable substitution when checking sanityAllan McRae1-0/+3
If any of pkgver, pkgrel or epoch contained a variable substitution, then it needed to be evaluated before checking its value conformed to the rules. [Dan: add quotes around RHS] Signed-off-by: Allan McRae <allan@archlinux.org> Signed-off-by: Dan McGee <dan@archlinux.org>
2011-08-18doc/PKGBUILD: update regarding versioned package fieldsDan McGee1-9/+12
Add the info that versioned replaces are now supported, as well as beefing up some of the other places touching on versioned fields. Signed-off-by: Dan McGee <dan@archlinux.org>
2011-08-18Convert resolvedep() to use _alpm_depcmp_literal()Dan McGee1-5/+10
The whole first loop is trying to check literals only, so teach it to do so. Also, reorder operations to make more sense by putting the strcmp() first in the literal loop, and using a very cheap name_hash check first in the second loop. Signed-off-by: Dan McGee <dan@archlinux.org>
2011-08-18Fix replacement of provider issueDan McGee2-3/+2
When we switched to using alpm_depcmp() in resolving replacments, we had some interesting behavior with regard to providers and packages not found in repositories. Teach the replacement resolving code to not look at provisions at all to be slightly more sane. Signed-off-by: Dan McGee <dan@archlinux.org>
2011-08-18Add an _alpm_depcmp_literal() functionDan McGee2-10/+14
This omits the finding of matching provisions and only checks the package itself against the provided dep. Signed-off-by: Dan McGee <dan@archlinux.org>
2011-08-18Replacements refactor: extract check_replacers()Dan McGee1-57/+73
This moves code that was inline in alpm_sync_sysupgrade() to its own method. Signed-off-by: Dan McGee <dan@archlinux.org>
2011-08-18Replacements refactor: extract check_literal()Dan McGee1-33/+46
This moves code that was inline in alpm_sync_sysupgrade() to its own method. Signed-off-by: Dan McGee <dan@archlinux.org>
2011-08-18Remove usages of alpm_list_next() in backendDan McGee4-13/+13
Another function call that can be replaced by a single pointer dereference. Signed-off-by: Dan McGee <dan@archlinux.org>
2011-08-18Remove use of no-op accessor functions in libraryDan McGee8-44/+36
The functions alpm_db_get_name(), alpm_pkg_get_name(), and alpm_pkg_get_version() are not necessary at all, so remove the calling and indirection when used in the backend, which makes things slightly more efficient and reduces code size. Signed-off-by: Dan McGee <dan@archlinux.org>
2011-08-18Enhance and utilize database status flagsDan McGee6-25/+76
* Move is_local standalone field to status enum * Create VALID/INVALID flag pair * Create EXISTS/MISSING flag pair With these additional fields, we can be more intelligent with database loading and messages to the user. We now only warn once if a sync database does not exist and do not continue to try to load it once we have marked it as missing. The reason for the flags existing in pairs is so the unknown case can be represented. There should never be a time when both flags in the same group are true, but if they are both false, it represents the unknown case. Care is taken to always manipulate both flags at the same time. Signed-off-by: Dan McGee <dan@archlinux.org>
2011-08-18Add makepkg -S which is an alias to makepkg --sourceSebastien Luttringer3-11/+11
makepkg --source is a often used go make source package like for AUR. Have a -S shortcut will save the world. Signed-off-by: Sebastien Luttringer <seblu@seblu.net> Signed-off-by: Dan McGee <dan@archlinux.org>
2011-08-18lib/libalpm/dload.c: Use STRDUP() instead of strdup()Lukas Fleischer1-3/+5
Use the STRDUP macro instead of strdup() for the sake of better error handling on memory allocation failures. Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de> Signed-off-by: Dan McGee <dan@archlinux.org>
2011-08-18lib/libalpm/dload.c: Add ASSERT() to alpm_fetch_pkgurl()Lukas Fleischer1-0/+1
Return with ALPM_ERR_WRONG_ARGS instead of causing a potential segfault if alpm_fetch_pkgurl() is invoked with a NULL URL. Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de> Signed-off-by: Dan McGee <dan@archlinux.org>
2011-08-17lib/dload: refactor deletion on failureDave Reisner1-6/+2
This moves all the delete-on-fail logic to under cleanup label. This also implies should_unlink when a payload is received that doesn't allow resuming. Fixes .db.sig.part files leftover in the sync dir. Signed-off-by: Dave Reisner <dreisner@archlinux.org> Signed-off-by: Dan McGee <dan@archlinux.org>
2011-08-17lib/dload: avoid renaming download to 0 length destfileDave Reisner1-1/+1
This leverages earlier work that avoids a rename when destfile is unset. Signed-off-by: Dave Reisner <dreisner@archlinux.org> Signed-off-by: Dan McGee <dan@archlinux.org>
2011-08-17Avoid stat() on NULL path in curl_download_internal()Lukas Fleischer1-1/+1
stat()'s behaviour is undefined if the first argument is NULL and might be prone to segfault. Add an additional check to skip the stat() invocation if no destfile is used. Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de> Signed-off-by: Dan McGee <dan@archlinux.org>
2011-08-17Skip rename() on NULL destfile in curl_download_internal()Lukas Fleischer1-5/+9
Avoid a potential segfault that may occur if we use a temporary file and fail to build the destination file name from the effective URL. Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de> Signed-off-by: Dan McGee <dan@archlinux.org>
2011-08-17Fix trailing whitespace in whole codebaseDan McGee14-28/+28
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-08-17Update PKGBUILD manpage about startdir deprecationSebastien Luttringer1-0/+1
Signed-off-by: Sebastien Luttringer <seblu@seblu.net> Signed-off-by: Dan McGee <dan@archlinux.org>
2011-08-16Fix compilation using --without-gpgmeDan McGee1-22/+21
This function is used regardless of whether gpgme support is enabled, so make sure it is always accessible. Signed-off-by: Dan McGee <dan@archlinux.org>
2011-08-16configure.ac: add checks for more types, functions and headersAllan McRae1-7/+15
This covers most types, functions and headers that we use in the code base. Currently we do not use any of these checks, but it is useful to have the configure output when looking at build issues on other peoples systems. Signed-off-by: Allan McRae <allan@archlinux.org> Signed-off-by: Dan McGee <dan@archlinux.org>
2011-08-16dload: zero out pm_errno in curl_download_internalDave Reisner2-10/+4
This reverts some hacky behavior from 5fc3ec and resets the handle's pm_errno where it should be reset -- prior to each download. This prevents a transaction with a download from being aborted when a package is successfully grabbed from a secondary server. Signed-off-by: Dave Reisner <dreisner@archlinux.org> Signed-off-by: Dan McGee <dan@archlinux.org>
2011-08-16doc/PKGBUILD: fix Asciidoc formatting issuesDan McGee1-6/+6
We had this gem: ⇐ (less than or equal to) Due to not ensuring we did literal printing of things like this. Fix it and a few other problems noticed scanning through both the HTML and manpage generated files. Signed-off-by: Dan McGee <dan@archlinux.org>
2011-08-16Update authors and contributorsDan McGee3-19/+8
* .mailmap: add mapping for Dave's two email addresses. * AUTHORS: clear out file, tell people to use `git shortlog -s` instead. * doc/footer.txt: "promote" Dave, put Xavier and Nagy in past contributors. Signed-off-by: Dan McGee <dan@archlinux.org>