Commit Graph

1260 Commits

Author SHA1 Message Date
Sebastian Nowicki 30c4d53ce5 Add a fetch callback to allow front-end download support
This allows a frontend to define its own download algorithm so that the
libfetch dependency can be omitted without using an external process.
The callback will be used when if it is defined, otherwise the old
behavior applies.

Signed-off-by: Sebastian Nowicki <sebnow@gmail.com>
[Dan: minor cleanups]
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-07-22 21:27:46 -05:00
Nagy Gabor 1d19f0896c Introduce -Suu
If the user switches from unstable repo to a stable one, it is quite hard to
sync its system with the new repo (the user will see many "Local is newer
than stable" messages, nothing more). That's why I introduced -Suu, which
treats a sync package like an upgrade, iff the package version doesn't match
with the local one's.

I added a new pactest (sync104.py) to test this, and I updated the
documentation of -Su.

Signed-off-by: Nagy Gabor <ngaba@bibl.u-szeged.hu>
[Dan: slight doc reword]
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-07-22 20:16:52 -05:00
Nagy Gabor cf669eda9c Fix a minor memleak
Signed-off-by: Nagy Gabor <ngaba@bibl.u-szeged.hu>
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-07-21 21:45:07 -05:00
Giovanni Scafora 1c4596b4be Update Italian Translation
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-07-21 20:24:06 -05:00
Xavier Chantry 344ced22c3 Fix one bug with .paccheck leftover file
This happens for example if you install a new package, and one of its
backup config file is already on the file system.

If the local file was different, it was saved to .pacorig which is fine.

However if the local file and pkg file were the same, the pkg file
(temporarily extracted as .paccheck) was left on the system.

Signed-off-by: Xavier Chantry <shiningxc@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-07-20 16:38:15 -05:00
Xavier Chantry 60b6cde637 Fix 2 minor memleaks
Signed-off-by: Xavier Chantry <shiningxc@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-07-20 16:37:45 -05:00
Xavier Chantry 5d15bb68f7 Do not create .pacsave with -R, if the file is unchanged
This fixes FS#15546

Also fix the interface of unlink_file which was really stupid..
(alpm_list_t used with only one element)

Signed-off-by: Xavier Chantry <shiningxc@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-07-20 16:37:37 -05:00
Xavier Chantry 45f90de0eb Fix klibc conflict case.
A package can now replace symdir->dir by dir without fileconflicts.

Signed-off-by: Xavier Chantry <shiningxc@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-07-20 10:13:42 -05:00
Xavier Chantry bfd6817112 Fix fileconflict004
When one package wants to replace a directory by a file, we check that all
files in that directory were owned by that package.

Additionally pacman can be more verbose when the extraction of the symlink
(or file) fails. The patch to add.c looks more complex than it is, I just
moved and reindented code to handle cases 10 and 11 together.

Signed-off-by: Xavier Chantry <shiningxc@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-07-20 10:13:25 -05:00
Xavier Chantry 2e043aae36 Run ldconfig inside chroot.
This fixes FS#15294.

The code to run a command inside a chroot was refactored from the
_alpm_runscriptlet function to _alpm_run_chroot.

Signed-off-by: Xavier Chantry <shiningxc@gmail.com>
2009-07-16 06:12:04 -05:00
Dan McGee c72b4543b6 Update copyright headers and messages
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-07-01 02:08:33 -05:00
Dan McGee be7266155f Allow remove to accept 'local/' prefix
See FS#14642- this allows -Qs output to be fed back into pacman without
problems or having to strip off the 'local/' prefix manually.

Signed-off-by: Dan McGee <dan@archlinux.org>
2009-07-01 01:42:35 -05:00
Volodia Macovei 6af163dd79 Add new Romanian translation
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-06-30 23:34:18 -05:00
Dan McGee a89eae99f6 Fix compile warning fail on older versions of GCC
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-06-30 23:14:18 -05:00
Dan McGee 8c8fa2d82c Search package groups when searching a DB
See FS#13099. This makes sense especially for the pacman frontend, as we
show groups in the search output.

Signed-off-by: Dan McGee <dan@archlinux.org>
2009-06-23 21:51:49 -05:00
Nagy Gabor f250b034b4 Enable remove progressbar with -S (conflict resolving)
$ sudo pacman -S mc

Old output:
***********
:: mc conflicts with mc-mp. Remove mc-mp? [Y/n] y
...
(1/1) checking for file conflicts                   [################] 100%
(1/1) installing mc                                 [################] 100%

New output:
***********
:: mc conflicts with mc-mp. Remove mc-mp? [Y/n] y
...
(1/1) checking for file conflicts                   [################] 100%
(1/1) removing mc-mp                                [################] 100%
(1/1) installing mc                                 [################] 100%

Signed-off-by: Nagy Gabor <ngaba@bibl.u-szeged.hu>
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-06-13 09:57:59 -05:00
Dan McGee aa579b8438 Give sensible feedback when a repo has no configured servers
This fixes FS#14899. When running an -Sp operation without servers
configured for a repository, we would segfault, so add an assert to the
backend method returning the first server preventing a null pointer
dereference.

In addition, add a new error code to libalpm that indicates we have no
servers configured for a repository. This makes -Sy and -S <package>
operations fail gracefully and helpfully when a repo is set up with no
servers, as the default mirrorlist in Arch is provided this way.

Signed-off-by: Dan McGee <dan@archlinux.org>
2009-06-08 20:02:17 -05:00
Nagy Gabor 19b8b63885 Introduce _alpm_pkg_free_trans()
The main purpose of this function to make our code more readable.
It frees transaction specific fields of pmpkg_t. (It is used when a package
is removed from the target list.)

Signed-off-by: Nagy Gabor <ngaba@bibl.u-szeged.hu>
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-06-07 15:11:16 -05:00
Xavier Chantry 13b281d743 xdelta : only handle gz compression specifically
There is apparently no need to handle the re-compression manually when
applying a xdelta patch in case of bzip2 or xz.

Only gzip needs to be handled specifically for disabling timestamp with the
-n option.

After this patch, if xdelta is enhanced with xz support (1-line patch), it
will be transparent from pacman side.

Signed-off-by: Xavier Chantry <shiningxc@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-06-06 11:16:45 -05:00
Nagy Gabor c520d38451 Introduce PM_TRANS_FLAG_NOLOCK
This flag indicates that the front-end will not call alpm_trans_commit(),
so the database needn't be locked. This is the first step toward fixing
FS#8905.

If this flag is set, alpm_trans_commit() does nothing and returns with
an error (that has new code: PM_ERR_TRANS_NOT_LOCKED).

Signed-off-by: Nagy Gabor <ngaba@bibl.u-szeged.hu>
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-06-01 22:00:57 -05:00
Nagy Gabor 0bf340f73c Remove unused error codes and handle PM_ERR_RETRIEVE by alpm_strerror()
Signed-off-by: Nagy Gabor <ngaba@bibl.u-szeged.hu>
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-05-18 23:11:43 -05:00
Nagy Gabor 882bff36ac Remove find_replacements()
"Foo replaces bar" simply means that "foo is a new version of bar".
So this patch refactors the code to use this "rule".

_alpm_sync_sysupgrade now does the following for each local package [bar]
(pseudo-code):
for db in syncdbs {
   if(db contains bar) {check if db/bar is an upgrade; break;}
   replacers = find(bar replacers in db);
   if(replacers!=NULL) {ask_user; break;}
}

Note:
1. Replacers are grouped per repo. If more than one package replace bar in
a repo, all of them are considered ("package set of bar replacers").
2. If repo1/foo1 and repo2/foo2 both replaces bar, only repo1/foo1 is
considered (if repo1 stands before repo2 in pacman.conf). FS#11737 is fixed.
3. It can happen that pacman doesn't consider any replacer, if it found a
literal "earlier", so sync132.py modified accordingly (btw, that situation
should not appear irl).

The new sysupgrade code doesn't use sync_newversion(), so I removed the
"local is newer than repo" message, which was annoying with -Qu and
SyncFirst.

Signed-off-by: Nagy Gabor <ngaba@bibl.u-szeged.hu>
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-05-18 23:11:05 -05:00
Gerardo Exequiel Pozzi ed848b1c54 Fix non-C style comments in libalpm
Signed-off-by: Gerardo Exequiel Pozzi <vmlinuz386@yahoo.com.ar>
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-05-11 20:26:49 -05:00
Bryan Ischo db3e166503 Look in target-list first to resolve dependencies
This fixes a bug introduced by my previous changes which changes the
behavior of IgnorePkg/IgnoreGroup to allow the user to remove unresolvable
packages from the transaction.  The bug is that the target-list was no
longer being consulted first to resolve dependencies, which means that if
two packages in the sync database satisfied a dependency, and the user
explicitly requested one of those two packages in the sync, the other
package was still being pulled in.

A new test was added, sync993.py, to verify the desired behavior.

Signed-off-by: Bryan Ischo <bji-keyword-pacman.3644cb@www.ischo.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-04-11 14:39:24 -05:00
Bryan Ischo d70465decc Remove duplicates from the unresolvable list before prompting user
Signed-off-by: Bryan Ischo <bji-keyword-pacman.3644cb@www.ischo.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-04-11 14:24:52 -05:00
Dan McGee 4b78852f7e const-ify endswith()
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-04-11 14:13:03 -05:00
Nagy Gabor aefb4e0fa5 Remove pmsyncpkg_t
pmsyncpkg_t data sructure was removed:
1. pmpkg_t.reason is used instead of pmsyncpkg_t.newreason. (The target
packages come from sync repos, so we can use this field without any
problems. Upgrade transaction also uses this field to store this info.)
2. pmsyncpkg_t.removes was moved to pmpkg_t.removes.
This step requires careful programming, because we don't duplicate packages
when we add them to trans->packages. So we modify sync pkgcache when we
add this transaction-only info to our package. Hence it is important to
free this list when we remove any package from the target list
(remove_unresolvable, remove_conflicts, trans_free), otherwise this could
confuse the new sync transactions (with non-pacman GUI).

Overall, our code became ~100 line shorter, and we can call our helper
functions directly on trans->packages in sync.c, we don't need to maintain
parallel package lists.

Signed-off-by: Nagy Gabor <ngaba@bibl.u-szeged.hu>
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-04-11 14:05:13 -05:00
Nagy Gabor 391952600d Fix for trans001.py (FS#9088)
From now on _alpm_db_find_fileconflicts() works with upgrade and remove
target lists (like checkdeps), which makes it transaction independent
(we still need a trans param because of the progressbar). This is a small
step towards the universal transaction. So we call this function directly
from sync.c before commiting the remove transaction. This is much safer,
but we can get false fileconflict error alarms in some tricky cases
("symlinks puzzle" etc).

The patch on find_fileconflict looks complex, but it is mainly an
"indent-patch", the new code-part can be found after the
/* check remove list ... */ comment, and I modified something around the
"file has changed hand" case (see comment modifications in the code).

Unfortunately sync.c became more ugly, because we have to create 2 parallel
internal transactions: to avoid duplicated work, upgrade transaction is
used to load package data (filelists). This problem will disappear, when
we finally get rid of internal transactions.

Signed-off-by: Nagy Gabor <ngaba@bibl.u-szeged.hu>
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-04-11 13:59:55 -05:00
Nagy Gabor 634304feae Free *data list when user removes unresolvable packages
Resolvedeps reports error when it cannot resolve some dependencies, puts
them into the *data list, and set pm_errno. If user removes the
unresolvable packages from the target list, we have no error anymore,
so from now on we free *data list (we eliminate a memleak) and unset
pm_errno.

(Additionally I removed two needless lines from the code, unresolvable list
is always freed in cleanup.)

Signed-off-by: Nagy Gabor <ngaba@bibl.u-szeged.hu>
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-04-11 13:55:46 -05:00
Nagy Gabor 56fd24ecf8 Print warning in _alpm_resolvedep() if a satisfier package is ignored without QUESTION
After commit f57f8d3386 pacman *silently*
ignores packages from IgnorePkg/IgnoreGroup during dependency resolving,
if prompt == 0. This behavior is changed to "give warning + ignore".
(Otherwise the user is not informed about the fact that the package
resolving was blocked by ignorepkg.)

Signed-off-by: Nagy Gabor <ngaba@bibl.u-szeged.hu>
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-04-11 13:54:50 -05:00
Nagy Gabor 77efd51216 New error type: PM_ERR_PKG_IGNORED
This patch fixes FS#12059.
Now sync_addtarget can return with PM_ERR_PKG_IGNORED, which indicates that
although the requested package was found it is in ignorepkg, so alpm could
not add it to the transaction. So the front-end can decide what to do.

Signed-off-by: Nagy Gabor <ngaba@bibl.u-szeged.hu>
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-04-11 13:54:25 -05:00
Dan McGee 93ca155b48 Merge branch 'xav/repo-add' 2009-04-11 13:50:56 -05:00
Sebastian Nowicki 63fc93607b Add detail documentation for alpm_db_update()
This adds alpm_db_update() to the alpm_databases Doxygen group. The function
is described in more detail and a code example is given.

Signed-off-by: Dan McGee <dan@archlinux.org>
2009-04-11 12:50:37 -05:00
Samed Beyribey 3cb4eaef4f fixed typos and alignment problem in Turkish translation
Signed-off-by: Samed Beyribey <ras0ir@eventualis.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-04-05 21:40:58 -05:00
Xavier Chantry c8beffa790 Fix several issues with xdelta
1) The changes to sync.c look big but there are mostly caused by
the indentation. Fix a bug where download_size == 0 because the packages and
deltas are already in the cache, but we still need to build the deltas list
and apply the deltas to create the final package.

2) Fix the gzip / md5sum issue by switching to xdelta3, disabling external
recompression and using gzip -n in pacman, and disable bsdtar compression
and using gzip -n in makepkg.

Signed-off-by: Xavier Chantry <shiningxc@gmail.com>
2009-03-15 18:08:36 +01:00
Xavier Chantry 9519d22df7 be_files.c : use %jd instead of %ju for intmax_t
Signed-off-by: Xavier Chantry <shiningxc@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-03-15 11:41:37 -05:00
Xavier Chantry de97282fbd Revert "popen does NOT require /bin/sh in a subchroot"
This reverts commit 9558639d80.

This change was wrong, popen does require /bin/sh in a subchroot.

1) pacman -S lilo -r root

Notice no error

2) rm root/bin/sh ; pacman -S lilo -r root

Notice an error :
error: scriptlet failed to execute correctly

Actually, we already get an explicit error here, when popen is run, so there
is no need to check for bin/sh explicitely.

Besides this check was problematic in some cases. For example, bash itself
has a scriptlet, but only post_install and post_upgrade, no pre_install and
pre_upgrade. However, since bash has a scriptlet, runscriptlet will also be
called before bash is installed. It won't do anything since the scriptlet
has no pre_install function. But if we keep the check, we will still get
"error : no /bin/sh".

Conflicts:

	lib/libalpm/trans.c

Signed-off-by: Xavier Chantry <shiningxc@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-03-15 11:41:37 -05:00
Xavier Chantry 36863b968f runscriptlet : Flush open fds before fork() to avoid cloning buffers
This is a bug I noticed 2 years ago :
http://www.nabble.com/Re%3A-logging-output-crazy-to11437357.html#a11479679

I thought I fixed it with 57d77eab32

But the bug was still here. Reading man fork, this part caught my attention:

*  The child inherits copies of the parent's set  of  open  file
descriptors.  Each  file descriptor  in  the  child refers to the same open
file description (see open(2)) as the corresponding file descriptor in the
parent.  This means that the two descriptors  share open  file  status
flags, current file offset, and signal-driven I/O attributes (see the
description of F_SETOWN and F_SETSIG in fcntl(2)).

Since the open file descriptors are inherited, it is probably a good idea to
flush them before forking.

Signed-off-by: Xavier Chantry <shiningxc@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-03-15 11:40:49 -05:00
Dan McGee 4458f71851 Merge branch 'maint' 2009-02-28 15:43:36 -06:00
Xavier Chantry 8c09c19139 libalpm: remove from_md5 and to_md5 from pmdelta_t
The from_md5 and to_md5 fields were a nice extra safety, which would avoid
trying to apply deltas on corrupted package files. However, they are not
strictly necessary, since xdelta should be able to detect that on its own.

The main problem is that it is impossible to compute these informations from
the delta only. So repo-add would not be able to compute the delta entry
based on just the delta file.

Signed-off-by: Xavier Chantry <shiningxc@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-02-28 15:33:46 -06:00
Baurzhan Muftakhidinov b3c67a195f Add new Kazakh translation
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-02-24 08:24:47 -06:00
Bryan Ischo f57f8d3386 Don't prompt the user for unignore of IgnorePkg/IgnoreGroup packages
Don't prompt the user for unignore of IgnorePkg/IgnoreGroup packages,
except for packages explicitly listed for sync by the user.  This
eliminates many unnecessary prompts when IgnorePkg/IgnoreGroup is
used.

Signed-off-by: Bryan Ischo <bryan@ischo.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-02-23 20:37:14 -06:00
Bryan Ischo 0268550401 Enabled new interactive prompt and updated some tests
Enabled a new prompt to ask the user if they'd like to remove
unresolvable packages from the transaction rather than failing it.

Many pactest tests that used to fail now return success codes, because
pacman now issues a prompt allowing the user to cancel rather than
failing many transactions, and the pactest scripts always choose to
cancel with no error rather than failing.  The only net effect is that
the return status of pacman is now 0 in cases where it used to be
nonzero.

Signed-off-by: Bryan Ischo <bryan@ischo.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-02-23 20:33:56 -06:00
Bryan Ischo 6c4d702cb1 Reorganize code for one-at-a-time resolving
This change reorganizes the internal code so that packages are
resolved one at a time instead of all at once from a list.  This will
allow a future checkin to prompt the user to see if they'd rather
remove unresolvable packages from the transaction and continue, or
fail the transaction.  This change does not affect the actual behavior
of libalpm and all tests pass without changes.

Signed-off-by: Bryan Ischo <bryan@ischo.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-02-18 20:52:22 -06:00
Xavier Chantry 34e1413d75 Delay the creation of local and sync db dir.
We don't need to create the directories when local or sync dbs are
registered. For example, if a sync db does not exist, we cannot even do
"pacman -Q" as an user.

Instead, we can create the local db if needed during the db_prepare
operation, and sync dbs on db_update.

Also remove some more useless abstractions in db_update and switch to a much
more efficient way to remove a sync db : rm -rf.

Signed-off-by: Xavier Chantry <shiningxc@gmail.com>
2009-01-20 14:07:15 +01:00
Xavier Chantry 14230869e6 Remove some db abstraction crap.
These db_open and db_close looked quite useless. And they caused the db
directory to be opened on a simple registering of a database. This is
totally unneeded, this opening can be delayed to when we actually need it.

Signed-off-by: Xavier Chantry <shiningxc@gmail.com>
2009-01-20 14:04:54 +01:00
Xavier Chantry eab9684837 alpm_unpack : change prefix handling to workaround FS#12148.
Instead of appending the prefix to each entry name, we can chdir to the
prefix before extracting, and restoring when it is done.
This seems to work better with the strange and special case of FS#12148
where an archive contained the "./" entry.

Signed-off-by: Xavier Chantry <shiningxc@gmail.com>
2009-01-20 14:03:46 +01:00
Dan McGee c794661f1e Merge branch 'maint' 2009-01-18 13:48:48 -06:00
Nagy Gabor 472e51b975 Use archive_entry_set_perm instead of archive_entry_set_mode
This patch fixes FS#12148 ('unstable' regular file).
I also changed the other archive_entry_set_mode usage in add.c to
archive_entry_set_perm.

Since I cannot find any relevant info in libarchive manual, I quote
Tim Kientzle (the author of libarchive) here, and I say thank you for
his help.

*** Tim Kientzle wrote *************************************

This is the problem in libalpm/util.c:

323    if(S_ISREG(st->st_mode)) {
324            archive_entry_set_mode(entry, 0644);
325    } else if(S_ISDIR(st->st_mode)) {
326            archive_entry_set_mode(entry, 0755);
327    }

Your example unstable.db.tar.gz is not empty.  It has
one entry in it, called "./".  That entry is marked
as a directory.  But, when you call archive_entry_set_mode(),
you are changing the file type!  archive_read_extract()
then creates the file /var/unstable as you requested.
(archive_read_extract() will replace an empty directory
with a file.)

You should either set the mode value correctly:

323    if(S_ISREG(st->st_mode)) {
324            archive_entry_set_mode(entry, IFREG | 0644);
325    } else if(S_ISDIR(st->st_mode)) {
326            archive_entry_set_mode(entry, IFDIR | 0755);
327    }

Or use archive_entry_set_perm(), which does not change
the file type:

323    if(S_ISREG(st->st_mode)) {
324            archive_entry_set_perm(entry, 0644);
325    } else if(S_ISDIR(st->st_mode)) {
326            archive_entry_set_perm(entry, 0755);
327    }

************************************************************

Signed-off-by: Nagy Gabor <ngaba@bibl.u-szeged.hu>
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-01-18 13:35:17 -06:00
Nagy Gabor cb7337eb64 db->pkgcache_loaded and db->grpcache_loaded
Clearly the old code was more elegant (NULL cache indicated "not loaded"),
but it had some drawbacks, so from now on we indicate the state of caches
explicitly.

Old drawbacks:
When we had an empty database (unstable), libalpm called db_populate after
every pkgcache access, because NULL pkgcache indicated "not loaded" state.
This is not a common case, but the same situation can happen with grpcache,
which is more problematic: If the user had a custom repo with no groups,
grpcache was always NULL. (grpcache is also loaded per database.) Thus
every get_grpcache call induced a load_grpcache operation, so the benefits
of grpcache was completely lost.

Signed-off-by: Nagy Gabor <ngaba@bibl.u-szeged.hu>
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-01-12 23:59:37 -06:00
Nagy Gabor 4da70d800a Rename alpm_get_md5sum to alpm_compute_md5sum and alpm_dep_get_string to alpm_dep_compute_string
This patch introduces the following function name convention:
_compute_ in function name: the return value must be freed.
_get_ in function name: the return value must not be freed.

Signed-off-by: Nagy Gabor <ngaba@bibl.u-szeged.hu>
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-01-12 23:59:30 -06:00
Nagy Gabor a888f377a5 HoldPkg rework
The HoldPkg feature is even more important when the packages to be held are
pulled automatically by pacman, in a -Rc and -Rs operation. Before, it only
applied when the packages were explicitly requested by the user to be
removed. This patch extends holdpkg to -Rc and -Rs by doing the HoldPkg
check just before trans_commit.

Additionally, the whole HoldPkg stuff was moved to the front-end.

I changed the default behavior to "don't remove", so I modified remove030.py
pactest as well.

See also: FS#9173.

Original-work-by: Xavier Chantry <shiningxc@gmail.com>
Signed-off-by: Nagy Gabor <ngaba@bibl.u-szeged.hu>
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-01-12 22:44:00 -06:00
Xavier Chantry 8017b0bb8e Remove libdownload support and fix libfetch one.
Aaron said to consider libdownload a dead project so libdownload support was
removed to more easily fix libfetch one (otherwise many ifdef needed).

There was no direct replacement for ferror to detect an error while
downloading. So instead, I added a check at the end to see if the file was
fully downloaded, which is just a small chunk of code taken from here:
http://cvsweb.netbsd.org/bsdweb.cgi/pkgsrc/net/libfetch/files/fetch.c?only_with_tag=MAIN

Signed-off-by: Xavier Chantry <shiningxc@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-01-12 22:40:15 -06:00
Dan McGee 0501d340cd Merge branch 'maint' 2009-01-06 20:22:15 -06:00
Vojtěch Gondžala c6bcdf4dc7 Update Czech translation
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-01-05 19:06:39 -06:00
Dan McGee 6f9539aefb Merge branch 'maint'
Conflicts:
	po/it.po
2009-01-04 11:12:28 -06:00
Mateusz Herych 997a611fa4 Update Polish translation
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-01-03 19:07:44 -06:00
Samed Beyribey a2cbccb8c7 Update Turkish translation
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-01-03 09:25:24 -06:00
Sergey Tereschenko c850786e43 Update Russian translation
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-01-03 09:24:07 -06:00
Roman Kyrylych 3acc265f9d Update Unkranian translation
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-01-03 09:20:41 -06:00
Giovanni Scafora 03a63e01a5 Update Italian translation
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-01-03 09:17:50 -06:00
Matthias Gorissen 024012649f Update German translation
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-01-03 09:14:35 -06:00
Juan Pablo González Tognarelli 792ee97645 Update Spanish translation
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-01-03 00:30:09 -06:00
Dan McGee a30bf868ca Merge branch 'maint' 2009-01-03 00:18:22 -06:00
Allan McRae b55f478042 libalpm: add PID to db.lck
This is the first step in being able to automatically remove phantom
lock files.

Signed-off-by: Allan McRae <allan@archlinux.org>
[Dan: fix compilation warnings]
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-01-03 00:00:19 -06:00
Allan McRae a73ad4f0e3 Separate local db directory creation and db write
Changelogs and install files were getting extracted into the local
db folder before it was manually created.  This created issues for
uses with 0077 umasks and was highlighted with the new sudo handling
of umasks (FS#12263).

This moves the local db creation to its own function which is called
before the start of package archive extraction.  Also, added a check
that the folder is actually created.

Signed-off-by: Allan McRae <allan@archlinux.org>
[Dan: rename to _alpm_db_prepare()]
Signed-off-by: Dan McGee <dan@archlinux.org>
2009-01-02 23:52:32 -06:00
Sterling Winter b3169a5687 Log pacsave warnings to pacman.log
Pacman currently logs .pacnew warnings to pacman.log but a similar history
of .pacsave warnings isn't kept. The user should be able to search
pacman.log to discover when and where all .pac* files were created by
pacman.

Addresses FS#12531.

Signed-off-by: Dan McGee <dan@archlinux.org>
2009-01-02 23:40:20 -06:00
Dan McGee f8b689d48e Merge branch 'maint'
Conflicts:
	lib/libalpm/dload.c
	po/it.po
	scripts/makepkg.sh.in
2009-01-02 22:48:52 -06:00
Dan McGee cc7f3b705e Print proxy information when downloading
May help debug issues we come across with proxy behavior (e.g. those pesky
segfaults) as well as be informative to the user when things aren't working
quite right. Addresses FS#12396.

Signed-off-by: Dan McGee <dan@archlinux.org>
2008-12-10 19:45:15 -06:00
Dan McGee 61c6552862 Merge branch 'maint'
Conflicts:
	lib/libalpm/dload.c
2008-12-02 22:15:02 -06:00
Dan McGee b99bebc008 Add regex to delta code so we don't segfault when reading line
If the delta line doesn't match our regex, we won't go and process it,
possibly walking off the end of the string.

Signed-off-by: Dan McGee <dan@archlinux.org>
2008-11-30 17:17:00 -06:00
Dan McGee f7192b5958 Minor code cleanups
Mostly noticed when compiling libalpm/pacman with ICC.

Signed-off-by: Dan McGee <dan@archlinux.org>
2008-11-17 21:47:55 -06:00
Dan McGee 43f9eb1aa9 Set SIGPIPE handler to SIG_IGN when downloading
We don't want a failed write to kill our whole program when we are
downloading things, so set the SIGPIPE handler to ignore when downloading
and restore any previous signal handler when we complete the download.

Signed-off-by: Dan McGee <dan@archlinux.org>
2008-10-31 19:46:13 -05:00
Dan McGee 8d4e1e6754 Make libfetch the 'native' download library
Use libfetch naming in the code in place of libdownload names. This is in
preparation for dropping support for libdownload at some point as libfetch
can run on Linux.

Signed-off-by: Dan McGee <dan@archlinux.org>
2008-10-31 19:46:13 -05:00
Nagy Gabor 314b4462d2 -Qu rework
From now on -Qu is an "outdated package" filter on local database.
(This is a behaviour change.)

This patch fixes some memleaks and makes the code cleaner, for details see
my comment on FS#7884.

FS#11868 is implemented.

Signed-off-by: Nagy Gabor <ngaba@bibl.u-szeged.hu>
Signed-off-by: Dan McGee <dan@archlinux.org>
2008-10-31 19:46:13 -05:00
Dan McGee cd51abf0c8 Merge branch 'maint' 2008-10-28 22:20:09 -05:00
Lyman Li 2f5d792725 Update Chinese translation
Signed-off-by: Dan McGee <dan@archlinux.org>
2008-10-28 22:06:34 -05:00
Dan McGee d1fec15d81 Correctly close the pipe used for scriptlet execution
We never had a call to pclose() in here before, leaving our file descriptor
in some sort of limbo state. In addition, clean up some of the other logic
such as directly calling exit(1) on a popen() failure rather than going to
our cleanup block, and handling and respecting the exit status of the
subprocess correctly.

Signed-off-by: Dan McGee <dan@archlinux.org>
2008-10-18 23:59:28 -05:00
Sergey Tereschenko d24592cbcd Minor updates to Russian translation
Signed-off-by: Dan McGee <dan@archlinux.org>
2008-10-12 23:19:07 -05:00
Dan McGee fa02a71abd Merge branch 'maint' 2008-10-12 21:36:45 -05:00
Dan McGee f0e1846b51 Remove unnecessary unistd.h header inclusion
Signed-off-by: Dan McGee <dan@archlinux.org>
2008-10-12 21:30:15 -05:00
Dan McGee f9be2334f7 libalpm: handle syscall interruption correctly
It is possible to throw EINTR from a system call such as open(), close(), or
waitpid() if custom signal handlers are set up and they are not initialized
with the SA_RESTART flag. This was noticed by Andreas Radke when ^C (SIGINT)
was given during the call to waitpid(), causing it to throw the EINTR error
and we could not accommodate it.

Simply wrap these calls in a simple loop that allows us to retry the call if
interrupted.

Signed-off-by: Dan McGee <dan@archlinux.org>
2008-10-12 21:28:05 -05:00
Dan McGee da933c223e Remove unnecessary initialization in new functions
We don't need to zero things out, we are already using calloc for this
purpose.

Signed-off-by: Dan McGee <dan@archlinux.org>
2008-09-03 09:36:31 -05:00
Dan McGee 1c47500ea6 Merge branch 'maint' 2008-08-26 20:11:25 -05:00
Roman Kyrylych afac773d19 New Ukrainian translation
Signed-off-by: Dan McGee <dan@archlinux.org>
2008-08-26 20:00:10 -05:00
Xavier Chantry d05882db9e Rename alpm_db_get{pkg,grp}cache to alpm_db_get_{pkg,grp}cache
This is more consistent with the private functions :
_alpm_db_get_{pkg,grp}cache

Signed-off-by: Xavier Chantry <shiningxc@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2008-08-25 18:10:03 -05:00
Xavier Chantry 0701356260 Change checkdeps and checkdbconflicts to be more flexible.
These two functions now take directly a package list rather than a database.

checkdbconflicts was renamed to checkconflicts.

Signed-off-by: Xavier Chantry <shiningxc@gmail.com>
2008-08-25 18:08:52 -05:00
Xavier Chantry 24d7c6a372 Final updates on all translation for 3.2.1
* Update all .po files because of the last "-q,--quiet" fix.
Also for some strange reason, en_GB was missing a few c-format tags.

* Finally, delete all unused translations.

Signed-off-by: Xavier Chantry <shiningxc@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2008-08-25 17:54:22 -05:00
Hugo Doria 81853893a5 Update Portuguese (Brazil) translation
Xav : alignment fixes
2008-08-25 19:55:45 +02:00
Samed Beyribey eeb3c6868c Update Turkish translation 2008-08-25 19:36:01 +02:00
甘露(Lu.Gan) cfc52dad98 Update Chinese Simplified translation 2008-08-25 08:34:16 +02:00
Vojtěch Gondžala 49c58ce9db Update Czech translation 2008-08-24 14:10:17 +02:00
Matthias Gorissen 08b0fb856d Update German translation 2008-08-24 14:10:16 +02:00
Sergey Tereschenko 6f38cedd8d Update Russian translation
[Xav: one minor fix to libalpm po file]
2008-08-24 02:04:39 +02:00
Dan McGee a4100b3847 Merge branch 'maint' 2008-08-23 18:28:58 -05:00
Xavier Chantry 68e59ecbaf Update British English translation
Signed-off-by: Xavier Chantry <shiningxc@gmail.com>
2008-08-23 23:38:40 +02:00
Xavier Chantry 91eeee08de Update French translation
Signed-off-by: Xavier Chantry <shiningxc@gmail.com>
2008-08-23 23:36:12 +02:00
Nagy Gabor 05d23059fd Update Hungarian translation 2008-08-23 23:36:12 +02:00
Juan Pablo González Tognarelli f56d763547 Update Spanish translation
Xav : one minor fix (a missing %s in the downgrading message).
2008-08-23 23:35:21 +02:00
Mateusz Herych 8f99f75e6e Update Polish translation 2008-08-23 23:15:55 +02:00
Giovanni Scafora 4b4ad18348 Update Italian translation 2008-08-23 23:13:12 +02:00
Dan McGee b0b5dabf1b Update translation files for pending 3.2.1 release
Signed-off-by: Dan McGee <dan@archlinux.org>
2008-08-23 11:21:28 -05:00
Nagy Gabor baf5852555 Move -Sp implementation to the front-end
This patch kills one of our hackish pseudo transactions: PRINTURIS.
(The other one is -Sw)

From now on, front-end must not call trans_commit in case of -Sp,
it should print the uris of target packages "by hand" instead.

PRINTURIS flag was removed, NOCONFLICTS flag can be passed to skip
conflict checks.

Signed-off-by: Nagy Gabor <ngaba@bibl.u-szeged.hu>
Signed-off-by: Dan McGee <dan@archlinux.org>
2008-08-23 09:50:40 -05:00
Nagy Gabor 8146f6f1c6 New public alpm_pkg_get_db function
This function returns with the origin database of a package.

Signed-off-by: Nagy Gabor <ngaba@bibl.u-szeged.hu>
Signed-off-by: Dan McGee <dan@archlinux.org>
2008-08-23 09:44:47 -05:00
Nagy Gabor 3ff7701e89 Pass the old package with PM_TRANS_EVT_UPGRADE_START
This is more rational and coherent with PM_TRANS_EVT_UPGRADE_DONE.

Signed-off-by: Nagy Gabor <ngaba@bibl.u-szeged.hu>
Signed-off-by: Dan McGee <dan@archlinux.org>
2008-08-23 09:20:32 -05:00
Xavier Chantry 5b51dbb11e Cleanup of _alpm_pkg_compare_versions.
* Change the return values to be more informative.

It was previously boolean, only indicating if a sync package was newer than
a local package.

Now it is a simple wrapper to vercmp, handling the force flag.

* Remove the verbose output from _alpm_pkg_compare_versions.

The "force" message is not so useful.
The "package : local (v1) is newer than repo (v2)" message can be moved to
-Su operation.
For the -S operation, it is better to have something like :
"downgrading package from v1 to v2"

* Don't display the "up to date -- skipping" and "up to date -- reinstalling"
messages, when the local version is newer than the sync one.

* Fix the behavior of --needed option to not skip a target when the local
version is newer, and clarify its description.

* Add a new alpm_pkg_has_force function

This allows us to access the pkg->force field like any other package fields.

Signed-off-by: Xavier Chantry <shiningxc@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2008-08-23 08:47:07 -05:00
Nagy Gabor 729651a554 Remove an usused variable from alpm/util.c/_alpm_lckmk()
Probably a tweakable "lockdb-retry" option was planned which is not
implemented. (Now it should be implemented in front-end.)

So now this variable was unused and caused a small memleak.
(FREE(dir) was not reached in case of error.)

Signed-off-by: Nagy Gabor <ngaba@bibl.u-szeged.hu>
Signed-off-by: Dan McGee <dan@archlinux.org>
2008-08-19 18:43:46 -05:00
Xavier Chantry 232b838a54 libalpm/add.c : ensure the old pkg was fully loaded.
This fixes FS#11218.

Signed-off-by: Xavier Chantry <shiningxc@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2008-08-19 18:42:51 -05:00
Dan McGee d8f8a12665 Fix segfault on x86_64 when using UseSyslog
Due to differences in handling va_list between i686 and x86_64, this bug
can only be seen on x86_64. va_list usage is not allowed but we had been
getting away with it. See
http://lists.opensuse.org/opensuse-programming/2008-02/msg00005.html
for details and explanation.

This fixes FS#11096.

Signed-off-by: Dan McGee <dan@archlinux.org>
2008-08-08 22:18:00 -05:00
Dan McGee 57393eb730 Fix variable naming issues in _alpm_db_cmp
When this function got a rewrite in commit f43805d875, argument and variable
names got a bit mixed up when separating the casts from the strcmp
operation. Fix the mixup which also fixes a possible segfault when this
function is called.

Signed-off-by: Dan McGee <dan@archlinux.org>
2008-08-08 13:45:46 -05:00
Xavier Chantry 72c5a298a3 Avoid double slashes in URLs given to libdownload.
If a Server specified in pacman.conf had a trailing slash, libalpm ended up
building URLs with double slashes, and this broke libdownload with errors
like the following one :

error: failed retrieving file 'redland-1.0.8-1-i686.pkg.tar.gz'
from 192.168.0.90 : Command okay

So the public function alpm_db_set_server will make sure to remove the
trailing slash of servers.  For the private function
_alpm_download_single_file, I only added a comment.

Signed-off-by: Xavier Chantry <shiningxc@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2008-08-05 19:30:29 -05:00
Xavier Chantry 4476598e4e dload.c : drop the specific handling of file: url.
Before commit fc48dc31, file:/// urls forced the use of the internal
downloader (libdownload), because the default XferCommand, wget, does not
handle them.  We tried to move away from forcing usage of libdownload, so
this commit implemented the handling of file:/// urls manually. However,
this implementation is way too basic. It does not handle the progress bar,
thus nothing at all appears in pacman's output when a file: repo is
synchronized, or when a file is downloaded from a sync repo. Also, it is not
able to detect when the repo is already up-to-date. When libdownload was
used, both were handled.

It seems better to just drop this implementation for now. All users who use
libdownload will get the much better file:// handling back. For the users of
XferCommand, it will be more problematic, but they have several options:

1) Switch to a downloader handling file:// (wget doesn't, but curl does for
example).
2) Drop the file:// repo, and set up light http or ftp servers instead.
Consider that going that way would make this repo available for the whole
local network, which can be useful.
3) Switch back to libdownload, which works perfectly for many users.

