summaryrefslogtreecommitdiffstats
AgeCommit message (Collapse)AuthorFilesLines
2010-12-21Only check diskspace availability if needs more than zeroAllan McRae1-1/+2
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-21Always specify arguement type in function delcarationsAllan McRae6-28/+28
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-21makepkg: remove last inappropriate PKGBUILD usageAllan McRae1-1/+1
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-21Use macros in sync DB parsingDan McGee1-99/+52
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 McGee3-20/+25
2010-12-15Add a cushion for diskspace checkingDan McGee1-3/+8
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 McRae1-2/+3
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-15Reorganize fields in package structDan McGee1-13/+15
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 McGee1-2/+13
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 McGee4-0/+4
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-12-14Add hash_sdbm functionDan McGee2-0/+22
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 McGee1-2/+2
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-12-14doc/PKGBUILD: document that functions run in -e modev3.4.2Dan McGee1-7/+11
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-14Fix manpage wrap not at 80 charactersDan McGee1-10/+11
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-12-14Correctly force load of package reasonDan McGee1-5/+1
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-12-14Abstract has_scriptlet() to package ops structDan McGee3-14/+19
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-12-14Remove non-public functions from headerDan McGee3-7/+4
And rename accordingly. Signed-off-by: Dan McGee <dan@archlinux.org>
2010-12-14Mark sync_db_read() as staticDan McGee2-3/+6
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-12-13Abort db_populate if dbpath is not setBruno Widmann1-0/+3
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-13Update news and bump versionsDan McGee2-3/+3
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-12-13Update scripts/ .gitignoreDan McGee1-0/+1
Signed-off-by: Dan McGee <dan@archlinux.org>
2010-12-13Create sync/ DB directory if it does not existDan McGee1-0/+18
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-13pacman-optimize: ensure database directory contains local/Dan McGee1-2/+4
And also default dbpath to the one we may find in pacman.conf. Signed-off-by: Dan McGee <dan@archlinux.org>
2010-12-13Add script to update pacman database formatAllan McRae2-0/+124
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-13Update pactest suite for change in db structureAllan McRae2-48/+18
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-13Merge desc and depends files in local dbAllan McRae3-94/+61
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-13Attempt to stop installation when we encounter problemsDan McGee1-32/+48
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-13Turn libarchive warnings into libalpm warningsDan McGee2-3/+3
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-13Make reading from any file possible in sync DBDan McGee1-12/+8
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-13Explicitly test time difference is greater than zeroAllan McRae1-1/+1
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-13makepkg: perform sanity checks on variables in package functionsAllan McRae1-6/+13
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-13diskspace style cleanups and small fixesDan McGee2-50/+55
* 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-13Refactor statfs/statvfs type checkDan McGee4-62/+50
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-13Display progress bar for disk space checkingAllan McRae4-3/+36
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-13Add configuration option to control disk space checkingAllan McRae7-4/+31
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-13Implement disk space checkingAllan McRae3-1/+45
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-13Add functions to calculate approximate disk usage by packagesAllan McRae2-0/+103
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-13Add function to match file to mount pointAllan McRae1-0/+28
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-13Add function for listing system mount pointsAllan McRae3-1/+160
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-13Prototype disk space checking functionalityAllan McRae4-0/+66
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-13Remove AC_TYPE_SIGNAL usageDan McGee3-3/+2
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>
2010-12-13dirent usage cleanupDan McGee6-5/+2
We were including the header in a lot of places it is no longer used. Additionally, use the correct autoconf macro for determining whether d_type is available as a member: HAVE_STRUCT_DIRENT_D_TYPE. Signed-off-by: Dan McGee <dan@archlinux.org> Signed-off-by: Allan McRae <allan@archlinux.org> Signed-off-by: Dan McGee <dan@archlinux.org>
2010-12-13Move MAX_DELTA_RATIO definitionAllan McRae2-3/+3
This is a delta specific definition so it makes more sense to put it in the delta specific header file. Signed-off-by: Allan McRae <allan@archlinux.org> Signed-off-by: Dan McGee <dan@archlinux.org>
2010-12-13Combine reading from depends and desc in sync dbAllan McRae1-7/+2
This will allow us to eventually combine the depends and desc entries within the sync database. Signed-off-by: Allan McRae <allan@archlinux.org> Signed-off-by: Dan McGee <dan@archlinux.org>
2010-12-13makepkg: remove dead code from handle_depsAndres P1-2/+0
The error message that has been removed never gets to print because, given the same condition, handle_deps throws the same error and then immediately exits makepkg. Signed-off-by: Andres P <aepd87@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org> Signed-off-by: Dan McGee <dan@archlinux.org>
2010-12-13makepkg: do not ignore errors from pacman when checking depsAndres P1-6/+7
As check_deps is run in a subshell, exit had the same meaning as return. Since the intention is to halt makepkg when pacman throws an error other than 127, the enclosing function has to handle error control instead. Fixes FS#19840 Signed-off-by: Andres P <aepd87@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org> Signed-off-by: Dan McGee <dan@archlinux.org>
2010-12-13makepkg: use portable escape sequence for terminal escapesCarlos Diaz1-6/+6
The escape string isn't necesarily \033; it's determined by what the particular termcap/info entry for that terminal contains. Bash uses ncurses functions to expand \e to the _correct_ terminal escape. Signed-off-by: Carlos Diaz <839273@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org> Signed-off-by: Dan McGee <dan@archlinux.org>
2010-12-13Add epoch to PKGBUILD prototypesAllan McRae2-0/+2
Signed-off-by: Allan McRae <allan@archlinux.org> Signed-off-by: Dan McGee <dan@archlinux.org>
2010-12-13src/util: update .gitignoreDan McGee1-7/+8
Add pactree and sort entries. Signed-off-by: Dan McGee <dan@archlinux.org>
2010-12-13contrib: remove bash pactreeXavier Chantry3-327/+0
This has been rewitten in C which is much much faster. Signed-off-by: Xavier Chantry <chantry.xavier@gmail.com>