summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2011-10-06bacman: use globbing to get local package db pathlolilolicon
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 supportlolilolicon
bacman should support whatever makepkg does as PKGEXT. Also remove obsolete $EXT variable. Signed-off-by: lolilolicon <lolilolicon@gmail.com>
2011-10-06bacman: small code cleanuplolilolicon
This includes: - Quoting fixes. - Drop deprecated mktemp option -p. - Set extglob nullglob shell options at the top. - Use extended globbing instead of regex to match %HEADER% in pacman db. Signed-off-by: lolilolicon <lolilolicon@gmail.com>
2011-10-06bacman: bashify using [[ ]] and (( ))lolilolicon
Another style change. The [[ expression ]] form is particularly cleaner, safer and more powerful than the [ expression ] form. Signed-off-by: lolilolicon <lolilolicon@gmail.com>
2011-10-06bacman: indent code using TABlolilolicon
As every piece of code in the whole project uses TAB as indentation character, bacman shouldn't be an exception. Signed-off-by: lolilolicon <lolilolicon@gmail.com>
2011-10-05Enable CheckSpace by default in default config fileDan McGee
This will have to be picked up downstream of course, but addresses FS#25684 now that this is a lot faster in 4.0 than it was in the original 3.5 implementation. Also make curl the first XferCommand listed, as we are moving away from any other download program at this point. Signed-off-by: Dan McGee <dan@archlinux.org>
2011-10-05Update translation message catalogs in prep for 4.0 releaseDan McGee
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-10-05Add a top-level 'update-po' make targetDan McGee
This makes the maintainer's life (read: my life) a lot easier when updating translation files to push to Transifex. Signed-off-by: Dan McGee <dan@archlinux.org>
2011-10-05Update translations from TransifexDan McGee
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-10-05pacman-key: treat foo-trusted as an ownertrust export fileDan McGee
This allows it to serve double-duty. In order to allow users to base verification decisions off of both a valid signature and a trusted signature, we need to assign some level of owner trust to the keys we designate as trusted on import. Signed-off-by: Dan McGee <dan@archlinux.org>
2011-10-05pacman-key: refine and clarify import/import-trustdb behaviorDan McGee
* --import now only imports keys from pubkey.gpg and does not import owner trust; if you want to have both simply run the operations in sequence. * --import-trustdb has been simplified; it will overwrite existing values in the trust database as before, but there is no need to export it first as those values are safe if left untouched. * Fix the manpage referring to a non-existent option. Signed-off-by: Dan McGee <dan@archlinux.org>
2011-10-04Parse '0' as a valid package installed sizeDan McGee
This was a bad oversight on my part, pointed out by Jakob. Whoops. Signed-off-by: Dan McGee <dan@archlinux.org>
2011-10-03makepkg: create tar file for bogus PKGEXTlolilolicon
If PKGEXT is not one of the recognized tar*'s, create_package() would create an empty package file and fail, since bsdtar on the left side of the pipe returns 141 on SIGPIPE (broken pipe). This patch changes the behavior for an invalid PKGEXT. A warning is printed on stderr, and a tar file is created. Also retire the obsolete $EXT variable. Add the obligatory comment why we don't use bsdtar's compression. Finally, fix mixed-tab-space indentation. Signed-off-by: lolilolicon <lolilolicon@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
2011-09-30Use _alpm_local_db_pkgpath in _cache_changelog_openDan McGee
Another place where we were doing the dirty work by hand. Signed-off-by: Dan McGee <dan@archlinux.org>
2011-09-30makepkg: support .tar.Z source packages creationlolilolicon
SRCEXT should allow whatever PKGEXT does. Also address an uninitialized use of $ret. Signed-off-by: lolilolicon <lolilolicon@gmail.com>
2011-09-30Revamp scriptlet path formation for scriptlets in local databaseDan McGee
Expose the current static get_pkgpath() function internally to the rest of the library as _alpm_local_db_pkgpath(). This allows use of this convenience function in add.c and remove.c when forming the path to the scriptlet location. Signed-off-by: Dan McGee <dan@archlinux.org>
2011-09-30Refactor _alpm_runscriptlet()Dan McGee
Add an is_archive parameter to reduce the amount of black magic going on. Rework to use fewer PATH_MAX sized local variables, and simplify some of the logic where appropriate in both this function and in the callers where duplicate calls can be replaced by some conditional parameter code. Signed-off-by: Dan McGee <dan@archlinux.org>
2011-09-30paccache: proper quoting in [[ expression ]]lolilolicon
Always quote the right-hand side of expression when the == or != operator is used, unless intended as a pattern. Signed-off-by: lolilolicon <lolilolicon@gmail.com> Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2011-09-30paccache: declare variables explicitlylolilolicon
Declare and initialize integer variables 'needsroot' and 'verbose'. Don't use the fact that (( undefined_variable )) evaluates to 0. Signed-off-by: lolilolicon <lolilolicon@gmail.com> Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2011-09-30pacman-key: remove errexit flag from shebangDave Reisner
We're ill equipped to be using this flag as we don't trap and respond to the ERR signal. The result is that if is ever tripped, pacman-key will instantly exit with no indication of why. At the same time, we're already fairly good about doing our own error checking and verbalizing it before dying. Signed-off-by: Dave Reisner <dreisner@archlinux.org> Signed-off-by: Dan McGee <dan@archlinux.org>
2011-09-30pacman-key: return 0 from get_from if default value usedAllan McRae
This prevents the error trap being set off when GPGDir is commented in pacman.conf. Bug introduced in 507b01b9. Signed-off-by: Allan McRae <allan@archlinux.org> Signed-off-by: Dan McGee <dan@archlinux.org>
2011-09-30Remove redundant transaction size outputAllan McRae
Printing all of "Installed", "Removed" and "Net Upgrade" sizes is redundant as the difference of the first two is the last. Instead, only print "Installed Size" and "Net Upgrade Size" when both the installed and removed are non-zero. This results in the following output in the following cases: - package installation only: Installed Size - package removal only: Removed Size - package installation involving replacement: Installed + Net Upgrade Size - package upgrade: Installed + Net Upgrade Size - combination upgrade and installation: Installed + Net Upgrade Size Download Size remains outputted whenever something is downloaded. Signed-off-by: Allan McRae <allan@archlinux.org> Signed-off-by: Dan McGee <dan@archlinux.org>
2011-09-29paccache: allow strictly integer for -k optionlolilolicon
Verify the argument to -k is a non-negative integer. Leading zeros are simply stripped. 'declare -i keep' allowed the argument to -k to be any arithmetic evaluation expression. The simple assignment 'keep=$OPTARG' triggers arithmetic evaluation implicitly, which can either consume a huge amount of resources with input such as '2**2**32' or immediately produce an error on invalid input. Instead, we simply 'declare -- keep' and avoid all that. Signed-off-by: lolilolicon <lolilolicon@gmail.com> Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2011-09-29Remove redundant "removal" output in pure remove operationAllan McRae
Printing "[removal]" beside all package names is redundant when all packages are being removed (i.e. when using -R). Signed-off-by: Allan McRae <allan@archlinux.org>
2011-09-29move prevprogress onto payload handleDave Reisner
This is a poor place for it, and it will likely move again in the future, but it's better to have it here than as a static variable. Initialization of this variable is now no longer necessary as its zeroed on creation of the payload struct. Signed-off-by: Dave Reisner <dreisner@archlinux.org> Signed-off-by: Dan McGee <dan@archlinux.org>
2011-09-28pkgdelta: proper quoting in [[ expression ]]lolilolicon
Always quote the right-hand side of expression when the == or != operator is used, unless intended as a pattern. Signed-off-by: lolilolicon <lolilolicon@gmail.com>
2011-09-28makepkg: proper quoting in [[ expression ]]lolilolicon
Always quote the righthand side of expression when the == or != operator is used, unless intended as a pattern. Quoting bash(1): When the == and != operators are used, the string to the right of the operator is considered a pattern. Any part of the pattern may be quoted to force it to be matched as a string. Signed-off-by: lolilolicon <lolilolicon@gmail.com>
2011-09-28Refactor display_targets to not be recursiveDan McGee
This also fixes a memory leak and makes the dual-purpose "rows" variable go away in favor of storing the rows and non-verbose names separately. This also fixes some potential memory leaks and/or wrong behavior due to the config->verbosepkglists flag being flipped, which we should never be doing. Signed-off-by: Dan McGee <dan@archlinux.org>
2011-09-28Refactor download payload reset and freeDan McGee
This was done to squash a memory leak in the sync database download code. When we downloaded a database and then reused the payload struct, we could find ourselves calling get_fullpath() for the signatures and overwriting non-freed values we had left over from the database download. Refactor the payload_free function into a payload_reset function that we can call that does NOT free the payload itself, so we can reuse payload structs. This also allows us to move the payload to the stack in some call paths, relieving us of the need to alloc space. Signed-off-by: Dan McGee <dan@archlinux.org>
2011-09-28Initialize cURL library on first useDan McGee
Rather than always initializing it on any handle creation. There are several frontend operations (search, info, etc.) that never need the download code, so spending time initializing this every single time is a bit silly. This makes it a bit more like the GPGME code init path. Signed-off-by: Dan McGee <dan@archlinux.org>
2011-09-28Add more valgrind suppressionsDan McGee
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-09-28verbose package lists: remove errant debuggerDan McGee
Left this in as part of the last set of commits, whoops. Signed-off-by: Dan McGee <dan@archlinux.org>
2011-09-28Always show download size if -w/--downloadonly was providedDan McGee
The prompt can be rather confusing otherwise when all files have already been downloaded, but there is not a single total size listed. Signed-off-by: Dan McGee <dan@archlinux.org>
2011-09-28Table format creation code cleanupDan McGee
Better scoping of variables for the most part, and ensure we are using string_length() and not strlen() as appropriate. Also refactor the longest cell code to call string_length() a lot less; by simply using an array of max sizes we don't have to recompute values nearly as much. Signed-off-by: Dan McGee <dan@archlinux.org>
2011-09-28Use unsigned types for indent width and column countDan McGee
For getcols(), the functions we call return a value of type 'unsigned short', so it makes sense for us to do the same. string_length() is meant to behave like strlen(), so it should return type size_t. This exposes other functions such as indentprint() which should also be using signed return types. Signed-off-by: Dan McGee <dan@archlinux.org>
2011-09-28Show download sizes when using -S/--syncDan McGee
We now label the old 'Size' column as 'Net Change' to reflect the reality of what we are looking at. Sync operations now get an additional 'Download Size' column. Signed-off-by: Dan McGee <dan@archlinux.org>
2011-09-28Keep track of explicitly added and removed packagesDan McGee
This allows us to sort the output list by showing all pulled dependencies first, followed by the explicitly specified targets. Signed-off-by: Dan McGee <dan@archlinux.org>
2011-09-28Combine add and removal package list displayDan McGee
There was no real reason for these to be done separately. Signed-off-by: Dan McGee <dan@archlinux.org>
2011-09-28Track unresolvable transaction packagesDan McGee
Rather than free them right away, keep the list on the transaction as we already do with add and remove lists. This is necessary because we may be manipulating pointers the frontend needs to refer to packages, and we are breaking our contract as stated in the alpm_add_pkg() documentation of only freeing packages at the end of a transaction. This fixes an issue found when refactoring the package list display code. Signed-off-by: Dan McGee <dan@archlinux.org>
2011-09-28Move pacsave path construction code off the stackDan McGee
This is definitely not in the normal hot path, so we can afford to do some temporary heap allocation here. Signed-off-by: Dan McGee <dan@archlinux.org>
2011-09-28Use the full buffer when computing md5/sha256 sumsDan McGee
No wonder these were slower than expected. We were only reading 4 (32-bit) or 8 (64-bit) bytes at a time and feeding it to the hash functions. Define a buffer size constant and use it correctly so we feed 8K at a time into the hashing algorithm. This cut one larger `-Sw --noconfirm` operation, with nothing to actually download so only timing integrity, from 3.3s to 1.7s. This has been broken since the original commit eba521913d6 introducing OpenSSL usage for crypto hash functions. Boy do I feel stupid. Signed-off-by: Dan McGee <dan@archlinux.org>
2011-09-28Fix memory leak in download payload->remote_nameDan McGee
In the sync code, we explicitly allocated a string for this field, while in the dload code itself it was filled in with a pointer to another string. This led to a memory leak in the sync download case. Make remote_name non-const and always explicitly allocate it. This patch ensures this as well as uses malloc + snprintf (rather than calloc) in several codepaths, and eliminates the only use of PATH_MAX in the download code. Signed-off-by: Dan McGee <dan@archlinux.org>
2011-09-27Revert "libalpm: compare pkgname with strcoll"Dan McGee
This commit was made with the intent of displaying "correctly" sorted package lists to users. Here are some reasons I think this is incorrect: * It is done in the wrong place. If a frontend application wants to show a different order of packages dependent on locale, it should do that on its own. * Even if one wants a locale-specific order, almost all package names are all ASCII and language agnostic, so this different comparison makes little sense and may serve only to confuse people. * _alpm_pkg_cmp was unlike any other comparator function. None of the rest had any dependency on anything but the content of the structs being compared (e.g., they only used strcmp() or other basic comparison operators). This reverts commit 3e4d2c3aa65416487939148828afb385de2ee146. Signed-off-by: Dan McGee <dan@archlinux.org>
2011-09-27_alpm_splitdep: use malloc instead of callocDan McGee
There was only one simple to handle case where we left a field uninitialized; set it to NULL and use malloc() instead. Signed-off-by: Dan McGee <dan@archlinux.org>
2011-09-27be_sync: fetch only entry mode, not full stat structDan McGee
This saves a lot of unnecessary work since we don't need any of the other fields in the stat struct. Signed-off-by: Dan McGee <dan@archlinux.org>
2011-09-27alpm_list: use malloc instead of callocDan McGee
In every case we were calling calloc, the struct we allocated (or the memory to be used) is fully specified later in the method. For alpm_list_t allocations, we always set all of data, next, and prev. For list copying and transforming to an array, we always copy the entire data element, so no need to zero it first. Signed-off-by: Dan McGee <dan@archlinux.org>
2011-09-27makepkg: ensure '-' is last in a character globDave Reisner
If '-' isn't the last item, it's interpreted as a range and not literally, causing problematic behavior in parsing optdepends. Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2011-09-27pacman-key: use consistent punctuation in error messagesDan McGee
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-09-27Fix compilation using --without-gpgmeDan McGee
I'm really good at breaking this on a regular basis. If only we had some sort of automated testing for this... Signed-off-by: Dan McGee <dan@archlinux.org>
2011-09-27Remove unnecessary loggerDan McGee
This is just a wrapper function; the real function we call logs an almost identical line. Signed-off-by: Dan McGee <dan@archlinux.org>