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

789 Commits

Author SHA1 Message Date
Dan McGee
6cf8a5137e libalpm/delta: add const to most methods
Signed-off-by: Dan McGee <dan@archlinux.org>
2007-10-29 01:28:13 -05:00
Dan McGee
cc754bc6e3 libalpm: introduce MALLOC and CALLOC macros
These macros take the place of the common 4 or 5 line blocks of code we had
in most places that called malloc or calloc. This should reduce some code
duplication and make memory allocation more standard in libalpm.

Highlights:
* Note that the MALLOC macro actually uses calloc, this is just for safety
  so that memory is initialized to 0. This can be easily changed in one
  place.
* One malloc call was completely eliminated- it made more sense to do it
  on the stack.
* The use of RET_ERR in public functions (mainly the alpm_*_new functions)
  was standardized, this makes sense so pm_errno is set.

Signed-off-by: Dan McGee <dan@archlinux.org>
2007-10-29 01:00:52 -05:00
Dan McGee
fe3a461703 Add some more debugging output to dep checking code
Signed-off-by: Dan McGee <dan@archlinux.org>
2007-10-29 00:01:17 -05:00
Dan McGee
3e1b72f4f2 Clean up LDADD usage
We had a lot of unnecessary overstatements of libraries to include on
linking, and autoconf/automake takes care of this for us. This also helps
some compilation issues on other platforms.

Signed-off-by: Dan McGee <dan@archlinux.org>
2007-10-26 20:40:20 -05:00
Dan McGee
b38e046621 Explicitly cast void* to char* during printf call
If we don't have an explicit cast, make fails during -Wall -Werror.

Signed-off-by: Dan McGee <dan@archlinux.org>
2007-10-26 19:09:21 -05:00
Nagy Gabor
17f99a0f00 dependency error message fix in libalpm/remove.c
Normally you must never see that error message.

Signed-off-by: Dan McGee <dan@archlinux.org>
2007-10-26 19:05:42 -05:00
Nagy Gabor
d903fc607e Dependency error/log messages fix
The old code used only the depend.name in messages, which might have not
been informative. The new code uses the whole dependency string in
%DEPENDS% format.

(Dan: slight English clarification in one of the messages)
Signed-off-by: Dan McGee <dan@archlinux.org>
2007-10-26 18:54:21 -05:00
Nagy Gabor
0cff7c6bdf Add alpm_dep_get_string method
Public alpm_dep_get_string function is introduced, which converts a
pmdepend_t structure to printable string in %DEPENDS% format.  This
function is now used in pacman to print dependency error messages.

Signed-off-by: Dan McGee <dan@archlinux.org>
2007-10-25 07:10:08 -05:00
Nagy Gabor
89ac8aa9c4 _alpm_depmiss_isin fix
The old code used memcmp, which is not good for comparing strings:
"pkgname"'\0''\0' should be equal to "pkgname"'\0''a' for example.
The new code uses strcmp.

Signed-off-by: Dan McGee <dan@archlinux.org>
2007-10-24 16:51:12 -05:00
Dan McGee
bd15c23e16 Print and typecast time_t correctly
The recommended C99 way to print the value of a time_t is to cast it to
uintmax_t or intmax_t. Do this to ensure compatability with all platforms.

Signed-off-by: Dan McGee <dan@archlinux.org>
2007-10-23 00:35:42 -05:00
Dan McGee
8b1fb61df2 Ensure all localization stuff is correctly guarded
Anything dealing with libintl and localization should be correctly guarded
inside an ENABLE_NLS block on both the pacman and libalpm sides.

Signed-off-by: Dan McGee <dan@archlinux.org>
2007-10-22 23:52:55 -05:00
Dan McGee
0c4f7d821c Fix broken or missing includes
Signed-off-by: Dan McGee <dan@archlinux.org>
2007-10-22 23:37:38 -05:00
Dan McGee
46eaa5c542 Fix invalid static scoping of strverscmp
Signed-off-by: Dan McGee <dan@archlinux.org>
2007-10-22 23:36:03 -05:00
Nathan Jones
f5b77eb989 Add download size to target list.
This displays the download size, taking into account delta files and
cached files.

This closes FS#4182.

Signed-off-by: Nathan Jones <nathanj@insightbb.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2007-10-19 19:30:06 -05:00
Nathan Jones
e472e80c08 Download delta files if UseDelta is set.
Delta files will be used if the size is smaller than a percent
(MAX_DELTA_RATIO) of the package size.

