summaryrefslogtreecommitdiffstats
AgeCommit message (Collapse)AuthorFilesLines
2011-10-17dload: add pointer to server list for each payloadDave Reisner2-0/+3
Signed-off-by: Dave Reisner <dreisner@archlinux.org> Signed-off-by: Dan McGee <dan@archlinux.org>
2011-10-17diskspace: create static function mount_point_list_freeDave Reisner1-11/+14
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>
2011-10-17diskspace: add _alpm_check_downloadspace()Dave Reisner2-0/+51
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>
2011-10-14Large performance improvement for check for owned directoriesDan McGee1-5/+11
We can take a large shortcut here that saves us a lot of time, especially when upgrading packages with lots of directories. Obviously iterating the full file list of every single package to determine if this directory was present in any other package can take quite some time on a system with many packages installed. We don't need to remove a directory at all if we are upgrading a package and the version we are moving to still had the directory. Also make a small optimization on the package comparsion- we really only care about equality here, not the result of the compare, so we can shortcut using our name_hash. What kind of benefit does this give us? Oh, only a reduction from 295.7 million to 1.4 million strcmp() calls (99.5% fewer) during a `pacman -S linux libreoffice-common` operation. Signed-off-by: Dan McGee <dan@archlinux.org>
2011-10-14Make _alpm_filelist_contains() NULL-safeDan McGee1-3/+7
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-10-14Merge branch 'maint'Dan McGee8-73/+141
2011-10-14makepkg: don't attach traps until after argument parsingDan McGee1-11/+9
Nothing we do in our traps is necessary this early in the script. This fixes FS#26196. Signed-off-by: Dan McGee <dan@archlinux.org>
2011-10-14Use fputs and putchar in callback progress displayDan McGee1-15/+15
When we have fixed strings or output, printf overhead is unnecessary. Signed-off-by: Dan McGee <dan@archlinux.org>
2011-10-14Remove -f short option for --forceDan McGee10-14/+15
This is not something that should be used on a frequent basis, and giving it a short option encourages use without making the drawbacks obvious. For the 1% of situations that require it, the 5 extra keystrokes are a fair price to pay. Signed-off-by: Dan McGee <dan@archlinux.org>
2011-10-14Add missing #ifdef around cURL error code in download structDan McGee1-0/+2
Thanks to Eduardo Tongson on the mailing list. Signed-off-by: Dan McGee <dan@archlinux.org>
2011-10-13Use puts() instead of no-op printf() where applicableDan McGee6-22/+27
This replaces several printf calls of the following styles: printf("%s", ...); printf("some fixed string"); printf("x"); We can use either fputs() or putchar() here to do the same thing without incurring the overhead of the printf format parser. The biggest gain here comes when we are calling the print function in a loop repeatedly; notably when printing local package files. $ /usr/bin/time ./pacman-before -Ql | md5sum 0.25user 0.04system 0:00.30elapsed 98%CPU $ /usr/bin/time ./pacman-after -Ql | md5sum 0.17user 0.06system 0:00.25elapsed 94%CPU $ /usr/bin/time ./pacman-before -Qlq | md5sum 0.20user 0.05system 0:00.26elapsed 98%CPU $ /usr/bin/time ./pacman-after -Qlq | md5sum 0.15user 0.05system 0:00.23elapsed 93%CPU So '-Ql' shows a 17% improvement while '-Qlq' shows a 13% improvement on 382456 total files. Signed-off-by: Dan McGee <dan@archlinux.org>
2011-10-13Remove mcheck.h supportDan McGee2-10/+0
When was the last time anyone used this? That's what I thought. Signed-off-by: Dan McGee <dan@archlinux.org>
2011-10-13Fix some strict 32-bit gcc warningsDan McGee2-2/+5
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-10-13Coding style cleanupsDan McGee1-5/+5
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-10-13curl_gethost() potential bug fixupsDan McGee1-10/+14
This is in the realm of "probably not going to happen", but if someone were to translate "disk" to a string longer than 256 characters, we would have a smashed/corrupted stack due to our unchecked strcpy() call. Rework the function to always length-check the value we copy into the hostname buffer, and do it with memcpy rather than the more cumbersome and unnecessary snprintf. Finally, move the magic 256 value into a constant and pass it into the function which is going to get inlined anyway. Signed-off-by: Dan McGee <dan@archlinux.org>
2011-10-13doc/index.txt: Reformat past releases chartDan McGee1-41/+94
This makes it a three-column deal with releases all the way back to 1.0. Signed-off-by: Dan McGee <dan@archlinux.org>
2011-10-13doc: update .gitignore, add CSS override for new tables usageDan McGee3-6/+17
* Make all docs depend on Makefile; if we change flags here we want them rebuilt. * Add explicit filenames to .gitignore so we can add our own CSS override file, and add an asciidoc-override.css resource. * Adjust a few asciidoc options when generating HTML. * Remove asciidoc-manpage.css; apparantly this doesn't exist anymore. Signed-off-by: Dan McGee <dan@archlinux.org>
2011-10-13Merge branch 'maint'Dan McGee5-67/+97
Conflicts: src/pacman/util.c
2011-10-13Update NEWS for missing 4.0 stuff and 4.0.1 changes so farDan McGee1-1/+4
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-10-13scripts/*.sh.in: Honor TMPDIR environment variableLukas Fleischer2-2/+2
Replace "/tmp" with "${TMPDIR:-/tmp}" to allow for overriding the hardcoded path. Since we only use "/tmp" in conjunction with mktemp(1), we could also have used "--tmpdir", which is GNU-ish, however (and the BSD counterpart "-t" has been deprecated in GNU mktemp). Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de> Signed-off-by: Dan McGee <dan@archlinux.org>
2011-10-13scripts/*.sh.in: Fix signal handler error messagesLukas Fleischer2-3/+7
This includes some fixes to the messages that are displayed when a signal is caught in makepkg or repo-add: * Instead of always showing "==> ERROR: TERM signal caught. Exiting...", replace "TERM" by whatever signal is actually caught. * Fix a typo in the SIGERR error message in repo-add ("occurred" instead of "occured"). Francois already fixed this for makepkg in 1e51b81c. Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de> Signed-off-by: Dan McGee <dan@archlinux.org>
2011-10-13repo-add: Avoid race condition in signal handlersLukas Fleischer1-2/+8
There is a small chance that a user sends SIGINT (or any other signal that is trapped) when we're already in clean_up() which used to lead to trap_exit() being executed and the remaining code in clean_up() being skipped due to the bash signal/trap handler blocking EXIT (since its handler is already being executed, even if it's interrupted). In practice, this behaviour caused unexpected results (primarily because pressing ^C at the wrong time left a lock file behind): $ ./repo-add extra.db.tar.gz foobar ==> Extracting database to a temporary location... ^C ==> ERROR: Aborted by user! Exiting... $ ./repo-add extra.db.tar.gz foobar ==> Extracting database to a temporary location... ==> ERROR: File 'foobar' not found. ==> No packages modified, nothing to do. ^C ==> ERROR: Aborted by user! Exiting... $ ./repo-add extra.db.tar.gz foobar ==> ERROR: Failed to acquire lockfile: extra.db.tar.gz.lck. ==> ERROR: Held by process 18522 Fix this and reduce the chance of race conditions in signal handlers by: * Unhooking all traps in both clean_up() and trap_exit(). * Call clean_up() explicitly in trap_exit() to make sure we remove the lock file and the temporary directory even if we send SIGINT when clean_up() is already being executed but didn't reach the unhook code yet. Also, add an optional parameter to clean_up() to allow for setting an explicit exit code when we call clean_up() from trap_exit(). Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de> Signed-off-by: Dan McGee <dan@archlinux.org>
2011-10-12Add user-visible warning message if public keyring not foundDan McGee1-0/+3
This should help point users in the right direction if they have not initialized via pacman-key just yet. Signed-off-by: Dan McGee <dan@archlinux.org>
2011-10-12Remove alpm_list_getdata wrapper functionDan McGee14-99/+85
This one is pretty darn useless. Just derefence the ->data attribute since the type is public anyway and save yourself the function call. Signed-off-by: Dan McGee <dan@archlinux.org>
2011-10-12diskspace: extract check_mountpoint() functionDan McGee1-17/+23
This will be useful when extending disk space checks to free space checking before we download package files. Signed-off-by: Dan McGee <dan@archlinux.org>
2011-10-12_alpm_archive_fgets: optimize EOL searchDan McGee1-17/+17
Instead of iterating character by character, use memchr() calls to hopefully speed up the search. A newline is the most likely culprit, so search for that first followed by a NULL byte if there was no newline in the buffer. Signed-off-by: Dan McGee <dan@archlinux.org>
2011-10-12signing: delay gpgme_init() until latest possible momentDan McGee1-19/+27
In the default configuration, we can enter the signing code but still have nothing to do with GPGME- for example, if database signatures are optional but none are present. Delay initialization of GPGME until we know there is a signature file present or we were passed base64-encoded data. This also makes debugging with valgrind a lot easier as you don't have to deal with all the GPGME error noise because their code leaks like a sieve. Signed-off-by: Dan McGee <dan@archlinux.org>
2011-10-12VerbosePkgLists: format table lines in i18n-compatible wayDan McGee2-43/+49
This had the unfortunate implementation detail that depended on the strings having 1 byte == 1 column hold true. As we know, this is not at all the case once you move past the base ASCII character set. Reimplement this whole thing so it doesn't depend on format strings at all. Instead, simply calculate the max column widths, and then when displaying each row add the correct amount of padding using UTF-8 safe string length functions. Before: 名字 旧版本新版本 净变化 下载大小 libgee 0.6.2.1-1 0.60 MiB 0.10 MiB libsocialweb 0.25.19-2 1.92 MiB 0.23 MiB folks 0.6.3.2-1 1.38 MiB 0.25 MiB After: 名字 旧版本 新版本 净变化 下载大小 libgee 0.6.2.1-1 0.60 MiB 0.10 MiB libsocialweb 0.25.19-2 1.92 MiB 0.23 MiB folks 0.6.3.2-1 1.38 MiB 0.25 MiB Signed-off-by: Dan McGee <dan@archlinux.org>
2011-10-12Convert MALLOC to actually call malloc()Dan McGee2-3/+3
If you need zero-filled allocations, call CALLOC() instead. This was from the original definition of these macros in commit cc754bc6e3be0f3; hopefully our code is in the shape it needs to be to switch this behavior. Signed-off-by: Dan McGee <dan@archlinux.org>
2011-10-12Move infrequently used path variables off the stackDan McGee1-23/+30
These backup-related paths in package extraction are used on relatively few files during the install process, so bump them off the stack and into the heap. This removes the artificial PATH_MAX limitation on their length as well. Signed-off-by: Dan McGee <dan@archlinux.org>
2011-10-12Extract a try_rename helper from extract_single_file()Dan McGee1-20/+18
This moves the repetitive (and highly unlikely) logging work to a single location. Signed-off-by: Dan McGee <dan@archlinux.org>
2011-10-12Introduce alpm_time_t typeDan McGee12-38/+34
This will always be a 64-bit signed integer rather than the variable length time_t type. Dates beyond 2038 should be fully supported in the library; the frontend still lags behind because 32-bit platforms provide no localtime64() or equivalent function to convert from an epoch value to a broken down time structure. Signed-off-by: Dan McGee <dan@archlinux.org>
2011-10-12_alpm_parsedate: use strtoll() to parse numeric valueDan McGee1-1/+20
This prepares the function to handle values past year 2038. The return type is still limited to 32-bits on 32-bit systems; this will be adjusted in a future patch. Signed-off-by: Dan McGee <dan@archlinux.org>
2011-10-12Bump version to 4.0.0Dan McGee2-1/+3
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-10-12Final Transifex update before 4.0Dan McGee12-998/+1182
We have a few incomplete translations, but these should be addressable before the 4.0.1 maint release that is surely not that far in the future. Signed-off-by: Dan McGee <dan@archlinux.org>
2011-10-11pactest: add a better descriptionDan McGee1-1/+1
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-10-11Add note to TRANSLATORS regarding TransifexDan McGee1-9/+8
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-10-11pacman-key: don't escape single quote in usage messageDan McGee1-1/+1
This screws up gettext and causes the message to display always untranslated. Signed-off-by: Dan McGee <dan@archlinux.org>
2011-10-11Document verifying source file signatures in makepkgAllan McRae1-0/+4
Signed-off-by: Allan McRae <allan@archlinux.org> Signed-off-by: Dan McGee <dan@archlinux.org>
2011-10-11Fix typo in PKGBUILD man pageAllan McRae1-1/+1
Signed-off-by: Allan McRae <allan@archlinux.org> Signed-off-by: Dan McGee <dan@archlinux.org>
2011-10-11PKGBUILD.vim: fix epoch syntax highlightinglolilolicon1-0/+3
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-10-11Update translations from TransifexDan McGee81-1949/+2503
In prep for the 4.0.0 release. Signed-off-by: Dan McGee <dan@archlinux.org>
2011-10-10dload: unhook error buffer after transfer finishesDave Reisner1-1/+4
Similar to what we did in edd9ed6a, disconnect the relationship with our stack allocated error buffer from the curl handle. Just as an FTP connection might have some network chatter on teardown causing the progress callback to be triggered, we might also hit an error condition that causes curl to write to our (now out of scope) error buffer. I'm unable to reproduce FS#26327, but I have a suspicion that this should fix it. Signed-off-by: Dave Reisner <dreisner@archlinux.org> Signed-off-by: Dan McGee <dan@archlinux.org>
2011-10-10pactree: Make error message smarter in register_syncs()Lukas Fleischer1-1/+1
Our error message used to be very unclear when the configuration file could not be found: $ ./pactree -lsr gtk error: failed to register sync DBs Instead, display an accurate message and include the file name: $ ./pactree -lsr gtk error: config file /usr/local/etc/pacman.conf could not be read Also, move the error message inside register_syncs() to allow for differentiating between different errors that might require a handler in the future. Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de> Signed-off-by: Dan McGee <dan@archlinux.org>
2011-10-10pactree: Add "--config" optionLukas Fleischer1-3/+15
This allows for specifying an alternate configuration file path, similar to pacman's "--config" option. Given that there is currently no other way to tell pactree to read from another configuration file (except for patching or symlinking), this seems totally sensible - even if there are plans to refactor and/or replace the standalone configuration file parser. We do not define a short option for the sake of consistency with pacman's set of command line options. Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de> Signed-off-by: Dan McGee <dan@archlinux.org>
2011-10-10makepkg: strip comments after pkgver/pkgrel when checking valueAllan McRae1-2/+2
Inline comments after pkgver or pkgrel would cause the sanity checks to fail so remove them before checking the value. Signed-off-by: Allan McRae <allan@archlinux.org> Signed-off-by: Dan McGee <dan@archlinux.org>
2011-10-07Format pacsort and vercmp testsuite outputAllan McRae2-4/+8
Make the output into a single block and add separators at the end so that they do not merge into each other. Signed-off-by: Allan McRae <allan@archlinux.org> Signed-off-by: Dan McGee <dan@archlinux.org>
2011-10-06Update NEWS for 4.0.0 releaseDan McGee1-0/+71
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-10-06bacman: use globbing to get local package db pathlolilolicon1-3/+11
The original code- pkg_dir="$(echo $pac_db/$pkg_name-[0-9]*)" is problematic in several ways: - $pac_db and $pkg_name should be quoted, obviously. - It assumes pkgver always starts with an integer, while in fact it just can't contain ':' and '-'. Counterexample: the code breaks on lshw B.02.15-1. - It assumes there are no more than one directory matching the pattern. While this should be the case if everything works perfectly, it certainly relies on external conditions. Counterexample: if the local db contains two packages named foo and foo-3g, even if everything else is perfect, the code will match two directories. Don't make assumptions, use what is known. Signed-off-by: lolilolicon <lolilolicon@gmail.com>
2011-10-06bacman: add tar.Z package creation supportlolilolicon1-9/+3
bacman should support whatever makepkg does as PKGEXT. Also remove obsolete $EXT variable. Signed-off-by: lolilolicon <lolilolicon@gmail.com>