From owner-svn-soc-all@FreeBSD.ORG Fri Aug 16 11:26:12 2013 Return-Path: Delivered-To: svn-soc-all@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id 067CE998 for ; Fri, 16 Aug 2013 11:26:12 +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 E61E72089 for ; Fri, 16 Aug 2013 11:26:11 +0000 (UTC) Received: from socsvn.freebsd.org ([127.0.1.124]) by socsvn.freebsd.org (8.14.7/8.14.7) with ESMTP id r7GBQBrK011571 for ; Fri, 16 Aug 2013 11:26:11 GMT (envelope-from mattbw@FreeBSD.org) Received: (from www@localhost) by socsvn.freebsd.org (8.14.7/8.14.6/Submit) id r7GBQBS9011554 for svn-soc-all@FreeBSD.org; Fri, 16 Aug 2013 11:26:11 GMT (envelope-from mattbw@FreeBSD.org) Date: Fri, 16 Aug 2013 11:26:11 GMT Message-Id: <201308161126.r7GBQBS9011554@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: r256022 - in soc2013/mattbw/backend: . actions 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: Fri, 16 Aug 2013 11:26:12 -0000 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 */ #include /* gboolean */ #include /* 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 + * + * 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 */ +#include /* 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 + * + * 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 /* 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_*/ +