summaryrefslogtreecommitdiff
path: root/lib/libalpm
diff options
context:
space:
mode:
Diffstat (limited to 'lib/libalpm')
-rw-r--r--lib/libalpm/alpm.h11
-rw-r--r--lib/libalpm/be_local.c2
-rw-r--r--lib/libalpm/be_package.c10
-rw-r--r--lib/libalpm/be_sync.c2
-rw-r--r--lib/libalpm/deps.c14
-rw-r--r--lib/libalpm/deps.h2
-rw-r--r--lib/libalpm/package.c2
-rw-r--r--lib/libalpm/sync.c12
8 files changed, 32 insertions, 23 deletions
diff --git a/lib/libalpm/alpm.h b/lib/libalpm/alpm.h
index 1cfd4f5b..888b6a00 100644
--- a/lib/libalpm/alpm.h
+++ b/lib/libalpm/alpm.h
@@ -1517,6 +1517,17 @@ alpm_list_t *alpm_checkconflicts(alpm_handle_t *handle, alpm_list_t *pkglist);
*/
char *alpm_dep_compute_string(const alpm_depend_t *dep);
+/** Return a newly allocated dependency information parsed from a string
+ * @param depstring a formatted string, e.g. "glibc=2.12"
+ * @return a dependency info structure
+ */
+alpm_depend_t *alpm_dep_from_string(const char *depstring);
+
+/** Free a dependency info structure
+ * @param dep struct to free
+ */
+void alpm_dep_free(alpm_depend_t *dep);
+
/** @} */
/** @} */
diff --git a/lib/libalpm/be_local.c b/lib/libalpm/be_local.c
index 091ed4c8..93763966 100644
--- a/lib/libalpm/be_local.c
+++ b/lib/libalpm/be_local.c
@@ -640,7 +640,7 @@ char *_alpm_local_db_pkgpath(alpm_db_t *db, alpm_pkg_t *info,
if(!feof(fp)) goto error; else break; \
} \
if(_alpm_strip_newline(line, 0) == 0) break; \
- f = alpm_list_add(f, _alpm_splitdep(line)); \
+ f = alpm_list_add(f, alpm_dep_from_string(line)); \
} while(1) /* note the while(1) and not (0) */
static int local_db_read(alpm_pkg_t *info, alpm_dbinfrq_t inforeq)
diff --git a/lib/libalpm/be_package.c b/lib/libalpm/be_package.c
index 6ec88885..5617f4fa 100644
--- a/lib/libalpm/be_package.c
+++ b/lib/libalpm/be_package.c
@@ -216,23 +216,23 @@ static int parse_descfile(alpm_handle_t *handle, struct archive *a, alpm_pkg_t *
/* size in the raw package is uncompressed (installed) size */
newpkg->isize = _alpm_strtoofft(ptr);
} else if(strcmp(key, "depend") == 0) {
- alpm_depend_t *dep = _alpm_splitdep(ptr);
+ alpm_depend_t *dep = alpm_dep_from_string(ptr);
newpkg->depends = alpm_list_add(newpkg->depends, dep);
} else if(strcmp(key, "optdepend") == 0) {
- alpm_depend_t *optdep = _alpm_splitdep(ptr);
+ alpm_depend_t *optdep = alpm_dep_from_string(ptr);
newpkg->optdepends = alpm_list_add(newpkg->optdepends, optdep);
} else if(strcmp(key, "makedepend") == 0) {
/* not used atm */
} else if(strcmp(key, "checkdepend") == 0) {
/* not used atm */
} else if(strcmp(key, "conflict") == 0) {
- alpm_depend_t *conflict = _alpm_splitdep(ptr);
+ alpm_depend_t *conflict = alpm_dep_from_string(ptr);
newpkg->conflicts = alpm_list_add(newpkg->conflicts, conflict);
} else if(strcmp(key, "replaces") == 0) {
- alpm_depend_t *replace = _alpm_splitdep(ptr);
+ alpm_depend_t *replace = alpm_dep_from_string(ptr);
newpkg->replaces = alpm_list_add(newpkg->replaces, replace);
} else if(strcmp(key, "provides") == 0) {
- alpm_depend_t *provide = _alpm_splitdep(ptr);
+ alpm_depend_t *provide = alpm_dep_from_string(ptr);
newpkg->provides = alpm_list_add(newpkg->provides, provide);
} else if(strcmp(key, "backup") == 0) {
alpm_backup_t *backup;
diff --git a/lib/libalpm/be_sync.c b/lib/libalpm/be_sync.c
index 4b67f429..b03d273a 100644
--- a/lib/libalpm/be_sync.c
+++ b/lib/libalpm/be_sync.c
@@ -533,7 +533,7 @@ static int _alpm_validate_filename(alpm_db_t *db, const char *pkgname,
#define READ_AND_SPLITDEP(f) do { \
if(_alpm_archive_fgets(archive, &buf) != ARCHIVE_OK) goto error; \
if(_alpm_strip_newline(buf.line, buf.real_line_size) == 0) break; \
- f = alpm_list_add(f, _alpm_splitdep(line)); \
+ f = alpm_list_add(f, alpm_dep_from_string(line)); \
} while(1) /* note the while(1) and not (0) */
static int sync_db_read(alpm_db_t *db, struct archive *archive,
diff --git a/lib/libalpm/deps.c b/lib/libalpm/deps.c
index 7daa28d3..c280336b 100644
--- a/lib/libalpm/deps.c
+++ b/lib/libalpm/deps.c
@@ -35,7 +35,7 @@
#include "handle.h"
#include "trans.h"
-void _alpm_dep_free(alpm_depend_t *dep)
+void SYMEXPORT alpm_dep_free(alpm_depend_t *dep)
{
FREE(dep->name);
FREE(dep->version);
@@ -59,7 +59,7 @@ static alpm_depmissing_t *depmiss_new(const char *target, alpm_depend_t *dep,
void SYMEXPORT alpm_depmissing_free(alpm_depmissing_t *miss)
{
- _alpm_dep_free(miss->depend);
+ alpm_dep_free(miss->depend);
FREE(miss->target);
FREE(miss->causingpkg);
FREE(miss);
@@ -279,12 +279,12 @@ static int no_dep_version(alpm_handle_t *handle)
*/
alpm_pkg_t SYMEXPORT *alpm_find_satisfier(alpm_list_t *pkgs, const char *depstring)
{
- alpm_depend_t *dep = _alpm_splitdep(depstring);
+ alpm_depend_t *dep = alpm_dep_from_string(depstring);
if(!dep) {
return NULL;
}
alpm_pkg_t *pkg = find_dep_satisfier(pkgs, dep);
- _alpm_dep_free(dep);
+ alpm_dep_free(dep);
return pkg;
}
@@ -451,7 +451,7 @@ int _alpm_depcmp(alpm_pkg_t *pkg, alpm_depend_t *dep)
|| _alpm_depcmp_provides(dep, alpm_pkg_get_provides(pkg));
}
-alpm_depend_t *_alpm_splitdep(const char *depstring)
+alpm_depend_t SYMEXPORT *alpm_dep_from_string(const char *depstring)
{
alpm_depend_t *depend;
const char *ptr, *version, *desc;
@@ -755,10 +755,10 @@ alpm_pkg_t SYMEXPORT *alpm_find_dbs_satisfier(alpm_handle_t *handle,
CHECK_HANDLE(handle, return NULL);
ASSERT(dbs, RET_ERR(handle, ALPM_ERR_WRONG_ARGS, NULL));
- dep = _alpm_splitdep(depstring);
+ dep = alpm_dep_from_string(depstring);
ASSERT(dep, return NULL);
pkg = resolvedep(handle, dep, dbs, NULL, 1);
- _alpm_dep_free(dep);
+ alpm_dep_free(dep);
return pkg;
}
diff --git a/lib/libalpm/deps.h b/lib/libalpm/deps.h
index f4eadba1..bd717bbd 100644
--- a/lib/libalpm/deps.h
+++ b/lib/libalpm/deps.h
@@ -27,7 +27,6 @@
#include "package.h"
#include "alpm.h"
-void _alpm_dep_free(alpm_depend_t *dep);
alpm_depend_t *_alpm_dep_dup(const alpm_depend_t *dep);
alpm_list_t *_alpm_sortbydeps(alpm_handle_t *handle,
alpm_list_t *targets, alpm_list_t *ignore, int reverse);
@@ -35,7 +34,6 @@ int _alpm_recursedeps(alpm_db_t *db, alpm_list_t **targs, int include_explicit);
int _alpm_resolvedeps(alpm_handle_t *handle, alpm_list_t *localpkgs, alpm_pkg_t *pkg,
alpm_list_t *preferred, alpm_list_t **packages, alpm_list_t *remove,
alpm_list_t **data);
-alpm_depend_t *_alpm_splitdep(const char *depstring);
int _alpm_depcmp_literal(alpm_pkg_t *pkg, alpm_depend_t *dep);
int _alpm_depcmp_provides(alpm_depend_t *dep, alpm_list_t *provisions);
int _alpm_depcmp(alpm_pkg_t *pkg, alpm_depend_t *dep);
diff --git a/lib/libalpm/package.c b/lib/libalpm/package.c
index a69f454c..e2997f69 100644
--- a/lib/libalpm/package.c
+++ b/lib/libalpm/package.c
@@ -630,7 +630,7 @@ cleanup:
static void free_deplist(alpm_list_t *deps)
{
- alpm_list_free_inner(deps, (alpm_list_fn_free)_alpm_dep_free);
+ alpm_list_free_inner(deps, (alpm_list_fn_free)alpm_dep_free);
alpm_list_free(deps);
}
diff --git a/lib/libalpm/sync.c b/lib/libalpm/sync.c
index 4c74a3a0..f040eee6 100644
--- a/lib/libalpm/sync.c
+++ b/lib/libalpm/sync.c
@@ -524,8 +524,8 @@ int _alpm_sync_prepare(alpm_handle_t *handle, alpm_list_t **data)
conflict->package1, conflict->package2);
/* if sync1 provides sync2, we remove sync2 from the targets, and vice versa */
- alpm_depend_t *dep1 = _alpm_splitdep(conflict->package1);
- alpm_depend_t *dep2 = _alpm_splitdep(conflict->package2);
+ alpm_depend_t *dep1 = alpm_dep_from_string(conflict->package1);
+ alpm_depend_t *dep2 = alpm_dep_from_string(conflict->package2);
if(_alpm_depcmp(sync1, dep2)) {
rsync = sync2;
sync = sync1;
@@ -544,12 +544,12 @@ int _alpm_sync_prepare(alpm_handle_t *handle, alpm_list_t **data)
}
alpm_list_free_inner(deps, (alpm_list_fn_free)alpm_conflict_free);
alpm_list_free(deps);
- _alpm_dep_free(dep1);
- _alpm_dep_free(dep2);
+ alpm_dep_free(dep1);
+ alpm_dep_free(dep2);
goto cleanup;
}
- _alpm_dep_free(dep1);
- _alpm_dep_free(dep2);
+ alpm_dep_free(dep1);
+ alpm_dep_free(dep2);
/* Prints warning */
_alpm_log(handle, ALPM_LOG_WARNING,