mirror of
https://github.com/moparisthebest/pacman
synced 2025-03-01 01:41:52 -05:00
* Completed getinfo api changes (pmmissing_t, pmtrans_t, etc)
* Modified some dependancy checking * Changed "performing local database upgrade" message to be more clear * Change 'usize' to 'isize' in database files * Scriptlet output is now sent to pacman's log file * Limited some debugging output to be more clear
This commit is contained in:
parent
5469177183
commit
986409f9bd
@ -613,34 +613,6 @@ pmlist_t *alpm_db_search(pmdb_t *db)
|
|||||||
* @{
|
* @{
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/** Get informations about the transaction.
|
|
||||||
* @param parm name of the info to get
|
|
||||||
* @return a void* on success (the value), NULL on error
|
|
||||||
*/
|
|
||||||
void *alpm_trans_getinfo(unsigned char parm)
|
|
||||||
{
|
|
||||||
pmtrans_t *trans;
|
|
||||||
void *data;
|
|
||||||
|
|
||||||
/* Sanity checks */
|
|
||||||
ASSERT(handle != NULL, return(NULL));
|
|
||||||
ASSERT(handle->trans != NULL, return(NULL));
|
|
||||||
|
|
||||||
trans = handle->trans;
|
|
||||||
|
|
||||||
switch(parm) {
|
|
||||||
case PM_TRANS_TYPE: data = (void *)(long)trans->type; break;
|
|
||||||
case PM_TRANS_FLAGS: data = (void *)(long)trans->flags; break;
|
|
||||||
case PM_TRANS_TARGETS: data = trans->targets; break;
|
|
||||||
case PM_TRANS_PACKAGES: data = trans->packages; break;
|
|
||||||
default:
|
|
||||||
data = NULL;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
return(data);
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Initialize the transaction.
|
/** Initialize the transaction.
|
||||||
* @param type type of the transaction
|
* @param type type of the transaction
|
||||||
* @param flags flags of the transaction (like nodeps, etc)
|
* @param flags flags of the transaction (like nodeps, etc)
|
||||||
@ -790,32 +762,6 @@ int alpm_trans_release()
|
|||||||
* @brief Functions to get informations about a libalpm dependency
|
* @brief Functions to get informations about a libalpm dependency
|
||||||
* @{
|
* @{
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/** Get informations about a dependency.
|
|
||||||
* @param miss dependency pointer
|
|
||||||
* @param parm name of the info to get
|
|
||||||
* @return a void* on success (the value), NULL on error
|
|
||||||
*/
|
|
||||||
void *alpm_dep_getinfo(pmdepmissing_t *miss, unsigned char parm)
|
|
||||||
{
|
|
||||||
void *data;
|
|
||||||
|
|
||||||
/* Sanity checks */
|
|
||||||
ASSERT(miss != NULL, return(NULL));
|
|
||||||
|
|
||||||
switch(parm) {
|
|
||||||
case PM_DEP_TARGET: data = (void *)(long)miss->target; break;
|
|
||||||
case PM_DEP_TYPE: data = (void *)(long)miss->type; break;
|
|
||||||
case PM_DEP_MOD: data = (void *)(long)miss->depend.mod; break;
|
|
||||||
case PM_DEP_NAME: data = miss->depend.name; break;
|
|
||||||
case PM_DEP_VERSION: data = miss->depend.version; break;
|
|
||||||
default:
|
|
||||||
data = NULL;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
return(data);
|
|
||||||
}
|
|
||||||
/** @} */
|
/** @} */
|
||||||
|
|
||||||
/** \addtogroup alpm_conflict File Conflicts Functions
|
/** \addtogroup alpm_conflict File Conflicts Functions
|
||||||
@ -828,25 +774,6 @@ void *alpm_dep_getinfo(pmdepmissing_t *miss, unsigned char parm)
|
|||||||
* @param parm name of the info to get
|
* @param parm name of the info to get
|
||||||
* @return a void* on success (the value), NULL on error
|
* @return a void* on success (the value), NULL on error
|
||||||
*/
|
*/
|
||||||
void *alpm_conflict_getinfo(pmconflict_t *conflict, unsigned char parm)
|
|
||||||
{
|
|
||||||
void *data;
|
|
||||||
|
|
||||||
/* Sanity checks */
|
|
||||||
ASSERT(conflict != NULL, return(NULL));
|
|
||||||
|
|
||||||
switch(parm) {
|
|
||||||
case PM_CONFLICT_TARGET: data = conflict->target; break;
|
|
||||||
case PM_CONFLICT_TYPE: data = (void *)(long)conflict->type; break;
|
|
||||||
case PM_CONFLICT_FILE: data = conflict->file; break;
|
|
||||||
case PM_CONFLICT_CTARGET: data = conflict->ctarget; break;
|
|
||||||
default:
|
|
||||||
data = NULL;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
return(data);
|
|
||||||
}
|
|
||||||
/** @} */
|
/** @} */
|
||||||
|
|
||||||
/** \addtogroup alpm_log Logging Functions
|
/** \addtogroup alpm_log Logging Functions
|
||||||
|
@ -200,6 +200,7 @@ int alpm_parse_config(char *file, alpm_cb_db_register callback, const char *this
|
|||||||
int alpm_pkg_vercmp(const char *ver1, const char *ver2);
|
int alpm_pkg_vercmp(const char *ver1, const char *ver2);
|
||||||
char *alpm_pkg_name_hasarch(char *pkgname);
|
char *alpm_pkg_name_hasarch(char *pkgname);
|
||||||
|
|
||||||
|
const char *alpm_pkg_get_filename(pmpkg_t *pkg);
|
||||||
const char *alpm_pkg_get_name(pmpkg_t *pkg);
|
const char *alpm_pkg_get_name(pmpkg_t *pkg);
|
||||||
const char *alpm_pkg_get_version(pmpkg_t *pkg);
|
const char *alpm_pkg_get_version(pmpkg_t *pkg);
|
||||||
const char *alpm_pkg_get_desc(pmpkg_t *pkg);
|
const char *alpm_pkg_get_desc(pmpkg_t *pkg);
|
||||||
@ -212,7 +213,7 @@ const char *alpm_pkg_get_md5sum(pmpkg_t *pkg);
|
|||||||
const char *alpm_pkg_get_sha1sum(pmpkg_t *pkg);
|
const char *alpm_pkg_get_sha1sum(pmpkg_t *pkg);
|
||||||
const char *alpm_pkg_get_arch(pmpkg_t *pkg);
|
const char *alpm_pkg_get_arch(pmpkg_t *pkg);
|
||||||
unsigned long alpm_pkg_get_size(pmpkg_t *pkg);
|
unsigned long alpm_pkg_get_size(pmpkg_t *pkg);
|
||||||
unsigned long alpm_pkg_get_usize(pmpkg_t *pkg);
|
unsigned long alpm_pkg_get_isize(pmpkg_t *pkg);
|
||||||
unsigned char alpm_pkg_get_reason(pmpkg_t *pkg);
|
unsigned char alpm_pkg_get_reason(pmpkg_t *pkg);
|
||||||
pmlist_t *alpm_pkg_get_licenses(pmpkg_t *pkg);
|
pmlist_t *alpm_pkg_get_licenses(pmpkg_t *pkg);
|
||||||
pmlist_t *alpm_pkg_get_groups(pmpkg_t *pkg);
|
pmlist_t *alpm_pkg_get_groups(pmpkg_t *pkg);
|
||||||
@ -331,15 +332,10 @@ typedef void (*alpm_trans_cb_conv)(unsigned char, void *, void *, void *, int *)
|
|||||||
/* Transaction Progress callback */
|
/* Transaction Progress callback */
|
||||||
typedef void (*alpm_trans_cb_progress)(unsigned char, char *, int, int, int);
|
typedef void (*alpm_trans_cb_progress)(unsigned char, char *, int, int, int);
|
||||||
|
|
||||||
/* Info parameters */
|
unsigned char alpm_trans_get_type();
|
||||||
enum {
|
unsigned int alpm_trans_get_flags();
|
||||||
PM_TRANS_TYPE = 1,
|
pmlist_t * alpm_trans_get_targets();
|
||||||
PM_TRANS_FLAGS,
|
pmlist_t * alpm_trans_get_packages();
|
||||||
PM_TRANS_TARGETS,
|
|
||||||
PM_TRANS_PACKAGES
|
|
||||||
};
|
|
||||||
|
|
||||||
void *alpm_trans_getinfo(unsigned char parm);
|
|
||||||
int alpm_trans_init(unsigned char type, unsigned int flags, alpm_trans_cb_event cb_event, alpm_trans_cb_conv conv, alpm_trans_cb_progress cb_progress);
|
int alpm_trans_init(unsigned char type, unsigned int flags, alpm_trans_cb_event cb_event, alpm_trans_cb_conv conv, alpm_trans_cb_progress cb_progress);
|
||||||
int alpm_trans_sysupgrade(void);
|
int alpm_trans_sysupgrade(void);
|
||||||
int alpm_trans_addtarget(char *target);
|
int alpm_trans_addtarget(char *target);
|
||||||
@ -362,16 +358,12 @@ enum {
|
|||||||
PM_DEP_TYPE_REQUIRED,
|
PM_DEP_TYPE_REQUIRED,
|
||||||
PM_DEP_TYPE_CONFLICT
|
PM_DEP_TYPE_CONFLICT
|
||||||
};
|
};
|
||||||
/* Info parameters */
|
|
||||||
enum {
|
|
||||||
PM_DEP_TARGET = 1,
|
|
||||||
PM_DEP_TYPE,
|
|
||||||
PM_DEP_MOD,
|
|
||||||
PM_DEP_NAME,
|
|
||||||
PM_DEP_VERSION
|
|
||||||
};
|
|
||||||
|
|
||||||
void *alpm_dep_getinfo(pmdepmissing_t *miss, unsigned char parm);
|
const char *alpm_dep_get_target(pmdepmissing_t *miss);
|
||||||
|
unsigned char alpm_dep_get_type(pmdepmissing_t *miss);
|
||||||
|
unsigned char alpm_dep_get_mod(pmdepmissing_t *miss);
|
||||||
|
const char *alpm_dep_get_name(pmdepmissing_t *miss);
|
||||||
|
const char *alpm_dep_get_version(pmdepmissing_t *miss);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* File conflicts
|
* File conflicts
|
||||||
@ -381,15 +373,11 @@ enum {
|
|||||||
PM_CONFLICT_TYPE_TARGET = 1,
|
PM_CONFLICT_TYPE_TARGET = 1,
|
||||||
PM_CONFLICT_TYPE_FILE
|
PM_CONFLICT_TYPE_FILE
|
||||||
};
|
};
|
||||||
/* Info parameters */
|
|
||||||
enum {
|
|
||||||
PM_CONFLICT_TARGET = 1,
|
|
||||||
PM_CONFLICT_TYPE,
|
|
||||||
PM_CONFLICT_FILE,
|
|
||||||
PM_CONFLICT_CTARGET
|
|
||||||
};
|
|
||||||
|
|
||||||
void *alpm_conflict_getinfo(pmconflict_t *conflict, unsigned char parm);
|
const char *alpm_conflict_get_target(pmconflict_t *conflict);
|
||||||
|
unsigned char alpm_conflict_get_type(pmconflict_t *conflict);
|
||||||
|
const char *alpm_conflict_get_file(pmconflict_t *conflict);
|
||||||
|
const char *alpm_conflict_get_ctarget(pmconflict_t *conflict);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Helpers
|
* Helpers
|
||||||
@ -398,6 +386,7 @@ void *alpm_conflict_getinfo(pmconflict_t *conflict, unsigned char parm);
|
|||||||
/* pmlist_t */
|
/* pmlist_t */
|
||||||
pmlist_t *alpm_list_first(pmlist_t *list);
|
pmlist_t *alpm_list_first(pmlist_t *list);
|
||||||
pmlist_t *alpm_list_next(pmlist_t *entry);
|
pmlist_t *alpm_list_next(pmlist_t *entry);
|
||||||
|
#define alpm_list_data(type, list) (type)alpm_list_getdata((list))
|
||||||
void *alpm_list_getdata(const pmlist_t *entry);
|
void *alpm_list_getdata(const pmlist_t *entry);
|
||||||
int alpm_list_free(pmlist_t *entry);
|
int alpm_list_free(pmlist_t *entry);
|
||||||
int alpm_list_free_outer(pmlist_t *entry);
|
int alpm_list_free_outer(pmlist_t *entry);
|
||||||
|
@ -198,6 +198,10 @@ int _alpm_db_read(pmdb_t *db, unsigned int inforeq, pmpkg_t *info)
|
|||||||
return(-1);
|
return(-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(info->infolevel & inforeq) {
|
||||||
|
/* already loaded this info, do nothing */
|
||||||
|
return(0);
|
||||||
|
}
|
||||||
_alpm_log(PM_LOG_FUNCTION, _("loading package data for %s : level=%d"), info->name, inforeq);
|
_alpm_log(PM_LOG_FUNCTION, _("loading package data for %s : level=%d"), info->name, inforeq);
|
||||||
|
|
||||||
/* clear out 'line', to be certain - and to make valgrind happy */
|
/* clear out 'line', to be certain - and to make valgrind happy */
|
||||||
@ -223,7 +227,16 @@ int _alpm_db_read(pmdb_t *db, unsigned int inforeq, pmpkg_t *info)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
_alpm_strtrim(line);
|
_alpm_strtrim(line);
|
||||||
if(!strcmp(line, "%DESC%")) {
|
if(!strcmp(line, "%FILENAME%")) {
|
||||||
|
/* filename is _new_ - it provides the real name of the package, on the
|
||||||
|
* server, to allow for us to not tie the name of the actual file to the
|
||||||
|
* data of the package
|
||||||
|
*/
|
||||||
|
if(fgets(info->filename, sizeof(info->filename), fp) == NULL) {
|
||||||
|
goto error;
|
||||||
|
}
|
||||||
|
_alpm_strtrim(info->filename);
|
||||||
|
} else if(!strcmp(line, "%DESC%")) {
|
||||||
while(fgets(line, 512, fp) && strlen(_alpm_strtrim(line))) {
|
while(fgets(line, 512, fp) && strlen(_alpm_strtrim(line))) {
|
||||||
info->desc_localized = _alpm_list_add(info->desc_localized, strdup(line));
|
info->desc_localized = _alpm_list_add(info->desc_localized, strdup(line));
|
||||||
}
|
}
|
||||||
@ -305,15 +318,15 @@ int _alpm_db_read(pmdb_t *db, unsigned int inforeq, pmpkg_t *info)
|
|||||||
}
|
}
|
||||||
_alpm_strtrim(tmp);
|
_alpm_strtrim(tmp);
|
||||||
info->size = atol(tmp);
|
info->size = atol(tmp);
|
||||||
} else if(!strcmp(line, "%USIZE%")) {
|
} else if(!strcmp(line, "%ISIZE%")) {
|
||||||
/* USIZE (uncompressed size) tag only appears in sync repositories,
|
/* ISIZE (installed size) tag only appears in sync repositories,
|
||||||
* not the local one. */
|
* not the local one. */
|
||||||
char tmp[32];
|
char tmp[32];
|
||||||
if(fgets(tmp, sizeof(tmp), fp) == NULL) {
|
if(fgets(tmp, sizeof(tmp), fp) == NULL) {
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
_alpm_strtrim(tmp);
|
_alpm_strtrim(tmp);
|
||||||
info->usize = atol(tmp);
|
info->isize = atol(tmp);
|
||||||
} else if(!strcmp(line, "%SHA1SUM%")) {
|
} else if(!strcmp(line, "%SHA1SUM%")) {
|
||||||
/* SHA1SUM tag only appears in sync repositories,
|
/* SHA1SUM tag only appears in sync repositories,
|
||||||
* not the local one. */
|
* not the local one. */
|
||||||
@ -525,9 +538,9 @@ int _alpm_db_write(pmdb_t *db, pmpkg_t *info, unsigned int inforeq)
|
|||||||
fprintf(fp, "%%CSIZE%%\n"
|
fprintf(fp, "%%CSIZE%%\n"
|
||||||
"%ld\n\n", info->size);
|
"%ld\n\n", info->size);
|
||||||
}
|
}
|
||||||
if(info->usize) {
|
if(info->isize) {
|
||||||
fprintf(fp, "%%USIZE%%\n"
|
fprintf(fp, "%%ISIZE%%\n"
|
||||||
"%ld\n\n", info->usize);
|
"%ld\n\n", info->isize);
|
||||||
}
|
}
|
||||||
if(info->sha1sum) {
|
if(info->sha1sum) {
|
||||||
fprintf(fp, "%%SHA1SUM%%\n"
|
fprintf(fp, "%%SHA1SUM%%\n"
|
||||||
|
@ -29,12 +29,14 @@
|
|||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
#include <stdio.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <limits.h>
|
#include <limits.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
#include <libintl.h>
|
#include <libintl.h>
|
||||||
/* pacman */
|
/* pacman */
|
||||||
|
#include "handle.h"
|
||||||
#include "list.h"
|
#include "list.h"
|
||||||
#include "trans.h"
|
#include "trans.h"
|
||||||
#include "util.h"
|
#include "util.h"
|
||||||
@ -353,4 +355,39 @@ pmlist_t *_alpm_db_find_conflicts(pmdb_t *db, pmtrans_t *trans, char *root, pmli
|
|||||||
return(conflicts);
|
return(conflicts);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const char *alpm_conflict_get_target(pmconflict_t *conflict)
|
||||||
|
{
|
||||||
|
/* Sanity checks */
|
||||||
|
ASSERT(handle != NULL, return(NULL));
|
||||||
|
ASSERT(conflict != NULL, return(NULL));
|
||||||
|
|
||||||
|
return conflict->target;
|
||||||
|
}
|
||||||
|
|
||||||
|
unsigned char alpm_conflict_get_type(pmconflict_t *conflict)
|
||||||
|
{
|
||||||
|
/* Sanity checks */
|
||||||
|
ASSERT(handle != NULL, return(-1));
|
||||||
|
ASSERT(conflict != NULL, return(-1));
|
||||||
|
|
||||||
|
return conflict->type;
|
||||||
|
}
|
||||||
|
|
||||||
|
const char *alpm_conflict_get_file(pmconflict_t *conflict)
|
||||||
|
{
|
||||||
|
/* Sanity checks */
|
||||||
|
ASSERT(handle != NULL, return(NULL));
|
||||||
|
ASSERT(conflict != NULL, return(NULL));
|
||||||
|
|
||||||
|
return conflict->file;
|
||||||
|
}
|
||||||
|
|
||||||
|
const char *alpm_conflict_get_ctarget(pmconflict_t *conflict)
|
||||||
|
{
|
||||||
|
/* Sanity checks */
|
||||||
|
ASSERT(handle != NULL, return(NULL));
|
||||||
|
ASSERT(conflict != NULL, return(NULL));
|
||||||
|
|
||||||
|
return conflict->ctarget;
|
||||||
|
}
|
||||||
/* vim: set ts=2 sw=2 noet: */
|
/* vim: set ts=2 sw=2 noet: */
|
||||||
|
@ -187,7 +187,6 @@ pmlist_t *_alpm_checkdeps(pmtrans_t *trans, pmdb_t *db, unsigned char op, pmlist
|
|||||||
{
|
{
|
||||||
pmdepend_t depend;
|
pmdepend_t depend;
|
||||||
pmlist_t *i, *j, *k;
|
pmlist_t *i, *j, *k;
|
||||||
int cmp;
|
|
||||||
int found = 0;
|
int found = 0;
|
||||||
pmlist_t *baddeps = NULL;
|
pmlist_t *baddeps = NULL;
|
||||||
pmdepmissing_t *miss = NULL;
|
pmdepmissing_t *miss = NULL;
|
||||||
@ -204,15 +203,16 @@ pmlist_t *_alpm_checkdeps(pmtrans_t *trans, pmdb_t *db, unsigned char op, pmlist
|
|||||||
pmpkg_t *tp = i->data;
|
pmpkg_t *tp = i->data;
|
||||||
pmpkg_t *oldpkg;
|
pmpkg_t *oldpkg;
|
||||||
if(tp == NULL) {
|
if(tp == NULL) {
|
||||||
|
_alpm_log(PM_LOG_DEBUG, _("null package found in package list"));
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if((oldpkg = _alpm_db_get_pkgfromcache(db, tp->name)) == NULL) {
|
if((oldpkg = _alpm_db_get_pkgfromcache(db, tp->name)) == NULL) {
|
||||||
|
_alpm_log(PM_LOG_DEBUG, _("cannot find package installed '%s'"), tp->name);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
_alpm_db_read(db, INFRQ_DEPENDS, oldpkg);
|
_alpm_db_read(db, INFRQ_DEPENDS, oldpkg);
|
||||||
for(j = oldpkg->requiredby; j; j = j->next) {
|
for(j = oldpkg->requiredby; j; j = j->next) {
|
||||||
char *ver;
|
|
||||||
pmpkg_t *p;
|
pmpkg_t *p;
|
||||||
found = 0;
|
found = 0;
|
||||||
if((p = _alpm_db_get_pkgfromcache(db, j->data)) == NULL) {
|
if((p = _alpm_db_get_pkgfromcache(db, j->data)) == NULL) {
|
||||||
@ -241,26 +241,7 @@ pmlist_t *_alpm_checkdeps(pmtrans_t *trans, pmdb_t *db, unsigned char op, pmlist
|
|||||||
/* we found an installed package that provides depend.name */
|
/* we found an installed package that provides depend.name */
|
||||||
FREELISTPTR(provides);
|
FREELISTPTR(provides);
|
||||||
}
|
}
|
||||||
found = 0;
|
if(!_alpm_depcmp(tp, &depend)) {
|
||||||
if(depend.mod == PM_DEP_MOD_ANY) {
|
|
||||||
found = 1;
|
|
||||||
} else {
|
|
||||||
/* note that we use the version from the NEW package in the check */
|
|
||||||
ver = strdup(tp->version);
|
|
||||||
if(!index(depend.version,'-')) {
|
|
||||||
char *ptr;
|
|
||||||
for(ptr = ver; *ptr != '-'; ptr++);
|
|
||||||
*ptr = '\0';
|
|
||||||
}
|
|
||||||
cmp = _alpm_versioncmp(ver, depend.version);
|
|
||||||
switch(depend.mod) {
|
|
||||||
case PM_DEP_MOD_EQ: found = (cmp == 0); break;
|
|
||||||
case PM_DEP_MOD_GE: found = (cmp >= 0); break;
|
|
||||||
case PM_DEP_MOD_LE: found = (cmp <= 0); break;
|
|
||||||
}
|
|
||||||
FREE(ver);
|
|
||||||
}
|
|
||||||
if(!found) {
|
|
||||||
_alpm_log(PM_LOG_DEBUG, _("checkdeps: found %s as required by %s"), depend.name, p->name);
|
_alpm_log(PM_LOG_DEBUG, _("checkdeps: found %s as required by %s"), depend.name, p->name);
|
||||||
miss = _alpm_depmiss_new(p->name, PM_DEP_TYPE_REQUIRED, depend.mod, depend.name, depend.version);
|
miss = _alpm_depmiss_new(p->name, PM_DEP_TYPE_REQUIRED, depend.mod, depend.name, depend.version);
|
||||||
if(!_alpm_depmiss_isin(miss, baddeps)) {
|
if(!_alpm_depmiss_isin(miss, baddeps)) {
|
||||||
@ -277,6 +258,7 @@ pmlist_t *_alpm_checkdeps(pmtrans_t *trans, pmdb_t *db, unsigned char op, pmlist
|
|||||||
for(i = packages; i; i = i->next) {
|
for(i = packages; i; i = i->next) {
|
||||||
pmpkg_t *tp = i->data;
|
pmpkg_t *tp = i->data;
|
||||||
if(tp == NULL) {
|
if(tp == NULL) {
|
||||||
|
_alpm_log(PM_LOG_DEBUG, _("null package found in package list"));
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -294,29 +276,7 @@ pmlist_t *_alpm_checkdeps(pmtrans_t *trans, pmdb_t *db, unsigned char op, pmlist
|
|||||||
/* check database for literal packages */
|
/* check database for literal packages */
|
||||||
for(k = _alpm_db_get_pkgcache(db, INFRQ_DESC|INFRQ_DEPENDS); k && !found; k = k->next) {
|
for(k = _alpm_db_get_pkgcache(db, INFRQ_DESC|INFRQ_DEPENDS); k && !found; k = k->next) {
|
||||||
pmpkg_t *p = (pmpkg_t *)k->data;
|
pmpkg_t *p = (pmpkg_t *)k->data;
|
||||||
if(!strcmp(p->name, depend.name)) {
|
found = _alpm_depcmp(p, &depend);
|
||||||
if(depend.mod == PM_DEP_MOD_ANY) {
|
|
||||||
/* accept any version */
|
|
||||||
found = 1;
|
|
||||||
} else {
|
|
||||||
char *ver = strdup(p->version);
|
|
||||||
/* check for a release in depend.version. if it's
|
|
||||||
* missing remove it from p->version as well.
|
|
||||||
*/
|
|
||||||
if(!index(depend.version,'-')) {
|
|
||||||
char *ptr;
|
|
||||||
for(ptr = ver; *ptr != '-'; ptr++);
|
|
||||||
*ptr = '\0';
|
|
||||||
}
|
|
||||||
cmp = _alpm_versioncmp(ver, depend.version);
|
|
||||||
switch(depend.mod) {
|
|
||||||
case PM_DEP_MOD_EQ: found = (cmp == 0); break;
|
|
||||||
case PM_DEP_MOD_GE: found = (cmp >= 0); break;
|
|
||||||
case PM_DEP_MOD_LE: found = (cmp <= 0); break;
|
|
||||||
}
|
|
||||||
FREE(ver);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
/* check database for provides matches */
|
/* check database for provides matches */
|
||||||
if(!found) {
|
if(!found) {
|
||||||
@ -340,57 +300,14 @@ pmlist_t *_alpm_checkdeps(pmtrans_t *trans, pmdb_t *db, unsigned char op, pmlist
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(depend.mod == PM_DEP_MOD_ANY) {
|
found = _alpm_depcmp(p, &depend);
|
||||||
/* accept any version */
|
|
||||||
found = 1;
|
|
||||||
} else {
|
|
||||||
char *ver = strdup(p->version);
|
|
||||||
/* check for a release in depend.version. if it's
|
|
||||||
* missing remove it from p->version as well.
|
|
||||||
*/
|
|
||||||
if(!index(depend.version,'-')) {
|
|
||||||
char *ptr;
|
|
||||||
for(ptr = ver; *ptr != '-'; ptr++);
|
|
||||||
*ptr = '\0';
|
|
||||||
}
|
|
||||||
cmp = _alpm_versioncmp(ver, depend.version);
|
|
||||||
switch(depend.mod) {
|
|
||||||
case PM_DEP_MOD_EQ: found = (cmp == 0); break;
|
|
||||||
case PM_DEP_MOD_GE: found = (cmp >= 0); break;
|
|
||||||
case PM_DEP_MOD_LE: found = (cmp <= 0); break;
|
|
||||||
}
|
|
||||||
FREE(ver);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
FREELISTPTR(k);
|
FREELISTPTR(k);
|
||||||
}
|
}
|
||||||
/* check other targets */
|
/* check other targets */
|
||||||
for(k = packages; k && !found; k = k->next) {
|
for(k = packages; k && !found; k = k->next) {
|
||||||
pmpkg_t *p = (pmpkg_t *)k->data;
|
pmpkg_t *p = (pmpkg_t *)k->data;
|
||||||
/* see if the package names match OR if p provides depend.name */
|
found = _alpm_depcmp(p, &depend);
|
||||||
if(!strcmp(p->name, depend.name) || _alpm_list_is_strin(depend.name, p->provides)) {
|
|
||||||
if(depend.mod == PM_DEP_MOD_ANY) {
|
|
||||||
/* accept any version */
|
|
||||||
found = 1;
|
|
||||||
} else {
|
|
||||||
char *ver = strdup(p->version);
|
|
||||||
/* check for a release in depend.version. if it's
|
|
||||||
* missing remove it from p->version as well.
|
|
||||||
*/
|
|
||||||
if(!index(depend.version,'-')) {
|
|
||||||
char *ptr;
|
|
||||||
for(ptr = ver; *ptr != '-'; ptr++);
|
|
||||||
*ptr = '\0';
|
|
||||||
}
|
|
||||||
cmp = _alpm_versioncmp(ver, depend.version);
|
|
||||||
switch(depend.mod) {
|
|
||||||
case PM_DEP_MOD_EQ: found = (cmp == 0); break;
|
|
||||||
case PM_DEP_MOD_GE: found = (cmp >= 0); break;
|
|
||||||
case PM_DEP_MOD_LE: found = (cmp <= 0); break;
|
|
||||||
}
|
|
||||||
FREE(ver);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
/* else if still not found... */
|
/* else if still not found... */
|
||||||
if(!found) {
|
if(!found) {
|
||||||
@ -701,4 +618,48 @@ error:
|
|||||||
return(-1);
|
return(-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const char *alpm_dep_get_target(pmdepmissing_t *miss)
|
||||||
|
{
|
||||||
|
/* Sanity checks */
|
||||||
|
ASSERT(handle != NULL, return(NULL));
|
||||||
|
ASSERT(miss != NULL, return(NULL));
|
||||||
|
|
||||||
|
return miss->target;
|
||||||
|
}
|
||||||
|
|
||||||
|
unsigned char alpm_dep_get_type(pmdepmissing_t *miss)
|
||||||
|
{
|
||||||
|
/* Sanity checks */
|
||||||
|
ASSERT(handle != NULL, return(-1));
|
||||||
|
ASSERT(miss != NULL, return(-1));
|
||||||
|
|
||||||
|
return miss->type;
|
||||||
|
}
|
||||||
|
|
||||||
|
unsigned char alpm_dep_get_mod(pmdepmissing_t *miss)
|
||||||
|
{
|
||||||
|
/* Sanity checks */
|
||||||
|
ASSERT(handle != NULL, return(-1));
|
||||||
|
ASSERT(miss != NULL, return(-1));
|
||||||
|
|
||||||
|
return miss->depend.mod;
|
||||||
|
}
|
||||||
|
|
||||||
|
const char *alpm_dep_get_name(pmdepmissing_t *miss)
|
||||||
|
{
|
||||||
|
/* Sanity checks */
|
||||||
|
ASSERT(handle != NULL, return(NULL));
|
||||||
|
ASSERT(miss != NULL, return(NULL));
|
||||||
|
|
||||||
|
return miss->depend.name;
|
||||||
|
}
|
||||||
|
|
||||||
|
const char *alpm_dep_get_version(pmdepmissing_t *miss)
|
||||||
|
{
|
||||||
|
/* Sanity checks */
|
||||||
|
ASSERT(handle != NULL, return(NULL));
|
||||||
|
ASSERT(miss != NULL, return(NULL));
|
||||||
|
|
||||||
|
return miss->depend.version;
|
||||||
|
}
|
||||||
/* vim: set ts=2 sw=2 noet: */
|
/* vim: set ts=2 sw=2 noet: */
|
||||||
|
@ -25,6 +25,7 @@
|
|||||||
|
|
||||||
#include "db.h"
|
#include "db.h"
|
||||||
#include "sync.h"
|
#include "sync.h"
|
||||||
|
#include "package.h"
|
||||||
#include "alpm.h"
|
#include "alpm.h"
|
||||||
|
|
||||||
/* Dependency */
|
/* Dependency */
|
||||||
|
@ -58,6 +58,7 @@ pmpkg_t *_alpm_pkg_new(const char *name, const char *version)
|
|||||||
} else {
|
} else {
|
||||||
pkg->version[0] = '\0';
|
pkg->version[0] = '\0';
|
||||||
}
|
}
|
||||||
|
pkg->filename[0] = '\0';
|
||||||
pkg->desc[0] = '\0';
|
pkg->desc[0] = '\0';
|
||||||
pkg->url[0] = '\0';
|
pkg->url[0] = '\0';
|
||||||
pkg->license = NULL;
|
pkg->license = NULL;
|
||||||
@ -70,7 +71,7 @@ pmpkg_t *_alpm_pkg_new(const char *name, const char *version)
|
|||||||
pkg->sha1sum[0] = '\0';
|
pkg->sha1sum[0] = '\0';
|
||||||
pkg->arch[0] = '\0';
|
pkg->arch[0] = '\0';
|
||||||
pkg->size = 0;
|
pkg->size = 0;
|
||||||
pkg->usize = 0;
|
pkg->isize = 0;
|
||||||
pkg->scriptlet = 0;
|
pkg->scriptlet = 0;
|
||||||
pkg->force = 0;
|
pkg->force = 0;
|
||||||
pkg->reason = PM_PKG_REASON_EXPLICIT;
|
pkg->reason = PM_PKG_REASON_EXPLICIT;
|
||||||
@ -101,6 +102,7 @@ pmpkg_t *_alpm_pkg_dup(pmpkg_t *pkg)
|
|||||||
RET_ERR(PM_ERR_MEMORY, NULL);
|
RET_ERR(PM_ERR_MEMORY, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
STRNCPY(newpkg->filename, pkg->filename, PKG_FILENAME_LEN);
|
||||||
STRNCPY(newpkg->name, pkg->name, PKG_NAME_LEN);
|
STRNCPY(newpkg->name, pkg->name, PKG_NAME_LEN);
|
||||||
STRNCPY(newpkg->version, pkg->version, PKG_VERSION_LEN);
|
STRNCPY(newpkg->version, pkg->version, PKG_VERSION_LEN);
|
||||||
STRNCPY(newpkg->desc, pkg->desc, PKG_DESC_LEN);
|
STRNCPY(newpkg->desc, pkg->desc, PKG_DESC_LEN);
|
||||||
@ -113,7 +115,7 @@ pmpkg_t *_alpm_pkg_dup(pmpkg_t *pkg)
|
|||||||
STRNCPY(newpkg->sha1sum, pkg->sha1sum, PKG_SHA1SUM_LEN);
|
STRNCPY(newpkg->sha1sum, pkg->sha1sum, PKG_SHA1SUM_LEN);
|
||||||
STRNCPY(newpkg->arch, pkg->arch, PKG_ARCH_LEN);
|
STRNCPY(newpkg->arch, pkg->arch, PKG_ARCH_LEN);
|
||||||
newpkg->size = pkg->size;
|
newpkg->size = pkg->size;
|
||||||
newpkg->usize = pkg->usize;
|
newpkg->isize = pkg->isize;
|
||||||
newpkg->force = pkg->force;
|
newpkg->force = pkg->force;
|
||||||
newpkg->scriptlet = pkg->scriptlet;
|
newpkg->scriptlet = pkg->scriptlet;
|
||||||
newpkg->reason = pkg->reason;
|
newpkg->reason = pkg->reason;
|
||||||
@ -244,10 +246,10 @@ static int parse_descfile(char *descfile, pmpkg_t *info, int output)
|
|||||||
char tmp[32];
|
char tmp[32];
|
||||||
STRNCPY(tmp, ptr, sizeof(tmp));
|
STRNCPY(tmp, ptr, sizeof(tmp));
|
||||||
info->size = atol(ptr);
|
info->size = atol(ptr);
|
||||||
} else if(!strcmp(key, "USIZE")) {
|
} else if(!strcmp(key, "ISIZE")) {
|
||||||
char tmp[32];
|
char tmp[32];
|
||||||
STRNCPY(tmp, ptr, sizeof(tmp));
|
STRNCPY(tmp, ptr, sizeof(tmp));
|
||||||
info->usize = atol(ptr);
|
info->isize = atol(ptr);
|
||||||
} else if(!strcmp(key, "DEPEND")) {
|
} else if(!strcmp(key, "DEPEND")) {
|
||||||
info->depends = _alpm_list_add(info->depends, strdup(ptr));
|
info->depends = _alpm_list_add(info->depends, strdup(ptr));
|
||||||
} else if(!strcmp(key, "REMOVE")) {
|
} else if(!strcmp(key, "REMOVE")) {
|
||||||
@ -437,30 +439,6 @@ pmpkg_t *_alpm_pkg_isin(char *needle, pmlist_t *haystack)
|
|||||||
return(NULL);
|
return(NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
char *_alpm_pkg_makefilename(pmpkg_t *pkg)
|
|
||||||
{
|
|
||||||
char *fname = NULL;
|
|
||||||
int len = 0, arch_valid = 0;
|
|
||||||
|
|
||||||
len = strlen(pkg->name) + strlen(pkg->version) + strlen(PM_EXT_PKG) + 3;
|
|
||||||
if(pkg->arch && strlen(pkg->arch) > 0) {
|
|
||||||
arch_valid = 1;
|
|
||||||
len += strlen(pkg->arch) + 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
if((fname = (char *)calloc(len, sizeof(char))) == NULL) {
|
|
||||||
RET_ERR(PM_ERR_MEMORY, NULL);
|
|
||||||
}
|
|
||||||
|
|
||||||
if(arch_valid) {
|
|
||||||
snprintf(fname, len-1, "%s-%s-%s" PM_EXT_PKG, pkg->name, pkg->version, pkg->arch);
|
|
||||||
} else {
|
|
||||||
snprintf(fname, len-1, "%s-%s" PM_EXT_PKG, pkg->name, pkg->version);
|
|
||||||
}
|
|
||||||
|
|
||||||
return fname;
|
|
||||||
}
|
|
||||||
|
|
||||||
int _alpm_pkg_splitname(char *target, char *name, char *version, int witharch)
|
int _alpm_pkg_splitname(char *target, char *name, char *version, int witharch)
|
||||||
{
|
{
|
||||||
char tmp[PKG_FULLNAME_LEN+7];
|
char tmp[PKG_FULLNAME_LEN+7];
|
||||||
@ -511,6 +489,24 @@ int _alpm_pkg_splitname(char *target, char *name, char *version, int witharch)
|
|||||||
return(0);
|
return(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const char *alpm_pkg_get_filename(pmpkg_t *pkg)
|
||||||
|
{
|
||||||
|
/* Sanity checks */
|
||||||
|
ASSERT(handle != NULL, return(NULL));
|
||||||
|
ASSERT(pkg != NULL, return(NULL));
|
||||||
|
|
||||||
|
if(!strlen(pkg->filename)) {
|
||||||
|
/* construct the file name, it's not in the desc file */
|
||||||
|
if(pkg->arch && strlen(pkg->arch) > 0) {
|
||||||
|
snprintf(pkg->filename, PKG_FILENAME_LEN, "%s-%s-%s" PM_EXT_PKG, pkg->name, pkg->version, pkg->arch);
|
||||||
|
} else {
|
||||||
|
snprintf(pkg->filename, PKG_FILENAME_LEN, "%s-%s" PM_EXT_PKG, pkg->name, pkg->version);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return pkg->filename;
|
||||||
|
}
|
||||||
|
|
||||||
const char *alpm_pkg_get_name(pmpkg_t *pkg)
|
const char *alpm_pkg_get_name(pmpkg_t *pkg)
|
||||||
{
|
{
|
||||||
/* Sanity checks */
|
/* Sanity checks */
|
||||||
@ -649,7 +645,7 @@ unsigned long alpm_pkg_get_size(pmpkg_t *pkg)
|
|||||||
return pkg->size;
|
return pkg->size;
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned long alpm_pkg_get_usize(pmpkg_t *pkg)
|
unsigned long alpm_pkg_get_isize(pmpkg_t *pkg)
|
||||||
{
|
{
|
||||||
/* Sanity checks */
|
/* Sanity checks */
|
||||||
ASSERT(handle != NULL, return(-1));
|
ASSERT(handle != NULL, return(-1));
|
||||||
@ -658,7 +654,7 @@ unsigned long alpm_pkg_get_usize(pmpkg_t *pkg)
|
|||||||
if(pkg->origin == PKG_FROM_CACHE && !(pkg->infolevel & INFRQ_DESC)) {
|
if(pkg->origin == PKG_FROM_CACHE && !(pkg->infolevel & INFRQ_DESC)) {
|
||||||
_alpm_db_read(pkg->data, INFRQ_DESC, pkg);
|
_alpm_db_read(pkg->data, INFRQ_DESC, pkg);
|
||||||
}
|
}
|
||||||
return pkg->usize;
|
return pkg->isize;
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned char alpm_pkg_get_reason(pmpkg_t *pkg)
|
unsigned char alpm_pkg_get_reason(pmpkg_t *pkg)
|
||||||
|
@ -37,6 +37,7 @@ enum {
|
|||||||
};
|
};
|
||||||
|
|
||||||
/* Packages */
|
/* Packages */
|
||||||
|
#define PKG_FILENAME_LEN 512
|
||||||
#define PKG_NAME_LEN 256
|
#define PKG_NAME_LEN 256
|
||||||
#define PKG_VERSION_LEN 64
|
#define PKG_VERSION_LEN 64
|
||||||
#define PKG_FULLNAME_LEN (PKG_NAME_LEN-1)+1+(PKG_VERSION_LEN-1)+1
|
#define PKG_FULLNAME_LEN (PKG_NAME_LEN-1)+1+(PKG_VERSION_LEN-1)+1
|
||||||
@ -50,6 +51,7 @@ enum {
|
|||||||
#define PKG_ARCH_LEN 32
|
#define PKG_ARCH_LEN 32
|
||||||
|
|
||||||
struct __pmpkg_t {
|
struct __pmpkg_t {
|
||||||
|
char filename[PKG_FILENAME_LEN];
|
||||||
char name[PKG_NAME_LEN];
|
char name[PKG_NAME_LEN];
|
||||||
char version[PKG_VERSION_LEN];
|
char version[PKG_VERSION_LEN];
|
||||||
char desc[PKG_DESC_LEN];
|
char desc[PKG_DESC_LEN];
|
||||||
@ -62,7 +64,7 @@ struct __pmpkg_t {
|
|||||||
char sha1sum[PKG_SHA1SUM_LEN];
|
char sha1sum[PKG_SHA1SUM_LEN];
|
||||||
char arch[PKG_ARCH_LEN];
|
char arch[PKG_ARCH_LEN];
|
||||||
unsigned long size;
|
unsigned long size;
|
||||||
unsigned long usize;
|
unsigned long isize;
|
||||||
unsigned char scriptlet;
|
unsigned char scriptlet;
|
||||||
unsigned char force;
|
unsigned char force;
|
||||||
time_t date;
|
time_t date;
|
||||||
@ -93,7 +95,6 @@ void _alpm_pkg_free(void *data);
|
|||||||
int _alpm_pkg_cmp(const void *p1, const void *p2);
|
int _alpm_pkg_cmp(const void *p1, const void *p2);
|
||||||
pmpkg_t *_alpm_pkg_load(char *pkgfile);
|
pmpkg_t *_alpm_pkg_load(char *pkgfile);
|
||||||
pmpkg_t *_alpm_pkg_isin(char *needle, pmlist_t *haystack);
|
pmpkg_t *_alpm_pkg_isin(char *needle, pmlist_t *haystack);
|
||||||
char *_alpm_pkg_makefilename(pmpkg_t *pkg);
|
|
||||||
int _alpm_pkg_splitname(char *target, char *name, char *version, int witharch);
|
int _alpm_pkg_splitname(char *target, char *name, char *version, int witharch);
|
||||||
|
|
||||||
|
|
||||||
|
@ -785,12 +785,12 @@ int _alpm_sync_commit(pmtrans_t *trans, pmdb_t *db_local, pmlist_t **data)
|
|||||||
pmdb_t *dbs = spkg->data;
|
pmdb_t *dbs = spkg->data;
|
||||||
|
|
||||||
if(current == dbs) {
|
if(current == dbs) {
|
||||||
char *fname = NULL;
|
const char *fname = NULL;
|
||||||
char path[PATH_MAX];
|
char path[PATH_MAX];
|
||||||
|
|
||||||
fname = _alpm_pkg_makefilename(spkg);
|
fname = alpm_pkg_get_filename(spkg);
|
||||||
if(trans->flags & PM_TRANS_FLAG_PRINTURIS) {
|
if(trans->flags & PM_TRANS_FLAG_PRINTURIS) {
|
||||||
EVENT(trans, PM_TRANS_EVT_PRINTURI, (char *)alpm_db_get_url(current), fname);
|
EVENT(trans, PM_TRANS_EVT_PRINTURI, (char *)alpm_db_get_url(current), (char *)fname);
|
||||||
} else {
|
} else {
|
||||||
struct stat buf;
|
struct stat buf;
|
||||||
snprintf(path, PATH_MAX, "%s/%s", ldir, fname);
|
snprintf(path, PATH_MAX, "%s/%s", ldir, fname);
|
||||||
@ -801,7 +801,6 @@ int _alpm_sync_commit(pmtrans_t *trans, pmdb_t *db_local, pmlist_t **data)
|
|||||||
_alpm_log(PM_LOG_DEBUG, _("%s is already in the cache\n"), fname);
|
_alpm_log(PM_LOG_DEBUG, _("%s is already in the cache\n"), fname);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
FREE(fname);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -840,11 +839,12 @@ int _alpm_sync_commit(pmtrans_t *trans, pmdb_t *db_local, pmlist_t **data)
|
|||||||
for(i = trans->packages; i; i = i->next) {
|
for(i = trans->packages; i; i = i->next) {
|
||||||
pmsyncpkg_t *sync = i->data;
|
pmsyncpkg_t *sync = i->data;
|
||||||
pmpkg_t *spkg = sync->pkg;
|
pmpkg_t *spkg = sync->pkg;
|
||||||
char str[PATH_MAX], *pkgname;
|
char str[PATH_MAX];
|
||||||
|
const char *pkgname;
|
||||||
char *md5sum1, *md5sum2, *sha1sum1, *sha1sum2;
|
char *md5sum1, *md5sum2, *sha1sum1, *sha1sum2;
|
||||||
char *ptr=NULL;
|
char *ptr=NULL;
|
||||||
|
|
||||||
pkgname = _alpm_pkg_makefilename(spkg);
|
pkgname = alpm_pkg_get_filename(spkg);
|
||||||
md5sum1 = spkg->md5sum;
|
md5sum1 = spkg->md5sum;
|
||||||
sha1sum1 = spkg->sha1sum;
|
sha1sum1 = spkg->sha1sum;
|
||||||
|
|
||||||
@ -877,7 +877,7 @@ int _alpm_sync_commit(pmtrans_t *trans, pmdb_t *db_local, pmlist_t **data)
|
|||||||
if(trans->flags & PM_TRANS_FLAG_ALLDEPS) {
|
if(trans->flags & PM_TRANS_FLAG_ALLDEPS) {
|
||||||
doremove=1;
|
doremove=1;
|
||||||
} else {
|
} else {
|
||||||
QUESTION(trans, PM_TRANS_CONV_CORRUPTED_PKG, pkgname, NULL, NULL, &doremove);
|
QUESTION(trans, PM_TRANS_CONV_CORRUPTED_PKG, (char *)pkgname, NULL, NULL, &doremove);
|
||||||
}
|
}
|
||||||
if(doremove) {
|
if(doremove) {
|
||||||
char str[PATH_MAX];
|
char str[PATH_MAX];
|
||||||
@ -890,7 +890,6 @@ int _alpm_sync_commit(pmtrans_t *trans, pmdb_t *db_local, pmlist_t **data)
|
|||||||
*data = _alpm_list_add(*data, ptr);
|
*data = _alpm_list_add(*data, ptr);
|
||||||
retval = 1;
|
retval = 1;
|
||||||
}
|
}
|
||||||
FREE(pkgname);
|
|
||||||
FREE(md5sum2);
|
FREE(md5sum2);
|
||||||
FREE(sha1sum2);
|
FREE(sha1sum2);
|
||||||
}
|
}
|
||||||
@ -963,10 +962,10 @@ int _alpm_sync_commit(pmtrans_t *trans, pmdb_t *db_local, pmlist_t **data)
|
|||||||
pmsyncpkg_t *sync = i->data;
|
pmsyncpkg_t *sync = i->data;
|
||||||
pmpkg_t *spkg = sync->pkg;
|
pmpkg_t *spkg = sync->pkg;
|
||||||
|
|
||||||
char *fname = NULL;
|
const char *fname = NULL;
|
||||||
char str[PATH_MAX];
|
char str[PATH_MAX];
|
||||||
|
|
||||||
fname = _alpm_pkg_makefilename(spkg);
|
fname = alpm_pkg_get_filename(spkg);
|
||||||
snprintf(str, PATH_MAX, "%s%s/%s", handle->root, handle->cachedir, fname);
|
snprintf(str, PATH_MAX, "%s%s/%s", handle->root, handle->cachedir, fname);
|
||||||
if(_alpm_trans_addtarget(tr, str) == -1) {
|
if(_alpm_trans_addtarget(tr, str) == -1) {
|
||||||
goto error;
|
goto error;
|
||||||
|
@ -226,4 +226,39 @@ int _alpm_trans_commit(pmtrans_t *trans, pmlist_t **data)
|
|||||||
return(0);
|
return(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
unsigned char alpm_trans_get_type()
|
||||||
|
{
|
||||||
|
/* Sanity checks */
|
||||||
|
ASSERT(handle != NULL, return(-1));
|
||||||
|
ASSERT(handle->trans != NULL, return(-1));
|
||||||
|
|
||||||
|
return handle->trans->type;
|
||||||
|
}
|
||||||
|
|
||||||
|
unsigned int alpm_trans_get_flags()
|
||||||
|
{
|
||||||
|
/* Sanity checks */
|
||||||
|
ASSERT(handle != NULL, return(-1));
|
||||||
|
ASSERT(handle->trans != NULL, return(-1));
|
||||||
|
|
||||||
|
return handle->trans->flags;
|
||||||
|
}
|
||||||
|
|
||||||
|
pmlist_t * alpm_trans_get_targets()
|
||||||
|
{
|
||||||
|
/* Sanity checks */
|
||||||
|
ASSERT(handle != NULL, return(NULL));
|
||||||
|
ASSERT(handle->trans != NULL, return(NULL));
|
||||||
|
|
||||||
|
return handle->trans->targets;
|
||||||
|
}
|
||||||
|
|
||||||
|
pmlist_t * alpm_trans_get_packages()
|
||||||
|
{
|
||||||
|
/* Sanity checks */
|
||||||
|
ASSERT(handle != NULL, return(NULL));
|
||||||
|
ASSERT(handle->trans != NULL, return(NULL));
|
||||||
|
|
||||||
|
return handle->trans->packages;
|
||||||
|
}
|
||||||
/* vim: set ts=2 sw=2 noet: */
|
/* vim: set ts=2 sw=2 noet: */
|
||||||
|
@ -511,13 +511,16 @@ int _alpm_runscriptlet(char *root, char *installfn, char *script, char *ver, cha
|
|||||||
if(fgets(line, 1024, pp) == NULL)
|
if(fgets(line, 1024, pp) == NULL)
|
||||||
break;
|
break;
|
||||||
/* "START <event desc>" */
|
/* "START <event desc>" */
|
||||||
if((strlen(line) > strlen(STARTSTR)) && !strncmp(line, STARTSTR, strlen(STARTSTR))) {
|
if((strlen(line) > strlen(SCRIPTLET_START)) && !strncmp(line, SCRIPTLET_START, strlen(SCRIPTLET_START))) {
|
||||||
EVENT(trans, PM_TRANS_EVT_SCRIPTLET_START, _alpm_strtrim(line + strlen(STARTSTR)), NULL);
|
EVENT(trans, PM_TRANS_EVT_SCRIPTLET_START, _alpm_strtrim(line + strlen(SCRIPTLET_START)), NULL);
|
||||||
/* "DONE <ret code>" */
|
/* "DONE <ret code>" */
|
||||||
} else if((strlen(line) > strlen(DONESTR)) && !strncmp(line, DONESTR, strlen(DONESTR))) {
|
} else if((strlen(line) > strlen(SCRIPTLET_DONE)) && !strncmp(line, SCRIPTLET_DONE, strlen(SCRIPTLET_DONE))) {
|
||||||
EVENT(trans, PM_TRANS_EVT_SCRIPTLET_DONE, (void*)atol(_alpm_strtrim(line + strlen(DONESTR))), NULL);
|
EVENT(trans, PM_TRANS_EVT_SCRIPTLET_DONE, (void*)atol(_alpm_strtrim(line + strlen(SCRIPTLET_DONE))), NULL);
|
||||||
} else {
|
} else {
|
||||||
EVENT(trans, PM_TRANS_EVT_SCRIPTLET_INFO, _alpm_strtrim(line), NULL);
|
_alpm_strtrim(line);
|
||||||
|
/* log our script output */
|
||||||
|
alpm_logaction(line);
|
||||||
|
EVENT(trans, PM_TRANS_EVT_SCRIPTLET_INFO, line, NULL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
pclose(pp);
|
pclose(pp);
|
||||||
@ -577,7 +580,7 @@ int _alpm_check_freespace(pmtrans_t *trans, pmlist_t **data)
|
|||||||
pmsyncpkg_t *sync = i->data;
|
pmsyncpkg_t *sync = i->data;
|
||||||
if(sync->type != PM_SYNC_TYPE_REPLACE) {
|
if(sync->type != PM_SYNC_TYPE_REPLACE) {
|
||||||
pmpkg_t *pkg = sync->pkg;
|
pmpkg_t *pkg = sync->pkg;
|
||||||
pkgsize += pkg->usize;
|
pkgsize += pkg->isize;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -51,8 +51,8 @@
|
|||||||
#define _(s) s
|
#define _(s) s
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define STARTSTR "START "
|
#define SCRIPTLET_START "START "
|
||||||
#define DONESTR "DONE "
|
#define SCRIPTLET_DONE "DONE "
|
||||||
|
|
||||||
int _alpm_makepath(char *path);
|
int _alpm_makepath(char *path);
|
||||||
int _alpm_copyfile(char *src, char *dest);
|
int _alpm_copyfile(char *src, char *dest);
|
||||||
|
@ -26,7 +26,12 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
#include <libintl.h>
|
||||||
/* pacman */
|
/* pacman */
|
||||||
|
#include "alpm.h"
|
||||||
|
#include "log.h"
|
||||||
|
#include "util.h"
|
||||||
|
#include "list.h"
|
||||||
#include "versioncmp.h"
|
#include "versioncmp.h"
|
||||||
|
|
||||||
#ifndef HAVE_STRVERSCMP
|
#ifndef HAVE_STRVERSCMP
|
||||||
@ -238,4 +243,42 @@ int _alpm_versioncmp(const char *a, const char *b)
|
|||||||
return(*one ? 1 : -1);
|
return(*one ? 1 : -1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int _alpm_depcmp(pmpkg_t *pkg, pmdepend_t *dep)
|
||||||
|
{
|
||||||
|
int equal = 0;
|
||||||
|
|
||||||
|
if(strcmp(pkg->name, dep->name) == 0 || _alpm_list_is_strin(dep->name, pkg->provides)) {
|
||||||
|
if(dep->mod == PM_DEP_MOD_ANY) {
|
||||||
|
equal = 1;
|
||||||
|
} else {
|
||||||
|
int cmp = _alpm_versioncmp(pkg->version, dep->version);
|
||||||
|
switch(dep->mod) {
|
||||||
|
case PM_DEP_MOD_EQ: equal = (cmp == 0); break;
|
||||||
|
case PM_DEP_MOD_GE: equal = (cmp >= 0); break;
|
||||||
|
case PM_DEP_MOD_LE: equal = (cmp <= 0); break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
char *mod = "depends on";
|
||||||
|
switch(dep->mod) {
|
||||||
|
case PM_DEP_MOD_EQ: mod = "=="; break;
|
||||||
|
case PM_DEP_MOD_GE: mod = ">="; break;
|
||||||
|
case PM_DEP_MOD_LE: mod = "<="; break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(strlen(dep->version) > 0) {
|
||||||
|
_alpm_log(PM_LOG_DEBUG, _("depcmp: %s-%s %s %s-%s => %s"),
|
||||||
|
pkg->name, pkg->version, mod, dep->name, dep->version,
|
||||||
|
(equal ? "match" : "no match"));
|
||||||
|
} else {
|
||||||
|
_alpm_log(PM_LOG_DEBUG, _("depcmp: %s-%s %s %s => %s"),
|
||||||
|
pkg->name, pkg->version, mod, dep->name,
|
||||||
|
(equal ? "match" : "no match"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return equal;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/* vim: set ts=2 sw=2 noet: */
|
/* vim: set ts=2 sw=2 noet: */
|
||||||
|
@ -23,7 +23,11 @@
|
|||||||
#ifndef _PM_RPMVERCMP_H
|
#ifndef _PM_RPMVERCMP_H
|
||||||
#define _PM_RPMVERCMP_H
|
#define _PM_RPMVERCMP_H
|
||||||
|
|
||||||
|
#include "deps.h"
|
||||||
|
#include "package.h"
|
||||||
|
|
||||||
int _alpm_versioncmp(const char *a, const char *b);
|
int _alpm_versioncmp(const char *a, const char *b);
|
||||||
|
int _alpm_depcmp(pmpkg_t *pkg, pmdepend_t *dep);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -94,12 +94,12 @@ int pacman_add(list_t *targets)
|
|||||||
case PM_ERR_UNSATISFIED_DEPS:
|
case PM_ERR_UNSATISFIED_DEPS:
|
||||||
for(i = alpm_list_first(data); i; i = alpm_list_next(i)) {
|
for(i = alpm_list_first(data); i; i = alpm_list_next(i)) {
|
||||||
pmdepmissing_t *miss = alpm_list_getdata(i);
|
pmdepmissing_t *miss = alpm_list_getdata(i);
|
||||||
MSG(NL, _(":: %s: requires %s"), alpm_dep_getinfo(miss, PM_DEP_TARGET),
|
MSG(NL, _(":: %s: requires %s"), alpm_dep_get_target(miss),
|
||||||
alpm_dep_getinfo(miss, PM_DEP_NAME));
|
alpm_dep_get_name(miss));
|
||||||
switch((long)alpm_dep_getinfo(miss, PM_DEP_MOD)) {
|
switch(alpm_dep_get_mod(miss)) {
|
||||||
case PM_DEP_MOD_EQ: MSG(CL, "=%s", alpm_dep_getinfo(miss, PM_DEP_VERSION)); break;
|
case PM_DEP_MOD_EQ: MSG(CL, "=%s", alpm_dep_get_version(miss)); break;
|
||||||
case PM_DEP_MOD_GE: MSG(CL, ">=%s", alpm_dep_getinfo(miss, PM_DEP_VERSION)); break;
|
case PM_DEP_MOD_GE: MSG(CL, ">=%s", alpm_dep_get_version(miss)); break;
|
||||||
case PM_DEP_MOD_LE: MSG(CL, "<=%s", alpm_dep_getinfo(miss, PM_DEP_VERSION)); break;
|
case PM_DEP_MOD_LE: MSG(CL, "<=%s", alpm_dep_get_version(miss)); break;
|
||||||
}
|
}
|
||||||
MSG(CL, "\n");
|
MSG(CL, "\n");
|
||||||
}
|
}
|
||||||
@ -108,25 +108,25 @@ int pacman_add(list_t *targets)
|
|||||||
for(i = alpm_list_first(data); i; i = alpm_list_next(i)) {
|
for(i = alpm_list_first(data); i; i = alpm_list_next(i)) {
|
||||||
pmdepmissing_t *miss = alpm_list_getdata(i);
|
pmdepmissing_t *miss = alpm_list_getdata(i);
|
||||||
MSG(NL, _(":: %s: conflicts with %s"),
|
MSG(NL, _(":: %s: conflicts with %s"),
|
||||||
alpm_dep_getinfo(miss, PM_DEP_TARGET), alpm_dep_getinfo(miss, PM_DEP_NAME));
|
alpm_dep_get_target(miss), alpm_dep_get_name(miss));
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case PM_ERR_FILE_CONFLICTS:
|
case PM_ERR_FILE_CONFLICTS:
|
||||||
for(i = alpm_list_first(data); i; i = alpm_list_next(i)) {
|
for(i = alpm_list_first(data); i; i = alpm_list_next(i)) {
|
||||||
pmconflict_t *conflict = alpm_list_getdata(i);
|
pmconflict_t *conflict = alpm_list_getdata(i);
|
||||||
switch((long)alpm_conflict_getinfo(conflict, PM_CONFLICT_TYPE)) {
|
switch(alpm_conflict_get_type(conflict)) {
|
||||||
case PM_CONFLICT_TYPE_TARGET:
|
case PM_CONFLICT_TYPE_TARGET:
|
||||||
MSG(NL, _("%s%s exists in \"%s\" (target) and \"%s\" (target)"),
|
MSG(NL, _("%s%s exists in \"%s\" (target) and \"%s\" (target)"),
|
||||||
config->root,
|
config->root,
|
||||||
(char *)alpm_conflict_getinfo(conflict, PM_CONFLICT_FILE),
|
alpm_conflict_get_file(conflict),
|
||||||
(char *)alpm_conflict_getinfo(conflict, PM_CONFLICT_TARGET),
|
alpm_conflict_get_target(conflict),
|
||||||
(char *)alpm_conflict_getinfo(conflict, PM_CONFLICT_CTARGET));
|
alpm_conflict_get_ctarget(conflict));
|
||||||
break;
|
break;
|
||||||
case PM_CONFLICT_TYPE_FILE:
|
case PM_CONFLICT_TYPE_FILE:
|
||||||
MSG(NL, _("%s: %s%s exists in filesystem"),
|
MSG(NL, _("%s: %s%s exists in filesystem"),
|
||||||
(char *)alpm_conflict_getinfo(conflict, PM_CONFLICT_TARGET),
|
alpm_conflict_get_target(conflict),
|
||||||
config->root,
|
config->root,
|
||||||
(char *)alpm_conflict_getinfo(conflict, PM_CONFLICT_FILE));
|
alpm_conflict_get_file(conflict));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -107,15 +107,15 @@ int pacman_deptest(list_t *targets)
|
|||||||
for(lp = alpm_list_first(data); lp; lp = alpm_list_next(lp)) {
|
for(lp = alpm_list_first(data); lp; lp = alpm_list_next(lp)) {
|
||||||
pmdepmissing_t *miss = alpm_list_getdata(lp);
|
pmdepmissing_t *miss = alpm_list_getdata(lp);
|
||||||
if(!config->op_d_resolve) {
|
if(!config->op_d_resolve) {
|
||||||
MSG(NL, _("requires: %s"), alpm_dep_getinfo(miss, PM_DEP_NAME));
|
MSG(NL, _("requires: %s"), alpm_dep_get_name(miss));
|
||||||
switch((long)alpm_dep_getinfo(miss, PM_DEP_MOD)) {
|
switch(alpm_dep_get_mod(miss)) {
|
||||||
case PM_DEP_MOD_EQ: MSG(CL, "=%s", alpm_dep_getinfo(miss, PM_DEP_VERSION)); break;
|
case PM_DEP_MOD_EQ: MSG(CL, "=%s", alpm_dep_get_version(miss)); break;
|
||||||
case PM_DEP_MOD_GE: MSG(CL, ">=%s", alpm_dep_getinfo(miss, PM_DEP_VERSION)); break;
|
case PM_DEP_MOD_GE: MSG(CL, ">=%s", alpm_dep_get_version(miss)); break;
|
||||||
case PM_DEP_MOD_LE: MSG(CL, "<=%s", alpm_dep_getinfo(miss, PM_DEP_VERSION)); break;
|
case PM_DEP_MOD_LE: MSG(CL, "<=%s", alpm_dep_get_version(miss)); break;
|
||||||
}
|
}
|
||||||
MSG(CL, "\n");
|
MSG(CL, "\n");
|
||||||
}
|
}
|
||||||
synctargs = list_add(synctargs, strdup(alpm_dep_getinfo(miss, PM_DEP_NAME)));
|
synctargs = list_add(synctargs, strdup(alpm_dep_get_name(miss)));
|
||||||
}
|
}
|
||||||
alpm_list_free(data);
|
alpm_list_free(data);
|
||||||
break;
|
break;
|
||||||
@ -123,7 +123,7 @@ int pacman_deptest(list_t *targets)
|
|||||||
/* we can't auto-resolve conflicts */
|
/* we can't auto-resolve conflicts */
|
||||||
for(lp = alpm_list_first(data); lp; lp = alpm_list_next(lp)) {
|
for(lp = alpm_list_first(data); lp; lp = alpm_list_next(lp)) {
|
||||||
pmdepmissing_t *miss = alpm_list_getdata(lp);
|
pmdepmissing_t *miss = alpm_list_getdata(lp);
|
||||||
MSG(NL, _("conflict: %s"), alpm_dep_getinfo(miss, PM_DEP_NAME));
|
MSG(NL, _("conflict: %s"), alpm_dep_get_name(miss));
|
||||||
}
|
}
|
||||||
retval = 127;
|
retval = 127;
|
||||||
alpm_list_free(data);
|
alpm_list_free(data);
|
||||||
|
@ -147,7 +147,7 @@ void dump_pkg_sync(pmpkg_t *pkg, char *treename)
|
|||||||
pmlist_display(_("Replaces :"), alpm_pkg_get_replaces(pkg));
|
pmlist_display(_("Replaces :"), alpm_pkg_get_replaces(pkg));
|
||||||
|
|
||||||
printf(_("Size (compressed) : %ld\n"), (long)alpm_pkg_get_size(pkg));
|
printf(_("Size (compressed) : %ld\n"), (long)alpm_pkg_get_size(pkg));
|
||||||
printf(_("Size (uncompressed):%ld\n"), (long)alpm_pkg_get_usize(pkg));
|
printf(_("Size (installed) : %ld\n"), (long)alpm_pkg_get_isize(pkg));
|
||||||
printf(_("Description : "));
|
printf(_("Description : "));
|
||||||
indentprint(alpm_pkg_get_desc(pkg), 20);
|
indentprint(alpm_pkg_get_desc(pkg), 20);
|
||||||
|
|
||||||
|
@ -163,7 +163,8 @@ int pacman_query(list_t *targets)
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
ERR(NL, _("group \"%s\" was not found\n"), package);
|
ERR(NL, _("group \"%s\" was not found\n"), package);
|
||||||
return(2);
|
/* do not return on query operations - let's just carry on */
|
||||||
|
/*return(2);*/
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
continue;
|
continue;
|
||||||
@ -215,7 +216,9 @@ int pacman_query(list_t *targets)
|
|||||||
if(info == NULL) {
|
if(info == NULL) {
|
||||||
/* something weird happened */
|
/* something weird happened */
|
||||||
ERR(NL, _("package \"%s\" not found\n"), pkgname);
|
ERR(NL, _("package \"%s\" not found\n"), pkgname);
|
||||||
return(1);
|
/* do not return on query operations - let's just carry on */
|
||||||
|
/*return(1);*/
|
||||||
|
continue;
|
||||||
}
|
}
|
||||||
if(config->op_q_foreign) {
|
if(config->op_q_foreign) {
|
||||||
int match = 0;
|
int match = 0;
|
||||||
@ -258,7 +261,9 @@ int pacman_query(list_t *targets)
|
|||||||
info = alpm_db_readpkg(db_local, package);
|
info = alpm_db_readpkg(db_local, package);
|
||||||
if(info == NULL) {
|
if(info == NULL) {
|
||||||
ERR(NL, _("package \"%s\" not found\n"), package);
|
ERR(NL, _("package \"%s\" not found\n"), package);
|
||||||
return(2);
|
/* do not return on query operations - let's just carry on */
|
||||||
|
/*return(2);*/
|
||||||
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* find a target */
|
/* find a target */
|
||||||
|
@ -104,8 +104,8 @@ int pacman_remove(list_t *targets)
|
|||||||
case PM_ERR_UNSATISFIED_DEPS:
|
case PM_ERR_UNSATISFIED_DEPS:
|
||||||
for(lp = alpm_list_first(data); lp; lp = alpm_list_next(lp)) {
|
for(lp = alpm_list_first(data); lp; lp = alpm_list_next(lp)) {
|
||||||
pmdepmissing_t *miss = alpm_list_getdata(lp);
|
pmdepmissing_t *miss = alpm_list_getdata(lp);
|
||||||
MSG(NL, _(" %s: is required by %s\n"), alpm_dep_getinfo(miss, PM_DEP_TARGET),
|
MSG(NL, _(" %s is required by %s\n"), alpm_dep_get_target(miss),
|
||||||
alpm_dep_getinfo(miss, PM_DEP_NAME));
|
alpm_dep_get_name(miss));
|
||||||
}
|
}
|
||||||
alpm_list_free(data);
|
alpm_list_free(data);
|
||||||
break;
|
break;
|
||||||
@ -122,7 +122,7 @@ int pacman_remove(list_t *targets)
|
|||||||
pmlist_t *lp;
|
pmlist_t *lp;
|
||||||
/* list transaction targets */
|
/* list transaction targets */
|
||||||
i = NULL;
|
i = NULL;
|
||||||
for(lp = alpm_list_first(alpm_trans_getinfo(PM_TRANS_PACKAGES)); lp; lp = alpm_list_next(lp)) {
|
for(lp = alpm_list_first(alpm_trans_get_packages()); lp; lp = alpm_list_next(lp)) {
|
||||||
pmpkg_t *pkg = alpm_list_getdata(lp);
|
pmpkg_t *pkg = alpm_list_getdata(lp);
|
||||||
i = list_add(i, strdup(alpm_pkg_get_name(pkg)));
|
i = list_add(i, strdup(alpm_pkg_get_name(pkg)));
|
||||||
}
|
}
|
||||||
|
@ -410,7 +410,7 @@ int pacman_sync(list_t *targets)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if(config->op_s_upgrade) {
|
if(config->op_s_upgrade) {
|
||||||
MSG(NL, _(":: Starting local database upgrade...\n"));
|
MSG(NL, _(":: Starting full system upgrade...\n"));
|
||||||
alpm_logaction(_("starting full system upgrade"));
|
alpm_logaction(_("starting full system upgrade"));
|
||||||
if(alpm_trans_sysupgrade() == -1) {
|
if(alpm_trans_sysupgrade() == -1) {
|
||||||
ERR(NL, "%s\n", alpm_strerror(pm_errno));
|
ERR(NL, "%s\n", alpm_strerror(pm_errno));
|
||||||
@ -424,7 +424,7 @@ int pacman_sync(list_t *targets)
|
|||||||
* this can prevent some of the "syntax error" problems users can have
|
* this can prevent some of the "syntax error" problems users can have
|
||||||
* when sysupgrade'ing with an older version of pacman.
|
* when sysupgrade'ing with an older version of pacman.
|
||||||
*/
|
*/
|
||||||
data = alpm_trans_getinfo(PM_TRANS_PACKAGES);
|
data = alpm_trans_get_packages();
|
||||||
for(lp = alpm_list_first(data); lp; lp = alpm_list_next(lp)) {
|
for(lp = alpm_list_first(data); lp; lp = alpm_list_next(lp)) {
|
||||||
pmsyncpkg_t *sync = alpm_list_getdata(lp);
|
pmsyncpkg_t *sync = alpm_list_getdata(lp);
|
||||||
pmpkg_t *spkg = alpm_sync_get_package(sync);
|
pmpkg_t *spkg = alpm_sync_get_package(sync);
|
||||||
@ -535,13 +535,13 @@ int pacman_sync(list_t *targets)
|
|||||||
case PM_ERR_UNSATISFIED_DEPS:
|
case PM_ERR_UNSATISFIED_DEPS:
|
||||||
for(lp = alpm_list_first(data); lp; lp = alpm_list_next(lp)) {
|
for(lp = alpm_list_first(data); lp; lp = alpm_list_next(lp)) {
|
||||||
pmdepmissing_t *miss = alpm_list_getdata(lp);
|
pmdepmissing_t *miss = alpm_list_getdata(lp);
|
||||||
MSG(NL, ":: %s: %s %s", alpm_dep_getinfo(miss, PM_DEP_TARGET),
|
MSG(NL, ":: %s %s %s", alpm_dep_get_target(miss),
|
||||||
(long)alpm_dep_getinfo(miss, PM_DEP_TYPE) == PM_DEP_TYPE_DEPEND ? _("requires") : _("is required by"),
|
alpm_dep_get_type(miss) == PM_DEP_TYPE_DEPEND ? _("requires") : _("is required by"),
|
||||||
alpm_dep_getinfo(miss, PM_DEP_NAME));
|
alpm_dep_get_name(miss));
|
||||||
switch((long)alpm_dep_getinfo(miss, PM_DEP_MOD)) {
|
switch(alpm_dep_get_mod(miss)) {
|
||||||
case PM_DEP_MOD_EQ: MSG(CL, "=%s", alpm_dep_getinfo(miss, PM_DEP_VERSION)); break;
|
case PM_DEP_MOD_EQ: MSG(CL, "=%s", alpm_dep_get_version(miss)); break;
|
||||||
case PM_DEP_MOD_GE: MSG(CL, ">=%s", alpm_dep_getinfo(miss, PM_DEP_VERSION)); break;
|
case PM_DEP_MOD_GE: MSG(CL, ">=%s", alpm_dep_get_version(miss)); break;
|
||||||
case PM_DEP_MOD_LE: MSG(CL, "<=%s", alpm_dep_getinfo(miss, PM_DEP_VERSION)); break;
|
case PM_DEP_MOD_LE: MSG(CL, "<=%s", alpm_dep_get_version(miss)); break;
|
||||||
}
|
}
|
||||||
MSG(CL, "\n");
|
MSG(CL, "\n");
|
||||||
}
|
}
|
||||||
@ -551,7 +551,7 @@ int pacman_sync(list_t *targets)
|
|||||||
pmdepmissing_t *miss = alpm_list_getdata(lp);
|
pmdepmissing_t *miss = alpm_list_getdata(lp);
|
||||||
|
|
||||||
MSG(NL, _(":: %s: conflicts with %s"),
|
MSG(NL, _(":: %s: conflicts with %s"),
|
||||||
alpm_dep_getinfo(miss, PM_DEP_TARGET), alpm_dep_getinfo(miss, PM_DEP_NAME));
|
alpm_dep_get_target(miss), alpm_dep_get_name(miss));
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case PM_ERR_DISK_FULL:
|
case PM_ERR_DISK_FULL:
|
||||||
@ -569,7 +569,7 @@ int pacman_sync(list_t *targets)
|
|||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
packages = alpm_trans_getinfo(PM_TRANS_PACKAGES);
|
packages = alpm_trans_get_packages();
|
||||||
if(packages == NULL) {
|
if(packages == NULL) {
|
||||||
/* nothing to do: just exit without complaining */
|
/* nothing to do: just exit without complaining */
|
||||||
MSG(NL," local database is up to date");
|
MSG(NL," local database is up to date");
|
||||||
@ -577,12 +577,12 @@ int pacman_sync(list_t *targets)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* list targets and get confirmation */
|
/* list targets and get confirmation */
|
||||||
if(!((unsigned long)alpm_trans_getinfo(PM_TRANS_FLAGS) & PM_TRANS_FLAG_PRINTURIS)) {
|
if(!(alpm_trans_get_flags() & PM_TRANS_FLAG_PRINTURIS)) {
|
||||||
list_t *list_install = NULL;
|
list_t *list_install = NULL;
|
||||||
list_t *list_remove = NULL;
|
list_t *list_remove = NULL;
|
||||||
char *str;
|
char *str;
|
||||||
unsigned long totalsize = 0;
|
unsigned long totalsize = 0;
|
||||||
unsigned long totalusize = 0;
|
unsigned long totalisize = 0;
|
||||||
double mb, umb;
|
double mb, umb;
|
||||||
|
|
||||||
for(lp = alpm_list_first(packages); lp; lp = alpm_list_next(lp)) {
|
for(lp = alpm_list_first(packages); lp; lp = alpm_list_next(lp)) {
|
||||||
@ -605,7 +605,7 @@ int pacman_sync(list_t *targets)
|
|||||||
pkgname = alpm_pkg_get_name(pkg);
|
pkgname = alpm_pkg_get_name(pkg);
|
||||||
pkgver = alpm_pkg_get_version(pkg);
|
pkgver = alpm_pkg_get_version(pkg);
|
||||||
totalsize += alpm_pkg_get_size(pkg);
|
totalsize += alpm_pkg_get_size(pkg);
|
||||||
totalusize += alpm_pkg_get_usize(pkg);
|
totalisize += alpm_pkg_get_isize(pkg);
|
||||||
|
|
||||||
asprintf(&str, "%s-%s", pkgname, pkgver);
|
asprintf(&str, "%s-%s", pkgname, pkgver);
|
||||||
list_install = list_add(list_install, str);
|
list_install = list_add(list_install, str);
|
||||||
@ -619,7 +619,7 @@ int pacman_sync(list_t *targets)
|
|||||||
FREE(str);
|
FREE(str);
|
||||||
}
|
}
|
||||||
mb = (double)(totalsize / 1048576.0);
|
mb = (double)(totalsize / 1048576.0);
|
||||||
umb = (double)(totalusize / 1048576.0);
|
umb = (double)(totalisize / 1048576.0);
|
||||||
/* round up to 0.1 */
|
/* round up to 0.1 */
|
||||||
if(mb < 0.1) {
|
if(mb < 0.1) {
|
||||||
mb = 0.1;
|
mb = 0.1;
|
||||||
@ -672,19 +672,19 @@ int pacman_sync(list_t *targets)
|
|||||||
case PM_ERR_FILE_CONFLICTS:
|
case PM_ERR_FILE_CONFLICTS:
|
||||||
for(lp = alpm_list_first(data); lp; lp = alpm_list_next(lp)) {
|
for(lp = alpm_list_first(data); lp; lp = alpm_list_next(lp)) {
|
||||||
pmconflict_t *conflict = alpm_list_getdata(lp);
|
pmconflict_t *conflict = alpm_list_getdata(lp);
|
||||||
switch((long)alpm_conflict_getinfo(conflict, PM_CONFLICT_TYPE)) {
|
switch(alpm_conflict_get_type(conflict)) {
|
||||||
case PM_CONFLICT_TYPE_TARGET:
|
case PM_CONFLICT_TYPE_TARGET:
|
||||||
MSG(NL, _("%s%s exists in \"%s\" (target) and \"%s\" (target)"),
|
MSG(NL, _("%s%s exists in \"%s\" (target) and \"%s\" (target)"),
|
||||||
config->root,
|
config->root,
|
||||||
(char *)alpm_conflict_getinfo(conflict, PM_CONFLICT_FILE),
|
alpm_conflict_get_file(conflict),
|
||||||
(char *)alpm_conflict_getinfo(conflict, PM_CONFLICT_TARGET),
|
alpm_conflict_get_target(conflict),
|
||||||
(char *)alpm_conflict_getinfo(conflict, PM_CONFLICT_CTARGET));
|
alpm_conflict_get_ctarget(conflict));
|
||||||
break;
|
break;
|
||||||
case PM_CONFLICT_TYPE_FILE:
|
case PM_CONFLICT_TYPE_FILE:
|
||||||
MSG(NL, _("%s: %s%s exists in filesystem"),
|
MSG(NL, _("%s: %s%s exists in filesystem"),
|
||||||
(char *)alpm_conflict_getinfo(conflict, PM_CONFLICT_TARGET),
|
alpm_conflict_get_target(conflict),
|
||||||
config->root,
|
config->root,
|
||||||
(char *)alpm_conflict_getinfo(conflict, PM_CONFLICT_FILE));
|
alpm_conflict_get_file(conflict));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3,6 +3,7 @@ bin_PROGRAMS = vercmp
|
|||||||
AM_CFLAGS = \
|
AM_CFLAGS = \
|
||||||
-I$(top_srcdir)/lib/libalpm \
|
-I$(top_srcdir)/lib/libalpm \
|
||||||
-I$(top_srcdir)/src/pacman
|
-I$(top_srcdir)/src/pacman
|
||||||
|
$(CFLAGS)
|
||||||
|
|
||||||
vercmp_SOURCES = vercmp.c
|
vercmp_SOURCES = vercmp.c
|
||||||
|
|
||||||
|
@ -21,6 +21,9 @@
|
|||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
#include <errno.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
#include <limits.h>
|
||||||
#include "versioncmp.h"
|
#include "versioncmp.h"
|
||||||
|
|
||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
|
Loading…
x
Reference in New Issue
Block a user