Age | Commit message (Collapse) | Author |
|
Signed-off-by: Dan McGee <dan@archlinux.org>
|
|
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>
|
|
Signed-off-by: Dan McGee <dan@archlinux.org>
|
|
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>
|
|
If we don't have an explicit cast, make fails during -Wall -Werror.
Signed-off-by: Dan McGee <dan@archlinux.org>
|
|
Normally you must never see that error message.
Signed-off-by: Dan McGee <dan@archlinux.org>
|
|
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>
|
|
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>
|
|
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>
|
|
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>
|
|
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>
|
|
Signed-off-by: Dan McGee <dan@archlinux.org>
|
|
Signed-off-by: Dan McGee <dan@archlinux.org>
|
|
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>
|
|
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>
|
|
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>
|
|
Signed-off-by: Nathan Jones <nathanj@insightbb.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
|
|
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>
|
|
Commit 4853a4aad97fe36f9237ffb7356201adab507a1c 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>
|
|
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>
|
|
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>
|
|
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>
|
|
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>
|
|
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>
|
|
Signed-off-by: Dan McGee <dan@archlinux.org>
|
|
Signed-off-by: Dan McGee <dan@archlinux.org>
|
|
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>
|
|
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>
|
|
Signed-off-by: Dan McGee <dan@archlinux.org>
|
|
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>
|
|
The strings differed in quotes only, this way we have only one i18n string for
translation
Signed-off-by: Aaron Griffin <aaronmgriffin@gmail.com>
|
|
This was removed a while ago, but the prototype was still hanging out.
Signed-off-by: Aaron Griffin <aaronmgriffin@gmail.com>
|
|
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>
|
|
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>
|
|
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>
|
|
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>
|
|
Signed-off-by: Dan McGee <dan@archlinux.org>
|
|
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>
|
|
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>
|
|
Move the progressbar code out of unlink_file so we can pass half the args.
Signed-off-by: Dan McGee <dan@archlinux.org>
|
|
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>
|
|
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>
|
|
The mistake fixed in commit 26441cf65ca10d4bf218203df5db5e8a7270787b
was actually done at two places.
This fix the second one.
Also remove one unnecessary newline introduced by
commit d34b2c4ed84bc40f4a895846785481fad88116a2
Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
|
|
Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
|
|
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>
|
|
My two previous hacks related to this part
(8038190c7c4786e1c49494eea1b40cdddcbd5136 and
b15a5194d1a8485a2769560e49e6ff03e1862533) 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 (54008798efcc9646f622f6b052ecd83281d57cda).
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>
|
|
This reverts commit dfc85cb5f516ffbcff557522e9703c5c7d88b047
and b6f3fe6957d0206485eac98fb2120578b75d0058.
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>
|
|
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>
|
|
Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
|
|
Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
|