int main(int argc, char *argv[]) { int ret; enum _alpm_errno_t err; setlocale(LC_ALL, ""); strings_init(); if (argc == 1) { cwr_fprintf(stderr, LOG_ERROR, "not enough arguments\n"); exit(EXIT_FAILURE); } const command_t *cmd = find(argv[1]); if (!cmd) { cwr_fprintf(stderr, LOG_ERROR, "command %s not understood\n", argv[1]); exit(EXIT_FAILURE); } /* if ((ret = parse_options(argc, argv)) != 0) */ /* return ret; */ cwr_fprintf(stderr, LOG_DEBUG, "initializing alpm\n"); pmhandle = alpm_initialize(PACMAN_ROOT, PACMAN_DBPATH, &err); if (!pmhandle) { cwr_fprintf(stderr, LOG_ERROR, "failed to initialize alpm library\n"); goto finish; } ret = run(cmd, --argc, ++argv); finish: alpm_release(pmhandle); return ret; }
int main(int argc, char *argv[]) { int retval = 1; /* default = false */ alpm_handle_t *handle; alpm_errno_t err; alpm_pkg_t *pkg = NULL; const alpm_siglevel_t level = ALPM_SIG_PACKAGE | ALPM_SIG_PACKAGE_OPTIONAL; if(argc != 2) { fprintf(stderr, "testpkg (pacman) v" PACKAGE_VERSION "\n\n" "Test a pacman package for validity.\n\n" "Usage: testpkg <package file>\n"); return 1; } handle = alpm_initialize(ROOTDIR, DBPATH, &err); if(!handle) { fprintf(stderr, "cannot initialize alpm: %s\n", alpm_strerror(err)); return 1; } /* let us get log messages from libalpm */ alpm_option_set_logcb(handle, output_cb); /* set gpgdir to default */ alpm_option_set_gpgdir(handle, GPGDIR); if(alpm_pkg_load(handle, argv[1], 1, level, &pkg) == -1 || pkg == NULL) { err = alpm_errno(handle); switch(err) { case ALPM_ERR_PKG_NOT_FOUND: printf("Cannot find the given file.\n"); break; case ALPM_ERR_PKG_OPEN: printf("Cannot open the given file.\n"); break; case ALPM_ERR_LIBARCHIVE: case ALPM_ERR_PKG_INVALID: printf("Package is invalid.\n"); break; default: printf("libalpm error: %s\n", alpm_strerror(err)); break; } retval = 1; } else { alpm_pkg_free(pkg); printf("Package is valid.\n"); retval = 0; } if(alpm_release(handle) == -1) { fprintf(stderr, "error releasing alpm\n"); } return retval; }
/** * call-seq: * new( rootpath , dbpath ) → an_alpm * * Creates a new Alpm instance configured for the given directories. * * === Parameters * [rootpath] * File system root directory to install packages under. * [dbpath] * Directory used for permanent storage of things like the * list of currently installed packages. * * === Return value * The newly created instance. */ static VALUE initialize(VALUE self, VALUE root, VALUE dbpath) { alpm_handle_t* p_alpm = NULL; alpm_errno_t err; p_alpm = alpm_initialize(StringValuePtr(root), StringValuePtr(dbpath), &err); if (!p_alpm) rb_raise(rb_eRuntimeError, "Initializing alpm library failed: %s", alpm_strerror(err)); DATA_PTR(self) = p_alpm; return self; }
static alpm_handle_t *alpm_init(void) { alpm_handle_t *alpm = NULL; enum _alpm_errno_t alpm_errno = 0; FILE *fp; char line[PATH_MAX]; char *ptr, *section = NULL; alpm = alpm_initialize("/", "/var/lib/pacman", &alpm_errno); if (!alpm) { alpm_strerror(alpm_errno); return NULL; } db_local = alpm_get_localdb(alpm); fp = fopen("/etc/pacman.conf", "r"); if (!fp) { perror("fopen: /etc/pacman.conf"); return alpm; } while (fgets(line, PATH_MAX, fp)) { strtrim(line); if (strlen(line) == 0 || line[0] == '#') { continue; } if ((ptr = strchr(line, '#'))) { *ptr = '\0'; } if (line[0] == '[' && line[strlen(line) - 1] == ']') { ptr = &line[1]; if (section) { free(section); } section = strdup(ptr); section[strlen(section) - 1] = '\0'; if (strcmp(section, "options") != 0) { alpm_register_syncdb(alpm, section, 0); } } } free(section); fclose(fp); return alpm; }
int main(int argc, char *argv[]) { int retval = 1; /* default = false */ pmhandle_t *handle; enum _pmerrno_t err; pmpkg_t *pkg = NULL; if(argc != 2) { fprintf(stderr, "usage: %s <package file>\n", BASENAME); return 1; } handle = alpm_initialize(ROOTDIR, DBPATH, &err); if(!handle) { fprintf(stderr, "cannot initialize alpm: %s\n", alpm_strerror(err)); return 1; } /* let us get log messages from libalpm */ alpm_option_set_logcb(handle, output_cb); if(alpm_pkg_load(handle, argv[1], 1, PM_PGP_VERIFY_OPTIONAL, &pkg) == -1 || pkg == NULL) { err = alpm_errno(handle); switch(err) { case PM_ERR_PKG_OPEN: printf("Cannot open the given file.\n"); break; case PM_ERR_LIBARCHIVE: case PM_ERR_PKG_INVALID: printf("Package is invalid.\n"); break; default: printf("libalpm error: %s\n", alpm_strerror(err)); break; } retval = 1; } else { alpm_pkg_free(pkg); printf("Package is valid.\n"); retval = 0; } if(alpm_release(handle) == -1) { fprintf(stderr, "error releasing alpm\n"); } return retval; }
/*pyalpm functions*/ PyObject* pyalpm_initialize(PyTypeObject *subtype, PyObject *args, PyObject *kwargs) { const char *root; const char *dbpath; alpm_handle_t *h; enum _alpm_errno_t errcode = 0; if(!PyArg_ParseTuple(args, "ss", &root, &dbpath)) { return NULL; } h = alpm_initialize(root, dbpath, &errcode); if (h) { return pyalpm_handle_from_pmhandle((void*)h); } else { RET_ERR("could not create a libalpm handle", errcode, NULL); } }
static int expac_new(expac_t **expac, const char *config_file) { expac_t *e; enum _alpm_errno_t alpm_errno = 0; config_t config; const char *dbroot = "/"; const char *dbpath = "/var/lib/pacman"; int r; e = calloc(1, sizeof(*e)); if(e == NULL) { return -ENOMEM; } memset(&config, 0, sizeof(config)); r = config_parse(&config, config_file); if(r < 0) { return r; } if(config.dbpath) { dbpath = config.dbpath; } if(config.dbroot) { dbroot = config.dbroot; } e->alpm = alpm_initialize(dbroot, dbpath, &alpm_errno); if(!e->alpm) { return -alpm_errno; } for(int i = 0; i < config.size; ++i) { alpm_register_syncdb(e->alpm, config.repos[i], 0); } config_reset(&config); *expac = e; return 0; }
int main(int argc, char **argv) { int retval = 1; /* default = false */ pmpkg_t *pkg = NULL; if(argc != 2) { fprintf(stderr, "usage: %s <package file>\n", BASENAME); return(1); } if(alpm_initialize() == -1) { fprintf(stderr, "cannot initialize alpm: %s\n", alpm_strerrorlast()); return(1); } /* let us get log messages from libalpm */ alpm_option_set_logcb(output_cb); if(alpm_pkg_load(argv[1], 1, &pkg) == -1 || pkg == NULL) { switch(pm_errno) { case PM_ERR_PKG_OPEN: printf("Cannot open the given file.\n"); break; case PM_ERR_LIBARCHIVE: case PM_ERR_PKG_INVALID: printf("Package is invalid.\n"); break; default: printf("libalpm error: %s\n", alpm_strerrorlast()); break; } retval = 1; } else { alpm_pkg_free(pkg); printf("Package is valid.\n"); retval = 0; } if(alpm_release() == -1) { fprintf(stderr, "error releasing alpm: %s\n", alpm_strerrorlast()); } return(retval); }
/* @param reload set to > 0 if reloading libalpm so that cachedirs can be * reinitialized. */ static int setup_pacman_environment(int reload) { enum _alpm_errno_t err; alpm_list_t *i; if (reload) { pw_printf(PW_LOG_DEBUG, "Reloading pacman configuration\n"); pacman_cachedirs = NULL; } if (parse_pmconfig()) { /* Free cachedirs */ FREELIST(pacman_cachedirs); return error(PW_ERR_PM_CONF_PARSE); } if (!pacman_rootdir) { pacman_rootdir = xstrdup(PACMAN_DEF_ROOTDIR); } if (!pacman_dbpath) { pacman_dbpath = xstrdup(PACMAN_DEF_DBPATH); } if (!pacman_cachedirs) { pacman_cachedirs = alpm_list_add(pacman_cachedirs, xstrdup(PACMAN_DEF_CACHEDIR)); } alpm_option_set_cachedirs(config->handle, pacman_cachedirs); config->handle = alpm_initialize(pacman_rootdir, pacman_dbpath, &err); if (!config->handle) { return error(PW_ERR_INIT_ALPM_HANDLE); } /* Register sync dbs */ for (i = pacman_syncdbs; i; i = i->next) { if (!alpm_db_register_sync(config->handle, (const char *) i->data, ALPM_SIG_USE_DEFAULT)) { return error(PW_ERR_INIT_ALPM_REGISTER_SYNC); } } return 0; }
/** * pacman_manager_get: * @error: A #GError, or %NULL * * Gets a reference to the global #PacmanManager object. * * Returns: A #PacmanManager, or %NULL if @error is set. Free with g_object_unref(). */ PacmanManager *pacman_manager_get (GError **error) { if (pacman_manager == NULL) { if (alpm_initialize () < 0) { g_set_error (error, PACMAN_ERROR, pm_errno, _("Failed to initialize alpm: %s"), alpm_strerrorlast ()); return NULL; } alpm_option_set_logcb (pacman_manager_log_cb); alpm_option_set_root (PACMAN_ROOT_PATH); alpm_option_set_dbpath (PACMAN_DATABASE_PATH); alpm_option_set_logfile (PACMAN_LOG_FILE); pacman_set_user_agent (); pacman_manager = pacman_manager_new (); } else { g_object_ref (pacman_manager); } return pacman_manager; }
int main(int argc, char *argv[]) { const char *dbpath = DBPATH; alpm_errno_t err; int a = 1; alpm_list_t *dbnames = NULL; while(a < argc) { if(strcmp(argv[a], "-b") == 0) { if(++a < argc) { dbpath = argv[a]; } else { usage(); } } else if(strcmp(argv[a], "-h") == 0 || strcmp(argv[a], "--help") == 0 ) { usage(); } else { dbnames = alpm_list_add(dbnames, argv[a]); } a++; } if(!dbnames) { usage(); } handle = alpm_initialize(ROOTDIR, dbpath, &err); if(!handle) { fprintf(stderr, "cannot initialize alpm: %s\n", alpm_strerror(err)); return 1; } /* let us get log messages from libalpm */ alpm_option_set_eventcb(handle, (alpm_cb_event) output_cb); checkdbs(dbnames); alpm_list_free(dbnames); cleanup(0); }
static gboolean asb_package_alpm_open (AsbPackage *pkg, const gchar *filename, GError **error) { AsbPackageAlpm *pkg_alpm = ASB_PACKAGE_ALPM (pkg); AsbPackageAlpmPrivate *priv = GET_PRIVATE (pkg_alpm); alpm_errno_t alpm_error; /* initialize the alpm library */ priv->handle = alpm_initialize ("/", "/tmp", &alpm_error); if (priv->handle == NULL) { g_set_error (error, ASB_PLUGIN_ERROR, ASB_PLUGIN_ERROR_FAILED, "libalpm initialization failed %s (%u) for %s", alpm_strerror (alpm_error), alpm_error, filename); return FALSE; } /* open the package */ if (alpm_pkg_load (priv->handle, filename, TRUE, 0, &priv->package) == -1) { g_set_error (error, ASB_PLUGIN_ERROR, ASB_PLUGIN_ERROR_FAILED, "Failed to load package %s : %s (%u)", filename, alpm_strerror (alpm_errno (priv->handle)), alpm_errno (priv->handle)); alpm_release (priv->handle); return FALSE; } asb_package_set_name (pkg, alpm_pkg_get_name (priv->package)); asb_package_set_url (pkg, alpm_pkg_get_url (priv->package)); asb_package_set_arch (pkg, alpm_pkg_get_arch (priv->package)); asb_package_alpm_ensure_version (pkg, error); return TRUE; }
int main(int argc, char *argv[]) { int freelist = 0, ret = 0; alpm_errno_t err; const char *target_name; alpm_pkg_t *pkg; alpm_list_t *dblist = NULL; if(parse_options(argc, argv) != 0) { usage(); ret = 1; goto finish; } handle = alpm_initialize(ROOTDIR, dbpath, &err); if(!handle) { fprintf(stderr, "error: cannot initialize alpm: %s\n", alpm_strerror(err)); ret = 1; goto finish; } if(searchsyncs) { if(register_syncs() != 0) { ret = 1; goto finish; } dblist = alpm_get_syncdbs(handle); } else { dblist = alpm_list_add(dblist, alpm_get_localdb(handle)); freelist = 1; } /* we only care about the first non option arg for walking */ target_name = argv[optind]; pkg = alpm_find_dbs_satisfier(handle, dblist, target_name); if(!pkg) { fprintf(stderr, "error: package '%s' not found\n", target_name); ret = 1; goto finish; } print_start(alpm_pkg_get_name(pkg), target_name); tdepth d = { NULL, NULL, 1 }; walk_deps(dblist, pkg, &d, reverse); print_end(); if(freelist) { alpm_list_free(dblist); } finish: cleanup(); return ret; }
int ipacman_init(const char* rootdir, alpm_cb_progress cb) { int ret = 0; alpm_errno_t err; /* Configure root path first. If it is set and dbpath/logfile were not * set, then set those as well to reside under the root. */ char path[PATH_MAX]; snprintf(path, PATH_MAX, "%s/var/lib/pacman/", rootdir); if(access(path, F_OK) != 0) { mkdirp(path, 0755); } /* initialize library */ handle = alpm_initialize(rootdir, path, &err); if(!handle) { printf("failed to initialize alpm library (%s)\n", alpm_strerror(err)); if(err == ALPM_ERR_DB_VERSION) { printf(" try running pacman-db-upgrade\n"); } return -1; } alpm_option_set_dlcb(handle, cb_dl_progress); alpm_option_set_eventcb(handle, cb_event); alpm_option_set_questioncb(handle, cb_question); alpm_option_set_progresscb(handle, cb?cb:cb_progress); snprintf(path, PATH_MAX, "%s/var/log/pacman.log", rootdir); ret = alpm_option_set_logfile(handle, path); if(ret != 0) { printf("problem setting logfile '%s' (%s)\n", path, alpm_strerror(alpm_errno(handle))); return ret; } /* Set GnuPG's home directory. This is not relative to rootdir, even if * rootdir is defined. Reasoning: gpgdir contains configuration data. */ snprintf(path, PATH_MAX, "%s/etc/pacman.d/gnupg/", rootdir); ret = alpm_option_set_gpgdir(handle, path); if(ret != 0) { printf("problem setting gpgdir '%s' (%s)\n", path, alpm_strerror(alpm_errno(handle))); return ret; } /* add a default cachedir if one wasn't specified */ snprintf(path, PATH_MAX, "%s/var/cache/pacman/pkg/", rootdir); alpm_option_add_cachedir(handle, path); //specialized for installer /*alpm_option_add_cachedir(handle, "/PKGS");*/ alpm_option_set_default_siglevel(handle, ALPM_SIG_PACKAGE | ALPM_SIG_PACKAGE_OPTIONAL | ALPM_SIG_DATABASE | ALPM_SIG_DATABASE_OPTIONAL); alpm_option_set_local_file_siglevel(handle, ALPM_SIG_USE_DEFAULT); alpm_option_set_remote_file_siglevel(handle, ALPM_SIG_USE_DEFAULT); alpm_option_set_totaldlcb(handle, cb_dl_total); struct utsname un; uname(&un); if (strcmp(un.machine, "mips64") == 0) alpm_option_set_arch(handle, "mipsel"); else alpm_option_set_arch(handle, un.machine); alpm_option_set_checkspace(handle, 1); alpm_option_set_usesyslog(handle, 1); alpm_option_set_deltaratio(handle, 0.7); /* the follow function use alpm_list_t* as arguments * use alpm_list_add() */ /* alpm_option_set_ignorepkgs(handle, ignorepkg); alpm_option_set_ignoregroups(handle, ignoregrp); alpm_option_set_noupgrades(handle, noupgrade); alpm_option_set_noextracts(handle, noextract); */ return 0; }
static alpm_handle_t * pk_backend_config_initialize_alpm (PkBackendConfig *config, GError **error) { alpm_handle_t *handle; alpm_errno_t errno; gsize dir = 1; g_return_val_if_fail (config != NULL, FALSE); if (config->root == NULL || *config->root == '\0') { g_free (config->root); config->root = g_strdup (PK_BACKEND_DEFAULT_ROOT); } else if (!g_str_has_suffix (config->root, G_DIR_SEPARATOR_S)) { dir = 0; } if (config->dbpath == NULL) { config->dbpath = g_strconcat (config->root, PK_BACKEND_DEFAULT_DBPATH + dir, NULL); } g_debug ("initializing alpm"); handle = alpm_initialize (config->root, config->dbpath, &errno); if (handle == NULL) { g_set_error_literal (error, ALPM_ERROR, errno, alpm_strerror (errno)); return handle; } if (config->gpgdir == NULL) { config->gpgdir = g_strconcat (config->root, PK_BACKEND_DEFAULT_GPGDIR + dir, NULL); } if (alpm_option_set_gpgdir (handle, config->gpgdir) < 0) { errno = alpm_errno (handle); g_set_error (error, ALPM_ERROR, errno, "GPGDir: %s", alpm_strerror (errno)); return handle; } if (config->logfile == NULL) { config->logfile = g_strconcat (config->root, PK_BACKEND_DEFAULT_LOGFILE + dir, NULL); } if (alpm_option_set_logfile (handle, config->logfile) < 0) { errno = alpm_errno (handle); g_set_error (error, ALPM_ERROR, errno, "LogFile: %s", alpm_strerror (errno)); return handle; } if (config->cachedirs == NULL) { gchar *path = g_strconcat (config->root, PK_BACKEND_DEFAULT_CACHEDIR + dir, NULL); config->cachedirs = alpm_list_add (NULL, path); } /* alpm takes ownership */ if (alpm_option_set_cachedirs (handle, config->cachedirs) < 0) { errno = alpm_errno (handle); g_set_error (error, ALPM_ERROR, errno, "CacheDir: %s", alpm_strerror (errno)); return handle; } config->cachedirs = NULL; return handle; }
static alpm_handle_t * pk_alpm_config_initialize_alpm (PkAlpmConfig *config, GError **error) { alpm_handle_t *handle; alpm_errno_t errno; gsize dir = 1; g_return_val_if_fail (config != NULL, FALSE); if (config->root == NULL || *config->root == '\0') { g_free (config->root); config->root = g_strdup ("/"); } else if (!g_str_has_suffix (config->root, G_DIR_SEPARATOR_S)) { dir = 0; } if (config->dbpath == NULL) { config->dbpath = g_strconcat (config->root, "/var/lib/pacman/" + dir, NULL); } g_debug ("initializing alpm"); handle = alpm_initialize (config->root, config->dbpath, &errno); if (handle == NULL) { g_set_error_literal (error, PK_ALPM_ERROR, errno, alpm_strerror (errno)); return handle; } if (config->gpgdir == NULL) { config->gpgdir = g_strconcat (config->root, "/etc/pacman.d/gnupg/" + dir, NULL); } if (alpm_option_set_gpgdir (handle, config->gpgdir) < 0) { errno = alpm_errno (handle); g_set_error (error, PK_ALPM_ERROR, errno, "GPGDir: %s", alpm_strerror (errno)); return handle; } if (config->logfile == NULL) { config->logfile = g_strconcat (config->root, "/var/log/pacman.log" + dir, NULL); } if (alpm_option_set_logfile (handle, config->logfile) < 0) { errno = alpm_errno (handle); g_set_error (error, PK_ALPM_ERROR, errno, "LogFile: %s", alpm_strerror (errno)); return handle; } if (config->cachedirs == NULL) { gchar *path = g_strconcat (config->root, "/var/cache/pacman/pkg/" + dir, NULL); config->cachedirs = alpm_list_add (NULL, path); } /* alpm takes ownership */ if (alpm_option_set_cachedirs (handle, config->cachedirs) < 0) { errno = alpm_errno (handle); g_set_error (error, PK_ALPM_ERROR, errno, "CacheDir: %s", alpm_strerror (errno)); return handle; } config->cachedirs = NULL; return handle; }
/** Sets up libalpm global stuff in one go. Called after the command line * and initial config file parsing. Once this is complete, we can see if any * paths were defined. If a rootdir was defined and nothing else, we want all * of our paths to live under the rootdir that was specified. Safe to call * multiple times (will only do anything the first time). */ static int setup_libalpm(void) { int ret = 0; alpm_errno_t err; alpm_handle_t *handle; alpm_list_t *i; pm_printf(ALPM_LOG_DEBUG, "setup_libalpm called\n"); /* Configure root path first. If it is set and dbpath/logfile were not * set, then set those as well to reside under the root. */ if(config->rootdir) { char path[PATH_MAX]; if(!config->dbpath) { snprintf(path, PATH_MAX, "%s/%s", config->rootdir, DBPATH + 1); config->dbpath = strdup(path); } if(!config->logfile) { snprintf(path, PATH_MAX, "%s/%s", config->rootdir, LOGFILE + 1); config->logfile = strdup(path); } } else { config->rootdir = strdup(ROOTDIR); if(!config->dbpath) { config->dbpath = strdup(DBPATH); } } /* initialize library */ handle = alpm_initialize(config->rootdir, config->dbpath, &err); if(!handle) { pm_printf(ALPM_LOG_ERROR, _("failed to initialize alpm library\n(%s: %s)\n"), alpm_strerror(err), config->dbpath); if(err == ALPM_ERR_DB_VERSION) { fprintf(stderr, _("try running pacman-db-upgrade\n")); } return -1; } config->handle = handle; alpm_option_set_logcb(handle, cb_log); alpm_option_set_dlcb(handle, cb_dl_progress); alpm_option_set_eventcb(handle, cb_event); alpm_option_set_questioncb(handle, cb_question); alpm_option_set_progresscb(handle, cb_progress); config->logfile = config->logfile ? config->logfile : strdup(LOGFILE); ret = alpm_option_set_logfile(handle, config->logfile); if(ret != 0) { pm_printf(ALPM_LOG_ERROR, _("problem setting logfile '%s' (%s)\n"), config->logfile, alpm_strerror(alpm_errno(handle))); return ret; } /* Set GnuPG's home directory. This is not relative to rootdir, even if * rootdir is defined. Reasoning: gpgdir contains configuration data. */ config->gpgdir = config->gpgdir ? config->gpgdir : strdup(GPGDIR); ret = alpm_option_set_gpgdir(handle, config->gpgdir); if(ret != 0) { pm_printf(ALPM_LOG_ERROR, _("problem setting gpgdir '%s' (%s)\n"), config->gpgdir, alpm_strerror(alpm_errno(handle))); return ret; } /* add a default cachedir if one wasn't specified */ if(config->cachedirs == NULL) { alpm_option_add_cachedir(handle, CACHEDIR); } else { alpm_option_set_cachedirs(handle, config->cachedirs); } alpm_option_set_default_siglevel(handle, config->siglevel); config->localfilesiglevel = merge_siglevel(config->siglevel, config->localfilesiglevel, config->localfilesiglevel_mask); config->remotefilesiglevel = merge_siglevel(config->siglevel, config->remotefilesiglevel, config->remotefilesiglevel_mask); alpm_option_set_local_file_siglevel(handle, config->localfilesiglevel); alpm_option_set_remote_file_siglevel(handle, config->remotefilesiglevel); for(i = config->repos; i; i = alpm_list_next(i)) { register_repo(i->data); } if(config->xfercommand) { alpm_option_set_fetchcb(handle, download_with_xfercommand); } else if(!(alpm_capabilities() & ALPM_CAPABILITY_DOWNLOADER)) { pm_printf(ALPM_LOG_WARNING, _("no '%s' configured\n"), "XferCommand"); } if(config->totaldownload) { alpm_option_set_totaldlcb(handle, cb_dl_total); } alpm_option_set_arch(handle, config->arch); alpm_option_set_checkspace(handle, config->checkspace); alpm_option_set_usesyslog(handle, config->usesyslog); alpm_option_set_deltaratio(handle, config->deltaratio); alpm_option_set_ignorepkgs(handle, config->ignorepkg); alpm_option_set_ignoregroups(handle, config->ignoregrp); alpm_option_set_noupgrades(handle, config->noupgrade); alpm_option_set_noextracts(handle, config->noextract); for(i = config->assumeinstalled; i; i = i->next) { char *entry = i->data; alpm_depend_t *dep = alpm_dep_from_string(entry); if(!dep) { return 1; } pm_printf(ALPM_LOG_DEBUG, "parsed assume installed: %s %s\n", dep->name, dep->version); ret = alpm_option_add_assumeinstalled(handle, dep); if(ret) { pm_printf(ALPM_LOG_ERROR, _("Failed to pass %s entry to libalpm"), "assume-installed"); alpm_dep_free(dep); return ret; } } return 0; }