summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2010-12-29makepkg: allow pkgname usage in split package functionsAllan McRae
Currently, using $pkgname in a split package package_*() function always returns the first value in the pkgname array rather than the name of tha package being packaged. Fix this so $pkgname gives the expected value. Fixes FS#22174 Signed-off-by: Allan McRae <allan@archlinux.org> Signed-off-by: Dan McGee <dan@archlinux.org>
2010-12-29Merge branch 'depcmp-perf'Dan McGee
2010-12-29Merge branch 'fgets-perf'Dan McGee
2010-12-21Use name hashes in depends to avoid strcmp callsDan McGee
Just like we did for package name comparsions, if we add a depend name_hash field on depend struct initialization, we can use it instead of doing a string name comparison, saving us a lot of checks in the depcmp code. Signed-off-by: Dan McGee <dan@archlinux.org>
2010-12-21Remove need for memory allocation in _alpm_depcmpDan McGee
Noticed when tweaking testdb, when we run _alpm_depcmp in loops and call it seven million times, the strdup()/free() combo can add up. Remove the need for any string duplication by some pointer manipulation and use of strncmp instead of strcmp. Also kill the function logger and add an escape so we don't needlessly retrieve the list of provides. Signed-off-by: Dan McGee <dan@archlinux.org>
2010-12-21Add pactest to test long archive readsDan McGee
This creates two packages with extremely long description lines (500KB and 600 KB), causing our archive read code to perform reallocation to store the whole contents. One of the packages will successfully read while the other will fail for the time being. Signed-off-by: Dan McGee <dan@archlinux.org>
2010-12-21pactest: allow testing of package descriptionDan McGee
And modify the code to not print the full rule string if it is more than 40 characters long; truncate it instead. Signed-off-by: Dan McGee <dan@archlinux.org>
2010-12-21Overhaul archive fgets functionDan McGee
The old function was written in a time before we relied on it for nearly every operation. Since then, we have switched to the archive backend and now fast parsing is a big deal. The former function made a per-character call to the libarchive archive_read_data() function, which resulted in some 21 million calls in a typical "load all sync dbs" operation. If we instead do some buffering of our own and read the blocks directly, and then find our newlines from there, we can cut out the multiple layers of overhead and go from archive to parsed data much quicker. Both users of the former function are switched over to the new signature, made easier by the macros now in place in the sync backend parsing code. Performance: for a `pacman -Su` (no upgrades available), _alpm_archive_fgets() goes from being 29% of the total time to 12% The time spent on the libarchive function being called dropped from 24% to 6%. This pushes _alpm_pkg_find back to the title of slowest low-level function. Signed-off-by: Dan McGee <dan@archlinux.org>
2010-12-20testdb: update for new database formatDan McGee
Sync DB's no longer have an extracted directory, so remove the files check for those. Local databases no longer have a 'depends' file, so kill that check as well. Finally, do a little other cleanup and remove the need for PATH_MAX. Signed-off-by: Dan McGee <dan@archlinux.org>
2010-12-20Only check diskspace availability if needs more than zeroAllan McRae
The amount of diskspace needed for a transaction can be less than zero. Only test this against the available disk space if it is positive, which avoids a comparison being made between signed and unsigned types (-Wsign-compare). Signed-off-by: Allan McRae <allan@archlinux.org> Signed-off-by: Dan McGee <dan@archlinux.org>
2010-12-20Always specify arguement type in function delcarationsAllan McRae
Always declare a function with (void) rather than () when we expect no arguements. Fixes all warnings with -Wstrict-prototypes. Signed-off-by: Allan McRae <allan@archlinux.org> Signed-off-by: Dan McGee <dan@archlinux.org>
2010-12-20makepkg: remove last inappropriate PKGBUILD usageAllan McRae
We should always use $BUILDSCRIPT instead of PKGBUILD. The only remaining uses of PKGBUILD in makekg are in comments. Signed-off-by: Allan McRae <allan@archlinux.org> Signed-off-by: Dan McGee <dan@archlinux.org>
2010-12-20Use macros in sync DB parsingDan McGee
This simplifies a lot of the repetative code and makes it obvious where the tricky or different ones are (e.g. depends, dates). It also makes it significantly easier to change the way this code works in the future. There should be no functional change with this patch. Signed-off-by: Dan McGee <dan@archlinux.org>
2010-12-15Merge branch 'maint'Dan McGee
2010-12-15Add a cushion for diskspace checkingDan McGee
It is the minimum of 5% of disk capacity or 20 MiB on a per-partition basis. Signed-off-by: Dan McGee <dan@archlinux.org>
2010-12-15Document PKGEXT and SRCEXTAllan McRae
Add some basic documentation for the PKGEXT and SRCEXT options in makepkg.conf. Fixes FS#21302. Signed-off-by: Allan McRae <allan@archlinux.org> Signed-off-by: Dan McGee <dan@archlinux.org>
2010-12-14Reorganize fields in package structDan McGee
Saves a few bytes due to padding (256 -> 248 bytes), especially on x86_64, so we get the overhead of our new hash field right back. Signed-off-by: Dan McGee <dan@archlinux.org>
2010-12-14Used hashed package name in _alpm_pkg_findDan McGee
This results in huge gains to a lot of our codepaths since this is the most frequent method of random access to packages in a list. The gains are seen in both profiling and real life. $ pacman -Sii zvbi real: 0.41 sec -> 0.32 sec strcmp: 16,669,760 calls -> 473,942 calls _alpm_pkg_find: 52.73% -> 26.31% of time $ pacman -Su (no upgrades found) real: 0.40 sec -> 0.50 sec strcmp: 19,497,226 calls -> 524,097 calls _alpm_pkg_find: 52.36% -> 26.15% of time There is some minor risk with this patch, but most of it should be avoided by falling back to strcmp() if we encounter a package with a '0' hash value (which we should not via any existing code path). We also do a strcmp once hash values match to ensure against hash collisions. The risk left is that a package name is modified once it was originally set, but the hash value is left alone. That would probably result in a lot of other problems anyway. Signed-off-by: Dan McGee <dan@archlinux.org>
2010-12-14When setting package name, set hash value as wellDan McGee
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-12-14Add hash_sdbm functionDan McGee
This is prepping for the addition of a hash field to each package to greatly speed up the string comparisons we frequently do on package name in _alpm_pkg_find. Signed-off-by: Dan McGee <dan@archlinux.org>
2010-12-14Use _alpm_pkg_find in deps searchDan McGee
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-12-13doc/PKGBUILD: document that functions run in -e modev3.4.2Dan McGee
Caught this noted on the forums, but it is definitely worth a note in the manpage as well. Signed-off-by: Dan McGee <dan@archlinux.org>
2010-12-13Fix manpage wrap not at 80 charactersDan McGee
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-12-13Correctly force load of package reasonDan McGee
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-12-13Abstract has_scriptlet() to package ops structDan McGee
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-12-13Remove non-public functions from headerDan McGee
And rename accordingly. Signed-off-by: Dan McGee <dan@archlinux.org>
2010-12-13Mark sync_db_read() as staticDan McGee
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-12-13Abort db_populate if dbpath is not setBruno Widmann
Rather than segfault. Fixes FS#21345. Signed-off-by: Bruno Widmann <bruno.widmann@gmail.com> Signed-off-by: Dan McGee <dan@archlinux.org>
2010-12-12Update news and bump versionsDan McGee
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-12-12Update scripts/ .gitignoreDan McGee
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-12-12Create sync/ DB directory if it does not existDan McGee
Rather than error out, this is easy enough. Looks quite similar to the code in be_local for creating the local directory. Signed-off-by: Dan McGee <dan@archlinux.org>
2010-12-12pacman-optimize: ensure database directory contains local/Dan McGee
And also default dbpath to the one we may find in pacman.conf. Signed-off-by: Dan McGee <dan@archlinux.org>
2010-12-12Add script to update pacman database formatAllan McRae
The pacman-db-upgrade script was added to detect old pacman database formats and upgrade them. Currently performs the merging of depends files into desc files in the local database. Signed-off-by: Allan McRae <allan@archlinux.org> Signed-off-by: Dan McGee <dan@archlinux.org>
2010-12-12Update pactest suite for change in db structureAllan McRae
Merging desc and depends files in sync and local db. Signed-off-by: Allan McRae <allan@archlinux.org> Signed-off-by: Dan McGee <dan@archlinux.org>
2010-12-12Merge desc and depends files in local dbAllan McRae
Whenever depends is needed from the local db, so is desc. The only disadvantage to merging them is the additional time taken to read the depends entries when they are not needed. As depends is in general relatively small, the additional time taken to read it in will be negligable. Also, merging these files will speed up local database access due to less file seeks. Signed-off-by: Allan McRae <allan@archlinux.org> Signed-off-by: Dan McGee <dan@archlinux.org>
2010-12-12Attempt to stop installation when we encounter problemsDan McGee
This should hopefully address some of the concerns raised in FS#11639 with regards to continuing after filling the disk up. Add some more checks and passing of error conditions between our functions. When a libarchive warning is encountered, check if it is due to lack of disk space and if so upgrade it to an error condition. A review of other libarchive warnings suggests that these are less critical and can remain as informative warning messages at this stage. Note the presence of errors after extraction of an entire package is complete. If so, we abort the transaction to be on the safe side and keep damage to a minimum. Signed-off-by: Dan McGee <dan@archlinux.org> [Allan: make ENOSPC warning into an error] Signed-off-by: Allan McRae <allan@archlinux.org> Signed-off-by: Dan McGee <dan@archlinux.org>
2010-12-12Turn libarchive warnings into libalpm warningsDan McGee
Rather than hiding these warnings, show them to the user as they happen. This will prevent things such as hiding full filesystem errors (ENOSPC) from the user as seen in FS#11639. Signed-off-by: Dan McGee <dan@archlinux.org> [Allan: adjust warning wording and add gettext calls] Signed-off-by: Allan McRae <allan@archlinux.org> Signed-off-by: Dan McGee <dan@archlinux.org>
2010-12-12Make reading from any file possible in sync DBDan McGee
Whether it be "desc", "depends", or "deltas", it really doesn't matter- treat them all the same and have the ability to read any data from any file in that list. This continues the work in a44c7b8956. Signed-off-by: Dan McGee <dan@archlinux.org>
2010-12-12Explicitly test time difference is greater than zeroAllan McRae
We are comparing a floating point number so should use an inequality rather than implicitly testing != 0. Prevents warning given by -Wfloat-equal. Signed-off-by: Allan McRae <allan@archlinux.org> Signed-off-by: Dan McGee <dan@archlinux.org>
2010-12-12makepkg: perform sanity checks on variables in package functionsAllan McRae
Check the over-ridden entries for provides, backup, optdepends and options for illegal entries. Partially fixes FS#16004. Signed-off-by: Allan McRae <allan@archlinux.org>
2010-12-12diskspace style cleanups and small fixesDan McGee
* Use our normal return() function syntax * Rework a few things to reduce number of casts * Fix void function argument declaration * Add missing gettext _() call * Remove need for seperate malloc() of statvfs/statfs structure * Unify argument order of static functions- mountpoints now always passed first * Count all files that start with '.' in a package against the DB * Rename db to db_local in check_diskspace to clarify some code * Fix some line wrapping to respect 80 characters Signed-off-by: Dan McGee <dan@archlinux.org> Signed-off-by: Allan McRae <allan@archlinux.org>
2010-12-12Refactor statfs/statvfs type checkDan McGee
Turn it into a configure-type typedef, which allows us to reduce the amount of duplicated code and clean up some #ifdef magic in the code itself. Adjust some of the other defined checks to look at the headers available rather than trying to pull in the right ones based on configure checks. Signed-off-by: Dan McGee <dan@archlinux.org> Signed-off-by: Allan McRae <allan@archlinux.org>
2010-12-12Display progress bar for disk space checkingAllan McRae
Checking disk space needed for a transaction can take a while so add an informative progress bar. Signed-off-by: Allan McRae <allan@archlinux.org> Signed-off-by: Dan McGee <dan@archlinux.org>
2010-12-12Add configuration option to control disk space checkingAllan McRae
Disk space checking is likely to be an unnecessary bottleneck to people with reasonable partition sizes so add a configuration option to allow it to be disabled/enabled as wanted. Signed-off-by: Allan McRae <allan@archlinux.org> Signed-off-by: Dan McGee <dan@archlinux.org>
2010-12-12Implement disk space checkingAllan McRae
Pull together the work of the previous commits to implement a check for enough free space before performing an install transaction. Abort if there is not enough free space with an appropriate pm_errno.. Signed-off-by: Allan McRae <allan@archlinux.org> Signed-off-by: Dan McGee <dan@archlinux.org>
2010-12-12Add functions to calculate approximate disk usage by packagesAllan McRae
Two helper function are added to calculate the disk usage from packages that are either currently installed on the system or from a package archive. Some minor approximations have been made: 1. Size for directories is not considered when removing a package from the filesystem to avoid multiple counting across packages. Also, these are reported to take zero size while installing. 2. Symlinks are reported to contribute zero size towards removal as libarchive reports them to have zero size for install. 3. Package data files (.PKGINFO, .INSTALL, .CHANGELOG) are counted towards usage on dbpath on install, but their size is not counted on package removal. 4. No handling of extra size needed for .pacsave/.pacnew files. Signed-off-by: Allan McRae <allan@archlinux.org> Signed-off-by: Dan McGee <dan@archlinux.org>
2010-12-12Add function to match file to mount pointAllan McRae
For a given file, determine which mount point it is on or will be installed to. Take into account that we might be using an alternative installation root. Add additional helper function added to sort mount point list for easier matching. Signed-off-by: Allan McRae <allan@archlinux.org> Signed-off-by: Dan McGee <dan@archlinux.org>
2010-12-12Add function for listing system mount pointsAllan McRae
Add a mount_point_list() function that attempts to portably obtain a list of system mount points and a struct to hold needed mount point information. Abort the transaction if we are unable to determine the mount points. Signed-off-by: Allan McRae <allan@archlinux.org> Signed-off-by: Dan McGee <dan@archlinux.org>
2010-12-12Prototype disk space checking functionalityAllan McRae
Very basic prototyping for adding functionality to check free disk space before performing package installs. Signed-off-by: Allan McRae <allan@archlinux.org> Signed-off-by: Dan McGee <dan@archlinux.org>
2010-12-12Remove AC_TYPE_SIGNAL usageDan McGee
This macro is deemed unnecessary by even the autoconf guys, so we really don't need to use it. Signed-off-by: Dan McGee <dan@archlinux.org> Signed-off-by: Allan McRae <allan@archlinux.org> Signed-off-by: Dan McGee <dan@archlinux.org>