mirror of
https://github.com/moparisthebest/pacman
synced 2024-12-22 15:58:50 -05:00
libalpm: export alpm_splitdep as alpm_dep_from_depstring and alpm_dep_free
Signed-off-by: Florian Pritz <bluewind@xinu.at>
This commit is contained in:
parent
13c9745302
commit
4e263f24c6
@ -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);
|
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);
|
||||||
|
|
||||||
/** @} */
|
/** @} */
|
||||||
|
|
||||||
/** @} */
|
/** @} */
|
||||||
|
@ -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(!feof(fp)) goto error; else break; \
|
||||||
} \
|
} \
|
||||||
if(_alpm_strip_newline(line, 0) == 0) 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) */
|
} while(1) /* note the while(1) and not (0) */
|
||||||
|
|
||||||
static int local_db_read(alpm_pkg_t *info, alpm_dbinfrq_t inforeq)
|
static int local_db_read(alpm_pkg_t *info, alpm_dbinfrq_t inforeq)
|
||||||
|
@ -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 */
|
/* size in the raw package is uncompressed (installed) size */
|
||||||
newpkg->isize = _alpm_strtoofft(ptr);
|
newpkg->isize = _alpm_strtoofft(ptr);
|
||||||
} else if(strcmp(key, "depend") == 0) {
|
} 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);
|
newpkg->depends = alpm_list_add(newpkg->depends, dep);
|
||||||
} else if(strcmp(key, "optdepend") == 0) {
|
} 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);
|
newpkg->optdepends = alpm_list_add(newpkg->optdepends, optdep);
|
||||||
} else if(strcmp(key, "makedepend") == 0) {
|
} else if(strcmp(key, "makedepend") == 0) {
|
||||||
/* not used atm */
|
/* not used atm */
|
||||||
} else if(strcmp(key, "checkdepend") == 0) {
|
} else if(strcmp(key, "checkdepend") == 0) {
|
||||||
/* not used atm */
|
/* not used atm */
|
||||||
} else if(strcmp(key, "conflict") == 0) {
|
} 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);
|
newpkg->conflicts = alpm_list_add(newpkg->conflicts, conflict);
|
||||||
} else if(strcmp(key, "replaces") == 0) {
|
} 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);
|
newpkg->replaces = alpm_list_add(newpkg->replaces, replace);
|
||||||
} else if(strcmp(key, "provides") == 0) {
|
} 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);
|
newpkg->provides = alpm_list_add(newpkg->provides, provide);
|
||||||
} else if(strcmp(key, "backup") == 0) {
|
} else if(strcmp(key, "backup") == 0) {
|
||||||
alpm_backup_t *backup;
|
alpm_backup_t *backup;
|
||||||
|
@ -533,7 +533,7 @@ static int _alpm_validate_filename(alpm_db_t *db, const char *pkgname,
|
|||||||
#define READ_AND_SPLITDEP(f) do { \
|
#define READ_AND_SPLITDEP(f) do { \
|
||||||
if(_alpm_archive_fgets(archive, &buf) != ARCHIVE_OK) goto error; \
|
if(_alpm_archive_fgets(archive, &buf) != ARCHIVE_OK) goto error; \
|
||||||
if(_alpm_strip_newline(buf.line, buf.real_line_size) == 0) break; \
|
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) */
|
} while(1) /* note the while(1) and not (0) */
|
||||||
|
|
||||||
static int sync_db_read(alpm_db_t *db, struct archive *archive,
|
static int sync_db_read(alpm_db_t *db, struct archive *archive,
|
||||||
|
@ -35,7 +35,7 @@
|
|||||||
#include "handle.h"
|
#include "handle.h"
|
||||||
#include "trans.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->name);
|
||||||
FREE(dep->version);
|
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)
|
void SYMEXPORT alpm_depmissing_free(alpm_depmissing_t *miss)
|
||||||
{
|
{
|
||||||
_alpm_dep_free(miss->depend);
|
alpm_dep_free(miss->depend);
|
||||||
FREE(miss->target);
|
FREE(miss->target);
|
||||||
FREE(miss->causingpkg);
|
FREE(miss->causingpkg);
|
||||||
FREE(miss);
|
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_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) {
|
if(!dep) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
alpm_pkg_t *pkg = find_dep_satisfier(pkgs, dep);
|
alpm_pkg_t *pkg = find_dep_satisfier(pkgs, dep);
|
||||||
_alpm_dep_free(dep);
|
alpm_dep_free(dep);
|
||||||
return pkg;
|
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_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;
|
alpm_depend_t *depend;
|
||||||
const char *ptr, *version, *desc;
|
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);
|
CHECK_HANDLE(handle, return NULL);
|
||||||
ASSERT(dbs, RET_ERR(handle, ALPM_ERR_WRONG_ARGS, 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);
|
ASSERT(dep, return NULL);
|
||||||
pkg = resolvedep(handle, dep, dbs, NULL, 1);
|
pkg = resolvedep(handle, dep, dbs, NULL, 1);
|
||||||
_alpm_dep_free(dep);
|
alpm_dep_free(dep);
|
||||||
return pkg;
|
return pkg;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -27,7 +27,6 @@
|
|||||||
#include "package.h"
|
#include "package.h"
|
||||||
#include "alpm.h"
|
#include "alpm.h"
|
||||||
|
|
||||||
void _alpm_dep_free(alpm_depend_t *dep);
|
|
||||||
alpm_depend_t *_alpm_dep_dup(const 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 *_alpm_sortbydeps(alpm_handle_t *handle,
|
||||||
alpm_list_t *targets, alpm_list_t *ignore, int reverse);
|
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,
|
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 *preferred, alpm_list_t **packages, alpm_list_t *remove,
|
||||||
alpm_list_t **data);
|
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_literal(alpm_pkg_t *pkg, alpm_depend_t *dep);
|
||||||
int _alpm_depcmp_provides(alpm_depend_t *dep, alpm_list_t *provisions);
|
int _alpm_depcmp_provides(alpm_depend_t *dep, alpm_list_t *provisions);
|
||||||
int _alpm_depcmp(alpm_pkg_t *pkg, alpm_depend_t *dep);
|
int _alpm_depcmp(alpm_pkg_t *pkg, alpm_depend_t *dep);
|
||||||
|
@ -630,7 +630,7 @@ cleanup:
|
|||||||
|
|
||||||
static void free_deplist(alpm_list_t *deps)
|
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);
|
alpm_list_free(deps);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -524,8 +524,8 @@ int _alpm_sync_prepare(alpm_handle_t *handle, alpm_list_t **data)
|
|||||||
conflict->package1, conflict->package2);
|
conflict->package1, conflict->package2);
|
||||||
|
|
||||||
/* if sync1 provides sync2, we remove sync2 from the targets, and vice versa */
|
/* if sync1 provides sync2, we remove sync2 from the targets, and vice versa */
|
||||||
alpm_depend_t *dep1 = _alpm_splitdep(conflict->package1);
|
alpm_depend_t *dep1 = alpm_dep_from_string(conflict->package1);
|
||||||
alpm_depend_t *dep2 = _alpm_splitdep(conflict->package2);
|
alpm_depend_t *dep2 = alpm_dep_from_string(conflict->package2);
|
||||||
if(_alpm_depcmp(sync1, dep2)) {
|
if(_alpm_depcmp(sync1, dep2)) {
|
||||||
rsync = sync2;
|
rsync = sync2;
|
||||||
sync = sync1;
|
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_inner(deps, (alpm_list_fn_free)alpm_conflict_free);
|
||||||
alpm_list_free(deps);
|
alpm_list_free(deps);
|
||||||
_alpm_dep_free(dep1);
|
alpm_dep_free(dep1);
|
||||||
_alpm_dep_free(dep2);
|
alpm_dep_free(dep2);
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
_alpm_dep_free(dep1);
|
alpm_dep_free(dep1);
|
||||||
_alpm_dep_free(dep2);
|
alpm_dep_free(dep2);
|
||||||
|
|
||||||
/* Prints warning */
|
/* Prints warning */
|
||||||
_alpm_log(handle, ALPM_LOG_WARNING,
|
_alpm_log(handle, ALPM_LOG_WARNING,
|
||||||
|
Loading…
Reference in New Issue
Block a user