Signed-off-by: Nathan Jones <nathanj@insightbb.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2007-10-19 19:29:17 -05:00
Nathan Jones
520db578da Refactor md5sum checking.
This will allow deltas and packages to share the md5sum checking code.

Signed-off-by: Nathan Jones <nathanj@insightbb.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2007-10-19 19:24:24 -05:00
Nathan Jones
0c2cc108d3 Add pmdelta_t structure and functions to libalpm.
Signed-off-by: Nathan Jones <nathanj@insightbb.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2007-10-19 19:21:44 -05:00
Chantry Xavier
0ff02995f1 libalpm/package.c : fix requiredby with multiple providers.
The code didn't match the following comment :
"A depends on B through n depends <=> A listed in B's requiredby n times"

It stopped at n=1 with a break.

I was surprised to see this case happens in real, that's how I noticed the
bug: wine depends on both freeglut and glut, while freeglut provides glut.

So when installing wine, the update_depends function listed wine twice in
freeglut's requiredby.  But the compute_requiredby function (used when
installing freeglut, and used by testdb) listed wine only once in
freeglut's requiredby.  That made testdb unhappy.

Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2007-10-18 12:32:10 -05:00
Chantry Xavier
3d7e06f204 libalpm/trans.c : fix a recently introduced breakage in scriptlets handling.
Commit 4853a4aad9 used the tmpdir variable
for checking the existence of /bin/sh, without resetting it.

This caused /bin/sh to be deleted during the cleanup part, as soon as a scriptlet
other than pre_upgrade or pre_install was executed.
For example, on the first post_upgrade during a -Su.

I introduced two variables : clean_tmpdir and restore_cwd, for deciding what should
be done in the cleanup part.

Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
2007-10-14 18:47:19 -05:00
Chantry Xavier
4e6a03c4f6 libalpm/trans.c : remove the DBPath <-> RootDir dependence in runscriptlet.
This code assumed that DBPath was under RootDir, while this is not necessarily the case :
pacman doesn't enforce anymore than DBPath is under RootDir.

So now, all scriptlets will be put somewhere in RootDir/tmp/, so that when it chroots in RootDir,
the scriptlets are still available inside the chroot.

This also removes the need of normalizing both dbpath and rootdir, in order to do computation on the paths.

Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
2007-10-14 18:46:43 -05:00
Dan McGee
0adedc536f Updates to fix Doxygen documentation generation
We had way too much going on with the Doxygen manpage generation. Clean it
up quite a bit by removing directory manpages, using relative paths, not
having a manpage for every single alpm function, and ensuring internal
functions are not documented publicly.

Signed-off-by: Dan McGee <dan@archlinux.org>
2007-10-14 17:29:32 -05:00
Dan McGee
6db0562b8d Add gcc format attribute to _alpm_log, catch a few bugs in the process
This fixed a few of our formatted output strings that were broken before
but never being checked.

Signed-off-by: Dan McGee <dan@archlinux.org>
2007-10-08 21:25:52 -05:00
Dan McGee
087b8df781 libalpm/package.c: ensure we use package name when loading packages
Some of the error messages in _alpm_pkg_load failed to use the pkgname
value when printing, which made error messages rather hard to decode.

