Esempio n. 1
0
/**
 * hif_package_get_release:
 * @pkg: a #HifPackage instance.
 *
 * Gets the release for the package.
 *
 * Returns: (transfer full): a string, or %NULL
 *
 * Since: 0.7.0
 */
char *
hif_package_get_release(HifPackage *pkg)
{
    char *e, *v, *r;
    pool_split_evr(hif_package_get_pool(pkg), hif_package_get_evr(pkg), &e, &v, &r);
    return g_strdup(r);
}
Esempio n. 2
0
/**
 * hif_package_get_package_id:
 * @pkg: a #HifPackage *instance.
 *
 * Gets the package-id as used by PackageKit.
 *
 * Returns: the package_id string, or %NULL, e.g. "hal;2:0.3.4;i386;installed:fedora"
 *
 * Since: 0.1.0
 **/
const gchar *
hif_package_get_package_id(HifPackage *pkg)
{
    HifPackagePrivate *priv;
    const gchar *reponame;
    g_autofree gchar *reponame_tmp = NULL;

    priv = hif_package_get_priv(pkg);
    if (priv == NULL)
        return NULL;
    if (priv->package_id != NULL)
        goto out;

    /* calculate and cache */
    reponame = hif_package_get_reponame(pkg);
    if (g_strcmp0(reponame, HY_SYSTEM_REPO_NAME) == 0) {
        /* origin data to munge into the package_id data field */
        if (priv->origin != NULL) {
            reponame_tmp = g_strdup_printf("installed:%s", priv->origin);
            reponame = reponame_tmp;
        } else {
            reponame = "installed";
        }
    } else if (g_strcmp0(reponame, HY_CMDLINE_REPO_NAME) == 0) {
        reponame = "local";
    }
    priv->package_id = hif_package_id_build(hif_package_get_name(pkg),
                        hif_package_get_evr(pkg),
                        hif_package_get_arch(pkg),
                        reponame);
out:
    return priv->package_id;
}
Esempio n. 3
0
/**
 * hif_package_get_epoch:
 * @pkg: a #HifPackage instance.
 *
 * Gets the epoch for the package.
 *
 * Returns: %TRUE for success
 *
 * Since: 0.7.0
 */
guint64
hif_package_get_epoch(HifPackage *pkg)
{
    return pool_get_epoch(hif_package_get_pool(pkg), hif_package_get_evr(pkg));
}