mirror of
https://gitdl.cn/https://github.com/chakralinux/core.git
synced 2025-01-24 02:22:15 +08:00
39 lines
1.3 KiB
Diff
39 lines
1.3 KiB
Diff
diff -ur repo-clean-0.1.3.xz/src/repo-clean.cpp repo-clean-0.1.3/src/repo-clean.cpp
|
|
--- repo-clean-0.1.3.xz/src/repo-clean.cpp 2012-01-21 17:41:30.000000000 +1100
|
|
+++ repo-clean-0.1.3/src/repo-clean.cpp 2012-01-21 17:19:26.700577264 +1100
|
|
@@ -36,6 +36,8 @@
|
|
|
|
#define _(String) gettext (String)
|
|
#define foreach BOOST_FOREACH
|
|
+#define ROOT "/"
|
|
+#define DBPATH "/var/lib/pacman/"
|
|
|
|
struct version_item
|
|
{
|
|
@@ -201,13 +203,14 @@
|
|
// build comp_tree
|
|
arch_comparing_tree arch_comp_tree;
|
|
int total = list.size(), err = 0, ign = 0;
|
|
- alpm_initialize();
|
|
+ alpm_handle_t *handle;
|
|
+ handle = alpm_initialize(ROOT, DBPATH, NULL);
|
|
for (unsigned int i = 0; i < list.size(); i++)
|
|
{
|
|
// load package
|
|
- pmpkg_t *pkg= NULL;
|
|
+ alpm_pkg_t *pkg= NULL;
|
|
std::string path = list[i];
|
|
- if (alpm_pkg_load(path.c_str(), 0, &pkg) == 0)
|
|
+ if (alpm_pkg_load(handle, path.c_str(), 0, ALPM_SIG_USE_DEFAULT, &pkg) == 0)
|
|
{
|
|
std::string pkg_name = alpm_pkg_get_name(pkg);
|
|
std::string pkg_version = alpm_pkg_get_version(pkg);
|
|
@@ -233,7 +236,7 @@
|
|
}
|
|
}
|
|
VERBOSE_PRINTF(_("%cTotal: %d Ignored: %d Corrupted: %d\n"), '\r', total, ign, err);
|
|
- alpm_release();
|
|
+ alpm_release(handle);
|
|
|
|
// check if comp_tree contain multiversion packages
|
|
bool found_multiversions = false;
|