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

755 Commits

Author SHA1 Message Date
Giovanni Scafora
c00f46b653 Update Italian Translation
Signed-off-by: Dan McGee <dan@archlinux.org>
2007-11-08 21:16:07 -06:00
Jeff Bailes
4bbb055cd9 Update en_GB translation
Signed-off-by: Dan McGee <dan@archlinux.org>
2007-11-07 19:03:58 -06:00
Aaron Griffin
d0d58489ff Add STRDUP macro to mirror MALLOC/CALLOC
Signed-off-by: Aaron Griffin <aaronmgriffin@gmail.com>
2007-11-06 23:23:03 -06:00
Aaron Griffin
2ee90ddae2 Maintain list tail pointers in the head node
List head nodes contain null 'prev' pointer, which we can (ab)use to maintain a
back reference to the tail pointer of the list.

While list additions are not _significantly_ improved, they are still sped up.

Original
   $ time pacman -Qo /usr/bin/wtpt
   /usr/bin/wtpt is owned by lcms 1.17-2

   real    0m3.623s
   user    0m1.883s
   sys     0m1.473s

New
   $ time pacman -Qo /usr/bin/wtpt
   /usr/bin/wtpt is owned by lcms 1.17-2

   real    0m2.006s
   user    0m0.263s
   sys     0m1.627s

Signed-off-by: Aaron Griffin <aaronmgriffin@gmail.com>
2007-11-06 22:47:10 -06:00
Dan McGee
52b7fd81f5 libalpm/db.c: change two warnings to errors
These two warnings really indicate failure, so the message they print should
do so as well.

Signed-off-by: Dan McGee <dan@archlinux.org>
2007-11-05 21:10:43 -06:00
Chantry Xavier
0686fec839 Remove the newline automatically added by alpm_logaction.
This way, _alpm_logaction behaves like _alpm_log, and gives more control.

Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
2007-11-04 18:04:43 -06:00
Dan McGee
b55abdce7a libalpm: use an lstat wrapper so we never dereference dir symlinks
Linux lstat follows POSIX standards and dereferences a symlink pointing
to a directory if there is a trailing slash. For purposes of libalpm, we
don't want this so make a lstat wrapper that suppresses this behavior.

Signed-off-by: Dan McGee <dan@archlinux.org>
2007-11-04 18:02:25 -06:00
Dan McGee
99f42d6bd2 libalpm: open the logstream on demand
Don't open a stream to the logfile until necessary. This will allow us
to catch any errors in opening the logfile instead of ignorning them.

Signed-off-by: Dan McGee <dan@archlinux.org>
2007-11-04 16:38:59 -06:00
Dan McGee
86ca39d15e Clean up usage of extern variables
Instead of declaring the extern variable in every *.c file, include it in
the header file that makes sense. This means handle.h for the handle, and
conf.h for the pacman side config object.

Signed-off-by: Dan McGee <dan@archlinux.org>
2007-11-04 12:05:22 -06:00
Dan McGee
006387828c Readd scriptlet logging that got lost in an earlier commit
I broke scriptlet logging with ad691001e2.
Readd more or less what was there before, although it still needs a lot of
work including hopefully rewriting it to a new event subsystem and having
it log to a seperate file.

Signed-off-by: Dan McGee <dan@archlinux.org>
2007-11-04 11:27:41 -06:00
Dan McGee
c26fe63ee5 Add some more autoconf macros to filter our CFLAGS usage
Hopefully these new autoconf macros, with a little magic, will allow us to
compile with any compiler and still choose the options we have available
to us.

Tested locally with gcc 4.2.2 and gcc 3.4.6; the latter doesn't support two
of the items we previously had hardcoded in our CFLAGS.

Signed-off-by: Dan McGee <dan@archlinux.org>
2007-11-04 10:42:07 -06:00
Dan McGee
ab91cef655 Add a little const correctness fix to alpm_list
Signed-off-by: Dan McGee <dan@archlinux.org>
2007-11-04 09:50:59 -06:00
Dan McGee
6aeda5fbff When printing size_t, use %zd
%d was used, which worked for Linux and FreeBSD. Not so for Darwin. The
warning was probably spat out when compiling on x68_64 as well, but no
developers use this architecture as their primary one.

Signed-off-by: Dan McGee <dan@archlinux.org>
2007-10-29 23:32:58 -05:00
Dan McGee
be387148c9 libalpm/handle.c: make realpath() call portable
BSD didn't support the NULL second argument GNU extension, so do it the
old fashioned way.

Signed-off-by: Dan McGee <dan@archlinux.org>
2007-10-29 23:12:37 -05:00
Dan McGee
dede5371e7 Copy pmdelta_t objects in _alpm_pkg_dup()
This was forgotten in the original set of patches.

CC: Nathan Jones <nathanj@insightbb.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2007-10-29 21:06:13 -05:00
Dan McGee
74aa54a1f6 Make general list copy function
Package dup needs to copy all members. Nathan had his implementation, but
I generalized it to this new alpm_list function (and will use it in the
next commit).

CC: Nathan Jones <nathanj@insightbb.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2007-10-29 21:05:04 -05:00
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