Signed-off-by: Dan McGee <dan@archlinux.org>
2007-10-08 21:21:04 -05:00
Dan McGee
920b0d2049 Update usage of gcc __attribute__ flags
Change the default visibility of libalpm functions to internal instead of
hidden- this allows for slightly better optimization because it tells GCC
that the function can never be called outside of the current module (see
http://gcc.gnu.org/onlinedocs/gcc/Function-Attributes.html).

Also added some attributes to the pacman print functions so that they check
the format strings being passed to them.

Signed-off-by: Dan McGee <dan@archlinux.org>
2007-10-08 20:46:56 -05:00
Dan McGee
b1613c2651 Clean up the scriptlet fork code a bit, honor the child return value
Signed-off-by: Dan McGee <dan@archlinux.org>
2007-10-08 20:46:55 -05:00
Dan McGee
60dc4b43fd Fix backward compatibility with non-epoch builddates
Signed-off-by: Dan McGee <dan@archlinux.org>
2007-10-08 20:46:55 -05:00
Aaron Griffin
4853a4aad9 Fail loudly is scriptlets cannot be run via /bin/sh
If /bin/sh is missing in the root directory, scriptlets cannot be executed, as
we're explicitly calling it.

Signed-off-by: Aaron Griffin <aaronmgriffin@gmail.com>
2007-10-04 21:36:25 -05:00
Dan McGee
4453ce155c libalpm: Optimize/inline the md5 functionality
The md5 routines are one of the chokepoints of libalpm (main chokepoint being
archive extraction). Although IO delay causes a lot of it, we can at least
inline some of the md5 stuff as we aren't that concerned about space and
eliminate quite a few function calls.

Signed-off-by: Dan McGee <dan@archlinux.org>
2007-09-28 23:27:14 -05:00
Dan McGee
01e92e9ded libalpm/deps.c: fix memleak found by valgrind
Signed-off-by: Dan McGee <dan@archlinux.org>
2007-09-28 23:27:14 -05:00
Dan McGee
7d5dca4043 libalpm/be_files: Fix outdated code setting path for lastupdate file
The code for setting the lastupdate file path still referenced both the
root and dbpath, when we should only be using dbpath. Fix it.

Signed-off-by: Dan McGee <dan@archlinux.org>
2007-09-28 23:27:14 -05:00
Aaron Griffin
cb3c3a920d Minor "cannot remove" message cleanup
The strings differed in quotes only, this way we have only one i18n string for
translation

Signed-off-by: Aaron Griffin <aaronmgriffin@gmail.com>
2007-09-28 00:25:57 -05:00
Aaron Griffin
f2f4ada1d6 Remove buildtype package accessor prototype
This was removed a while ago, but the prototype was still hanging out.

Signed-off-by: Aaron Griffin <aaronmgriffin@gmail.com>
2007-09-28 00:25:57 -05:00
Aaron Griffin
47622eef4d Support for localized times in metadata
Packages and DBs now support using the UNIX epoch (seconds since Jan 1, 1970)
for use in builddate and installdate. This will only affect newly built
packages. Old existing packages with the text format are still supported, but
this is deprecated.

In the case of removal of text time support, this code will fail gracefully,
returning the start of the epoch for broken packages.

Signed-off-by: Aaron Griffin <aaronmgriffin@gmail.com>
2007-09-28 00:25:57 -05:00
Dan McGee
219808714f Add 'full' parameter to alpm_pkg_load
In most cases, we want to fully scan a package when we load it, which serves
as a integrity verification check. However, there are times when it is only
desired to read the metadata and nothing else, so allow the caller of pkg_load
to choose the behavior they need.

This pays big dividends in speeding up pacman cache cleaning functionality.
Old (729 packages):
real    1m43.717s
user    1m20.785s
sys     0m2.993s
New (729 packages):
real    0m25.607s
user    0m19.389s
sys     0m0.543s

Signed-off-by: Dan McGee <dan@archlinux.org>
2007-09-28 00:16:43 -05:00
Dan McGee
d2edcb58e2 Update comments dealing with pkgext/dbext stripping
pacman/callback.c already did the work I set out to do with this commit, so
update the comments accordingly in the frontend and backend.

Signed-off-by: Dan McGee <dan@archlinux.org>
2007-09-28 00:16:43 -05:00
Dan McGee
f7bbfe4052 Remove package name dependency from libalpm
Previously, package names must match a specified scheme or they will cause
pacman add operations to fail. This is not a very intelligent or necessary
way to act, so remove the dependency on the name of the package to be
installed and read all relevant information from the metadata instead.

This does have one causality to be addressed later- pacman cache cleaning
functionality, which has never been phenomenal, just lost most capability.

Signed-off-by: Dan McGee <dan@archlinux.org>
2007-09-28 00:16:43 -05:00
Dan McGee
0758012b66 libalpm: Add newline to alpm log function output
Signed-off-by: Dan McGee <dan@archlinux.org>
2007-09-28 00:15:28 -05:00
Dan McGee
fc0e83f05b Preliminary support for optdepends
Add some alpm functions for getting optdepends, have makepkg include them
in the PKGINFO file, and have a pacman -Qi operation display the raw string
as stored by libalpm.

Signed-off-by: Dan McGee <dan@archlinux.org>
2007-09-25 23:02:30 -05:00
Dan McGee
843d368ef6 libalpm/add.c: fix backup array issue
As seen with the recent upgrade of pacman and the removal of the
pacman.d/current mirrorlist, files that were formerly in the backup array
get deleted upon their removal, which could be dangerous. Instead, we should
use the combined backup array of the old and new package. This fix should
address this issue in a relatively straightforward way.

In addition, old files should be moved to pacsave locations as expected.

Signed-off-by: Dan McGee <dan@archlinux.org>
2007-09-23 20:48:04 -05:00
Dan McGee
8acb6d24af libalpm/remove.c: fix up arguments to unlink_file
Move the progressbar code out of unlink_file so we can pass half the args.

Signed-off-by: Dan McGee <dan@archlinux.org>
2007-09-23 19:47:52 -05:00
Dan McGee
d3c8003020 alpm: removed unused strtoupper wrapper, remove installeddate on parse_descfile
installdate should never be present in a package descfile, so get rid of it.
With the last commit, we also don't need the util strtoupper function.

Signed-off-by: Dan McGee <dan@archlinux.org>
2007-09-23 12:20:48 -05:00
Chantry Xavier
443950b7e9 libalpm/package.c : fix for FS#8081, case sensitive comparisons in parse_descfile.
This fix FS#8081. The tr_TR locale has known issue with case insensitive
comparisons, mostly because upper(i) != I.

So the .PKGINFO files generated by makepkg MUST contain all keywords in lowercases now.
This was already done, but was not mandatory.

Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
2007-09-23 12:05:30 -05:00
Chantry Xavier
f9b7c67d24 libalpm/add.c : fix backup handling (2)
The mistake fixed in commit 26441cf65c
was actually done at two places.
This fix the second one.

Also remove one unnecessary newline introduced by
commit d34b2c4ed8

Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
2007-09-18 18:56:40 -05:00
Chantry Xavier
d34b2c4ed8 libalpm/add.c : newline fix.
Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
2007-09-17 22:56:42 -05:00
Stefano Esposito
d50390c089 Avoid segfaults whet calling alpm_option_get_* before initialization
When calling a function of the alpm_option_get_* group, you get a segfault
if you don't call alpm_initialize() first. With this patch those functions
set pm_errno to PM_ERR_HANDLE_NULL and return an error value if handle ==
NULL.

(Dan: modified to meet pacman coding standards)

Signed-off-by: Stefano Esposito <stefano.esposito87@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2007-09-17 21:59:02 -05:00
Chantry Xavier
b0aa510592 trans.c : reworking of transaction interruptions
My two previous hacks related to this part
(8038190c7c and
b15a5194d1) were caused by the lack of
understanding of a feature introduced a while ago:
Better control over CTRL-C interruptions -- do not leave the DB in an
inconsistent state (54008798ef).

Now I have been looking at this commit, and the added feature is indeed
interesting. The main problem I had with it is that it does a rather
unusual use of alpm_trans_release, which caused a few problems that I tried
to fix in a weird way. I think these problems were caused by the fact that
there weren't any difference between "interrupt transaction" and "release a
transaction which failed" actions from the alpm_trans_release POV.  So I
decided to add a new function instead, alpm_trans_interrupt, which is
called on Ctrl+C, and which only sets trans->state to STATE_INTERRUPTED so
that remove_commit and add_commit can exit cleanly at a safe moment. This
allowed me to revert my two previous hacks as well.

Also ensure we handle SIGINT correctly in all cases- if a transaction is
not ongoing, then we can free the transaction and exit quickly.

Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2007-09-16 20:17:44 -05:00
Chantry Xavier
046c8a6819 Remove the DB consistency check from pacman and libalpm.
This reverts commit dfc85cb5f5
and b6f3fe6957.
This DB check is already in testdb (among others).

Also testdb now uses the db path set at make time by default,
so specifying the db path is optional.

Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2007-09-16 20:10:18 -05:00
Stefano Esposito
27acdc2c94 make alpm_strerror binding friendly
I'm currently working on python bindings for alpm written in pyrex. While
working i found that declaring alpm_strerror as
	char * alpm_strerror (void)
instead of
	char * alpm_strerror (int err)

and then using pm_errno in the implementation instead of err, could make it
more bindings-friendly.

Dan: cleaned up and added void to declaration. Instead of replacing existing
function, add a new function called 'alpm_strerrorlast(void)'.

Signed-off-by: Stefano Esposito <stefano.esposito87@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2007-09-11 20:58:27 -05:00
Chantry Xavier
f21c45c0dd libalpm/deps.c : export _alpm_checkdeps (-> alpm_checkdeps).
Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2007-09-11 20:42:03 -05:00
Chantry Xavier
be32aa3004 libalpm/package.c : add new alpm_pkg_compute_requiredby function.
Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
2007-09-11 20:41:54 -05:00
Chantry Xavier
b15a5194d1 libalpm/trans.c : remove the lock even on interrupted transactions.
Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
2007-09-06 19:45:16 -05:00
Dan McGee
9cceb3d9c4 Add a few missing includes, caught while compiling on cygwin
Signed-off-by: Dan McGee <dan@archlinux.org>
2007-09-06 19:03:38 -05:00
Dan McGee
461bc9e6ce libalpm: remove outdated files from POTFILES.in
Fixes 'make dist' target as sha1.c and md5driver.c no longer exist.

Signed-off-by: Dan McGee <dan@archlinux.org>
2007-09-04 07:12:57 -05:00
Travis Willard
824b7fd27b Fix compile-time error with de.po, runtime error with db.c
One string in de.po differed pretty strongly with its translated version.
It may still be totally wrong as far as translations go, but it compiles
now. Get translater to check.

Also, ensure the proper dbpath gets set in the db when it's created.

Signed-off-by: Travis Willard <travis@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2007-09-03 20:50:24 -05:00
Matthias Gorissen
d34db57b6b Update German translation
Signed-off-by: Dan McGee <dan@archlinux.org>
2007-09-02 09:50:07 -05:00
Chantry Xavier
aef1c88f3b libalpm/remove.c : avoid duplicated packages in removal list.
Suppose a package foo depends on foo1, foo2, ..., foon.
Doing pacman -Rc foo1 foo2 ... foon added foo n times to the removal list,
because what checkdeps return is something like :
foo1 is requiredby foo
foo2 is requiredby foo
...
foon is requiredby foo

Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2007-09-02 09:33:46 -05:00
Travis Willard
b6f89f03af separate local from sync dbs on filesystem
Introduce two new methods into the API - alpm_db_register_sync and
alpm_db_register_local, which replace the functionality of
alpm_db_register. db_register_local always returns the local DB, and
db_register_sync will always try to register a sync DB. This conceptually
separates the local DB from sync DBs in the code. Also updated the pacman
frontend to use the new functions. In addition, this changes the location
of all sync DBs in the filesystem from $DBPATH/$REPO to $DBPATH/sync/$REPO,
This removes the silly limitation that a sync DB couldn't be named 'local',
along with structurally separating sync DBs and the local DB in the
filesystem.

Signed-off-by: Travis Willard <travis@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2007-08-26 23:44:32 -04:00
Chantry Xavier
26441cf65c libalpm/add.c : fix backup handling.
During last refactoring, a "continue" somehow became a "return(0)" :)

Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
2007-08-26 13:34:16 -04:00
Dan McGee
5c9eec5570 libalpm: add newlines to all strings passed to log callback
This allows us to remove the hack in the frontend where we added a newline
to everything coming out of the pm_printf functions, and instead let the
developer put newlines where they want them. This should be the last hangover
of that auto-newline stuff.

