1
0
mirror of https://github.com/moparisthebest/pacman synced 2024-08-13 17:03:46 -04:00
Commit Graph

2149 Commits

Author SHA1 Message Date
Dan McGee
245efca759 Remove unnecessary archive_entry_set_pathname() calls
I'm not sure why these were ever here, as by this point we have already
extracted the file meaning a call to this function is basically a no-op.

Signed-off-by: Dan McGee <dan@archlinux.org>
2008-04-27 17:27:05 -05:00
Dan McGee
6d79ba2db0 Fix some fallout from the delta/download changes
We removed one too many FREELIST() calls when trying to fix some memleaks,
and add a safety/sanity check to ensure filename is set, as packages in old
DBs are likely to not have this field.

Signed-off-by: Dan McGee <dan@archlinux.org>
2008-04-26 13:03:53 -05:00
Chantry Xavier
481c3edc89 get_filename : use the FILENAME db field only.
Reference : FS#9547.

The get_filename function first tries to get the filename field from the
database, and if it doesn't find it, it tries to guess it based on the name,
version and arch.

This field was introduced in 3.0, but there are still many old entries in
the official databases without it. So the databases need to be regenerated
first before this patch can be applied.
There is a second problem with the delta code, which needs the filename for
locally installed packages too, but this field is not present in the local
db. So the delta code needs to be fixed first.

Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2008-04-26 11:54:47 -05:00
Chantry Xavier
8fdf08ef78 libalpm/sync.c : memleak fixes.
Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
2008-04-26 11:54:46 -05:00
Chantry Xavier
670fadf041 Get rid of the delta patches list
As Nathan noticed, the new informations in the delta struct allows us to
get rid of this list :
http://www.archlinux.org/pipermail/pacman-dev/2008-February/011163.html

So I rewrote apply_deltas for that. The previous apply_deltas also had a
limitation: it assumed that the initial package and the deltas were in the
first cache dir, which is not necessarily the case. That situation is
supported now.

Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2008-04-26 11:54:38 -05:00
Chantry Xavier
701a03dcdb Completely rework delta algorithm
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-26 11:36:01 -05:00
Dan McGee
30bdf94c2b Rework delta struct and modify code accordingly
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-26 11:30:12 -05:00
Chantry Xavier
ff9744aa1f Refactor the trans init and release code.
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-26 11:15:09 -05:00
Nagy Gabor
1b5a851851 Kill compute_requiredby usage in can_remove_package()
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-25 18:51:47 -05:00
Dan McGee
423820b34c Merge branch 'maint'
Conflicts:

	pactest/pmtest.py
2008-04-19 16:18:40 -05:00
Dan McGee
7a873a8f12 Give libalpm native support for both libdownload and libfetch
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-19 16:18:17 -05:00
Dan McGee
64e1dd64a4 Remove unnecessary NULL check in FREE() macro
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-19 15:59:40 -05:00
Chantry Xavier
c465d9e848 pactest : Use tarfile module.
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-17 14:29:08 -05:00
Chantry Xavier
5e375aa9d3 pactest: Add quotes for directory with whitespaces
Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2008-04-17 14:28:08 -05:00
Dan McGee
bf84c23266 Merge branch 'maint' 2008-04-15 19:07:51 -05:00
Dan McGee
0d8affeac0 Slight changes to fix warnings from autoconf 2.62
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-15 19:07:13 -05:00
Dan McGee
c7a81c0b54 More non-Linux build updates, mostly Darwin
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-15 15:57:36 -05:00
Dan McGee
d685d0220f Fix gettext on non-Linux platforms
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-14 21:01:30 -05:00
Dan McGee
ba70c52945 Fix compilation errors on x86_64
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-14 18:24:45 -05:00
K. Piche
2d991a25ae remove.c: refactor into functions
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-14 17:36:33 -05:00
K. Piche
db4258c1fd Some comments for _alpm_unpack.
Signed-off-by: K. Piche <kevin@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2008-04-14 17:19:32 -05:00
K. Piche
9f56137034 add.c: added some tracing and improved some variable locality
Signed-off-by: K. Piche <kevin@archlinux.org>
[Dan: removed one logger]
Signed-off-by: Dan McGee <dan@archlinux.org>
2008-04-14 17:17:22 -05:00
Dan McGee
ee2bbb39b5 Memory allocation and other small cleanups
Signed-off-by: Dan McGee <dan@archlinux.org>
2008-04-10 20:54:48 -05:00
Dan McGee
4bd0a85095 Merge branch 'maint' 2008-04-10 20:54:34 -05:00
Dan McGee
e9a0d35d08 Remove unnecessary import in dload.h
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-10 20:53:28 -05:00
Dan McGee
4b7f7e2a59 Correctly use the fd returned my mkstemp()
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-08 18:55:22 -05:00
Dan McGee
57acfced0d Update configure.ac to current code
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-07 19:27:35 -05:00
Dan McGee
83c4b2aebb Merge branch 'maint' 2008-04-07 19:19:34 -05:00
Dan McGee
bec2ba5b40 Add check for swprintf() and a workaround when it is missing
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-07 19:09:46 -05:00
Dan McGee
9441fba124 Add *.exe ignores for certain other platforms
Signed-off-by: Dan McGee <dan@archlinux.org>
2008-04-07 19:09:20 -05:00
Dan McGee
a708c6eadc Allow disabling of internal (libdownload) code
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-06 21:00:11 -05:00
Dan McGee
9c7ebe6872 Remove a bit more download.h pollution
Kill it where it isn't absolutely necessary.

