index : pacman | |
Archlinux32 fork of pacman | gitolite user |
summaryrefslogtreecommitdiff |
-rw-r--r-- | lib/libalpm/add.c | 11 | ||||
-rw-r--r-- | lib/libalpm/alpm.h | 7 | ||||
-rw-r--r-- | lib/libalpm/package.c | 9 | ||||
-rw-r--r-- | lib/libalpm/sync.c | 47 |
diff --git a/lib/libalpm/add.c b/lib/libalpm/add.c index eef7aab1..3c832b3e 100644 --- a/lib/libalpm/add.c +++ b/lib/libalpm/add.c @@ -650,17 +650,18 @@ static int commit_single_pkg(pmpkg_t *newpkg, int pkg_current, int pkg_count, if(local) { is_upgrade = 1; - EVENT(trans, PM_TRANS_EVT_UPGRADE_START, newpkg, NULL); - _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 */ oldpkg = _alpm_pkg_dup(local); /* make sure all infos are loaded because the database entry * will be removed soon */ _alpm_db_read(oldpkg->origin_data.db, oldpkg, INFRQ_ALL); + + EVENT(trans, PM_TRANS_EVT_UPGRADE_START, newpkg, oldpkg); + _alpm_log(PM_LOG_DEBUG, "upgrading package %s-%s\n", + newpkg->name, newpkg->version); + /* copy over the install reason */ - newpkg->reason = alpm_pkg_get_reason(local); + newpkg->reason = alpm_pkg_get_reason(oldpkg); /* pre_upgrade scriptlet */ if(alpm_pkg_has_scriptlet(newpkg) && !(trans->flags & PM_TRANS_FLAG_NOSCRIPTLET)) { diff --git a/lib/libalpm/alpm.h b/lib/libalpm/alpm.h index 16b48a0a..cdceaf01 100644 --- a/lib/libalpm/alpm.h +++ b/lib/libalpm/alpm.h @@ -218,6 +218,7 @@ alpm_list_t *alpm_pkg_get_deltas(pmpkg_t *pkg); alpm_list_t *alpm_pkg_get_replaces(pmpkg_t *pkg); alpm_list_t *alpm_pkg_get_files(pmpkg_t *pkg); alpm_list_t *alpm_pkg_get_backup(pmpkg_t *pkg); +pmdb_t *alpm_pkg_get_db(pmpkg_t *pkg); void *alpm_pkg_changelog_open(pmpkg_t *pkg); size_t alpm_pkg_changelog_read(void *ptr, size_t size, const pmpkg_t *pkg, const void *fp); @@ -282,7 +283,7 @@ typedef enum _pmtransflag_t { PM_TRANS_FLAG_DOWNLOADONLY = 0x200, PM_TRANS_FLAG_NOSCRIPTLET = 0x400, PM_TRANS_FLAG_NOCONFLICTS = 0x800, - PM_TRANS_FLAG_PRINTURIS = 0x1000, + /* 0x1000 flag can go here */ PM_TRANS_FLAG_NEEDED = 0x2000, PM_TRANS_FLAG_ALLEXPLICIT = 0x4000, PM_TRANS_FLAG_UNNEEDED = 0x8000, @@ -364,10 +365,6 @@ typedef enum _pmtransevt_t { * A line of text is passed to the callback. */ PM_TRANS_EVT_SCRIPTLET_INFO, - /** Print URI. - * The database's URI and the package's filename are passed to the callback. - */ - PM_TRANS_EVT_PRINTURI, /** Files will be downloaded from a repository. * The repository's tree name is passed to the callback. */ diff --git a/lib/libalpm/package.c b/lib/libalpm/package.c index eaef688d..13020041 100644 --- a/lib/libalpm/package.c +++ b/lib/libalpm/package.c @@ -423,6 +423,15 @@ alpm_list_t SYMEXPORT *alpm_pkg_get_backup(pmpkg_t *pkg) return pkg->backup; } +pmdb_t SYMEXPORT *alpm_pkg_get_db(pmpkg_t *pkg) +{ + /* Sanity checks */ + ASSERT(pkg != NULL, return(NULL)); + ASSERT(pkg->origin == PKG_FROM_CACHE, return(NULL)); + + return(pkg->origin_data.db); +} + /** * Open a package changelog for reading. Similar to fopen in functionality, * except that the returned 'file stream' could really be from an archive diff --git a/lib/libalpm/sync.c b/lib/libalpm/sync.c index 4a705b57..22b391bc 100644 --- a/lib/libalpm/sync.c +++ b/lib/libalpm/sync.c @@ -497,8 +497,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); } - /* We don't care about conflicts if we're just printing uris */ - if(!(trans->flags & (PM_TRANS_FLAG_NOCONFLICTS | PM_TRANS_FLAG_PRINTURIS))) { + if(!(trans->flags & PM_TRANS_FLAG_NOCONFLICTS)) { /* check for inter-conflicts and whatnot */ EVENT(trans, PM_TRANS_EVT_INTERCONFLICTS_START, NULL, NULL); @@ -838,32 +837,27 @@ int _alpm_sync_commit(pmtrans_t *trans, pmdb_t *db_local, alpm_list_t **data) fname = alpm_pkg_get_filename(spkg); ASSERT(fname != NULL, RET_ERR(PM_ERR_PKG_INVALID_NAME, -1)); - if(trans->flags & PM_TRANS_FLAG_PRINTURIS) { - EVENT(trans, PM_TRANS_EVT_PRINTURI, (char *)alpm_db_get_url(current), - (char *)fname); - } else { - if(spkg->download_size != 0) { - alpm_list_t *delta_path = spkg->delta_path; - if(delta_path) { - alpm_list_t *dlts = NULL; - - for(dlts = delta_path; dlts; dlts = dlts->next) { - pmdelta_t *d = dlts->data; - - if(d->download_size != 0) { - /* add the delta filename to the download list if - * it's not in the cache */ - files = alpm_list_add(files, strdup(d->delta)); - } - - /* keep a list of the delta files for md5sums */ - deltas = alpm_list_add(deltas, d); + if(spkg->download_size != 0) { + alpm_list_t *delta_path = spkg->delta_path; + if(delta_path) { + alpm_list_t *dlts = NULL; + + for(dlts = delta_path; dlts; dlts = dlts->next) { + pmdelta_t *d = dlts->data; + + if(d->download_size != 0) { + /* add the delta filename to the download list if + * it's not in the cache */ + files = alpm_list_add(files, strdup(d->delta)); } - } else { - /* not using deltas, so add the file to the download list */ - files = alpm_list_add(files, strdup(fname)); + /* keep a list of the delta files for md5sums */ + deltas = alpm_list_add(deltas, d); } + + } else { + /* not using deltas, so add the file to the download list */ + files = alpm_list_add(files, strdup(fname)); } } } @@ -880,9 +874,6 @@ int _alpm_sync_commit(pmtrans_t *trans, pmdb_t *db_local, alpm_list_t **data) FREELIST(files); } } - if(trans->flags & PM_TRANS_FLAG_PRINTURIS) { - return(0); - } /* clear out value to let callback know we are done */ if(handle->totaldlcb) { |