Signed-off-by: Dan McGee <dan@archlinux.org>
2007-08-23 22:26:55 -04:00
Dan McGee
2798ebbb62 libalpm/remove.c: check for ability to unlink is wrong
As reported by JGC in FS #7652, the check for EACCES is not exactly correct.
We need to check for the ETXTBSY error as well. This is necessary on FreeBSD.

Signed-off-by: Dan McGee <dan@archlinux.org>
2007-08-23 20:47:40 -04:00
Dan McGee
515754faac Various valgrind mem leak fixes
Signed-off-by: Dan McGee <dan@archlinux.org>
2007-08-21 23:29:10 -04:00
Dan McGee
c22e381a8b Post trial install changes, round one
A bunch of changes related to my first "real" install of pacman-git into
/usr/local and trying to use it.

* Shift some uses of free -> FREE in libalpm.
* Move stat and sanity checks of config paths into libalpm from the
  config and argument parsing in pacman.c.
* Fix issue where dbpath still was not defined early enough due to its
  requirement for being used in alpm_db_register. This should be rewritten
  so it doesn't have this dependency, but this will work for now.

Signed-off-by: Dan McGee <dan@archlinux.org>
2007-08-21 21:28:05 -04:00
Nagy Gabor
b1808930ce libalpm/add.c,trans.c : cleanup of requiredby handling.
This patch cleans up and fix the _alpm_trans_update_depends function
and ensure that all requiredby fields are filled in case of multiple satisfiers
(previously, the handling of mutliple satisfiers in that function was inconsistent).

