socsvn commit: r256840 - in soc2013/mattbw/backend: . query

mattbw at FreeBSD.org mattbw at FreeBSD.org
Mon Sep 2 18:40:53 UTC 2013


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) {


More information about the svn-soc-all mailing list