1
0
mirror of https://github.com/moparisthebest/pacman synced 2024-11-05 00:55:04 -05:00
Commit Graph

2174 Commits

Author SHA1 Message Date
Chantry Xavier
f43805d875 Cleanup usages of alpm_list_find and alpm_list_remove.
* remove obsolete and unused *_cmp helper functions like deppkg_cmp and
_alpm_grp_cmp

* new alpm_list_remove_str function, used 6 times in handle.c

* remove _alpm_prov_cmp / _alpm_db_whatprovides and replace them by
a more general alpm_find_pkg_satisfiers with a cleaner implementation.
before: alpm_db_whatprovides(db, targ)
after: alpm_find_pkg_satisfiers(alpm_db_getpkgcache(db), targ)

* remove satisfycmp and replace alpm_list_find + satisfycmp usage by
_alpm_find_dep_satisfiers.
before : alpm_list_find(_alpm_db_get_pkgcache(db), dep, satisfycmp)
after : _alpm_find_dep_satisfiers(_alpm_db_get_pkgcache(db), dep)

* remove _alpm_pkgname_pkg_cmp, which was used with alpm_list_remove, and
use _alpm_pkg_find + alpm_list_remove with _alpm_pkg_cmp instead.

This commit actually get rids of all complicated and asymmetric _cmp
functions. I first thought these functions were worth it, be caused it
allowed us to reuse list_find and list_remove. But this was at the detriment
of the clarity and also the ease of use of these functions, dangerous
because of their asymmetricity.

Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2008-05-13 15:49:02 -05:00
Nagy Gabor
8248b4bfb1 Swap the parameters of alpm_pkg_find
Now the syntax is coherent with alpm_list_find and alpm_sync_find.

Signed-off-by: Nagy Gabor <ngaba@bibl.u-szeged.hu>
Signed-off-by: Dan McGee <dan@archlinux.org>
2008-05-13 15:49:02 -05:00
Dan McGee
e80232f24c Remove errant include of error.h
This doesn't exist anymore, the header file was removed a while back in
commit 4c872594da.

Signed-off-by: Dan McGee <dan@archlinux.org>
2008-05-13 15:49:02 -05:00
Dan McGee
663408532a Merge branch 'maint'
Conflicts:

	lib/libalpm/package.c - comment location moved to be_package.c
2008-05-11 20:14:30 -05:00
Dan McGee
13f24a5bda Refactor pkg_load/parse_descfile into a new backend file
alpm_pkg_load() and parse_descfile() are specific to getting information
from package files, just as other code is specific to getting information
into or out of a package database. Move this code out of package.c, which
should eventually only contain operators on the pmpkg_t struct that do not
depend at all on where the data came from.

Signed-off-by: Dan McGee <dan@archlinux.org>
2008-05-11 20:07:55 -05:00
Dan McGee
0460038447 Remove some useless abstraction and start db cleanup
We have some useless abstractions like an alpm_db_rewind function. I've read
somewhere that readdir() was the worst filesystem function call invented,
and what do we do? Add a wrapper around it. Kill this abstraction and move
some other things into be_files that should be there anyway because they
are so tied to how a files backend works.

Signed-off-by: Dan McGee <dan@archlinux.org>
2008-05-11 20:05:59 -05:00
Allan McRae
3c3cb001a4 Make all error messages use pm_fprintf
Tested using many easily generated error conditions.  Also added "malloc
failure" (conf.c) and "segmentation fault" (pacman.c) error messages for
translation.

Signed-off-by: Allan McRae <mcrae_allan@hotmail.com>
[Dan: fix trailing whitespace errors, other compilation issues]
Signed-off-by: Dan McGee <dan@archlinux.org>
2008-05-11 20:05:28 -05:00
Dan McGee
3175faace4 pactest: fix --gdb option
A libtool upgrade broke the gdb option as we need a MODE specified; add the
execute mode to the call.

Signed-off-by: Dan McGee <dan@archlinux.org>
2008-05-11 20:05:14 -05:00
Sebastian Nowicki
e3d35b3274 Add detailed description to alpm_pkg_load
It was unclear what "loading the full package" actually did. The
detailed description should clear that up, without having to look at the
code.

Signed-off-by: Sebastian Nowicki <sebnow@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2008-05-10 15:10:51 -05:00
Chantry Xavier
0bfc8adf37 contrib/paclist: list packages installed from given repo.
The paclist script provides a simple method for monitoring which packages
are installed from a given repo. This is particularly useful when using a
testing or unstable repository.

Thanks to Allan McRae for the idea and an initial bash script. As suggested
by Dan, I tried to rewrite in perl, and this resulted in much better
performance. Then Dan further cleaned up the script.

Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
[Dan: add to Makefile & README, minor script cleanups]
Signed-off-by: Dan McGee <dan@archlinux.org>
2008-05-10 11:13:24 -05:00
Dan McGee
1ba0d84da2 pacsearch: rewrite in perl
This rewrite in perl blows the socks off the old shell script version for
large searches:

$ time ./pacsearch.perl ^.*$ >/dev/null
real    0m0.836s
user    0m0.593s
sys     0m0.217s

$ time pacsearch.sh ^.*$ >/dev/null
real    1m53.818s
user    1m16.818s
sys     0m33.694s