Signed-off-by: Xavier Chantry <shiningxc@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2008-08-05 09:58:52 -05:00
Xavier Chantry 115dcf0911 Final update of all translations.
Two recent commits slightly broke the translations, so this fixes all of
them.

Signed-off-by: Xavier Chantry <shiningxc@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2008-07-30 07:24:32 -05:00
Giovanni Scafora 20a0b8e201 Small fix to Italian translation
Signed-off-by: Giovanni Scafora <linuxmania@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2008-07-25 07:14:55 -05:00
Xavier Chantry b8e306b73e Implement AND based package searching.
This fixes FS#2334.

Signed-off-by: Xavier Chantry <shiningxc@gmail.com>
[Dan: add some comments to the code]
Signed-off-by: Dan McGee <dan@archlinux.org>
2008-07-24 22:16:29 -05:00
Dan McGee e6fb229534 Remove unused strverscmp substitute
Our internal vercmp function was the only user of this, and it no longer
relies on it.

Signed-off-by: Dan McGee <dan@archlinux.org>
2008-07-24 22:16:28 -05:00
Xavier Chantry 310b13a4b7 libalpm/package.c : fix infolevel bug in pkg_dup
The pkg_dup function shouldn't call any alpm_pkg_get_ accessors because
this can fill the old package with all INFRQ_DESC fields for example, and
this won't necessarily be reproduced in the new package (for all the fields
that were copied before).

