This is for 3.3.0, not for 3.3.1. But since there are only like 10 messages
missing, it seems worth including now.
Signed-off-by: Christian Larsson <congacx@gmail.com>
Signed-off-by: Laszlo Papp <djszapi2@archlinux.us>
[Dan: fix some busted translation strings]
Signed-off-by: Dan McGee <dan@archlinux.org>
Commit 34e1413d75 attempted to implement lazy loading of package databases.
Although it took care of my main complaint (creating the database directory
if it didn't exist), it didn't allow sync repos to be registered before
alpm_option_set_dbpath() had been called.
With this patch, we no longer compute the individual repository DB paths
until necessary, allowing full lazy loading to work as intended, and
allowing us to drop the extra setlibpath() calls from the frontend. This
allows the changes introduced in a2cd48960 (but later reverted) to be added
back in again.
Signed-off-by: Dan McGee <dan@archlinux.org>
It was probably a bad idea to modify the target directly in case of
repo/pkg syntax.
Duplicating it also allows us to keep the original target string, which
is more informative when printing errors.
Also remove a duplicated error message from libalpm, and improve the
message already returned to the frontend.
$ pacman -S foo/bar
before
error: repository 'foo' not found
error: 'bar': no such repository
after
error: 'foo/bar': could not find repository for target
Signed-off-by: Xavier Chantry <shiningxc@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
Add more untranslated strings, improve consistency, etc.
Signed-off-by: Xavier Chantry <shiningxc@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
After commit 774c252 the --debug output shows 5-6 "syntax error..." lines
for each package. After this patch pacman recognizes makepkgopt as a valid
key, but doesn't do anything.
Signed-off-by: Nagy Gabor <ngaba@bibl.u-szeged.hu>
Signed-off-by: Dan McGee <dan@archlinux.org>
-int alpm_trans_sysupgrade(int enable_downgrade);
-int alpm_trans_sync(char *target);
-int alpm_trans_add(char *target);
-int alpm_trans_remove(char *target);
+int alpm_sync_sysupgrade(int enable_downgrade);
+int alpm_sync_target(char *target);
+int alpm_sync_dbtarget(char *db, char *target);
+int alpm_add_target(char *target);
+int alpm_remove_target(char *target);
* functions renaming
* add new sync_dbtarget which allows to specify the db
* repo/ syntax handling is moved to frontend
( should implement FS#15141)
* group handling is moved to backend
( see http://www.archlinux.org/pipermail/pacman-dev/2009-June/008847.html )
This basically started with this change :
/* Transaction */
struct __pmtrans_t {
- pmtranstype_t type;
pmtransflag_t flags;
pmtransstate_t state;
- alpm_list_t *packages; /* list of (pmpkg_t *) */
+ alpm_list_t *add; /* list of (pmpkg_t *) */
+ alpm_list_t *remove; /* list of (pmpkg_t *) */
And then I have to modify all the code accordingly.
This patch utilizes the power of sync.c to fix FS#3492 and FS#5798.
Now an upgrade transaction is just a sync transaction internally (in alpm),
so all sync features are available with -U as well:
* conflict resolving
* sync dependencies from sync repos
* remove unresolvable targets
See http://www.archlinux.org/pipermail/pacman-dev/2009-June/008725.html
for the concept.
We use "mixed" target list, where PKG_FROM_FILE origin indicates local
package file, PKG_FROM_CACHE indicates sync package. The front-end can add
only one type of packages (depending on transaction type) atm, but if alpm
resolves dependencies for -U, we may get a real mixed trans->packages list.
_alpm_pkg_free_trans() was modified so that it can handle both target types
_alpm_add_prepare() was removed, we use _alpm_sync_prepare() instead
_alpm_add_commit() was renamed to _alpm_upgrade_targets()
sync.c (and deps.c) was modified slightly to handle mixed target lists,
the modifications are straightforward. There is one notable change here: We
don't create new upgrade trans in sync.c, we replace the pkgcache entries
with the loaded package files in the target list (this is a bit hackish) and
call _alpm_upgrade_targets(). This implies a TODO (pkg->origin_data.db is
not accessible anymore), but it doesn't hurt anything with pacman front-end,
so it will be fixed later (otherwise this patch would be huge).
I updated the documentation of -U and I added a new pactest, upgrade090.py,
to test the syncdeps feature of -U.
Signed-off-by: Nagy Gabor <ngaba@bibl.u-szeged.hu>
Signed-off-by: Dan McGee <dan@archlinux.org>
Sometimes "foo conflicts with bar" information is not enough, see this
thread: http://bbs.archlinux.org/viewtopic.php?id=77647. That's why I added
a new reason field to our pmconflict_t struct that stores the packager-
defined conflict that induced the fact that package1 conflicts with
package2.
I modified the front-end (in callback.c, sync.c, upgrade.c) to print this
new information as well.
Signed-off-by: Nagy Gabor <ngaba@bibl.u-szeged.hu>
This function is unused since commit
358cc5804a.
Signed-off-by: Xavier Chantry <shiningxc@gmail.com>
[Dan: also kill from util.h]
Signed-off-by: Dan McGee <dan@archlinux.org>
- fix one memleak if get_filename failed
- cleanup according to Joerg's feedback:
"url_for_string: If fetchParseURL returned successful, you should always
have a scheme set. The logic for anonftp should only be needed for very
broken server -- do you know of any such?
download_internal:
Specifying 'p' is now a nop -- it is tried by default first with
fall-back to active FTP."
Signed-off-by: Xavier Chantry <shiningxc@gmail.com>
[Dan: remove from pacman.conf and pacman.conf.5]
Signed-off-by: Dan McGee <dan@archlinux.org>
libfetch supports checking mtime so we do not need to do it manually.
when the databases are already up-to-date, initiating a connection with
fetchXGet and closing it right after with fetchIO_close took a very long
time (up to 10min!) on some network.
Signed-off-by: Xavier Chantry <shiningxc@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
(cherry picked from commit d7675e393f)
We had 10000 as our timeout value, assuming it was expressed in ms. This is
false after looking at the current code, so reset it back to 10 seconds.
Addresses FS#15369.
Signed-off-by: Dan McGee <dan@archlinux.org>
I assume the loop was never iterated more than once, because the write
location was not updated at each loop iteration (buffer instead of buffer +
nwritten), yet we never had reports of corrupted download.
Signed-off-by: Xavier Chantry <shiningxc@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
libfetch supports checking mtime so we do not need to do it manually.
when the databases are already up-to-date, initiating a connection with
fetchXGet and closing it right after with fetchIO_close took a very long
time (up to 10min!) on some network.
Signed-off-by: Xavier Chantry <shiningxc@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
If /sbin is not in the PATH and sudo is used, ldconfig cannot be found. So
use /sbin/ldconfig instead. The code checked for the existence of
/sbin/ldconfig anyway..
Signed-off-by: Marc - A. Dahlhaus <mad@wol.de>
Signed-off-by: Xavier Chantry <shiningxc@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
After commit 30c4d53ce5, get_destfile and
get_tempfile are only used for internal download, so move these two
functions inside the ifdef
Signed-off-by: Xavier Chantry <shiningxc@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
'make distcheck' had issues with this one and reformatted it. In addition,
it found a fuzzy message which is now fixed due to an inadvertent msgid
edit.
Signed-off-by: Dan McGee <dan@archlinux.org>
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>
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>
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>
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>
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>
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>
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>
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>
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>
$ 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>
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>
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>
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>
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>
"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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
* 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>
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>
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>
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>
* 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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
Some previous commits apparently broke the get_filename function for package
loaded with pkg_load (on a -Qip operation) because this field was no longer
filled. Now pkg_load fills it.
But the -Qip operation needs to be run like this : -Qip <filename>, so the
filename is already known. There is no need to display it again.
Besides, on a normal -Qi operation, the filename is not displayed either
because this information is not stored in the local database.
Signed-off-by: Xavier Chantry <shiningxc@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
Errors like the following one happen regularly (for unknown reasons...) :
error: could not open file /var/lib/pacman/local//glibc-2.7-9/depends: No
such file or directory
Anyway, every time an user reported an error like that, it always seemed
like he thought the error was caused by the double /, which is obviously
wrong.
Since db->path always include a trailing /, there is no need to add one when
concatenating paths in be_files.c or add.c.
Additionally, some static strings were switched to dynamic.
And the computation of the "dbpath"/"pkgname"-"pkgversion" was refactored
in db_read, db_write and db_remove with a get_pkgpath static function.
Signed-off-by: Xavier Chantry <shiningxc@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
Add a new totaldlcb callback function to libalpm and make pacman utilize it
when the TotalDownload option is enabled. This callback function is pretty
simple- it is meant to be called once at the beginning of a "list download"
action, and once at the end (with value 0 to indicate the list has been
finished). The frontend is responsible for keeping track of adding
individual file download amounts to the total xfered amount in order to
display some sort of overall progress.
Signed-off-by: Dan McGee <dan@archlinux.org>
We have been using unsigned long as a file size type for a while, which
works but isn't quite correct and could easily break. Worse was probably our
use of int in the download callback functions, which could be restrictive
for packages > 2GB in size.
Switch all file size variables to use off_t, which is the preferred type for
file sizes. Note that at least on Linux, all applications compiled against
libalpm must now be sure to use large file support, where _FILE_OFFSET_BITS
is defined to be 64 or there will be some weird issues that crop up.
Signed-off-by: Dan McGee <dan@archlinux.org>
This was mistakenly referencing the LGPL even after the XySSL code bump, so
fix the license clause to be correct.
Signed-off-by: Dan McGee <dan@archlinux.org>
Commit 8428367285 introduced the regression,
and a previous commit introduced the vercmptest.sh test script to track down
these issues. This commit solves the problem by removing the previous
attempt at locating the pkgrel portions and replacing it with something that
performs the correct logic.
While tracking down everything I needed to, I also found a mistake in one of
the pactests which is fixed here as well as increased the functionality and
verbosity of the vercmptest script to both print out each test it is running
as well as automatically run the mirror of each test case.
Signed-off-by: Dan McGee <dan@archlinux.org>
Removed unused handle->uid from pmhandle_t. The need to check permissions
should be determined by the frontend (and is in pacman).
Fixed comment on noextract in pmhandle_t.
Signed-off-by: Allan McRae <mcrae_allan@hotmail.com>
Signed-off-by: Xavier Chantry <shiningxc@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
This event was unused, was missing the equivalent EXTRACT_DONE event, and
was useless because we already have ADD / UPGRADE START and DONE events.
Signed-off-by: Xavier Chantry <shiningxc@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
repo-add and db_read both assume that REPLACES and FORCE fields are in the
desc file, so do that for db_write as well (instead of depends file).
Note that db_write is currently only used on the local database. And the
only purpose of replaces and force in local database is for information
purpose (available on -Qi operations). So this is not a big problem.
Ref: http://www.archlinux.org/pipermail/pacman-dev/2008-May/011859.html
Acked-by: Dan McGee <dan@archlinux.org>
Signed-off-by: Xavier Chantry <shiningxc@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
Name and version are computed from "/var/lib/pacman/..." pathname. And the
%NAME% and %VERSION% fields from the desc file were not even read. So now,
when we read the desc file, we make sure the %NAME% and %VERSION% fields are
consistent.
Signed-off-by: Nagy Gabor <ngaba@bibl.u-szeged.hu>
Signed-off-by: Xavier Chantry <shiningxc@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
In the case of -Rs operation, first pulling the dependencies with
recursedeps before calling checkdeps takes care of the dependency chain of
remove052 pactest.
In the case of -Rcs, we can keep the old behavior because we have no problem
there (any dependency returned by checkdeps will be added to the remove list
because of -Rc) and we have to run recursedeps on the final remove list
anyway to catch all orphans.
Ref.: http://www.archlinux.org/pipermail/pacman-dev/2008-April/011569.html
Signed-off-by: Nagy Gabor <ngaba at bibl.u-szeged.hu>
Signed-off-by: Xavier Chantry <shiningxc@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
Actually, just rename _alpm_versioncmp to alpm_pkg_vercmp and get rid of the
need for a wrapper since it did nothing anyway.
Signed-off-by: Dan McGee <dan@archlinux.org>
This code hasn't been looked at in some time. I grabbed a more recent
version of the RPM source (4.4.2.3) and attempted to sync up any changes
they have made, as well as make the libalpm additional code much cleaner and
limited to only a few added lines of code.
The size of this patch might make you think we added code, but bloat-o-meter
actually tells us otherwise:
<function> <old> <new> <diff>
_alpm_versioncmp 1485 1021 -464
Signed-off-by: Dan McGee <dan@archlinux.org>
Any real call of this function doesn't specify a name or version ahead of
time, so just kill that functionality off. Now to remove those dummy
packages...
Signed-off-by: Dan McGee <dan@archlinux.org>
If we have a package without name and/or version, we are really out of luck.
Speed these functions up by removing unnecessary code. Note that both the
splitname and pkg_load functions, where the name and version of packages are
initially populated for databases and pkg.tar.gz files respectively, enforce
that every new package struct created has a name and version.
Signed-off-by: Dan McGee <dan@archlinux.org>
Commit 0460038447 caused a regression when
rereading the pkgcache after updating the on-disk databases. A rewinddir
call was errantly removed.
Instead of replacing the call to rewindir, clean up this whole mess.
db_scan is used only once and with target == NULL so there was actually half
the code of db_scan which was unused. This is gone now and replaced by a
single new db_populate function.
Dan: add_sorted ended up being 3x slower than one msort at the end, so I
changed back to that. I also made one pointer variable const and merged this
whole patch with my original fix for the rewinddir issue.
Signed-off-by: Xavier Chantry <shiningxc@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
This has been around since at least pacman 2.9.8. Frugalware just dumped it
in commit 113ec73bfcfdc, and deleting it here and running pactest shows that
nothing that we have actually tested changes. If someone can pactest the
edge case where this is needed, then show me the money.
Signed-off-by: Dan McGee <dan@archlinux.org>
* remove obsolete and unused *_cmp helper functions like deppkg_cmp and
_alpm_grp_cmp
* new alpm_list_remove_str function, used 6 times in handle.c
* remove _alpm_prov_cmp / _alpm_db_whatprovides and replace them by
a more general alpm_find_pkg_satisfiers with a cleaner implementation.
before: alpm_db_whatprovides(db, targ)
after: alpm_find_pkg_satisfiers(alpm_db_getpkgcache(db), targ)
* remove satisfycmp and replace alpm_list_find + satisfycmp usage by
_alpm_find_dep_satisfiers.
before : alpm_list_find(_alpm_db_get_pkgcache(db), dep, satisfycmp)
after : _alpm_find_dep_satisfiers(_alpm_db_get_pkgcache(db), dep)
* remove _alpm_pkgname_pkg_cmp, which was used with alpm_list_remove, and
use _alpm_pkg_find + alpm_list_remove with _alpm_pkg_cmp instead.
This commit actually get rids of all complicated and asymmetric _cmp
functions. I first thought these functions were worth it, be caused it
allowed us to reuse list_find and list_remove. But this was at the detriment
of the clarity and also the ease of use of these functions, dangerous
because of their asymmetricity.
Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
Now the syntax is coherent with alpm_list_find and alpm_sync_find.
Signed-off-by: Nagy Gabor <ngaba@bibl.u-szeged.hu>
Signed-off-by: Dan McGee <dan@archlinux.org>
alpm_pkg_load() and parse_descfile() are specific to getting information
from package files, just as other code is specific to getting information
into or out of a package database. Move this code out of package.c, which
should eventually only contain operators on the pmpkg_t struct that do not
depend at all on where the data came from.
Signed-off-by: Dan McGee <dan@archlinux.org>
We have some useless abstractions like an alpm_db_rewind function. I've read
somewhere that readdir() was the worst filesystem function call invented,
and what do we do? Add a wrapper around it. Kill this abstraction and move
some other things into be_files that should be there anyway because they
are so tied to how a files backend works.
Signed-off-by: Dan McGee <dan@archlinux.org>
It was unclear what "loading the full package" actually did. The
detailed description should clear that up, without having to look at the
code.
Signed-off-by: Sebastian Nowicki <sebnow@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
The start of a few commits to remove some PATH_MAX usage from our code. Use
a dynamically allocated string instead.
Signed-off-by: Dan McGee <dan@archlinux.org>
We only need a copy of this string once we know we are going to extract it,
and we don't need a static buffer to copy it into since it is coming from a
known-length string.
Signed-off-by: Dan McGee <dan@archlinux.org>
XySSL 0.9 was released; sync our code with the upstream source. Note that
there weren't any real changes besides renaming of macros, so nothing much
to see here.
The biggest change may be the licence- it is now GPL/BSD software rather
than LGPL/BSD. The license header is changed to reflect this.
Signed-off-by: Dan McGee <dan@archlinux.org>
It is hard to decipher what the transaction events actually notify you
of, and what parameters are passed to the callback function, without
looking at the code. This patch adds documentation for the _pmtransevt_t
enum in order to clarify what the event is for and what data is passed
when the callback is called.
Signed-off-by: Sebastian Nowicki <sebnow@gmail.com>
Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
Rework to use a single #define for the buffsize, and in the process clean up
some other code and double the default buffer size.
Signed-off-by: Dan McGee <dan@archlinux.org>
We were a bit juryrigged using one call to mkstemp() before rather than
extracting the new files side-by-side and doing our comparisons there. We
were also facing some permissions issues. Instead, make our life easier by
extracting all temp files to a '.paccheck' extension, doing our md5
comparisons, and then taking the correct actions.
Still to be done here- a cleanup of the use of PATH_MAX which should not be
necessary if we use dynamic allocation on the heap.
Signed-off-by: Dan McGee <dan@archlinux.org>
I'm not sure why these were ever here, as by this point we have already
extracted the file meaning a call to this function is basically a no-op.
Signed-off-by: Dan McGee <dan@archlinux.org>
We removed one too many FREELIST() calls when trying to fix some memleaks,
and add a safety/sanity check to ensure filename is set, as packages in old
DBs are likely to not have this field.
Signed-off-by: Dan McGee <dan@archlinux.org>
Reference : FS#9547.
The get_filename function first tries to get the filename field from the
database, and if it doesn't find it, it tries to guess it based on the name,
version and arch.
This field was introduced in 3.0, but there are still many old entries in
the official databases without it. So the databases need to be regenerated
first before this patch can be applied.
There is a second problem with the delta code, which needs the filename for
locally installed packages too, but this field is not present in the local
db. So the delta code needs to be fixed first.
Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
As Nathan noticed, the new informations in the delta struct allows us to
get rid of this list :
http://www.archlinux.org/pipermail/pacman-dev/2008-February/011163.html
So I rewrote apply_deltas for that. The previous apply_deltas also had a
limitation: it assumed that the initial package and the deltas were in the
first cache dir, which is not necessarily the case. That situation is
supported now.
Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
Using the graph structures that Nagy set up for dependency sorting, we now
do a similar process for deltas. Load up all of the deltas into a graph
object on which we can then apply Dijkstra's algorithm, using the new weight
field of graph struct.
We initialize the nodes weight using the base files that we can use in our
filecache (both filename and md5sum must match). The algorithm then picks
the best path among those that can be resolved.
Note that this algorithm has a few advantages over the old one:
1. It is completely file agnostic. These delta chains do not have to consist
of package files- this could be adopted to do delta-fied DBs.
2. It does not use the local_db anymore, or even care if a package or file
is currently installed. Instead, it only looks in the filecache for files
and packages that match delta chain entries.
Original-work-by: Dan McGee <dan@archlinux.org>
Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
Start to move the delta struct away from an assumed package name scheme and
towards something that is package (or even filename) agnostic. This will
allow us much greater flexibility in the usage of deltas (maybe even sync
DBs some day) as well as allowing code outside of delta.h/delta.c to be much
cleaner with less of a need for snprintf() calls.
Signed-off-by: Dan McGee <dan@archlinux.org>
In the can_remove_package function, we don't need to compute the whole
requiredby list, we just need to find one member of it that doesn't belong
to the targets list.
That way we get a small speedup and remove the only usage of
alpm_pkg_compute_requiredby in the backend, so that it can be tweaked for
frontend usage.
Signed-off-by: Nagy Gabor <ngaba@bibl.u-szeged.hu>
Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
This should remove the need for any additional patching to run on platforms
that have libfetch available but not libdownload. It isn't the prettiest,
but we have kept our libdownload impact down to just a few files, so it can
be easily done.
Signed-off-by: Dan McGee <dan@archlinux.org>
free() is designed to do nothing if it is passed a NULL pointer, so there is
no need to check for it on our end. Change/fix the macro.
Signed-off-by: Dan McGee <dan@archlinux.org>
Darwin's binary format does support symbols with differing visibilities, but
it does not support the protected or internal visibilities- only hidden. For
Darwin only, we should fall back to this visibility to prevent warnings from
the compiler and because it is close enough for our library purposes.
See http://gcc.gnu.org/viewcvs/*checkout*/trunk/gcc/config/darwin.c, search
for the "darwin_assemble_visibility" function for more details.
Also add pacman.static.exe to gitignore.
Signed-off-by: Dan McGee <dan@archlinux.org>
Linux includes all the gettext stuff in glibc, so there is no need for the
libintl links which we failed to include in our linker variables. Update the
makefiles which should enable NLS support on all platforms, including OS X
and Cygwin.
Signed-off-by: Dan McGee <dan@archlinux.org>
Things must have gotten stricter with GCC 4.3 on the '%zd' printf string and
this is the first I've tried to compile there. Fix the problem by using
size_t instead of int.
Signed-off-by: Dan McGee <dan@archlinux.org>
Pulled two loops out of _alpm_remove_prepare and gave them their own
functions.
Signed-off-by: K. Piche <kevin@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
We no longer expose any of libdownload in our public functions, so no need
to include this header anymore.
Signed-off-by: Dan McGee <dan@archlinux.org>
There were a few issues with this code:
1. We already had an open fd to a file, but never used it to our benefit.
Use the libarchive convienence method to write the current file contents
straight to a file descriptor.
2. The real problem cropped up on Windows where the locking semantics caused
the old way of extraction to fail because we had an open file descriptor.
By using the file descriptor and closing it ASAP, we prevent these
failures.
Signed-off-by: Dan McGee <dan@archlinux.org>
Add a new --disable-internal-download flag to configure allowing the
internal download code to be skipped. This will be helpful on platforms that
currently don't support either libdownload or libfetch (such as Cygwin) and
for just compiling a lighter weight pacman binary.
This was made really easy by our recent refactoring of the download code
into separate internal and external functions, as well as some error code
cleanup.
Signed-off-by: Dan McGee <dan@archlinux.org>
We correctly closed the logfile stream when recalling set_logfile, but did
not NULL out the dead pointer once we did this. Fix the problem which was
the cause of FS#10056.
Signed-off-by: Dan McGee <dan@archlinux.org>
After the libarchive upgrade from 2.4.12 to 2.4.14, our usage of
archive_entry_pathname became dangerous. We were using the result of that
function even after calls to archive_entry_set_pathname.
With 2.4.14, the entryname becomes wrong after these calls, and so all the
future use of entryname are bogus. entryname is used quite a lot for
logging, so that's not so bad. But it's also used for the backup handling,
so that's not very cool. For example, reinstalling a package with backup
entries will erase all the md5 entries from the DB, because they won't be
found back.
entryname is now a static string so that we can easily keep the result of
archive_entry_pathname.
Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
[Dan: fixed version numbers in commit message]
Signed-off-by: Dan McGee <dan@archlinux.org>
This should be a notable speed-up (apart from kernel cache).
Signed-off-by: Nagy Gabor <ngaba@bibl.u-szeged.hu>
Signed-off-by: Dan McGee <dan@archlinux.org>
With the addition of the archive_fgets() function, we can now skip the temp
file usage in pkg_load/parse_descfile that was not needed. This has a nice
benefit of probably being both faster, reducing code, and getting rid of
"expensive" file operations.
Signed-off-by: Dan McGee <dan@archlinux.org>
This crude function allows reading from an archive on a line-by-line basis
similar to the familiar fgets() call on a FILE stream. This is the first
step in being able to read DB entries straight from an archive.
Signed-off-by: Dan McGee <dan@archlinux.org>
This patch should avoid duplicated target names in the backend.
1. sync_loadtarget will return with PM_ERR_TRANS_DUP_TARGET when trying to
add a duplicated target
2. sysupgrade never pulls duplicated targets
3. resolvedeps won't pull duplicated targets anymore
A pulled list was introduced in sync_prepare to improve the
pmsyncpkg_t<->pmpkg_t list conversion by making it more direct.
Also replace sync1005 and sync1006 by the sync1008 pactest, which is
similar but more interesting (the provisions are dependencies instead of
explicit targets).
sync1005 didn't work as expected anyway. It was expecting that pacman
failed, and pacman indeed failed, but not for the good reason. It didn't
fail during the preparation step because of conflicting targets, but during
the commit step, because of a md5 error...
And sync1006 didn't pass and was not really worth fixing. We have already
enough failing pactests more important than these two.
sync1008 pass with this patch.
Signed-off-by: Nagy Gabor <ngaba@bibl.u-szeged.hu>
Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
In the file:// download case, we didn't free the return from get_destfile()
after we were done with it. Fix it. (Found with xfercommand001.py)
Signed-off-by: Dan McGee <dan@archlinux.org>
The _alpm_backup_split function always alloced memory for the fname, and we
let it disappear in a specific case (upgrade026.py). Fix the issue.
Signed-off-by: Dan McGee <dan@archlinux.org>
This will reduce the need for running an -Syy if the DB was only
half-extracted, as the mtime won't get updated until the new database is
completely in place.
Signed-off-by: Dan McGee <dan@archlinux.org>
* -Rss removes all dependencies (including explicitly installed ones).
* updated documentation
* two pactest files added to test the difference between -Rs and -Rss
Signed-off-by: Nagy Gabor <ngaba@bibl.u-szeged.hu>
Its implementation was quite broken:
* add_loadtarget() might have silently filtered out some targets when
replacing an older version.
* This was used in sync.c to determine whether a target is implicit or not,
which is incorrect behavior. Before this patch we silently removed user
confirmed replacements; now we always warn on a replacement.
* remove001.py behavior was quite odd in adding same target 5 times to the
target list, we can change this behavior to be a failure.
Signed-off-by: Nagy Gabor <ngaba@bibl.u-szeged.hu>
[Xav: changed remove001 pactest accordingly]
Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
[Dan: rewrote commit message]
Signed-off-by: Dan McGee <dan@archlinux.org>
This should be the main step in the download refactoring initiated by commit
81a2a06818.
The stub functions introduced by that commit were implemented.
The big download code was mostly composed of two steps, and so it has been
naturally splitted in two functions : download_external and download_internal
file:/// urls are now handled manually, instead of forcing the use of the
internal downloader.
Thanks to Dan for fixing the remaining issues and cleaning up the patch :)
Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
Now pacman frontend uses this function instead of the compile-time libalpm
version number.
Signed-off-by: Nagy Gabor <ngaba@bibl.u-szeged.hu>
[Dan: fix one more spot where LIB_VERSION was used]
Signed-off-by: Dan McGee <dan@archlinux.org>
(cherry picked from commit 49197b7492)
This comment was created for the old provision version format and needless.
Signed-off-by: Nagy Gabor <ngaba@bibl.u-szeged.hu>
Signed-off-by: Dan McGee <dan@archlinux.org>
Hopefully the last of the huge commits ever. This also adds the c-format tag
to all of the translated messages.
Signed-off-by: Dan McGee <dan@archlinux.org>
Add the --no-location xgettext option to disable the line numbers. They are
not very useful, and generate a huge number of pointless line changes on
every update.
Ref: http://www.archlinux.org/pipermail/pacman-dev/2008-March/011332.html
Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
The issue was discussed in this thread on the mailing list:
http://archlinux.org/pipermail/pacman-dev/2008-March/011324.html
In addition, the GNU gettext manual states that translation encoding is
completely separate from the encoding used by the users of the translation.
It makes sense for our project to use UTF-8 for all translations, regardless
of the preferred encoding used by users of a certain language. This allows
all contributors to more easily edit a translation file if necessary and not
have to worry about codepage issues.
Signed-off-by: Dan McGee <dan@archlinux.org>
Now pacman frontend uses this function instead of the compile-time libalpm
version number.
Signed-off-by: Nagy Gabor <ngaba@bibl.u-szeged.hu>
[Dan: fix one more spot where LIB_VERSION was used]
Signed-off-by: Dan McGee <dan@archlinux.org>
test_delta_md5sum and test_pkg_md5sum were simple wrappers to test_md5sum,
and only used once, so not very useful. I removed them.
Also, test_md5sum and alpm_pkg_checkmd5sum functions were a bit duplicated,
so I refactored them with a new _alpm_test_md5sum function in libalpm/util.c
Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
I screwed up originally when I accepted the TotalDownload patch,
8ec27835f4. I didn't realize how deeply it
modified libalpm and I probably shouldn't have let it do what it did. This
commit reverts much of what that patch added in order to clean up our
internal function calls. We can find another way to do it right down the
road here but for now it has to go.
Signed-off-by: Dan McGee <dan@archlinux.org>
Using c-format on every strings allowed me two found two broken ones.
One was harmless, but the other caused a segfault, as reported in FS#9658.
Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
Currently xgettext apparently attempts to autodetect c format strings (eg a
string with a %s) to decide whether to use c-format flag or not.
If we use --flag=_:1:c-format instead of --flag=_:1:pass-c-format, the
c-format will be applied everywhere.
I couldn't find this documented anywhere though. But the pass prefix is
mentioned here :
http://www.gnu.org/software/gettext/manual/html_node/xgettext-Invocation.html#xgettext-Invocation
"Specifies additional flags for strings occurring as part of the argth
argument of the function word. The possible flags are the possible format
string indicators, such as ‘c-format’, and their negations, such as
‘no-c-format’, possibly prefixed with ‘pass-’."
And c-format is documented there :
http://www.gnu.org/software/gettext/manual/html_node/c_002dformat-Flag.html#c_002dformat-Flag
"This situation happens quite often. The printf function is often called
with strings which do not contain a format specifier. Of course one would
normally use fputs but it does happen. In this case xgettext does not
recognize this as a format string but what happens if the translation
introduces a valid format specifier? The printf function will try to access
one of the parameters but none exists because the original code does not
pass any parameters."
And that's exactly what happened with FS#9658.
So using c-format for every string will prevent this issue from happening
again.
Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
Remove what was a pretty weird abstraction in the libalpm backend. Instead
of parsing server URLs as we get them (of which we don't usually use more
than a handful anyway), wait until they are actually used, which allows us
to store them as a simple string list instead. This allows us to remove a
lot of code, and will greatly simplify the continuing refactoring of the
download code.
Signed-off-by: Dan McGee <dan@archlinux.org>
Add new stub functions that work by calling the existing (terrible) download
forreal function, which needs a serious overhaul. Hide the existing
functions and switch all former users to the new functions.
Signed-off-by: Dan McGee <dan@archlinux.org>
This is the first in what will be a series of patches to clean up the
current download code in libalpm. Start by moving download code out of
server.c and into download.c.
Signed-off-by: Dan McGee <dan@archlinux.org>
* Remove some #include statements that are not strictly necessary
* Remove node_new function that is really just a one-liner
Signed-off-by: Dan McGee <dan@archlinux.org>
* Introduces 'list == NULL' convention for empty list. That means
alpm_list_new isn't needed anymore, so kill it
* Small straightforward fixes in alpm_list.c
Signed-off-by: Nagy Gabor <ngaba@bibl.u-szeged.hu>
Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
This will allow us to utilize this helpful type and functions in places
besides dependency calculations. In addition, remove the public declaration
of pmgraph_t in alpm.h- there is zero need to expose this internal type.
Signed-off-by: Dan McGee <dan@archlinux.org>
This is the first step of fixing FS#9547. This should not break any existing
code that may rely on this function behaving the way it did, and should be
good for inclusion in a maint release.
In addition, update pactest so it fills the FILENAME field in the DB entries
it creates so we can move forward with a real fix to this issue.
Signed-off-by: Dan McGee <dan@archlinux.org>
For our Czech, Polish, and Russian translations, they do not need to be at
the more specific 'lang_COUNTRY' code, but can live at just plain 'lang'.
This follows the pattern of most other translated programs out there as
Roman pointed out on IRC.
ru_RU: 2 (pacman and libalpm)
ru: 128 for him, 131 for me (everything else)
Signed-off-by: Dan McGee <dan@archlinux.org>
If the end of the pB list was reached before the end of pA, we failed to
read any remaining files from the pA list. Add an additional loop to ensure
all entries of pA are added to the return list regardless of whether we have
reached the end of pB.
This new loop also eliminates the now-unnecessary check for a null pB, as we
need to ensure we are excluding directories in the resulting output anyway.
Signed-off-by: Dan McGee <dan@archlinux.org>
sync->newversion shouldn't be public at all, and internally we access it directly.
(Before pmsyncpkg_t clean-up the analogue of this field [type] was needed in replaces computation.)
Signed-off-by: Nagy Gabor <ngaba@bibl.u-szeged.hu>
Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
This patch indroduces a new public alpm_sync_newversion, which scans for new
version of a package in sync repos.
Hopefully this will reduce code duplication in the future:
* check-for-pacman-new-version from front-end can be easier
* -Qu refactoring
Signed-off-by: Nagy Gabor <ngaba@bibl.u-szeged.hu>
Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
Fixes FS#9235.
We already had the following case in extract_single_file :
/* cases 1,2,3: couldn't stat an existing file, skip all backup checks */
But we actually only did a lstat here. And if lstat worked, we did a stat
without checking.
When lstat works and stat fails, it means we have a broken symlink, like in
FS#9235. We can actually treat this case like a non-existing file.
The broken symlink will then be simply overwritten.
Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
_alpm_pkgname_pkg_cmp(pkgname, pkg) returns true iff pkg's name is pkgname.
This is useful if you want to remove a package from pmpkg_t* list, and you
want to search for package name.
This allows cleaning the -Ru code a bit, by removing the need of a dummy
pkg.
Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
With --unneeded option 'pacman -R' doesn't stop in case of dependency error;
it removes the needed-dependency targets from the target-list instead. See
also: http://archlinux.org/pipermail/pacman-dev/2007-October/009653.html .
The patch also adds a new causingpkg field to pmdepmissing_t which indicates
the to-be-removed package which would cause a dependency break. This is
needed, because miss->depend.name may be a provision. miss->causingpkg will
be useful in -R dependency error messages too.
[Xavier: renamed inducer to causingpkg, removed the _alpm_pkgname_pkg_cmp
helper function as requested by Aaron. This might be added by a further
commit. Other small cleanups, updated manpage and bash completion.]
Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
Fix for sync044.py and reason001.py.
Rename sync->data to sync->removes (alpm_list_t *)
Replace pmsynctype_t sync->type by pmpkgreason_t sync->newreason
The type field was set to UPGRADE or DEPEND or REPLACE.
Instead of using type = UPGRADE or DEPEND, we now rather use a
"pmpkgreason_t newreason" field directly (= explicit or depend) which allows
a better handling of the install reason.
And the REPLACE type is now deduced implicitly when the sync->removes list
is not empty.
Signed-off-by: Nagy Gabor <ngaba@bibl.u-szeged.hu>
Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
* eliminate asymmetry (innerconflict vs. outerconflict)
* fix a memleak (in case of PM_ERR_MEMORY deps wasn't freed)
* fix wrong pmconflict_t duplication (*retconflict = *conflict)
Note: the new code introduces some code duplication which shall disappear by
fixing FS#7524.
Signed-off-by: Nagy Gabor <ngaba@bibl.u-szeged.hu>
Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
Remove unnecessary synclist_free function, and use our standard way
(alpm_list_free_inner + alpm_list_free) instead.
This slightly reduces code duplication.
Signed-off-by: Nagy Gabor <ngaba@bibl.u-szeged.hu>
Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
The original patch from Nagy tried to resolve target vs target conflicts,
and so broke the following pactests : sync040, sync041 and sync990
Nagy's proposal to solve this situation was to choose the interactive way,
ask the user how to deal with it: either remove pkg1 or remove pkg2 or stop
here. So he left this as a TODO.
But instead of trying to resolve these conflicts or asking the user, I
tried to find a more conservative way, looking at what the current pactests
expected:
If between the two conflicting packages, one provides the other, pacman
will keep that one and remove the other from the target list. That breaks
sync893 and sync897. But Dan agreed these two looked weird and should be
changed.
This commit should close FS#8897, FS#8899 and FS#9024.
Reference:
http://www.archlinux.org/pipermail/pacman-dev/2007-October/009745.htmlhttp://www.archlinux.org/pipermail/pacman-dev/2007-December/010393.html
Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
The mixup causes a fail in the build using --enable-debug on x86_64 but not
i686, so none of us caught this right away. Fix it. FS#9297.
Signed-off-by: Dan McGee <dan@archlinux.org>
Edit _alpm_db_add_pkgincache to not duplicate packages, because this is not
needed, is slower, and uses more memory. This made the max memory usage
during base reinstall go from 10.4MB to 9.7MB.
Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
This function has a limited purpose, but might be interesting to do a
sanity check from a frontend (eg testdb).
Also removed the private _alpm_checkconflicts function to avoid confusion.
This function was used only once in libalpm, in sync.c, and was just a
single line anyway. Having to do it manually makes it explicit that we are
looking for two kind of conflicts (targ vs targ and db vs targ).
Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
We have a debug message in the target vs. target file conflict check, and
this is a bit rediculous when it comes to watching output from something
like smoke001.py. Instead, put the output outside this inner loop so we only
see it at most once per target, which is much more reasonable.
Signed-off-by: Dan McGee <dan@archlinux.org>
This is the symmetric of --asdeps, install packages explicitly.
Documentation and completion files were updated accordingly.
Added sync301.py and upgrade032.py pactest files to test this.
I also made a little modification in ALLDEPS handling too.
Signed-off-by: Nagy Gabor <ngaba@bibl.u-szeged.hu>
Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
The deptest code (pacman -T) used by makepkg was mostly in the frontend.
There were 2 drawbacks:
1) the public splitdep function returns a pmdepend_t struct, but the
_alpm_dep_free function for freeing it is private. So there was a memleak.
2) there is a helper in the backend (satisfycmp in deps.c) which makes this
function much easier.
So this adds a new public alpm_deptest in libalpm/deps.c, which cleans
pacman_deptest in pacman/deptest.c a lot.
Besides, alpm_splitdep was made private, because the frontend no longer
requires it, and _alpm_dep_free is also private.
Finally the deptest001 pactest was extended.
Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
Another elimination of a static length structure in libalpm. Should result
in a little more memory saved during execution of packages with lots of
deltas attached.
Signed-off-by: Dan McGee <dan@archlinux.org>
We are in string freeze for the 3.1.1 release. This commit updates all the
message files to the latest code, and all translation updates should be
based off of these po-files. Please attempt to keep the line number changes
to a minimum- there should be no reason to update these po files with just
new line numbers. That way we can more easily see exactly which translations
were updated.
Signed-off-by: Dan McGee <dan@archlinux.org>
Change the 'provname provver' format to 'provname=provver'.
In .PKGINFO, the provisions are copied from the PKGBUILD without quotes. So
the provision version was actually handled as a different provision...
See FS#9171.
Dan: Unfortunately we have to change our original specification for
versioned provisions with this patch, but it ends up being the simpler and
cleaner solution in the long run, and if there is any time to change it the
time is now before many packages have been built. Keeping the ' ' based
format would have required us to do special parsing in repo-add, as well as
being susceptible to users not using quotes in their provides array.
Hopefully this will resolve the issues we had with our initial plan. Sorry
for the confusion.
Acked-by: Nagy Gabor <ngaba@bibl.u-szeged.hu>
Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
Fix for FS#9176.
A previous commit (6e8daa553b) already forced all database files to 644.
Now the directories are also forced to 755.
Additionally, repo-add now sets the umask to 022, just like makepkg does, to
fix the problem at its root.
Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
For example, if the cachedir is a broken symlink or a non writable
directory, pacman fallbacks to /tmp/. Just before doing that, it freed the
handle->cachedirs list twice !
once in _alpm_filecache_setup, and once in alpm_option_set_cachedirs. So the
first one was removed.
Fixes FS#9186.
Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
Packages put in the sync->data field were always duplicated with pkg_dup,
and then freed, This is not needed.
Killing this duplication of packages made the memory usage during base
reinstall go from 10.4 MB to 8.1 MB.
Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
In the old code 'alpm_list_diff(_alpm_db_get_pkgcache(db), dblist,
_alpm_pkg_cmp);' was slow.
Signed-off-by: Nagy Gabor <ngaba@bibl.u-szeged.hu>
[Xav: In my opinion, computing both dblist and modified in one for loop also makes
the code clearer, besides being more efficient.
Also renamed joined to targets since I also find that clearer.]
Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
We didn't have a free function before, causing some memory leaks. We also
need a dup function now that strings are not in the structure but are
dynamically allocated.
Also adapt pmdepmissing_t to use a pointer to a depend struct instead of an
inclusive one so we can use the functions we created here.
Signed-off-by: Dan McGee <dan@archlinux.org>
Moves "checking dependencies..." notification into code block where
dependency checking is performed to stop spurious notification.
Reference: http://archlinux.org/pipermail/pacman-dev/2008-January/010714.html
Signed-off-by: Allan McRae <mcrae_allan@hotmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
Two functions defined in alpm.h were not marked with SYMEXPORT, causing
linking errors if they were used.
In addition, remove the incorrect use of the 'alpm_' prefix from an internal
function and replace it with '_alpm_'.
Fixes FS#9155.
Signed-off-by: Dan McGee <dan@archlinux.org>
This also affects all structures with static strings, such as depmiss,
conflict, etc. This should help a lot with memory usage, and hopefully make
things a bit more "idiot proof".
Currently our pactest pass/fail rate is identical before and after this
patch. This is not to say it is a perfect patch- I have yet to pull valgrind
out. However, this should be quite safe to use in all situations from here
on out, and we can start plugging the memleaks.
Original-work-by: Aaron Griffin <aaronmgriffin@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
This reverts commit e28973169d.
This code might fit better in the frontend than in the backend finally.
Ref: http://www.archlinux.org/pipermail/pacman-dev/2007-November/010150.html
I also changed it for fixing FS#8763 :
if there is exactly one provider, pacman will pull it and print a warning.
if there are several providers, pacman will list them and fail. It's up to
the user to pick one. Add sync501 pactest to reflect that.
It wasn't even implemented correctly, and it really doesn't have a use if
packagers just do their job correctly anyway for a distro. Let's not try to
solve a problem with the wrong solution now.
Signed-off-by: Dan McGee <dan@archlinux.org>
We had an unused date element in the pmpkg_t struct (not builddate or
installdate). Kill it off and fix the one function that was using it.
Signed-off-by: Dan McGee <dan@archlinux.org>
The previous fileconflict check (package vs filesystem) skipped the conflict
when the file on the filesystem was a directory or a symlink to a directory,
no matter what the file in the package was.
Now, the conflict will only be skipped if the file in the package is a
directory (so compatible with a dir or a dir symlink on the filesystem).
So in the case of 8156 (new fileconflict003 pactest for this case), instead
of silently ignoring the extraction of the test symlink, pacman will now
fail because of a file conflict between the test symlink in the pkg2 package
and the test directory on the filesystem.
Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
By attempting to stat the cachedir when we load the pacman config, pacman
bails out if it is a non-existant directory, even if it will never be
needed. This is unfortunate as it is only used for sync transactions anyway.
Instead, wait until we need it in _alpm_filecache_setup to actually do
anything.
Reported as FS#9096.
Signed-off-by: Dan McGee <dan@archlinux.org>
Originally noticed in FS#9024, but was fixed in previous changes anyway.
However, it doesn't hurt to still check it.
Also add a pactest from Chantry Xavier for the original problem to ensure
we can't reproduce it.
Signed-off-by: Dan McGee <dan@archlinux.org>
Thanks to the proactive backup handling, we don't need to add the moving
file to the skip_add list.
The backup handling will make sure nothing gets overwritten.
Ref: http://www.archlinux.org/pipermail/pacman-dev/2007-December/010610.html
Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
This was the case of the bash packaging error where a file was removed from
the package but not the backup array.
I just added a sanity check so that only the files from the backup array
that are also in the filelist are used.
I had to edit upgrade026 pactest slightly : it required the file to be
copied to .pacsave instead of moved. But just moving it should be enough, as
we agreed on the ML :
http://www.archlinux.org/pipermail/pacman-dev/2007-December/010440.html
Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
These used FUNCTION output level and not DEBUG, so I didn't catch them way
back when I removed those gettext calls. Remove them now (which exposed a
nice little memory access error elsewhere in the code). This should have a
slight speedup effect on the code too as we no longer have to make the
gettext call even when these messages aren't printed.
Signed-off-by: Dan McGee <dan@archlinux.org>
Ugh, it was a pain to figure out why the Total Removed Size was showing up
wrong in the output of removed packages, but this was why- we used a stupid
_alpm_pkg_new call instead of just duping the package. Fix this. In the long
run, we really need to figure out better ways to not duplicate all this
package information.
Signed-off-by: Dan McGee <dan@archlinux.org>
This adds a pactest for the relocation of a config file between two packages
(case of etc/profile moving from bash to filesystem).
While running this pactest, I found out that chk_filedifference didn't work
correctly with an empty list as second argument. So that's fixed now.
Ref: http://www.archlinux.org/pipermail/pacman-dev/2007-December/010610.html
Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
This is something pacman can do on its own straight from the archive, and we
will reduce the chance of problems occurring becuase of inproper FILELIST
generation as we have had in the past with special characters in filenames.
Once we remove it from makepkg. we can remove any usage of it from all of
our other tools, including pacman, pactest, and contrib/ utilities.
Note that removing it from pacman uncovered a few other bugs anyway, so this
was probably a good move.
Signed-off-by: Dan McGee <dan@archlinux.org>
This is the bash case when the /etc/profile file was removed by error from
the package, but stayed in the backup array.
Ref:
http://www.archlinux.org/pipermail/arch-dev-public/2007-December/003556.html
Also fixed a little typo in add.c, but it's disabled code.
Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
As I mentioned earlier on the ML :
http://www.archlinux.org/pipermail/pacman-dev/2007-December/010416.html
the first part of commit 843d368ef6 had no effect because of a bug.
So I fixed the bug, but since this would change backup handling behavior,
and possibly require other bigger changes to work right, I decided to just
disable that part temporarily, and left a TODO in the code.
Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
Fixes FS#7380: alpm crashes on passing NULL to alpm_trans_commit in
a sync operation. Adds check that data parameter is not NULL in
several functions.
Signed-off-by: Allan McRae <mcrae_allan@hotmail.com>
[Dan: fix whitespace]
Signed-off-by: Dan McGee <dan@archlinux.org>
This will allow someone to install a group but ignore individual
packages inside the group.
Signed-off-by: Nathan Jones <nathanj@insightbb.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
It is possible for the if statement to never succeed, causing path to
never be freed. It is also possible for the if statement to succeed more
than once per loop, which could have caused a segfault.
Signed-off-by: Nathan Jones <nathanj@insightbb.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
It's probably far from perfect, but at least I tried to translate
everything.
I noticed a missing newline at libalpm/trans.c , line 573 :
_alpm_log(PM_LOG_ERROR, _("call to popen failed (%s)"),
I don't think it's possible to fix it now (string freeze?), so I didn't.
Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
You can use foo<2.0 and foo>2.0 as depend
add046.py and add047.py pactests were added to check this
Signed-off-by: Nagy Gabor <ngaba@bibl.u-szeged.hu>
Signed-off-by: Dan McGee <dan@archlinux.org>
* Updated libalpm translation
* Regenerated hu.po files, because the 'call-for-translators version' was outdated
Signed-off-by: Nagy Gabor <ngaba@bibl.u-szeged.hu>
Signed-off-by: Dan McGee <dan@archlinux.org>
If /tmp was full during the early stages of package extraction, we were
unable to extract the package description file with the call to
archive_read_data_into_fd(archive, fd) becuase we never checked the return
code. Add a check to ensure the extraction was successful and print and
return an error if it was not instead of falling through to a possibly
untrue error message.
This should fix FS #8885.
Signed-off-by: Dan McGee <dan@archlinux.org>
I appears that when chrooted, the /bin/sh used by popen is that of the parent
process. This is true until the process forks once chrooted, which we do not
want to do.
As such, this actually makes things nicer. We don't need a /bin/sh in a chroot
to run install scriptlets, and don't need to check for it in the root directory
Signed-off-by: Aaron Griffin <aaronmgriffin@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
The new pattern is as follows:
. /path/to/scriptlet
post_upgrade X Y
This requires less frameworking in the install scripts (the three lines that
shift and eval a function are nasty)
Signed-off-by: Aaron Griffin <aaronmgriffin@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
Update the GPL boilerplate to direct people to the GNU website for a copy of
the license, as well as bump all of Judd's copyrights to 2007.
Signed-off-by: Dan McGee <dan@archlinux.org>
Thanks to Allan for inspiring all this work on what was one little TODO item
in the codebase. :)
Change changelog handling so we can now dump a changelog from both installed
packages and package files (fixes FS#7371). We do this by moving all of the
machinery to the backend where it should have been in the first place.
The changelog reading is now done through a open/read/close interface
similar to the fopen/fread/fclose functions (can you guess how it is done?).
It is buffered by the frontend, so programs using the library can read as
much or as little as they want at a time.
Unfortunately, I could not implement a changelog_feof function due to some
shortcomings of libarchive. However, I left the stub code in there,
commented out, in case it becomes possible later or anyone wants to take a
stab at it.
Original-work-by: Allan McRae <mcrae_allan@hotmail.com>
Improved-by: Chantry Xavier <shiningxc@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
If _alpm_unpack has a specific file to extract (not NULL), but doesn't find
it, it'll now return 1, for indicating the failure.
Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
The alpm_list_free(complete) needs to be done OUTSIDE the loop walking
through the server list.
Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
Now alpm_checkdeps first search for literals, then search for no-literal satisfiers
Signed-off-by: Nagy Gabor <ngaba@bibl.u-szeged.hu>
[Dan: fix spelling of INTALL, fix line wrapping]
Signed-off-by: Dan McGee <dan@archlinux.org>
Update all of the pot and po files with the latest messages available.
Translators- you are encouraged to do this as well every time you update the
translation, and the directions in 'translation-help' should help. Also feel
free to delete all the old translations that end up at the bottom of these
files and only clutter things up.
Signed-off-by: Dan McGee <dan@archlinux.org>
alpm_list_find and alpm_list_find_ptr will now return a void *, and
alpm_list_find_str will return a char *, instead of an int.
Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
I started playing around with gcov today and it showed a few places in the
code that we don't test at all. This is the start of ensuring that we
execute most of the code in our codebase.
Signed-off-by: Dan McGee <dan@archlinux.org>
During a pacman operation such as a group install, pacman can ask several
questions such as "local version is up to date. Upgrade anyway?". They are
usually all answered either by yes or by no:
* yes when you want to reinstall all the targets.
* no when you only want to install the missing ones (either because you are
installing a group, or because you are copying a pacman -S line from wiki or
whatever).
So instead of asking this question for each target, it is now now configured
with a flag. Yes will be the default -S behavior, No will be achieved with
the --needed flag.
Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
* memleak found by Nagy in checkdeps
* an useless line found by Nagy in resolvedeps
* data wasn't set to the missing dependencies in sync_prepare
* use the MALLOC macro in resolvedeps
Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
alpm_depcmp is simple enough that we shouldn't need constant debug logging,
and the logging we do have in there negatively impacts our speed regardless
of whether we actually are seeing it or not. If it ever needs debugging, it
would be trivial to reimplement it by just temporarily reverting this
commit.
Signed-off-by: Dan McGee <dan@archlinux.org>
Hopefully these are unnecessary, as they were probably added originally to
cover up a problem instead of finding the root cause. I'd rather fail hard
in these cases anyway.
Signed-off-by: Dan McGee <dan@archlinux.org>
_alpm_innerconflicts: check for target<->target conflicts
_alpm_outerconflicts: check for target<->localpkg conflicts
This will be useful in sync.c clean-up and in testdb.c
As an application the patch also fixes a misleading message (and a memleak)
in add.c
Signed-off-by: Nagy Gabor <ngaba@bibl.u-szeged.hu>
Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
checkdeps and resolvedeps now take both a remove list and an install list as
arguments, allowing dependencies to be calculated correctly.
This broke the sync990 pactest, but this pactest used dependencies and
provides in an unusual way, so it has been changed.
Dan: the sync990 pactest was just plain wrong. It didn't satisfy the
dependencies correctly, so should never have succeeded.
Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
[Dan: some variable renaming, clarification in commit message]
Signed-off-by: Dan McGee <dan@archlinux.org>
In the case of a packaging error where install or changelog had bad permissions,
pacman respected the original permissions without trying to fix it - this means
that some operations (changelog) artificially required root permissions to run
In addition, minor function housekeeping on _alpm_unpack
Signed-off-by: Aaron Griffin <aaronmgriffin@gmail.com>
This closes out FS#6500 and covers cases where the package names contain regex
characters (i.e. the case of dvd+rw-tools)
Signed-off-by: Aaron Griffin <aaronmgriffin@gmail.com>
* The frontend calls alpm_trans_prepare(&data), and in case of errors,
receive the missing dependencies / conflicts / etc in the data pointer.
It apparently needs to free this structure totally with :
alpm_list_free_inner(data, free)
alpm_list_free(data)
So I added alpm_list_free_inner(data, free) in
pacman/{sync.c,remove.c,add,c}
* in _alpm_sync_prepare, the deps and asked lists were not freed in case
of errors (unresolvable conflicts).
Besides the code for handling this case was duplicated.
* in _alpm_remove_commit, free was used instead of alpm_list_free for
newfiles.
* newline fix in pacman/sync.c
Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
An alpm_list_free call was missing.
Also make use of alpm_list_free_inner in both _alpm_sync_free and
_alpm_trans_free.
Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
This operation made sense in the days before sync DBs existed, but it no
longer has the same usefulness it once did.
Signed-off-by: Dan McGee <dan@archlinux.org>
Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
Signed-off-by: Nagy Gabor <ngaba@bibl.u-szeged.hu>
Signed-off-by: Aaron Griffin <aaronmgriffin@gmail.com>
From now on libalpm informs user about packages which will be
installed/removed in wrong order.
Signed-off-by: Nagy Gabor <ngaba@bibl.u-szeged.hu>
Signed-off-by: Dan McGee <dan@archlinux.org>
The alpm_get_upgrades was exactly the same as find_replacements +
_alpm_sync_sysupgrade, except that it automatically made the eventual
replacements, without asking the user : Replace %s with %s/%s? [Y/n]
The replace question, asked in find_replacements. can now be skipped by
using a NULL trans argument, so that we get the same behavior as with
alpm_get_upgrades.
So alpm_db_get_upgrades() can now be replaced by
alpm_sync_sysupgrade(db_local, syncdbs).
Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
This patch introduces versioned provisions in "provision 1.0-1" format.
_alpm_db_whatprovides was modified accordingly (added sync500.py),
alpm_depcmp was modified accordingly (add043.py passes now; added add044.py
and add045.py).
Notes:
alpm_db_search now uses the whole versioned %PROVIDES% string in its search.
debug logging was simplified in alpm_depcmp.
Signed-off-by: Nagy Gabor <ngaba@bibl.u-szeged.hu>
[Xavier: fixed a few typos, duplicate const strings with strdup before
modifying them, put some debugging back in alpm_depcmp, minor code cleanups
(var/function renaming), added a note in PKGBUILD man page.]
Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
[Dan: made strcmp checks clearer, added a comment]
Signed-off-by: Dan McGee <dan@archlinux.org>
dash doesn't pass positional parameters to sourced scripts, causing install
scripts to fail. Instead of sourcing the script, make it executable and
call it directly which allows positional parameters to be passed correctly.
Signed-off-by: Dan McGee <dan@archlinux.org>
pmdepmissing_t was used for two totally different things :
missing dependencies, and dependency conflicts.
So this patch simply adds a type for dep conflicts,
and convert the code to use it.
This fix the TODO in conflict.c :
/* TODO WTF is a 'depmissing' doing indicating a conflict? */
Additionally, the code in conflict.c now eliminates the duplicated conflicts.
If pkg1 conflicts with pkg2, and pkg2 conflicts with pkg1, only one of them will be stored.
However the conflict handling in sync_prepare (sync.c) is still very asymetrical, and very ugly too.
This should be improved in the future (there is already a pending patch from Nagy that cleans it a lot).
Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
The names related to conflicts are misleading :
For dependencies conflicts, the type is pmdepmissing,
and the function names contain just "conflict".
For file conflicts, the type is pmconflict,
and some functions contained just "conflict", some others "fileconflict".
So this is the first step for improving the situation.
Original idea/patch from Nagy, but the patch already didn't apply anymore,
so I did it again.
The main difference is that I kept the conflictype, with the following renaming :
pmconflicttype_t -> pmfileconflicttype_t
PM_CONFLICT_TYPE_TARGET -> PM_FILECONFLICT_TARGET
PM_CONFLICT_TYPE_FILE -> PM_FILECONFLICT_FILESYSTEM
Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
resolvedeps will now search for other satisfiers
when we don't let it add a package from IgnorePkg.
Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
And check the IgnorePkg handling is done correctly in the other places.
For example, -Qu and -Su will automatically skip the ignored packages (-Su will print a warning),
but -S will install ignored packages anyway, because it was asked explicitly.
Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
This file only contained one private function : _alpm_db_whatprovides .
And the public alpm_db_whatprovides was in db.c , so I moved everything there.
Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
[Dan: updated POTFILES.in as well]
Signed-off-by: Dan McGee <dan@archlinux.org>
The old alpm_list_find was renamed to alpm_list_find_ptr, and a new
alpm_list_find was introduced, which uses the fn comparison-function
parameter in its decision.
Now both alpm_list_find_ptr (a new ptrcmp helper function was also
added) and alpm_list_find_str are just an alpm_list_find call.
Signed-off-by: Nagy Gabor <ngaba@bibl.u-szeged.hu>
Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
[Dan: made ptrcmp a static function]
Signed-off-by: Dan McGee <dan@archlinux.org>