summaryrefslogtreecommitdiff
path: root/lib/libalpm
Commit message (Collapse)AuthorAge
...
* | lib/conflict: save strlen call by reusing snprintf returnDave Reisner2011-12-12
| | | | | | | | | | | | | | | | | | The return should probably be checked to ensure its not longer than PATH_MAX, but I have no idea what the correct behavior is when that happens. Signed-off-by: Dave Reisner <dreisner@archlinux.org> Signed-off-by: Dan McGee <dan@archlinux.org>
* | code syntax cleanupDave Reisner2011-12-12
| | | | | | | | | | | | | | As per HACKING file, we use 'CTRL(' rather than 'CTRL (' Signed-off-by: Dave Reisner <dreisner@archlinux.org> Signed-off-by: Dan McGee <dan@archlinux.org>
* | Move items around in the alpm handle structDan McGee2011-12-07
| | | | | | | | | | | | This allows for the struct layout to have no empty spaces. Signed-off-by: Dan McGee <dan@archlinux.org>
* | Slight local database files reading optimizationDan McGee2011-12-07
| | | | | | | | | | | | | | | | Since we know the length of the line, we can use this all the way through and do a cheaper operation than strdup() by just invoking malloc and memcpy directly. Signed-off-by: Dan McGee <dan@archlinux.org>
* | Merge branch 'maint'Dan McGee2011-12-07
|\|
| * Use correct size in memsetDan McGee2011-12-05
| | | | | | | | | | | | | | | | We were using the size of a pointer, not the size of the whole archive_read_buffer struct. Thanks to Clang/LLVM 3.0 and Allan/Dave in IRC for finding this one. Signed-off-by: Dan McGee <dan@archlinux.org>
| * Enforce signature download size limit on -U <url> operationsDan McGee2011-12-05
| | | | | | | | | | | | | | | | We had a 16 KiB limit on database signatures, we should do the same here too to have a slight sanity check, even if we can't do so for the package itself yet. Signed-off-by: Dan McGee <dan@archlinux.org>
* | Merge branch 'maint'Dan McGee2011-11-30
|\|
| * _alpm_ldconfig: return value from _alpm_run_chrootDan McGee2011-11-30
| | | | | | | | Signed-off-by: Dan McGee <dan@archlinux.org>
* | Add helper function for duplicating depends listsDan McGee2011-11-30
| | | | | | | | | | | | | | | | | | | | We do this in several of the package duplication steps; add a helper function for doing so to reduce some of the repetitive code. Also add a free_deplist function for our repeated depend list free calls of both the data and the list. Signed-off-by: Dan McGee <dan@archlinux.org>
* | added doxygen documentationandrew.gregory.8@gmail.com2011-11-22
| | | | | | | | | | | | | | | | | | Made existing documentation more consistent and added documentation where there was none. One function still needs documentation and is marked with 'TODO'. Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com> Signed-off-by: Dan McGee <dan@archlinux.org>
* | add key algo to import msgFlorian Pritz2011-11-20
| | | | | | | | | | Signed-off-by: Florian Pritz <bluewind@xinu.at> Signed-off-by: Dan McGee <dan@archlinux.org>
* | change gpg import message to resemble gpg --list-keysFlorian Pritz2011-11-20
| | | | | | | | | | | | | | Dan: const pointers, don't worry about bitfields. Signed-off-by: Florian Pritz <bluewind@xinu.at> Signed-off-by: Dan McGee <dan@archlinux.org>
* | Update alpm_errno_t type to non-enum versionDan McGee2011-11-16
| | | | | | | | Signed-off-by: Dan McGee <dan@archlinux.org>
* | Merge branch 'maint'Dan McGee2011-11-16
|\|
| * Update translations from TransifexDan McGee2011-11-16
| | | | | | | | Signed-off-by: Dan McGee <dan@archlinux.org>
| * Allow sync_prepare to work in certain cases without sync databasesDan McGee2011-11-15
| | | | | | | | | | | | | | | | | | | | | | | | | | When doing a bare -U operation on a local package that doesn't pull in any dependencies from the sync databases, we can get away with missing database files. This makes the check conditional on no sync targets found in the target list. This is not the prettiest code here so we have a bit of hackish behavior required to straighten both the behavior and the nonsensical error message out. Addresses FS#26899. Signed-off-by: Dan McGee <dan@archlinux.org>
| * Update translations from TransifexDan McGee2011-11-13
| | | | | | | | Signed-off-by: Dan McGee <dan@archlinux.org>
| * Updates in preparation for 4.0.1 releaseDan McGee2011-11-13
| | | | | | | | | | | | | | Bump the version, update the translation template files, and fill in NEWS with relevant commits and changes since 4.0.0. Signed-off-by: Dan McGee <dan@archlinux.org>
* | Add helper method for creating and opening archive objectDan McGee2011-11-16
| | | | | | | | | | | | | | | | | | | | | | | | | | This moves the common setup code of about 5 different callers into one method. Error messages will now be common and shared in all places; several paths did not have any messages at all before. In addition, we now pick an ideal block size for the archive read based off the larger value of our default buffer size or the st.st_blksize field. For a filesystem such as NFS, this is often much larger than the default 8192- values such as 32768 and 131072 are common. Signed-off-by: Dan McGee <dan@archlinux.org>
* | create a typedef for enum _alpm_errno_tJonathan Conder2011-11-14
| | | | | | | | | | | | | | | | This is consistent with the other enums and structs, and should be slightly more readable. Signed-off-by: Jonathan Conder <jonno.conder@gmail.com> Signed-off-by: Dan McGee <dan@archlinux.org>
* | add support for back end fnmatch'd optionsDave Reisner2011-11-13
| | | | | | | | | | | | | | | | | | | | | | | | | | This is work originally provided by Sascha Kruse on FS#20360 with only minor adjustments to the implementation. It's been expanded to cover: NoUpgrade, NoExtract, IgnorePkg, IgnoreGroup. Adds tests ignore008, sync139, sync502, and sync503. Also satisfies FS#18988. Original-work-by: Sascha Kruse <knopwob@googlemail.com> Signed-off-by: Dave Reisner <dreisner@archlinux.org>
* | invert iteration order for ignoregroupDave Reisner2011-11-11
| | | | | | | | | | | | | | | | | | This is a simple change that allows comparions to be more in line with how other checks are done. It will be necessary for ensuing patchwork that implements fnmatch for comparing and assumes a specific argument ordering. Signed-off-by: Dave Reisner <dreisner@archlinux.org>
* | Merge branch 'maint'Dan McGee2011-11-07
|\|
| * Fix thinko in _alpm_strip_newlineDan McGee2011-11-01
| | | | | | | | | | | | | | | | | | The point of this early compare to NULL byte check was so we could bail early and skip the strcmp() call. Given we weren't doing the check right, this never exited early. Fix it to work as intended. Noticed-by: Pepe Juárez <trulustapa@gmail.com> Signed-off-by: Dan McGee <dan@archlinux.org>
* | libalpm/util: don't use sprintf to convert from bin to hexDan McGee2011-11-01
| | | | | | | | | | | | | | This is a trivial operation that doesn't require calling a function over and over- just do some math and indexing into a character array. Signed-off-by: Dan McGee <dan@archlinux.org>
* | Fix size reported in CALLOC allocation failure messageDan McGee2011-11-01
| | | | | | | | Signed-off-by: Dan McGee <dan@archlinux.org>
* | Convert package and database archive reads to use file descriptorsDan McGee2011-11-01
| | | | | | | | | | | | | | | | | | | | | | | | | | | | This gives us a bit more control and over the archive reading process, and a bit less is done behind the scenes. It also allows us to use fstat() in preference to stat(), which should avoid some potential race conditions. Some reorganization is necessary to move the stat calls after the open() calls. Error handling and cleanup in general is also improved, as we had several potential memory and file handle leaks before in some error paths. Signed-off-by: Dan McGee <dan@archlinux.org>
* | libalpm/util: use low-level I/O for copyfile and checksum routinesDan McGee2011-11-01
| | | | | | | | | | | | | | | | This removes an unnecessary level of buffering. We are not doing line-based I/O here, so we can read in blocks of 8K at a time directly from the file. Signed-off-by: Dan McGee <dan@archlinux.org>
* | Add OPEN() and CLOSE() util macrosDan McGee2011-11-01
| | | | | | | | | | | | | | These wrap the normal open() and close() low-level I/O calls and ensure EINTR is handled correctly. Signed-off-by: Dan McGee <dan@archlinux.org>
* | Merge branch 'maint'Dan McGee2011-11-01
|\|
| * dload: remove redundant conditionalDave Reisner2011-10-27
| | | | | | | | | | | | | | Replacing the strdup when after the first NULL check assures that we get continue with payload->remote_name defined. Signed-off-by: Dave Reisner <dreisner@archlinux.org>
| * dload: chmod tempfiles to respect umaskDave Reisner2011-10-27
| | | | | | | | | | | | | | Dan: fix mask calculation, add it to the success/fail block instead. Signed-off-by: Dave Reisner <dreisner@archlinux.org> Signed-off-by: Dan McGee <dan@archlinux.org>
| * Introduce ALPM_BUFFER_SIZE constantDan McGee2011-10-27
| | | | | | | | | | | | | | | | | | | | | | | | | | | | This takes the place of three previously used constants: ARCHIVE_DEFAULT_BYTES_PER_BLOCK, BUFFER_SIZE, and CPBUFSIZE. In libarchive 3.0, the first constant will be no more, so we can ensure we are forward-compatible by removing our usage of it now. The rest are unified for consistency. By default, we will use the value of BUFSIZ provided by <stdio.h>, which is 8192 on Linux. If that is undefined, a default value is provided. Signed-off-by: Dan McGee <dan@archlinux.org>
| * Fix issues with replacing unowned symlinksDan McGee2011-10-26
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | There aretwo seperate issues in the same block of file conflict checking code here: 1) If realpath errored, such as when a symlink was broken, we would call 'continue' rather than simply exit this particular method of resolution. This was likely just a copy-paste mistake as the previous resolving steps all use loops where continue makes sense. Refactor the check so we only proceed if realpath is successful, and continue with the rest of the checks either way. 2) The real problem this code was trying to solve was canonicalizing path component (e.g., directory) symlinks. The final component, if not a directory, should not be handled at all in this loop. Add a !S_ISLNK() condition to the loop so we only call this for real files. There are few other small cleanups to the debug messages that I made while debugging this problem- we don't need to keep printing the file name, and ensure every block that sets resolved_conflict to true prints a debug message so we know how it was resolved. This fixes the expected failures from symlink010.py and symlink011.py, while still ensuring the fix for fileconflict007.py works. Signed-off-by: Dan McGee <dan@archlinux.org>
| * Don't realloc a 0-length files array when loading packagesDan McGee2011-10-26
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | There is some pecular behavior going on here when a package is loaded that has no files, as is very common in our test suite. When we enter the realloc/sort code, a package without files will call the following: files = realloc(NULL, 0); One would assume this is a no-op, returning a NULL pointer, but that is not the case and valgrind later reports we are leaking memory. Fix the whole thing by skipping the reallocation and sort steps if the pointer is NULL, as we have nothing to do. Note that the package still gets marked as 'files loaded', becuase although there were none, we tried and were successful. Signed-off-by: Dan McGee <dan@archlinux.org>
* | libalpm/util: two stat() related cleanupsDan McGee2011-10-26
| | | | | | | | | | | | | | | | | | | | | | | | First, use fstat() in preference to stat() since we already have an open file handle. This also removes the need to check for a symlink as that is not possible when a file is opened. Next, use archive_entry_mode() rather than archive_entry_stat() as we only use the mode portion of the stat struct and the call is much cheaper. Also delay it until it is necessary. Signed-off-by: Dan McGee <dan@archlinux.org>
* | Merge branch 'maint'Dan McGee2011-10-25
|\|
| * lib/sync: inform callers of compute_download_size of a partialDave Reisner2011-10-25
| | | | | | | | | | | | | | | | | | | | Extend the return values of compute_download_size to allow callers to know that a .part file exists for the package. This extra value isn't currently used, but it'll be needed later on. Signed-off-by: Dave Reisner <dreisner@archlinux.org> Signed-off-by: Dan McGee <dan@archlinux.org>
| * Add more logging to download codeDan McGee2011-10-24
| | | | | | | | | | | | | | | | | | This adds a logger to the CURLE_OK case so we can always know the return code if it was >= 400, and debug log it regardless. Also adjust another logger to use the cURL error message directly, as well as use fstat() when we have an open file handle rather than stat(). Signed-off-by: Dan McGee <dan@archlinux.org>
* | Merge branch 'maint'Dan McGee2011-10-21
|\| | | | | | | | | | | | | Conflicts: src/pacman/package.c Signed-off-by: Dan McGee <dan@archlinux.org>
| * Show an error message on failed remote key lookupDan McGee2011-10-17
| | | | | | | | | | | | | | | | | | | | | | | | | | The absolutely terrible part about this is the failure on GPGME's part to distinguish between "key not found" and "keyserver timeout". Instead, it returns the same silly GPG_ERR_EOF in both cases (why isn't GPG_ERR_TIMEOUT being used?), leaving us helpless to tell them apart. Spit out a generic enough error message that covers both cases; unfortunately we can't provide much guidance to the user because we aren't sure what actually happened. Signed-off-by: Dan McGee <dan@archlinux.org>
* | sync: move file download loop out of download_filesDave Reisner2011-10-21
| | | | | | | | | | | | | | | | Create a new static function called 'download_single_file' which iterates over the servers for each payload. Signed-off-by: Dave Reisner <dreisner@archlinux.org> Signed-off-by: Dan McGee <dan@archlinux.org>
* | sync: check for necessary disk space for downloadDave Reisner2011-10-21
| | | | | | | | Signed-off-by: Dave Reisner <dreisner@archlinux.org>
* | sync: extract build_payload() method from find_dl_candidatesDan McGee2011-10-21
| | | | | | | | | | | | | | | | This is done by both the delta and regular file code, so we can extract a little helper method. Done mostly to satisfy my "why are we repeating code here" itch. Signed-off-by: Dan McGee <dan@archlinux.org>
* | sync: dont group sync records by repositoryDave Reisner2011-10-21
| | | | | | | | | | | | | | | | | | Break out the logic of finding payloads into a separate static function to avoid nesting mayhem. After gathering all the records, download them all at once. Signed-off-by: Dave Reisner <dreisner@archlinux.org> Signed-off-by: Dan McGee <dan@archlinux.org>
* | base64: don't compile base64_encode() functionDan McGee2011-10-17
| | | | | | | | | | | | | | We don't use this anywhere; "comment" it out so we still remain relatively close to the upstream sources. Signed-off-by: Dan McGee <dan@archlinux.org>
* | dload: add pointer to server list for each payloadDave Reisner2011-10-17
| | | | | | | | | | Signed-off-by: Dave Reisner <dreisner@archlinux.org> Signed-off-by: Dan McGee <dan@archlinux.org>
* | diskspace: create static function mount_point_list_freeDave Reisner2011-10-17
| | | | | | | | | | | | | | | | This logic is reused in both diskspace and downloadspace check functions, so pull it out into its own static method. Signed-off-by: Dave Reisner <dreisner@archlinux.org> Signed-off-by: Dan McGee <dan@archlinux.org>
* | diskspace: add _alpm_check_downloadspace()Dave Reisner2011-10-17
| | | | | | | | | | | | | | | | | | This function determines if the given cachedir has at least the given amount of free space on it. This will be later used in the sync code to preemptively halt downloads. Signed-off-by: Dave Reisner <dreisner@archlinux.org> Signed-off-by: Dan McGee <dan@archlinux.org>