Signed-off-by: Xavier Chantry <shiningxc@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2008-07-24 22:16:28 -05:00
Dan McGee 5e4882dfe8 Fix vercmp and add additional tests
This vercmp issue has been a sticking point but this should resolve many of
the issues that have come up. Only a few minor code changes were necessary
to get the behavior we desired, and this version appears to beat any other
vercmp rendition on a few more cases added in this commit.

This commit passes all 58 vercmp tests currently out there. Other 'fixes'
still fail on a few tests, namely these ones:

test: ver1: 1.5.a ver2: 1.5 ret: -1 expected: 1
  ==> FAILURE
test: ver1: 1.5 ver2: 1.5.a ret: 1 expected: -1
  ==> FAILURE
test: ver1: 1.5-1 ver2: 1.5.b ret: 1 expected: -1
  ==> FAILURE
test: ver1: 1.5.b ver2: 1.5-1 ret: -1 expected: 1
  ==> FAILURE
4 of 58 tests failed

Signed-off-by: Dan McGee <dan@archlinux.org>
2008-07-24 22:16:28 -05:00
Hugo Doria 24783e6b6b Update Portuguese (Brazil) translation
Signed-off-by: Xavier Chantry <shiningxc@gmail.com>
2008-07-22 19:47:01 -05:00
Mateusz Herych c9550e9655 Update Polish translation
Signed-off-by: Xavier Chantry <shiningxc@gmail.com>
2008-07-22 19:47:01 -05:00
Sergey Tereschenko a7ee8f90f9 Update Russian translation
Signed-off-by: Xavier Chantry <shiningxc@gmail.com>
2008-07-22 19:47:01 -05:00
Vojtěch Gondžala 12e804511a Update Czech translation
Signed-off-by: Xavier Chantry <shiningxc@gmail.com>
2008-07-22 19:47:01 -05:00
Jeff Bailes 6d4f235af9 Update British English translation
Signed-off-by: Xavier Chantry <shiningxc@gmail.com>
2008-07-22 19:47:01 -05:00
Samed Beyribey 441c2dd550 Update Turkish translation
Signed-off-by: Xavier Chantry <shiningxc@gmail.com>
2008-07-22 19:47:00 -05:00
甘露(Lu.Gan) 27f56304d6 Update Chinese Simplified translation
Signed-off-by: Dan McGee <dan@archlinux.org>
2008-07-22 19:46:56 -05:00
Nagy Gabor 501ce943e6 Update Hungarian translation
Signed-off-by: Dan McGee <dan@archlinux.org>
2008-07-22 19:46:12 -05:00
Juan Pablo González Tognarelli b169925c1e Update Spanish translation
Signed-off-by: Dan McGee <dan@archlinux.org>
2008-07-22 19:46:11 -05:00
Giovanni Scafora c1a648137e Update Italian translation
Signed-off-by: Dan McGee <dan@archlinux.org>
2008-07-22 19:46:11 -05:00
Matthias Gorissen 4ebad47ae7 Update German translation
Signed-off-by: Dan McGee <dan@archlinux.org>
2008-07-22 19:46:11 -05:00
Xavier Chantry ad697d2fd5 Update French translation
Signed-off-by: Dan McGee <dan@archlinux.org>
2008-07-22 19:46:11 -05:00
Xavier Chantry 991dfca90e Update pot files.
Signed-off-by: Xavier Chantry <shiningxc@gmail.com>
2008-07-22 19:46:11 -05:00
Nagy Gabor b4f2cb53ef Rephrase some debug messages in alpm/sync.c
Debug messages were removed from _alpm_sync_find, because it is a general
purpose function; debug messages should be placed in the caller function.