Functionality and output is identical to the old version with the exception
of the old version's missing EOL after all the output.  It should be a lot
easier to add new things like the --color flag that has been a TODO at the
top of the script for a long time.

Signed-off-by: Dan McGee <dan@archlinux.org>
2008-05-10 11:04:17 -05:00
Dan McGee
b49fc504ac Update makepath to remove PATH_MAX usage
The start of a few commits to remove some PATH_MAX usage from our code. Use
a dynamically allocated string instead.

Signed-off-by: Dan McGee <dan@archlinux.org>
2008-05-10 00:51:04 -05:00
Dan McGee
2edd01a973 scripts: add -q/--quiet option to repo-add and repo-remove
They are pretty noisy scripts in their normal course of operations, so allow
all messages to be squashed except for warning and error messages with this
new flag.

Signed-off-by: Dan McGee <dan@archlinux.org>
2008-05-10 00:48:55 -05:00
Dan McGee
502645c0e3 makepkg: Unify start and end messages
I've always found it odd why the package version is shown at the start but
not the end of the package build. Fix it, and while we are at it, add the
$CARCH variable to the display too.

Signed-off-by: Dan McGee <dan@archlinux.org>
2008-05-10 00:48:47 -05:00
Dan McGee
df5024fd64 Use strdup() instead of a static buffer
We only need a copy of this string once we know we are going to extract it,
and we don't need a static buffer to copy it into since it is coming from a
known-length string.

Signed-off-by: Dan McGee <dan@archlinux.org>
2008-05-08 20:59:59 -05:00
Dan McGee
081ba4816e Update md5 routines
XySSL 0.9 was released; sync our code with the upstream source. Note that
there weren't any real changes besides renaming of macros, so nothing much
to see here.

The biggest change may be the licence- it is now GPL/BSD software rather
than LGPL/BSD. The license header is changed to reflect this.

Signed-off-by: Dan McGee <dan@archlinux.org>
2008-05-08 20:59:18 -05:00
Dan McGee
7fccfc7819 be_files.c: PATH_MAX cleanup
Most of these are not easy to remove, but I could kill the ones in the two
lastupdate functions.

Signed-off-by: Dan McGee <dan@archlinux.org>
2008-05-08 20:59:02 -05:00
Dan McGee
a13bf74979 pacman-side code cleanups
When taking a look at PATH_MAX usage, I found a few small things we can
clean up or fix.

Signed-off-by: Dan McGee <dan@archlinux.org>
2008-05-08 20:58:33 -05:00
Dan McGee
5389cdf654 Merge branch 'maint' 2008-04-29 19:52:06 -05:00
Chantry Xavier
6b31183576 Doxyfile : enable JAVADOC_AUTOBRIEF.
From http://www.stack.nl/~dimitri/doxygen/config.html#cfg_javadoc_autobrief

JAVADOC_AUTOBRIEF
    If the JAVADOC_AUTOBRIEF is set to YES then doxygen will interpret the
first line (until the first dot) of a JavaDoc-style comment as the brief
description. If set to NO (the default), the Javadoc-style will behave just
like regular Qt-style comments (thus requiring an explicit @brief command
for a brief description.)

Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2008-04-29 15:51:48 -05:00
Sebastian Nowicki
8f902865d9 Add documentation for transaction events
It is hard to decipher what the transaction events actually notify you
of, and what parameters are passed to the callback function, without
looking at the code. This patch adds documentation for the _pmtransevt_t
enum in order to clarify what the event is for and what data is passed
when the callback is called.

Signed-off-by: Sebastian Nowicki <sebnow@gmail.com>
Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2008-04-29 15:51:45 -05:00
Dan McGee
010279e449 Updates to _alpm_copyfile()
Rework to use a single #define for the buffsize, and in the process clean up
some other code and double the default buffer size.

Signed-off-by: Dan McGee <dan@archlinux.org>
2008-04-28 22:24:40 -05:00
Dan McGee
4e6361642e Rework extract_single_file() temp file creation
We were a bit juryrigged using one call to mkstemp() before rather than
extracting the new files side-by-side and doing our comparisons there. We
were also facing some permissions issues. Instead, make our life easier by
extracting all temp files to a '.paccheck' extension, doing our md5
comparisons, and then taking the correct actions.

Still to be done here- a cleanup of the use of PATH_MAX which should not be
necessary if we use dynamic allocation on the heap.

Signed-off-by: Dan McGee <dan@archlinux.org>
2008-04-28 22:24:40 -05:00
Dan McGee
1201c8ce3a Update pactest to allow setting modes on created files
This should allow some future tests to set modes and ensure they are set
after installation. It is also in anticipation of a test for checking
permissions on pacnew files.

Signed-off-by: Dan McGee <dan@archlinux.org>
2008-04-28 22:24:40 -05:00
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
Daenyth Blank
27943a04d6 makepkg: fix strip section to allow spaces in paths
Inside tidy_install, change the section which strips libraries to use find |
while read rather than for foo in `find`. This should allow whitespaces in
filenames to still be processed correctly.

This fixes FS#10294.

Signed-off-by: Daenyth Blank <Daenyth+git@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2008-04-27 14:18:43 -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