mirror of
https://github.com/moparisthebest/pacman
synced 2024-12-23 00:08:50 -05:00
Do not replicate files list when removing packages
This saves replicating the potentially large list of files in a package that is being removed. Signed-off-by: Allan McRae <allan@archlinux.org> Signed-off-by: Dan McGee <dan@archlinux.org>
This commit is contained in:
parent
ab79b13079
commit
a7b02d07f4
@ -285,8 +285,7 @@ static void unlink_file(alpm_handle_t *handle, alpm_pkg_t *info, const char *fil
|
|||||||
int _alpm_upgraderemove_package(alpm_handle_t *handle,
|
int _alpm_upgraderemove_package(alpm_handle_t *handle,
|
||||||
alpm_pkg_t *oldpkg, alpm_pkg_t *newpkg)
|
alpm_pkg_t *oldpkg, alpm_pkg_t *newpkg)
|
||||||
{
|
{
|
||||||
alpm_list_t *skip_remove, *b;
|
alpm_list_t *skip_remove, *b, *lp;
|
||||||
alpm_list_t *newfiles, *lp;
|
|
||||||
size_t filenum = 0;
|
size_t filenum = 0;
|
||||||
alpm_list_t *files = alpm_pkg_get_files(oldpkg);
|
alpm_list_t *files = alpm_pkg_get_files(oldpkg);
|
||||||
const char *pkgname = alpm_pkg_get_name(oldpkg);
|
const char *pkgname = alpm_pkg_get_name(oldpkg);
|
||||||
@ -329,11 +328,9 @@ int _alpm_upgraderemove_package(alpm_handle_t *handle,
|
|||||||
_alpm_log(handle, PM_LOG_DEBUG, "removing %ld files\n", (unsigned long)filenum);
|
_alpm_log(handle, PM_LOG_DEBUG, "removing %ld files\n", (unsigned long)filenum);
|
||||||
|
|
||||||
/* iterate through the list backwards, unlinking files */
|
/* iterate through the list backwards, unlinking files */
|
||||||
newfiles = alpm_list_reverse(files);
|
for(lp = alpm_list_last(files); lp; lp = alpm_list_previous(files, lp)) {
|
||||||
for(lp = newfiles; lp; lp = alpm_list_next(lp)) {
|
|
||||||
unlink_file(handle, oldpkg, lp->data, skip_remove, 0);
|
unlink_file(handle, oldpkg, lp->data, skip_remove, 0);
|
||||||
}
|
}
|
||||||
alpm_list_free(newfiles);
|
|
||||||
FREELIST(skip_remove);
|
FREELIST(skip_remove);
|
||||||
|
|
||||||
db:
|
db:
|
||||||
@ -390,7 +387,6 @@ int _alpm_remove_packages(alpm_handle_t *handle)
|
|||||||
|
|
||||||
if(!(trans->flags & PM_TRANS_FLAG_DBONLY)) {
|
if(!(trans->flags & PM_TRANS_FLAG_DBONLY)) {
|
||||||
alpm_list_t *files = alpm_pkg_get_files(info);
|
alpm_list_t *files = alpm_pkg_get_files(info);
|
||||||
alpm_list_t *newfiles;
|
|
||||||
size_t filenum = 0;
|
size_t filenum = 0;
|
||||||
|
|
||||||
for(lp = files; lp; lp = lp->next) {
|
for(lp = files; lp; lp = lp->next) {
|
||||||
@ -409,8 +405,7 @@ int _alpm_remove_packages(alpm_handle_t *handle)
|
|||||||
pkg_count, (pkg_count - targcount + 1));
|
pkg_count, (pkg_count - targcount + 1));
|
||||||
|
|
||||||
/* iterate through the list backwards, unlinking files */
|
/* iterate through the list backwards, unlinking files */
|
||||||
newfiles = alpm_list_reverse(files);
|
for(lp = alpm_list_last(files); lp; lp = alpm_list_previous(files, lp)) {
|
||||||
for(lp = newfiles; lp; lp = alpm_list_next(lp)) {
|
|
||||||
int percent;
|
int percent;
|
||||||
unlink_file(handle, info, lp->data, NULL, trans->flags & PM_TRANS_FLAG_NOSAVE);
|
unlink_file(handle, info, lp->data, NULL, trans->flags & PM_TRANS_FLAG_NOSAVE);
|
||||||
|
|
||||||
@ -420,7 +415,6 @@ int _alpm_remove_packages(alpm_handle_t *handle)
|
|||||||
percent, pkg_count, (pkg_count - targcount + 1));
|
percent, pkg_count, (pkg_count - targcount + 1));
|
||||||
position++;
|
position++;
|
||||||
}
|
}
|
||||||
alpm_list_free(newfiles);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* set progress to 100% after we finish unlinking files */
|
/* set progress to 100% after we finish unlinking files */
|
||||||
|
Loading…
Reference in New Issue
Block a user