I inserted "adding package foo-1.0-1 to the transaction targets" debug
message to find_replacements and sync_sysupgrade.

Signed-off-by: Nagy Gabor <ngaba@bibl.u-szeged.hu>
Signed-off-by: Dan McGee <dan@archlinux.org>
2008-07-19 11:05:17 -05:00
Nagy Gabor 2b73d45127 Use NULL instead of "" as no causingpkg
Our STRDUP macro (used in _alpm_depmiss_new) is NULL safe.

Signed-off-by: Nagy Gabor <ngaba@bibl.u-szeged.hu>
Signed-off-by: Dan McGee <dan@archlinux.org>
2008-07-19 11:04:38 -05:00
Nagy Gabor 471ed04790 alpm_list_remove treat NULL needle as "nothing"
So if you want to remove NULL needle from a list, alpm_list_remove will
return with "not found".

Signed-off-by: Nagy Gabor <ngaba@bibl.u-szeged.hu>
Signed-off-by: Dan McGee <dan@archlinux.org>
2008-07-17 20:20:13 -05:00
Nagy Gabor 5929508198 Fix a possible segfault in alpm/remove.c
Before removing a package from target list (in remove_prepare_keep_needed),
we should check whether we have already removed it.

Signed-off-by: Nagy Gabor <ngaba@bibl.u-szeged.hu>
Signed-off-by: Dan McGee <dan@archlinux.org>
2008-07-17 20:20:06 -05:00
Nagy Gabor 03021713e5 _alpm_db_add_pkgincache rework
Commit 8240da6cb3 broke some alpm hierarchy
and introduced a new memleak (trans->packages was never freed in case of add
transaction, even if the transaction wasn't committed), so it is reverted
now.

We follow a different approach to reduce memory usage:
_alpm_db_add_pkgincache doesn't duplicate the whole package before adding
it to the cache, only the package name and version (INFRQ_BASE).
This method needs very small extra memory (compared to the reverted method),
and after transaction commit we use less memory than before (since the
big 'files' fields are not copied to cache), this is useful in GUIs.

Note: The old add_pkgincache was a bit broken, since pkg->origin wasn't
filled in correctly.

Signed-off-by: Nagy Gabor <ngaba@bibl.u-szeged.hu>
Acked-by: Xavier Chantry <shiningxc@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2008-07-15 19:16:42 -05:00
Nagy Gabor 37b5972212 Fix some memleaks in alpm/add.c
In case of error some allocated memory wasn't freed in commit_single_pkg.
Note: The return value of this function is not used.

Signed-off-by: Nagy Gabor <ngaba@bibl.u-szeged.hu>
Signed-off-by: Dan McGee <dan@archlinux.org>
2008-07-15 19:13:30 -05:00
Nagy Gabor 17e9c9d9ff Fix a wrong FREELIST usage in add.c
The dynamic pmconflict_t must be freed with _alpm_conflict_free.

Signed-off-by: Nagy Gabor <ngaba@bibl.u-szeged.hu>
Signed-off-by: Dan McGee <dan@archlinux.org>
2008-07-15 19:12:22 -05:00
Nagy Gabor fd8969f678 sync_addtarget rework
Now '-S provision' handling is done in the back-end.

In case of multiple providers, the first one is selected (behavior change:
deleted provision002.py). The old processing order was: literal, group,
provision; the new one: literal, provision, group. This is more rational,
but "pacman -S group" will be slower now. "pacman -S repo/provision" also
works. Provision was generalized to dependencies, so you can resolve deps by
hand: "pacman -S 'bash>2.0'" or "pacman -S 'core/bash>2.0'" etc. This can be
useful in makepkg dependency resolving. The changes were documented in
pacman manual.

alpm_find_pkg_satisfiers and _alpm_find_dep_satisfiers functions were
removed, since they are no longer needed.

I added some verbosity to "select provider instead of literal" and
"fallback to group".

Signed-off-by: Nagy Gabor <ngaba@bibl.u-szeged.hu>
Signed-off-by: Dan McGee <dan@archlinux.org>
2008-07-13 09:16:55 -05:00
Dan McGee b196cc43a5 Merge branch 'maint' 2008-07-07 21:39:42 -05:00
Nagy Gabor d92b0e674d Fix a bogus message in Hungarian translation
Signed-off-by: Nagy Gabor <ngaba@bibl.u-szeged.hu>
Signed-off-by: Dan McGee <dan@archlinux.org>
2008-07-07 21:30:42 -05:00
Nagy Gabor 72c0ab5c51 Resolvedeps rework
I divided resolvedeps into 2 functions. The new _alpm_resolvedep function
will resolve one dependency, for example the 'foo>=1.0-1' dependency.  It
can be useful in sync_addtarget refactoring.

The resolvedeps parameters were changed, to be coherent with recursedeps:
* the target-list is an alpm_list* instead of alpm_list**. This is OK,
  because alpm_list_add == alpm_list_add_last
* syncpkg param was removed. list contains the to-be-installed packages,
  resolvedeps will add the required dependencies into this list
* trans param was removed, it was used in QUESTION() only, which can be used
  on the main (handle->trans) transaction only (because the front-end cannot
  access our pseudo-transactions at all!).

The patch fixes some wrong dynamic pmdepmissing_t usage.

I did a behavior change (and sync1003.py was modified accordingly), which
needs some explanation: The old resolvedeps didn't elect packages from
'remove' list. I've dropped this because I don't want that 2nd excluding
list param. In fact, in real life, we ~never need this rule. Resolvedeps is
called before checkconflicts, so only -Su's %REPLACES% packages are sitting
in 'remove' list. This means, that we have the replacement packages in our
target list. Usually "foo replaces bar" means, that bar isn't in our repos
any more, so resolvedeps *cannot* elect it; but usually it won't try it at
all, because foo is in the target list, and it is expected to satisfy
'bar>=1.0-1'-like dependencies too. Since checkdeps and checkconflicts is
done after resolvedeps, this cannot cause any harm.

Signed-off-by: Nagy Gabor <ngaba@bibl.u-szeged.hu>
Signed-off-by: Dan McGee <dan@archlinux.org>
2008-07-07 21:12:55 -05:00
Nagy Gabor 8856146d71 Swap parameters on PM_TRANS_CONV_INSTALL_IGNOREPKG callback function
PM_TRANS_CONV_INSTALL_IGNOREPKG callback function can get 2 params: foo, bar
in this order (packages), bar can be NULL.

Old API:
foo, NULL: Do you want to install foo from IgnorePkg?
foo, bar: foo requires bar from IgnorePkg. Do you want to install bar?
New API:
foo, bar: Do you want to install foo from IgnorePkg? (If bar!=NULL:) bar
requires it.

Signed-off-by: Nagy Gabor <ngaba@bibl.u-szeged.hu>
Signed-off-by: Dan McGee <dan@archlinux.org>
2008-07-07 21:12:30 -05:00
Nagy Gabor 616b5967b8 New _alpm_find_dep_satisfier function
This function finds the first satisfier package in a pkglist. Using it
instead of _alpm_find_dep_satisfiers eliminates some memleaks and it is
faster. (_alpm_find_dep_satisfiers and _alpm_find_pkg_satisfiers will be
removed soon.)

Signed-off-by: Nagy Gabor <ngaba@bibl.u-szeged.hu>
Signed-off-by: Dan McGee <dan@archlinux.org>
2008-07-07 21:04:37 -05:00
Nagy Gabor f7199f36ba New _alpm_dep_edge function
The function is introduced to kill some code duplication. The function name
uses the 'dependency graph' terminology.

Signed-off-by: Nagy Gabor <ngaba@bibl.u-szeged.hu>
Signed-off-by: Dan McGee <dan@archlinux.org>
2008-07-07 21:04:16 -05:00
Nagy Gabor 2122eb1428 Don't duplicate packages in requiredby list
This is a "fix" for FS#10226. I think that multiple versioned dependencies
are quite common now, and the old behavior is quite annoying there. This
patch won't cause any slow-down.

Signed-off-by: Nagy Gabor <ngaba@bibl.u-szeged.hu>
Signed-off-by: Dan McGee <dan@archlinux.org>
2008-07-07 21:03:52 -05:00
Dan McGee d594b6e797 Merge branch 'maint' 2008-06-19 08:51:36 -05:00
Alper KANAT d88524ea0e Add libalpm Türkçe (Turkish) translation
Signed-off-by: Dan McGee <dan@archlinux.org>
2008-06-19 08:46:56 -05:00
Dan McGee 29bf6814f7 Use access() instead of stat() when possible
We were using the stat() system call in quite a few places when we didn't
actually need anything the stat struct returned- we were simply checking for
file existence. access() will be more efficient in those cases.

Before (strace pacman -Ss pacman):
% time     seconds  usecs/call     calls    errors syscall
------ ----------- ----------- --------- --------- ----------------
 33.16    0.005987           0     19016           stat64

After:
% time     seconds  usecs/call     calls    errors syscall
------ ----------- ----------- --------- --------- ----------------
 34.85    0.003863           0     12633         1 access
  7.95    0.000881           0      6391         7 stat64

Signed-off-by: Dan McGee <dan@archlinux.org>
2008-06-15 22:52:27 -05:00
Dan McGee 7313c8546a Merge branch 'maint' 2008-06-12 19:21:06 -05:00