Commit Graph

1534 Commits

Author SHA1 Message Date
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
Dan McGee 619bf56e66 Remove rounding on package size totals
We print the total to two decimal places, so there is no real need for
rounding of the values. Remove the rounding and switch all output to two
decimal places.

Signed-off-by: Dan McGee <dan@archlinux.org>
2007-10-16 08:41:37 -05:00
Dan McGee 128b288ca7 Fix scriptlet pactest cases so they 'succeed' again
Signed-off-by: Dan McGee <dan@archlinux.org>
2007-10-14 18:52:17 -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
Chantry Xavier 5d30c5c0b7 pacman/pacman.c : put back root check even if -r is specified.
Root is needed for most install / remove operation, because it's needed
for chrooting, for running scriptlets.

Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
2007-10-14 17:56:40 -05:00
Nathan Jones abce73de4c Manually check xdelta exit codes.
This is needed because 'xdelta delta' returns 1 even when the delta
creation succeeds. This was causing makepkg to exit after the command
due to bash's -e option.

Some information from the xdelta man page:
The delta command exits with status 0 to indicate that no differences
were found, with status 1 to indicate that some differences were found,
and with status 2 to indicate an error of some kind.

Signed-off-by: Nathan Jones <nathanj@insightbb.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2007-10-14 17:54:32 -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 5adb8d4b5a util/testdb: fix up function naming
We shouldn't use the _alpm prefix (copy-paste issue, no big deal).

Signed-off-by: Dan McGee <dan@archlinux.org>
2007-10-10 06:57:42 -05:00
Nagy Gabor 3c4e98f7b5 Add two new pactests to check symlink behavior
Signed-off-by: Dan McGee <dan@archlinux.org>
2007-10-09 13:27:08 -05:00
Dan McGee 7f3adc3936 Add new French Arch mirror
Fix Aaron's busted-a** commit. :P

Signed-off-by: Dan McGee <dan@archlinux.org>
2007-10-09 12:48:02 -05:00
Aaron Griffin 5e3a1bdec6 New French mirror at ftp.free.fr
Signed-off-by: Aaron Griffin <aaronmgriffin@gmail.com>
2007-10-09 12:41:05 -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
Chantry Xavier e03a1f0044 pacman/pacman.c : add --logfile option.
Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
2007-10-08 20:46:56 -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
Nagy Gabor 3d8408759d Add new (failing) sync pactest
Signed-off-by: Dan McGee <dan@archlinux.org>
2007-10-08 20:46:55 -05:00
Dan McGee 1ff8e7f364 Remove the non-user friendly --ask option
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
Dan McGee 6aac221879 Add new french mirror
Signed-off-by: Dan McGee <dan@archlinux.org>
2007-10-08 20:46:55 -05:00
Dan McGee f5f4650de7 pacman-optimize: add check for diff/diffutils
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
Chantry Xavier 98bcd1f5b1 Fix -Sy and -Sp operations.
When the -Sy operation failed, the lock wasn't removed because
alpm_trans_release wasn't called. This is fixed now.

Also, after my last change in commit 52e7e6d747 ,
Sp didn't do anything anymore.
That's because needs_transaction returned false for -Sp, so the sync transaction
wasn't run. However, the current implementation of -Sp requires a sync transaction.

Also, since a transaction creates the lock file at the beginning, and releases it
at the end, this mean that -Sp requires root access anyway..

I think I understand now why Aaron found that the current -Sp implementation is hackish :)

Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
Signed-off-by: Aaron Griffin <aaronmgriffin@gmail.com>
2007-10-04 18:13:09 -05:00
Nathan Jones 02ec82b8c6 makepkg: Fix typo to make xdelta creation work.
Signed-off-by: Nathan Jones <nathanj@insightbb.com>
Signed-off-by: Aaron Griffin <aaronmgriffin@gmail.com>
2007-10-04 17:50:29 -05:00
Chantry Xavier 52e7e6d747 needs_transaction adjustments
I just moved the root path check out of needs_transaction, and put it directly
in pacman.c . I think this part is alright.

For the other problems, I thought about doing the transaction first, in a new
sync trans function, which will init and release a transaction.  And then doing
the commands like -Ss / -Sl / -Sg / -Si.

