2005-03-22 15:21:12 -05:00
|
|
|
/*
|
|
|
|
* conflict.c
|
2007-11-16 21:18:45 -05:00
|
|
|
*
|
2011-01-05 23:45:15 -05:00
|
|
|
* Copyright (c) 2006-2011 Pacman Development Team <pacman-dev@archlinux.org>
|
2009-07-01 03:08:33 -04:00
|
|
|
* Copyright (c) 2002-2006 by Judd Vinet <jvinet@zeroflux.org>
|
2006-10-15 15:31:03 -04:00
|
|
|
* Copyright (c) 2005 by Aurelien Foret <orelien@chez.com>
|
|
|
|
* Copyright (c) 2006 by David Kimpe <dnaku@frugalware.org>
|
|
|
|
* Copyright (c) 2006 by Miklos Vajna <vmiklos@frugalware.org>
|
2006-10-15 20:05:10 -04:00
|
|
|
* Copyright (c) 2006 by Christian Hamar <krics@linuxforum.hu>
|
2007-11-16 21:18:45 -05:00
|
|
|
*
|
2005-03-22 15:21:12 -05:00
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
2007-12-10 23:55:22 -05:00
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
2005-03-22 15:21:12 -05:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include "config.h"
|
2007-03-05 17:13:33 -05:00
|
|
|
|
2005-03-22 15:21:12 -05:00
|
|
|
#include <stdlib.h>
|
2006-11-22 04:03:41 -05:00
|
|
|
#include <stdio.h>
|
2005-03-22 15:21:12 -05:00
|
|
|
#include <string.h>
|
2006-03-02 14:04:40 -05:00
|
|
|
#include <limits.h>
|
2005-03-22 15:21:12 -05:00
|
|
|
#include <sys/stat.h>
|
2009-07-17 09:48:57 -04:00
|
|
|
#include <dirent.h>
|
2007-03-05 17:13:33 -05:00
|
|
|
|
|
|
|
/* libalpm */
|
|
|
|
#include "conflict.h"
|
2007-01-19 04:28:44 -05:00
|
|
|
#include "alpm_list.h"
|
2011-06-16 14:16:49 -04:00
|
|
|
#include "alpm.h"
|
2007-03-05 17:13:33 -05:00
|
|
|
#include "handle.h"
|
2006-11-20 04:10:23 -05:00
|
|
|
#include "trans.h"
|
2005-03-22 15:21:12 -05:00
|
|
|
#include "util.h"
|
2006-01-15 10:55:16 -05:00
|
|
|
#include "log.h"
|
|
|
|
#include "deps.h"
|
2005-03-22 15:21:12 -05:00
|
|
|
|
2011-08-09 00:25:45 -04:00
|
|
|
static alpm_conflict_t *conflict_new(alpm_pkg_t *pkg1, alpm_pkg_t *pkg2,
|
2011-08-09 02:00:16 -04:00
|
|
|
alpm_depend_t *reason)
|
2007-11-18 08:25:43 -05:00
|
|
|
{
|
2011-06-28 00:33:55 -04:00
|
|
|
alpm_conflict_t *conflict;
|
2007-11-18 08:25:43 -05:00
|
|
|
|
2011-06-28 00:33:55 -04:00
|
|
|
MALLOC(conflict, sizeof(alpm_conflict_t), return NULL);
|
2007-11-18 08:25:43 -05:00
|
|
|
|
2011-08-09 00:25:45 -04:00
|
|
|
conflict->package1_hash = pkg1->name_hash;
|
|
|
|
conflict->package2_hash = pkg2->name_hash;
|
|
|
|
STRDUP(conflict->package1, pkg1->name, return NULL);
|
|
|
|
STRDUP(conflict->package2, pkg2->name, return NULL);
|
2011-08-09 02:00:16 -04:00
|
|
|
conflict->reason = reason;
|
2007-11-18 08:25:43 -05:00
|
|
|
|
2011-03-20 20:45:57 -04:00
|
|
|
return conflict;
|
2007-11-18 08:25:43 -05:00
|
|
|
}
|
|
|
|
|
2011-06-28 00:33:55 -04:00
|
|
|
void _alpm_conflict_free(alpm_conflict_t *conflict)
|
2008-01-11 01:01:58 -05:00
|
|
|
{
|
|
|
|
FREE(conflict->package2);
|
|
|
|
FREE(conflict->package1);
|
|
|
|
FREE(conflict);
|
|
|
|
}
|
|
|
|
|
2011-06-28 00:33:55 -04:00
|
|
|
alpm_conflict_t *_alpm_conflict_dup(const alpm_conflict_t *conflict)
|
2008-01-25 15:31:20 -05:00
|
|
|
{
|
2011-06-28 00:33:55 -04:00
|
|
|
alpm_conflict_t *newconflict;
|
2011-06-28 18:46:04 -04:00
|
|
|
CALLOC(newconflict, 1, sizeof(alpm_conflict_t), return NULL);
|
2008-01-25 15:31:20 -05:00
|
|
|
|
2011-08-09 00:25:45 -04:00
|
|
|
newconflict->package1_hash = conflict->package1_hash;
|
|
|
|
newconflict->package2_hash = conflict->package2_hash;
|
2011-06-07 17:06:16 -04:00
|
|
|
STRDUP(newconflict->package1, conflict->package1, return NULL);
|
|
|
|
STRDUP(newconflict->package2, conflict->package2, return NULL);
|
2011-08-09 02:00:16 -04:00
|
|
|
newconflict->reason = conflict->reason;
|
2008-01-25 15:31:20 -05:00
|
|
|
|
2011-03-20 20:45:57 -04:00
|
|
|
return newconflict;
|
2008-01-25 15:31:20 -05:00
|
|
|
}
|
|
|
|
|
2011-06-28 00:33:55 -04:00
|
|
|
static int conflict_isin(alpm_conflict_t *needle, alpm_list_t *haystack)
|
2007-11-18 08:25:43 -05:00
|
|
|
{
|
|
|
|
alpm_list_t *i;
|
|
|
|
for(i = haystack; i; i = i->next) {
|
2011-06-28 00:33:55 -04:00
|
|
|
alpm_conflict_t *conflict = i->data;
|
2011-08-09 00:25:45 -04:00
|
|
|
if(needle->package1_hash == conflict->package1_hash
|
|
|
|
&& needle->package2_hash == conflict->package2_hash
|
|
|
|
&& strcmp(needle->package1, conflict->package1) == 0
|
|
|
|
&& strcmp(needle->package2, conflict->package2) == 0) {
|
2011-03-20 20:45:57 -04:00
|
|
|
return 1;
|
2007-11-18 08:25:43 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-03-20 20:45:57 -04:00
|
|
|
return 0;
|
2007-11-18 08:25:43 -05:00
|
|
|
}
|
2007-03-03 03:13:59 -05:00
|
|
|
|
2011-06-07 17:13:58 -04:00
|
|
|
/** Adds the pkg1/pkg2 conflict to the baddeps list.
|
|
|
|
* @param handle the context handle
|
|
|
|
* @param baddeps list to add conflict to
|
2007-07-19 19:22:45 -04:00
|
|
|
* @param pkg1 first package
|
|
|
|
* @param pkg2 package causing conflict
|
2011-06-07 17:13:58 -04:00
|
|
|
* @param reason reason for this conflict
|
2007-07-19 19:22:45 -04:00
|
|
|
*/
|
2011-06-28 00:04:00 -04:00
|
|
|
static int add_conflict(alpm_handle_t *handle, alpm_list_t **baddeps,
|
2011-08-09 02:00:16 -04:00
|
|
|
alpm_pkg_t *pkg1, alpm_pkg_t *pkg2, alpm_depend_t *reason)
|
2007-03-03 03:13:59 -05:00
|
|
|
{
|
2011-06-28 00:33:55 -04:00
|
|
|
alpm_conflict_t *conflict = conflict_new(pkg1, pkg2, reason);
|
2011-06-07 17:06:16 -04:00
|
|
|
if(!conflict) {
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
if(!conflict_isin(conflict, *baddeps)) {
|
2011-08-09 02:00:16 -04:00
|
|
|
char *conflict_str = alpm_dep_compute_string(reason);
|
2007-11-18 08:25:43 -05:00
|
|
|
*baddeps = alpm_list_add(*baddeps, conflict);
|
2011-08-09 02:00:16 -04:00
|
|
|
_alpm_log(handle, ALPM_LOG_DEBUG, "package %s conflicts with %s (by %s)\n",
|
|
|
|
pkg1->name, pkg2->name, conflict_str);
|
|
|
|
free(conflict_str);
|
2007-07-19 19:22:45 -04:00
|
|
|
} else {
|
2008-01-11 01:01:58 -05:00
|
|
|
_alpm_conflict_free(conflict);
|
2007-03-03 03:13:59 -05:00
|
|
|
}
|
2011-06-07 17:06:16 -04:00
|
|
|
return 0;
|
2007-03-03 03:13:59 -05:00
|
|
|
}
|
|
|
|
|
2007-07-19 19:22:45 -04:00
|
|
|
/** Check if packages from list1 conflict with packages from list2.
|
|
|
|
* This looks at the conflicts fields of all packages from list1, and sees
|
|
|
|
* if they match packages from list2.
|
|
|
|
* If a conflict (pkg1, pkg2) is found, it is added to the baddeps list
|
|
|
|
* in this order if order >= 0, or reverse order (pkg2,pkg1) otherwise.
|
|
|
|
*
|
2011-06-07 17:13:58 -04:00
|
|
|
* @param handle the context handle
|
2007-07-19 19:22:45 -04:00
|
|
|
* @param list1 first list of packages
|
|
|
|
* @param list2 second list of packages
|
2011-06-07 17:13:58 -04:00
|
|
|
* @param baddeps list to store conflicts
|
2007-07-19 19:22:45 -04:00
|
|
|
* @param order if >= 0 the conflict order is preserved, if < 0 it's reversed
|
|
|
|
*/
|
2011-06-28 00:04:00 -04:00
|
|
|
static void check_conflict(alpm_handle_t *handle,
|
2011-06-07 17:13:58 -04:00
|
|
|
alpm_list_t *list1, alpm_list_t *list2,
|
2007-07-19 19:22:45 -04:00
|
|
|
alpm_list_t **baddeps, int order) {
|
2011-06-07 17:13:58 -04:00
|
|
|
alpm_list_t *i;
|
2007-03-03 03:13:59 -05:00
|
|
|
|
2007-07-19 19:22:45 -04:00
|
|
|
if(!baddeps) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
for(i = list1; i; i = i->next) {
|
2011-06-28 09:26:39 -04:00
|
|
|
alpm_pkg_t *pkg1 = i->data;
|
2011-06-07 17:13:58 -04:00
|
|
|
alpm_list_t *j;
|
2007-03-03 03:13:59 -05:00
|
|
|
|
2007-07-19 19:22:45 -04:00
|
|
|
for(j = alpm_pkg_get_conflicts(pkg1); j; j = j->next) {
|
2011-08-09 02:00:16 -04:00
|
|
|
alpm_depend_t *conflict = j->data;
|
2011-06-07 17:13:58 -04:00
|
|
|
alpm_list_t *k;
|
2007-03-03 03:13:59 -05:00
|
|
|
|
2007-07-19 19:22:45 -04:00
|
|
|
for(k = list2; k; k = k->next) {
|
2011-06-28 09:26:39 -04:00
|
|
|
alpm_pkg_t *pkg2 = k->data;
|
2007-07-19 19:22:45 -04:00
|
|
|
|
2011-08-09 00:25:45 -04:00
|
|
|
if(pkg1->name_hash == pkg2->name_hash
|
|
|
|
&& strcmp(pkg1->name, pkg2->name) == 0) {
|
2007-07-19 19:22:45 -04:00
|
|
|
/* skip the package we're currently processing */
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
2011-08-09 02:00:16 -04:00
|
|
|
if(_alpm_depcmp(pkg2, conflict)) {
|
2007-07-19 19:22:45 -04:00
|
|
|
if(order >= 0) {
|
2011-08-09 00:25:45 -04:00
|
|
|
add_conflict(handle, baddeps, pkg1, pkg2, conflict);
|
2007-07-19 19:22:45 -04:00
|
|
|
} else {
|
2011-08-09 00:25:45 -04:00
|
|
|
add_conflict(handle, baddeps, pkg2, pkg1, conflict);
|
2007-07-19 19:22:45 -04:00
|
|
|
}
|
|
|
|
}
|
2006-02-21 18:55:59 -05:00
|
|
|
}
|
2007-03-03 03:13:59 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2007-11-20 03:57:38 -05:00
|
|
|
/* Check for inter-conflicts */
|
2011-06-28 00:04:00 -04:00
|
|
|
alpm_list_t *_alpm_innerconflicts(alpm_handle_t *handle, alpm_list_t *packages)
|
2007-11-20 03:57:38 -05:00
|
|
|
{
|
|
|
|
alpm_list_t *baddeps = NULL;
|
|
|
|
|
2011-07-01 12:01:38 -04:00
|
|
|
_alpm_log(handle, ALPM_LOG_DEBUG, "check targets vs targets\n");
|
2011-06-07 17:13:58 -04:00
|
|
|
check_conflict(handle, packages, packages, &baddeps, 0);
|
2007-11-20 03:57:38 -05:00
|
|
|
|
2011-03-20 20:45:57 -04:00
|
|
|
return baddeps;
|
2007-11-20 03:57:38 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Check for target vs (db - target) conflicts
|
|
|
|
* In case of conflict the package1 field of pmdepconflict_t contains
|
|
|
|
* the target package, package2 field contains the local package
|
|
|
|
*/
|
2011-06-28 00:11:43 -04:00
|
|
|
alpm_list_t *_alpm_outerconflicts(alpm_db_t *db, alpm_list_t *packages)
|
2007-03-03 03:13:59 -05:00
|
|
|
{
|
2007-07-19 19:22:45 -04:00
|
|
|
alpm_list_t *baddeps = NULL;
|
2007-03-03 03:13:59 -05:00
|
|
|
|
|
|
|
if(db == NULL) {
|
2011-03-20 20:45:57 -04:00
|
|
|
return NULL;
|
2007-03-03 03:13:59 -05:00
|
|
|
}
|
|
|
|
|
2011-02-25 09:22:09 -05:00
|
|
|
alpm_list_t *dblist = alpm_list_diff(_alpm_db_get_pkgcache(db),
|
2011-01-24 20:49:34 -05:00
|
|
|
packages, _alpm_pkg_cmp);
|
2007-03-03 03:13:59 -05:00
|
|
|
|
2007-11-20 03:57:38 -05:00
|
|
|
/* two checks to be done here for conflicts */
|
2011-07-01 12:01:38 -04:00
|
|
|
_alpm_log(db->handle, ALPM_LOG_DEBUG, "check targets vs db\n");
|
2011-06-07 17:13:58 -04:00
|
|
|
check_conflict(db->handle, packages, dblist, &baddeps, 1);
|
2011-07-01 12:01:38 -04:00
|
|
|
_alpm_log(db->handle, ALPM_LOG_DEBUG, "check db vs targets\n");
|
2011-06-07 17:13:58 -04:00
|
|
|
check_conflict(db->handle, dblist, packages, &baddeps, -1);
|
2006-01-15 10:55:16 -05:00
|
|
|
|
2007-08-04 11:11:03 -04:00
|
|
|
alpm_list_free(dblist);
|
2011-03-20 20:45:57 -04:00
|
|
|
return baddeps;
|
2006-01-15 10:55:16 -05:00
|
|
|
}
|
|
|
|
|
2007-12-09 08:49:34 -05:00
|
|
|
/** Check the package conflicts in a database
|
|
|
|
*
|
2011-06-07 14:53:53 -04:00
|
|
|
* @param handle the context handle
|
2008-08-17 13:30:36 -04:00
|
|
|
* @param pkglist the list of packages to check
|
2011-06-28 00:33:55 -04:00
|
|
|
* @return an alpm_list_t of alpm_conflict_t
|
2007-12-09 08:49:34 -05:00
|
|
|
*/
|
2011-06-28 00:04:00 -04:00
|
|
|
alpm_list_t SYMEXPORT *alpm_checkconflicts(alpm_handle_t *handle,
|
2011-06-07 17:13:58 -04:00
|
|
|
alpm_list_t *pkglist)
|
|
|
|
{
|
2011-06-14 11:01:08 -04:00
|
|
|
CHECK_HANDLE(handle, return NULL);
|
2011-06-07 14:53:53 -04:00
|
|
|
return _alpm_innerconflicts(handle, pkglist);
|
2007-11-20 03:57:38 -05:00
|
|
|
}
|
|
|
|
|
2011-03-30 21:20:16 -04:00
|
|
|
static const int DIFFERENCE = 0;
|
|
|
|
static const int INTERSECT = 1;
|
|
|
|
/* Returns a set operation on the provided two lists of files.
|
|
|
|
* Pre-condition: both lists are sorted!
|
2011-06-16 14:16:49 -04:00
|
|
|
* When done, free the list but NOT the contained data.
|
2011-03-30 21:20:16 -04:00
|
|
|
*
|
|
|
|
* Operations:
|
|
|
|
* DIFFERENCE - a difference operation is performed. filesA - filesB.
|
|
|
|
* INTERSECT - an intersection operation is performed. filesA & filesB.
|
2007-01-18 11:52:57 -05:00
|
|
|
*/
|
Convert package filelists to an array instead of linked list
This accomplishes quite a few things with one rather invasive change.
1. Iteration is much more performant, due to a reduction in pointer
chasing and linear item access.
2. Data structures are smaller- we no longer have the overhead of the
linked list as the file struts are now laid out consecutively in
memory.
3. Memory allocation has been massively reworked. Before, we would
allocate three different pieces of memory per file item- the list
struct, the file struct, and the copied filename. What this resulted
in was massive fragmentation of memory when loading filelists since
the memory allocator had to leave holes all over the place. The new
situation here now removes the need for any list item allocation;
allocates the file structs in contiguous memory (and reallocs as
necessary), leaving only the strings as individually allocated. Tests
using valgrind (massif) show some pretty significant memory
reductions on the worst case `pacman -Ql > /dev/null` (366387 files
on my machine):
Before:
Peak heap: 54,416,024 B
Useful heap: 36,840,692 B
Extra heap: 17,575,332 B
After:
Peak heap: 38,004,352 B
Useful heap: 28,101,347 B
Extra heap: 9,903,005 B
Several small helper methods have been introduced, including a list to
array conversion helper as well as a filelist merge sort that works
directly on arrays.
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-07-19 05:47:29 -04:00
|
|
|
static alpm_list_t *filelist_operation(alpm_filelist_t *filesA,
|
|
|
|
alpm_filelist_t *filesB, int operation)
|
2007-02-13 03:15:38 -05:00
|
|
|
{
|
|
|
|
alpm_list_t *ret = NULL;
|
Convert package filelists to an array instead of linked list
This accomplishes quite a few things with one rather invasive change.
1. Iteration is much more performant, due to a reduction in pointer
chasing and linear item access.
2. Data structures are smaller- we no longer have the overhead of the
linked list as the file struts are now laid out consecutively in
memory.
3. Memory allocation has been massively reworked. Before, we would
allocate three different pieces of memory per file item- the list
struct, the file struct, and the copied filename. What this resulted
in was massive fragmentation of memory when loading filelists since
the memory allocator had to leave holes all over the place. The new
situation here now removes the need for any list item allocation;
allocates the file structs in contiguous memory (and reallocs as
necessary), leaving only the strings as individually allocated. Tests
using valgrind (massif) show some pretty significant memory
reductions on the worst case `pacman -Ql > /dev/null` (366387 files
on my machine):
Before:
Peak heap: 54,416,024 B
Useful heap: 36,840,692 B
Extra heap: 17,575,332 B
After:
Peak heap: 38,004,352 B
Useful heap: 28,101,347 B
Extra heap: 9,903,005 B
Several small helper methods have been introduced, including a list to
array conversion helper as well as a filelist merge sort that works
directly on arrays.
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-07-19 05:47:29 -04:00
|
|
|
size_t ctrA = 0, ctrB = 0;
|
2007-02-13 03:15:38 -05:00
|
|
|
|
Convert package filelists to an array instead of linked list
This accomplishes quite a few things with one rather invasive change.
1. Iteration is much more performant, due to a reduction in pointer
chasing and linear item access.
2. Data structures are smaller- we no longer have the overhead of the
linked list as the file struts are now laid out consecutively in
memory.
3. Memory allocation has been massively reworked. Before, we would
allocate three different pieces of memory per file item- the list
struct, the file struct, and the copied filename. What this resulted
in was massive fragmentation of memory when loading filelists since
the memory allocator had to leave holes all over the place. The new
situation here now removes the need for any list item allocation;
allocates the file structs in contiguous memory (and reallocs as
necessary), leaving only the strings as individually allocated. Tests
using valgrind (massif) show some pretty significant memory
reductions on the worst case `pacman -Ql > /dev/null` (366387 files
on my machine):
Before:
Peak heap: 54,416,024 B
Useful heap: 36,840,692 B
Extra heap: 17,575,332 B
After:
Peak heap: 38,004,352 B
Useful heap: 28,101,347 B
Extra heap: 9,903,005 B
Several small helper methods have been introduced, including a list to
array conversion helper as well as a filelist merge sort that works
directly on arrays.
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-07-19 05:47:29 -04:00
|
|
|
while(ctrA < filesA->count && ctrB < filesB->count) {
|
|
|
|
alpm_file_t *fileA = filesA->files + ctrA;
|
|
|
|
alpm_file_t *fileB = filesB->files + ctrB;
|
2011-06-16 14:16:49 -04:00
|
|
|
const char *strA = fileA->name;
|
|
|
|
const char *strB = fileB->name;
|
2011-03-30 21:20:16 -04:00
|
|
|
/* skip directories, we don't care about them */
|
2007-02-13 03:15:38 -05:00
|
|
|
if(strA[strlen(strA)-1] == '/') {
|
Convert package filelists to an array instead of linked list
This accomplishes quite a few things with one rather invasive change.
1. Iteration is much more performant, due to a reduction in pointer
chasing and linear item access.
2. Data structures are smaller- we no longer have the overhead of the
linked list as the file struts are now laid out consecutively in
memory.
3. Memory allocation has been massively reworked. Before, we would
allocate three different pieces of memory per file item- the list
struct, the file struct, and the copied filename. What this resulted
in was massive fragmentation of memory when loading filelists since
the memory allocator had to leave holes all over the place. The new
situation here now removes the need for any list item allocation;
allocates the file structs in contiguous memory (and reallocs as
necessary), leaving only the strings as individually allocated. Tests
using valgrind (massif) show some pretty significant memory
reductions on the worst case `pacman -Ql > /dev/null` (366387 files
on my machine):
Before:
Peak heap: 54,416,024 B
Useful heap: 36,840,692 B
Extra heap: 17,575,332 B
After:
Peak heap: 38,004,352 B
Useful heap: 28,101,347 B
Extra heap: 9,903,005 B
Several small helper methods have been introduced, including a list to
array conversion helper as well as a filelist merge sort that works
directly on arrays.
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-07-19 05:47:29 -04:00
|
|
|
ctrA++;
|
2007-02-13 03:15:38 -05:00
|
|
|
} else if(strB[strlen(strB)-1] == '/') {
|
Convert package filelists to an array instead of linked list
This accomplishes quite a few things with one rather invasive change.
1. Iteration is much more performant, due to a reduction in pointer
chasing and linear item access.
2. Data structures are smaller- we no longer have the overhead of the
linked list as the file struts are now laid out consecutively in
memory.
3. Memory allocation has been massively reworked. Before, we would
allocate three different pieces of memory per file item- the list
struct, the file struct, and the copied filename. What this resulted
in was massive fragmentation of memory when loading filelists since
the memory allocator had to leave holes all over the place. The new
situation here now removes the need for any list item allocation;
allocates the file structs in contiguous memory (and reallocs as
necessary), leaving only the strings as individually allocated. Tests
using valgrind (massif) show some pretty significant memory
reductions on the worst case `pacman -Ql > /dev/null` (366387 files
on my machine):
Before:
Peak heap: 54,416,024 B
Useful heap: 36,840,692 B
Extra heap: 17,575,332 B
After:
Peak heap: 38,004,352 B
Useful heap: 28,101,347 B
Extra heap: 9,903,005 B
Several small helper methods have been introduced, including a list to
array conversion helper as well as a filelist merge sort that works
directly on arrays.
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-07-19 05:47:29 -04:00
|
|
|
ctrB++;
|
2007-02-13 03:15:38 -05:00
|
|
|
} else {
|
2007-02-13 21:58:35 -05:00
|
|
|
int cmp = strcmp(strA, strB);
|
|
|
|
if(cmp < 0) {
|
2011-03-30 21:20:16 -04:00
|
|
|
if(operation == DIFFERENCE) {
|
|
|
|
/* item only in filesA, qualifies as a difference */
|
2011-06-16 14:16:49 -04:00
|
|
|
ret = alpm_list_add(ret, fileA);
|
2011-03-30 21:20:16 -04:00
|
|
|
}
|
Convert package filelists to an array instead of linked list
This accomplishes quite a few things with one rather invasive change.
1. Iteration is much more performant, due to a reduction in pointer
chasing and linear item access.
2. Data structures are smaller- we no longer have the overhead of the
linked list as the file struts are now laid out consecutively in
memory.
3. Memory allocation has been massively reworked. Before, we would
allocate three different pieces of memory per file item- the list
struct, the file struct, and the copied filename. What this resulted
in was massive fragmentation of memory when loading filelists since
the memory allocator had to leave holes all over the place. The new
situation here now removes the need for any list item allocation;
allocates the file structs in contiguous memory (and reallocs as
necessary), leaving only the strings as individually allocated. Tests
using valgrind (massif) show some pretty significant memory
reductions on the worst case `pacman -Ql > /dev/null` (366387 files
on my machine):
Before:
Peak heap: 54,416,024 B
Useful heap: 36,840,692 B
Extra heap: 17,575,332 B
After:
Peak heap: 38,004,352 B
Useful heap: 28,101,347 B
Extra heap: 9,903,005 B
Several small helper methods have been introduced, including a list to
array conversion helper as well as a filelist merge sort that works
directly on arrays.
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-07-19 05:47:29 -04:00
|
|
|
ctrA++;
|
2007-02-13 21:58:35 -05:00
|
|
|
} else if(cmp > 0) {
|
Convert package filelists to an array instead of linked list
This accomplishes quite a few things with one rather invasive change.
1. Iteration is much more performant, due to a reduction in pointer
chasing and linear item access.
2. Data structures are smaller- we no longer have the overhead of the
linked list as the file struts are now laid out consecutively in
memory.
3. Memory allocation has been massively reworked. Before, we would
allocate three different pieces of memory per file item- the list
struct, the file struct, and the copied filename. What this resulted
in was massive fragmentation of memory when loading filelists since
the memory allocator had to leave holes all over the place. The new
situation here now removes the need for any list item allocation;
allocates the file structs in contiguous memory (and reallocs as
necessary), leaving only the strings as individually allocated. Tests
using valgrind (massif) show some pretty significant memory
reductions on the worst case `pacman -Ql > /dev/null` (366387 files
on my machine):
Before:
Peak heap: 54,416,024 B
Useful heap: 36,840,692 B
Extra heap: 17,575,332 B
After:
Peak heap: 38,004,352 B
Useful heap: 28,101,347 B
Extra heap: 9,903,005 B
Several small helper methods have been introduced, including a list to
array conversion helper as well as a filelist merge sort that works
directly on arrays.
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-07-19 05:47:29 -04:00
|
|
|
ctrB++;
|
2007-02-13 21:58:35 -05:00
|
|
|
} else {
|
2011-03-30 21:20:16 -04:00
|
|
|
if(operation == INTERSECT) {
|
|
|
|
/* item in both, qualifies as an intersect */
|
2011-06-16 14:16:49 -04:00
|
|
|
ret = alpm_list_add(ret, fileA);
|
2011-03-30 21:20:16 -04:00
|
|
|
}
|
Convert package filelists to an array instead of linked list
This accomplishes quite a few things with one rather invasive change.
1. Iteration is much more performant, due to a reduction in pointer
chasing and linear item access.
2. Data structures are smaller- we no longer have the overhead of the
linked list as the file struts are now laid out consecutively in
memory.
3. Memory allocation has been massively reworked. Before, we would
allocate three different pieces of memory per file item- the list
struct, the file struct, and the copied filename. What this resulted
in was massive fragmentation of memory when loading filelists since
the memory allocator had to leave holes all over the place. The new
situation here now removes the need for any list item allocation;
allocates the file structs in contiguous memory (and reallocs as
necessary), leaving only the strings as individually allocated. Tests
using valgrind (massif) show some pretty significant memory
reductions on the worst case `pacman -Ql > /dev/null` (366387 files
on my machine):
Before:
Peak heap: 54,416,024 B
Useful heap: 36,840,692 B
Extra heap: 17,575,332 B
After:
Peak heap: 38,004,352 B
Useful heap: 28,101,347 B
Extra heap: 9,903,005 B
Several small helper methods have been introduced, including a list to
array conversion helper as well as a filelist merge sort that works
directly on arrays.
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-07-19 05:47:29 -04:00
|
|
|
ctrA++;
|
|
|
|
ctrB++;
|
2007-02-13 21:58:35 -05:00
|
|
|
}
|
2007-02-13 03:15:38 -05:00
|
|
|
}
|
|
|
|
}
|
2007-02-18 22:18:59 -05:00
|
|
|
|
2011-03-30 21:20:16 -04:00
|
|
|
/* if doing a difference, ensure we have completely emptied pA */
|
Convert package filelists to an array instead of linked list
This accomplishes quite a few things with one rather invasive change.
1. Iteration is much more performant, due to a reduction in pointer
chasing and linear item access.
2. Data structures are smaller- we no longer have the overhead of the
linked list as the file struts are now laid out consecutively in
memory.
3. Memory allocation has been massively reworked. Before, we would
allocate three different pieces of memory per file item- the list
struct, the file struct, and the copied filename. What this resulted
in was massive fragmentation of memory when loading filelists since
the memory allocator had to leave holes all over the place. The new
situation here now removes the need for any list item allocation;
allocates the file structs in contiguous memory (and reallocs as
necessary), leaving only the strings as individually allocated. Tests
using valgrind (massif) show some pretty significant memory
reductions on the worst case `pacman -Ql > /dev/null` (366387 files
on my machine):
Before:
Peak heap: 54,416,024 B
Useful heap: 36,840,692 B
Extra heap: 17,575,332 B
After:
Peak heap: 38,004,352 B
Useful heap: 28,101,347 B
Extra heap: 9,903,005 B
Several small helper methods have been introduced, including a list to
array conversion helper as well as a filelist merge sort that works
directly on arrays.
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-07-19 05:47:29 -04:00
|
|
|
while(operation == DIFFERENCE && ctrA < filesA->count) {
|
|
|
|
alpm_file_t *fileA = filesA->files + ctrA;
|
2011-06-16 14:16:49 -04:00
|
|
|
const char *strA = fileA->name;
|
2008-02-11 10:51:34 -05:00
|
|
|
/* skip directories */
|
|
|
|
if(strA[strlen(strA)-1] != '/') {
|
2011-06-16 14:16:49 -04:00
|
|
|
ret = alpm_list_add(ret, fileA);
|
2008-02-11 10:51:34 -05:00
|
|
|
}
|
Convert package filelists to an array instead of linked list
This accomplishes quite a few things with one rather invasive change.
1. Iteration is much more performant, due to a reduction in pointer
chasing and linear item access.
2. Data structures are smaller- we no longer have the overhead of the
linked list as the file struts are now laid out consecutively in
memory.
3. Memory allocation has been massively reworked. Before, we would
allocate three different pieces of memory per file item- the list
struct, the file struct, and the copied filename. What this resulted
in was massive fragmentation of memory when loading filelists since
the memory allocator had to leave holes all over the place. The new
situation here now removes the need for any list item allocation;
allocates the file structs in contiguous memory (and reallocs as
necessary), leaving only the strings as individually allocated. Tests
using valgrind (massif) show some pretty significant memory
reductions on the worst case `pacman -Ql > /dev/null` (366387 files
on my machine):
Before:
Peak heap: 54,416,024 B
Useful heap: 36,840,692 B
Extra heap: 17,575,332 B
After:
Peak heap: 38,004,352 B
Useful heap: 28,101,347 B
Extra heap: 9,903,005 B
Several small helper methods have been introduced, including a list to
array conversion helper as well as a filelist merge sort that works
directly on arrays.
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-07-19 05:47:29 -04:00
|
|
|
ctrA++;
|
2008-02-11 10:51:34 -05:00
|
|
|
}
|
2007-02-18 22:18:59 -05:00
|
|
|
|
2011-03-20 20:45:57 -04:00
|
|
|
return ret;
|
2007-02-13 23:52:17 -05:00
|
|
|
}
|
|
|
|
|
2011-06-28 00:35:17 -04:00
|
|
|
/* Adds alpm_fileconflict_t to a conflicts list. Pass the conflicts list, type
|
2011-07-01 12:01:38 -04:00
|
|
|
* (either ALPM_FILECONFLICT_TARGET or ALPM_FILECONFLICT_FILESYSTEM), a file
|
2011-06-27 10:02:01 -04:00
|
|
|
* string, and either two package names or one package name and NULL. This is
|
|
|
|
* a wrapper for former functionality that was done inline.
|
2007-02-13 23:52:17 -05:00
|
|
|
*/
|
2011-06-28 00:04:00 -04:00
|
|
|
static alpm_list_t *add_fileconflict(alpm_handle_t *handle,
|
2011-06-27 23:58:59 -04:00
|
|
|
alpm_list_t *conflicts, alpm_fileconflicttype_t type, const char *filestr,
|
2011-06-07 17:13:58 -04:00
|
|
|
const char *name1, const char *name2)
|
2007-02-13 23:52:17 -05:00
|
|
|
{
|
2011-06-28 00:35:17 -04:00
|
|
|
alpm_fileconflict_t *conflict;
|
|
|
|
MALLOC(conflict, sizeof(alpm_fileconflict_t), goto error);
|
2007-10-29 02:00:52 -04:00
|
|
|
|
2007-02-18 22:18:59 -05:00
|
|
|
conflict->type = type;
|
2011-06-14 10:30:46 -04:00
|
|
|
STRDUP(conflict->target, name1, goto error);
|
|
|
|
STRDUP(conflict->file, filestr, goto error);
|
2007-02-18 22:18:59 -05:00
|
|
|
if(name2) {
|
2011-06-14 10:30:46 -04:00
|
|
|
STRDUP(conflict->ctarget, name2, goto error);
|
2007-02-18 22:18:59 -05:00
|
|
|
} else {
|
2011-06-14 10:30:46 -04:00
|
|
|
STRDUP(conflict->ctarget, "", goto error);
|
2007-02-18 22:18:59 -05:00
|
|
|
}
|
|
|
|
|
2007-02-13 23:52:17 -05:00
|
|
|
conflicts = alpm_list_add(conflicts, conflict);
|
2011-07-01 12:01:38 -04:00
|
|
|
_alpm_log(handle, ALPM_LOG_DEBUG, "found file conflict %s, packages %s and %s\n",
|
2007-02-18 22:18:59 -05:00
|
|
|
filestr, name1, name2 ? name2 : "(filesystem)");
|
2007-02-13 23:52:17 -05:00
|
|
|
|
2011-03-20 20:45:57 -04:00
|
|
|
return conflicts;
|
2011-06-14 10:30:46 -04:00
|
|
|
|
|
|
|
error:
|
2011-07-01 12:01:39 -04:00
|
|
|
RET_ERR(handle, ALPM_ERR_MEMORY, conflicts);
|
2007-02-13 23:52:17 -05:00
|
|
|
}
|
|
|
|
|
2011-06-28 00:35:17 -04:00
|
|
|
void _alpm_fileconflict_free(alpm_fileconflict_t *conflict)
|
2008-01-11 01:01:58 -05:00
|
|
|
{
|
2011-05-04 16:48:47 -04:00
|
|
|
FREE(conflict->ctarget);
|
|
|
|
FREE(conflict->file);
|
2008-01-11 01:01:58 -05:00
|
|
|
FREE(conflict->target);
|
|
|
|
FREE(conflict);
|
|
|
|
}
|
|
|
|
|
Convert package filelists to an array instead of linked list
This accomplishes quite a few things with one rather invasive change.
1. Iteration is much more performant, due to a reduction in pointer
chasing and linear item access.
2. Data structures are smaller- we no longer have the overhead of the
linked list as the file struts are now laid out consecutively in
memory.
3. Memory allocation has been massively reworked. Before, we would
allocate three different pieces of memory per file item- the list
struct, the file struct, and the copied filename. What this resulted
in was massive fragmentation of memory when loading filelists since
the memory allocator had to leave holes all over the place. The new
situation here now removes the need for any list item allocation;
allocates the file structs in contiguous memory (and reallocs as
necessary), leaving only the strings as individually allocated. Tests
using valgrind (massif) show some pretty significant memory
reductions on the worst case `pacman -Ql > /dev/null` (366387 files
on my machine):
Before:
Peak heap: 54,416,024 B
Useful heap: 36,840,692 B
Extra heap: 17,575,332 B
After:
Peak heap: 38,004,352 B
Useful heap: 28,101,347 B
Extra heap: 9,903,005 B
Several small helper methods have been introduced, including a list to
array conversion helper as well as a filelist merge sort that works
directly on arrays.
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-07-19 05:47:29 -04:00
|
|
|
const alpm_file_t *_alpm_filelist_contains(alpm_filelist_t *filelist,
|
|
|
|
const char *name)
|
2011-06-16 14:16:49 -04:00
|
|
|
{
|
Convert package filelists to an array instead of linked list
This accomplishes quite a few things with one rather invasive change.
1. Iteration is much more performant, due to a reduction in pointer
chasing and linear item access.
2. Data structures are smaller- we no longer have the overhead of the
linked list as the file struts are now laid out consecutively in
memory.
3. Memory allocation has been massively reworked. Before, we would
allocate three different pieces of memory per file item- the list
struct, the file struct, and the copied filename. What this resulted
in was massive fragmentation of memory when loading filelists since
the memory allocator had to leave holes all over the place. The new
situation here now removes the need for any list item allocation;
allocates the file structs in contiguous memory (and reallocs as
necessary), leaving only the strings as individually allocated. Tests
using valgrind (massif) show some pretty significant memory
reductions on the worst case `pacman -Ql > /dev/null` (366387 files
on my machine):
Before:
Peak heap: 54,416,024 B
Useful heap: 36,840,692 B
Extra heap: 17,575,332 B
After:
Peak heap: 38,004,352 B
Useful heap: 28,101,347 B
Extra heap: 9,903,005 B
Several small helper methods have been introduced, including a list to
array conversion helper as well as a filelist merge sort that works
directly on arrays.
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-07-19 05:47:29 -04:00
|
|
|
size_t i;
|
|
|
|
const alpm_file_t *file = filelist->files;
|
|
|
|
for(i = 0; i < filelist->count; i++) {
|
|
|
|
if(strcmp(file->name, name) == 0) {
|
2011-06-16 14:16:49 -04:00
|
|
|
return file;
|
|
|
|
}
|
Convert package filelists to an array instead of linked list
This accomplishes quite a few things with one rather invasive change.
1. Iteration is much more performant, due to a reduction in pointer
chasing and linear item access.
2. Data structures are smaller- we no longer have the overhead of the
linked list as the file struts are now laid out consecutively in
memory.
3. Memory allocation has been massively reworked. Before, we would
allocate three different pieces of memory per file item- the list
struct, the file struct, and the copied filename. What this resulted
in was massive fragmentation of memory when loading filelists since
the memory allocator had to leave holes all over the place. The new
situation here now removes the need for any list item allocation;
allocates the file structs in contiguous memory (and reallocs as
necessary), leaving only the strings as individually allocated. Tests
using valgrind (massif) show some pretty significant memory
reductions on the worst case `pacman -Ql > /dev/null` (366387 files
on my machine):
Before:
Peak heap: 54,416,024 B
Useful heap: 36,840,692 B
Extra heap: 17,575,332 B
After:
Peak heap: 38,004,352 B
Useful heap: 28,101,347 B
Extra heap: 9,903,005 B
Several small helper methods have been introduced, including a list to
array conversion helper as well as a filelist merge sort that works
directly on arrays.
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-07-19 05:47:29 -04:00
|
|
|
file++;
|
2011-06-16 14:16:49 -04:00
|
|
|
}
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2011-06-07 14:53:53 -04:00
|
|
|
static int dir_belongsto_pkg(const char *root, const char *dirpath,
|
2011-06-28 09:26:39 -04:00
|
|
|
alpm_pkg_t *pkg)
|
2009-07-17 09:48:57 -04:00
|
|
|
{
|
|
|
|
struct stat sbuf;
|
|
|
|
char path[PATH_MAX];
|
|
|
|
char abspath[PATH_MAX];
|
2011-06-16 14:16:49 -04:00
|
|
|
struct dirent *ent = NULL;
|
2009-07-17 09:48:57 -04:00
|
|
|
DIR *dir;
|
|
|
|
|
2011-06-07 14:53:53 -04:00
|
|
|
snprintf(abspath, PATH_MAX, "%s%s", root, dirpath);
|
2009-07-17 09:48:57 -04:00
|
|
|
dir = opendir(abspath);
|
|
|
|
if(dir == NULL) {
|
2011-03-20 20:45:57 -04:00
|
|
|
return 1;
|
2009-07-17 09:48:57 -04:00
|
|
|
}
|
2011-06-16 14:16:49 -04:00
|
|
|
|
2009-07-17 09:48:57 -04:00
|
|
|
while((ent = readdir(dir)) != NULL) {
|
|
|
|
const char *name = ent->d_name;
|
|
|
|
|
|
|
|
if(strcmp(name, ".") == 0 || strcmp(name, "..") == 0) {
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
snprintf(path, PATH_MAX, "%s/%s", dirpath, name);
|
2011-06-07 14:53:53 -04:00
|
|
|
snprintf(abspath, PATH_MAX, "%s%s", root, path);
|
2009-07-17 09:48:57 -04:00
|
|
|
if(stat(abspath, &sbuf) != 0) {
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
if(S_ISDIR(sbuf.st_mode)) {
|
2011-06-07 14:53:53 -04:00
|
|
|
if(dir_belongsto_pkg(root, path, pkg)) {
|
2009-07-17 09:48:57 -04:00
|
|
|
continue;
|
|
|
|
} else {
|
|
|
|
closedir(dir);
|
2011-03-20 20:45:57 -04:00
|
|
|
return 0;
|
2009-07-17 09:48:57 -04:00
|
|
|
}
|
|
|
|
} else {
|
2011-06-16 14:16:49 -04:00
|
|
|
if(_alpm_filelist_contains(alpm_pkg_get_files(pkg), path)) {
|
2009-07-17 09:48:57 -04:00
|
|
|
continue;
|
|
|
|
} else {
|
|
|
|
closedir(dir);
|
2011-03-20 20:45:57 -04:00
|
|
|
return 0;
|
2009-07-17 09:48:57 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
closedir(dir);
|
2011-03-20 20:45:57 -04:00
|
|
|
return 1;
|
2009-07-17 09:48:57 -04:00
|
|
|
}
|
|
|
|
|
2007-03-22 02:25:26 -04:00
|
|
|
/* Find file conflicts that may occur during the transaction with two checks:
|
|
|
|
* 1: check every target against every target
|
|
|
|
* 2: check every target against the filesystem */
|
2011-06-28 00:04:00 -04:00
|
|
|
alpm_list_t *_alpm_db_find_fileconflicts(alpm_handle_t *handle,
|
2009-01-02 11:43:05 -05:00
|
|
|
alpm_list_t *upgrade, alpm_list_t *remove)
|
2005-03-22 15:21:12 -05:00
|
|
|
{
|
2011-06-16 16:40:02 -04:00
|
|
|
alpm_list_t *i, *conflicts = NULL;
|
2010-12-08 00:13:36 -05:00
|
|
|
size_t numtargs = alpm_list_count(upgrade);
|
|
|
|
size_t current;
|
2011-06-28 09:27:16 -04:00
|
|
|
alpm_trans_t *trans = handle->trans;
|
2005-03-22 15:21:12 -05:00
|
|
|
|
2011-06-03 14:18:36 -04:00
|
|
|
if(!upgrade) {
|
2011-03-20 20:45:57 -04:00
|
|
|
return NULL;
|
2005-03-22 15:21:12 -05:00
|
|
|
}
|
2007-02-13 23:52:17 -05:00
|
|
|
|
2007-11-11 12:30:16 -05:00
|
|
|
/* TODO this whole function needs a huge change, which hopefully will
|
|
|
|
* be possible with real transactions. Right now we only do half as much
|
|
|
|
* here as we do when we actually extract files in add.c with our 12
|
|
|
|
* different cases. */
|
2011-02-08 22:16:04 -05:00
|
|
|
for(current = 0, i = upgrade; i; i = i->next, current++) {
|
2011-06-16 16:40:02 -04:00
|
|
|
alpm_pkg_t *p1 = i->data;
|
Convert package filelists to an array instead of linked list
This accomplishes quite a few things with one rather invasive change.
1. Iteration is much more performant, due to a reduction in pointer
chasing and linear item access.
2. Data structures are smaller- we no longer have the overhead of the
linked list as the file struts are now laid out consecutively in
memory.
3. Memory allocation has been massively reworked. Before, we would
allocate three different pieces of memory per file item- the list
struct, the file struct, and the copied filename. What this resulted
in was massive fragmentation of memory when loading filelists since
the memory allocator had to leave holes all over the place. The new
situation here now removes the need for any list item allocation;
allocates the file structs in contiguous memory (and reallocs as
necessary), leaving only the strings as individually allocated. Tests
using valgrind (massif) show some pretty significant memory
reductions on the worst case `pacman -Ql > /dev/null` (366387 files
on my machine):
Before:
Peak heap: 54,416,024 B
Useful heap: 36,840,692 B
Extra heap: 17,575,332 B
After:
Peak heap: 38,004,352 B
Useful heap: 28,101,347 B
Extra heap: 9,903,005 B
Several small helper methods have been introduced, including a list to
array conversion helper as well as a filelist merge sort that works
directly on arrays.
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-07-19 05:47:29 -04:00
|
|
|
alpm_list_t *j;
|
|
|
|
alpm_filelist_t tmpfiles;
|
2011-06-16 16:40:02 -04:00
|
|
|
alpm_pkg_t *dbpkg;
|
Convert package filelists to an array instead of linked list
This accomplishes quite a few things with one rather invasive change.
1. Iteration is much more performant, due to a reduction in pointer
chasing and linear item access.
2. Data structures are smaller- we no longer have the overhead of the
linked list as the file struts are now laid out consecutively in
memory.
3. Memory allocation has been massively reworked. Before, we would
allocate three different pieces of memory per file item- the list
struct, the file struct, and the copied filename. What this resulted
in was massive fragmentation of memory when loading filelists since
the memory allocator had to leave holes all over the place. The new
situation here now removes the need for any list item allocation;
allocates the file structs in contiguous memory (and reallocs as
necessary), leaving only the strings as individually allocated. Tests
using valgrind (massif) show some pretty significant memory
reductions on the worst case `pacman -Ql > /dev/null` (366387 files
on my machine):
Before:
Peak heap: 54,416,024 B
Useful heap: 36,840,692 B
Extra heap: 17,575,332 B
After:
Peak heap: 38,004,352 B
Useful heap: 28,101,347 B
Extra heap: 9,903,005 B
Several small helper methods have been introduced, including a list to
array conversion helper as well as a filelist merge sort that works
directly on arrays.
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-07-19 05:47:29 -04:00
|
|
|
size_t filenum;
|
2007-02-21 23:42:59 -05:00
|
|
|
|
2011-01-09 21:36:42 -05:00
|
|
|
int percent = (current * 100) / numtargs;
|
2011-07-01 12:01:39 -04:00
|
|
|
PROGRESS(trans, ALPM_TRANS_PROGRESS_CONFLICTS_START, "", percent,
|
2007-08-05 11:50:24 -04:00
|
|
|
numtargs, current);
|
2007-02-13 23:52:17 -05:00
|
|
|
/* CHECK 1: check every target against every target */
|
2011-07-01 12:01:38 -04:00
|
|
|
_alpm_log(handle, ALPM_LOG_DEBUG, "searching for file conflicts: %s\n",
|
2008-01-14 01:59:11 -05:00
|
|
|
alpm_pkg_get_name(p1));
|
2007-02-13 03:15:38 -05:00
|
|
|
for(j = i->next; j; j = j->next) {
|
2011-06-14 10:30:46 -04:00
|
|
|
alpm_list_t *common_files;
|
2011-06-16 16:40:02 -04:00
|
|
|
alpm_pkg_t *p2 = j->data;
|
2011-06-14 10:30:46 -04:00
|
|
|
common_files = filelist_operation(alpm_pkg_get_files(p1),
|
2011-03-30 21:20:16 -04:00
|
|
|
alpm_pkg_get_files(p2), INTERSECT);
|
2007-02-13 03:15:38 -05:00
|
|
|
|
2011-06-14 10:30:46 -04:00
|
|
|
if(common_files) {
|
2011-06-16 16:40:02 -04:00
|
|
|
alpm_list_t *k;
|
|
|
|
char path[PATH_MAX];
|
2011-06-14 10:30:46 -04:00
|
|
|
for(k = common_files; k; k = k->next) {
|
2009-01-02 11:43:05 -05:00
|
|
|
snprintf(path, PATH_MAX, "%s%s", handle->root, (char *)k->data);
|
2011-06-14 10:30:46 -04:00
|
|
|
conflicts = add_fileconflict(handle, conflicts,
|
2011-07-01 12:01:38 -04:00
|
|
|
ALPM_FILECONFLICT_TARGET, path,
|
2008-01-01 20:59:27 -05:00
|
|
|
alpm_pkg_get_name(p1), alpm_pkg_get_name(p2));
|
2011-07-01 12:01:39 -04:00
|
|
|
if(handle->pm_errno == ALPM_ERR_MEMORY) {
|
2011-06-07 17:06:16 -04:00
|
|
|
FREELIST(conflicts);
|
2011-06-14 10:30:46 -04:00
|
|
|
FREELIST(common_files);
|
|
|
|
return NULL;
|
2011-06-07 17:06:16 -04:00
|
|
|
}
|
2005-03-22 15:21:12 -05:00
|
|
|
}
|
2011-06-16 14:16:49 -04:00
|
|
|
alpm_list_free(common_files);
|
2005-03-22 15:21:12 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2006-10-15 19:31:21 -04:00
|
|
|
/* CHECK 2: check every target against the filesystem */
|
2011-07-01 12:01:38 -04:00
|
|
|
_alpm_log(handle, ALPM_LOG_DEBUG, "searching for filesystem conflicts: %s\n",
|
2011-06-14 10:30:46 -04:00
|
|
|
p1->name);
|
2011-06-03 14:18:36 -04:00
|
|
|
dbpkg = _alpm_db_get_pkgfromcache(handle->db_local, p1->name);
|
2007-02-13 23:52:17 -05:00
|
|
|
|
2009-01-02 11:43:05 -05:00
|
|
|
/* Do two different checks here. If the package is currently installed,
|
2007-02-13 23:52:17 -05:00
|
|
|
* then only check files that are new in the new package. If the package
|
2011-06-14 10:30:46 -04:00
|
|
|
* is not currently installed, then simply stat the whole filelist. Note
|
|
|
|
* that the former list needs to be freed while the latter list should NOT
|
|
|
|
* be freed. */
|
2007-02-13 23:52:17 -05:00
|
|
|
if(dbpkg) {
|
Convert package filelists to an array instead of linked list
This accomplishes quite a few things with one rather invasive change.
1. Iteration is much more performant, due to a reduction in pointer
chasing and linear item access.
2. Data structures are smaller- we no longer have the overhead of the
linked list as the file struts are now laid out consecutively in
memory.
3. Memory allocation has been massively reworked. Before, we would
allocate three different pieces of memory per file item- the list
struct, the file struct, and the copied filename. What this resulted
in was massive fragmentation of memory when loading filelists since
the memory allocator had to leave holes all over the place. The new
situation here now removes the need for any list item allocation;
allocates the file structs in contiguous memory (and reallocs as
necessary), leaving only the strings as individually allocated. Tests
using valgrind (massif) show some pretty significant memory
reductions on the worst case `pacman -Ql > /dev/null` (366387 files
on my machine):
Before:
Peak heap: 54,416,024 B
Useful heap: 36,840,692 B
Extra heap: 17,575,332 B
After:
Peak heap: 38,004,352 B
Useful heap: 28,101,347 B
Extra heap: 9,903,005 B
Several small helper methods have been introduced, including a list to
array conversion helper as well as a filelist merge sort that works
directly on arrays.
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-07-19 05:47:29 -04:00
|
|
|
alpm_list_t *difference;
|
2007-02-13 23:52:17 -05:00
|
|
|
/* older ver of package currently installed */
|
Convert package filelists to an array instead of linked list
This accomplishes quite a few things with one rather invasive change.
1. Iteration is much more performant, due to a reduction in pointer
chasing and linear item access.
2. Data structures are smaller- we no longer have the overhead of the
linked list as the file struts are now laid out consecutively in
memory.
3. Memory allocation has been massively reworked. Before, we would
allocate three different pieces of memory per file item- the list
struct, the file struct, and the copied filename. What this resulted
in was massive fragmentation of memory when loading filelists since
the memory allocator had to leave holes all over the place. The new
situation here now removes the need for any list item allocation;
allocates the file structs in contiguous memory (and reallocs as
necessary), leaving only the strings as individually allocated. Tests
using valgrind (massif) show some pretty significant memory
reductions on the worst case `pacman -Ql > /dev/null` (366387 files
on my machine):
Before:
Peak heap: 54,416,024 B
Useful heap: 36,840,692 B
Extra heap: 17,575,332 B
After:
Peak heap: 38,004,352 B
Useful heap: 28,101,347 B
Extra heap: 9,903,005 B
Several small helper methods have been introduced, including a list to
array conversion helper as well as a filelist merge sort that works
directly on arrays.
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-07-19 05:47:29 -04:00
|
|
|
difference = filelist_operation(alpm_pkg_get_files(p1),
|
2011-03-30 21:20:16 -04:00
|
|
|
alpm_pkg_get_files(dbpkg), DIFFERENCE);
|
Convert package filelists to an array instead of linked list
This accomplishes quite a few things with one rather invasive change.
1. Iteration is much more performant, due to a reduction in pointer
chasing and linear item access.
2. Data structures are smaller- we no longer have the overhead of the
linked list as the file struts are now laid out consecutively in
memory.
3. Memory allocation has been massively reworked. Before, we would
allocate three different pieces of memory per file item- the list
struct, the file struct, and the copied filename. What this resulted
in was massive fragmentation of memory when loading filelists since
the memory allocator had to leave holes all over the place. The new
situation here now removes the need for any list item allocation;
allocates the file structs in contiguous memory (and reallocs as
necessary), leaving only the strings as individually allocated. Tests
using valgrind (massif) show some pretty significant memory
reductions on the worst case `pacman -Ql > /dev/null` (366387 files
on my machine):
Before:
Peak heap: 54,416,024 B
Useful heap: 36,840,692 B
Extra heap: 17,575,332 B
After:
Peak heap: 38,004,352 B
Useful heap: 28,101,347 B
Extra heap: 9,903,005 B
Several small helper methods have been introduced, including a list to
array conversion helper as well as a filelist merge sort that works
directly on arrays.
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-07-19 05:47:29 -04:00
|
|
|
tmpfiles.count = alpm_list_count(difference);
|
|
|
|
tmpfiles.files = alpm_list_to_array(difference, tmpfiles.count,
|
|
|
|
sizeof(alpm_file_t));
|
|
|
|
alpm_list_free(difference);
|
2007-02-13 23:52:17 -05:00
|
|
|
} else {
|
|
|
|
/* no version of package currently installed */
|
Convert package filelists to an array instead of linked list
This accomplishes quite a few things with one rather invasive change.
1. Iteration is much more performant, due to a reduction in pointer
chasing and linear item access.
2. Data structures are smaller- we no longer have the overhead of the
linked list as the file struts are now laid out consecutively in
memory.
3. Memory allocation has been massively reworked. Before, we would
allocate three different pieces of memory per file item- the list
struct, the file struct, and the copied filename. What this resulted
in was massive fragmentation of memory when loading filelists since
the memory allocator had to leave holes all over the place. The new
situation here now removes the need for any list item allocation;
allocates the file structs in contiguous memory (and reallocs as
necessary), leaving only the strings as individually allocated. Tests
using valgrind (massif) show some pretty significant memory
reductions on the worst case `pacman -Ql > /dev/null` (366387 files
on my machine):
Before:
Peak heap: 54,416,024 B
Useful heap: 36,840,692 B
Extra heap: 17,575,332 B
After:
Peak heap: 38,004,352 B
Useful heap: 28,101,347 B
Extra heap: 9,903,005 B
Several small helper methods have been introduced, including a list to
array conversion helper as well as a filelist merge sort that works
directly on arrays.
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-07-19 05:47:29 -04:00
|
|
|
tmpfiles = *alpm_pkg_get_files(p1);
|
2007-02-19 21:14:27 -05:00
|
|
|
}
|
2007-02-13 23:52:17 -05:00
|
|
|
|
Convert package filelists to an array instead of linked list
This accomplishes quite a few things with one rather invasive change.
1. Iteration is much more performant, due to a reduction in pointer
chasing and linear item access.
2. Data structures are smaller- we no longer have the overhead of the
linked list as the file struts are now laid out consecutively in
memory.
3. Memory allocation has been massively reworked. Before, we would
allocate three different pieces of memory per file item- the list
struct, the file struct, and the copied filename. What this resulted
in was massive fragmentation of memory when loading filelists since
the memory allocator had to leave holes all over the place. The new
situation here now removes the need for any list item allocation;
allocates the file structs in contiguous memory (and reallocs as
necessary), leaving only the strings as individually allocated. Tests
using valgrind (massif) show some pretty significant memory
reductions on the worst case `pacman -Ql > /dev/null` (366387 files
on my machine):
Before:
Peak heap: 54,416,024 B
Useful heap: 36,840,692 B
Extra heap: 17,575,332 B
After:
Peak heap: 38,004,352 B
Useful heap: 28,101,347 B
Extra heap: 9,903,005 B
Several small helper methods have been introduced, including a list to
array conversion helper as well as a filelist merge sort that works
directly on arrays.
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-07-19 05:47:29 -04:00
|
|
|
for(filenum = 0; filenum < tmpfiles.count; filenum++) {
|
|
|
|
alpm_file_t *file = tmpfiles.files + filenum;
|
2011-06-16 14:16:49 -04:00
|
|
|
const char *filestr = file->name;
|
|
|
|
const char *relative_path;
|
2011-06-16 16:40:02 -04:00
|
|
|
alpm_list_t *k;
|
2011-06-27 10:07:06 -04:00
|
|
|
/* have we acted on this conflict? */
|
|
|
|
int resolved_conflict = 0;
|
2011-06-16 16:40:02 -04:00
|
|
|
struct stat lsbuf;
|
|
|
|
char path[PATH_MAX];
|
2007-02-19 21:14:27 -05:00
|
|
|
|
2009-01-02 11:43:05 -05:00
|
|
|
snprintf(path, PATH_MAX, "%s%s", handle->root, filestr);
|
2007-02-19 21:14:27 -05:00
|
|
|
|
2007-07-13 04:41:40 -04:00
|
|
|
/* stat the file - if it exists, do some checks */
|
2007-11-11 12:30:16 -05:00
|
|
|
if(_alpm_lstat(path, &lsbuf) != 0) {
|
2007-07-13 04:41:40 -04:00
|
|
|
continue;
|
|
|
|
}
|
2007-11-11 12:30:16 -05:00
|
|
|
|
2011-06-16 16:40:02 -04:00
|
|
|
if(S_ISDIR(file->mode)) {
|
2011-06-14 10:30:46 -04:00
|
|
|
struct stat sbuf;
|
2008-01-06 04:59:41 -05:00
|
|
|
if(S_ISDIR(lsbuf.st_mode)) {
|
2011-07-01 12:01:38 -04:00
|
|
|
_alpm_log(handle, ALPM_LOG_DEBUG, "%s is a directory, not a conflict\n", path);
|
2009-01-02 11:43:05 -05:00
|
|
|
continue;
|
2011-06-14 10:30:46 -04:00
|
|
|
}
|
|
|
|
stat(path, &sbuf);
|
|
|
|
if(S_ISLNK(lsbuf.st_mode) && S_ISDIR(sbuf.st_mode)) {
|
2011-07-01 12:01:38 -04:00
|
|
|
_alpm_log(handle, ALPM_LOG_DEBUG,
|
2008-01-06 04:59:41 -05:00
|
|
|
"%s is a symlink to a dir, hopefully not a conflict\n", path);
|
2009-01-02 11:43:05 -05:00
|
|
|
continue;
|
2008-01-06 04:59:41 -05:00
|
|
|
}
|
2011-06-27 10:07:06 -04:00
|
|
|
/* if we made it to here, we want all subsequent path comparisons to
|
|
|
|
* not include the trailing slash. This allows things like file ->
|
|
|
|
* directory replacements. */
|
|
|
|
path[strlen(path) - 1] = '\0';
|
2008-01-06 04:59:41 -05:00
|
|
|
}
|
2007-02-21 23:42:59 -05:00
|
|
|
|
2011-07-01 12:01:38 -04:00
|
|
|
_alpm_log(handle, ALPM_LOG_DEBUG, "checking possible conflict: %s\n", path);
|
2011-06-27 10:07:06 -04:00
|
|
|
relative_path = path + strlen(handle->root);
|
2009-01-02 11:43:05 -05:00
|
|
|
|
|
|
|
/* Check remove list (will we remove the conflicting local file?) */
|
|
|
|
for(k = remove; k && !resolved_conflict; k = k->next) {
|
2011-06-28 09:26:39 -04:00
|
|
|
alpm_pkg_t *rempkg = k->data;
|
2011-06-16 14:16:49 -04:00
|
|
|
if(rempkg && _alpm_filelist_contains(alpm_pkg_get_files(rempkg),
|
|
|
|
relative_path)) {
|
2011-07-01 12:01:38 -04:00
|
|
|
_alpm_log(handle, ALPM_LOG_DEBUG,
|
2011-06-16 16:40:02 -04:00
|
|
|
"local file will be removed, not a conflict: %s\n", path);
|
2009-01-02 11:43:05 -05:00
|
|
|
resolved_conflict = 1;
|
2005-03-22 15:21:12 -05:00
|
|
|
}
|
2009-01-02 11:43:05 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Look at all the targets to see if file has changed hands */
|
|
|
|
for(k = upgrade; k && !resolved_conflict; k = k->next) {
|
2011-06-16 16:40:02 -04:00
|
|
|
alpm_pkg_t *p2 = k->data;
|
2009-01-02 11:43:05 -05:00
|
|
|
if(!p2 || strcmp(p1->name, p2->name) == 0) {
|
|
|
|
continue;
|
|
|
|
}
|
2011-06-28 09:26:39 -04:00
|
|
|
alpm_pkg_t *localp2 = _alpm_db_get_pkgfromcache(handle->db_local, p2->name);
|
2009-01-02 11:43:05 -05:00
|
|
|
|
|
|
|
/* localp2->files will be removed (target conflicts are handled by CHECK 1) */
|
2011-06-16 14:16:49 -04:00
|
|
|
if(localp2 && _alpm_filelist_contains(alpm_pkg_get_files(localp2), filestr)) {
|
2009-01-02 11:43:05 -05:00
|
|
|
/* skip removal of file, but not add. this will prevent a second
|
|
|
|
* package from removing the file when it was already installed
|
|
|
|
* by its new owner (whether the file is in backup array or not */
|
2011-06-07 17:06:16 -04:00
|
|
|
handle->trans->skip_remove =
|
|
|
|
alpm_list_add(handle->trans->skip_remove, strdup(filestr));
|
2011-07-01 12:01:38 -04:00
|
|
|
_alpm_log(handle, ALPM_LOG_DEBUG,
|
2011-06-16 16:40:02 -04:00
|
|
|
"file changed packages, adding to remove skiplist: %s\n", path);
|
2009-01-02 11:43:05 -05:00
|
|
|
resolved_conflict = 1;
|
2007-02-22 01:36:05 -05:00
|
|
|
}
|
2005-03-22 15:21:12 -05:00
|
|
|
}
|
2009-01-02 11:43:05 -05:00
|
|
|
|
2009-07-17 09:48:57 -04:00
|
|
|
/* check if all files of the dir belong to the installed pkg */
|
|
|
|
if(!resolved_conflict && S_ISDIR(lsbuf.st_mode) && dbpkg) {
|
|
|
|
char *dir = malloc(strlen(filestr) + 2);
|
|
|
|
sprintf(dir, "%s/", filestr);
|
2011-06-16 14:16:49 -04:00
|
|
|
if(_alpm_filelist_contains(alpm_pkg_get_files(dbpkg), dir)) {
|
2011-07-01 12:01:38 -04:00
|
|
|
_alpm_log(handle, ALPM_LOG_DEBUG,
|
2011-06-14 10:30:46 -04:00
|
|
|
"check if all files in %s belongs to %s\n",
|
2009-07-17 09:48:57 -04:00
|
|
|
dir, dbpkg->name);
|
2011-06-07 14:53:53 -04:00
|
|
|
resolved_conflict = dir_belongsto_pkg(handle->root, filestr, dbpkg);
|
2009-07-17 09:48:57 -04:00
|
|
|
}
|
|
|
|
free(dir);
|
|
|
|
}
|
|
|
|
|
2009-07-19 10:54:12 -04:00
|
|
|
if(!resolved_conflict && dbpkg) {
|
2011-06-09 14:41:08 -04:00
|
|
|
char *rpath = calloc(PATH_MAX, sizeof(char));
|
2011-06-27 10:02:01 -04:00
|
|
|
const char *relative_rpath;
|
2009-07-19 10:54:12 -04:00
|
|
|
if(!realpath(path, rpath)) {
|
2011-06-09 14:41:08 -04:00
|
|
|
free(rpath);
|
2009-07-19 10:54:12 -04:00
|
|
|
continue;
|
|
|
|
}
|
2011-06-27 10:02:01 -04:00
|
|
|
relative_rpath = rpath + strlen(handle->root);
|
2011-06-16 14:16:49 -04:00
|
|
|
if(_alpm_filelist_contains(alpm_pkg_get_files(dbpkg), relative_rpath)) {
|
2009-07-19 10:54:12 -04:00
|
|
|
resolved_conflict = 1;
|
|
|
|
}
|
|
|
|
free(rpath);
|
|
|
|
}
|
|
|
|
|
2011-07-14 16:32:03 -04:00
|
|
|
/* is the file unowned and in the backup list of the new package? */
|
|
|
|
if(!resolved_conflict && _alpm_needbackup(filestr, p1)) {
|
|
|
|
alpm_list_t *local_pkgs = _alpm_db_get_pkgcache(handle->db_local);
|
|
|
|
int found = 0;
|
|
|
|
for(k = local_pkgs; k && !found; k = k->next) {
|
|
|
|
if(_alpm_filelist_contains(alpm_pkg_get_files(k->data), filestr)) {
|
|
|
|
found = 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if(!found) {
|
|
|
|
_alpm_log(handle, ALPM_LOG_DEBUG,
|
|
|
|
"file was unowned but in new backup list: %s\n", path);
|
|
|
|
resolved_conflict = 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-01-02 11:43:05 -05:00
|
|
|
if(!resolved_conflict) {
|
2011-06-14 10:30:46 -04:00
|
|
|
conflicts = add_fileconflict(handle, conflicts,
|
2011-07-01 12:01:38 -04:00
|
|
|
ALPM_FILECONFLICT_FILESYSTEM, path, p1->name, NULL);
|
2011-07-01 12:01:39 -04:00
|
|
|
if(handle->pm_errno == ALPM_ERR_MEMORY) {
|
2011-06-07 17:06:16 -04:00
|
|
|
FREELIST(conflicts);
|
2011-06-14 10:30:46 -04:00
|
|
|
if(dbpkg) {
|
|
|
|
/* only freed if it was generated from filelist_operation() */
|
Convert package filelists to an array instead of linked list
This accomplishes quite a few things with one rather invasive change.
1. Iteration is much more performant, due to a reduction in pointer
chasing and linear item access.
2. Data structures are smaller- we no longer have the overhead of the
linked list as the file struts are now laid out consecutively in
memory.
3. Memory allocation has been massively reworked. Before, we would
allocate three different pieces of memory per file item- the list
struct, the file struct, and the copied filename. What this resulted
in was massive fragmentation of memory when loading filelists since
the memory allocator had to leave holes all over the place. The new
situation here now removes the need for any list item allocation;
allocates the file structs in contiguous memory (and reallocs as
necessary), leaving only the strings as individually allocated. Tests
using valgrind (massif) show some pretty significant memory
reductions on the worst case `pacman -Ql > /dev/null` (366387 files
on my machine):
Before:
Peak heap: 54,416,024 B
Useful heap: 36,840,692 B
Extra heap: 17,575,332 B
After:
Peak heap: 38,004,352 B
Useful heap: 28,101,347 B
Extra heap: 9,903,005 B
Several small helper methods have been introduced, including a list to
array conversion helper as well as a filelist merge sort that works
directly on arrays.
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-07-19 05:47:29 -04:00
|
|
|
free(tmpfiles.files);
|
2011-06-14 10:30:46 -04:00
|
|
|
}
|
|
|
|
return NULL;
|
2011-06-07 17:06:16 -04:00
|
|
|
}
|
2009-01-02 11:43:05 -05:00
|
|
|
}
|
2005-03-22 15:21:12 -05:00
|
|
|
}
|
2011-06-14 10:30:46 -04:00
|
|
|
if(dbpkg) {
|
|
|
|
/* only freed if it was generated from filelist_operation() */
|
Convert package filelists to an array instead of linked list
This accomplishes quite a few things with one rather invasive change.
1. Iteration is much more performant, due to a reduction in pointer
chasing and linear item access.
2. Data structures are smaller- we no longer have the overhead of the
linked list as the file struts are now laid out consecutively in
memory.
3. Memory allocation has been massively reworked. Before, we would
allocate three different pieces of memory per file item- the list
struct, the file struct, and the copied filename. What this resulted
in was massive fragmentation of memory when loading filelists since
the memory allocator had to leave holes all over the place. The new
situation here now removes the need for any list item allocation;
allocates the file structs in contiguous memory (and reallocs as
necessary), leaving only the strings as individually allocated. Tests
using valgrind (massif) show some pretty significant memory
reductions on the worst case `pacman -Ql > /dev/null` (366387 files
on my machine):
Before:
Peak heap: 54,416,024 B
Useful heap: 36,840,692 B
Extra heap: 17,575,332 B
After:
Peak heap: 38,004,352 B
Useful heap: 28,101,347 B
Extra heap: 9,903,005 B
Several small helper methods have been introduced, including a list to
array conversion helper as well as a filelist merge sort that works
directly on arrays.
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-07-19 05:47:29 -04:00
|
|
|
free(tmpfiles.files);
|
2011-06-14 10:30:46 -04:00
|
|
|
}
|
2005-03-22 15:21:12 -05:00
|
|
|
}
|
2011-07-01 12:01:39 -04:00
|
|
|
PROGRESS(trans, ALPM_TRANS_PROGRESS_CONFLICTS_START, "", 100,
|
2011-02-08 22:16:04 -05:00
|
|
|
numtargs, current);
|
2005-03-22 15:21:12 -05:00
|
|
|
|
2011-03-20 20:45:57 -04:00
|
|
|
return conflicts;
|
2005-03-22 15:21:12 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
/* vim: set ts=2 sw=2 noet: */
|