pkg

Check-in [b295691032]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment: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
Timelines: family | ancestors | descendants | both | trunk | gsoc2013
Files: files | file ages | folders
SHA1: b2956910322f439a943f22acd850dc7014417c38
User & Date: bryan@shatow.net 2014-06-11 17:33:00
Context
2014-06-11
17:40
pkgdb_load_rdeps: Switch to a JOIN syntax check-in: ed7cf1ccb1 user: bryan@shatow.net tags: trunk, gsoc2013
17:33
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 check-in: b295691032 user: bryan@shatow.net tags: trunk, gsoc2013
16:50
Pkg cache: Fix symlinks not being updated. Do this atomically with rename(2). check-in: 5aa88d42b2 user: bryan@shatow.net tags: trunk, gsoc2013
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to libpkg/pkgdb.c.

1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
....
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
}

int
pkgdb_load_rdeps(struct pkgdb *db, struct pkg *pkg)
{
	sqlite3_stmt	*stmt = NULL;
	int		 ret;
	const char	*origin;
	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 "
		"WHERE p.id = d.package_id "
		"AND p.name = d.name "
		"AND 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 "
		"WHERE p.id = d.package_id "
		"AND p.name = d.name "
		"AND d.origin = ?1;";

	assert(db != NULL && pkg != NULL);

	if (pkg->flags & PKG_LOAD_RDEPS)
		return (EPKG_OK);

	if (pkg->type == PKG_REMOTE) {
................................................................................
	}

	if (ret != SQLITE_OK) {
		ERROR_SQLITE(db->sqlite, mainsql);
		return (EPKG_FATAL);
	}

	pkg_get(pkg, PKG_ORIGIN, &origin);
	sqlite3_bind_text(stmt, 1, origin, -1, SQLITE_STATIC);

	while ((ret = sqlite3_step(stmt)) == SQLITE_ROW) {
		pkg_addrdep(pkg, sqlite3_column_text(stmt, 0),
			    sqlite3_column_text(stmt, 1),
			    sqlite3_column_text(stmt, 2),
			    sqlite3_column_int(stmt, 3));
	}







|




<
|

<
|


|
<

<
|







 







|
|







1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930

1931
1932

1933
1934
1935
1936

1937

1938
1939
1940
1941
1942
1943
1944
1945
....
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
}

int
pkgdb_load_rdeps(struct pkgdb *db, struct pkg *pkg)
{
	sqlite3_stmt	*stmt = NULL;
	int		 ret;
	const char	*uniqueid;
	const char	*reponame = NULL;
	char		 sql[BUFSIZ];
	const char	*mainsql = ""
		"SELECT p.name, p.origin, p.version, p.locked "

		"FROM main.packages AS p, main.deps AS d "
		"WHERE p.id = d.package_id "

			"AND d.name || '~' || d.origin = ?1;";
	const char	*reposql = ""
		"SELECT p.name, p.origin, p.version, 0 "
		"FROM %Q.packages AS p, %Q.deps AS d "

		"WHERE p.id = d.package_id "

			"AND d.name || '~' || d.origin = ?1;";

	assert(db != NULL && pkg != NULL);

	if (pkg->flags & PKG_LOAD_RDEPS)
		return (EPKG_OK);

	if (pkg->type == PKG_REMOTE) {
................................................................................
	}

	if (ret != SQLITE_OK) {
		ERROR_SQLITE(db->sqlite, mainsql);
		return (EPKG_FATAL);
	}

	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),
			    sqlite3_column_text(stmt, 1),
			    sqlite3_column_text(stmt, 2),
			    sqlite3_column_int(stmt, 3));
	}