1
0
mirror of https://github.com/moparisthebest/pacman synced 2024-12-22 15:58:50 -05:00

libalpm: add newlines to all strings passed to log callback

This allows us to remove the hack in the frontend where we added a newline
to everything coming out of the pm_printf functions, and instead let the
developer put newlines where they want them. This should be the last hangover
of that auto-newline stuff.

Signed-off-by: Dan McGee <dan@archlinux.org>
This commit is contained in:
Dan McGee 2007-08-23 22:26:55 -04:00
parent 2798ebbb62
commit 5c9eec5570
15 changed files with 302 additions and 303 deletions

View File

@ -65,7 +65,7 @@ int _alpm_add_loadtarget(pmtrans_t *trans, pmdb_t *db, char *name)
ASSERT(db != NULL, RET_ERR(PM_ERR_DB_NULL, -1));
ASSERT(name != NULL && strlen(name) != 0, RET_ERR(PM_ERR_WRONG_ARGS, -1));
_alpm_log(PM_LOG_DEBUG, "loading target '%s'", name);
_alpm_log(PM_LOG_DEBUG, "loading target '%s'\n", name);
/* TODO FS#5120 we need a better way to check if a package is a valid package,
* and read the metadata instead of relying on the filename for package name
@ -110,7 +110,7 @@ int _alpm_add_loadtarget(pmtrans_t *trans, pmdb_t *db, char *name)
if(strcmp(pkg->name, pkgname) == 0) {
if(_alpm_versioncmp(pkg->version, pkgver) < 0) {
pmpkg_t *newpkg;
_alpm_log(PM_LOG_WARNING, _("replacing older version %s-%s by %s in target list"),
_alpm_log(PM_LOG_WARNING, _("replacing older version %s-%s by %s in target list\n"),
pkg->name, pkg->version, pkgver);
if((newpkg = _alpm_pkg_load(name)) == NULL) {
/* pm_errno is already set by pkg_load() */
@ -119,14 +119,14 @@ int _alpm_add_loadtarget(pmtrans_t *trans, pmdb_t *db, char *name)
_alpm_pkg_free(i->data);
i->data = newpkg;
} else {
_alpm_log(PM_LOG_WARNING, _("newer version %s-%s is in the target list -- skipping"),
_alpm_log(PM_LOG_WARNING, _("newer version %s-%s is in the target list -- skipping\n"),
pkg->name, pkg->version);
}
return(0);
}
}
_alpm_log(PM_LOG_DEBUG, "reading '%s' metadata", pkgname);
_alpm_log(PM_LOG_DEBUG, "reading '%s' metadata\n", pkgname);
info = _alpm_pkg_load(name);
if(info == NULL) {
/* pm_errno is already set by pkg_load() */
@ -176,7 +176,7 @@ int _alpm_add_prepare(pmtrans_t *trans, pmdb_t *db, alpm_list_t **data)
EVENT(trans, PM_TRANS_EVT_CHECKDEPS_START, NULL, NULL);
/* look for unsatisfied dependencies */
_alpm_log(PM_LOG_DEBUG, "looking for unsatisfied dependencies");
_alpm_log(PM_LOG_DEBUG, "looking for unsatisfied dependencies\n");
lp = _alpm_checkdeps(db, trans->type, trans->packages);
if(lp != NULL) {
if(data) {
@ -188,13 +188,13 @@ int _alpm_add_prepare(pmtrans_t *trans, pmdb_t *db, alpm_list_t **data)
}
/* no unsatisfied deps, so look for conflicts */
_alpm_log(PM_LOG_DEBUG, "looking for conflicts");
_alpm_log(PM_LOG_DEBUG, "looking for conflicts\n");
lp = _alpm_checkconflicts(db, trans->packages);
for(i = lp; i; i = i->next) {
pmdepmissing_t *miss = i->data;
_alpm_log(PM_LOG_ERROR, _("replacing packages with -A and -U is not supported yet"));
_alpm_log(PM_LOG_ERROR, _("please remove '%s' first, using -Rd"), miss->depend.name);
_alpm_log(PM_LOG_ERROR, _("replacing packages with -A and -U is not supported yet\n"));
_alpm_log(PM_LOG_ERROR, _("please remove '%s' first, using -Rd\n"), miss->depend.name);
RET_ERR(PM_ERR_CONFLICTING_DEPS, -1);
/* Attempt to resolve conflicts */
@ -235,7 +235,7 @@ int _alpm_add_prepare(pmtrans_t *trans, pmdb_t *db, alpm_list_t **data)
}
/* re-order w.r.t. dependencies */
_alpm_log(PM_LOG_DEBUG, "sorting by dependencies");
_alpm_log(PM_LOG_DEBUG, "sorting by dependencies\n");
lp = _alpm_sortbydeps(trans->packages, PM_TRANS_TYPE_ADD);
/* free the old alltargs */
alpm_list_free(trans->packages);
@ -248,7 +248,7 @@ int _alpm_add_prepare(pmtrans_t *trans, pmdb_t *db, alpm_list_t **data)
if(!(trans->flags & PM_TRANS_FLAG_FORCE)) {
EVENT(trans, PM_TRANS_EVT_FILECONFLICTS_START, NULL, NULL);
_alpm_log(PM_LOG_DEBUG, "looking for file conflicts");
_alpm_log(PM_LOG_DEBUG, "looking for file conflicts\n");
lp = _alpm_db_find_conflicts(db, trans, handle->root);
if(lp != NULL) {
if(data) {
@ -271,7 +271,7 @@ static int upgrade_remove(pmpkg_t *oldpkg, pmpkg_t *newpkg, pmtrans_t *trans, pm
* with the type PM_TRANS_TYPE_REMOVEUPGRADE. TODO: kill this weird
* behavior. */
pmtrans_t *tr = _alpm_trans_new();
_alpm_log(PM_LOG_DEBUG, "removing old package first (%s-%s)",
_alpm_log(PM_LOG_DEBUG, "removing old package first (%s-%s)\n",
oldpkg->name, oldpkg->version);
if(!tr) {
@ -303,7 +303,7 @@ static int upgrade_remove(pmpkg_t *oldpkg, pmpkg_t *newpkg, pmtrans_t *trans, pm
alpm_list_t *old_noupgrade = alpm_list_strdup(handle->noupgrade);
for(b = alpm_pkg_get_backup(newpkg); b; b = b->next) {
const char *backup = b->data;
_alpm_log(PM_LOG_DEBUG, "adding %s to the NoUpgrade array temporarily",
_alpm_log(PM_LOG_DEBUG, "adding %s to the NoUpgrade array temporarily\n",
backup);
handle->noupgrade = alpm_list_add(handle->noupgrade, strdup(backup));
}
@ -355,7 +355,7 @@ static int extract_single_file(struct archive *archive,
} else if(*entryname == '.') {
/* for now, ignore all files starting with '.' that haven't
* already been handled (for future possibilities) */
_alpm_log(PM_LOG_DEBUG, "skipping extraction of '%s'", entryname);
_alpm_log(PM_LOG_DEBUG, "skipping extraction of '%s'\n", entryname);
archive_read_data_skip(archive);
return(0);
} else {
@ -365,7 +365,7 @@ static int extract_single_file(struct archive *archive,
/* if a file is in NoExtract then we never extract it */
if(alpm_list_find_str(handle->noextract, entryname)) {
_alpm_log(PM_LOG_DEBUG, "%s is in NoExtract, skipping extraction",
_alpm_log(PM_LOG_DEBUG, "%s is in NoExtract, skipping extraction\n",
entryname);
alpm_logaction("note: %s is in NoExtract, skipping extraction",
entryname);
@ -375,7 +375,7 @@ static int extract_single_file(struct archive *archive,
/* if a file is in the add skiplist we never extract it */
if(alpm_list_find_str(trans->skip_add, filename)) {
_alpm_log(PM_LOG_DEBUG, "%s is in trans->skip_add, skipping extraction", entryname);
_alpm_log(PM_LOG_DEBUG, "%s is in trans->skip_add, skipping extraction\n", entryname);
archive_read_data_skip(archive);
return(0);
}
@ -419,13 +419,13 @@ static int extract_single_file(struct archive *archive,
"filesystem: %o package: %o", entryname, lsbuf.st_mode & mask,
entrymode & mask);
}
_alpm_log(PM_LOG_DEBUG, "extract: skipping dir extraction of %s",
_alpm_log(PM_LOG_DEBUG, "extract: skipping dir extraction of %s\n",
entryname);
archive_read_data_skip(archive);
return(0);
} else if(S_ISDIR(lsbuf.st_mode) && S_ISLNK(entrymode)) {
/* case 11: existing dir, symlink in package, ignore it */
_alpm_log(PM_LOG_DEBUG, "extract: skipping symlink extraction of %s",
_alpm_log(PM_LOG_DEBUG, "extract: skipping symlink extraction of %s\n",
entryname);
archive_read_data_skip(archive);
return(0);
@ -433,26 +433,26 @@ static int extract_single_file(struct archive *archive,
/* case 9: existing symlink, dir in package */
if(S_ISDIR(sbuf.st_mode)) {
/* the symlink on FS is to a directory, so we'll use it */
_alpm_log(PM_LOG_DEBUG, "extract: skipping symlink overwrite of %s",
_alpm_log(PM_LOG_DEBUG, "extract: skipping symlink overwrite of %s\n",
entryname);
archive_read_data_skip(archive);
return(0);
} else {
/* this is BAD. symlink was not to a directory */
_alpm_log(PM_LOG_ERROR, _("extract: symlink %s does not point to dir"),
_alpm_log(PM_LOG_ERROR, _("extract: symlink %s does not point to dir\n"),
entryname);
archive_read_data_skip(archive);
return(1);
}
} else if(S_ISDIR(lsbuf.st_mode) && S_ISREG(entrymode)) {
/* case 10: trying to overwrite dir tree with file, don't allow it */
_alpm_log(PM_LOG_ERROR, _("extract: not overwriting dir with file %s"),
_alpm_log(PM_LOG_ERROR, _("extract: not overwriting dir with file %s\n"),
entryname);
archive_read_data_skip(archive);
return(1);
} else if(S_ISREG(lsbuf.st_mode) && S_ISDIR(entrymode)) {
/* case 6: trying to overwrite file with dir */
_alpm_log(PM_LOG_DEBUG, "extract: overwriting file with dir %s",
_alpm_log(PM_LOG_DEBUG, "extract: overwriting file with dir %s\n",
entryname);
} else if(S_ISREG(entrymode)) {
/* case 4,7: */
@ -496,10 +496,10 @@ static int extract_single_file(struct archive *archive,
int ret = archive_read_extract(archive, entry, archive_flags);
if(ret == ARCHIVE_WARN) {
/* operation succeeded but a non-critical error was encountered */
_alpm_log(PM_LOG_DEBUG, "warning extracting %s (%s)",
_alpm_log(PM_LOG_DEBUG, "warning extracting %s (%s)\n",
entryname, archive_error_string(archive));
} else if(ret != ARCHIVE_OK) {
_alpm_log(PM_LOG_ERROR, _("could not extract %s (%s)"),
_alpm_log(PM_LOG_ERROR, _("could not extract %s (%s)\n"),
entryname, archive_error_string(archive));
alpm_logaction("error: could not extract %s (%s)",
entryname, archive_error_string(archive));
@ -535,10 +535,10 @@ static int extract_single_file(struct archive *archive,
backups->data = backup;
}
_alpm_log(PM_LOG_DEBUG, "checking hashes for %s", entryname);
_alpm_log(PM_LOG_DEBUG, "current: %s", hash_local);
_alpm_log(PM_LOG_DEBUG, "new: %s", hash_pkg);
_alpm_log(PM_LOG_DEBUG, "original: %s", hash_orig);
_alpm_log(PM_LOG_DEBUG, "checking hashes for %s\n", entryname);
_alpm_log(PM_LOG_DEBUG, "current: %s\n", hash_local);
_alpm_log(PM_LOG_DEBUG, "new: %s\n", hash_pkg);
_alpm_log(PM_LOG_DEBUG, "original: %s\n", hash_orig);
if(!oldpkg) {
/* looks like we have a local file that has a different hash as the
@ -550,19 +550,19 @@ static int extract_single_file(struct archive *archive,
/* move the existing file to the "pacorig" */
if(rename(filename, newpath)) {
archive_entry_set_pathname(entry, filename);
_alpm_log(PM_LOG_ERROR, _("could not rename %s (%s)"), filename, strerror(errno));
_alpm_log(PM_LOG_ERROR, _("could not rename %s (%s)\n"), filename, strerror(errno));
alpm_logaction("error: could not rename %s (%s)", filename, strerror(errno));
errors++;
} else {
/* copy the tempfile we extracted to the real path */
if(_alpm_copyfile(tempfile, filename)) {
archive_entry_set_pathname(entry, filename);
_alpm_log(PM_LOG_ERROR, _("could not copy tempfile to %s (%s)"), filename, strerror(errno));
_alpm_log(PM_LOG_ERROR, _("could not copy tempfile to %s (%s)\n"), filename, strerror(errno));
alpm_logaction("error: could not copy tempfile to %s (%s)", filename, strerror(errno));
errors++;
} else {
archive_entry_set_pathname(entry, filename);
_alpm_log(PM_LOG_WARNING, _("%s saved as %s"), filename, newpath);
_alpm_log(PM_LOG_WARNING, _("%s saved as %s\n"), filename, newpath);
alpm_logaction("warning: %s saved as %s", filename, newpath);
}
}
@ -573,38 +573,38 @@ static int extract_single_file(struct archive *archive,
if(strcmp(hash_orig, hash_local) == 0) {
/* installed file has NOT been changed by user */
if(strcmp(hash_orig, hash_pkg) != 0) {
_alpm_log(PM_LOG_DEBUG, "action: installing new file: %s",
_alpm_log(PM_LOG_DEBUG, "action: installing new file: %s\n",
entryname);
if(_alpm_copyfile(tempfile, filename)) {
_alpm_log(PM_LOG_ERROR, _("could not copy tempfile to %s (%s)"), filename, strerror(errno));
_alpm_log(PM_LOG_ERROR, _("could not copy tempfile to %s (%s)\n"), filename, strerror(errno));
errors++;
}
archive_entry_set_pathname(entry, filename);
} else {
/* there's no sense in installing the same file twice, install
* ONLY is the original and package hashes differ */
_alpm_log(PM_LOG_DEBUG, "action: leaving existing file in place");
_alpm_log(PM_LOG_DEBUG, "action: leaving existing file in place\n");
}
} else if(strcmp(hash_orig, hash_pkg) == 0) {
/* originally installed file and new file are the same - this
* implies the case above failed - i.e. the file was changed by a
* user */
_alpm_log(PM_LOG_DEBUG, "action: leaving existing file in place");
_alpm_log(PM_LOG_DEBUG, "action: leaving existing file in place\n");
} else if(strcmp(hash_local, hash_pkg) == 0) {
/* this would be magical. The above two cases failed, but the
* user changes just so happened to make the new file exactly the
* same as the one in the package... skip it */
_alpm_log(PM_LOG_DEBUG, "action: leaving existing file in place");
_alpm_log(PM_LOG_DEBUG, "action: leaving existing file in place\n");
} else {
char newpath[PATH_MAX];
_alpm_log(PM_LOG_DEBUG, "action: keeping current file and installing new one with .pacnew ending");
_alpm_log(PM_LOG_DEBUG, "action: keeping current file and installing new one with .pacnew ending\n");
snprintf(newpath, PATH_MAX, "%s.pacnew", filename);
if(_alpm_copyfile(tempfile, newpath)) {
_alpm_log(PM_LOG_ERROR, _("could not install %s as %s: %s"), filename, newpath, strerror(errno));
_alpm_log(PM_LOG_ERROR, _("could not install %s as %s: %s\n"), filename, newpath, strerror(errno));
alpm_logaction("error: could not install %s as %s: %s", filename, newpath, strerror(errno));
} else {
_alpm_log(PM_LOG_WARNING, _("%s installed as %s"), filename, newpath);
_alpm_log(PM_LOG_WARNING, _("%s installed as %s\n"), filename, newpath);
alpm_logaction("warning: %s installed as %s", filename, newpath);
}
}
@ -620,12 +620,12 @@ static int extract_single_file(struct archive *archive,
/* we didn't need a backup */
if(notouch) {
/* change the path to a .pacnew extension */
_alpm_log(PM_LOG_DEBUG, "%s is in NoUpgrade -- skipping", filename);
_alpm_log(PM_LOG_WARNING, _("extracting %s as %s.pacnew"), filename, filename);
_alpm_log(PM_LOG_DEBUG, "%s is in NoUpgrade -- skipping\n", filename);
_alpm_log(PM_LOG_WARNING, _("extracting %s as %s.pacnew\n"), filename, filename);
alpm_logaction("warning: extracting %s as %s.pacnew", filename, filename);
strncat(filename, ".pacnew", PATH_MAX - strlen(filename));
} else {
_alpm_log(PM_LOG_DEBUG, "extracting %s", filename);
_alpm_log(PM_LOG_DEBUG, "extracting %s\n", filename);
}
if(trans->flags & PM_TRANS_FLAG_FORCE) {
@ -640,10 +640,10 @@ static int extract_single_file(struct archive *archive,
int ret = archive_read_extract(archive, entry, archive_flags);
if(ret == ARCHIVE_WARN) {
/* operation succeeded but a non-critical error was encountered */
_alpm_log(PM_LOG_DEBUG, "warning extracting %s (%s)",
_alpm_log(PM_LOG_DEBUG, "warning extracting %s (%s)\n",
entryname, archive_error_string(archive));
} else if(ret != ARCHIVE_OK) {
_alpm_log(PM_LOG_ERROR, _("could not extract %s (%s)"),
_alpm_log(PM_LOG_ERROR, _("could not extract %s (%s)\n"),
entryname, archive_error_string(archive));
alpm_logaction("error: could not extract %s (%s)",
entryname, archive_error_string(archive));
@ -661,7 +661,7 @@ static int extract_single_file(struct archive *archive,
if(!oldbackup || strcmp(oldbackup, entryname) != 0) {
return(0);
}
_alpm_log(PM_LOG_DEBUG, "appending backup entry for %s", filename);
_alpm_log(PM_LOG_DEBUG, "appending backup entry for %s\n", filename);
hash = alpm_get_md5sum(filename);
backup = malloc(backup_len);
@ -700,7 +700,7 @@ static int commit_single_pkg(pmpkg_t *newpkg, int pkg_current, int pkg_count,
is_upgrade = 1;
EVENT(trans, PM_TRANS_EVT_UPGRADE_START, newpkg, NULL);
_alpm_log(PM_LOG_DEBUG, "upgrading package %s-%s",
_alpm_log(PM_LOG_DEBUG, "upgrading package %s-%s\n",
newpkg->name, newpkg->version);
/* we'll need to save some record for backup checks later */
@ -721,7 +721,7 @@ static int commit_single_pkg(pmpkg_t *newpkg, int pkg_current, int pkg_count,
is_upgrade = 0;
EVENT(trans, PM_TRANS_EVT_ADD_START, newpkg, NULL);
_alpm_log(PM_LOG_DEBUG, "adding package %s-%s",
_alpm_log(PM_LOG_DEBUG, "adding package %s-%s\n",
newpkg->name, newpkg->version);
/* pre_install scriptlet */
@ -740,7 +740,7 @@ static int commit_single_pkg(pmpkg_t *newpkg, int pkg_current, int pkg_count,
}
if(!(trans->flags & PM_TRANS_FLAG_DBONLY)) {
_alpm_log(PM_LOG_DEBUG, "extracting files");
_alpm_log(PM_LOG_DEBUG, "extracting files\n");
if ((archive = archive_read_new()) == NULL) {
RET_ERR(PM_ERR_LIBARCHIVE_ERROR, -1);
@ -756,7 +756,7 @@ static int commit_single_pkg(pmpkg_t *newpkg, int pkg_current, int pkg_count,
/* save the cwd so we can restore it later */
if(getcwd(cwd, PATH_MAX) == NULL) {
_alpm_log(PM_LOG_ERROR, _("could not get current working directory"));
_alpm_log(PM_LOG_ERROR, _("could not get current working directory\n"));
cwd[0] = 0;
}
@ -779,7 +779,7 @@ static int commit_single_pkg(pmpkg_t *newpkg, int pkg_current, int pkg_count,
* (missing metadata sizes) */
unsigned long pos = archive_position_compressed(archive);
percent = (double)pos / (double)newpkg->size;
_alpm_log(PM_LOG_DEBUG, "decompression progress: %f%% (%ld / %ld)",
_alpm_log(PM_LOG_DEBUG, "decompression progress: %f%% (%ld / %ld)\n",
percent*100.0, pos, newpkg->size);
if(percent >= 1.0) {
percent = 1.0;
@ -810,12 +810,12 @@ static int commit_single_pkg(pmpkg_t *newpkg, int pkg_current, int pkg_count,
if(errors) {
ret = 1;
if(is_upgrade) {
_alpm_log(PM_LOG_ERROR, _("problem occurred while upgrading %s"),
_alpm_log(PM_LOG_ERROR, _("problem occurred while upgrading %s\n"),
newpkg->name);
alpm_logaction("error: problem occurred while upgrading %s",
newpkg->name);
} else {
_alpm_log(PM_LOG_ERROR, _("problem occurred while installing %s"),
_alpm_log(PM_LOG_ERROR, _("problem occurred while installing %s\n"),
newpkg->name);
alpm_logaction("error: problem occurred while installing %s",
newpkg->name);
@ -833,11 +833,11 @@ static int commit_single_pkg(pmpkg_t *newpkg, int pkg_current, int pkg_count,
/* remove the extra line feed appended by asctime() */
newpkg->installdate[strlen(newpkg->installdate)-1] = 0;
_alpm_log(PM_LOG_DEBUG, "updating database");
_alpm_log(PM_LOG_DEBUG, "adding database entry '%s'", newpkg->name);
_alpm_log(PM_LOG_DEBUG, "updating database\n");
_alpm_log(PM_LOG_DEBUG, "adding database entry '%s'\n", newpkg->name);
if(_alpm_db_write(db, newpkg, INFRQ_ALL)) {
_alpm_log(PM_LOG_ERROR, _("could not update database entry %s-%s"),
_alpm_log(PM_LOG_ERROR, _("could not update database entry %s-%s\n"),
alpm_pkg_get_name(newpkg), alpm_pkg_get_version(newpkg));
alpm_logaction("error: could not update database entry %s-%s",
alpm_pkg_get_name(newpkg), alpm_pkg_get_version(newpkg));
@ -845,7 +845,7 @@ static int commit_single_pkg(pmpkg_t *newpkg, int pkg_current, int pkg_count,
}
if(_alpm_db_add_pkgincache(db, newpkg) == -1) {
_alpm_log(PM_LOG_ERROR, _("could not add entry '%s' in cache"),
_alpm_log(PM_LOG_ERROR, _("could not add entry '%s' in cache\n"),
alpm_pkg_get_name(newpkg));
}
@ -915,7 +915,7 @@ int _alpm_add_commit(pmtrans_t *trans, pmdb_t *db)
/* run ldconfig if it exists */
if(handle->trans->state != STATE_INTERRUPTED) {
_alpm_log(PM_LOG_DEBUG, "running \"ldconfig -r %s\"", handle->root);
_alpm_log(PM_LOG_DEBUG, "running \"ldconfig -r %s\"\n", handle->root);
_alpm_ldconfig(handle->root);
}

View File

@ -53,7 +53,7 @@ int _alpm_db_install(pmdb_t *db, const char *dbfile)
/* TODO we should not simply unpack the archive, but better parse it and
* db_write each entry (see sync_load_dbarchive to get archive content) */
_alpm_log(PM_LOG_DEBUG, "unpacking database '%s'", dbfile);
_alpm_log(PM_LOG_DEBUG, "unpacking database '%s'\n", dbfile);
if(_alpm_unpack(dbfile, db->path, NULL)) {
RET_ERR(PM_ERR_SYSTEM, -1);
@ -102,7 +102,7 @@ int _alpm_db_open(pmdb_t *db)
RET_ERR(PM_ERR_DB_NULL, -1);
}
_alpm_log(PM_LOG_DEBUG, "opening database from path '%s'", db->path);
_alpm_log(PM_LOG_DEBUG, "opening database from path '%s'\n", db->path);
db->handle = opendir(db->path);
if(db->handle == NULL) {
RET_ERR(PM_ERR_DB_OPEN, -1);
@ -206,11 +206,11 @@ pmpkg_t *_alpm_db_scan(pmdb_t *db, const char *target)
pkg = _alpm_pkg_new(NULL, NULL);
if(pkg == NULL) {
_alpm_log(PM_LOG_DEBUG, "db scan could not find package: %s", target);
_alpm_log(PM_LOG_DEBUG, "db scan could not find package: %s\n", target);
return(NULL);
}
if(_alpm_pkg_splitname(ent->d_name, pkg->name, pkg->version, 0) == -1) {
_alpm_log(PM_LOG_ERROR, _("invalid name for database entry '%s'"), ent->d_name);
_alpm_log(PM_LOG_ERROR, _("invalid name for database entry '%s'\n"), ent->d_name);
alpm_pkg_free(pkg);
pkg = NULL;
continue;
@ -243,12 +243,12 @@ int _alpm_db_read(pmdb_t *db, pmpkg_t *info, pmdbinfrq_t inforeq)
}
if(info == NULL || info->name[0] == 0 || info->version[0] == 0) {
_alpm_log(PM_LOG_DEBUG, "invalid package entry provided to _alpm_db_read, skipping");
_alpm_log(PM_LOG_DEBUG, "invalid package entry provided to _alpm_db_read, skipping\n");
return(-1);
}
if(info->origin == PKG_FROM_FILE) {
_alpm_log(PM_LOG_DEBUG, "request to read database info for a file-based package '%s', skipping...", info->name);
_alpm_log(PM_LOG_DEBUG, "request to read database info for a file-based package '%s', skipping...\n", info->name);
return(-1);
}
@ -261,7 +261,7 @@ int _alpm_db_read(pmdb_t *db, pmpkg_t *info, pmdbinfrq_t inforeq)
/* already loaded this info, do nothing */
return(0);
}
_alpm_log(PM_LOG_FUNCTION, _("loading package data for %s : level=%d"), info->name, inforeq);
_alpm_log(PM_LOG_FUNCTION, _("loading package data for %s : level=%d\n"), info->name, inforeq);
/* clear out 'line', to be certain - and to make valgrind happy */
memset(line, 0, 513);
@ -269,7 +269,7 @@ int _alpm_db_read(pmdb_t *db, pmpkg_t *info, pmdbinfrq_t inforeq)
snprintf(path, PATH_MAX, "%s/%s-%s", db->path, info->name, info->version);
if(stat(path, &buf)) {
/* directory doesn't exist or can't be opened */
_alpm_log(PM_LOG_DEBUG, "cannot find '%s-%s' in db '%s'",
_alpm_log(PM_LOG_DEBUG, "cannot find '%s-%s' in db '%s'\n",
info->name, info->version, db->treename);
return(-1);
}
@ -278,7 +278,7 @@ int _alpm_db_read(pmdb_t *db, pmpkg_t *info, pmdbinfrq_t inforeq)
if(inforeq & INFRQ_DESC) {
snprintf(path, PATH_MAX, "%s/%s-%s/desc", db->path, info->name, info->version);
if((fp = fopen(path, "r")) == NULL) {
_alpm_log(PM_LOG_ERROR, _("could not open file %s: %s"), path, strerror(errno));
_alpm_log(PM_LOG_ERROR, _("could not open file %s: %s\n"), path, strerror(errno));
goto error;
}
while(!feof(fp)) {
@ -387,7 +387,7 @@ int _alpm_db_read(pmdb_t *db, pmpkg_t *info, pmdbinfrq_t inforeq)
if(inforeq & INFRQ_FILES) {
snprintf(path, PATH_MAX, "%s/%s-%s/files", db->path, info->name, info->version);
if((fp = fopen(path, "r")) == NULL) {
_alpm_log(PM_LOG_ERROR, _("could not open file %s: %s"), path, strerror(errno));
_alpm_log(PM_LOG_ERROR, _("could not open file %s: %s\n"), path, strerror(errno));
goto error;
}
while(fgets(line, 256, fp)) {
@ -410,7 +410,7 @@ int _alpm_db_read(pmdb_t *db, pmpkg_t *info, pmdbinfrq_t inforeq)
if(inforeq & INFRQ_DEPENDS) {
snprintf(path, PATH_MAX, "%s/%s-%s/depends", db->path, info->name, info->version);
if((fp = fopen(path, "r")) == NULL) {
_alpm_log(PM_LOG_ERROR, _("could not open file %s: %s"), path, strerror(errno));
_alpm_log(PM_LOG_ERROR, _("could not open file %s: %s\n"), path, strerror(errno));
goto error;
}
while(!feof(fp)) {
@ -498,11 +498,11 @@ int _alpm_db_write(pmdb_t *db, pmpkg_t *info, pmdbinfrq_t inforeq)
/* DESC */
if(inforeq & INFRQ_DESC) {
_alpm_log(PM_LOG_DEBUG, "writing %s-%s DESC information back to db",
_alpm_log(PM_LOG_DEBUG, "writing %s-%s DESC information back to db\n",
info->name, info->version);
snprintf(path, PATH_MAX, "%s/%s-%s/desc", db->path, info->name, info->version);
if((fp = fopen(path, "w")) == NULL) {
_alpm_log(PM_LOG_ERROR, _("could not open file %s: %s"), path, strerror(errno));
_alpm_log(PM_LOG_ERROR, _("could not open file %s: %s\n"), path, strerror(errno));
retval = -1;
goto cleanup;
}
@ -576,11 +576,11 @@ int _alpm_db_write(pmdb_t *db, pmpkg_t *info, pmdbinfrq_t inforeq)
/* FILES */
if(local && (inforeq & INFRQ_FILES)) {
_alpm_log(PM_LOG_DEBUG, "writing %s-%s FILES information back to db",
_alpm_log(PM_LOG_DEBUG, "writing %s-%s FILES information back to db\n",
info->name, info->version);
snprintf(path, PATH_MAX, "%s/%s-%s/files", db->path, info->name, info->version);
if((fp = fopen(path, "w")) == NULL) {
_alpm_log(PM_LOG_ERROR, _("could not open file %s: %s"), path, strerror(errno));
_alpm_log(PM_LOG_ERROR, _("could not open file %s: %s\n"), path, strerror(errno));
retval = -1;
goto cleanup;
}
@ -604,11 +604,11 @@ int _alpm_db_write(pmdb_t *db, pmpkg_t *info, pmdbinfrq_t inforeq)
/* DEPENDS */
if(inforeq & INFRQ_DEPENDS) {
_alpm_log(PM_LOG_DEBUG, "writing %s-%s DEPENDS information back to db",
_alpm_log(PM_LOG_DEBUG, "writing %s-%s DEPENDS information back to db\n",
info->name, info->version);
snprintf(path, PATH_MAX, "%s/%s-%s/depends", db->path, info->name, info->version);
if((fp = fopen(path, "w")) == NULL) {
_alpm_log(PM_LOG_ERROR, _("could not open file %s: %s"), path, strerror(errno));
_alpm_log(PM_LOG_ERROR, _("could not open file %s: %s\n"), path, strerror(errno));
retval = -1;
goto cleanup;
}

View File

@ -54,12 +54,12 @@ int _alpm_db_load_pkgcache(pmdb_t *db)
_alpm_db_free_pkgcache(db);
_alpm_log(PM_LOG_DEBUG, "loading package cache for repository '%s'",
_alpm_log(PM_LOG_DEBUG, "loading package cache for repository '%s'\n",
db->treename);
_alpm_db_rewind(db);
while((info = _alpm_db_scan(db, NULL)) != NULL) {
_alpm_log(PM_LOG_FUNCTION, _("adding '%s' to package cache for db '%s'"),
_alpm_log(PM_LOG_FUNCTION, _("adding '%s' to package cache for db '%s'\n"),
alpm_pkg_get_name(info), db->treename);
info->origin = PKG_FROM_CACHE;
info->origin_data.db = db;
@ -80,7 +80,7 @@ void _alpm_db_free_pkgcache(pmdb_t *db)
return;
}
_alpm_log(PM_LOG_DEBUG, "freeing package cache for repository '%s'",
_alpm_log(PM_LOG_DEBUG, "freeing package cache for repository '%s'\n",
db->treename);
alpm_list_t *tmp;
@ -109,7 +109,7 @@ alpm_list_t *_alpm_db_get_pkgcache(pmdb_t *db)
/* hmmm, still NULL ?*/
if(!db->pkgcache) {
_alpm_log(PM_LOG_DEBUG, "error: pkgcache is NULL for db '%s'", db->treename);
_alpm_log(PM_LOG_DEBUG, "error: pkgcache is NULL for db '%s'\n", db->treename);
}
return(db->pkgcache);
@ -129,7 +129,7 @@ int _alpm_db_add_pkgincache(pmdb_t *db, pmpkg_t *pkg)
if(newpkg == NULL) {
return(-1);
}
_alpm_log(PM_LOG_DEBUG, "adding entry '%s' in '%s' cache",
_alpm_log(PM_LOG_DEBUG, "adding entry '%s' in '%s' cache\n",
alpm_pkg_get_name(newpkg), db->treename);
db->pkgcache = alpm_list_add_sorted(db->pkgcache, newpkg, _alpm_pkg_cmp);
@ -149,14 +149,14 @@ int _alpm_db_remove_pkgfromcache(pmdb_t *db, pmpkg_t *pkg)
return(-1);
}
_alpm_log(PM_LOG_DEBUG, "removing entry '%s' from '%s' cache",
_alpm_log(PM_LOG_DEBUG, "removing entry '%s' from '%s' cache\n",
alpm_pkg_get_name(pkg), db->treename);
db->pkgcache = alpm_list_remove(db->pkgcache, pkg, _alpm_pkg_cmp, &vdata);
data = vdata;
if(data == NULL) {
/* package not found */
_alpm_log(PM_LOG_DEBUG, "cannot remove entry '%s' from '%s' cache: not found",
_alpm_log(PM_LOG_DEBUG, "cannot remove entry '%s' from '%s' cache: not found\n",
alpm_pkg_get_name(pkg), db->treename);
return(-1);
}
@ -178,7 +178,7 @@ pmpkg_t *_alpm_db_get_pkgfromcache(pmdb_t *db, const char *target)
alpm_list_t *pkgcache = _alpm_db_get_pkgcache(db);
if(!pkgcache) {
_alpm_log(PM_LOG_DEBUG, "error: failed to get '%s' from NULL pkgcache",
_alpm_log(PM_LOG_DEBUG, "error: failed to get '%s' from NULL pkgcache\n",
target);
return(NULL);
}
@ -202,7 +202,7 @@ int _alpm_db_load_grpcache(pmdb_t *db)
_alpm_db_load_pkgcache(db);
}
_alpm_log(PM_LOG_DEBUG, "loading group cache for repository '%s'",
_alpm_log(PM_LOG_DEBUG, "loading group cache for repository '%s'\n",
db->treename);
for(lp = _alpm_db_get_pkgcache(db); lp; lp = lp->next) {

View File

@ -59,7 +59,7 @@ static int does_conflict(pmpkg_t *pkg1, const char *conflict, pmpkg_t *pkg2)
match = alpm_depcmp(pkg2, conf);
if(match) {
_alpm_log(PM_LOG_DEBUG, "package %s conflicts with %s (by %s)",
_alpm_log(PM_LOG_DEBUG, "package %s conflicts with %s (by %s)\n",
pkg1name, pkg2name, conflict);
}
FREE(conf);
@ -145,11 +145,11 @@ alpm_list_t *_alpm_checkconflicts(pmdb_t *db, alpm_list_t *packages)
_alpm_pkg_cmp);
/* three checks to be done here for conflicts */
_alpm_log(PM_LOG_DEBUG, "check targets vs db");
_alpm_log(PM_LOG_DEBUG, "check targets vs db\n");
check_conflict(packages, dblist, &baddeps, 1);
_alpm_log(PM_LOG_DEBUG, "check db vs targets");
_alpm_log(PM_LOG_DEBUG, "check db vs targets\n");
check_conflict(dblist, packages, &baddeps, -1);
_alpm_log(PM_LOG_DEBUG, "check targets vs targets");
_alpm_log(PM_LOG_DEBUG, "check targets vs targets\n");
check_conflict(packages, packages, &baddeps, 0);
alpm_list_free(dblist);
@ -241,7 +241,7 @@ static alpm_list_t *add_fileconflict(alpm_list_t *conflicts,
{
pmconflict_t *conflict = malloc(sizeof(pmconflict_t));
if(conflict == NULL) {
_alpm_log(PM_LOG_ERROR, _("malloc failure: could not allocate %d bytes"),
_alpm_log(PM_LOG_ERROR, _("malloc failure: could not allocate %d bytes\n"),
sizeof(pmconflict_t));
return(conflicts);
}
@ -255,7 +255,7 @@ static alpm_list_t *add_fileconflict(alpm_list_t *conflicts,
}
conflicts = alpm_list_add(conflicts, conflict);
_alpm_log(PM_LOG_DEBUG, "found file conflict %s, packages %s and %s",
_alpm_log(PM_LOG_DEBUG, "found file conflict %s, packages %s and %s\n",
filestr, name1, name2 ? name2 : "(filesystem)");
return(conflicts);
@ -296,7 +296,7 @@ alpm_list_t *_alpm_db_find_conflicts(pmdb_t *db, pmtrans_t *trans, char *root)
if(!p2) {
continue;
}
_alpm_log(PM_LOG_DEBUG, "searching for file conflicts: %s and %s",
_alpm_log(PM_LOG_DEBUG, "searching for file conflicts: %s and %s\n",
alpm_pkg_get_name(p1), alpm_pkg_get_name(p2));
tmpfiles = chk_fileconflicts(alpm_pkg_get_files(p1), alpm_pkg_get_files(p2));
@ -316,7 +316,7 @@ alpm_list_t *_alpm_db_find_conflicts(pmdb_t *db, pmtrans_t *trans, char *root)
char *filestr = NULL;
/* CHECK 2: check every target against the filesystem */
_alpm_log(PM_LOG_DEBUG, "searching for filesystem conflicts: %s", p1->name);
_alpm_log(PM_LOG_DEBUG, "searching for filesystem conflicts: %s\n", p1->name);
dbpkg = _alpm_db_get_pkgfromcache(db, p1->name);
/* Do two different checks here. f the package is currently installed,
@ -341,9 +341,9 @@ alpm_list_t *_alpm_db_find_conflicts(pmdb_t *db, pmtrans_t *trans, char *root)
continue;
}
if(S_ISDIR(buf.st_mode)) {
_alpm_log(PM_LOG_DEBUG, "%s is a directory, not a conflict", path);
_alpm_log(PM_LOG_DEBUG, "%s is a directory, not a conflict\n", path);
} else {
_alpm_log(PM_LOG_DEBUG, "checking possible conflict: %s", path);
_alpm_log(PM_LOG_DEBUG, "checking possible conflict: %s\n", path);
/* Make sure the possible conflict is not a symlink that points to a
* path in the old package. This is kind of dirty with inode usage */
@ -355,7 +355,7 @@ alpm_list_t *_alpm_db_find_conflicts(pmdb_t *db, pmtrans_t *trans, char *root)
snprintf(str, PATH_MAX, "%s%s", root, (char*)k->data);
if(!lstat(str, &buf2) && buf.st_ino == buf2.st_ino) {
ok = 1;
_alpm_log(PM_LOG_DEBUG, "conflict was a symlink: %s", path);
_alpm_log(PM_LOG_DEBUG, "conflict was a symlink: %s\n", path);
break;
}
}
@ -386,7 +386,7 @@ alpm_list_t *_alpm_db_find_conflicts(pmdb_t *db, pmtrans_t *trans, char *root)
/* keep file intact if it is in backup array */
trans->skip_add = alpm_list_add(trans->skip_add, strdup(path));
trans->skip_remove = alpm_list_add(trans->skip_remove, strdup(path));
_alpm_log(PM_LOG_DEBUG, "file in backup array, adding to add and remove skiplist: %s", filestr);
_alpm_log(PM_LOG_DEBUG, "file in backup array, adding to add and remove skiplist: %s\n", filestr);
resolved_conflict = 1;
break;
} else {
@ -394,14 +394,14 @@ alpm_list_t *_alpm_db_find_conflicts(pmdb_t *db, pmtrans_t *trans, char *root)
* package from removing the file when it was already installed
* by its new owner */
trans->skip_remove = alpm_list_add(trans->skip_remove, strdup(path));
_alpm_log(PM_LOG_DEBUG, "file changed packages, adding to remove skiplist: %s", filestr);
_alpm_log(PM_LOG_DEBUG, "file changed packages, adding to remove skiplist: %s\n", filestr);
resolved_conflict = 1;
break;
}
}
}
if(!resolved_conflict) {
_alpm_log(PM_LOG_DEBUG, "file found in conflict: %s", path);
_alpm_log(PM_LOG_DEBUG, "file found in conflict: %s\n", path);
conflicts = add_fileconflict(conflicts, PM_CONFLICT_TYPE_FILE,
path, p1->name, NULL);
}

View File

@ -77,10 +77,10 @@ static void _alpm_db_unregister(pmdb_t *db)
return;
}
_alpm_log(PM_LOG_DEBUG, "closing database '%s'", db->treename);
_alpm_log(PM_LOG_DEBUG, "closing database '%s'\n", db->treename);
_alpm_db_close(db);
_alpm_log(PM_LOG_DEBUG, "unregistering database '%s'", db->treename);
_alpm_log(PM_LOG_DEBUG, "unregistering database '%s'\n", db->treename);
_alpm_db_free(db);
}
@ -192,11 +192,11 @@ int SYMEXPORT alpm_db_setserver(pmdb_t *db, const char *url)
return(-1);
}
db->servers = alpm_list_add(db->servers, server);
_alpm_log(PM_LOG_DEBUG, "adding new server to database '%s': protocol '%s', server '%s', path '%s'",
_alpm_log(PM_LOG_DEBUG, "adding new server to database '%s': protocol '%s', server '%s', path '%s'\n",
db->treename, server->s_url->scheme, server->s_url->host, server->s_url->doc);
} else {
FREELIST(db->servers);
_alpm_log(PM_LOG_DEBUG, "serverlist flushed for '%s'", db->treename);
_alpm_log(PM_LOG_DEBUG, "serverlist flushed for '%s'\n", db->treename);
}
return(0);
@ -240,7 +240,7 @@ int SYMEXPORT alpm_db_update(int force, pmdb_t *db)
/* get the lastupdate time */
_alpm_db_getlastupdate(db, lastupdate);
if(strlen(lastupdate) == 0) {
_alpm_log(PM_LOG_DEBUG, "failed to get lastupdate time for %s (no big deal)", db->treename);
_alpm_log(PM_LOG_DEBUG, "failed to get lastupdate time for %s (no big deal)\n", db->treename);
}
}
@ -259,23 +259,23 @@ int SYMEXPORT alpm_db_update(int force, pmdb_t *db)
} else if(ret == -1) {
/* we use downloadLastErrString and downloadLastErrCode here, error returns from
* libdownload */
_alpm_log(PM_LOG_DEBUG, "failed to sync db: %s [%d]",
_alpm_log(PM_LOG_DEBUG, "failed to sync db: %s [%d]\n",
downloadLastErrString, downloadLastErrCode);
RET_ERR(PM_ERR_DB_SYNC, -1);
} else {
if(strlen(newmtime)) {
_alpm_log(PM_LOG_DEBUG, "sync: new mtime for %s: %s",
_alpm_log(PM_LOG_DEBUG, "sync: new mtime for %s: %s\n",
db->treename, newmtime);
_alpm_db_setlastupdate(db, newmtime);
}
snprintf(path, PATH_MAX, "%s%s" DBEXT, dbpath, db->treename);
/* remove the old dir */
_alpm_log(PM_LOG_DEBUG, "flushing database %s%s", db->path);
_alpm_log(PM_LOG_DEBUG, "flushing database %s%s\n", db->path);
for(lp = _alpm_db_get_pkgcache(db); lp; lp = lp->next) {
pmpkg_t *pkg = lp->data;
if(pkg && _alpm_db_remove(db, pkg) == -1) {
_alpm_log(PM_LOG_ERROR, _("could not remove database entry %s%s"), db->treename,
_alpm_log(PM_LOG_ERROR, _("could not remove database entry %s%s\n"), db->treename,
alpm_pkg_get_name(pkg));
RET_ERR(PM_ERR_DB_REMOVE, -1);
}
@ -455,7 +455,7 @@ alpm_list_t SYMEXPORT *alpm_db_get_upgrades(void)
/* TODO holy nested loops, Batman! */
/* check for "recommended" package replacements */
_alpm_log(PM_LOG_DEBUG, "checking for package replacements");
_alpm_log(PM_LOG_DEBUG, "checking for package replacements\n");
for(i = handle->dbs_sync; i; i = i->next) {
for(j = _alpm_db_get_pkgcache(i->data); j; j = j->next) {
pmpkg_t *spkg = j->data;
@ -466,10 +466,10 @@ alpm_list_t SYMEXPORT *alpm_db_get_upgrades(void)
pmpkg_t *lpkg = m->data;
if(strcmp(k->data, alpm_pkg_get_name(lpkg)) == 0) {
_alpm_log(PM_LOG_DEBUG, "checking replacement '%s' for package '%s'",
_alpm_log(PM_LOG_DEBUG, "checking replacement '%s' for package '%s'\n",
k->data, alpm_pkg_get_name(spkg));
if(alpm_list_find_str(handle->ignorepkg, alpm_pkg_get_name(lpkg))) {
_alpm_log(PM_LOG_WARNING, _("%s-%s: ignoring package upgrade (to be replaced by %s-%s)"),
_alpm_log(PM_LOG_WARNING, _("%s-%s: ignoring package upgrade (to be replaced by %s-%s)\n"),
alpm_pkg_get_name(lpkg), alpm_pkg_get_version(lpkg),
alpm_pkg_get_name(spkg), alpm_pkg_get_version(spkg));
} else {
@ -499,7 +499,7 @@ alpm_list_t SYMEXPORT *alpm_db_get_upgrades(void)
sync->data = alpm_list_add(NULL, dummy);
syncpkgs = alpm_list_add(syncpkgs, sync);
}
_alpm_log(PM_LOG_DEBUG, "%s-%s elected for upgrade (to be replaced by %s-%s)",
_alpm_log(PM_LOG_DEBUG, "%s-%s elected for upgrade (to be replaced by %s-%s)\n",
alpm_pkg_get_name(lpkg), alpm_pkg_get_version(lpkg),
alpm_pkg_get_name(spkg), alpm_pkg_get_version(spkg));
}
@ -521,7 +521,7 @@ alpm_list_t SYMEXPORT *alpm_db_get_upgrades(void)
spkg = _alpm_db_get_pkgfromcache(j->data, alpm_pkg_get_name(local));
}
if(spkg == NULL) {
_alpm_log(PM_LOG_DEBUG, "'%s' not found in sync db -- skipping",
_alpm_log(PM_LOG_DEBUG, "'%s' not found in sync db -- skipping\n",
alpm_pkg_get_name(local));
continue;
}
@ -536,13 +536,13 @@ alpm_list_t SYMEXPORT *alpm_db_get_upgrades(void)
}
}
if(replace) {
_alpm_log(PM_LOG_DEBUG, "'%s' is already elected for removal -- skipping",
_alpm_log(PM_LOG_DEBUG, "'%s' is already elected for removal -- skipping\n",
alpm_pkg_get_name(local));
continue;
}
if(alpm_pkg_compare_versions(local, spkg)) {
_alpm_log(PM_LOG_DEBUG, "%s elected for upgrade (%s => %s)",
_alpm_log(PM_LOG_DEBUG, "%s elected for upgrade (%s => %s)\n",
alpm_pkg_get_name(local), alpm_pkg_get_version(local),
alpm_pkg_get_version(spkg));
@ -647,7 +647,7 @@ alpm_list_t *_alpm_db_search(pmdb_t *db, const alpm_list_t *needles)
continue;
}
targ = i->data;
_alpm_log(PM_LOG_DEBUG, "searching for target '%s'", targ);
_alpm_log(PM_LOG_DEBUG, "searching for target '%s'\n", targ);
if(regcomp(&reg, targ, REG_EXTENDED | REG_NOSUB | REG_ICASE | REG_NEWLINE) != 0) {
RET_ERR(PM_ERR_INVALID_REGEX, NULL);
@ -678,7 +678,7 @@ alpm_list_t *_alpm_db_search(pmdb_t *db, const alpm_list_t *needles)
}
if(matched != NULL) {
_alpm_log(PM_LOG_DEBUG, " search target '%s' matched '%s'",
_alpm_log(PM_LOG_DEBUG, " search target '%s' matched '%s'\n",
targ, matched);
ret = alpm_list_add(ret, pkg);
}
@ -701,7 +701,7 @@ pmdb_t *_alpm_db_register(const char *treename)
if(strcmp(treename, "local") == 0) {
if(handle->db_local != NULL) {
_alpm_log(PM_LOG_WARNING, _("attempt to re-register the 'local' DB"));
_alpm_log(PM_LOG_WARNING, _("attempt to re-register the 'local' DB\n"));
RET_ERR(PM_ERR_DB_NOT_NULL, NULL);
}
} else {
@ -709,24 +709,24 @@ pmdb_t *_alpm_db_register(const char *treename)
for(i = handle->dbs_sync; i; i = i->next) {
pmdb_t *sdb = i->data;
if(strcmp(treename, sdb->treename) == 0) {
_alpm_log(PM_LOG_DEBUG, "attempt to re-register the '%s' database, using existing", sdb->treename);
_alpm_log(PM_LOG_DEBUG, "attempt to re-register the '%s' database, using existing\n", sdb->treename);
return sdb;
}
}
}
_alpm_log(PM_LOG_DEBUG, "registering database '%s'", treename);
_alpm_log(PM_LOG_DEBUG, "registering database '%s'\n", treename);
/* make sure the database directory exists */
dbpath = alpm_option_get_dbpath();
if(!dbpath) {
_alpm_log(PM_LOG_WARNING, _("database path is undefined"));
_alpm_log(PM_LOG_WARNING, _("database path is undefined\n"));
RET_ERR(PM_ERR_DB_OPEN, NULL);
}
snprintf(path, PATH_MAX, "%s%s", dbpath, treename);
/* TODO this is rediculous, we try to do this even if we can't */
if(stat(path, &buf) != 0 || !S_ISDIR(buf.st_mode)) {
_alpm_log(PM_LOG_DEBUG, "database dir '%s' does not exist, creating it",
_alpm_log(PM_LOG_DEBUG, "database dir '%s' does not exist, creating it\n",
path);
if(_alpm_makepath(path) != 0) {
RET_ERR(PM_ERR_SYSTEM, NULL);
@ -738,7 +738,7 @@ pmdb_t *_alpm_db_register(const char *treename)
RET_ERR(PM_ERR_DB_CREATE, NULL);
}
_alpm_log(PM_LOG_DEBUG, "opening database '%s'", db->treename);
_alpm_log(PM_LOG_DEBUG, "opening database '%s'\n", db->treename);
if(_alpm_db_open(db) == -1) {
_alpm_db_free(db);
RET_ERR(PM_ERR_DB_OPEN, NULL);

View File

@ -73,7 +73,7 @@ pmdepmissing_t *_alpm_depmiss_new(const char *target, pmdeptype_t type,
miss = malloc(sizeof(pmdepmissing_t));
if(miss == NULL) {
_alpm_log(PM_LOG_ERROR, _("malloc failure: could not allocate %d bytes"), sizeof(pmdepmissing_t));
_alpm_log(PM_LOG_ERROR, _("malloc failure: could not allocate %d bytes\n"), sizeof(pmdepmissing_t));
RET_ERR(PM_ERR_MEMORY, NULL);
}
@ -175,7 +175,7 @@ alpm_list_t *_alpm_sortbydeps(alpm_list_t *targets, pmtranstype_t mode)
return(NULL);
}
_alpm_log(PM_LOG_DEBUG, "started sorting dependencies");
_alpm_log(PM_LOG_DEBUG, "started sorting dependencies\n");
vertices = _alpm_graph_init(targets);
@ -213,7 +213,7 @@ alpm_list_t *_alpm_sortbydeps(alpm_list_t *targets, pmtranstype_t mode)
}
}
_alpm_log(PM_LOG_DEBUG, "sorting dependencies finished");
_alpm_log(PM_LOG_DEBUG, "sorting dependencies finished\n");
if(mode == PM_TRANS_TYPE_REMOVE) {
/* we're removing packages, so reverse the order */
@ -256,12 +256,12 @@ alpm_list_t *_alpm_checkdeps(pmdb_t *db, pmtranstype_t op,
pmpkg_t *newpkg = i->data;
pmpkg_t *oldpkg;
if(newpkg == NULL) {
_alpm_log(PM_LOG_DEBUG, "null package found in package list");
_alpm_log(PM_LOG_DEBUG, "null package found in package list\n");
continue;
}
if((oldpkg = _alpm_db_get_pkgfromcache(db, alpm_pkg_get_name(newpkg))) == NULL) {
_alpm_log(PM_LOG_DEBUG, "cannot find package installed '%s'",
_alpm_log(PM_LOG_DEBUG, "cannot find package installed '%s'\n",
alpm_pkg_get_name(newpkg));
continue;
}
@ -294,7 +294,7 @@ alpm_list_t *_alpm_checkdeps(pmdb_t *db, pmtranstype_t op,
pmpkg_t *pkg = l->data;
if(alpm_depcmp(pkg, depend)) {
_alpm_log(PM_LOG_DEBUG, "checkdeps: dependency '%s' has moved from '%s' to '%s'",
_alpm_log(PM_LOG_DEBUG, "checkdeps: dependency '%s' has moved from '%s' to '%s'\n",
depend->name, alpm_pkg_get_name(oldpkg), alpm_pkg_get_name(pkg));
satisfied = 1;
break;
@ -310,7 +310,7 @@ alpm_list_t *_alpm_checkdeps(pmdb_t *db, pmtranstype_t op,
if(alpm_depcmp(pkg, depend) && !_alpm_pkg_find(alpm_pkg_get_name(pkg), packages)) {
/* we ignore packages that will be updated because we know
* that the updated ones don't satisfy depend */
_alpm_log(PM_LOG_DEBUG, "checkdeps: dependency '%s' satisfied by installed package '%s'",
_alpm_log(PM_LOG_DEBUG, "checkdeps: dependency '%s' satisfied by installed package '%s'\n",
depend->name, alpm_pkg_get_name(pkg));
satisfied = 1;
break;
@ -319,7 +319,7 @@ alpm_list_t *_alpm_checkdeps(pmdb_t *db, pmtranstype_t op,
}
if(!satisfied) {
_alpm_log(PM_LOG_DEBUG, "checkdeps: updated '%s' won't satisfy a dependency of '%s'",
_alpm_log(PM_LOG_DEBUG, "checkdeps: updated '%s' won't satisfy a dependency of '%s'\n",
alpm_pkg_get_name(oldpkg), alpm_pkg_get_name(p));
miss = _alpm_depmiss_new(p->name, PM_DEP_TYPE_DEPEND, depend->mod,
depend->name, depend->version);
@ -340,7 +340,7 @@ alpm_list_t *_alpm_checkdeps(pmdb_t *db, pmtranstype_t op,
for(i = packages; i; i = i->next) {
pmpkg_t *tp = i->data;
if(tp == NULL) {
_alpm_log(PM_LOG_DEBUG, "null package found in package list");
_alpm_log(PM_LOG_DEBUG, "null package found in package list\n");
continue;
}
@ -368,7 +368,7 @@ alpm_list_t *_alpm_checkdeps(pmdb_t *db, pmtranstype_t op,
/* else if still not found... */
if(!found) {
_alpm_log(PM_LOG_DEBUG, "missing dependency '%s' for package '%s'",
_alpm_log(PM_LOG_DEBUG, "missing dependency '%s' for package '%s'\n",
depend->name, alpm_pkg_get_name(tp));
miss = _alpm_depmiss_new(alpm_pkg_get_name(tp), PM_DEP_TYPE_DEPEND, depend->mod,
depend->name, depend->version);
@ -387,7 +387,7 @@ alpm_list_t *_alpm_checkdeps(pmdb_t *db, pmtranstype_t op,
pmpkg_t *rmpkg = alpm_list_getdata(i);
if(rmpkg == NULL) {
_alpm_log(PM_LOG_DEBUG, "null package found in package list");
_alpm_log(PM_LOG_DEBUG, "null package found in package list\n");
continue;
}
for(j = alpm_pkg_get_requiredby(rmpkg); j; j = j->next) {
@ -414,7 +414,7 @@ alpm_list_t *_alpm_checkdeps(pmdb_t *db, pmtranstype_t op,
for(l = _alpm_db_get_pkgcache(db); l; l = l->next) {
pmpkg_t *pkg = l->data;
if(alpm_depcmp(pkg, depend) && !_alpm_pkg_find(alpm_pkg_get_name(pkg), packages)) {
_alpm_log(PM_LOG_DEBUG, "checkdeps: dependency '%s' satisfied by installed package '%s'",
_alpm_log(PM_LOG_DEBUG, "checkdeps: dependency '%s' satisfied by installed package '%s'\n",
depend->name, alpm_pkg_get_name(pkg));
satisfied = 1;
break;
@ -422,7 +422,7 @@ alpm_list_t *_alpm_checkdeps(pmdb_t *db, pmtranstype_t op,
}
if(!satisfied) {
_alpm_log(PM_LOG_DEBUG, "checkdeps: found %s which requires %s",
_alpm_log(PM_LOG_DEBUG, "checkdeps: found %s which requires %s\n",
alpm_pkg_get_name(p), alpm_pkg_get_name(rmpkg));
miss = _alpm_depmiss_new(alpm_pkg_get_name(p),
PM_DEP_TYPE_DEPEND, depend->mod, depend->name,
@ -485,11 +485,11 @@ int SYMEXPORT alpm_depcmp(pmpkg_t *pkg, pmdepend_t *dep)
}
if(strlen(dep->version) > 0) {
_alpm_log(PM_LOG_DEBUG, "depcmp: %s-%s %s %s-%s => %s",
_alpm_log(PM_LOG_DEBUG, "depcmp: %s-%s %s %s-%s => %s\n",
pkgname, pkgversion,
mod, dep->name, dep->version, (equal ? "match" : "no match"));
} else {
_alpm_log(PM_LOG_DEBUG, "depcmp: %s-%s %s %s => %s",
_alpm_log(PM_LOG_DEBUG, "depcmp: %s-%s %s %s => %s\n",
pkgname, pkgversion,
mod, dep->name, (equal ? "match" : "no match"));
}
@ -511,7 +511,7 @@ pmdepend_t SYMEXPORT *alpm_splitdep(const char *depstring)
depend = malloc(sizeof(pmdepend_t));
if(depend == NULL) {
_alpm_log(PM_LOG_ERROR, _("malloc failure: could not allocate %d bytes"), sizeof(pmdepend_t));
_alpm_log(PM_LOG_ERROR, _("malloc failure: could not allocate %d bytes\n"), sizeof(pmdepend_t));
return(NULL);
}
@ -563,7 +563,7 @@ static int can_remove_package(pmdb_t *db, pmpkg_t *pkg, alpm_list_t *targets,
if(!include_explicit) {
/* see if it was explicitly installed */
if(alpm_pkg_get_reason(pkg) == PM_PKG_REASON_EXPLICIT) {
_alpm_log(PM_LOG_DEBUG, "excluding %s -- explicitly installed",
_alpm_log(PM_LOG_DEBUG, "excluding %s -- explicitly installed\n",
alpm_pkg_get_name(pkg));
return(0);
}
@ -624,7 +624,7 @@ void _alpm_recursedeps(pmdb_t *db, alpm_list_t **targs, int include_explicit)
pmpkg_t *deppkg = k->data;
if(alpm_depcmp(deppkg,depend)
&& can_remove_package(db, deppkg, *targs, include_explicit)) {
_alpm_log(PM_LOG_DEBUG, "adding '%s' to the targets",
_alpm_log(PM_LOG_DEBUG, "adding '%s' to the targets\n",
alpm_pkg_get_name(deppkg));
/* add it to the target list */
@ -656,7 +656,7 @@ int _alpm_resolvedeps(pmdb_t *local, alpm_list_t *dbs_sync, pmpkg_t *syncpkg,
return(-1);
}
_alpm_log(PM_LOG_DEBUG, "started resolving dependencies");
_alpm_log(PM_LOG_DEBUG, "started resolving dependencies\n");
targ = alpm_list_add(NULL, syncpkg);
deps = _alpm_checkdeps(local, PM_TRANS_TYPE_ADD, targ);
alpm_list_free(targ);
@ -675,7 +675,7 @@ int _alpm_resolvedeps(pmdb_t *local, alpm_list_t *dbs_sync, pmpkg_t *syncpkg,
for(j = *list; j && !found; j = j->next) {
pmpkg_t *sp = j->data;
if(alpm_depcmp(sp, missdep)) {
_alpm_log(PM_LOG_DEBUG, "%s satisfies dependency %s -- skipping",
_alpm_log(PM_LOG_DEBUG, "%s satisfies dependency %s -- skipping\n",
alpm_pkg_get_name(sp), missdep->name);
found = 1;
}
@ -702,11 +702,11 @@ int _alpm_resolvedeps(pmdb_t *local, alpm_list_t *dbs_sync, pmpkg_t *syncpkg,
}
if(!found) {
_alpm_log(PM_LOG_ERROR, _("cannot resolve dependencies for \"%s\" (\"%s\" is not in the package set)"),
_alpm_log(PM_LOG_ERROR, _("cannot resolve dependencies for \"%s\" (\"%s\" is not in the package set)\n"),
miss->target, missdep->name);
if(data) {
if((miss = malloc(sizeof(pmdepmissing_t))) == NULL) {
_alpm_log(PM_LOG_ERROR, _("malloc failure: could not allocate %d bytes"), sizeof(pmdepmissing_t));
_alpm_log(PM_LOG_ERROR, _("malloc failure: could not allocate %d bytes\n"), sizeof(pmdepmissing_t));
FREELIST(*data);
pm_errno = PM_ERR_MEMORY;
goto error;
@ -727,17 +727,17 @@ int _alpm_resolvedeps(pmdb_t *local, alpm_list_t *dbs_sync, pmpkg_t *syncpkg,
_alpm_pkg_free(dummypkg);
}
if(usedep) {
_alpm_log(PM_LOG_DEBUG, "pulling dependency %s (needed by %s)",
_alpm_log(PM_LOG_DEBUG, "pulling dependency %s (needed by %s)\n",
alpm_pkg_get_name(sync), alpm_pkg_get_name(syncpkg));
*list = alpm_list_add(*list, sync);
if(_alpm_resolvedeps(local, dbs_sync, sync, list, trans, data)) {
goto error;
}
} else {
_alpm_log(PM_LOG_ERROR, _("cannot resolve dependencies for \"%s\""), miss->target);
_alpm_log(PM_LOG_ERROR, _("cannot resolve dependencies for \"%s\"\n"), miss->target);
if(data) {
if((miss = malloc(sizeof(pmdepmissing_t))) == NULL) {
_alpm_log(PM_LOG_ERROR, _("malloc failure: could not allocate %d bytes"), sizeof(pmdepmissing_t));
_alpm_log(PM_LOG_ERROR, _("malloc failure: could not allocate %d bytes\n"), sizeof(pmdepmissing_t));
FREELIST(*data);
pm_errno = PM_ERR_MEMORY;
goto error;
@ -750,7 +750,7 @@ int _alpm_resolvedeps(pmdb_t *local, alpm_list_t *dbs_sync, pmpkg_t *syncpkg,
}
}
_alpm_log(PM_LOG_DEBUG, "finished resolving dependencies");
_alpm_log(PM_LOG_DEBUG, "finished resolving dependencies\n");
FREELIST(deps);

View File

@ -41,7 +41,7 @@ pmgrp_t *_alpm_grp_new()
grp = calloc(1, sizeof(pmgrp_t));
if(grp == NULL) {
_alpm_log(PM_LOG_ERROR, _("malloc failure: could not allocate %d bytes"),
_alpm_log(PM_LOG_ERROR, _("malloc failure: could not allocate %d bytes\n"),
sizeof(pmgrp_t));
RET_ERR(PM_ERR_MEMORY, NULL);
}

View File

@ -49,7 +49,7 @@ pmhandle_t *_alpm_handle_new()
handle = malloc(sizeof(pmhandle_t));
if(handle == NULL) {
_alpm_log(PM_LOG_ERROR, _("malloc failure: could not allocate %d bytes"), sizeof(pmhandle_t));
_alpm_log(PM_LOG_ERROR, _("malloc failure: could not allocate %d bytes\n"), sizeof(pmhandle_t));
RET_ERR(PM_ERR_MEMORY, NULL);
}
@ -164,7 +164,7 @@ int SYMEXPORT alpm_option_set_root(const char *root)
strncpy(handle->root, realroot, rootlen);
handle->root[rootlen-1] = '/';
FREE(realroot);
_alpm_log(PM_LOG_DEBUG, "option 'root' = %s", handle->root);
_alpm_log(PM_LOG_DEBUG, "option 'root' = %s\n", handle->root);
return(0);
}
@ -195,7 +195,7 @@ int SYMEXPORT alpm_option_set_dbpath(const char *dbpath)
handle->dbpath = calloc(dbpathlen+1, sizeof(char));
strncpy(handle->dbpath, dbpath, dbpathlen);
handle->dbpath[dbpathlen-1] = '/';
_alpm_log(PM_LOG_DEBUG, "option 'dbpath' = %s", handle->dbpath);
_alpm_log(PM_LOG_DEBUG, "option 'dbpath' = %s\n", handle->dbpath);
if(handle->lockfile) {
FREE(handle->lockfile);
@ -203,7 +203,7 @@ int SYMEXPORT alpm_option_set_dbpath(const char *dbpath)
lockfilelen = strlen(handle->dbpath) + strlen(lf) + 1;
handle->lockfile = calloc(lockfilelen, sizeof(char));
snprintf(handle->lockfile, lockfilelen, "%s%s", handle->dbpath, lf);
_alpm_log(PM_LOG_DEBUG, "option 'lockfile' = %s", handle->lockfile);
_alpm_log(PM_LOG_DEBUG, "option 'lockfile' = %s\n", handle->lockfile);
return(0);
}
@ -232,7 +232,7 @@ int SYMEXPORT alpm_option_add_cachedir(const char *cachedir)
strncpy(newcachedir, cachedir, cachedirlen);
newcachedir[cachedirlen-1] = '/';
handle->cachedirs = alpm_list_add(handle->cachedirs, newcachedir);
_alpm_log(PM_LOG_DEBUG, "option 'cachedir' = %s", newcachedir);
_alpm_log(PM_LOG_DEBUG, "option 'cachedir' = %s\n", newcachedir);
return(0);
}
@ -259,7 +259,7 @@ int SYMEXPORT alpm_option_set_logfile(const char *logfile)
if(handle->logstream == NULL) {
/* TODO we probably want to do this at some point, but right now
* it just blows up when a user calls pacman without privilages */
_alpm_log(PM_LOG_DEBUG, "couldn't open logfile for writing, ignoring");
_alpm_log(PM_LOG_DEBUG, "couldn't open logfile for writing, ignoring\n");
/*
if(errno == EACCES) {
pm_errno = PM_ERR_BADPERMS;
@ -282,7 +282,7 @@ int SYMEXPORT alpm_option_set_logfile(const char *logfile)
if(oldlogstream) {
fclose(oldlogstream);
}
_alpm_log(PM_LOG_DEBUG, "option 'logfile' = %s", handle->logfile);
_alpm_log(PM_LOG_DEBUG, "option 'logfile' = %s\n", handle->logfile);
return(0);
}

View File

@ -62,7 +62,7 @@
*/
int SYMEXPORT alpm_pkg_load(const char *filename, pmpkg_t **pkg)
{
_alpm_log(PM_LOG_FUNCTION, "enter alpm_pkg_load");
_alpm_log(PM_LOG_FUNCTION, "enter alpm_pkg_load\n");
/* Sanity checks */
ASSERT(filename != NULL && strlen(filename) != 0, RET_ERR(PM_ERR_WRONG_ARGS, -1));
@ -83,7 +83,7 @@ int SYMEXPORT alpm_pkg_load(const char *filename, pmpkg_t **pkg)
*/
int SYMEXPORT alpm_pkg_free(pmpkg_t *pkg)
{
_alpm_log(PM_LOG_FUNCTION, "enter alpm_pkg_free");
_alpm_log(PM_LOG_FUNCTION, "enter alpm_pkg_free\n");
ASSERT(pkg != NULL, RET_ERR(PM_ERR_WRONG_ARGS, -1));
@ -116,16 +116,16 @@ int SYMEXPORT alpm_pkg_checkmd5sum(pmpkg_t *pkg)
md5sum = alpm_get_md5sum(fpath);
if(md5sum == NULL) {
_alpm_log(PM_LOG_ERROR, _("could not get md5sum for package %s-%s"),
_alpm_log(PM_LOG_ERROR, _("could not get md5sum for package %s-%s\n"),
alpm_pkg_get_name(pkg), alpm_pkg_get_version(pkg));
pm_errno = PM_ERR_NOT_A_FILE;
retval = -1;
} else {
if(strcmp(md5sum, alpm_pkg_get_md5sum(pkg)) == 0) {
_alpm_log(PM_LOG_DEBUG, "md5sums for package %s-%s match",
_alpm_log(PM_LOG_DEBUG, "md5sums for package %s-%s match\n",
alpm_pkg_get_name(pkg), alpm_pkg_get_version(pkg));
} else {
_alpm_log(PM_LOG_ERROR, _("md5sums do not match for package %s-%s"),
_alpm_log(PM_LOG_ERROR, _("md5sums do not match for package %s-%s\n"),
alpm_pkg_get_name(pkg), alpm_pkg_get_version(pkg));
pm_errno = PM_ERR_PKG_INVALID;
retval = -1;
@ -665,7 +665,7 @@ pmpkg_t *_alpm_pkg_dup(pmpkg_t *pkg)
ALPM_LOG_FUNC;
if((newpkg = calloc(1, sizeof(pmpkg_t))) == NULL) {
_alpm_log(PM_LOG_ERROR, _("malloc failure: could not allocate %d bytes"), sizeof(pmpkg_t));
_alpm_log(PM_LOG_ERROR, _("malloc failure: could not allocate %d bytes\n"), sizeof(pmpkg_t));
RET_ERR(PM_ERR_MEMORY, NULL);
}
@ -730,7 +730,7 @@ int alpm_pkg_compare_versions(pmpkg_t *local_pkg, pmpkg_t *pkg)
if(alpm_list_find_str(handle->ignorepkg, alpm_pkg_get_name(pkg))) {
/* package should be ignored (IgnorePkg) */
if(cmp > 0) {
_alpm_log(PM_LOG_WARNING, _("%s-%s: ignoring package upgrade (%s)"),
_alpm_log(PM_LOG_WARNING, _("%s-%s: ignoring package upgrade (%s)\n"),
alpm_pkg_get_name(local_pkg), alpm_pkg_get_version(local_pkg),
alpm_pkg_get_version(pkg));
}
@ -739,12 +739,12 @@ int alpm_pkg_compare_versions(pmpkg_t *local_pkg, pmpkg_t *pkg)
if(cmp != 0 && pkg->force) {
cmp = 1;
_alpm_log(PM_LOG_WARNING, _("%s: forcing upgrade to version %s"),
_alpm_log(PM_LOG_WARNING, _("%s: forcing upgrade to version %s\n"),
alpm_pkg_get_name(pkg), alpm_pkg_get_version(pkg));
} else if(cmp < 0) {
/* local version is newer */
pmdb_t *db = pkg->origin_data.db;
_alpm_log(PM_LOG_WARNING, _("%s: local (%s) is newer than %s (%s)"),
_alpm_log(PM_LOG_WARNING, _("%s: local (%s) is newer than %s (%s)\n"),
alpm_pkg_get_name(local_pkg), alpm_pkg_get_version(local_pkg),
alpm_db_get_name(db), alpm_pkg_get_version(pkg));
cmp = 0;
@ -752,7 +752,7 @@ int alpm_pkg_compare_versions(pmpkg_t *local_pkg, pmpkg_t *pkg)
/* we have an upgrade, make sure we should actually do it */
if(_alpm_pkg_istoonew(pkg)) {
/* package too new (UpgradeDelay) */
_alpm_log(PM_LOG_WARNING, _("%s-%s: delaying upgrade of package (%s)"),
_alpm_log(PM_LOG_WARNING, _("%s-%s: delaying upgrade of package (%s)\n"),
alpm_pkg_get_name(local_pkg), alpm_pkg_get_version(local_pkg),
alpm_pkg_get_version(pkg));
cmp = 0;
@ -789,7 +789,7 @@ static int parse_descfile(const char *descfile, pmpkg_t *info)
ALPM_LOG_FUNC;
if((fp = fopen(descfile, "r")) == NULL) {
_alpm_log(PM_LOG_ERROR, _("could not open file %s: %s"), descfile, strerror(errno));
_alpm_log(PM_LOG_ERROR, _("could not open file %s: %s\n"), descfile, strerror(errno));
return(-1);
}
@ -803,7 +803,7 @@ static int parse_descfile(const char *descfile, pmpkg_t *info)
ptr = line;
key = strsep(&ptr, "=");
if(key == NULL || ptr == NULL) {
_alpm_log(PM_LOG_DEBUG, "%s: syntax error in description file line %d",
_alpm_log(PM_LOG_DEBUG, "%s: syntax error in description file line %d\n",
info->name[0] != '\0' ? info->name : "error", linenum);
} else {
_alpm_strtrim(key);
@ -843,7 +843,7 @@ static int parse_descfile(const char *descfile, pmpkg_t *info)
} else if(!strcmp(key, "BACKUP")) {
info->backup = alpm_list_add(info->backup, strdup(ptr));
} else {
_alpm_log(PM_LOG_DEBUG, "%s: syntax error in description file line %d",
_alpm_log(PM_LOG_DEBUG, "%s: syntax error in description file line %d\n",
info->name[0] != '\0' ? info->name : "error", linenum);
}
}
@ -918,15 +918,15 @@ pmpkg_t *_alpm_pkg_load(const char *pkgfile)
archive_read_data_into_fd (archive, fd);
/* parse the info file */
if(parse_descfile(descfile, info) == -1) {
_alpm_log(PM_LOG_ERROR, _("could not parse the package description file"));
_alpm_log(PM_LOG_ERROR, _("could not parse the package description file\n"));
goto pkg_invalid;
}
if(!strlen(info->name)) {
_alpm_log(PM_LOG_ERROR, _("missing package name in %s"), pkgfile);
_alpm_log(PM_LOG_ERROR, _("missing package name in %s\n"), pkgfile);
goto pkg_invalid;
}
if(!strlen(info->version)) {
_alpm_log(PM_LOG_ERROR, _("missing package version in %s"), pkgfile);
_alpm_log(PM_LOG_ERROR, _("missing package version in %s\n"), pkgfile);
goto pkg_invalid;
}
config = 1;
@ -961,7 +961,7 @@ pmpkg_t *_alpm_pkg_load(const char *pkgfile)
FREE(str);
fclose(fp);
if(unlink(fn)) {
_alpm_log(PM_LOG_WARNING, _("could not remove tempfile %s"), fn);
_alpm_log(PM_LOG_WARNING, _("could not remove tempfile %s\n"), fn);
}
FREE(fn);
close(fd);
@ -977,27 +977,27 @@ pmpkg_t *_alpm_pkg_load(const char *pkgfile)
}
if(archive_read_data_skip(archive)) {
_alpm_log(PM_LOG_ERROR, _("error while reading package: %s"), archive_error_string(archive));
_alpm_log(PM_LOG_ERROR, _("error while reading package: %s\n"), archive_error_string(archive));
pm_errno = PM_ERR_LIBARCHIVE_ERROR;
goto error;
}
expath = NULL;
}
if(ret != ARCHIVE_EOF) { /* An error occured */
_alpm_log(PM_LOG_ERROR, _("error while reading package: %s"), archive_error_string(archive));
_alpm_log(PM_LOG_ERROR, _("error while reading package: %s\n"), archive_error_string(archive));
pm_errno = PM_ERR_LIBARCHIVE_ERROR;
goto error;
}
if(!config) {
_alpm_log(PM_LOG_ERROR, _("missing package metadata"), pkgfile);
_alpm_log(PM_LOG_ERROR, _("missing package metadata\n"), pkgfile);
goto error;
}
archive_read_finish(archive);
if(!filelist) {
_alpm_log(PM_LOG_ERROR, _("missing package filelist in %s, generating one"), pkgfile);
_alpm_log(PM_LOG_ERROR, _("missing package filelist in %s, generating one\n"), pkgfile);
info->files = all_files;
} else {
alpm_list_free_inner(all_files, free);
@ -1140,7 +1140,7 @@ void _alpm_pkg_update_requiredby(pmpkg_t *pkg)
FREE(dep);
if(satisfies) {
alpm_list_t *reqs = alpm_pkg_get_requiredby(pkg);
_alpm_log(PM_LOG_DEBUG, "adding '%s' in requiredby field for '%s'",
_alpm_log(PM_LOG_DEBUG, "adding '%s' in requiredby field for '%s'\n",
cachepkgname, pkg->name);
reqs = alpm_list_add(reqs, strdup(cachepkgname));
pkg->requiredby = reqs;

View File

@ -66,7 +66,7 @@ int _alpm_remove_loadtarget(pmtrans_t *trans, pmdb_t *db, char *name)
if((info = _alpm_db_scan(db, name)) == NULL) {
/* Unimportant - just ignore it if we can't find it */
_alpm_log(PM_LOG_DEBUG, "could not find %s in database", name);
_alpm_log(PM_LOG_DEBUG, "could not find %s in database\n", name);
RET_ERR(PM_ERR_PKG_NOT_FOUND, -1);
}
@ -80,7 +80,7 @@ int _alpm_remove_loadtarget(pmtrans_t *trans, pmdb_t *db, char *name)
}
}
_alpm_log(PM_LOG_DEBUG, "adding %s in the targets list", info->name);
_alpm_log(PM_LOG_DEBUG, "adding %s in the targets list\n", info->name);
trans->packages = alpm_list_add(trans->packages, info);
return(0);
@ -103,7 +103,7 @@ int _alpm_remove_prepare(pmtrans_t *trans, pmdb_t *db, alpm_list_t **data)
EVENT(trans, PM_TRANS_EVT_CHECKDEPS_START, NULL, NULL);
if(!(trans->flags & PM_TRANS_FLAG_NODEPS)) {
_alpm_log(PM_LOG_DEBUG, "looking for unsatisfied dependencies");
_alpm_log(PM_LOG_DEBUG, "looking for unsatisfied dependencies\n");
lp = _alpm_checkdeps(db, trans->type, trans->packages);
if(lp != NULL) {
if(trans->flags & PM_TRANS_FLAG_CASCADE) {
@ -113,11 +113,11 @@ int _alpm_remove_prepare(pmtrans_t *trans, pmdb_t *db, alpm_list_t **data)
pmdepmissing_t *miss = (pmdepmissing_t *)i->data;
pmpkg_t *info = _alpm_db_scan(db, miss->target);
if(info) {
_alpm_log(PM_LOG_DEBUG, "pulling %s in the targets list",
_alpm_log(PM_LOG_DEBUG, "pulling %s in the targets list\n",
alpm_pkg_get_name(info));
trans->packages = alpm_list_add(trans->packages, info);
} else {
_alpm_log(PM_LOG_ERROR, _("could not find %s in database -- skipping"),
_alpm_log(PM_LOG_ERROR, _("could not find %s in database -- skipping\n"),
miss->depend.name);
}
}
@ -136,12 +136,12 @@ int _alpm_remove_prepare(pmtrans_t *trans, pmdb_t *db, alpm_list_t **data)
}
if(trans->flags & PM_TRANS_FLAG_RECURSE) {
_alpm_log(PM_LOG_DEBUG, "finding removable dependencies");
_alpm_log(PM_LOG_DEBUG, "finding removable dependencies\n");
_alpm_recursedeps(db, &trans->packages, 0);
}
/* re-order w.r.t. dependencies */
_alpm_log(PM_LOG_DEBUG, "sorting by dependencies");
_alpm_log(PM_LOG_DEBUG, "sorting by dependencies\n");
lp = _alpm_sortbydeps(trans->packages, PM_TRANS_TYPE_REMOVE);
/* free the old alltargs */
alpm_list_free(trans->packages);
@ -168,7 +168,7 @@ static int can_remove_file(pmtrans_t *trans, const char *path)
if(errno != EACCES && errno != ETXTBSY && access(file, F_OK) == 0) {
/* only return failure if the file ACTUALLY exists and we can't write to
* it - ignore "chmod -w" simple permission failures */
_alpm_log(PM_LOG_ERROR, _("cannot remove file '%s': %s"),
_alpm_log(PM_LOG_ERROR, _("cannot remove file '%s': %s\n"),
file, strerror(errno));
return(0);
}
@ -208,29 +208,29 @@ static void unlink_file(pmpkg_t *info, alpm_list_t *lp, alpm_list_t *targ,
if(trans->type == PM_TRANS_TYPE_REMOVEUPGRADE) {
/* check noupgrade */
if(alpm_list_find_str(handle->noupgrade, lp->data)) {
_alpm_log(PM_LOG_DEBUG, "Skipping removal of '%s' due to NoUpgrade", file);
_alpm_log(PM_LOG_DEBUG, "Skipping removal of '%s' due to NoUpgrade\n", file);
return;
}
}
if(lstat(file, &buf)) {
_alpm_log(PM_LOG_DEBUG, "file %s does not exist", file);
_alpm_log(PM_LOG_DEBUG, "file %s does not exist\n", file);
return;
}
if(S_ISDIR(buf.st_mode)) {
if(rmdir(file)) {
/* this is okay, other pakcages are probably using it (like /usr) */
_alpm_log(PM_LOG_DEBUG, "keeping directory %s", file);
_alpm_log(PM_LOG_DEBUG, "keeping directory %s\n", file);
} else {
_alpm_log(PM_LOG_DEBUG, "removing directory %s", file);
_alpm_log(PM_LOG_DEBUG, "removing directory %s\n", file);
}
} else {
/* check the remove skip list before removing the file.
* see the big comment block in db_find_conflicts() for an
* explanation. */
if(alpm_list_find_str(trans->skip_remove, file)) {
_alpm_log(PM_LOG_DEBUG, "%s is in trans->skip_remove, skipping removal", file);
_alpm_log(PM_LOG_DEBUG, "%s is in trans->skip_remove, skipping removal\n", file);
return;
} else if(needbackup) {
/* if the file is flagged, back it up to .pacsave */
@ -241,21 +241,21 @@ static void unlink_file(pmpkg_t *info, alpm_list_t *lp, alpm_list_t *targ,
char newpath[PATH_MAX];
snprintf(newpath, PATH_MAX, "%s.pacsave", file);
rename(file, newpath);
_alpm_log(PM_LOG_WARNING, _("%s saved as %s"), file, newpath);
_alpm_log(PM_LOG_WARNING, _("%s saved as %s\n"), file, newpath);
return;
} else {
_alpm_log(PM_LOG_DEBUG, "transaction is set to NOSAVE, not backing up '%s'", file);
_alpm_log(PM_LOG_DEBUG, "transaction is set to NOSAVE, not backing up '%s'\n", file);
}
}
}
_alpm_log(PM_LOG_DEBUG, "unlinking %s", file);
_alpm_log(PM_LOG_DEBUG, "unlinking %s\n", file);
int list_count = alpm_list_count(trans->packages); /* this way we don't have to call alpm_list_count twice during PROGRESS */
PROGRESS(trans, PM_TRANS_PROGRESS_REMOVE_START, info->name, (double)(percent * 100), list_count, (list_count - alpm_list_count(targ) + 1));
++(*position);
if(unlink(file) == -1) {
_alpm_log(PM_LOG_ERROR, _("cannot remove file %s: %s"), lp->data, strerror(errno));
_alpm_log(PM_LOG_ERROR, _("cannot remove file %s: %s\n"), lp->data, strerror(errno));
}
}
}
@ -288,7 +288,7 @@ int _alpm_remove_commit(pmtrans_t *trans, pmdb_t *db)
if(trans->type != PM_TRANS_TYPE_REMOVEUPGRADE) {
EVENT(trans, PM_TRANS_EVT_REMOVE_START, info, NULL);
_alpm_log(PM_LOG_DEBUG, "removing package %s-%s",
_alpm_log(PM_LOG_DEBUG, "removing package %s-%s\n",
pkgname, alpm_pkg_get_version(info));
/* run the pre-remove scriptlet if it exists */
@ -303,14 +303,14 @@ int _alpm_remove_commit(pmtrans_t *trans, pmdb_t *db)
if(!(trans->flags & PM_TRANS_FLAG_DBONLY)) {
for(lp = files; lp; lp = lp->next) {
if(!can_remove_file(trans, lp->data)) {
_alpm_log(PM_LOG_DEBUG, "not removing package '%s', can't remove all files",
_alpm_log(PM_LOG_DEBUG, "not removing package '%s', can't remove all files\n",
pkgname);
RET_ERR(PM_ERR_PKG_CANT_REMOVE, -1);
}
}
int filenum = alpm_list_count(files);
_alpm_log(PM_LOG_DEBUG, "removing %d files", filenum);
_alpm_log(PM_LOG_DEBUG, "removing %d files\n", filenum);
/* iterate through the list backwards, unlinking files */
for(lp = alpm_list_last(files); lp; lp = lp->prev) {
@ -335,15 +335,15 @@ int _alpm_remove_commit(pmtrans_t *trans, pmdb_t *db)
infodup = _alpm_pkg_dup(info);
/* remove the package from the database */
_alpm_log(PM_LOG_DEBUG, "updating database");
_alpm_log(PM_LOG_DEBUG, "removing database entry '%s'", pkgname);
_alpm_log(PM_LOG_DEBUG, "updating database\n");
_alpm_log(PM_LOG_DEBUG, "removing database entry '%s'\n", pkgname);
if(_alpm_db_remove(db, info) == -1) {
_alpm_log(PM_LOG_ERROR, _("could not remove database entry %s-%s"),
_alpm_log(PM_LOG_ERROR, _("could not remove database entry %s-%s\n"),
pkgname, alpm_pkg_get_version(info));
}
/* remove the package from the cache */
if(_alpm_db_remove_pkgfromcache(db, info) == -1) {
_alpm_log(PM_LOG_ERROR, _("could not remove entry '%s' from cache"),
_alpm_log(PM_LOG_ERROR, _("could not remove entry '%s' from cache\n"),
pkgname);
}
@ -360,7 +360,7 @@ int _alpm_remove_commit(pmtrans_t *trans, pmdb_t *db)
/* run ldconfig if it exists */
if((trans->type != PM_TRANS_TYPE_REMOVEUPGRADE)
&& (handle->trans->state != STATE_INTERRUPTED)) {
_alpm_log(PM_LOG_DEBUG, "running \"ldconfig -r %s\"", handle->root);
_alpm_log(PM_LOG_DEBUG, "running \"ldconfig -r %s\"\n", handle->root);
_alpm_ldconfig(handle->root);
}

View File

@ -50,18 +50,18 @@ pmserver_t *_alpm_server_new(const char *url)
server = malloc(sizeof(pmserver_t));
if(server == NULL) {
_alpm_log(PM_LOG_ERROR, _("malloc failure: could not allocate %d bytes"), sizeof(pmserver_t));
_alpm_log(PM_LOG_ERROR, _("malloc failure: could not allocate %d bytes\n"), sizeof(pmserver_t));
RET_ERR(PM_ERR_MEMORY, NULL);
}
memset(server, 0, sizeof(pmserver_t));
u = downloadParseURL(url);
if(!u) {
_alpm_log(PM_LOG_ERROR, _("url '%s' is invalid, ignoring"), url);
_alpm_log(PM_LOG_ERROR, _("url '%s' is invalid, ignoring\n"), url);
RET_ERR(PM_ERR_SERVER_BAD_URL, NULL);
}
if(strlen(u->scheme) == 0) {
_alpm_log(PM_LOG_WARNING, _("url scheme not specified, assuming http"));
_alpm_log(PM_LOG_WARNING, _("url scheme not specified, assuming http\n"));
strcpy(u->scheme, "http");
}
@ -103,7 +103,7 @@ static char *strip_filename(pmserver_t *server)
p = strrchr(server->s_url->doc, '/');
if(p && *(++p)) {
fname = strdup(p);
_alpm_log(PM_LOG_DEBUG, "stripping '%s' from '%s'",
_alpm_log(PM_LOG_DEBUG, "stripping '%s' from '%s'\n",
fname, server->s_url->doc);
*p = 0;
}
@ -203,7 +203,7 @@ int _alpm_downloadfiles_forreal(alpm_list_t *servers, const char *localpath,
/* just use the raw filename if we can't find crap */
strncpy(pkgname, fn, PKG_NAME_LEN);
}
_alpm_log(PM_LOG_DEBUG, "using '%s' for download progress", pkgname);
_alpm_log(PM_LOG_DEBUG, "using '%s' for download progress\n", pkgname);
snprintf(realfile, PATH_MAX, "%s%s", localpath, fn);
snprintf(output, PATH_MAX, "%s%s.part", localpath, fn);
@ -219,7 +219,7 @@ int _alpm_downloadfiles_forreal(alpm_list_t *servers, const char *localpath,
int chk_resume = 0;
if(stat(output, &st) == 0 && st.st_size > 0) {
_alpm_log(PM_LOG_DEBUG, "existing file found, using it");
_alpm_log(PM_LOG_DEBUG, "existing file found, using it\n");
fileurl->offset = (off_t)st.st_size;
dltotal_bytes = st.st_size;
localf = fopen(output, "a");
@ -238,7 +238,7 @@ int _alpm_downloadfiles_forreal(alpm_list_t *servers, const char *localpath,
dlf = downloadXGet(fileurl, &ust, (handle->nopassiveftp ? "" : "p"));
if(downloadLastErrCode != 0 || dlf == NULL) {
_alpm_log(PM_LOG_ERROR, _("failed retrieving file '%s' from %s : %s"),
_alpm_log(PM_LOG_ERROR, _("failed retrieving file '%s' from %s : %s\n"),
fn, fileurl->host, downloadLastErrString);
if(localf != NULL) {
fclose(localf);
@ -247,14 +247,14 @@ int _alpm_downloadfiles_forreal(alpm_list_t *servers, const char *localpath,
downloadFreeURL(fileurl);
continue;
} else {
_alpm_log(PM_LOG_DEBUG, "connected to %s successfully", fileurl->host);
_alpm_log(PM_LOG_DEBUG, "connected to %s successfully\n", fileurl->host);
}
if(ust.mtime && mtime1) {
char strtime[15];
_alpm_time2string(ust.mtime, strtime);
if(strcmp(mtime1, strtime) == 0) {
_alpm_log(PM_LOG_DEBUG, "mtimes are identical, skipping %s", fn);
_alpm_log(PM_LOG_DEBUG, "mtimes are identical, skipping %s\n", fn);
complete = alpm_list_add(complete, fn);
if(localf != NULL) {
fclose(localf);
@ -272,7 +272,7 @@ int _alpm_downloadfiles_forreal(alpm_list_t *servers, const char *localpath,
}
if(chk_resume && fileurl->offset == 0) {
_alpm_log(PM_LOG_WARNING, _("cannot resume download, starting over"));
_alpm_log(PM_LOG_WARNING, _("cannot resume download, starting over\n"));
if(localf != NULL) {
fclose(localf);
localf = NULL;
@ -285,7 +285,7 @@ int _alpm_downloadfiles_forreal(alpm_list_t *servers, const char *localpath,
dltotal_bytes = 0;
localf = fopen(output, "w");
if(localf == NULL) { /* still null? */
_alpm_log(PM_LOG_ERROR, _("cannot write to file '%s'"), output);
_alpm_log(PM_LOG_ERROR, _("cannot write to file '%s'\n"), output);
if(dlf != NULL) {
fclose(dlf);
}
@ -301,7 +301,7 @@ int _alpm_downloadfiles_forreal(alpm_list_t *servers, const char *localpath,
char buffer[PM_DLBUF_LEN];
while((nread = fread(buffer, 1, PM_DLBUF_LEN, dlf)) > 0) {
if(ferror(dlf)) {
_alpm_log(PM_LOG_ERROR, _("error downloading '%s': %s"),
_alpm_log(PM_LOG_ERROR, _("error downloading '%s': %s\n"),
fn, downloadLastErrString);
fclose(localf);
fclose(dlf);
@ -313,7 +313,7 @@ int _alpm_downloadfiles_forreal(alpm_list_t *servers, const char *localpath,
while(nwritten < nread) {
nwritten += fwrite(buffer, 1, (nread - nwritten), localf);
if(ferror(localf)) {
_alpm_log(PM_LOG_ERROR, _("error writing to file '%s': %s"),
_alpm_log(PM_LOG_ERROR, _("error writing to file '%s': %s\n"),
realfile, strerror(errno));
fclose(localf);
fclose(dlf);
@ -374,18 +374,18 @@ int _alpm_downloadfiles_forreal(alpm_list_t *servers, const char *localpath,
/* cwd to the download directory */
getcwd(cwd, PATH_MAX);
if(chdir(localpath)) {
_alpm_log(PM_LOG_WARNING, _("could not chdir to %s"), localpath);
_alpm_log(PM_LOG_WARNING, _("could not chdir to %s\n"), localpath);
return(PM_ERR_CONNECT_FAILED);
}
/* execute the parsed command via /bin/sh -c */
_alpm_log(PM_LOG_DEBUG, "running command: %s", parsedCmd);
_alpm_log(PM_LOG_DEBUG, "running command: %s\n", parsedCmd);
ret = system(parsedCmd);
if(ret == -1) {
_alpm_log(PM_LOG_WARNING, _("running XferCommand: fork failed!"));
_alpm_log(PM_LOG_WARNING, _("running XferCommand: fork failed!\n"));
return(PM_ERR_FORK_FAILED);
} else if(ret != 0) {
/* download failed */
_alpm_log(PM_LOG_DEBUG, "XferCommand command returned non-zero status code (%d)", ret);
_alpm_log(PM_LOG_DEBUG, "XferCommand command returned non-zero status code (%d)\n", ret);
} else {
/* download was successful */
complete = alpm_list_add(complete, fn);
@ -420,7 +420,7 @@ char SYMEXPORT *alpm_fetch_pkgurl(const char *url)
ALPM_LOG_FUNC;
if(strstr(url, "://") == NULL) {
_alpm_log(PM_LOG_DEBUG, "Invalid URL passed to alpm_fetch_pkgurl");
_alpm_log(PM_LOG_DEBUG, "Invalid URL passed to alpm_fetch_pkgurl\n");
return(NULL);
}
@ -432,7 +432,7 @@ char SYMEXPORT *alpm_fetch_pkgurl(const char *url)
/* strip path information from the filename */
filename = strip_filename(server);
if(!filename) {
_alpm_log(PM_LOG_ERROR, _("URL does not contain a file for download"));
_alpm_log(PM_LOG_ERROR, _("URL does not contain a file for download\n"));
return(NULL);
}
@ -445,10 +445,10 @@ char SYMEXPORT *alpm_fetch_pkgurl(const char *url)
/* download the file */
if(_alpm_downloadfiles(servers, cachedir, files)) {
_alpm_log(PM_LOG_WARNING, _("failed to download %s"), url);
_alpm_log(PM_LOG_WARNING, _("failed to download %s\n"), url);
return(NULL);
}
_alpm_log(PM_LOG_DEBUG, "successfully downloaded %s", filename);
_alpm_log(PM_LOG_DEBUG, "successfully downloaded %s\n", filename);
alpm_list_free(files);
alpm_list_free(servers);
_alpm_server_free(server);

View File

@ -56,7 +56,7 @@ pmsyncpkg_t *_alpm_sync_new(int type, pmpkg_t *spkg, void *data)
ALPM_LOG_FUNC;
if((sync = malloc(sizeof(pmsyncpkg_t))) == NULL) {
_alpm_log(PM_LOG_ERROR, _("malloc failure: could not allocate %d bytes"), sizeof(pmsyncpkg_t));
_alpm_log(PM_LOG_ERROR, _("malloc failure: could not allocate %d bytes\n"), sizeof(pmsyncpkg_t));
return(NULL);
}
@ -101,7 +101,7 @@ static int find_replacements(pmtrans_t *trans, pmdb_t *db_local,
ALPM_LOG_FUNC;
/* check for "recommended" package replacements */
_alpm_log(PM_LOG_DEBUG, "checking for package replacements");
_alpm_log(PM_LOG_DEBUG, "checking for package replacements\n");
for(i = dbs_sync; i; i = i->next) {
pmdb_t *db = i->data;
@ -117,12 +117,12 @@ static int find_replacements(pmtrans_t *trans, pmdb_t *db_local,
continue;
}
_alpm_log(PM_LOG_DEBUG, "checking replacement '%s' for package '%s'",
_alpm_log(PM_LOG_DEBUG, "checking replacement '%s' for package '%s'\n",
replacement, spkg->name);
/* ignore if EITHER the local or replacement package are to be ignored */
if(alpm_list_find_str(handle->ignorepkg, spkg->name)
|| alpm_list_find_str(handle->ignorepkg, lpkg->name)) {
_alpm_log(PM_LOG_WARNING, _("%s-%s: ignoring package upgrade (to be replaced by %s-%s)"),
_alpm_log(PM_LOG_WARNING, _("%s-%s: ignoring package upgrade (to be replaced by %s-%s)\n"),
alpm_pkg_get_name(lpkg), alpm_pkg_get_version(lpkg),
alpm_pkg_get_name(spkg), alpm_pkg_get_version(spkg));
} else {
@ -157,7 +157,7 @@ static int find_replacements(pmtrans_t *trans, pmdb_t *db_local,
sync->data = alpm_list_add(NULL, dummy);
trans->packages = alpm_list_add(trans->packages, sync);
}
_alpm_log(PM_LOG_DEBUG, "%s-%s elected for upgrade (to be replaced by %s-%s)",
_alpm_log(PM_LOG_DEBUG, "%s-%s elected for upgrade (to be replaced by %s-%s)\n",
alpm_pkg_get_name(lpkg), alpm_pkg_get_version(lpkg),
alpm_pkg_get_name(spkg), alpm_pkg_get_version(spkg));
}
@ -180,7 +180,7 @@ int _alpm_sync_sysupgrade(pmtrans_t *trans, pmdb_t *db_local, alpm_list_t *dbs_s
/* check for "recommended" package replacements */
if(find_replacements(trans, db_local, dbs_sync) == 0) {
/* match installed packages with the sync dbs and compare versions */
_alpm_log(PM_LOG_DEBUG, "checking for package upgrades");
_alpm_log(PM_LOG_DEBUG, "checking for package upgrades\n");
for(i = _alpm_db_get_pkgcache(db_local); i; i = i->next) {
int replace=0;
pmpkg_t *local = i->data;
@ -191,7 +191,7 @@ int _alpm_sync_sysupgrade(pmtrans_t *trans, pmdb_t *db_local, alpm_list_t *dbs_s
spkg = _alpm_db_get_pkgfromcache(j->data, alpm_pkg_get_name(local));
}
if(spkg == NULL) {
_alpm_log(PM_LOG_DEBUG, "'%s' not found in sync db -- skipping",
_alpm_log(PM_LOG_DEBUG, "'%s' not found in sync db -- skipping\n",
alpm_pkg_get_name(local));
continue;
}
@ -206,14 +206,14 @@ int _alpm_sync_sysupgrade(pmtrans_t *trans, pmdb_t *db_local, alpm_list_t *dbs_s
}
}
if(replace) {
_alpm_log(PM_LOG_DEBUG, "'%s' is already elected for removal -- skipping",
_alpm_log(PM_LOG_DEBUG, "'%s' is already elected for removal -- skipping\n",
alpm_pkg_get_name(local));
continue;
}
/* compare versions and see if we need to upgrade */
if(alpm_pkg_compare_versions(local, spkg)) {
_alpm_log(PM_LOG_DEBUG, "%s-%s elected for upgrade (%s => %s)",
_alpm_log(PM_LOG_DEBUG, "%s-%s elected for upgrade (%s => %s)\n",
alpm_pkg_get_name(local), alpm_pkg_get_version(local),
alpm_pkg_get_name(spkg), alpm_pkg_get_version(spkg));
if(!_alpm_sync_find(trans->packages, alpm_pkg_get_name(spkg))) {
@ -268,7 +268,7 @@ int _alpm_sync_addtarget(pmtrans_t *trans, pmdb_t *db_local, alpm_list_t *dbs_sy
if(targ) {
*targ = '\0';
targ++;
_alpm_log(PM_LOG_DEBUG, "searching for target in repo '%s'", targ);
_alpm_log(PM_LOG_DEBUG, "searching for target in repo '%s'\n", targ);
for(j = dbs_sync; j && !spkg; j = j->next) {
pmdb_t *db = j->data;
if(strcmp(db->treename, targline) == 0) {
@ -276,19 +276,19 @@ int _alpm_sync_addtarget(pmtrans_t *trans, pmdb_t *db_local, alpm_list_t *dbs_sy
spkg = _alpm_db_get_pkgfromcache(db, targ);
if(spkg == NULL) {
/* Search provides */
_alpm_log(PM_LOG_DEBUG, "target '%s' not found -- looking for provisions", targ);
_alpm_log(PM_LOG_DEBUG, "target '%s' not found -- looking for provisions\n", targ);
alpm_list_t *p = _alpm_db_whatprovides(db, targ);
if(!p) {
RET_ERR(PM_ERR_PKG_NOT_FOUND, -1);
}
_alpm_log(PM_LOG_DEBUG, "found '%s' as a provision for '%s'", p->data, targ);
_alpm_log(PM_LOG_DEBUG, "found '%s' as a provision for '%s'\n", p->data, targ);
spkg = _alpm_db_get_pkgfromcache(db, p->data);
alpm_list_free(p);
}
}
}
if(!repo_found) {
_alpm_log(PM_LOG_ERROR, _("repository '%s' not found"), targline);
_alpm_log(PM_LOG_ERROR, _("repository '%s' not found\n"), targline);
RET_ERR(PM_ERR_PKG_REPO_NOT_FOUND, -1);
}
} else {
@ -299,12 +299,12 @@ int _alpm_sync_addtarget(pmtrans_t *trans, pmdb_t *db_local, alpm_list_t *dbs_sy
}
if(spkg == NULL) {
/* Search provides */
_alpm_log(PM_LOG_DEBUG, "target '%s' not found -- looking for provisions", targ);
_alpm_log(PM_LOG_DEBUG, "target '%s' not found -- looking for provisions\n", targ);
for(j = dbs_sync; j && !spkg; j = j->next) {
pmdb_t *db = j->data;
alpm_list_t *p = _alpm_db_whatprovides(db, targ);
if(p) {
_alpm_log(PM_LOG_DEBUG, "found '%s' as a provision for '%s'", p->data, targ);
_alpm_log(PM_LOG_DEBUG, "found '%s' as a provision for '%s'\n", p->data, targ);
spkg = _alpm_db_get_pkgfromcache(db, p->data);
alpm_list_free(p);
}
@ -329,7 +329,7 @@ int _alpm_sync_addtarget(pmtrans_t *trans, pmdb_t *db_local, alpm_list_t *dbs_sy
} else if(!(trans->flags & PM_TRANS_FLAG_PRINTURIS)) {
QUESTION(trans, PM_TRANS_CONV_LOCAL_UPTODATE, local, NULL, NULL, &resp);
if(!resp) {
_alpm_log(PM_LOG_WARNING, _("%s-%s is up to date -- skipping"),
_alpm_log(PM_LOG_WARNING, _("%s-%s is up to date -- skipping\n"),
alpm_pkg_get_name(local), alpm_pkg_get_version(local));
return(0);
}
@ -352,7 +352,7 @@ int _alpm_sync_addtarget(pmtrans_t *trans, pmdb_t *db_local, alpm_list_t *dbs_sy
_alpm_pkg_free(dummy);
RET_ERR(PM_ERR_MEMORY, -1);
}
_alpm_log(PM_LOG_DEBUG, "adding target '%s' to the transaction set",
_alpm_log(PM_LOG_DEBUG, "adding target '%s' to the transaction set\n",
alpm_pkg_get_name(spkg));
trans->packages = alpm_list_add(trans->packages, sync);
}
@ -400,7 +400,7 @@ int _alpm_sync_prepare(pmtrans_t *trans, pmdb_t *db_local, alpm_list_t *dbs_sync
if(!(trans->flags & PM_TRANS_FLAG_NODEPS)) {
/* Resolve targets dependencies */
EVENT(trans, PM_TRANS_EVT_RESOLVEDEPS_START, NULL, NULL);
_alpm_log(PM_LOG_DEBUG, "resolving target's dependencies");
_alpm_log(PM_LOG_DEBUG, "resolving target's dependencies\n");
for(i = trans->packages; i; i = i->next) {
pmpkg_t *spkg = ((pmsyncpkg_t *)i->data)->pkg;
if(_alpm_resolvedeps(db_local, dbs_sync, spkg, &list,
@ -425,7 +425,7 @@ int _alpm_sync_prepare(pmtrans_t *trans, pmdb_t *db_local, alpm_list_t *dbs_sync
goto cleanup;
}
trans->packages = alpm_list_add(trans->packages, sync);
_alpm_log(PM_LOG_DEBUG, "adding package %s-%s to the transaction targets",
_alpm_log(PM_LOG_DEBUG, "adding package %s-%s to the transaction targets\n",
alpm_pkg_get_name(spkg), alpm_pkg_get_version(spkg));
}
}
@ -447,7 +447,7 @@ int _alpm_sync_prepare(pmtrans_t *trans, pmdb_t *db_local, alpm_list_t *dbs_sync
EVENT(trans, PM_TRANS_EVT_RESOLVEDEPS_DONE, NULL, NULL);
_alpm_log(PM_LOG_DEBUG, "looking for unresolvable dependencies");
_alpm_log(PM_LOG_DEBUG, "looking for unresolvable dependencies\n");
deps = _alpm_checkdeps(db_local, PM_TRANS_TYPE_UPGRADE, list);
if(deps) {
if(data) {
@ -466,7 +466,7 @@ int _alpm_sync_prepare(pmtrans_t *trans, pmdb_t *db_local, alpm_list_t *dbs_sync
/* check for inter-conflicts and whatnot */
EVENT(trans, PM_TRANS_EVT_INTERCONFLICTS_START, NULL, NULL);
_alpm_log(PM_LOG_DEBUG, "looking for conflicts");
_alpm_log(PM_LOG_DEBUG, "looking for conflicts\n");
deps = _alpm_checkconflicts(db_local, list);
if(deps) {
int errorout = 0;
@ -477,7 +477,7 @@ int _alpm_sync_prepare(pmtrans_t *trans, pmdb_t *db_local, alpm_list_t *dbs_sync
pmsyncpkg_t *sync;
pmpkg_t *found = NULL;
_alpm_log(PM_LOG_DEBUG, "package '%s' conflicts with '%s'",
_alpm_log(PM_LOG_DEBUG, "package '%s' conflicts with '%s'\n",
miss->target, miss->depend.name);
/* check if the conflicting package is about to be removed/replaced.
* if so, then just ignore it. */
@ -488,14 +488,14 @@ int _alpm_sync_prepare(pmtrans_t *trans, pmdb_t *db_local, alpm_list_t *dbs_sync
}
}
if(found) {
_alpm_log(PM_LOG_DEBUG, "'%s' is already elected for removal -- skipping",
_alpm_log(PM_LOG_DEBUG, "'%s' is already elected for removal -- skipping\n",
alpm_pkg_get_name(found));
continue;
}
sync = _alpm_sync_find(trans->packages, miss->target);
if(sync == NULL) {
_alpm_log(PM_LOG_DEBUG, "'%s' not found in transaction set -- skipping",
_alpm_log(PM_LOG_DEBUG, "'%s' not found in transaction set -- skipping\n",
miss->target);
continue;
}
@ -505,7 +505,7 @@ int _alpm_sync_prepare(pmtrans_t *trans, pmdb_t *db_local, alpm_list_t *dbs_sync
miss->depend.name)) {
/* treat like a replaces item so requiredby fields are
* inherited properly. */
_alpm_log(PM_LOG_DEBUG, "package '%s' provides its own conflict",
_alpm_log(PM_LOG_DEBUG, "package '%s' provides its own conflict\n",
miss->target);
if(!local) {
char *rmpkg = NULL;
@ -526,12 +526,12 @@ int _alpm_sync_prepare(pmtrans_t *trans, pmdb_t *db_local, alpm_list_t *dbs_sync
target = alpm_list_find_str(trans->targets, miss->target);
depend = alpm_list_find_str(trans->targets, miss->depend.name);
if(depend && !target) {
_alpm_log(PM_LOG_DEBUG, "'%s' is in the target list -- keeping it",
_alpm_log(PM_LOG_DEBUG, "'%s' is in the target list -- keeping it\n",
miss->depend.name);
/* remove miss->target */
rmpkg = miss->target;
} else if(target && !depend) {
_alpm_log(PM_LOG_DEBUG, "'%s' is in the target list -- keeping it",
_alpm_log(PM_LOG_DEBUG, "'%s' is in the target list -- keeping it\n",
miss->target);
/* remove miss->depend.name */
rmpkg = miss->depend.name;
@ -543,7 +543,7 @@ int _alpm_sync_prepare(pmtrans_t *trans, pmdb_t *db_local, alpm_list_t *dbs_sync
if(rmpkg) {
pmsyncpkg_t *rsync = _alpm_sync_find(trans->packages, rmpkg);
void *vpkg;
_alpm_log(PM_LOG_DEBUG, "removing '%s' from target list",
_alpm_log(PM_LOG_DEBUG, "removing '%s' from target list\n",
rsync->pkg->name);
trans->packages = alpm_list_remove(trans->packages, rsync,
syncpkg_cmp, &vpkg);
@ -553,7 +553,7 @@ int _alpm_sync_prepare(pmtrans_t *trans, pmdb_t *db_local, alpm_list_t *dbs_sync
}
}
/* It's a conflict -- see if they want to remove it */
_alpm_log(PM_LOG_DEBUG, "resolving package '%s' conflict",
_alpm_log(PM_LOG_DEBUG, "resolving package '%s' conflict\n",
miss->target);
if(local) {
int doremove = 0;
@ -571,7 +571,7 @@ int _alpm_sync_prepare(pmtrans_t *trans, pmdb_t *db_local, alpm_list_t *dbs_sync
sync->data = NULL;
}
/* append to the replaces list */
_alpm_log(PM_LOG_DEBUG, "electing '%s' for removal",
_alpm_log(PM_LOG_DEBUG, "electing '%s' for removal\n",
miss->depend.name);
sync->data = alpm_list_add(sync->data, q);
/* see if the package is in the current target list */
@ -580,7 +580,7 @@ int _alpm_sync_prepare(pmtrans_t *trans, pmdb_t *db_local, alpm_list_t *dbs_sync
if(rsync) {
/* remove it from the target list */
void *vpkg;
_alpm_log(PM_LOG_DEBUG, "removing '%s' from target list",
_alpm_log(PM_LOG_DEBUG, "removing '%s' from target list\n",
miss->depend.name);
trans->packages = alpm_list_remove(trans->packages, rsync,
syncpkg_cmp, &vpkg);
@ -588,11 +588,11 @@ int _alpm_sync_prepare(pmtrans_t *trans, pmdb_t *db_local, alpm_list_t *dbs_sync
}
} else {
/* abort */
_alpm_log(PM_LOG_ERROR, _("unresolvable package conflicts detected"));
_alpm_log(PM_LOG_ERROR, _("unresolvable package conflicts detected\n"));
errorout = 1;
if(data) {
if((miss = malloc(sizeof(pmdepmissing_t))) == NULL) {
_alpm_log(PM_LOG_ERROR, _("malloc failure: could not allocate %d bytes"), sizeof(pmdepmissing_t));
_alpm_log(PM_LOG_ERROR, _("malloc failure: could not allocate %d bytes\n"), sizeof(pmdepmissing_t));
FREELIST(*data);
pm_errno = PM_ERR_MEMORY;
ret = -1;
@ -604,11 +604,11 @@ int _alpm_sync_prepare(pmtrans_t *trans, pmdb_t *db_local, alpm_list_t *dbs_sync
}
}
} else {
_alpm_log(PM_LOG_ERROR, _("unresolvable package conflicts detected"));
_alpm_log(PM_LOG_ERROR, _("unresolvable package conflicts detected\n"));
errorout = 1;
if(data) {
if((miss = malloc(sizeof(pmdepmissing_t))) == NULL) {
_alpm_log(PM_LOG_ERROR, _("malloc failure: could not allocate %d bytes"), sizeof(pmdepmissing_t));
_alpm_log(PM_LOG_ERROR, _("malloc failure: could not allocate %d bytes\n"), sizeof(pmdepmissing_t));
FREELIST(*data);
pm_errno = PM_ERR_MEMORY;
ret = -1;
@ -657,7 +657,7 @@ int _alpm_sync_prepare(pmtrans_t *trans, pmdb_t *db_local, alpm_list_t *dbs_sync
}
}
if(list) {
_alpm_log(PM_LOG_DEBUG, "checking dependencies of packages designated for removal");
_alpm_log(PM_LOG_DEBUG, "checking dependencies of packages designated for removal\n");
deps = _alpm_checkdeps(db_local, PM_TRANS_TYPE_REMOVE, list);
if(deps) {
/* Check if broken dependencies are fixed by packages we are installing */
@ -671,7 +671,7 @@ int _alpm_sync_prepare(pmtrans_t *trans, pmdb_t *db_local, alpm_list_t *dbs_sync
pmsyncpkg_t *sp = l->data;
pmpkg_t *sppkg = sp->pkg;
if(alpm_depcmp(sppkg, &(miss->depend))) {
_alpm_log(PM_LOG_DEBUG, "sync: dependency '%s' satisfied by package '%s'",
_alpm_log(PM_LOG_DEBUG, "sync: dependency '%s' satisfied by package '%s'\n",
miss->depend.name, alpm_pkg_get_name(sppkg));
satisfied = 1;
}
@ -821,13 +821,13 @@ int _alpm_sync_commit(pmtrans_t *trans, pmdb_t *db_local, alpm_list_t **data)
trans->state = STATE_COMMITING;
tr = _alpm_trans_new();
if(tr == NULL) {
_alpm_log(PM_LOG_ERROR, _("could not create removal transaction"));
_alpm_log(PM_LOG_ERROR, _("could not create removal transaction\n"));
pm_errno = PM_ERR_MEMORY;
goto error;
}
if(_alpm_trans_init(tr, PM_TRANS_TYPE_REMOVE, PM_TRANS_FLAG_NODEPS, NULL, NULL, NULL) == -1) {
_alpm_log(PM_LOG_ERROR, _("could not initialize the removal transaction"));
_alpm_log(PM_LOG_ERROR, _("could not initialize the removal transaction\n"));
goto error;
}
@ -847,15 +847,15 @@ int _alpm_sync_commit(pmtrans_t *trans, pmdb_t *db_local, alpm_list_t **data)
}
}
if(replaces) {
_alpm_log(PM_LOG_DEBUG, "removing conflicting and to-be-replaced packages");
_alpm_log(PM_LOG_DEBUG, "removing conflicting and to-be-replaced packages\n");
if(_alpm_trans_prepare(tr, data) == -1) {
_alpm_log(PM_LOG_ERROR, _("could not prepare removal transaction"));
_alpm_log(PM_LOG_ERROR, _("could not prepare removal transaction\n"));
goto error;
}
/* we want the frontend to be aware of commit details */
tr->cb_event = trans->cb_event;
if(_alpm_trans_commit(tr, NULL) == -1) {
_alpm_log(PM_LOG_ERROR, _("could not commit removal transaction"));
_alpm_log(PM_LOG_ERROR, _("could not commit removal transaction\n"));
goto error;
}
}
@ -863,15 +863,15 @@ int _alpm_sync_commit(pmtrans_t *trans, pmdb_t *db_local, alpm_list_t **data)
tr = NULL;
/* install targets */
_alpm_log(PM_LOG_DEBUG, "installing packages");
_alpm_log(PM_LOG_DEBUG, "installing packages\n");
tr = _alpm_trans_new();
if(tr == NULL) {
_alpm_log(PM_LOG_ERROR, _("could not create transaction"));
_alpm_log(PM_LOG_ERROR, _("could not create transaction\n"));
pm_errno = PM_ERR_MEMORY;
goto error;
}
if(_alpm_trans_init(tr, PM_TRANS_TYPE_UPGRADE, trans->flags | PM_TRANS_FLAG_NODEPS, trans->cb_event, trans->cb_conv, trans->cb_progress) == -1) {
_alpm_log(PM_LOG_ERROR, _("could not initialize transaction"));
_alpm_log(PM_LOG_ERROR, _("could not initialize transaction\n"));
goto error;
}
for(i = trans->packages; i; i = i->next) {
@ -898,12 +898,12 @@ int _alpm_sync_commit(pmtrans_t *trans, pmdb_t *db_local, alpm_list_t **data)
}
}
if(_alpm_trans_prepare(tr, data) == -1) {
_alpm_log(PM_LOG_ERROR, _("could not prepare transaction"));
_alpm_log(PM_LOG_ERROR, _("could not prepare transaction\n"));
/* pm_errno is set by trans_prepare */
goto error;
}
if(_alpm_trans_commit(tr, NULL) == -1) {
_alpm_log(PM_LOG_ERROR, _("could not commit transaction"));
_alpm_log(PM_LOG_ERROR, _("could not commit transaction\n"));
goto error;
}
_alpm_trans_free(tr);
@ -911,7 +911,7 @@ int _alpm_sync_commit(pmtrans_t *trans, pmdb_t *db_local, alpm_list_t **data)
/* propagate replaced packages' requiredby fields to their new owners */
if(replaces) {
_alpm_log(PM_LOG_DEBUG, "updating database for replaced packages' dependencies");
_alpm_log(PM_LOG_DEBUG, "updating database for replaced packages' dependencies\n");
for(i = trans->packages; i; i = i->next) {
pmsyncpkg_t *sync = i->data;
if(sync->type == PM_SYNC_TYPE_REPLACE) {
@ -940,7 +940,7 @@ int _alpm_sync_commit(pmtrans_t *trans, pmdb_t *db_local, alpm_list_t **data)
}
}
if(_alpm_db_write(db_local, depender, INFRQ_DEPENDS) == -1) {
_alpm_log(PM_LOG_ERROR, _("could not update requiredby for database entry %s-%s"),
_alpm_log(PM_LOG_ERROR, _("could not update requiredby for database entry %s-%s\n"),
alpm_pkg_get_name(new), alpm_pkg_get_version(new));
}
/* add the new requiredby */
@ -949,7 +949,7 @@ int _alpm_sync_commit(pmtrans_t *trans, pmdb_t *db_local, alpm_list_t **data)
}
}
if(_alpm_db_write(db_local, new, INFRQ_DEPENDS) == -1) {
_alpm_log(PM_LOG_ERROR, _("could not update new database entry %s-%s"),
_alpm_log(PM_LOG_ERROR, _("could not update new database entry %s-%s\n"),
alpm_pkg_get_name(new), alpm_pkg_get_version(new));
}
}
@ -975,13 +975,13 @@ pmsyncpkg_t *_alpm_sync_find(alpm_list_t *syncpkgs, const char* pkgname)
pmpkg_t *pkg = alpm_sync_get_pkg(syncpkg);
if(strcmp(alpm_pkg_get_name(pkg), pkgname) == 0) {
_alpm_log(PM_LOG_DEBUG, "found package '%s-%s' in sync",
_alpm_log(PM_LOG_DEBUG, "found package '%s-%s' in sync\n",
alpm_pkg_get_name(pkg), alpm_pkg_get_version(pkg));
return(syncpkg);
}
}
_alpm_log(PM_LOG_DEBUG, "package '%s' not found in sync", pkgname);
_alpm_log(PM_LOG_DEBUG, "package '%s' not found in sync\n", pkgname);
return(NULL); /* not found */
}

View File

@ -199,7 +199,7 @@ int SYMEXPORT alpm_trans_release()
handle->lckfd = -1;
}
if(_alpm_lckrm()) {
_alpm_log(PM_LOG_WARNING, _("could not remove lock file %s"),
_alpm_log(PM_LOG_WARNING, _("could not remove lock file %s\n"),
alpm_option_get_lockfile());
alpm_logaction("warning: could not remove lock file %s",
alpm_option_get_lockfile());
@ -217,7 +217,7 @@ pmtrans_t *_alpm_trans_new()
ALPM_LOG_FUNC;
if((trans = malloc(sizeof(pmtrans_t))) == NULL) {
_alpm_log(PM_LOG_ERROR, _("malloc failure: could not allocate %d bytes"), sizeof(pmtrans_t));
_alpm_log(PM_LOG_ERROR, _("malloc failure: could not allocate %d bytes\n"), sizeof(pmtrans_t));
return(NULL);
}
@ -447,10 +447,10 @@ int _alpm_trans_update_depends(pmtrans_t *trans, pmpkg_t *pkg)
depends = alpm_pkg_get_depends(pkg);
if(depends) {
_alpm_log(PM_LOG_DEBUG, "updating dependency packages 'requiredby' fields for %s-%s",
_alpm_log(PM_LOG_DEBUG, "updating dependency packages 'requiredby' fields for %s-%s\n",
pkgname, pkg->version);
} else {
_alpm_log(PM_LOG_DEBUG, "package has no dependencies, no other packages to update");
_alpm_log(PM_LOG_DEBUG, "package has no dependencies, no other packages to update\n");
}
localdb = alpm_option_get_localdb();
@ -468,7 +468,7 @@ int _alpm_trans_update_depends(pmtrans_t *trans, pmpkg_t *pkg)
/* this is cheating... we call this function to populate the package */
alpm_list_t *rqdby = alpm_pkg_get_requiredby(deppkg);
_alpm_log(PM_LOG_DEBUG, "updating 'requiredby' field for package '%s'",
_alpm_log(PM_LOG_DEBUG, "updating 'requiredby' field for package '%s'\n",
alpm_pkg_get_name(deppkg));
if(trans->type == PM_TRANS_TYPE_REMOVE
@ -483,7 +483,7 @@ int _alpm_trans_update_depends(pmtrans_t *trans, pmpkg_t *pkg)
}
if(_alpm_db_write(localdb, deppkg, INFRQ_DEPENDS)) {
_alpm_log(PM_LOG_ERROR, _("could not update 'requiredby' database entry %s-%s"),
_alpm_log(PM_LOG_ERROR, _("could not update 'requiredby' database entry %s-%s\n"),
alpm_pkg_get_name(deppkg), alpm_pkg_get_version(deppkg));
}
}
@ -535,7 +535,7 @@ int _alpm_runscriptlet(const char *root, const char *installfn,
if(stat(installfn, &buf)) {
/* not found */
_alpm_log(PM_LOG_DEBUG, "scriptlet '%s' not found", installfn);
_alpm_log(PM_LOG_DEBUG, "scriptlet '%s' not found\n", installfn);
return(0);
}
@ -546,7 +546,7 @@ int _alpm_runscriptlet(const char *root, const char *installfn,
}
snprintf(tmpdir, PATH_MAX, "%stmp/alpm_XXXXXX", root);
if(mkdtemp(tmpdir) == NULL) {
_alpm_log(PM_LOG_ERROR, _("could not create temp directory"));
_alpm_log(PM_LOG_ERROR, _("could not create temp directory\n"));
return(1);
}
_alpm_unpack(installfn, tmpdir, ".INSTALL");
@ -566,18 +566,18 @@ int _alpm_runscriptlet(const char *root, const char *installfn,
/* save the cwd so we can restore it later */
if(getcwd(cwd, PATH_MAX) == NULL) {
_alpm_log(PM_LOG_ERROR, _("could not get current working directory"));
_alpm_log(PM_LOG_ERROR, _("could not get current working directory\n"));
/* in case of error, cwd content is undefined: so we set it to something */
cwd[0] = 0;
}
/* just in case our cwd was removed in the upgrade operation */
if(chdir(root) != 0) {
_alpm_log(PM_LOG_ERROR, _("could not change directory to %s (%s)"), root, strerror(errno));
_alpm_log(PM_LOG_ERROR, _("could not change directory to %s (%s)\n"), root, strerror(errno));
goto cleanup;
}
_alpm_log(PM_LOG_DEBUG, "executing %s script...", script);
_alpm_log(PM_LOG_DEBUG, "executing %s script...\n", script);
if(oldver) {
snprintf(cmdline, PATH_MAX, "source %s %s %s %s",
@ -586,32 +586,32 @@ int _alpm_runscriptlet(const char *root, const char *installfn,
snprintf(cmdline, PATH_MAX, "source %s %s %s",
scriptpath, script, ver);
}
_alpm_log(PM_LOG_DEBUG, "%s", cmdline);
_alpm_log(PM_LOG_DEBUG, "%s\n", cmdline);
pid = fork();
if(pid == -1) {
_alpm_log(PM_LOG_ERROR, _("could not fork a new process (%s)"), strerror(errno));
_alpm_log(PM_LOG_ERROR, _("could not fork a new process (%s)\n"), strerror(errno));
retval = 1;
goto cleanup;
}
if(pid == 0) {
_alpm_log(PM_LOG_DEBUG, "chrooting in %s", root);
_alpm_log(PM_LOG_DEBUG, "chrooting in %s\n", root);
if(chroot(root) != 0) {
_alpm_log(PM_LOG_ERROR, _("could not change the root directory (%s)"), strerror(errno));
_alpm_log(PM_LOG_ERROR, _("could not change the root directory (%s)\n"), strerror(errno));
exit(1);
}
if(chdir("/") != 0) {
_alpm_log(PM_LOG_ERROR, _("could not change directory to / (%s)"), strerror(errno));
_alpm_log(PM_LOG_ERROR, _("could not change directory to / (%s)\n"), strerror(errno));
exit(1);
}
umask(0022);
_alpm_log(PM_LOG_DEBUG, "executing \"%s\"", cmdline);
_alpm_log(PM_LOG_DEBUG, "executing \"%s\"\n", cmdline);
execl("/bin/sh", "sh", "-c", cmdline, (char *)NULL);
exit(0);
} else {
if(waitpid(pid, 0, 0) == -1) {
_alpm_log(PM_LOG_ERROR, _("call to waitpid failed (%s)"),
_alpm_log(PM_LOG_ERROR, _("call to waitpid failed (%s)\n"),
strerror(errno));
retval = 1;
goto cleanup;
@ -620,7 +620,7 @@ int _alpm_runscriptlet(const char *root, const char *installfn,
cleanup:
if(strlen(tmpdir) && _alpm_rmrf(tmpdir)) {
_alpm_log(PM_LOG_WARNING, _("could not remove tmpdir %s"), tmpdir);
_alpm_log(PM_LOG_WARNING, _("could not remove tmpdir %s\n"), tmpdir);
}
if(strlen(cwd)) {
chdir(cwd);

View File

@ -201,7 +201,7 @@ int _alpm_makepath(const char *path)
if(mkdir(full, 0755)) {
FREE(orig);
umask(oldmask);
_alpm_log(PM_LOG_ERROR, _("failed to make path '%s' : %s"),
_alpm_log(PM_LOG_ERROR, _("failed to make path '%s' : %s\n"),
path, strerror(errno));
return(1);
}
@ -400,7 +400,8 @@ int _alpm_unpack(const char *archive, const char *prefix, const char *fn)
if(archive_read_open_filename(_archive, archive,
ARCHIVE_DEFAULT_BYTES_PER_BLOCK) != ARCHIVE_OK) {
_alpm_log(PM_LOG_ERROR, _("could not open %s: %s\n"), archive, archive_error_string(_archive));
_alpm_log(PM_LOG_ERROR, _("could not open %s: %s\n"), archive,
archive_error_string(_archive));
RET_ERR(PM_ERR_PKG_OPEN, -1);
}
@ -561,7 +562,7 @@ char *_alpm_filecache_find(const char* filename)
if(stat(path, &buf) == 0) {
/* TODO maybe check to make sure it is readable? */
retpath = strdup(path);
_alpm_log(PM_LOG_DEBUG, "found cached pkg: %s", retpath);
_alpm_log(PM_LOG_DEBUG, "found cached pkg: %s\n", retpath);
return(retpath);
}
}
@ -589,11 +590,11 @@ const char *_alpm_filecache_setup(void)
alpm_logaction("warning: no %s cache exists, creating...",
cachedir);
if(_alpm_makepath(cachedir) == 0) {
_alpm_log(PM_LOG_DEBUG, "using cachedir: %s", cachedir);
_alpm_log(PM_LOG_DEBUG, "using cachedir: %s\n", cachedir);
return(cachedir);
}
} else if(S_ISDIR(buf.st_mode) && (buf.st_mode & S_IWUSR)) {
_alpm_log(PM_LOG_DEBUG, "using cachedir: %s", cachedir);
_alpm_log(PM_LOG_DEBUG, "using cachedir: %s\n", cachedir);
return(cachedir);
}
}
@ -603,8 +604,8 @@ const char *_alpm_filecache_setup(void)
tmp = alpm_list_add(NULL, strdup("/tmp/"));
FREELIST(i);
alpm_option_set_cachedirs(tmp);
_alpm_log(PM_LOG_DEBUG, "using cachedir: %s", "/tmp/");
_alpm_log(PM_LOG_WARNING, _("couldn't create package cache, using /tmp instead"));
_alpm_log(PM_LOG_DEBUG, "using cachedir: %s", "/tmp/\n");
_alpm_log(PM_LOG_WARNING, _("couldn't create package cache, using /tmp instead\n"));
alpm_logaction("warning: couldn't create package cache, using /tmp instead");
return(alpm_list_getdata(tmp));
}
@ -645,7 +646,7 @@ char SYMEXPORT *alpm_get_md5sum(const char *filename)
}
md5sum[32] = '\0';
_alpm_log(PM_LOG_DEBUG, "md5(%s) = %s", filename, md5sum);
_alpm_log(PM_LOG_DEBUG, "md5(%s) = %s\n", filename, md5sum);
return(md5sum);
}

View File

@ -503,8 +503,6 @@ int pm_vfprintf(FILE *stream, pmloglevel_t level, const char *format, va_list ar
/* print the message using va_arg list */
ret = vfprintf(stream, format, args);
/* TEMP HACK because libalpm strings don't have \n */
fprintf(stream, "\n");
return(ret);
}