From owner-svn-soc-all@FreeBSD.ORG Mon Sep 2 18:40:53 2013 Return-Path: Delivered-To: svn-soc-all@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id 95E9E9AC for ; Mon, 2 Sep 2013 18:40:53 +0000 (UTC) (envelope-from mattbw@FreeBSD.org) Received: from socsvn.freebsd.org (socsvn.freebsd.org [IPv6:2001:1900:2254:206a::50:2]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 8195C29A0 for ; Mon, 2 Sep 2013 18:40:53 +0000 (UTC) Received: from socsvn.freebsd.org ([127.0.1.124]) by socsvn.freebsd.org (8.14.7/8.14.7) with ESMTP id r82IercE024020 for ; Mon, 2 Sep 2013 18:40:53 GMT (envelope-from mattbw@FreeBSD.org) Received: (from www@localhost) by socsvn.freebsd.org (8.14.7/8.14.6/Submit) id r82IerkZ023988 for svn-soc-all@FreeBSD.org; Mon, 2 Sep 2013 18:40:53 GMT (envelope-from mattbw@FreeBSD.org) Date: Mon, 2 Sep 2013 18:40:53 GMT Message-Id: <201309021840.r82IerkZ023988@socsvn.freebsd.org> X-Authentication-Warning: socsvn.freebsd.org: www set sender to mattbw@FreeBSD.org using -f From: mattbw@FreeBSD.org To: svn-soc-all@FreeBSD.org Subject: socsvn commit: r256840 - in soc2013/mattbw/backend: . query MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 02 Sep 2013 18:40:53 -0000 Author: mattbw Date: Mon Sep 2 18:40:53 2013 New Revision: 256840 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=256840 Log: Fix broken installed packages resolution. I was using the pkgng package repo, as opposed to the PackageKit version, which is different when the package is local or installed. The corresponding unit test in query/check.c now passes. Modified: soc2013/mattbw/backend/Makefile soc2013/mattbw/backend/pkgutils.c soc2013/mattbw/backend/pkgutils.h soc2013/mattbw/backend/query/check.c Modified: soc2013/mattbw/backend/Makefile ============================================================================== --- soc2013/mattbw/backend/Makefile Mon Sep 2 17:07:46 2013 (r256839) +++ soc2013/mattbw/backend/Makefile Mon Sep 2 18:40:53 2013 (r256840) @@ -107,7 +107,7 @@ query/id_test.o: query/id_test.c ${CC} ${CFLAGS} ${TESTCFLAGS} -o ${.TARGET} -c ${.ALLSRC} -query/check_test: query/check_test.o query/check.o query/id.o query/packages.o query/find.o namever.o testutils.o +query/check_test: query/check_test.o query/check.o query/id.o query/packages.o query/find.o namever.o testutils.o pkgutils.o ${CC} ${LDFLAGS} ${TESTLDFLAGS} -o ${.TARGET} ${.ALLSRC} ${LIBS} ${TESTLIBS} query/check_test.o: query/check_test.c Modified: soc2013/mattbw/backend/pkgutils.c ============================================================================== --- soc2013/mattbw/backend/pkgutils.c Mon Sep 2 17:07:46 2013 (r256839) +++ soc2013/mattbw/backend/pkgutils.c Mon Sep 2 18:40:53 2013 (r256840) @@ -28,7 +28,7 @@ #include "pkgutils.h" /* Prototypes */ #include "utils.h" /* INTENTIONALLY_IGNORE */ -static const char *repo_of_package(struct pkg *pkg); + static const char *repo_of_remote_package(struct pkg *pkg); /* @@ -129,7 +129,7 @@ pkg_get(pkg, PKG_NAME, &name, PKG_VERSION, &version, PKG_ARCH, &arch); - repo = repo_of_package(pkg); + repo = pkgutils_pkg_to_pk_repo(pkg); return pk_package_id_build(name, version, arch, repo); } @@ -198,8 +198,8 @@ /* * Gets the PackageKit repository name for the package. */ -static const char * -repo_of_package(struct pkg *pkg) +const char * +pkgutils_pkg_to_pk_repo(struct pkg *pkg) { const char *repo; Modified: soc2013/mattbw/backend/pkgutils.h ============================================================================== --- soc2013/mattbw/backend/pkgutils.h Mon Sep 2 17:07:46 2013 (r256839) +++ soc2013/mattbw/backend/pkgutils.h Mon Sep 2 18:40:53 2013 (r256840) @@ -30,6 +30,7 @@ PkInfoEnum pkgutils_pkg_remove_state(struct pkg *pkg); bool pkgutils_pkg_matches_filters(struct pkg *pkg, PkBitfield filters); gchar *pkgutils_pkg_to_id(struct pkg *pkg); +const char *pkgutils_pkg_to_pk_repo(struct pkg *pkg); void pkgutils_add_old_version(struct pkgdb *db, struct pkg *pkg, struct pkg **old_p); #endif /* !_PKGNG_BACKEND_PKGUTILS_H_ */ Modified: soc2013/mattbw/backend/query/check.c ============================================================================== --- soc2013/mattbw/backend/query/check.c Mon Sep 2 17:07:46 2013 (r256839) +++ soc2013/mattbw/backend/query/check.c Mon Sep 2 18:40:53 2013 (r256840) @@ -24,6 +24,7 @@ #include "pkg.h" /* struct pkg... */ #include "../namever.h" /* namever_... */ +#include "../pkgutils.h" /* pkgutils_... */ #include "../utils.h" /* type_of_repo_name, enum repo_type */ #include "check.h" /* query_check... */ #include "find.h" /* query_find_... */ @@ -48,12 +49,9 @@ assert(query_id != NULL); assert(query_id->namever != NULL); - namever = namever_from_package(package); - (void)pkg_get(package, - PKG_ARCH, &arch, - PKG_NAME, &name, - PKG_REPONAME, &repo); + repo = pkgutils_pkg_to_pk_repo(package); + (void)pkg_get(package, PKG_ARCH, &arch, PKG_NAME, &name); /* Be cautious and reject matches if the package fields aren't here. */ if (namever == NULL || arch == NULL || repo == NULL) {