Git-Url: http://git.frugalware.org/gitweb/gitweb.cgi?p=pacman-g2.git;a=commitdiff;h=562139e237c3cf9cd47b1a15b0e3edb03dd499cc
commit 562139e237c3cf9cd47b1a15b0e3edb03dd499cc Author: Michel Hermier <[email protected]> Date: Wed May 14 21:38:01 2014 +0200 libpacman: Remove Package::origin and Package::data to introduce Package::path the string path to the archive file (on disk). diff --git a/lib/libpacman/cache.cpp b/lib/libpacman/cache.cpp index ae460e6..729f975 100644 --- a/lib/libpacman/cache.cpp +++ b/lib/libpacman/cache.cpp @@ -73,8 +73,6 @@ int _pacman_db_load_pkgcache(Database *db) db->rewind(); while((info = db->readpkg(inforeq)) != NULL) { - info->origin = PKG_FROM_CACHE; - info->data = db; /* add to the collective */ db->pkgcache = _pacman_list_add_sorted(db->pkgcache, info, _pacman_pkg_cmp); } diff --git a/lib/libpacman/package.cpp b/lib/libpacman/package.cpp index 9539294..18c6bca 100644 --- a/lib/libpacman/package.cpp +++ b/lib/libpacman/package.cpp @@ -81,9 +81,7 @@ Package::~Package() FREELIST(m_provides); FREELIST(m_replaces); FREELIST(triggers); - if(origin == PKG_FROM_FILE) { - FREE(data); - } + free(m_path); } Database *Package::database() const @@ -297,6 +295,11 @@ type Package::name() \ #undef LIBPACMAN_PACKAGE_PROPERTY +const char *Package::path() const +{ + return m_path; +} + FStringList *Package::provides() const { return m_provides; diff --git a/lib/libpacman/package.h b/lib/libpacman/package.h index 49ea2ed..332f2d1 100644 --- a/lib/libpacman/package.h +++ b/lib/libpacman/package.h @@ -109,6 +109,8 @@ public: bool set_filename(const char *filename, int witharch); static bool splitname(const char *target, char *name, char *version, int witharch); + const char *path() const; + FStringList *provides() const; bool provides(const char *pkgname); @@ -150,9 +152,7 @@ public: FStringList *m_conflicts; FStringList *m_provides; FStringList *triggers; - /* internal */ - unsigned char origin; - void *data; + char *m_path; }; } diff --git a/lib/libpacman/package/fpmpackage.cpp b/lib/libpacman/package/fpmpackage.cpp index c379665..7ef596a 100644 --- a/lib/libpacman/package/fpmpackage.cpp +++ b/lib/libpacman/package/fpmpackage.cpp @@ -242,8 +242,7 @@ Package *_pacman_fpmpackage_load(const char *pkgfile) } /* internal */ - info->origin = PKG_FROM_FILE; - info->data = strdup(pkgfile); + info->m_path = strdup(pkgfile); return(info); diff --git a/lib/libpacman/pacman.cpp b/lib/libpacman/pacman.cpp index 85319df..0c66d00 100644 --- a/lib/libpacman/pacman.cpp +++ b/lib/libpacman/pacman.cpp @@ -884,9 +884,7 @@ int pacman_pkg_free(pmpkg_t *_pkg) ASSERT(pkg != NULL, RET_ERR(PM_ERR_WRONG_ARGS, -1)); /* Only free packages loaded in user space */ - if(pkg->origin != PKG_FROM_CACHE) { - pkg->release(); - } + pkg->release(); return(0); } diff --git a/lib/libpacman/trans.cpp b/lib/libpacman/trans.cpp index 1604619..2e88f24 100644 --- a/lib/libpacman/trans.cpp +++ b/lib/libpacman/trans.cpp @@ -1377,7 +1377,7 @@ int _pacman_fpmpackage_install(Package *pkg, pmtranstype_t type, pmtrans_t *tran _pacman_log(PM_LOG_FLOW1, _("extracting files")); /* Extract the package */ - if((archive = _pacman_archive_read_open_all_file(pkg->data)) == NULL) { + if((archive = _pacman_archive_read_open_all_file(pkg->path())) == NULL) { RET_ERR(PM_ERR_PKG_OPEN, -1); } @@ -1969,7 +1969,7 @@ int __pmtrans_t::commit(pmlist_t **data) } if(pkg_new->scriptlet && !(flags & PM_TRANS_FLAG_NOSCRIPTLET)) { - _pacman_runscriptlet(handle->root, pkg_new->data, trans_event_table[type].pre.hook, pkg_new->version(), oldpkg ? oldpkg->version() : NULL, this); + _pacman_runscriptlet(handle->root, pkg_new->path(), trans_event_table[type].pre.hook, pkg_new->version(), oldpkg ? oldpkg->version() : NULL, this); } if(oldpkg) { _______________________________________________ Frugalware-git mailing list [email protected] http://frugalware.org/mailman/listinfo/frugalware-git
