socsvn commit: r256022 - in soc2013/mattbw/backend: . actions query
mattbw at FreeBSD.org
mattbw at FreeBSD.org
Fri Aug 16 11:26:12 UTC 2013
Author: mattbw
Date: Fri Aug 16 11:26:11 2013
New Revision: 256022
URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=256022
Log:
Add more stub-work for GetDepends and GetRequires.
Both of these actions will eventually be serviced by the same function with
only the pkg_deps/pkg_rdeps function being passed in changing.
Next is to implement the simpler case of GetDepends/GetRequires without
recursion. I think this will likely need changes to the query system
to allow multiple PackageIDs in one query, or else multiple copies of the
same depends/requires might appear. That can be fixed later.
The main sticking point is that dependencies are not packages - they might
not exist at all in the repositories - so I'll need to write some new code
to deal with these (the current emission code is for packages specifically).
Added:
soc2013/mattbw/backend/query/depends.c
soc2013/mattbw/backend/query/depends.h
Modified:
soc2013/mattbw/backend/Makefile
soc2013/mattbw/backend/actions/get_depends.c
soc2013/mattbw/backend/actions/get_requires.c
soc2013/mattbw/backend/query.h
Modified: soc2013/mattbw/backend/Makefile
==============================================================================
--- soc2013/mattbw/backend/Makefile Fri Aug 16 10:53:36 2013 (r256021)
+++ soc2013/mattbw/backend/Makefile Fri Aug 16 11:26:11 2013 (r256022)
@@ -52,6 +52,7 @@
SRCS+= \
query/core.c \
+ query/depends.c \
query/do.c \
query/match.c
Modified: soc2013/mattbw/backend/actions/get_depends.c
==============================================================================
--- soc2013/mattbw/backend/actions/get_depends.c Fri Aug 16 10:53:36 2013 (r256021)
+++ soc2013/mattbw/backend/actions/get_depends.c Fri Aug 16 11:26:11 2013 (r256022)
@@ -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 <assert.h> /* assert */
#include <glib.h> /* gboolean */
#include <stdbool.h> /* bool */
@@ -52,12 +53,9 @@
emit(struct pkg *pkg, const gchar *id, struct query *q)
{
- bool success;
-
assert(pkg != NULL);
assert(id != NULL);
assert(q != NULL);
- success = false;
- return success;
+ return query_depends_emit(query_backend(q), pkg, pkg_deps);
}
Modified: soc2013/mattbw/backend/actions/get_requires.c
==============================================================================
--- soc2013/mattbw/backend/actions/get_requires.c Fri Aug 16 10:53:36 2013 (r256021)
+++ soc2013/mattbw/backend/actions/get_requires.c Fri Aug 16 11:26:11 2013 (r256022)
@@ -53,12 +53,9 @@
emit(struct pkg *pkg, const gchar *id, struct query *q)
{
- bool success;
-
assert(pkg != NULL);
assert(id != NULL);
assert(q != NULL);
- success = false;
- return success;
+ return query_depends_emit(query_backend(q), pkg, pkg_rdeps);
}
Modified: soc2013/mattbw/backend/query.h
==============================================================================
--- soc2013/mattbw/backend/query.h Fri Aug 16 10:53:36 2013 (r256021)
+++ soc2013/mattbw/backend/query.h Fri Aug 16 11:26:11 2013 (r256022)
@@ -25,5 +25,6 @@
#include "query/do.h" /* query_do_... */
#include "query/match.h" /* query_match_... */
+#include "query/depends.h" /* query_depends_... */
#endif /* !_PKGNG_BACKEND_QUERY_H_ */
Added: soc2013/mattbw/backend/query/depends.c
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ soc2013/mattbw/backend/query/depends.c Fri Aug 16 11:26:11 2013 (r256022)
@@ -0,0 +1,43 @@
+/*-
+ * Copyright (C) 2013 Matt Windsor <mattbw at FreeBSD.org>
+ *
+ * Licensed under the GNU General Public License Version 2
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#include <assert.h> /* assert */
+#include <stdbool.h> /* bool */
+#include "pkg.h" /* pkg... */
+#include "../pk-backend.h" /* PkBackend */
+
+#include "depends.h" /* query_depends_... */
+#include "../utils.h" /* ERR */
+
+bool
+query_depends_emit(PkBackend *backend, struct pkg *pkg, depends_get_ptr get)
+{
+ bool success;
+
+ assert(backend != NULL);
+ assert(pkg != NULL);
+ assert(get != NULL);
+
+ success = false;
+
+ ERR(backend, PK_ERROR_ENUM_NOT_SUPPORTED, "soon");
+
+ return success;
+}
Added: soc2013/mattbw/backend/query/depends.h
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ soc2013/mattbw/backend/query/depends.h Fri Aug 16 11:26:11 2013 (r256022)
@@ -0,0 +1,33 @@
+/*-
+ * Copyright (C) 2013 Matt Windsor <mattbw at FreeBSD.org>
+ *
+ * Licensed under the GNU General Public License Version 2
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+#ifndef _PKGNG_BACKEND_QUERY_DEPENDS_H_
+#define _PKGNG_BACKEND_QUERY_DEPENDS_H_
+
+#include <stdbool.h> /* bool */
+#include "pkg.h" /* pkg_... */
+#include "../pk-backend.h" /* Pk... */
+
+
+typedef int (*depends_get_ptr) (const struct pkg *pkg, struct pkg_dep **dep);
+
+bool query_depends_emit(PkBackend *backend, struct pkg *pkg, depends_get_ptr get);
+
+#endif /*_PKGNG_BACKEND_QUERY_DEPENDS_H_*/
+
More information about the svn-soc-all
mailing list