mirror of
https://github.com/moparisthebest/pacman
synced 2025-02-28 09:21:53 -05:00
Allow access to package origin data
Add new alpm_pkg_get_origin() method, use it in the front end now that the enum constants are publicly available. Signed-off-by: Dan McGee <dan@archlinux.org>
This commit is contained in:
parent
3a458783a2
commit
040083b97f
2
README
2
README
@ -429,7 +429,7 @@ API CHANGES BETWEEN 3.5 AND 4.0
|
||||
alpm_option_get_default_siglevel(), alpm_option_set_default_siglevel(),
|
||||
alpm_option_get_gpgdir(), alpm_option_set_gpgdir(), alpm_db_get_siglevel(),
|
||||
alpm_sigresult_cleanup(), alpm_db_check_pgp_signature(), alpm_pkg_check_pgp_signature(),
|
||||
alpm_pkg_get_sha256sum(), alpm_pkg_get_base64_sig()
|
||||
alpm_pkg_get_origin(), alpm_pkg_get_sha256sum(), alpm_pkg_get_base64_sig()
|
||||
- list functions:
|
||||
alpm_list_to_array(), alpm_list_previous()
|
||||
- structs:
|
||||
|
@ -598,6 +598,11 @@ const char *alpm_pkg_get_name(alpm_pkg_t *pkg);
|
||||
*/
|
||||
const char *alpm_pkg_get_version(alpm_pkg_t *pkg);
|
||||
|
||||
/** Returns the origin of the package.
|
||||
* @return a #alpm_pkgfrom_t constant, -1 on error
|
||||
*/
|
||||
alpm_pkgfrom_t alpm_pkg_get_origin(alpm_pkg_t *pkg);
|
||||
|
||||
/** Returns the package description.
|
||||
* @param pkg a pointer to package
|
||||
* @return a reference to an internal string
|
||||
|
@ -185,6 +185,13 @@ const char SYMEXPORT *alpm_pkg_get_version(alpm_pkg_t *pkg)
|
||||
return pkg->version;
|
||||
}
|
||||
|
||||
alpm_pkgfrom_t SYMEXPORT alpm_pkg_get_origin(alpm_pkg_t *pkg)
|
||||
{
|
||||
ASSERT(pkg != NULL, return -1);
|
||||
pkg->handle->pm_errno = 0;
|
||||
return pkg->origin;
|
||||
}
|
||||
|
||||
const char SYMEXPORT *alpm_pkg_get_desc(alpm_pkg_t *pkg)
|
||||
{
|
||||
ASSERT(pkg != NULL, return NULL);
|
||||
|
@ -61,7 +61,7 @@ static void deplist_display(const char *title,
|
||||
* @param from the type of package we are dealing with
|
||||
* @param extra should we show extra information
|
||||
*/
|
||||
void dump_pkg_full(alpm_pkg_t *pkg, alpm_pkgfrom_t from, int extra)
|
||||
void dump_pkg_full(alpm_pkg_t *pkg, int extra)
|
||||
{
|
||||
const char *reason;
|
||||
time_t bdate, idate;
|
||||
@ -69,10 +69,9 @@ void dump_pkg_full(alpm_pkg_t *pkg, alpm_pkgfrom_t from, int extra)
|
||||
const char *label;
|
||||
double size;
|
||||
alpm_list_t *requiredby = NULL;
|
||||
alpm_pkgfrom_t from;
|
||||
|
||||
if(pkg == NULL) {
|
||||
return;
|
||||
}
|
||||
from = alpm_pkg_get_origin(pkg);
|
||||
|
||||
/* set variables here, do all output below */
|
||||
bdate = alpm_pkg_get_builddate(pkg);
|
||||
|
@ -22,7 +22,7 @@
|
||||
|
||||
#include <alpm.h>
|
||||
|
||||
void dump_pkg_full(alpm_pkg_t *pkg, alpm_pkgfrom_t from, int extra);
|
||||
void dump_pkg_full(alpm_pkg_t *pkg, int extra);
|
||||
|
||||
void dump_pkg_backups(alpm_pkg_t *pkg);
|
||||
void dump_pkg_files(alpm_pkg_t *pkg, int quiet);
|
||||
|
@ -460,9 +460,9 @@ static int display(alpm_pkg_t *pkg)
|
||||
|
||||
if(config->op_q_info) {
|
||||
if(config->op_q_isfile) {
|
||||
dump_pkg_full(pkg, PKG_FROM_FILE, 0);
|
||||
dump_pkg_full(pkg, 0);
|
||||
} else {
|
||||
dump_pkg_full(pkg, PKG_FROM_LOCALDB, config->op_q_info > 1);
|
||||
dump_pkg_full(pkg, config->op_q_info > 1);
|
||||
}
|
||||
}
|
||||
if(config->op_q_list) {
|
||||
|
@ -469,7 +469,7 @@ static int sync_info(alpm_list_t *syncs, alpm_list_t *targets)
|
||||
alpm_pkg_t *pkg = alpm_list_getdata(k);
|
||||
|
||||
if(strcmp(alpm_pkg_get_name(pkg), pkgstr) == 0) {
|
||||
dump_pkg_full(pkg, PKG_FROM_SYNCDB, config->op_s_info > 1);
|
||||
dump_pkg_full(pkg, config->op_s_info > 1);
|
||||
foundpkg = 1;
|
||||
break;
|
||||
}
|
||||
@ -494,7 +494,7 @@ static int sync_info(alpm_list_t *syncs, alpm_list_t *targets)
|
||||
|
||||
for(j = alpm_db_get_pkgcache(db); j; j = alpm_list_next(j)) {
|
||||
alpm_pkg_t *pkg = alpm_list_getdata(j);
|
||||
dump_pkg_full(pkg, PKG_FROM_SYNCDB, config->op_s_info > 1);
|
||||
dump_pkg_full(pkg, config->op_s_info > 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user