summaryrefslogtreecommitdiffstats
AgeCommit message (Collapse)AuthorFilesLines
2008-04-26Completely rework delta algorithmChantry Xavier9-209/+218
Using the graph structures that Nagy set up for dependency sorting, we now do a similar process for deltas. Load up all of the deltas into a graph object on which we can then apply Dijkstra's algorithm, using the new weight field of graph struct. We initialize the nodes weight using the base files that we can use in our filecache (both filename and md5sum must match). The algorithm then picks the best path among those that can be resolved. Note that this algorithm has a few advantages over the old one: 1. It is completely file agnostic. These delta chains do not have to consist of package files- this could be adopted to do delta-fied DBs. 2. It does not use the local_db anymore, or even care if a package or file is currently installed. Instead, it only looks in the filecache for files and packages that match delta chain entries. Original-work-by: Dan McGee <dan@archlinux.org> Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
2008-04-26Rework delta struct and modify code accordinglyDan McGee4-68/+67
Start to move the delta struct away from an assumed package name scheme and towards something that is package (or even filename) agnostic. This will allow us much greater flexibility in the usage of deltas (maybe even sync DBs some day) as well as allowing code outside of delta.h/delta.c to be much cleaner with less of a need for snprintf() calls. Signed-off-by: Dan McGee <dan@archlinux.org>
2008-04-26Refactor the trans init and release code.Chantry Xavier5-85/+52
The calls to alpm_trans_init and alpm_trans_release (+ error checking) were duplicated between remove.c, sync.c and upgrade.c This patch introduces trans_init and trans_release functions in util.c to have this code just once. So instead of having to do the same change 3 times for fixing FS#10273, I just had to do it once (so I did it too :)) Signed-off-by: Chantry Xavier <shiningxc@gmail.com> Signed-off-by: Dan McGee <dan@archlinux.org>
2008-04-26Kill compute_requiredby usage in can_remove_package()Nagy Gabor1-8/+10
In the can_remove_package function, we don't need to compute the whole requiredby list, we just need to find one member of it that doesn't belong to the targets list. That way we get a small speedup and remove the only usage of alpm_pkg_compute_requiredby in the backend, so that it can be tweaked for frontend usage. Signed-off-by: Nagy Gabor <ngaba@bibl.u-szeged.hu> Signed-off-by: Chantry Xavier <shiningxc@gmail.com> Signed-off-by: Dan McGee <dan@archlinux.org>
2008-04-19Merge branch 'maint'Dan McGee3-14/+22
Conflicts: pactest/pmtest.py
2008-04-19Give libalpm native support for both libdownload and libfetchDan McGee3-7/+41
This should remove the need for any additional patching to run on platforms that have libfetch available but not libdownload. It isn't the prettiest, but we have kept our libdownload impact down to just a few files, so it can be easily done. Signed-off-by: Dan McGee <dan@archlinux.org>
2008-04-19Remove unnecessary NULL check in FREE() macroDan McGee1-1/+1
free() is designed to do nothing if it is passed a NULL pointer, so there is no need to check for it on our end. Change/fix the macro. Signed-off-by: Dan McGee <dan@archlinux.org>
2008-04-17pactest : Use tarfile module.Chantry Xavier2-12/+20
Previously, tar was called manually with os.system. This caused one fork per package/db creation, which is costly, especially on cygwin. Besides, it also caused some problems with directory with whitespaces (that could also be fixed with quotes, but well..) Using tarfile module is cleaner and more efficient, and still easy enough. Benchmark (time make check) : - windows / cygwin prepatch: real 6m36.360s user 2m28.914s sys 2m35.866s postpatch: real 5m25.428s user 1m26.029s sys 2m0.006s - linux prepatch: real 1m22.629s user 0m31.498s sys 0m18.899s postpatch: real 1m11.465s user 0m26.382s sys 0m12.986s Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
2008-04-17pactest: Add quotes for directory with whitespacesChantry Xavier1-2/+2
Signed-off-by: Chantry Xavier <shiningxc@gmail.com> Signed-off-by: Dan McGee <dan@archlinux.org>
2008-04-16Merge branch 'maint'Dan McGee5-7/+19
2008-04-16Slight changes to fix warnings from autoconf 2.62Dan McGee1-2/+2
Two variables needed the _cv_ or warnings were spit out saying they were not cache vars. Signed-off-by: Dan McGee <dan@archlinux.org>
2008-04-15More non-Linux build updates, mostly DarwinDan McGee3-3/+15
Darwin's binary format does support symbols with differing visibilities, but it does not support the protected or internal visibilities- only hidden. For Darwin only, we should fall back to this visibility to prevent warnings from the compiler and because it is close enough for our library purposes. See http://gcc.gnu.org/viewcvs/*checkout*/trunk/gcc/config/darwin.c, search for the "darwin_assemble_visibility" function for more details. Also add pacman.static.exe to gitignore. Signed-off-by: Dan McGee <dan@archlinux.org>
2008-04-15Fix gettext on non-Linux platformsDan McGee2-2/+2
Linux includes all the gettext stuff in glibc, so there is no need for the libintl links which we failed to include in our linker variables. Update the makefiles which should enable NLS support on all platforms, including OS X and Cygwin. Signed-off-by: Dan McGee <dan@archlinux.org>
2008-04-15Fix compilation errors on x86_64Dan McGee1-2/+2
Things must have gotten stricter with GCC 4.3 on the '%zd' printf string and this is the first I've tried to compile there. Fix the problem by using size_t instead of int. Signed-off-by: Dan McGee <dan@archlinux.org>
2008-04-15remove.c: refactor into functionsK. Piche1-40/+59
Pulled two loops out of _alpm_remove_prepare and gave them their own functions. Signed-off-by: K. Piche <kevin@archlinux.org> Signed-off-by: Dan McGee <dan@archlinux.org>
2008-04-15Some comments for _alpm_unpack.K. Piche1-0/+11
Signed-off-by: K. Piche <kevin@archlinux.org> Signed-off-by: Dan McGee <dan@archlinux.org>
2008-04-15add.c: added some tracing and improved some variable localityK. Piche1-3/+10
Signed-off-by: K. Piche <kevin@archlinux.org> [Dan: removed one logger] Signed-off-by: Dan McGee <dan@archlinux.org>
2008-04-11Memory allocation and other small cleanupsDan McGee1-11/+9
Signed-off-by: Dan McGee <dan@archlinux.org>
2008-04-11Merge branch 'maint'Dan McGee1-6/+4
2008-04-11Remove unnecessary import in dload.hDan McGee1-1/+0
We no longer expose any of libdownload in our public functions, so no need to include this header anymore. Signed-off-by: Dan McGee <dan@archlinux.org>
2008-04-09Correctly use the fd returned my mkstemp()Dan McGee1-6/+4
There were a few issues with this code: 1. We already had an open fd to a file, but never used it to our benefit. Use the libarchive convienence method to write the current file contents straight to a file descriptor. 2. The real problem cropped up on Windows where the locking semantics caused the old way of extraction to fail because we had an open file descriptor. By using the file descriptor and closing it ASAP, we prevent these failures. Signed-off-by: Dan McGee <dan@archlinux.org>
2008-04-08Update configure.ac to current codeDan McGee2-15/+14
Remove a few functions and things that were unnecessary, update the help line calls to the current function name, and make the small change to pacman.c for the signal handler return type that is defined in config.h. Signed-off-by: Dan McGee <dan@archlinux.org>
2008-04-08Merge branch 'maint'Dan McGee5-3/+17
2008-04-08Add check for swprintf() and a workaround when it is missingDan McGee2-2/+12
We use this function once in our codebase, but fortunately the workaround is relatively easy. swprintf() is not available on Cygwin so the compile failed there, but we can do a series of mbstowcs() calls that produce the same end result as the swprintf() call. Signed-off-by: Dan McGee <dan@archlinux.org>
2008-04-08Add *.exe ignores for certain other platformsDan McGee2-0/+4
Signed-off-by: Dan McGee <dan@archlinux.org>
2008-04-07Allow disabling of internal (libdownload) codeDan McGee4-37/+76
Add a new --disable-internal-download flag to configure allowing the internal download code to be skipped. This will be helpful on platforms that currently don't support either libdownload or libfetch (such as Cygwin) and for just compiling a lighter weight pacman binary. This was made really easy by our recent refactoring of the download code into separate internal and external functions, as well as some error code cleanup. Signed-off-by: Dan McGee <dan@archlinux.org>
2008-04-07Remove a bit more download.h pollutionDan McGee2-7/+5
Kill it where it isn't absolutely necessary. Signed-off-by: Dan McGee <dan@archlinux.org>
2008-04-07Remove unnecessary header file, move one macro to util.cDan McGee21-47/+5
Signed-off-by: Dan McGee <dan@archlinux.org>
2008-04-07libalpm error cleanup, step 1Dan McGee6-29/+22
Remove unused error codes, begin refactoring some of the others. Signed-off-by: Dan McGee <dan@archlinux.org>
2008-04-07Remove libdownload reference from pacman frontendDan McGee1-17/+2
Signed-off-by: Dan McGee <dan@archlinux.org>
2008-04-07Add quiet printout to --owns functionalityDan McGee1-3/+8
If we specify -q/--quiet on an --owns operation, only print a matching package name rather than the verbose human-readable message. Signed-off-by: Dan McGee <dan@archlinux.org>
2008-04-06Quote filenames in find expression in pacdiffAllan McRae1-1/+1
From 41cc28f560bf9843d81ce5fb62b884b6325d06a0 Mon Sep 17 00:00:00 2001 From: Allan McRae <mcrae_allan@hotmail.com> Date: Sun, 6 Apr 2008 22:18:06 +1000 Subject: [PATCH] Quote filenames in find expression in pacdiff Small patch to allow pacdiff to run in /etc. See FS#10090. Signed-off-by: Allan McRae <mcrae_allan@hotmail.com> Signed-off-by: Dan McGee <dan@archlinux.org>
2008-04-02Merge branch 'maint'Dan McGee5-10/+11
Conflicts: configure.ac contrib/Makefile.am
2008-04-02Update NEWS and configure.ac for 3.1.4 releasev3.1.4Dan McGee4-11/+11
Also fix a broken contrib/ Makefile, found with make distcheck. I also let the little translation linebreak update slip in here as it was small enough not to be a big deal, and this should just prevent it from happening again later anyway. Signed-off-by: Dan McGee <dan@archlinux.org>
2008-04-02Set handle->logstream to null after fclose()Dan McGee1-0/+1
We correctly closed the logfile stream when recalling set_logfile, but did not NULL out the dead pointer once we did this. Fix the problem which was the cause of FS#10056. Signed-off-by: Dan McGee <dan@archlinux.org>
2008-03-30Update -Ss and -Qs pactests to include groupsDan McGee2-0/+2
This update causes query003 to fail before commit 4b8ada818e21aae43b4f54f146ffa215fdb9213e. Hopefully the issue doesn't crop up again but we might as well test for it. Signed-off-by: Dan McGee <dan@archlinux.org>
2008-03-30Enable display of multiple groups in -Ss and -Qs outputDan McGee2-6/+22
Not too complicated of a fix, but just adds some code to loop over the entire group list and space it out. Signed-off-by: Dan McGee <dan@archlinux.org>
2008-03-30Fix segfault on -Qs usageDan McGee2-5/+3
This segfault creeped in as a result of commit bf867003. We were incorrectly assuming the group member of our package was a pmgrp_t list when in fact it is just a string list, which caused a segfault on any -Qs operation. Also slightly cleanup the -Ss code (which was originally correct unlike the -Qs code). Signed-off-by: Dan McGee <dan@archlinux.org>
2008-03-30Merge branch 'maint'Dan McGee3-7/+7
2008-03-30doc/pacman.8: fix manpage typoDan McGee1-2/+3
Fix a misspelling and make a clarification while we are at it. Signed-off-by: Dan McGee <dan@archlinux.org>
2008-03-30Fix manpage typoDan McGee1-1/+1
Noticed in FS#10025. Signed-off-by: Dan McGee <dan@archlinux.org>
2008-03-29Duplicate the result of archive_entry_pathname.Chantry Xavier1-2/+2
After the libarchive upgrade from 2.4.12 to 2.4.14, our usage of archive_entry_pathname became dangerous. We were using the result of that function even after calls to archive_entry_set_pathname. With 2.4.14, the entryname becomes wrong after these calls, and so all the future use of entryname are bogus. entryname is used quite a lot for logging, so that's not so bad. But it's also used for the backup handling, so that's not very cool. For example, reinstalling a package with backup entries will erase all the md5 entries from the DB, because they won't be found back. entryname is now a static string so that we can easily keep the result of archive_entry_pathname. Signed-off-by: Chantry Xavier <shiningxc@gmail.com> [Dan: fixed version numbers in commit message] Signed-off-by: Dan McGee <dan@archlinux.org>
2008-03-28Use pkgcache instead of db_scan in remove.cNagy Gabor1-4/+4
This should be a notable speed-up (apart from kernel cache). Signed-off-by: Nagy Gabor <ngaba@bibl.u-szeged.hu> Signed-off-by: Dan McGee <dan@archlinux.org>
2008-03-27Read .PKGINFO directly from package fileDan McGee1-50/+11
With the addition of the archive_fgets() function, we can now skip the temp file usage in pkg_load/parse_descfile that was not needed. This has a nice benefit of probably being both faster, reducing code, and getting rid of "expensive" file operations. Signed-off-by: Dan McGee <dan@archlinux.org>
2008-03-27Add an archive_fgets() functionDan McGee2-0/+31
This crude function allows reading from an archive on a line-by-line basis similar to the familiar fgets() call on a FILE stream. This is the first step in being able to read DB entries straight from an archive. Signed-off-by: Dan McGee <dan@archlinux.org>
2008-03-27Make db->treename a pointerDan McGee2-3/+3
I really don't think we need statically allocated strings here. Signed-off-by: Dan McGee <dan@archlinux.org>
2008-03-23Merge branch 'maint'Dan McGee3-1/+5
2008-03-23Avoid duplicated target names.Nagy Gabor4-39/+37
This patch should avoid duplicated target names in the backend. 1. sync_loadtarget will return with PM_ERR_TRANS_DUP_TARGET when trying to add a duplicated target 2. sysupgrade never pulls duplicated targets 3. resolvedeps won't pull duplicated targets anymore A pulled list was introduced in sync_prepare to improve the pmsyncpkg_t<->pmpkg_t list conversion by making it more direct. Also replace sync1005 and sync1006 by the sync1008 pactest, which is similar but more interesting (the provisions are dependencies instead of explicit targets). sync1005 didn't work as expected anyway. It was expecting that pacman failed, and pacman indeed failed, but not for the good reason. It didn't fail during the preparation step because of conflicting targets, but during the commit step, because of a md5 error... And sync1006 didn't pass and was not really worth fixing. We have already enough failing pactests more important than these two. sync1008 pass with this patch. Signed-off-by: Nagy Gabor <ngaba@bibl.u-szeged.hu> Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
2008-03-23memleak fix: ensure we free result of get_destfile()Dan McGee1-6/+5
In the file:// download case, we didn't free the return from get_destfile() after we were done with it. Fix it. (Found with xfercommand001.py) Signed-off-by: Dan McGee <dan@archlinux.org>
2008-03-23memleak fix: ensure backup fname isn't lost if unusedDan McGee2-0/+4
The _alpm_backup_split function always alloced memory for the fname, and we let it disappear in a specific case (upgrade026.py). Fix the issue. Signed-off-by: Dan McGee <dan@archlinux.org>