Signed-off-by: Dan McGee <dan@archlinux.org>
2008-04-06 20:28:43 -05:00
Dan McGee
4c872594da Remove unnecessary header file, move one macro to util.c
Signed-off-by: Dan McGee <dan@archlinux.org>
2008-04-06 20:20:20 -05:00
Dan McGee
e4a4cf7ce5 libalpm error cleanup, step 1
Remove unused error codes, begin refactoring some of the others.

Signed-off-by: Dan McGee <dan@archlinux.org>
2008-04-06 20:16:57 -05:00
Dan McGee
4004bf9caf Remove libdownload reference from pacman frontend
Signed-off-by: Dan McGee <dan@archlinux.org>
2008-04-06 20:02:39 -05:00
Dan McGee
404e0a0e10 Add quiet printout to --owns functionality
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-06 19:49:41 -05:00
Allan McRae
b3f4bd9750 Quote filenames in find expression in pacdiff
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-06 10:44:44 -05:00
Dan McGee
073bac794d Merge branch 'maint'
Conflicts:

	configure.ac
	contrib/Makefile.am
2008-04-01 22:14:58 -05:00
Dan McGee
0b8abf376f Update NEWS and configure.ac for 3.1.4 release
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-01 22:04:56 -05:00
Dan McGee
ab9187d07d Set handle->logstream to null after fclose()
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-04-01 18:08:58 -05:00
Dan McGee
0bd6fb3bc2 Update -Ss and -Qs pactests to include groups
This update causes query003 to fail before commit
4b8ada818e. 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-30 16:47:27 -05:00
Dan McGee
5f17ac8150 Enable display of multiple groups in -Ss and -Qs output
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-30 16:41:13 -05:00
Dan McGee
4b8ada818e Fix segfault on -Qs usage
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-30 16:36:55 -05:00
Dan McGee
0d1263af26 Merge branch 'maint' 2008-03-30 13:42:24 -05:00
Dan McGee
41c1295559 doc/pacman.8: fix manpage typo
Fix a misspelling and make a clarification while we are at it.

Signed-off-by: Dan McGee <dan@archlinux.org>
2008-03-30 13:41:19 -05:00
Dan McGee
d9b9e60d7d Fix manpage typo
Noticed in FS#10025.

Signed-off-by: Dan McGee <dan@archlinux.org>
2008-03-30 11:00:53 -05:00
Chantry Xavier
3fe43ffa04 Duplicate the result of archive_entry_pathname.
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-28 18:32:04 -05:00
Nagy Gabor
562442633a Use pkgcache instead of db_scan in remove.c
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-28 17:53:04 -05:00
Dan McGee
d140b440a8 Read .PKGINFO directly from package file
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-27 12:07:32 -05:00
Dan McGee
f8c737d3b6 Add an archive_fgets() function
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-27 12:07:26 -05:00