poldek: poldek/pm/mod.h, poldek/pm/pm.c, poldek/pm/pm.h, poldek/pm...
mis
mis at pld-linux.org
Sat Jul 14 00:33:16 CEST 2007
Author: mis Date: Fri Jul 13 22:33:16 2007 GMT
Module: poldek Tag: HEAD
---- Log message:
- pm_get_pmcaps() killed by pm_satisfies()
---- Files affected:
poldek/poldek/pm:
mod.h (1.14 -> 1.15) , pm.c (1.12 -> 1.13) , pm.h (1.21 -> 1.22)
poldek/poldek/pm/pset:
mod.c (1.7 -> 1.8) , pm_pset.h (1.10 -> 1.11) , pset.c (1.25 -> 1.26)
poldek/poldek/pm/rpm:
misc.c (1.19 -> 1.20) , mod.c (1.7 -> 1.8) , pm_rpm.h (1.19 -> 1.20) , rpm.c (1.19 -> 1.20)
---- Diffs:
================================================================
Index: poldek/poldek/pm/mod.h
diff -u poldek/poldek/pm/mod.h:1.14 poldek/poldek/pm/mod.h:1.15
--- poldek/poldek/pm/mod.h:1.14 Sun Jul 8 18:42:28 2007
+++ poldek/poldek/pm/mod.h Sat Jul 14 00:33:11 2007
@@ -25,7 +25,6 @@
int (*configure)(void *modh, const char *key, void *val);
int (*conf_get)(void *modh, const char *key, char *value, int vsize);
- tn_array *(*pm_caps)(void *modh);
int (*pm_satisfies)(void *modh, const struct capreq *req);
char *(*dbpath)(void *modh, char *path, size_t size);
================================================================
Index: poldek/poldek/pm/pm.c
diff -u poldek/poldek/pm/pm.c:1.12 poldek/poldek/pm/pm.c:1.13
--- poldek/poldek/pm/pm.c:1.12 Sun Jul 8 18:42:28 2007
+++ poldek/poldek/pm/pm.c Sat Jul 14 00:33:11 2007
@@ -124,14 +124,6 @@
return ctx->mod->machine_score(ctx->modh, tag, val);
}
-
-tn_array *pm_get_pmcaps(struct pm_ctx *ctx)
-{
- if (ctx->mod->pm_caps)
- return ctx->mod->pm_caps(ctx->modh);
- return NULL;
-}
-
int pm_satisfies(struct pm_ctx *ctx, const struct capreq *req)
{
if (ctx->mod->pm_satisfies)
================================================================
Index: poldek/poldek/pm/pm.h
diff -u poldek/poldek/pm/pm.h:1.21 poldek/poldek/pm/pm.h:1.22
--- poldek/poldek/pm/pm.h:1.21 Sun Jul 8 18:42:28 2007
+++ poldek/poldek/pm/pm.h Sat Jul 14 00:33:11 2007
@@ -177,7 +177,6 @@
int pm_machine_score(struct pm_ctx *ctx,
enum pm_machine_score_tag tag, const char *val);
-tn_array *pm_get_pmcaps(struct pm_ctx *ctx);
int pm_satisfies(struct pm_ctx *ctx, const struct capreq *req);
int pm_get_dbdepdirs(struct pm_ctx *ctx,
================================================================
Index: poldek/poldek/pm/pset/mod.c
diff -u poldek/poldek/pm/pset/mod.c:1.7 poldek/poldek/pm/pset/mod.c:1.8
--- poldek/poldek/pm/pset/mod.c:1.7 Mon Jan 8 18:22:00 2007
+++ poldek/poldek/pm/pset/mod.c Sat Jul 14 00:33:11 2007
@@ -6,10 +6,8 @@
0, "pset",
pm_pset_init, pm_pset_destroy,
pm_pset_configure,
- NULL,
NULL,
- NULL,
-
+ pm_pset_satisfies,
// pm_pset_dbpath,
// pm_pset_dbmtime,
// pm_pset_dbdepdirs,
================================================================
Index: poldek/poldek/pm/pset/pm_pset.h
diff -u poldek/poldek/pm/pset/pm_pset.h:1.10 poldek/poldek/pm/pset/pm_pset.h:1.11
--- poldek/poldek/pm/pset/pm_pset.h:1.10 Sun Jul 8 18:42:28 2007
+++ poldek/poldek/pm/pset/pm_pset.h Sat Jul 14 00:33:11 2007
@@ -13,6 +13,8 @@
int pm_pset_configure(void *pm_pset, const char *key, void *val);
+int pm_pset_satisfies(void *pm_pset, const struct capreq *req);
+
int pm_pset_packages_install(struct pkgdb *db, const tn_array *pkgs,
const tn_array *pkgs_toremove,
struct poldek_ts *ts);
================================================================
Index: poldek/poldek/pm/pset/pset.c
diff -u poldek/poldek/pm/pset/pset.c:1.25 poldek/poldek/pm/pset/pset.c:1.26
--- poldek/poldek/pm/pset/pset.c:1.25 Sun Jul 8 18:42:28 2007
+++ poldek/poldek/pm/pset/pset.c Sat Jul 14 00:33:11 2007
@@ -116,6 +116,14 @@
return 1;
}
+int pm_pset_satisfies(void *pm_pset, const struct capreq *req)
+{
+ if (capreq_is_rpmlib(req))
+ return 1;
+
+ return 0;
+}
+
static
int setup_source(struct pkgset *ps, struct source *src)
{
@@ -131,8 +139,9 @@
if (dir == NULL)
return 0;
-
- if (!pkgdir_load(dir, 0, 0)) {
+
+ /* full file list is required to resolve auto-dir deps */
+ if (!pkgdir_load(dir, NULL, PKGDIR_LD_FULLFLIST)) {
pkgdir_free(dir);
return 0;
}
================================================================
Index: poldek/poldek/pm/rpm/misc.c
diff -u poldek/poldek/pm/rpm/misc.c:1.19 poldek/poldek/pm/rpm/misc.c:1.20
--- poldek/poldek/pm/rpm/misc.c:1.19 Wed Jun 27 02:39:09 2007
+++ poldek/poldek/pm/rpm/misc.c Sat Jul 14 00:33:11 2007
@@ -99,7 +99,7 @@
}
#endif
-static int get_rpmlib_caps(tn_array *caps)
+static int get_rpm_internal_caps(tn_array *caps)
{
rpmds ds = NULL;
int i;
@@ -132,7 +132,7 @@
#if HAVE_RPMGETRPMLIBPROVIDES /* rpmGetRpmlibProvides() => rpm < 4.4.3 */
-static int get_rpmlib_caps_rpm_lt_4_4_3(tn_array *caps)
+static int get_rpm_internal_caps_rpm_lt_4_4_3(tn_array *caps)
{
char **names = NULL, **versions = NULL, *evr;
int *flags = NULL, n = 0, i;
@@ -163,7 +163,7 @@
}
#endif
-tn_array *pm_rpm_rpmlib_caps(void *pm_rpm)
+static tn_array *load_internal_caps(void *pm_rpm)
{
tn_array *caps;
int rc = 0;
@@ -172,10 +172,10 @@
caps = capreq_arr_new(0);
#if HAVE_RPMDSRPMLIB /* rpm >= 4.4.3 */
- rc = get_rpmlib_caps(caps);
+ rc = get_rpm_internal_caps(caps);
#else
# if HAVE_RPMGETRPMLIBPROVIDES
- rc = get_rpmlib_caps_rpm_lt_4_4_3(caps);
+ rc = get_rpm_internal_caps_rpm_lt_4_4_3(caps);
# endif
#endif
@@ -189,6 +189,62 @@
return caps;
}
+static int rpmioaccess_satisfies(const struct capreq *req)
+{
+ int rc = 0;
+
+#if HAVE_RPMIOACCESS
+ const char *name = NULL;
+ int n = 0;
+
+ if (capreq_versioned(req))
+ return 0;
+
+ name = capreq_name(req);
+ n = strlen(name);
+
+ /* code copied from lib/depends.c:563 */
+ if (n > 5 && name[n - 1] == ')' &&
+ ((strchr("Rr_", name[0]) != NULL &&
+ strchr("Ww_", name[1]) != NULL &&
+ strchr("Xx_", name[2]) != NULL &&
+ name[3] == '(') || !strncmp(name, "exists(", sizeof("exists(")-1)
+ || !strncmp(name, "executable(", sizeof("executable(")-1)
+ || !strncmp(name, "readable(", sizeof("readable(")-1)
+ || !strncmp(name, "writable(", sizeof("writable(")-1)
+ )) {
+
+ rc = (rpmioAccess(name, NULL, X_OK) == 0);
+ }
+#endif /* HAVE_RPMIOACCESS */
+ return rc;
+}
+
+int pm_rpm_satisfies(void *pm_rpm, const struct capreq *req)
+{
+ struct pm_rpm *pm = pm_rpm;
+ struct capreq *cap = NULL;
+
+ /* internal caps have names like name(feature) */
+ if (!capreq_is_rpmlib(req) && strstr(capreq_name(req), "(") == NULL)
+ return 0;
+
+ if (rpmioaccess_satisfies(req))
+ return 1;
+
+ if (pm->caps == NULL)
+ if ((pm->caps = load_internal_caps(pm_rpm)) == NULL)
+ return 0;
+
+ cap = n_array_bsearch_ex(pm->caps, req,
+ (tn_fn_cmp)capreq_cmp_name);
+
+ if (cap && cap_match_req(cap, req, 1))
+ return 1;
+
+ return 0;
+}
+
static void get_host_cpu_vendor_os(const char **acpu, const char **avendor,
const char **aos)
{
@@ -330,33 +386,3 @@
return machine_score(PMMSTAG_ARCH, arch);
}
-int pm_rpm_satisfies(void *pm_rpm, const struct capreq *req)
-{
- int n = 0, rc = 0;
- const char *name = NULL;
-
- pm_rpm = pm_rpm;
-
-#if HAVE_RPMIOACCESS
- if (capreq_versioned(req))
- return 0;
-
- name = capreq_name(req);
- n = strlen(name);
-
- /* code copied from lib/depends.c:563 */
- if (n > 5 && name[n - 1] == ')' &&
- ((strchr("Rr_", name[0]) != NULL &&
- strchr("Ww_", name[1]) != NULL &&
- strchr("Xx_", name[2]) != NULL &&
- name[3] == '(') || !strncmp(name, "exists(", sizeof("exists(")-1)
- || !strncmp(name, "executable(", sizeof("executable(")-1)
- || !strncmp(name, "readable(", sizeof("readable(")-1)
- || !strncmp(name, "writable(", sizeof("writable(")-1)
- )) {
-
- rc = (rpmioAccess(name, NULL, X_OK) == 0);
- }
-#endif /* HAVE_RPMIOACCESS */
- return rc;
-}
================================================================
Index: poldek/poldek/pm/rpm/mod.c
diff -u poldek/poldek/pm/rpm/mod.c:1.7 poldek/poldek/pm/rpm/mod.c:1.8
--- poldek/poldek/pm/rpm/mod.c:1.7 Mon Jan 8 18:22:00 2007
+++ poldek/poldek/pm/rpm/mod.c Sat Jul 14 00:33:11 2007
@@ -8,7 +8,6 @@
pm_rpm_configure,
pm_rpm_conf_get,
- pm_rpm_rpmlib_caps, /* XXX: TODO replace with pm_rpm_conf_get() */
pm_rpm_satisfies,
pm_rpm_dbpath,
pm_rpm_dbmtime,
================================================================
Index: poldek/poldek/pm/rpm/pm_rpm.h
diff -u poldek/poldek/pm/rpm/pm_rpm.h:1.19 poldek/poldek/pm/rpm/pm_rpm.h:1.20
--- poldek/poldek/pm/rpm/pm_rpm.h:1.19 Sun Jul 8 18:42:28 2007
+++ poldek/poldek/pm/rpm/pm_rpm.h Sat Jul 14 00:33:11 2007
@@ -41,6 +41,7 @@
char *rpm;
char *sudo;
char *default_dbpath;
+ tn_array *caps; /* rpmlib() and friends */
};
void *pm_rpm_init(void);
================================================================
Index: poldek/poldek/pm/rpm/rpm.c
diff -u poldek/poldek/pm/rpm/rpm.c:1.19 poldek/poldek/pm/rpm/rpm.c:1.20
--- poldek/poldek/pm/rpm/rpm.c:1.19 Sun Jul 1 23:04:27 2007
+++ poldek/poldek/pm/rpm/rpm.c Sat Jul 14 00:33:11 2007
@@ -62,6 +62,7 @@
n_cfree(&pm->rpm);
n_cfree(&pm->sudo);
n_cfree(&pm->default_dbpath);
+ n_array_cfree(&pm->caps);
free(pm);
}
@@ -90,7 +91,8 @@
p = RPM_DEFAULT_DBPATH;
pm_rpm->default_dbpath = n_strdup(p);
-
+
+ pm_rpm->caps = NULL;
return pm_rpm;
}
================================================================
---- CVS-web:
http://cvs.pld-linux.org/poldek/poldek/pm/mod.h?r1=1.14&r2=1.15&f=u
http://cvs.pld-linux.org/poldek/poldek/pm/pm.c?r1=1.12&r2=1.13&f=u
http://cvs.pld-linux.org/poldek/poldek/pm/pm.h?r1=1.21&r2=1.22&f=u
http://cvs.pld-linux.org/poldek/poldek/pm/pset/mod.c?r1=1.7&r2=1.8&f=u
http://cvs.pld-linux.org/poldek/poldek/pm/pset/pm_pset.h?r1=1.10&r2=1.11&f=u
http://cvs.pld-linux.org/poldek/poldek/pm/pset/pset.c?r1=1.25&r2=1.26&f=u
http://cvs.pld-linux.org/poldek/poldek/pm/rpm/misc.c?r1=1.19&r2=1.20&f=u
http://cvs.pld-linux.org/poldek/poldek/pm/rpm/mod.c?r1=1.7&r2=1.8&f=u
http://cvs.pld-linux.org/poldek/poldek/pm/rpm/pm_rpm.h?r1=1.19&r2=1.20&f=u
http://cvs.pld-linux.org/poldek/poldek/pm/rpm/rpm.c?r1=1.19&r2=1.20&f=u
More information about the pld-cvs-commit
mailing list