Ejemplo n.º 1
0
static PyObject *
list_arches(_SackObject *self, PyObject *unused)
{
    const char **arches = hif_sack_list_arches(self->sack);
    PyObject *list;
    if (!arches) {
        PyErr_SetString(HyExc_Runtime, "Arches not initialized");
        return NULL;
    }
    list = strlist_to_pylist(arches);
    g_free(arches);
    return list;
}
Ejemplo n.º 2
0
END_TEST

START_TEST(test_list_arches)
{
    HifSack *sack = hif_sack_new();
    hif_sack_set_cachedir(sack, test_globals.tmpdir);
    hif_sack_set_arch(sack, TEST_FIXED_ARCH, NULL);
    fail_unless(hif_sack_setup(sack, HIF_SACK_SETUP_FLAG_MAKE_CACHE_DIR, NULL));
    const char ** arches = hif_sack_list_arches(sack);

    /* noarch, x86_64, athlon, i686, i586, i486, i386 */
    fail_unless(g_strv_length((gchar**)arches), 7);
    ck_assert_str_eq(arches[3], "i686");

    g_free(arches);
    g_object_unref(sack);
}
Ejemplo n.º 3
0
static inline int
is_real_arch(HyNevra nevra, HifSack *sack, int flags)
{
    int check_glob = (flags & HY_GLOB) && is_glob_pattern(nevra->arch);
    if (nevra->arch == NULL)
        return 1;
    if (arch_exist(nevra->arch, "src", check_glob))
        return 1;
    const char **existing_arches = hif_sack_list_arches(sack);
    int ret = 0;
    for (int i = 0; existing_arches[i] != NULL; ++i) {
        if ((ret = arch_exist(nevra->arch, existing_arches[i], check_glob)))
            break;
    }
    g_free(existing_arches);
    return ret;
}