summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAge
* 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>
* Remove unnecessary casts in callback codeDan McGee2011-11-15
| | | | 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>
* Merge branch 'maint'Dan McGee2011-11-13
|\
| * makepkg: check for value before using eval'd varDave Reisner2011-11-10
| | | | | | | | | | | | | | | | This prevent bsdtar from exploding when install= or changelog= are present without a value. Signed-off-by: Dave Reisner <dreisner@archlinux.org> Signed-off-by: Dan McGee <dan@archlinux.org>
* | add fnmatch support for HoldPkgDave Reisner2011-11-13
| | | | | | | | | | | | Adds test remove031. Signed-off-by: Dave Reisner <dreisner@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
|\|
| * makepkg: handle pgp signatures with .sign extensionAllan McRae2011-11-07
| | | | | | | | | | | | | | Detached sgnature files with extension .sign are accepted by gnupg. Signed-off-by: Allan McRae <allan@archlinux.org> Signed-off-by: Dan McGee <dan@archlinux.org>
| * Fix download progress rounding edge caseDan McGee2011-11-03
| | | | | | | | | | | | | | | | | | | | | | | | | | Allan's original message: Occasionally when the download rate showed 100.0 the output got messed up. This was caused by the rounding of a number between 99.95 and 100. Adjust the threshold to avoid this rounding issue. Dan: make this fix, but also show values between 0 and 9.995 with two decimal places since we have the room. Original-fix-by: Allan McRae <allan@archlinux.org> Signed-off-by: Dan McGee <dan@archlinux.org>
| * 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
|\|
| * src/util: link vercmp against .lo, not the .oDave Reisner2011-11-01
| | | | | | | | | | | | | | This seems to fix FS#26652. Signed-off-by: Dave Reisner <dreisner@archlinux.org> Signed-off-by: Dan McGee <dan@archlinux.org>
| * 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>
| * paccache: add vim modelineDave Reisner2011-10-26
| | | | | | | | Signed-off-by: Dave Reisner <dreisner@archlinux.org>
| * paccache: ensure seen/seenarch vars are setDave Reisner2011-10-26
| | | | | | | | | | | | | | | | Doesn't do a whole lot of good to compare against values that are never set. Fixes bug where -vvv output wasn't grouping packages together properly. Signed-off-by: Dave Reisner <dreisner@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>
| * Add some unowned symlink replacement testsDan McGee2011-10-26
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | These should all prevent installation, and yet two of the three tests currently fail. Not good. The best way to see what is going on here is to diff the three new tests side by side- there is only a small difference between the three tests, and that is in the destination of the symlink in question that should never be overwritten. symlink010.py: myprogsuffix -> myprog symlink011.py: myprogsuffix -> broken symlink012.py: myprogsuffix -> otherprog 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>
| * Fix libtool detection of --as-needed flagAllan McRae2011-10-25
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The fix for -Wl,--as-needed in commit b0f9477f assumes that --as-needed/--no-as-needed is the only option given in a -Wl line. However, it is perfectly valid to specify multiple flags comma separated after a single -Wl (e.g. the default LDFLAGS in Arch Linux makepkg.conf). Adjust the fix so it detect --as-needed in a more general context > readelf -d lib/libalpm/.libs/libalpm.so.?.?.? | grep NEEDED | wc -l Before: 13 After: 5 Signed-off-by: Allan McRae <allan@archlinux.org> Signed-off-by: Dan McGee <dan@archlinux.org>
| * Update libtool filesAllan McRae2011-10-25
| | | | | | | | | | | | | | | | Update for libtool-2.4.2 while keeping the fix for --as-needed from commit b0f9477f. Signed-off-by: Allan McRae <allan@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>
| * bacman: pkgrel does not have to be an integerlolilolicon2011-10-21
| | | | | | | | | | | | | | pkgrel, as with pkgver, simply mustn't contain hyphens. Signed-off-by: lolilolicon <lolilolicon@gmail.com> Signed-off-by: Dan McGee <dan@archlinux.org>
| * Remove remaining usages of fprintf() from frontendDan McGee2011-10-21
| | | | | | | | | | | | | | These can either be replaced with pm_printf() if they are error related, or in the fprintf(stdout, ...) case a bare printf() will do. Signed-off-by: Dan McGee <dan@archlinux.org>
| * Remove pm_fprintf() in favor of pm_printf()Dan McGee2011-10-21
| | | | | | | | | | | | | | | | | | | | Now that pm_printf() always prints to stderr, we don't need this second function that was always used with stderr as the first argument. Thus, this patch removes the function and makes the following sed replacement: sed -i -e 's#pm_fprintf(stderr, #pm_printf(#g' src/pacman/*.c Signed-off-by: Dan McGee <dan@archlinux.org>
| * Use stderr as output stream for pm_printf()Dan McGee2011-10-21
| | | | | | | | | | | | | | | | | | | | | | This matches what we now do in our backend callback function- all debug/info/warning/error/etc. messages should be on stderr. These are all the messages with a "warning:" or other type prefix, so does not affect general pacman output. This should fix the output confusion noted in FS#26555. Signed-off-by: Dan McGee <dan@archlinux.org>
| * pacman-key: add a default keyserver timeout value on --initDan McGee2011-10-17
| | | | | | | | | | | | | | | | | | The default is supposidely 30 seconds from the gpg manpage, but that sure wasn't what I was seeing- it was somewhere closer to two minutes of silence. Add a more reasonable 10 second timeout value which should be good enough for any keyserver that doesn't totally stink at it's job. 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>
| * Table display: print message with warning: prefixDan McGee2011-10-17
| | | | | | | | | | | | Use the normal error functions here rather than a bare fprintf(). Signed-off-by: Dan McGee <dan@archlinux.org>
* | Hide empty columns in table package list displayDan McGee2011-10-21
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | On -R operations, the "New Version" column is always empty, taking up space and not really showing the user anything valuable. The same is true on -S or -U operations for the "Old Version" column when packages are only being installed and not upgraded. Remove this column so we get a few screen columns back, especially now that we show repo/packagename style output. This also makes some adjustment to the padding logic. We no longer include padding in column widths but it is included in the total table width. We also ensure the last displayed column is always right aligned, even if this is not the actual rightmost column. Example output, before: $ sudo pacman -R eclipse checking dependencies... Targets (1): Name Old Version New Version Net Change eclipse 3.7-1 -194.02 MiB Total Removed Size: 194.02 MiB And after: $ sudo pacman -R eclipse checking dependencies... Targets (1): Name Old Version Net Change eclipse 3.7-1 -194.02 MiB Total Removed Size: 194.02 MiB Signed-off-by: Dan McGee <dan@archlinux.org>
* | pacman: show repo name in download promptDave Reisner2011-10-21
| | | | | | | | | | | | | | | | | | | | | | This only applies to the VerbosePkgLists option. Lessens the deficiencies created by earlier work to separate download records by repository. Satisfies FS#26334. Signed-off-by: Dave Reisner <dreisner@archlinux.org> 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>