diff options
Diffstat (limited to 'src/pacman')
-rw-r--r-- | src/pacman/callback.c | 80 | ||||
-rw-r--r-- | src/pacman/conf.c | 110 | ||||
-rw-r--r-- | src/pacman/database.c | 16 | ||||
-rw-r--r-- | src/pacman/package.c | 8 | ||||
-rw-r--r-- | src/pacman/pacman.c | 66 | ||||
-rw-r--r-- | src/pacman/query.c | 32 | ||||
-rw-r--r-- | src/pacman/remove.c | 18 | ||||
-rw-r--r-- | src/pacman/sync.c | 70 | ||||
-rw-r--r-- | src/pacman/upgrade.c | 28 | ||||
-rw-r--r-- | src/pacman/util.c | 28 |
10 files changed, 228 insertions, 228 deletions
diff --git a/src/pacman/callback.c b/src/pacman/callback.c index f579e7ae..d34aca13 100644 --- a/src/pacman/callback.c +++ b/src/pacman/callback.c @@ -156,93 +156,93 @@ static void fill_progress(const int bar_percent, const int disp_percent, void cb_trans_evt(alpm_transevt_t event, void *data1, void *data2) { switch(event) { - case PM_TRANS_EVT_CHECKDEPS_START: + case ALPM_TRANS_EVT_CHECKDEPS_START: printf(_("checking dependencies...\n")); break; - case PM_TRANS_EVT_FILECONFLICTS_START: + case ALPM_TRANS_EVT_FILECONFLICTS_START: if(config->noprogressbar) { printf(_("checking for file conflicts...\n")); } break; - case PM_TRANS_EVT_RESOLVEDEPS_START: + case ALPM_TRANS_EVT_RESOLVEDEPS_START: printf(_("resolving dependencies...\n")); break; - case PM_TRANS_EVT_INTERCONFLICTS_START: + case ALPM_TRANS_EVT_INTERCONFLICTS_START: printf(_("looking for inter-conflicts...\n")); break; - case PM_TRANS_EVT_ADD_START: + case ALPM_TRANS_EVT_ADD_START: if(config->noprogressbar) { printf(_("installing %s...\n"), alpm_pkg_get_name(data1)); } break; - case PM_TRANS_EVT_ADD_DONE: + case ALPM_TRANS_EVT_ADD_DONE: alpm_logaction(config->handle, "installed %s (%s)\n", alpm_pkg_get_name(data1), alpm_pkg_get_version(data1)); display_optdepends(data1); break; - case PM_TRANS_EVT_REMOVE_START: + case ALPM_TRANS_EVT_REMOVE_START: if(config->noprogressbar) { printf(_("removing %s...\n"), alpm_pkg_get_name(data1)); } break; - case PM_TRANS_EVT_REMOVE_DONE: + case ALPM_TRANS_EVT_REMOVE_DONE: alpm_logaction(config->handle, "removed %s (%s)\n", alpm_pkg_get_name(data1), alpm_pkg_get_version(data1)); break; - case PM_TRANS_EVT_UPGRADE_START: + case ALPM_TRANS_EVT_UPGRADE_START: if(config->noprogressbar) { printf(_("upgrading %s...\n"), alpm_pkg_get_name(data1)); } break; - case PM_TRANS_EVT_UPGRADE_DONE: + case ALPM_TRANS_EVT_UPGRADE_DONE: alpm_logaction(config->handle, "upgraded %s (%s -> %s)\n", (char *)alpm_pkg_get_name(data1), (char *)alpm_pkg_get_version(data2), (char *)alpm_pkg_get_version(data1)); display_new_optdepends(data2,data1); break; - case PM_TRANS_EVT_INTEGRITY_START: + case ALPM_TRANS_EVT_INTEGRITY_START: if(config->noprogressbar) { printf(_("checking package integrity...\n")); } break; - case PM_TRANS_EVT_DELTA_INTEGRITY_START: + case ALPM_TRANS_EVT_DELTA_INTEGRITY_START: printf(_("checking delta integrity...\n")); break; - case PM_TRANS_EVT_DELTA_PATCHES_START: + case ALPM_TRANS_EVT_DELTA_PATCHES_START: printf(_("applying deltas...\n")); break; - case PM_TRANS_EVT_DELTA_PATCH_START: + case ALPM_TRANS_EVT_DELTA_PATCH_START: printf(_("generating %s with %s... "), (char *)data1, (char *)data2); break; - case PM_TRANS_EVT_DELTA_PATCH_DONE: + case ALPM_TRANS_EVT_DELTA_PATCH_DONE: printf(_("success!\n")); break; - case PM_TRANS_EVT_DELTA_PATCH_FAILED: + case ALPM_TRANS_EVT_DELTA_PATCH_FAILED: printf(_("failed.\n")); break; - case PM_TRANS_EVT_SCRIPTLET_INFO: + case ALPM_TRANS_EVT_SCRIPTLET_INFO: printf("%s", (char *)data1); break; - case PM_TRANS_EVT_RETRIEVE_START: + case ALPM_TRANS_EVT_RETRIEVE_START: printf(_(":: Retrieving packages from %s...\n"), (char *)data1); break; - case PM_TRANS_EVT_DISKSPACE_START: + case ALPM_TRANS_EVT_DISKSPACE_START: if(config->noprogressbar) { printf(_("checking available disk space...\n")); } break; /* all the simple done events, with fallthrough for each */ - case PM_TRANS_EVT_FILECONFLICTS_DONE: - case PM_TRANS_EVT_CHECKDEPS_DONE: - case PM_TRANS_EVT_RESOLVEDEPS_DONE: - case PM_TRANS_EVT_INTERCONFLICTS_DONE: - case PM_TRANS_EVT_INTEGRITY_DONE: - case PM_TRANS_EVT_DELTA_INTEGRITY_DONE: - case PM_TRANS_EVT_DELTA_PATCHES_DONE: - case PM_TRANS_EVT_DISKSPACE_DONE: + case ALPM_TRANS_EVT_FILECONFLICTS_DONE: + case ALPM_TRANS_EVT_CHECKDEPS_DONE: + case ALPM_TRANS_EVT_RESOLVEDEPS_DONE: + case ALPM_TRANS_EVT_INTERCONFLICTS_DONE: + case ALPM_TRANS_EVT_INTEGRITY_DONE: + case ALPM_TRANS_EVT_DELTA_INTEGRITY_DONE: + case ALPM_TRANS_EVT_DELTA_PATCHES_DONE: + case ALPM_TRANS_EVT_DISKSPACE_DONE: /* nothing */ break; } @@ -255,7 +255,7 @@ void cb_trans_conv(alpm_transconv_t event, void *data1, void *data2, void *data3, int *response) { switch(event) { - case PM_TRANS_CONV_INSTALL_IGNOREPKG: + case ALPM_TRANS_CONV_INSTALL_IGNOREPKG: if(!config->op_s_downloadonly) { *response = yesno(_(":: %s is in IgnorePkg/IgnoreGroup. Install anyway?"), alpm_pkg_get_name(data1)); @@ -263,13 +263,13 @@ void cb_trans_conv(alpm_transconv_t event, void *data1, void *data2, *response = 1; } break; - case PM_TRANS_CONV_REPLACE_PKG: + case ALPM_TRANS_CONV_REPLACE_PKG: *response = yesno(_(":: Replace %s with %s/%s?"), alpm_pkg_get_name(data1), (char *)data3, alpm_pkg_get_name(data2)); break; - case PM_TRANS_CONV_CONFLICT_PKG: + case ALPM_TRANS_CONV_CONFLICT_PKG: /* data parameters: target package, local package, conflict (strings) */ /* print conflict only if it contains new information */ if(strcmp(data1, data3) == 0 || strcmp(data2, data3) == 0) { @@ -285,7 +285,7 @@ void cb_trans_conv(alpm_transconv_t event, void *data1, void *data2, (char *)data2); } break; - case PM_TRANS_CONV_REMOVE_PKGS: + case ALPM_TRANS_CONV_REMOVE_PKGS: { alpm_list_t *unresolved = (alpm_list_t *) data1; alpm_list_t *namelist = NULL, *i; @@ -308,7 +308,7 @@ void cb_trans_conv(alpm_transconv_t event, void *data1, void *data2, alpm_list_free(namelist); } break; - case PM_TRANS_CONV_SELECT_PROVIDER: + case ALPM_TRANS_CONV_SELECT_PROVIDER: { alpm_list_t *providers = (alpm_list_t *)data1; int count = alpm_list_count(providers); @@ -320,7 +320,7 @@ void cb_trans_conv(alpm_transconv_t event, void *data1, void *data2, *response = select_question(count); } break; - case PM_TRANS_CONV_LOCAL_NEWER: + case ALPM_TRANS_CONV_LOCAL_NEWER: if(!config->op_s_downloadonly) { *response = yesno(_(":: %s-%s: local version is newer. Upgrade anyway?"), alpm_pkg_get_name(data1), @@ -329,7 +329,7 @@ void cb_trans_conv(alpm_transconv_t event, void *data1, void *data2, *response = 1; } break; - case PM_TRANS_CONV_CORRUPTED_PKG: + case ALPM_TRANS_CONV_CORRUPTED_PKG: *response = yesno(_(":: File %s is corrupted. Do you want to delete it?"), (char *)data1); break; @@ -381,22 +381,22 @@ void cb_trans_progress(alpm_transprog_t event, const char *pkgname, int percent, /* set text of message to display */ switch (event) { - case PM_TRANS_PROGRESS_ADD_START: + case ALPM_TRANS_PROGRESS_ADD_START: opr = _("installing"); break; - case PM_TRANS_PROGRESS_UPGRADE_START: + case ALPM_TRANS_PROGRESS_UPGRADE_START: opr = _("upgrading"); break; - case PM_TRANS_PROGRESS_REMOVE_START: + case ALPM_TRANS_PROGRESS_REMOVE_START: opr = _("removing"); break; - case PM_TRANS_PROGRESS_CONFLICTS_START: + case ALPM_TRANS_PROGRESS_CONFLICTS_START: opr = _("checking for file conflicts"); break; - case PM_TRANS_PROGRESS_DISKSPACE_START: + case ALPM_TRANS_PROGRESS_DISKSPACE_START: opr = _("checking available disk space"); break; - case PM_TRANS_PROGRESS_INTEGRITY_START: + case ALPM_TRANS_PROGRESS_INTEGRITY_START: opr = _("checking package integrity"); break; default: diff --git a/src/pacman/conf.c b/src/pacman/conf.c index 50b4988f..f2df260e 100644 --- a/src/pacman/conf.c +++ b/src/pacman/conf.c @@ -43,14 +43,14 @@ config_t *config_new(void) { config_t *newconfig = calloc(1, sizeof(config_t)); if(!newconfig) { - pm_fprintf(stderr, PM_LOG_ERROR, + pm_fprintf(stderr, ALPM_LOG_ERROR, _("malloc failure: could not allocate %zd bytes\n"), sizeof(config_t)); return NULL; } /* defaults which may get overridden later */ newconfig->op = PM_OP_MAIN; - newconfig->logmask = PM_LOG_ERROR | PM_LOG_WARNING; + newconfig->logmask = ALPM_LOG_ERROR | ALPM_LOG_WARNING; newconfig->configfile = strdup(CONFFILE); newconfig->sigverify = PM_PGP_VERIFY_UNKNOWN; @@ -159,27 +159,27 @@ static int download_with_xfercommand(const char *url, const char *localpath, /* save the cwd so we can restore it later */ if(getcwd(cwd, PATH_MAX) == NULL) { - pm_printf(PM_LOG_ERROR, _("could not get current working directory\n")); + pm_printf(ALPM_LOG_ERROR, _("could not get current working directory\n")); } else { restore_cwd = 1; } /* cwd to the download directory */ if(chdir(localpath)) { - pm_printf(PM_LOG_WARNING, _("could not chdir to download directory %s\n"), localpath); + pm_printf(ALPM_LOG_WARNING, _("could not chdir to download directory %s\n"), localpath); ret = -1; goto cleanup; } /* execute the parsed command via /bin/sh -c */ - pm_printf(PM_LOG_DEBUG, "running command: %s\n", parsedcmd); + pm_printf(ALPM_LOG_DEBUG, "running command: %s\n", parsedcmd); retval = system(parsedcmd); if(retval == -1) { - pm_printf(PM_LOG_WARNING, _("running XferCommand: fork failed!\n")); + pm_printf(ALPM_LOG_WARNING, _("running XferCommand: fork failed!\n")); ret = -1; } else if(retval != 0) { /* download failed */ - pm_printf(PM_LOG_DEBUG, "XferCommand command returned non-zero status " + pm_printf(ALPM_LOG_DEBUG, "XferCommand command returned non-zero status " "code (%d)\n", retval); ret = -1; } else { @@ -193,7 +193,7 @@ static int download_with_xfercommand(const char *url, const char *localpath, cleanup: /* restore the old cwd if we have it */ if(restore_cwd && chdir(cwd) != 0) { - pm_printf(PM_LOG_ERROR, _("could not change directory to %s (%s)\n"), + pm_printf(ALPM_LOG_ERROR, _("could not change directory to %s (%s)\n"), cwd, strerror(errno)); } @@ -218,7 +218,7 @@ int config_set_arch(const char *arch) } else { config->arch = strdup(arch); } - pm_printf(PM_LOG_DEBUG, "config: arch: %s\n", config->arch); + pm_printf(ALPM_LOG_DEBUG, "config: arch: %s\n", config->arch); return 0; } @@ -234,7 +234,7 @@ static pgp_verify_t option_verifysig(const char *value) } else { level = PM_PGP_VERIFY_UNKNOWN; } - pm_printf(PM_LOG_DEBUG, "config: VerifySig = %s (%d)\n", value, level); + pm_printf(ALPM_LOG_DEBUG, "config: VerifySig = %s (%d)\n", value, level); return level; } @@ -247,7 +247,7 @@ static int process_cleanmethods(alpm_list_t *values) { } else if(strcmp(value, "KeepCurrent") == 0) { config->cleanmethod |= PM_CLEAN_KEEPCUR; } else { - pm_printf(PM_LOG_ERROR, _("invalid value for 'CleanMethod' : '%s'\n"), + pm_printf(ALPM_LOG_ERROR, _("invalid value for 'CleanMethod' : '%s'\n"), value); return 1; } @@ -270,12 +270,12 @@ static void setrepeatingoption(char *ptr, const char *option, while((q = strchr(ptr, ' '))) { *q = '\0'; *list = alpm_list_add(*list, strdup(ptr)); - pm_printf(PM_LOG_DEBUG, "config: %s: %s\n", option, ptr); + pm_printf(ALPM_LOG_DEBUG, "config: %s: %s\n", option, ptr); ptr = q; ptr++; } *list = alpm_list_add(*list, strdup(ptr)); - pm_printf(PM_LOG_DEBUG, "config: %s: %s\n", option, ptr); + pm_printf(ALPM_LOG_DEBUG, "config: %s: %s\n", option, ptr); } static int _parse_options(const char *key, char *value, @@ -285,23 +285,23 @@ static int _parse_options(const char *key, char *value, /* options without settings */ if(strcmp(key, "UseSyslog") == 0) { config->usesyslog = 1; - pm_printf(PM_LOG_DEBUG, "config: usesyslog\n"); + pm_printf(ALPM_LOG_DEBUG, "config: usesyslog\n"); } else if(strcmp(key, "ILoveCandy") == 0) { config->chomp = 1; - pm_printf(PM_LOG_DEBUG, "config: chomp\n"); + pm_printf(ALPM_LOG_DEBUG, "config: chomp\n"); } else if(strcmp(key, "VerbosePkgLists") == 0) { config->verbosepkglists = 1; - pm_printf(PM_LOG_DEBUG, "config: verbosepkglists\n"); + pm_printf(ALPM_LOG_DEBUG, "config: verbosepkglists\n"); } else if(strcmp(key, "UseDelta") == 0) { config->usedelta = 1; - pm_printf(PM_LOG_DEBUG, "config: usedelta\n"); + pm_printf(ALPM_LOG_DEBUG, "config: usedelta\n"); } else if(strcmp(key, "TotalDownload") == 0) { config->totaldownload = 1; - pm_printf(PM_LOG_DEBUG, "config: totaldownload\n"); + pm_printf(ALPM_LOG_DEBUG, "config: totaldownload\n"); } else if(strcmp(key, "CheckSpace") == 0) { config->checkspace = 1; } else { - pm_printf(PM_LOG_WARNING, + pm_printf(ALPM_LOG_WARNING, _("config file %s, line %d: directive '%s' in section '%s' not recognized.\n"), file, linenum, key, "options"); } @@ -329,27 +329,27 @@ static int _parse_options(const char *key, char *value, /* don't overwrite a path specified on the command line */ if(!config->dbpath) { config->dbpath = strdup(value); - pm_printf(PM_LOG_DEBUG, "config: dbpath: %s\n", value); + pm_printf(ALPM_LOG_DEBUG, "config: dbpath: %s\n", value); } } else if(strcmp(key, "RootDir") == 0) { /* don't overwrite a path specified on the command line */ if(!config->rootdir) { config->rootdir = strdup(value); - pm_printf(PM_LOG_DEBUG, "config: rootdir: %s\n", value); + pm_printf(ALPM_LOG_DEBUG, "config: rootdir: %s\n", value); } } else if(strcmp(key, "GPGDir") == 0) { if(!config->gpgdir) { config->gpgdir = strdup(value); - pm_printf(PM_LOG_DEBUG, "config: gpgdir: %s\n", value); + pm_printf(ALPM_LOG_DEBUG, "config: gpgdir: %s\n", value); } } else if(strcmp(key, "LogFile") == 0) { if(!config->logfile) { config->logfile = strdup(value); - pm_printf(PM_LOG_DEBUG, "config: logfile: %s\n", value); + pm_printf(ALPM_LOG_DEBUG, "config: logfile: %s\n", value); } } else if(strcmp(key, "XferCommand") == 0) { config->xfercommand = strdup(value); - pm_printf(PM_LOG_DEBUG, "config: xfercommand: %s\n", value); + pm_printf(ALPM_LOG_DEBUG, "config: xfercommand: %s\n", value); } else if(strcmp(key, "CleanMethod") == 0) { alpm_list_t *methods = NULL; setrepeatingoption(value, "CleanMethod", &methods); @@ -363,13 +363,13 @@ static int _parse_options(const char *key, char *value, if(level != PM_PGP_VERIFY_UNKNOWN) { config->sigverify = level; } else { - pm_printf(PM_LOG_ERROR, + pm_printf(ALPM_LOG_ERROR, _("config file %s, line %d: directive '%s' has invalid value '%s'\n"), file, linenum, key, value); return 1; } } else { - pm_printf(PM_LOG_WARNING, + pm_printf(ALPM_LOG_WARNING, _("config file %s, line %d: directive '%s' in section '%s' not recognized.\n"), file, linenum, key, "options"); } @@ -392,7 +392,7 @@ static int _add_mirror(alpm_db_t *db, char *value) } else { if(strstr(temp, "$arch")) { free(temp); - pm_printf(PM_LOG_ERROR, _("The mirror '%s' contains the $arch" + pm_printf(ALPM_LOG_ERROR, _("The mirror '%s' contains the $arch" " variable, but no Architecture is defined.\n"), value); return 1; } @@ -401,7 +401,7 @@ static int _add_mirror(alpm_db_t *db, char *value) if(alpm_db_add_server(db, server) != 0) { /* pm_errno is set by alpm_db_setserver */ - pm_printf(PM_LOG_ERROR, _("could not add server URL to database '%s': %s (%s)\n"), + pm_printf(ALPM_LOG_ERROR, _("could not add server URL to database '%s': %s (%s)\n"), dbname, server, alpm_strerror(alpm_errno(config->handle))); free(server); return 1; @@ -423,7 +423,7 @@ static int setup_libalpm(void) enum _alpm_errno_t err; alpm_handle_t *handle; - pm_printf(PM_LOG_DEBUG, "setup_libalpm called\n"); + 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. */ @@ -447,10 +447,10 @@ static int setup_libalpm(void) /* initialize library */ handle = alpm_initialize(config->rootdir, config->dbpath, &err); if(!handle) { - pm_printf(PM_LOG_ERROR, _("failed to initialize alpm library (%s)\n"), + pm_printf(ALPM_LOG_ERROR, _("failed to initialize alpm library (%s)\n"), alpm_strerror(err)); - if(err == PM_ERR_DB_VERSION) { - pm_printf(PM_LOG_ERROR, _(" try running pacman-db-upgrade\n")); + if(err == ALPM_ERR_DB_VERSION) { + pm_printf(ALPM_LOG_ERROR, _(" try running pacman-db-upgrade\n")); } return -1; } @@ -462,7 +462,7 @@ static int setup_libalpm(void) config->logfile = config->logfile ? config->logfile : strdup(LOGFILE); ret = alpm_option_set_logfile(handle, config->logfile); if(ret != 0) { - pm_printf(PM_LOG_ERROR, _("problem setting logfile '%s' (%s)\n"), + pm_printf(ALPM_LOG_ERROR, _("problem setting logfile '%s' (%s)\n"), config->logfile, alpm_strerror(alpm_errno(handle))); return ret; } @@ -472,7 +472,7 @@ static int setup_libalpm(void) config->gpgdir = config->gpgdir ? config->gpgdir : strdup(GPGDIR); ret = alpm_option_set_gpgdir(handle, config->gpgdir); if(ret != 0) { - pm_printf(PM_LOG_ERROR, _("problem setting gpgdir '%s' (%s)\n"), + pm_printf(ALPM_LOG_ERROR, _("problem setting gpgdir '%s' (%s)\n"), config->gpgdir, alpm_strerror(alpm_errno(handle))); return ret; } @@ -537,7 +537,7 @@ static int finish_section(struct section_t *section, int parse_options) alpm_list_t *i; alpm_db_t *db; - pm_printf(PM_LOG_DEBUG, "config: finish section '%s'\n", section->name); + pm_printf(ALPM_LOG_DEBUG, "config: finish section '%s'\n", section->name); /* parsing options (or nothing)- nothing to do except free the pieces */ if(!section->name || parse_options || section->is_options) { @@ -547,7 +547,7 @@ static int finish_section(struct section_t *section, int parse_options) /* if we are not looking at options sections only, register a db */ db = alpm_db_register_sync(config->handle, section->name, section->sigverify); if(db == NULL) { - pm_printf(PM_LOG_ERROR, _("could not register '%s' database (%s)\n"), + pm_printf(ALPM_LOG_ERROR, _("could not register '%s' database (%s)\n"), section->name, alpm_strerror(alpm_errno(config->handle))); ret = 1; goto cleanup; @@ -556,7 +556,7 @@ static int finish_section(struct section_t *section, int parse_options) for(i = section->servers; i; i = alpm_list_next(i)) { char *value = alpm_list_getdata(i); if(_add_mirror(db, value) != 0) { - pm_printf(PM_LOG_ERROR, + pm_printf(ALPM_LOG_ERROR, _("could not add mirror '%s' to database '%s' (%s)\n"), value, section->name, alpm_strerror(alpm_errno(config->handle))); ret = 1; @@ -595,16 +595,16 @@ static int _parseconfig(const char *file, struct section_t *section, const int max_depth = 10; if(depth >= max_depth) { - pm_printf(PM_LOG_ERROR, + pm_printf(ALPM_LOG_ERROR, _("config parsing exceeded max recursion depth of %d.\n"), max_depth); ret = 1; goto cleanup; } - pm_printf(PM_LOG_DEBUG, "config: attempting to read file %s\n", file); + pm_printf(ALPM_LOG_DEBUG, "config: attempting to read file %s\n", file); fp = fopen(file, "r"); if(fp == NULL) { - pm_printf(PM_LOG_ERROR, _("config file %s could not be read.\n"), file); + pm_printf(ALPM_LOG_ERROR, _("config file %s could not be read.\n"), file); ret = 1; goto cleanup; } @@ -629,7 +629,7 @@ static int _parseconfig(const char *file, struct section_t *section, char *name; /* only possibility here is a line == '[]' */ if(line_len <= 2) { - pm_printf(PM_LOG_ERROR, _("config file %s, line %d: bad section name.\n"), + pm_printf(ALPM_LOG_ERROR, _("config file %s, line %d: bad section name.\n"), file, linenum); ret = 1; goto cleanup; @@ -642,7 +642,7 @@ static int _parseconfig(const char *file, struct section_t *section, ret = 1; goto cleanup; } - pm_printf(PM_LOG_DEBUG, "config: new section '%s'\n", name); + pm_printf(ALPM_LOG_DEBUG, "config: new section '%s'\n", name); section->name = name; section->is_options = (strcmp(name, "options") == 0); continue; @@ -657,14 +657,14 @@ static int _parseconfig(const char *file, struct section_t *section, strtrim(value); if(key == NULL) { - pm_printf(PM_LOG_ERROR, _("config file %s, line %d: syntax error in config file- missing key.\n"), + pm_printf(ALPM_LOG_ERROR, _("config file %s, line %d: syntax error in config file- missing key.\n"), file, linenum); ret = 1; goto cleanup; } /* For each directive, compare to the camelcase string. */ if(section->name == NULL) { - pm_printf(PM_LOG_ERROR, _("config file %s, line %d: All directives must belong to a section.\n"), + pm_printf(ALPM_LOG_ERROR, _("config file %s, line %d: All directives must belong to a section.\n"), file, linenum); ret = 1; goto cleanup; @@ -676,7 +676,7 @@ static int _parseconfig(const char *file, struct section_t *section, size_t gindex; if(value == NULL) { - pm_printf(PM_LOG_ERROR, _("config file %s, line %d: directive '%s' needs a value\n"), + pm_printf(ALPM_LOG_ERROR, _("config file %s, line %d: directive '%s' needs a value\n"), file, linenum, key); ret = 1; goto cleanup; @@ -685,23 +685,23 @@ static int _parseconfig(const char *file, struct section_t *section, globret = glob(value, GLOB_NOCHECK, NULL, &globbuf); switch(globret) { case GLOB_NOSPACE: - pm_printf(PM_LOG_DEBUG, + pm_printf(ALPM_LOG_DEBUG, "config file %s, line %d: include globbing out of space\n", file, linenum); break; case GLOB_ABORTED: - pm_printf(PM_LOG_DEBUG, + pm_printf(ALPM_LOG_DEBUG, "config file %s, line %d: include globbing read error for %s\n", file, linenum, value); break; case GLOB_NOMATCH: - pm_printf(PM_LOG_DEBUG, + pm_printf(ALPM_LOG_DEBUG, "config file %s, line %d: no include found for %s\n", file, linenum, value); break; default: for(gindex = 0; gindex < globbuf.gl_pathc; gindex++) { - pm_printf(PM_LOG_DEBUG, "config file %s, line %d: including %s\n", + pm_printf(ALPM_LOG_DEBUG, "config file %s, line %d: including %s\n", file, linenum, globbuf.gl_pathv[gindex]); _parseconfig(globbuf.gl_pathv[gindex], section, parse_options, depth + 1); } @@ -719,7 +719,7 @@ static int _parseconfig(const char *file, struct section_t *section, /* ... or in a repo section */ if(strcmp(key, "Server") == 0) { if(value == NULL) { - pm_printf(PM_LOG_ERROR, _("config file %s, line %d: directive '%s' needs a value\n"), + pm_printf(ALPM_LOG_ERROR, _("config file %s, line %d: directive '%s' needs a value\n"), file, linenum, key); ret = 1; goto cleanup; @@ -730,14 +730,14 @@ static int _parseconfig(const char *file, struct section_t *section, if(level != PM_PGP_VERIFY_UNKNOWN) { section->sigverify = level; } else { - pm_printf(PM_LOG_ERROR, + pm_printf(ALPM_LOG_ERROR, _("config file %s, line %d: directive '%s' has invalid value '%s'\n"), file, linenum, key, value); ret = 1; goto cleanup; } } else { - pm_printf(PM_LOG_WARNING, + pm_printf(ALPM_LOG_WARNING, _("config file %s, line %d: directive '%s' in section '%s' not recognized.\n"), file, linenum, key, section->name); } @@ -750,7 +750,7 @@ static int _parseconfig(const char *file, struct section_t *section, cleanup: fclose(fp); - pm_printf(PM_LOG_DEBUG, "config: finished parsing %s\n", file); + pm_printf(ALPM_LOG_DEBUG, "config: finished parsing %s\n", file); return ret; } @@ -768,7 +768,7 @@ int parseconfig(const char *file) * Next, we go back and parse everything but [options]. */ /* call the real parseconfig function with a null section & db argument */ - pm_printf(PM_LOG_DEBUG, "parseconfig: options pass\n"); + pm_printf(ALPM_LOG_DEBUG, "parseconfig: options pass\n"); if((ret = _parseconfig(file, §ion, 1, 0))) { return ret; } @@ -776,7 +776,7 @@ int parseconfig(const char *file) return ret; } /* second pass, repo section parsing */ - pm_printf(PM_LOG_DEBUG, "parseconfig: repo pass\n"); + pm_printf(ALPM_LOG_DEBUG, "parseconfig: repo pass\n"); return _parseconfig(file, §ion, 0, 0); } diff --git a/src/pacman/database.c b/src/pacman/database.c index b7490cea..5a1aa52b 100644 --- a/src/pacman/database.c +++ b/src/pacman/database.c @@ -45,16 +45,16 @@ int pacman_database(alpm_list_t *targets) alpm_pkgreason_t reason; if(targets == NULL) { - pm_printf(PM_LOG_ERROR, _("no targets specified (use -h for help)\n")); + pm_printf(ALPM_LOG_ERROR, _("no targets specified (use -h for help)\n")); return 1; } - if(config->flags & PM_TRANS_FLAG_ALLDEPS) { /* --asdeps */ - reason = PM_PKG_REASON_DEPEND; - } else if(config->flags & PM_TRANS_FLAG_ALLEXPLICIT) { /* --asexplicit */ - reason = PM_PKG_REASON_EXPLICIT; + if(config->flags & ALPM_TRANS_FLAG_ALLDEPS) { /* --asdeps */ + reason = ALPM_PKG_REASON_DEPEND; + } else if(config->flags & ALPM_TRANS_FLAG_ALLEXPLICIT) { /* --asexplicit */ + reason = ALPM_PKG_REASON_EXPLICIT; } else { - pm_printf(PM_LOG_ERROR, _("no install reason specified (use -h for help)\n")); + pm_printf(ALPM_LOG_ERROR, _("no install reason specified (use -h for help)\n")); return 1; } @@ -67,11 +67,11 @@ int pacman_database(alpm_list_t *targets) for(i = targets; i; i = alpm_list_next(i)) { char *pkgname = i->data; if(alpm_db_set_pkgreason(db_local, pkgname, reason) == -1) { - pm_printf(PM_LOG_ERROR, _("could not set install reason for package %s (%s)\n"), + pm_printf(ALPM_LOG_ERROR, _("could not set install reason for package %s (%s)\n"), pkgname, alpm_strerror(alpm_errno(config->handle))); retval = 1; } else { - if(reason == PM_PKG_REASON_DEPEND) { + if(reason == ALPM_PKG_REASON_DEPEND) { printf(_("%s: install reason has been set to 'installed as dependency'\n"), pkgname); } else { printf(_("%s: install reason has been set to 'explicitly installed'\n"), pkgname); diff --git a/src/pacman/package.c b/src/pacman/package.c index c394bf9a..5514f001 100644 --- a/src/pacman/package.c +++ b/src/pacman/package.c @@ -70,10 +70,10 @@ void dump_pkg_full(alpm_pkg_t *pkg, enum pkg_from from, int extra) } switch((long)alpm_pkg_get_reason(pkg)) { - case PM_PKG_REASON_EXPLICIT: + case ALPM_PKG_REASON_EXPLICIT: reason = _("Explicitly installed"); break; - case PM_PKG_REASON_DEPEND: + case ALPM_PKG_REASON_DEPEND: reason = _("Installed as a dependency for another package"); break; default: @@ -163,7 +163,7 @@ static const char *get_backup_file_status(const char *root, char *md5sum = alpm_compute_md5sum(path); if(md5sum == NULL) { - pm_fprintf(stderr, PM_LOG_ERROR, + pm_fprintf(stderr, ALPM_LOG_ERROR, _("could not calculate checksums for %s\n"), path); return NULL; } @@ -244,7 +244,7 @@ void dump_pkg_changelog(alpm_pkg_t *pkg) void *fp = NULL; if((fp = alpm_pkg_changelog_open(pkg)) == NULL) { - pm_fprintf(stderr, PM_LOG_ERROR, _("no changelog available for '%s'.\n"), + pm_fprintf(stderr, ALPM_LOG_ERROR, _("no changelog available for '%s'.\n"), alpm_pkg_get_name(pkg)); return; } else { diff --git a/src/pacman/pacman.c b/src/pacman/pacman.c index ce2ca2d5..e855203a 100644 --- a/src/pacman/pacman.c +++ b/src/pacman/pacman.c @@ -264,7 +264,7 @@ static void setuseragent(void) static void cleanup(int ret) { /* free alpm library resources */ if(config->handle && alpm_release(config->handle) == -1) { - pm_printf(PM_LOG_ERROR, "error releasing alpm library\n"); + pm_printf(ALPM_LOG_ERROR, "error releasing alpm library\n"); } /* free memory */ @@ -408,17 +408,17 @@ static int parsearg_global(int opt) unsigned short debug = (unsigned short)atoi(optarg); switch(debug) { case 2: - config->logmask |= PM_LOG_FUNCTION; /* fall through */ + config->logmask |= ALPM_LOG_FUNCTION; /* fall through */ case 1: - config->logmask |= PM_LOG_DEBUG; + config->logmask |= ALPM_LOG_DEBUG; break; default: - pm_printf(PM_LOG_ERROR, _("'%s' is not a valid debug level\n"), + pm_printf(ALPM_LOG_ERROR, _("'%s' is not a valid debug level\n"), optarg); return 1; } } else { - config->logmask |= PM_LOG_DEBUG; + config->logmask |= ALPM_LOG_DEBUG; } /* progress bars get wonky with debug on, shut them off */ config->noprogressbar = 1; @@ -445,8 +445,8 @@ static int parsearg_global(int opt) static int parsearg_database(int opt) { switch(opt) { - case OP_ASDEPS: config->flags |= PM_TRANS_FLAG_ALLDEPS; break; - case OP_ASEXPLICIT: config->flags |= PM_TRANS_FLAG_ALLEXPLICIT; break; + case OP_ASDEPS: config->flags |= ALPM_TRANS_FLAG_ALLDEPS; break; + case OP_ASEXPLICIT: config->flags |= ALPM_TRANS_FLAG_ALLEXPLICIT; break; default: return 1; } return 0; @@ -479,15 +479,15 @@ static int parsearg_trans(int opt) { switch(opt) { case 'd': - if(config->flags & PM_TRANS_FLAG_NODEPVERSION) { - config->flags |= PM_TRANS_FLAG_NODEPS; + if(config->flags & ALPM_TRANS_FLAG_NODEPVERSION) { + config->flags |= ALPM_TRANS_FLAG_NODEPS; } else { - config->flags |= PM_TRANS_FLAG_NODEPVERSION; + config->flags |= ALPM_TRANS_FLAG_NODEPVERSION; } break; - case 'k': config->flags |= PM_TRANS_FLAG_DBONLY; break; + case 'k': config->flags |= ALPM_TRANS_FLAG_DBONLY; break; case OP_NOPROGRESSBAR: config->noprogressbar = 1; break; - case OP_NOSCRIPTLET: config->flags |= PM_TRANS_FLAG_NOSCRIPTLET; break; + case OP_NOSCRIPTLET: config->flags |= ALPM_TRANS_FLAG_NOSCRIPTLET; break; case 'p': config->print = 1; break; case OP_PRINTFORMAT: check_optarg(); @@ -503,16 +503,16 @@ static int parsearg_remove(int opt) if(parsearg_trans(opt) == 0) return 0; switch(opt) { - case 'c': config->flags |= PM_TRANS_FLAG_CASCADE; break; - case 'n': config->flags |= PM_TRANS_FLAG_NOSAVE; break; + case 'c': config->flags |= ALPM_TRANS_FLAG_CASCADE; break; + case 'n': config->flags |= ALPM_TRANS_FLAG_NOSAVE; break; case 's': - if(config->flags & PM_TRANS_FLAG_RECURSE) { - config->flags |= PM_TRANS_FLAG_RECURSEALL; + if(config->flags & ALPM_TRANS_FLAG_RECURSE) { + config->flags |= ALPM_TRANS_FLAG_RECURSEALL; } else { - config->flags |= PM_TRANS_FLAG_RECURSE; + config->flags |= ALPM_TRANS_FLAG_RECURSE; } break; - case 'u': config->flags |= PM_TRANS_FLAG_UNNEEDED; break; + case 'u': config->flags |= ALPM_TRANS_FLAG_UNNEEDED; break; default: return 1; } return 0; @@ -524,9 +524,9 @@ static int parsearg_upgrade(int opt) if(parsearg_trans(opt) == 0) return 0; switch(opt) { - case 'f': config->flags |= PM_TRANS_FLAG_FORCE; break; - case OP_ASDEPS: config->flags |= PM_TRANS_FLAG_ALLDEPS; break; - case OP_ASEXPLICIT: config->flags |= PM_TRANS_FLAG_ALLEXPLICIT; break; + case 'f': config->flags |= ALPM_TRANS_FLAG_FORCE; break; + case OP_ASDEPS: config->flags |= ALPM_TRANS_FLAG_ALLDEPS; break; + case OP_ASEXPLICIT: config->flags |= ALPM_TRANS_FLAG_ALLEXPLICIT; break; case OP_IGNORE: parsearg_util_addlist(&(config->ignorepkg)); break; @@ -543,7 +543,7 @@ static int parsearg_sync(int opt) if(parsearg_upgrade(opt) == 0) return 0; switch(opt) { - case OP_NEEDED: config->flags |= PM_TRANS_FLAG_NEEDED; break; + case OP_NEEDED: config->flags |= ALPM_TRANS_FLAG_NEEDED; break; case 'c': (config->op_s_clean)++; break; case 'g': (config->group)++; break; case 'i': (config->op_s_info)++; break; @@ -553,8 +553,8 @@ static int parsearg_sync(int opt) case 'u': (config->op_s_upgrade)++; break; case 'w': config->op_s_downloadonly = 1; - config->flags |= PM_TRANS_FLAG_DOWNLOADONLY; - config->flags |= PM_TRANS_FLAG_NOCONFLICTS; + config->flags |= ALPM_TRANS_FLAG_DOWNLOADONLY; + config->flags |= ALPM_TRANS_FLAG_NOCONFLICTS; break; case 'y': (config->op_s_sync)++; break; default: return 1; @@ -645,7 +645,7 @@ static int parseargs(int argc, char *argv[]) } if(config->op == 0) { - pm_printf(PM_LOG_ERROR, _("only one operation may be used at a time\n")); + pm_printf(ALPM_LOG_ERROR, _("only one operation may be used at a time\n")); return 1; } if(config->help) { @@ -701,7 +701,7 @@ static int parseargs(int argc, char *argv[]) result = parsearg_global(opt); if(result != 0) { /* global option parsing failed, abort */ - pm_printf(PM_LOG_ERROR, _("invalid option\n")); + pm_printf(ALPM_LOG_ERROR, _("invalid option\n")); return result; } } @@ -833,7 +833,7 @@ int main(int argc, char *argv[]) } /* check for buffer overflow */ if(i >= PATH_MAX) { - pm_printf(PM_LOG_ERROR, _("buffer overflow detected in arg parsing\n")); + pm_printf(ALPM_LOG_ERROR, _("buffer overflow detected in arg parsing\n")); cleanup(EXIT_FAILURE); } @@ -843,7 +843,7 @@ int main(int argc, char *argv[]) pm_targets = alpm_list_add(pm_targets, strdup(line)); } if(!freopen(ctermid(NULL), "r", stdin)) { - pm_printf(PM_LOG_ERROR, _("failed to reopen stdin for reading: (%s)\n"), + pm_printf(ALPM_LOG_ERROR, _("failed to reopen stdin for reading: (%s)\n"), strerror(errno)); } } @@ -862,16 +862,16 @@ int main(int argc, char *argv[]) /* set up the print operations */ if(config->print && !config->op_s_clean) { config->noconfirm = 1; - config->flags |= PM_TRANS_FLAG_NOCONFLICTS; - config->flags |= PM_TRANS_FLAG_NOLOCK; + config->flags |= ALPM_TRANS_FLAG_NOCONFLICTS; + config->flags |= ALPM_TRANS_FLAG_NOLOCK; /* Display only errors */ - config->logmask &= ~PM_LOG_WARNING; + config->logmask &= ~ALPM_LOG_WARNING; } #if defined(HAVE_GETEUID) && !defined(CYGWIN) /* check if we have sufficient permission for the requested operation */ if(myuid > 0 && needs_root()) { - pm_printf(PM_LOG_ERROR, _("you cannot perform this operation unless you are root.\n")); + pm_printf(ALPM_LOG_ERROR, _("you cannot perform this operation unless you are root.\n")); cleanup(EXIT_FAILURE); } #endif @@ -918,7 +918,7 @@ int main(int argc, char *argv[]) ret = pacman_deptest(pm_targets); break; default: - pm_printf(PM_LOG_ERROR, _("no operation specified (use -h for help)\n")); + pm_printf(ALPM_LOG_ERROR, _("no operation specified (use -h for help)\n")); ret = EXIT_FAILURE; } diff --git a/src/pacman/query.c b/src/pacman/query.c index 1547c247..045dc7f0 100644 --- a/src/pacman/query.c +++ b/src/pacman/query.c @@ -117,7 +117,7 @@ static int query_fileowner(alpm_list_t *targets) /* This code is here for safety only */ if(targets == NULL) { - pm_fprintf(stderr, PM_LOG_ERROR, _("no file was specified for --owns\n")); + pm_fprintf(stderr, ALPM_LOG_ERROR, _("no file was specified for --owns\n")); return 1; } @@ -144,14 +144,14 @@ static int query_fileowner(alpm_list_t *targets) /* if it is not a path but a program name, then check in PATH */ if(strchr(filename, '/') == NULL) { if(search_path(&filename, &buf) == -1) { - pm_fprintf(stderr, PM_LOG_ERROR, _("failed to find '%s' in PATH: %s\n"), + pm_fprintf(stderr, ALPM_LOG_ERROR, _("failed to find '%s' in PATH: %s\n"), filename, strerror(errno)); ret++; free(filename); continue; } } else { - pm_fprintf(stderr, PM_LOG_ERROR, _("failed to read file '%s': %s\n"), + pm_fprintf(stderr, ALPM_LOG_ERROR, _("failed to read file '%s': %s\n"), filename, strerror(errno)); ret++; free(filename); @@ -160,7 +160,7 @@ static int query_fileowner(alpm_list_t *targets) } if(S_ISDIR(buf.st_mode)) { - pm_fprintf(stderr, PM_LOG_ERROR, + pm_fprintf(stderr, ALPM_LOG_ERROR, _("cannot determine ownership of directory '%s'\n"), filename); ret++; free(filename); @@ -176,7 +176,7 @@ static int query_fileowner(alpm_list_t *targets) rpath = resolve_path(dname); if(!rpath) { - pm_fprintf(stderr, PM_LOG_ERROR, _("cannot determine real path for '%s': %s\n"), + pm_fprintf(stderr, ALPM_LOG_ERROR, _("cannot determine real path for '%s': %s\n"), filename, strerror(errno)); free(filename); free(dname); @@ -209,7 +209,7 @@ static int query_fileowner(alpm_list_t *targets) } if(strlen(pkgfile) > max_length) { - pm_fprintf(stderr, PM_LOG_ERROR, _("path too long: %s%s\n"), root, pkgfile); + pm_fprintf(stderr, ALPM_LOG_ERROR, _("path too long: %s%s\n"), root, pkgfile); } /* concatenate our file and the root path */ strcpy(append, pkgfile); @@ -226,7 +226,7 @@ static int query_fileowner(alpm_list_t *targets) } } if(!found) { - pm_fprintf(stderr, PM_LOG_ERROR, _("No package owns %s\n"), filename); + pm_fprintf(stderr, ALPM_LOG_ERROR, _("No package owns %s\n"), filename); ret++; } free(filename); @@ -328,7 +328,7 @@ static int query_group(alpm_list_t *targets) } } } else { - pm_fprintf(stderr, PM_LOG_ERROR, _("group \"%s\" was not found\n"), grpname); + pm_fprintf(stderr, ALPM_LOG_ERROR, _("group \"%s\" was not found\n"), grpname); ret++; } } @@ -371,12 +371,12 @@ static int filter(alpm_pkg_t *pkg) { /* check if this package was explicitly installed */ if(config->op_q_explicit && - alpm_pkg_get_reason(pkg) != PM_PKG_REASON_EXPLICIT) { + alpm_pkg_get_reason(pkg) != ALPM_PKG_REASON_EXPLICIT) { return 0; } /* check if this package was installed as a dependency */ if(config->op_q_deps && - alpm_pkg_get_reason(pkg) != PM_PKG_REASON_DEPEND) { + alpm_pkg_get_reason(pkg) != ALPM_PKG_REASON_DEPEND) { return 0; } /* check if this pkg isn't in a sync DB */ @@ -409,7 +409,7 @@ static int check(alpm_pkg_t *pkg) rootlen = strlen(root); if(rootlen + 1 > PATH_MAX) { /* we are in trouble here */ - pm_fprintf(stderr, PM_LOG_ERROR, _("path too long: %s%s\n"), root, ""); + pm_fprintf(stderr, ALPM_LOG_ERROR, _("path too long: %s%s\n"), root, ""); return 1; } strcpy(f, root); @@ -421,7 +421,7 @@ static int check(alpm_pkg_t *pkg) const char *path = file->name; if(rootlen + 1 + strlen(path) > PATH_MAX) { - pm_fprintf(stderr, PM_LOG_WARNING, _("path too long: %s%s\n"), root, path); + pm_fprintf(stderr, ALPM_LOG_WARNING, _("path too long: %s%s\n"), root, path); continue; } strcpy(f + rootlen, path); @@ -431,7 +431,7 @@ static int check(alpm_pkg_t *pkg) if(config->quiet) { printf("%s %s\n", pkgname, f); } else { - pm_printf(PM_LOG_WARNING, "%s: %s (%s)\n", + pm_printf(ALPM_LOG_WARNING, "%s: %s (%s)\n", pkgname, f, strerror(errno)); } errors++; @@ -505,7 +505,7 @@ int pacman_query(alpm_list_t *targets) /* ensure we have at least one valid sync db set up */ alpm_list_t *sync_dbs = alpm_option_get_syncdbs(config->handle); if(sync_dbs == NULL) { - pm_printf(PM_LOG_ERROR, _("no usable package repositories configured.\n")); + pm_printf(ALPM_LOG_ERROR, _("no usable package repositories configured.\n")); return 1; } } @@ -517,7 +517,7 @@ int pacman_query(alpm_list_t *targets) * invalid: isfile, owns */ if(targets == NULL) { if(config->op_q_isfile || config->op_q_owns) { - pm_printf(PM_LOG_ERROR, _("no targets specified (use -h for help)\n")); + pm_printf(ALPM_LOG_ERROR, _("no targets specified (use -h for help)\n")); return 1; } @@ -557,7 +557,7 @@ int pacman_query(alpm_list_t *targets) } if(pkg == NULL) { - pm_fprintf(stderr, PM_LOG_ERROR, _("package \"%s\" not found\n"), strname); + pm_fprintf(stderr, ALPM_LOG_ERROR, _("package \"%s\" not found\n"), strname); ret = 1; continue; } diff --git a/src/pacman/remove.c b/src/pacman/remove.c index 4a23ab2e..3cedb892 100644 --- a/src/pacman/remove.c +++ b/src/pacman/remove.c @@ -39,7 +39,7 @@ static int remove_target(const char *target) if((info = alpm_db_get_pkg(db_local, target)) != NULL) { if(alpm_remove_pkg(config->handle, info) == -1) { - pm_fprintf(stderr, PM_LOG_ERROR, "'%s': %s\n", target, + pm_fprintf(stderr, ALPM_LOG_ERROR, "'%s': %s\n", target, alpm_strerror(alpm_errno(config->handle))); return -1; } @@ -49,13 +49,13 @@ static int remove_target(const char *target) /* fallback to group */ alpm_group_t *grp = alpm_db_readgroup(db_local, target); if(grp == NULL) { - pm_fprintf(stderr, PM_LOG_ERROR, "'%s': target not found\n", target); + pm_fprintf(stderr, ALPM_LOG_ERROR, "'%s': target not found\n", target); return -1; } for(p = grp->packages; p; p = alpm_list_next(p)) { alpm_pkg_t *pkg = alpm_list_getdata(p); if(alpm_remove_pkg(config->handle, pkg) == -1) { - pm_fprintf(stderr, PM_LOG_ERROR, "'%s': %s\n", target, + pm_fprintf(stderr, ALPM_LOG_ERROR, "'%s': %s\n", target, alpm_strerror(alpm_errno(config->handle))); return -1; } @@ -76,7 +76,7 @@ int pacman_remove(alpm_list_t *targets) alpm_list_t *i, *data = NULL; if(targets == NULL) { - pm_printf(PM_LOG_ERROR, _("no targets specified (use -h for help)\n")); + pm_printf(ALPM_LOG_ERROR, _("no targets specified (use -h for help)\n")); return 1; } @@ -103,16 +103,16 @@ int pacman_remove(alpm_list_t *targets) /* Step 2: prepare the transaction based on its type, targets and flags */ if(alpm_trans_prepare(config->handle, &data) == -1) { enum _alpm_errno_t err = alpm_errno(config->handle); - pm_fprintf(stderr, PM_LOG_ERROR, _("failed to prepare transaction (%s)\n"), + pm_fprintf(stderr, ALPM_LOG_ERROR, _("failed to prepare transaction (%s)\n"), alpm_strerror(err)); switch(err) { - case PM_ERR_PKG_INVALID_ARCH: + case ALPM_ERR_PKG_INVALID_ARCH: for(i = data; i; i = alpm_list_next(i)) { char *pkg = alpm_list_getdata(i); printf(_(":: package %s does not have a valid architecture\n"), pkg); } break; - case PM_ERR_UNSATISFIED_DEPS: + case ALPM_ERR_UNSATISFIED_DEPS: for(i = data; i; i = alpm_list_next(i)) { alpm_depmissing_t *miss = alpm_list_getdata(i); char *depstring = alpm_dep_compute_string(miss->depend); @@ -133,7 +133,7 @@ int pacman_remove(alpm_list_t *targets) for(i = alpm_trans_get_remove(config->handle); i; i = alpm_list_next(i)) { alpm_pkg_t *pkg = alpm_list_getdata(i); if(alpm_list_find_str(config->holdpkg, alpm_pkg_get_name(pkg))) { - pm_printf(PM_LOG_WARNING, _("%s is designated as a HoldPkg.\n"), + pm_printf(ALPM_LOG_WARNING, _("%s is designated as a HoldPkg.\n"), alpm_pkg_get_name(pkg)); holdpkg = 1; } @@ -164,7 +164,7 @@ int pacman_remove(alpm_list_t *targets) } if(alpm_trans_commit(config->handle, &data) == -1) { - pm_fprintf(stderr, PM_LOG_ERROR, _("failed to commit transaction (%s)\n"), + pm_fprintf(stderr, ALPM_LOG_ERROR, _("failed to commit transaction (%s)\n"), alpm_strerror(alpm_errno(config->handle))); retval = 1; } diff --git a/src/pacman/sync.c b/src/pacman/sync.c index ce57d3cd..ad6d5e5c 100644 --- a/src/pacman/sync.c +++ b/src/pacman/sync.c @@ -47,7 +47,7 @@ static int sync_cleandb(const char *dbpath, int keep_used) dir = opendir(dbpath); if(dir == NULL) { - pm_fprintf(stderr, PM_LOG_ERROR, _("could not access database directory\n")); + pm_fprintf(stderr, ALPM_LOG_ERROR, _("could not access database directory\n")); return 1; } @@ -82,7 +82,7 @@ static int sync_cleandb(const char *dbpath, int keep_used) len = strlen(path); if(S_ISDIR(buf.st_mode) || strcmp(path + len - 3, ".db") != 0) { if(rmrf(path)) { - pm_fprintf(stderr, PM_LOG_ERROR, + pm_fprintf(stderr, ALPM_LOG_ERROR, _("could not remove %s\n"), path); closedir(dir); return 1; @@ -108,7 +108,7 @@ static int sync_cleandb(const char *dbpath, int keep_used) } if(rmrf(path)) { - pm_fprintf(stderr, PM_LOG_ERROR, + pm_fprintf(stderr, ALPM_LOG_ERROR, _("could not remove %s\n"), path); closedir(dir); return 1; @@ -184,7 +184,7 @@ static int sync_cleancache(int level) struct dirent *ent; if(dir == NULL) { - pm_fprintf(stderr, PM_LOG_ERROR, + pm_fprintf(stderr, ALPM_LOG_ERROR, _("could not access cache directory %s\n"), cachedir); ret++; continue; @@ -240,7 +240,7 @@ static int sync_cleancache(int level) if(pkg != NULL && alpm_pkg_vercmp(local_version, alpm_pkg_get_version(pkg)) == 0) { /* package was found in local DB and version matches, keep it */ - pm_printf(PM_LOG_DEBUG, "pkg %s-%s found in local db\n", + pm_printf(ALPM_LOG_DEBUG, "pkg %s-%s found in local db\n", local_name, local_version); delete = 0; } @@ -254,7 +254,7 @@ static int sync_cleancache(int level) if(pkg != NULL && alpm_pkg_vercmp(local_version, alpm_pkg_get_version(pkg)) == 0) { /* package was found in a sync DB and version matches, keep it */ - pm_printf(PM_LOG_DEBUG, "pkg %s-%s found in sync db\n", + pm_printf(ALPM_LOG_DEBUG, "pkg %s-%s found in sync db\n", local_name, local_version); delete = 0; } @@ -288,7 +288,7 @@ static int sync_synctree(int level, alpm_list_t *syncs) ret = alpm_db_update((level < 2 ? 0 : 1), db); if(ret < 0) { - pm_fprintf(stderr, PM_LOG_ERROR, _("failed to update %s (%s)\n"), + pm_fprintf(stderr, ALPM_LOG_ERROR, _("failed to update %s (%s)\n"), alpm_db_get_name(db), alpm_strerror(alpm_errno(config->handle))); } else if(ret == 1) { printf(_(" %s is up to date\n"), alpm_db_get_name(db)); @@ -303,7 +303,7 @@ static int sync_synctree(int level, alpm_list_t *syncs) * expected */ if(!success) { - pm_fprintf(stderr, PM_LOG_ERROR, _("failed to synchronize any databases\n")); + pm_fprintf(stderr, ALPM_LOG_ERROR, _("failed to synchronize any databases\n")); } return (success > 0); } @@ -465,7 +465,7 @@ static int sync_info(alpm_list_t *syncs, alpm_list_t *targets) } if(!db) { - pm_fprintf(stderr, PM_LOG_ERROR, + pm_fprintf(stderr, ALPM_LOG_ERROR, _("repository '%s' does not exist\n"), repo); return 1; } @@ -481,7 +481,7 @@ static int sync_info(alpm_list_t *syncs, alpm_list_t *targets) } if(!foundpkg) { - pm_fprintf(stderr, PM_LOG_ERROR, + pm_fprintf(stderr, ALPM_LOG_ERROR, _("package '%s' was not found in repository '%s'\n"), pkgstr, repo); ret++; } @@ -502,7 +502,7 @@ static int sync_info(alpm_list_t *syncs, alpm_list_t *targets) } } if(!foundpkg) { - pm_fprintf(stderr, PM_LOG_ERROR, + pm_fprintf(stderr, ALPM_LOG_ERROR, _("package '%s' was not found\n"), pkgstr); ret++; } @@ -542,7 +542,7 @@ static int sync_list(alpm_list_t *syncs, alpm_list_t *targets) } if(db == NULL) { - pm_fprintf(stderr, PM_LOG_ERROR, + pm_fprintf(stderr, ALPM_LOG_ERROR, _("repository \"%s\" was not found.\n"),repo); alpm_list_free(ls); return 1; @@ -616,13 +616,13 @@ static int process_pkg(alpm_pkg_t *pkg) if(ret == -1) { enum _alpm_errno_t err = alpm_errno(config->handle); - if(err == PM_ERR_TRANS_DUP_TARGET - || err == PM_ERR_PKG_IGNORED) { + if(err == ALPM_ERR_TRANS_DUP_TARGET + || err == ALPM_ERR_PKG_IGNORED) { /* just skip duplicate or ignored targets */ - pm_printf(PM_LOG_WARNING, _("skipping target: %s\n"), alpm_pkg_get_name(pkg)); + pm_printf(ALPM_LOG_WARNING, _("skipping target: %s\n"), alpm_pkg_get_name(pkg)); return 0; } else { - pm_fprintf(stderr, PM_LOG_ERROR, "'%s': %s\n", alpm_pkg_get_name(pkg), + pm_fprintf(stderr, ALPM_LOG_ERROR, "'%s': %s\n", alpm_pkg_get_name(pkg), alpm_strerror(err)); return 1; } @@ -638,7 +638,7 @@ static int process_group(alpm_list_t *dbs, char *group) int count = alpm_list_count(pkgs); if(!count) { - pm_fprintf(stderr, PM_LOG_ERROR, _("target not found: %s\n"), group); + pm_fprintf(stderr, ALPM_LOG_ERROR, _("target not found: %s\n"), group); return 1; } @@ -681,8 +681,8 @@ static int process_targname(alpm_list_t *dblist, char *targname) alpm_pkg_t *pkg = alpm_find_dbs_satisfier(config->handle, dblist, targname); /* #FS#23342 - skip ignored packages when user says no */ - if(alpm_errno(config->handle) == PM_ERR_PKG_IGNORED) { - pm_printf(PM_LOG_WARNING, _("skipping target: %s\n"), targname); + if(alpm_errno(config->handle) == ALPM_ERR_PKG_IGNORED) { + pm_printf(ALPM_LOG_WARNING, _("skipping target: %s\n"), targname); /* TODO how to do this, we shouldn't be fucking with it from the frontend */ /* pm_errno = 0; */ return 0; @@ -712,7 +712,7 @@ static int process_target(char *target) dbname = targstring; db = get_db(dbname); if(!db) { - pm_fprintf(stderr, PM_LOG_ERROR, _("database not found: %s\n"), + pm_fprintf(stderr, ALPM_LOG_ERROR, _("database not found: %s\n"), dbname); ret = 1; goto cleanup; @@ -755,7 +755,7 @@ static int sync_trans(alpm_list_t *targets) printf(_(":: Starting full system upgrade...\n")); alpm_logaction(config->handle, "starting full system upgrade\n"); if(alpm_sync_sysupgrade(config->handle, config->op_s_upgrade >= 2) == -1) { - pm_fprintf(stderr, PM_LOG_ERROR, "%s\n", alpm_strerror(alpm_errno(config->handle))); + pm_fprintf(stderr, ALPM_LOG_ERROR, "%s\n", alpm_strerror(alpm_errno(config->handle))); retval = 1; goto cleanup; } @@ -764,16 +764,16 @@ static int sync_trans(alpm_list_t *targets) /* Step 2: "compute" the transaction based on targets and flags */ if(alpm_trans_prepare(config->handle, &data) == -1) { enum _alpm_errno_t err = alpm_errno(config->handle); - pm_fprintf(stderr, PM_LOG_ERROR, _("failed to prepare transaction (%s)\n"), + pm_fprintf(stderr, ALPM_LOG_ERROR, _("failed to prepare transaction (%s)\n"), alpm_strerror(err)); switch(err) { - case PM_ERR_PKG_INVALID_ARCH: + case ALPM_ERR_PKG_INVALID_ARCH: for(i = data; i; i = alpm_list_next(i)) { char *pkg = alpm_list_getdata(i); printf(_(":: package %s does not have a valid architecture\n"), pkg); } break; - case PM_ERR_UNSATISFIED_DEPS: + case ALPM_ERR_UNSATISFIED_DEPS: for(i = data; i; i = alpm_list_next(i)) { alpm_depmissing_t *miss = alpm_list_getdata(i); char *depstring = alpm_dep_compute_string(miss->depend); @@ -781,7 +781,7 @@ static int sync_trans(alpm_list_t *targets) free(depstring); } break; - case PM_ERR_CONFLICTING_DEPS: + case ALPM_ERR_CONFLICTING_DEPS: for(i = data; i; i = alpm_list_next(i)) { alpm_conflict_t *conflict = alpm_list_getdata(i); /* only print reason if it contains new information */ @@ -831,26 +831,26 @@ static int sync_trans(alpm_list_t *targets) if(alpm_trans_commit(config->handle, &data) == -1) { enum _alpm_errno_t err = alpm_errno(config->handle); - pm_fprintf(stderr, PM_LOG_ERROR, _("failed to commit transaction (%s)\n"), + pm_fprintf(stderr, ALPM_LOG_ERROR, _("failed to commit transaction (%s)\n"), alpm_strerror(err)); switch(err) { - case PM_ERR_FILE_CONFLICTS: + case ALPM_ERR_FILE_CONFLICTS: for(i = data; i; i = alpm_list_next(i)) { alpm_fileconflict_t *conflict = alpm_list_getdata(i); switch(conflict->type) { - case PM_FILECONFLICT_TARGET: + case ALPM_FILECONFLICT_TARGET: printf(_("%s exists in both '%s' and '%s'\n"), conflict->file, conflict->target, conflict->ctarget); break; - case PM_FILECONFLICT_FILESYSTEM: + case ALPM_FILECONFLICT_FILESYSTEM: printf(_("%s: %s exists in filesystem\n"), conflict->target, conflict->file); break; } } break; - case PM_ERR_PKG_INVALID: - case PM_ERR_DLT_INVALID: + case ALPM_ERR_PKG_INVALID: + case ALPM_ERR_DLT_INVALID: for(i = data; i; i = alpm_list_next(i)) { char *filename = alpm_list_getdata(i); printf(_("%s is invalid or corrupted\n"), filename); @@ -903,7 +903,7 @@ int pacman_sync(alpm_list_t *targets) /* ensure we have at least one valid sync db set up */ sync_dbs = alpm_option_get_syncdbs(config->handle); if(sync_dbs == NULL) { - pm_printf(PM_LOG_ERROR, _("no usable package repositories configured.\n")); + pm_printf(ALPM_LOG_ERROR, _("no usable package repositories configured.\n")); return 1; } @@ -944,13 +944,13 @@ int pacman_sync(alpm_list_t *targets) } else { /* don't proceed here unless we have an operation that doesn't require a * target list */ - pm_printf(PM_LOG_ERROR, _("no targets specified (use -h for help)\n")); + pm_printf(ALPM_LOG_ERROR, _("no targets specified (use -h for help)\n")); return 1; } } alpm_list_t *targs = alpm_list_strdup(targets); - if(!(config->flags & PM_TRANS_FLAG_DOWNLOADONLY) && !config->print) { + if(!(config->flags & ALPM_TRANS_FLAG_DOWNLOADONLY) && !config->print) { /* check for newer versions of packages to be upgraded first */ alpm_list_t *packages = syncfirst(); if(packages) { @@ -971,7 +971,7 @@ int pacman_sync(alpm_list_t *targets) } printf("\n"); } else { - pm_printf(PM_LOG_DEBUG, "skipping SyncFirst dialog\n"); + pm_printf(ALPM_LOG_DEBUG, "skipping SyncFirst dialog\n"); FREELIST(packages); } } diff --git a/src/pacman/upgrade.c b/src/pacman/upgrade.c index 31536a43..95b17cc1 100644 --- a/src/pacman/upgrade.c +++ b/src/pacman/upgrade.c @@ -46,7 +46,7 @@ int pacman_upgrade(alpm_list_t *targets) int retval = 0; if(targets == NULL) { - pm_printf(PM_LOG_ERROR, _("no targets specified (use -h for help)\n")); + pm_printf(ALPM_LOG_ERROR, _("no targets specified (use -h for help)\n")); return 1; } @@ -56,7 +56,7 @@ int pacman_upgrade(alpm_list_t *targets) if(strstr(i->data, "://")) { char *str = alpm_fetch_pkgurl(config->handle, i->data); if(str == NULL) { - pm_fprintf(stderr, PM_LOG_ERROR, "'%s': %s\n", + pm_fprintf(stderr, ALPM_LOG_ERROR, "'%s': %s\n", (char *)i->data, alpm_strerror(alpm_errno(config->handle))); return 1; } else { @@ -77,13 +77,13 @@ int pacman_upgrade(alpm_list_t *targets) alpm_pkg_t *pkg; if(alpm_pkg_load(config->handle, targ, 1, check_sig, &pkg) != 0) { - pm_fprintf(stderr, PM_LOG_ERROR, "'%s': %s\n", + pm_fprintf(stderr, ALPM_LOG_ERROR, "'%s': %s\n", targ, alpm_strerror(alpm_errno(config->handle))); trans_release(); return 1; } if(alpm_add_pkg(config->handle, pkg) == -1) { - pm_fprintf(stderr, PM_LOG_ERROR, "'%s': %s\n", + pm_fprintf(stderr, ALPM_LOG_ERROR, "'%s': %s\n", targ, alpm_strerror(alpm_errno(config->handle))); alpm_pkg_free(pkg); trans_release(); @@ -95,16 +95,16 @@ int pacman_upgrade(alpm_list_t *targets) /* TODO: No, compute nothing. This is stupid. */ if(alpm_trans_prepare(config->handle, &data) == -1) { enum _alpm_errno_t err = alpm_errno(config->handle); - pm_fprintf(stderr, PM_LOG_ERROR, _("failed to prepare transaction (%s)\n"), + pm_fprintf(stderr, ALPM_LOG_ERROR, _("failed to prepare transaction (%s)\n"), alpm_strerror(err)); switch(err) { - case PM_ERR_PKG_INVALID_ARCH: + case ALPM_ERR_PKG_INVALID_ARCH: for(i = data; i; i = alpm_list_next(i)) { char *pkg = alpm_list_getdata(i); printf(_(":: package %s does not have a valid architecture\n"), pkg); } break; - case PM_ERR_UNSATISFIED_DEPS: + case ALPM_ERR_UNSATISFIED_DEPS: for(i = data; i; i = alpm_list_next(i)) { alpm_depmissing_t *miss = alpm_list_getdata(i); char *depstring = alpm_dep_compute_string(miss->depend); @@ -116,7 +116,7 @@ int pacman_upgrade(alpm_list_t *targets) free(depstring); } break; - case PM_ERR_CONFLICTING_DEPS: + case ALPM_ERR_CONFLICTING_DEPS: for(i = data; i; i = alpm_list_next(i)) { alpm_conflict_t *conflict = alpm_list_getdata(i); if(strcmp(conflict->package1, conflict->reason) == 0 || @@ -163,26 +163,26 @@ int pacman_upgrade(alpm_list_t *targets) if(alpm_trans_commit(config->handle, &data) == -1) { enum _alpm_errno_t err = alpm_errno(config->handle); - pm_fprintf(stderr, PM_LOG_ERROR, _("failed to commit transaction (%s)\n"), + pm_fprintf(stderr, ALPM_LOG_ERROR, _("failed to commit transaction (%s)\n"), alpm_strerror(err)); switch(err) { - case PM_ERR_FILE_CONFLICTS: + case ALPM_ERR_FILE_CONFLICTS: for(i = data; i; i = alpm_list_next(i)) { alpm_fileconflict_t *conflict = alpm_list_getdata(i); switch(conflict->type) { - case PM_FILECONFLICT_TARGET: + case ALPM_FILECONFLICT_TARGET: printf(_("%s exists in both '%s' and '%s'\n"), conflict->file, conflict->target, conflict->ctarget); break; - case PM_FILECONFLICT_FILESYSTEM: + case ALPM_FILECONFLICT_FILESYSTEM: printf(_("%s: %s exists in filesystem\n"), conflict->target, conflict->file); break; } } break; - case PM_ERR_PKG_INVALID: - case PM_ERR_DLT_INVALID: + case ALPM_ERR_PKG_INVALID: + case ALPM_ERR_DLT_INVALID: for(i = data; i; i = alpm_list_next(i)) { char *filename = alpm_list_getdata(i); printf(_("%s is invalid or corrupted\n"), filename); diff --git a/src/pacman/util.c b/src/pacman/util.c index 6a93f6df..9ced7aad 100644 --- a/src/pacman/util.c +++ b/src/pacman/util.c @@ -61,9 +61,9 @@ int trans_init(alpm_transflag_t flags) if(ret == -1) { enum _alpm_errno_t err = alpm_errno(config->handle); - pm_fprintf(stderr, PM_LOG_ERROR, _("failed to init transaction (%s)\n"), + pm_fprintf(stderr, ALPM_LOG_ERROR, _("failed to init transaction (%s)\n"), alpm_strerror(err)); - if(err == PM_ERR_HANDLE_LOCK) { + if(err == ALPM_ERR_HANDLE_LOCK) { fprintf(stderr, _(" if you're sure a package manager is not already\n" " running, you can remove %s\n"), alpm_option_get_lockfile(config->handle)); @@ -77,7 +77,7 @@ int trans_init(alpm_transflag_t flags) int trans_release(void) { if(alpm_trans_release(config->handle) == -1) { - pm_fprintf(stderr, PM_LOG_ERROR, _("failed to release transaction (%s)\n"), + pm_fprintf(stderr, ALPM_LOG_ERROR, _("failed to release transaction (%s)\n"), alpm_strerror(alpm_errno(config->handle))); return -1; } @@ -749,7 +749,7 @@ void display_targets(const alpm_list_t *pkgs, int install) if(install) { size = humanize_size(dlsize, 'M', 1, &label); printf(_("Total Download Size: %.2f %s\n"), size, label); - if(!(config->flags & PM_TRANS_FLAG_DOWNLOADONLY)) { + if(!(config->flags & ALPM_TRANS_FLAG_DOWNLOADONLY)) { size = humanize_size(isize, 'M', 1, &label); printf(_("Total Installed Size: %.2f %s\n"), size, label); /* only show this net value if different from raw installed size */ @@ -1228,7 +1228,7 @@ int pm_asprintf(char **string, const char *format, ...) /* print the message using va_arg list */ va_start(args, format); if(vasprintf(string, format, args) == -1) { - pm_fprintf(stderr, PM_LOG_ERROR, _("failed to allocate string\n")); + pm_fprintf(stderr, ALPM_LOG_ERROR, _("failed to allocate string\n")); ret = -1; } va_end(args); @@ -1251,16 +1251,16 @@ int pm_vasprintf(char **string, alpm_loglevel_t level, const char *format, va_li /* print a prefix to the message */ switch(level) { - case PM_LOG_ERROR: + case ALPM_LOG_ERROR: pm_asprintf(string, _("error: %s"), msg); break; - case PM_LOG_WARNING: + case ALPM_LOG_WARNING: pm_asprintf(string, _("warning: %s"), msg); break; - case PM_LOG_DEBUG: + case ALPM_LOG_DEBUG: pm_asprintf(string, "debug: %s", msg); break; - case PM_LOG_FUNCTION: + case ALPM_LOG_FUNCTION: pm_asprintf(string, "function: %s", msg); break; default: @@ -1283,7 +1283,7 @@ int pm_vfprintf(FILE *stream, alpm_loglevel_t level, const char *format, va_list #if defined(PACMAN_DEBUG) /* If debug is on, we'll timestamp the output */ - if(config->logmask & PM_LOG_DEBUG) { + if(config->logmask & ALPM_LOG_DEBUG) { time_t t; struct tm *tmp; char timestr[10] = {0}; @@ -1299,16 +1299,16 @@ int pm_vfprintf(FILE *stream, alpm_loglevel_t level, const char *format, va_list /* print a prefix to the message */ switch(level) { - case PM_LOG_ERROR: + case ALPM_LOG_ERROR: fprintf(stream, _("error: ")); break; - case PM_LOG_WARNING: + case ALPM_LOG_WARNING: fprintf(stream, _("warning: ")); break; - case PM_LOG_DEBUG: + case ALPM_LOG_DEBUG: fprintf(stream, "debug: "); break; - case PM_LOG_FUNCTION: + case ALPM_LOG_FUNCTION: fprintf(stream, "function: "); break; default: |