From owner-svn-ports-head@FreeBSD.ORG Wed Jun 11 19:41:24 2014 Return-Path: Delivered-To: svn-ports-head@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 ESMTPS id 88C2DB6B; Wed, 11 Jun 2014 19:41:24 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 6A5832D8C; Wed, 11 Jun 2014 19:41:24 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.8/8.14.8) with ESMTP id s5BJfOPm060072; Wed, 11 Jun 2014 19:41:24 GMT (envelope-from bdrewery@svn.freebsd.org) Received: (from bdrewery@localhost) by svn.freebsd.org (8.14.8/8.14.8/Submit) id s5BJfOIH060069; Wed, 11 Jun 2014 19:41:24 GMT (envelope-from bdrewery@svn.freebsd.org) Message-Id: <201406111941.s5BJfOIH060069@svn.freebsd.org> From: Bryan Drewery Date: Wed, 11 Jun 2014 19:41:24 +0000 (UTC) To: ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org Subject: svn commit: r357529 - in head/ports-mgmt/pkg-devel: . files X-SVN-Group: ports-head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-ports-head@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: SVN commit messages for the ports tree for head List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 11 Jun 2014 19:41:24 -0000 Author: bdrewery Date: Wed Jun 11 19:41:23 2014 New Revision: 357529 URL: http://svnweb.freebsd.org/changeset/ports/357529 QAT: https://qat.redports.org/buildarchive/r357529/ Log: Fix loading of reverse dependencies Added: head/ports-mgmt/pkg-devel/files/patch-libpkg__pkgdb.c (contents, props changed) Modified: head/ports-mgmt/pkg-devel/Makefile Modified: head/ports-mgmt/pkg-devel/Makefile ============================================================================== --- head/ports-mgmt/pkg-devel/Makefile Wed Jun 11 19:32:48 2014 (r357528) +++ head/ports-mgmt/pkg-devel/Makefile Wed Jun 11 19:41:23 2014 (r357529) @@ -2,6 +2,7 @@ PORTNAME= pkg DISTVERSION= 1.3.0.b3 +PORTREVISION= 1 CATEGORIES= ports-mgmt MASTER_SITES= \ http://files.etoilebsd.net/pkg/ \ Added: head/ports-mgmt/pkg-devel/files/patch-libpkg__pkgdb.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/ports-mgmt/pkg-devel/files/patch-libpkg__pkgdb.c Wed Jun 11 19:41:23 2014 (r357529) @@ -0,0 +1,61 @@ +commit 4f3ce011ee1d0f00afc8d84ed9fd82cda9f02a08 +Author: Bryan Drewery +Date: Wed Jun 11 12:31:21 2014 -0500 + + Fix pkgdb_load_rdeps by reverting "Avoid deps full scan when loading dependencies." + + This reverts commit cf47e2c24af23c8f278d9c502fe2923a42f23d33. + + 1. deps should be joined on p.id=d.package_id rather than origin. + Otherwise no results are returned breaking pkg-query %r, pkg-autoremove, + etc. + 2. Restore uniqueid support [1] + + Discussed with: bapt [1] + + Fixes #833 + +diff --git libpkg/pkgdb.c libpkg/pkgdb.c +index e46ddeb..7e4500b 100644 +--- libpkg/pkgdb.c ++++ libpkg/pkgdb.c +@@ -1923,23 +1923,19 @@ pkgdb_load_rdeps(struct pkgdb *db, struct pkg *pkg) + { + sqlite3_stmt *stmt = NULL; + int ret; +- const char *origin; ++ const char *uniqueid; + const char *reponame = NULL; + char sql[BUFSIZ]; + const char *mainsql = "" + "SELECT p.name, p.origin, p.version, p.locked " +- "FROM main.deps AS d " +- "LEFT JOIN main.packages AS p ON p.origin = d.origin " ++ "FROM main.packages AS p, main.deps AS d " + "WHERE p.id = d.package_id " +- "AND p.name = d.name " +- "AND d.origin = ?1;"; ++ "AND d.name || '~' || d.origin = ?1;"; + const char *reposql = "" + "SELECT p.name, p.origin, p.version, 0 " +- "FROM %Q.deps AS d " +- "LEFT JOIN %Q.packages AS p ON p.origin = d.origin " ++ "FROM %Q.packages AS p, %Q.deps AS d " + "WHERE p.id = d.package_id " +- "AND p.name = d.name " +- "AND d.origin = ?1;"; ++ "AND d.name || '~' || d.origin = ?1;"; + + assert(db != NULL && pkg != NULL); + +@@ -1962,8 +1958,8 @@ pkgdb_load_rdeps(struct pkgdb *db, struct pkg *pkg) + return (EPKG_FATAL); + } + +- pkg_get(pkg, PKG_ORIGIN, &origin); +- sqlite3_bind_text(stmt, 1, origin, -1, SQLITE_STATIC); ++ pkg_get(pkg, PKG_UNIQUEID, &uniqueid); ++ sqlite3_bind_text(stmt, 1, uniqueid, -1, SQLITE_STATIC); + + while ((ret = sqlite3_step(stmt)) == SQLITE_ROW) { + pkg_addrdep(pkg, sqlite3_column_text(stmt, 0),