This makes a special case handling of requiredby in commit_single_pkg() obsolete,
and so allows cleaning that code as well.

Also fixed upgrade056 pactest because :
1) the requiredby fields were wrong, and this wouldn't happen with the fixed _alpm_trans_update_depends().
2) this is a very unusual case anyway (and handling all corner cases combined to a broken database
  seems nearly impossible to achieve).

References :
http://www.archlinux.org/pipermail/pacman-dev/2007-July/008919.html
http://www.archlinux.org/pipermail/pacman-dev/2007-July/008920.html

Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
2007-08-20 15:23:53 -04:00
Dan McGee
17d9122e01 Fix for FS 6404 and functionalize some cachedir handling stuff
In order to best resolve bug 6404, move some cachedir handling stuff out of
sync.c and into util.c and create two new functions: filecache_find and
filecache_setup. sync.c was rewritten to use these, and alpm_fetch_pkgurl
now also uses these routines.

Signed-off-by: Dan McGee <dan@archlinux.org>
2007-08-20 15:23:46 -04:00
Dan McGee
942175feaa Add const qualifier to md5_file and alpm_get_md5sum
Signed-off-by: Dan McGee <dan@archlinux.org>
2007-08-20 12:58:17 -04:00
Chantry Xavier
f81e619974 libalpm/sync.c : don't go back on STATE_PREPARED when committing fails.
In my opinion, a commiting transaction that failed isn't equivalent
to a prepared transaction.
Some things could have been done in the meantime.

Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
2007-08-17 14:46:27 -04:00
Dan McGee
fc65a9bcb1 Fix some errors spit out by -Wextra
Signed-off-by: Dan McGee <dan@archlinux.org>
2007-08-16 16:19:06 -04:00
Andrew Fyfe
1cb6d80631 Clean up MD5 code.
* Move alpm md5 functions to lib/libalpm/util.c
	* Remove unneeded includes for md5.h
	* Replace md5 implementation with one from http://www.xyssl.org