The problem is that for commands like -Sys / -Syl / etc, only the refresh part
of the transaction should be done.  So I had to introduce an ugly sync_only
hack.

Signed-off-by: Aaron Griffin <aaronmgriffin@gmail.com>
2007-10-03 21:02:36 -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
Dan McGee d5fa2da171 makepkg: Fix output color codes for real
Make sure we reset both the bold attribute and the color attributes when it
is necessary.

Signed-off-by: Dan McGee <dan@archlinux.org>
2007-09-28 12:45:14 -05:00
Dan McGee 5977a6ec9e Remove outdated mirror
Signed-off-by: Dan McGee <dan@archlinux.org>
2007-09-28 06:46:27 -05:00
Dan McGee 69d68ef0b5 makepkg: When we add an option, we should probably make it work
The -A,--ignorearch option was added and given help text, but never actually
listed as valid to the option parser. Fix this.

Signed-off-by: Dan McGee <dan@archlinux.org>
2007-09-28 00:36:48 -05:00
Aaron Griffin 48bf088e65 Use ANSI 'foreground' color instead of hardcoding 'white'
Signed-off-by: Aaron Griffin <aaronmgriffin@gmail.com>
2007-09-28 00:25:57 -05:00
Aaron Griffin b86479cf9b Allow --refresh specified for most -S options
Included options are -g, -i, -s, and -l
All of these will sync the DB if -y is specified and permissions are
appropriate.

Signed-off-by: Aaron Griffin <aaronmgriffin@gmail.com>
2007-09-28 00:25:57 -05:00
Aaron Griffin 4942d21632 Break out transaction test to a separate function
Added needs_transaction, putting out "hey do we need root?" tests in one place.

Signed-off-by: Aaron Griffin <aaronmgriffin@gmail.com>
2007-09-28 00:25:57 -05:00
Aaron Griffin 50bb16e015 OMG a space!
Yeah, I added a space. It deserves its own commit.

Signed-off-by: Aaron Griffin <aaronmgriffin@gmail.com>
2007-09-28 00:25:57 -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 16cb8e6e61 Reimplement pacman cache cleaning the right way
Partial cache cleaning was eliminated in a previous commit because it relied
on package naming conventions. Re-add it the correct way- we actually open
up each package in the cache and get a name and version out of it. If the
name and version match that of an installed package, keep it. If the package
is not installed or the version does not match the locally-installed version,
get rid of it.

This can easily be modified if some other heuristic of keeping and removing
packages is desired, or if we should clean out the cache dir of any files
that are not packages, etc.

The biggest current problem with this new approach- speed. Here is one run
on my local machine, going from 1643 to 729 packages in the cache (753 in
the local DB):
real    4m25.829s
user    3m22.527s
sys     0m6.713s

This is likely best addressed by the package loading scheme, which may be
loading the entirety of each package archive, which is a waste when we only
need the .PKGINFO file read.

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 679eff90cc Mirrorlist updates
Signed-off-by: Dan McGee <dan@archlinux.org>
2007-09-27 22:13:33 -05:00
Chantry Xavier a6b58638d1 document the -Qii option.
I suppose -Qii could be used for other things than displaying
the list of backup files, but currently, it's the only one,
so that's how I documented it..

Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2007-09-27 22:00:57 -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 012f793978 Allow a normal 'make' to compile without asciidoc installed
If we don't have asciidoc installed or enabled, we should still have a
successful make. However, we want to ensure 'make dist' fails without
asciidoc. This commit should ensure this.

Signed-off-by: Dan McGee <dan@archlinux.org>
2007-09-23 21:19:06 -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
Chantry Xavier 105fd40a4a Add sync044 pactest : A dependency induces a replacement.
That is the problem mentioned by Nagy there (with suggestions for fixing it) :
http://www.archlinux.org/pipermail/pacman-dev/2007-August/009082.html

If a dependency conflicts with a local package and has to replace it,
the PM_SYNC_TYPE_DEPEND information is lost, and the resulting install
reason is wrong (the package is marked as explictly installed).

Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
2007-09-23 19:50:11 -05:00