Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
path: root/lib
AgeCommit message (Collapse)Author
2011-12-21include config.h via MakefilesDave Reisner
Ensures that config.h is always ordered correctly (first) in the includes. Also means that new source files get this for free without having to remember to add it. We opt for -imacros over -include as its more portable, and the added constraint by -imacros doesn't bother us for config.h. This also touches the HACKING file to remove the explicit mention of config.h as part of the includes. Signed-off-by: Dave Reisner <dreisner@archlinux.org> Signed-off-by: Dan McGee <dan@archlinux.org>
2011-12-21Don't check diskspace when using --dbonlyDan McGee
Mostly a waste of time. Sure, we no longer make sure your pacman database partition has enough space, but if you are using this option you better know what you are doing anyway. Signed-off-by: Dan McGee <dan@archlinux.org>
2011-12-13sync: avoid checking file conflicts with --dbonlyDave Reisner
Scratches my own itch from FS#25667 Signed-off-by: Dave Reisner <dreisner@archlinux.org> Signed-off-by: Dan McGee <dan@archlinux.org>
2011-12-13delta: use regex substring matchingDave Reisner
Signed-off-by: Dave Reisner <dreisner@archlinux.org> Signed-off-by: Dan McGee <dan@archlinux.org>
2011-12-12Calculate root length only once when checking for file conflictsDan McGee
It is quite easy to hoist this potentially repeated computation out of the loop; even if we don't end up using it, it is super cheap to do it only once. Signed-off-by: Dan McGee <dan@archlinux.org>
2011-12-12lib/conflict: save strlen call by reusing snprintf returnDave Reisner
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>
2011-12-12code syntax cleanupDave Reisner
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>
2011-12-07Move items around in the alpm handle structDan McGee
This allows for the struct layout to have no empty spaces. Signed-off-by: Dan McGee <dan@archlinux.org>
2011-12-07Slight local database files reading optimizationDan McGee
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>
2011-12-07Merge branch 'maint'Dan McGee
2011-12-05Use correct size in memsetDan McGee
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>
2011-12-05Enforce signature download size limit on -U <url> operationsDan McGee
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>
2011-11-30Merge branch 'maint'Dan McGee
2011-11-30_alpm_ldconfig: return value from _alpm_run_chrootDan McGee
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-11-30Add helper function for duplicating depends listsDan McGee
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>
2011-11-22added doxygen documentationandrew.gregory.8@gmail.com
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>
2011-11-20add key algo to import msgFlorian Pritz
Signed-off-by: Florian Pritz <bluewind@xinu.at> Signed-off-by: Dan McGee <dan@archlinux.org>
2011-11-20change gpg import message to resemble gpg --list-keysFlorian Pritz
Dan: const pointers, don't worry about bitfields. Signed-off-by: Florian Pritz <bluewind@xinu.at> Signed-off-by: Dan McGee <dan@archlinux.org>
2011-11-16Update alpm_errno_t type to non-enum versionDan McGee
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-11-16Merge branch 'maint'Dan McGee
2011-11-16Add helper method for creating and opening archive objectDan McGee
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>
2011-11-16Update translations from TransifexDan McGee
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-11-15Allow sync_prepare to work in certain cases without sync databasesDan McGee
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>
2011-11-14create a typedef for enum _alpm_errno_tJonathan Conder
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>
2011-11-13Update translations from TransifexDan McGee
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-11-13Updates in preparation for 4.0.1 releaseDan McGee
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>
2011-11-13add support for back end fnmatch'd optionsDave Reisner
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>
2011-11-11invert iteration order for ignoregroupDave Reisner
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>
2011-11-07Merge branch 'maint'Dan McGee
2011-11-01Fix thinko in _alpm_strip_newlineDan McGee
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>
2011-11-01libalpm/util: don't use sprintf to convert from bin to hexDan McGee
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>
2011-11-01Fix size reported in CALLOC allocation failure messageDan McGee
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-11-01Convert package and database archive reads to use file descriptorsDan McGee
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>
2011-11-01libalpm/util: use low-level I/O for copyfile and checksum routinesDan McGee
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>
2011-11-01Add OPEN() and CLOSE() util macrosDan McGee
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>
2011-11-01Merge branch 'maint'Dan McGee
2011-10-27dload: remove redundant conditionalDave Reisner
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>
2011-10-27dload: chmod tempfiles to respect umaskDave Reisner
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>
2011-10-27Introduce ALPM_BUFFER_SIZE constantDan McGee
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>
2011-10-26Fix issues with replacing unowned symlinksDan McGee
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>
2011-10-26Don't realloc a 0-length files array when loading packagesDan McGee
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>
2011-10-26libalpm/util: two stat() related cleanupsDan McGee
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>
2011-10-25Merge branch 'maint'Dan McGee
2011-10-25lib/sync: inform callers of compute_download_size of a partialDave Reisner
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>
2011-10-24Add more logging to download codeDan McGee
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>
2011-10-21Merge branch 'maint'Dan McGee
Conflicts: src/pacman/package.c Signed-off-by: Dan McGee <dan@archlinux.org>
2011-10-21sync: move file download loop out of download_filesDave Reisner
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>
2011-10-21sync: check for necessary disk space for downloadDave Reisner
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2011-10-21sync: extract build_payload() method from find_dl_candidatesDan McGee
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>
2011-10-21sync: dont group sync records by repositoryDave Reisner
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>