From owner-svn-soc-all@FreeBSD.ORG Sat Aug 31 10:31:39 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 B8FBBFEE for ; Sat, 31 Aug 2013 10:31:39 +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 983352857 for ; Sat, 31 Aug 2013 10:31:39 +0000 (UTC) Received: from socsvn.freebsd.org ([127.0.1.124]) by socsvn.freebsd.org (8.14.7/8.14.7) with ESMTP id r7VAVdN7049851 for ; Sat, 31 Aug 2013 10:31:39 GMT (envelope-from mattbw@FreeBSD.org) Received: (from www@localhost) by socsvn.freebsd.org (8.14.7/8.14.6/Submit) id r7VAVdOx049848 for svn-soc-all@FreeBSD.org; Sat, 31 Aug 2013 10:31:39 GMT (envelope-from mattbw@FreeBSD.org) Date: Sat, 31 Aug 2013 10:31:39 GMT Message-Id: <201308311031.r7VAVdOx049848@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: r256768 - 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: Sat, 31 Aug 2013 10:31:39 -0000 Author: mattbw Date: Sat Aug 31 10:31:39 2013 New Revision: 256768 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=256768 Log: Use pkgutils_pk_repo_of when making a PackageID from a package. This means that installed and local-file packages will have a repo of "installed" and "local" respectively. This function now returns remote repo NAMES (repo-XYZ) instead of idents (XYZ). This change is mainly for simplicity. Modified: soc2013/mattbw/backend/pkgutils.c soc2013/mattbw/backend/query/check_test.c Modified: soc2013/mattbw/backend/pkgutils.c ============================================================================== --- soc2013/mattbw/backend/pkgutils.c Sat Aug 31 09:40:01 2013 (r256767) +++ soc2013/mattbw/backend/pkgutils.c Sat Aug 31 10:31:39 2013 (r256768) @@ -165,18 +165,21 @@ gchar * pkgutils_pkg_to_id(struct pkg *pkg) { - gchar *strv[4]; + const char *name; + const char *version; + const char *arch; + const char *repo; + + assert(pkg != NULL); pkg_get(pkg, - PKG_NAME, strv + PK_PACKAGE_ID_NAME, - PKG_VERSION, strv + PK_PACKAGE_ID_VERSION, - PKG_ARCH, strv + PK_PACKAGE_ID_ARCH, - PKG_REPONAME, strv + PK_PACKAGE_ID_DATA); - - return pk_package_id_build(strv[PK_PACKAGE_ID_NAME], - strv[PK_PACKAGE_ID_VERSION], - strv[PK_PACKAGE_ID_ARCH], - strv[PK_PACKAGE_ID_DATA]); + PKG_NAME, &name, + PKG_VERSION, &version, + PKG_ARCH, &arch); + + repo = pkgutils_pk_repo_of(pkg); + + return pk_package_id_build(name, version, arch, repo); } /* @@ -243,34 +246,20 @@ /* * Gets the PackageKit repository name for the (remote) package. * - * Currently this is actually the pkgng repository ident. This might change. + * Currently this is the pkgng repository name (not the ident as was previously + * the case). * * This does not need to be freed (possibly, TODO: check). */ static const char * repo_of_remote(struct pkg *pkg) { - const char *repo; const char *repo_name; - struct pkg_repo *repo_struct; assert(pkg != NULL); assert(pkg_type(pkg) == PKG_REMOTE); - repo = repo_name = NULL; - repo_struct = NULL; - - /* - * We can get the repo NAME directly, but we need the repo IDENT. - * Short of chopping bits of the string off in the assumption that - * the name is repo-IDENT, we'll have to grab it from the repo - * structure itself. - */ + repo_name = NULL; pkg_get(pkg, PKG_REPONAME, &repo_name); - - repo_struct = pkg_repo_find_name(repo_name); - if (repo_struct) - repo = pkg_repo_ident(repo_struct); - - return repo; + return repo_name; } Modified: soc2013/mattbw/backend/query/check_test.c ============================================================================== --- soc2013/mattbw/backend/query/check_test.c Sat Aug 31 09:40:01 2013 (r256767) +++ soc2013/mattbw/backend/query/check_test.c Sat Aug 31 10:31:39 2013 (r256768) @@ -17,6 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + #include #include /* free */ #include /* strcmp */