END_TEST START_TEST(test_versions) { HySack sack = test_globals.sack; unsigned epoch; char *version, *release; HyPackage pkg; pkg = by_name(sack, "baby"); ck_assert_str_eq(hy_package_get_evr(pkg), "6:5.0-11"); epoch = hy_package_get_epoch(pkg); fail_unless(epoch == 6); version = hy_package_get_version(pkg); ck_assert_str_eq(version, "5.0"); hy_free(version); release = hy_package_get_release(pkg); ck_assert_str_eq(release, "11"); hy_free(release); hy_package_free(pkg); pkg = by_name(sack, "jay"); // epoch missing if it's 0: ck_assert_str_eq(hy_package_get_evr(pkg), "5.0-0"); epoch = hy_package_get_epoch(pkg); fail_unless(epoch == 0); version = hy_package_get_version(pkg); ck_assert_str_eq(version, "5.0"); hy_free(version); release = hy_package_get_release(pkg); ck_assert_str_eq(release, "0"); hy_free(release); hy_package_free(pkg); }
/** * hif_db_get_dir_for_package: **/ static gchar * hif_db_get_dir_for_package (HyPackage package) { const gchar *pkgid; gchar *dir = NULL; pkgid = hif_package_get_pkgid (package); if (pkgid == NULL) goto out; dir = g_strdup_printf ("/var/lib/yum/yumdb/%c/%s-%s-%s-%s-%s", hy_package_get_name (package)[0], pkgid, hy_package_get_name (package), hy_package_get_version (package), hy_package_get_release (package), hy_package_get_arch (package)); out: return dir; }