Пример #1
0
END_TEST

START_TEST(test_chksum_fail)
{
    HySack sack = test_globals.sack;
    HyPackage pkg = by_name(sack, "walrus");
    int type;

    const unsigned char *chksum = hy_package_get_chksum(pkg, &type);
    fail_unless(chksum == NULL);
    chksum = hy_package_get_hdr_chksum(pkg, &type);
    fail_unless(chksum == NULL);
    hy_package_free(pkg);
}
Пример #2
0
Файл: hth.c Проект: Tojaj/hawkey
static void execute_print(HySack sack, HyQuery q, int show_obsoletes)
{
    HyPackageList plist;

    plist = hy_query_run(q);
    const int count = hy_packagelist_count(plist);
    for (int i = 0; i < count; ++i) {
	HyPackage pkg = hy_packagelist_get(plist, i);
	char *nvra = hy_package_get_nevra(pkg);
	const char *reponame = hy_package_get_reponame(pkg);

	printf("found package: %s [%s]\n", nvra, reponame);
	if (strcmp(reponame, HY_SYSTEM_REPO_NAME) == 0) {
	    int type;
	    const unsigned char * hdrid = hy_package_get_hdr_chksum(pkg, &type);
	    char *str = hy_chksum_str(hdrid, type);

	    printf("\tsha1 header id: %s\n", str);
	    hy_free(str);
	}
	if (show_obsoletes) {
	    HyReldepList obsoletes = hy_package_get_obsoletes(pkg);
	    HyQuery qobs = hy_query_create(sack);

	    hy_query_filter(qobs, HY_PKG_REPONAME, HY_NEQ, HY_SYSTEM_REPO_NAME);
	    hy_query_filter_reldep_in(qobs, HY_PKG_PROVIDES, obsoletes);
	    HyPackageList olist = hy_query_run(qobs);
	    const int ocount = hy_packagelist_count(olist);
	    for (int j = 0; j < ocount; ++j) {
		HyPackage opkg = hy_packagelist_get(olist, j);
		char *onvra = hy_package_get_nevra(opkg);
		printf("obsoleting: %s\n", onvra);
		hy_free(onvra);
	    }
	    hy_packagelist_free(olist);
	    hy_query_free(qobs);
	    hy_reldeplist_free(obsoletes);
	}
	hy_free(nvra);
    }
    hy_packagelist_free(plist);
}