Esempio n. 1
0
/**
 * call-seq:
 *   arch() → a_symbol
 *
 * Returns the architecture to download packages for.
 */
static VALUE get_arch(VALUE self)
{
  alpm_handle_t* p_alpm = NULL;
  Data_Get_Struct(self, alpm_handle_t, p_alpm);

  return ID2SYM(rb_intern(alpm_option_get_arch(p_alpm)));
}
Esempio n. 2
0
static alpm_list_t *check_arch(alpm_handle_t *handle, alpm_list_t *pkgs)
{
    alpm_list_t *i;
    alpm_list_t *invalid = NULL;

    const char *arch = alpm_option_get_arch(handle);
    if(!arch) {
        return NULL;
    }
    for(i = pkgs; i; i = i->next) {
        alpm_pkg_t *pkg = i->data;
        const char *pkgarch = alpm_pkg_get_arch(pkg);
        if(pkgarch && strcmp(pkgarch, arch) && strcmp(pkgarch, "any")) {
            char *string;
            const char *pkgname = alpm_pkg_get_name(pkg);
            const char *pkgver = alpm_pkg_get_version(pkg);
            size_t len = strlen(pkgname) + strlen(pkgver) + strlen(pkgarch) + 3;
            MALLOC(string, len, RET_ERR(handle, ALPM_ERR_MEMORY, invalid));
            sprintf(string, "%s-%s-%s", pkgname, pkgver, pkgarch);
            invalid = alpm_list_add(invalid, string);
        }
    }
    return invalid;
}
Esempio n. 3
0
/**
 * pacman_manager_get_architecture:
 * @manager: A #PacmanManager.
 *
 * Gets the architecture of packages that are allowed to be installed. If %NULL, no restrictions are placed on package architectures.
 *
 * Returns: One of "i686", "x86_64", etc., or %NULL if none is set. Do not free.
 */
const gchar *pacman_manager_get_architecture (PacmanManager *manager) {
	g_return_val_if_fail (manager != NULL, NULL);
	
	return alpm_option_get_arch ();
}