Dan: clean up XySSL code by removing parts we don't use, and add a note
saying what changed.
Dan: fix alpm_get_md5sum, off by one error on the malloc call and other
small things.

Signed-off-by: Andrew Fyfe <andrew@neptune-one.net>
Signed-off-by: Dan McGee <dan@archlinux.org>
2007-08-16 13:17:33 -04:00
Andrew Fyfe
ba67fdae63 Remove support for SHA1 from pacman.
There's no need for a second hashing algorithm. MD5 serves the purpose
of verifying that a package file hasn't been corrupted during download.

Signed-off-by: Andrew Fyfe <andrew@neptune-one.net>
Signed-off-by: Dan McGee <dan@archlinux.org>
2007-08-16 11:30:38 -04:00
Chantry Xavier
ee977019e3 libalpm/db.c : add alpm_db_unregister_all.
This basically moves the code from alpm_release, which was mostly about
unregistering all databases, to a safer alpm_db_unregister_all.
This allows to avoid modifying the dbs_sync list while iterating over it,
and and also prevent alpm_release from looping infinitely when a database
can't be unregistered.

Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
2007-08-16 11:08:17 -04:00
Chantry Xavier
8038190c7c libalpm/db.c : allow unregistering db for interrupted transaction.
This prevents alpm_release to loop infinitely in case of
an interrupted transaction, where the database wasn't
unregistered.
alpm_release should probably also be fixed, as it can
still loop if db_unregister fails for another reason.

Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
2007-08-15 20:22:31 -04:00
Dan McGee
a65ad4efc1 package.h: implement origin_data union in pmpkg_t struct
We were using a void *data element in pmpkg_t before, which is unsafe by its
nature of being untyped. Reimplement data as origin_data being a union that
can hold either a path to a package file or a pointer to a cache database,
and make the other necesary updates in the code to reflect this. See package.h
for details.

Signed-off-by: Dan McGee <dan@archlinux.org>
2007-08-14 10:14:35 -04:00
Dan McGee
49c29e16b3 Code cleanup
Remove the commented desc_localized stuff, we can find it later in version
control. Also remove some unnecessary includes of the stat header and
use -fstack-protector-all which is a bit more broad.

