summaryrefslogtreecommitdiffstats
path: root/lib/libalpm/be_sync.c
AgeCommit message (Collapse)AuthorFilesLines
2010-12-21Overhaul archive fgets functionDan McGee1-5/+10
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-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-14Remove non-public functions from headerDan McGee1-2/+2
And rename accordingly. Signed-off-by: Dan McGee <dan@archlinux.org>
2010-12-14Mark sync_db_read() as staticDan McGee1-2/+6
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-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-13dirent usage cleanupDan McGee1-1/+0
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-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-13Fix a few problems reported by clang-analyzerXavier Chantry1-7/+5
One missing NULL-check and 3 dead assignments. Signed-off-by: Xavier Chantry <chantry.xavier@gmail.com> Signed-off-by: Dan McGee <dan@archlinux.org>
2010-10-14Add epoch support to pacman/libalpmDan McGee1-1/+10
This will allow for better control of what was previously the 'force' option in a PKGBUILD and transferred into the built package. Signed-off-by: Dan McGee <dan@archlinux.org>
2010-10-14Small tweaks after backend mergeDan McGee1-6/+0
Just a few small things I noticed looking through the code. Signed-off-by: Dan McGee <dan@archlinux.org>
2010-10-14Clean-up parsing sync databaseAllan McRae1-26/+1
Remove unnecessary parsing of fields not found in sync desc file. Signed-off-by: Allan McRae <allan@archlinux.org>
2010-10-14Move and rename splitnameAllan McRae1-1/+1
The splitname function is a general utility function and so is better suited to util.h. Rename it to _alpm_splitname to indicate it is an internal libalpm function as was the case prior to splitting local and sync db handling. Signed-off-by: Allan McRae <allan@archlinux.org>
2010-10-14Only download sync databasesAllan McRae1-163/+2
As the sync databases are read directly from the tarball, we no longer need to extract them. Signed-off-by: Allan McRae <allan@archlinux.org>
2010-10-14Parse sync databaseAllan McRae1-412/+125
Read in package information for a tar based sync database. Do not use lazy loading for sync db. Signed-off-by: Allan McRae <allan@archlinux.org>
2010-10-14Populate sync db from archiveAllan McRae1-25/+33
Read in list of packages for sync db from tar archive. Breaks reading in _alpm_sync_db_read and a lot of pactests (which is expected as they do not handle sync db in archives...). Signed-off-by: Allan McRae <allan@archlinux.org>
2010-10-14Completely separate local and sync db handlingAllan McRae1-33/+38
Put the db_operations struct to use and completely split the handling of the sync and local databases. Signed-off-by: Allan McRae <allan@archlinux.org>
2010-10-14Separate be_files into be_sync and be_localAllan McRae1-0/+906
The file be_files.c is "split" to be_local.c and be_sync.c in order to achieve separate handling of sync and local databases. Some basic clean-up of functions that are only of use for local or sync databases has been performed and some rough function renaming in duplicated code has been performed to prevent compilation errors. However, most of the clean-up and final separation of sync and local db handling occurs in following patches. Signed-off-by: Allan McRae <allan@archlinux.org>