Signed-off-by: Dan McGee <dan@archlinux.org>
2007-08-14 09:33:55 -04:00
Nagy Gabor
3a0a4db129 libalpm/conflict.c : small speed-up and fix.
Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
2007-08-12 21:15:37 -04:00
Nagy Gabor
ab06221521 libalpm/conflict.c : small memleak fix.
Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
2007-08-12 21:14:14 -04:00
Nagy Gabor
b96922679e Add two pactest for versioned conflicts.
A side effect of the previous commit ( ea9a756eea )
is that it's now possible to use versioned conflicts.
Add two new conflict pactests for showing it.

Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
2007-08-12 21:14:05 -04:00
Chantry Xavier
ea9a756eea libalpm/conflict.c : cleanup + fix for conflict001.
Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2007-07-20 11:58:52 -04:00
Nagy Gabor
0d00f7095f libalpm/sync.c : two memleak fixes in _alpm_sync_prepare.
Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
2007-07-20 10:37:24 -04:00
Chantry Xavier
b0c064d59b libalpm/sync.c : fix DEPENDSONLY flag handling.
I didn't like the patch proposed by Nagy for the sync1002 pactest here:
http://www.archlinux.org/pipermail/pacman-dev/2007-July/008971.html

So here is another attempt of fixing it.
In case of the DEPENDSONLY flag :
1) pass an empty list to resolvedeps instead of the list of targets
2) empty the trans->packages targets list before adding the resolved deps.

Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
2007-07-20 10:34:28 -04:00
Chantry Xavier
df2447cd23 libalpm/alpm_list.c : add SYMEXPORT to all alpm_list_ functions.
Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
2007-07-20 10:28:07 -04:00
Dan McGee
23a4d51b7a Reorder functions in libalpm/package.c for Doxygen purposes
Put all of the public functions at the top and inside the Doxygen packages
group.

Signed-off-by: Dan McGee <dan@archlinux.org>
2007-07-18 10:26:21 -04:00
Chantry Xavier
240bdf5971 libalpm/deps.c : split alpm_depcmp.
That function wasn't big, but this might be useful
for later refactoring of the search for satisfier code.

Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2007-07-17 10:10:27 -04:00
Chantry Xavier
c68d3cc38a libalpm/deps.c : split sortbydeps function.
The _alpm_sortbydeps function has two main part :
1) initialization of the graph structure
2) the sorting itself

So it didn't seem bad to move the first part to a second function.

Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2007-07-17 10:06:26 -04:00
Dan McGee
466d289e6a Remove unnecessary entries from .gitignore files
.gitignore works recursively, so we don't need Makefile and Makefile.in
in all of the subdirectory .gitignore files.

Signed-off-by: Dan McGee <dan@archlinux.org>
2007-07-16 16:49:28 -04:00
Chantry Xavier
99572ed8f6 new pmdepend_t / pmdepmissing_t accessors.
Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2007-07-16 09:21:13 -04:00
Dan McGee
591bfabbd3 Clean up libalpm/add.c and revise file extraction code
This is a full refactoring of _alpm_add_commit into multiple functions and a
better layout for later. Some highlights:

* No regressions in pactest performance.
* Much cleaner layout. add_commit is split into four functions:
  upgrade_remove, extract_single_file, commit_single_pkg, _alpm_add_commit
* No more super-functions, the heaviest (extract_single_file) is finally
  under 400 lines, with much improved commenting as well.
* Incorporation of Andrew Fyfe's ideas for fixing FS #7484. Try to handle
  all possible cases of extraction combinations with files, symlinks, dirs,
  and non-existant entries on the filesystem. This should make our dealings
  with libarchive fall more into our control.

Signed-off-by: Dan McGee <dan@archlinux.org>
2007-07-15 21:36:46 -04:00
Dan McGee
a1e57cbec8 Add --asdeps option to pacman
This replaces the former -D operation that was undocumented and rather
hacky. It can be used with add, upgrade, or sync transactions and will affect
all packages installed. Should close FS #7193.

Also tell makepkg to use this new flag.

Signed-off-by: Dan McGee <dan@archlinux.org>
2007-07-15 12:46:02 -04:00
Nagy Gabor
c2920033d0 libalpm/deps.c : cleanup + little fix for resolvedeps.
The resolvedeps function was a bit negligent, as showed by the sync011 pactest.
Reference :
http://www.archlinux.org/pipermail/pacman-dev/2007-July/008782.html

Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
2007-07-15 10:37:38 -04:00
Dan McGee
f0ea21cffc Ensure requiredby entries are removed during an upgrade
This fixes the failure of the requiredby004 pactest in a not so pretty way,
but it gets the job done. I purposely used the extremely long name of
PM_TRANS_TYPE_REMOVEUPGRADE to be both clear and in the hope that someone
else will figure out a better solution.

Original idea from Nagy Gabor, patch updated and cleaned for current code.

Signed-off-by: Dan McGee <dan@archlinux.org>
2007-07-14 09:34:39 -04:00
Nagy Gabor
ce1fb07436 libalpm/sync.c : ldconfig is run twice.
remove _alpm_ldconfig call from _alpm_sync_commit,
since sync operation causes an upgrade transaction,
where ldconfig is already run.

Reference:
http://www.archlinux.org/pipermail/pacman-dev/2007-April/008132.html

Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2007-07-14 01:12:18 -04:00
Chantry Xavier
edcefb1d58 libalpm/remove.c : revert part of commit to fix remove044 pactest
In 1c9f30b9fa

This change should be done AFTER the TODO in recursedeps is implemented.
Then we'll be able to first sort the list, then call recursedeps which keeps
it sorted. For now, the sorting should still be done as the last step.

Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2007-07-13 17:18:27 -04:00
Nagy Gabor
9f9086573a Update hungarian translation
Signed-off-by: Dan McGee <dan@archlinux.org>
2007-07-13 15:44:39 -04:00
Chantry Xavier
1c9f30b9fa libalpm/deps.c : fix for remove044 pactest.
Patch from Nagy that makes removedeps use alpm_depcmp.

I also renamed removedeps to recursedeps, as it can have
a more general usage, and added an include_explicit argument,
so we can control if packages explictly installed are added or not.

Note: Small changes made by me (Dan) as well- mostly some English grammar
correction and a few other cleanups.

Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2007-07-13 10:37:13 -04:00
Chantry Xavier
8d62835ba1 Remove conflict message for non-existent files (reworked)
Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2007-07-13 10:18:52 -04:00
Chantry Xavier
7234785601 libalpm/remove.c : Rsd combination.
Currently the d (nodeps) option skips the s (recursive) part,
rendering the Rsd combination totally useless.
This patch makes a recursive removal still possible using the nodeps option,
as Romashka asked there :
http://bugs.archlinux.org/task/6057#comment17784

Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
2007-07-13 15:47:20 +02:00
Andrew Fyfe
c0a7d9d82d Some doxygen comments.
Signed-off-by: Andrew Fyfe <andrew@neptune-one.net>
2007-07-12 16:00:58 -04:00
Dan McGee
d402583c43 Remove some more conditional include stuff
Signed-off-by: Dan McGee <dan@archlinux.org>
2007-07-12 16:00:35 -04:00
Dan McGee
20f73d6299 Remove versioncmp.{c,h}, clean up selective #ifdefs
Remove versioncmp.c by moving all functions to locations that make sense.

Move replacement functions (for building without glibc) into util.c where
they belong, and do proper checks for them instead of using __sun__, etc.

Signed-off-by: Dan McGee <dan@archlinux.org>
2007-07-12 15:20:43 -04:00
Dan McGee
653fb8fe03 Remove 'buildtype' from libalpm and pacman
Remove unused buildtype field from pmpkg_t struct and anything associated
with it, as it is unused at the moment. If we need to readd it, it is an
easy revert of this commit.

Signed-off-by: Dan McGee <dan@archlinux.org>
2007-07-11 23:36:13 -04:00
Chantry Xavier
cb164c3130 conflict.c: start cleaning conflict check functions
The three chk_ functions overlap for packages both in targets and in the
database. This caused the same conflict to be found in both direction
(A conflicts with B, and B conflicts with A).

This patch avoids this duplication. which shouldn't be needed, but other
changes might be required for that to work correctly.

This also has the unexpected side effect to hide the failure of sync022
pactest, for FS #7415. That's maybe not a good thing though..

Note from Dan: sync022 does succeed, but a sync023 pactest added to check
regressions also seems to pass. This may be a valid fix to this 'problem'
sync022 was meant to find.

Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2007-07-11 00:48:03 -04:00