socsvn commit: r253780 - in soc2013/mattbw/backend: . actions
mattbw at FreeBSD.org
mattbw at FreeBSD.org
Mon Jul 1 08:49:16 UTC 2013
Author: mattbw
Date: Mon Jul 1 08:49:15 2013
New Revision: 253780
URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=253780
Log:
(broken) consolidate action headers; add install-packages to makefile
Added:
soc2013/mattbw/backend/actions/actions.h
Deleted:
soc2013/mattbw/backend/actions/get-details.h
soc2013/mattbw/backend/actions/get-files.h
soc2013/mattbw/backend/actions/get-repo-list.h
Modified:
soc2013/mattbw/backend/Makefile
soc2013/mattbw/backend/actions/get-details.c
soc2013/mattbw/backend/actions/get-files.c
soc2013/mattbw/backend/actions/get-repo-list.c
soc2013/mattbw/backend/actions/install-packages.c
soc2013/mattbw/backend/pk-backend-pkgng.c
Modified: soc2013/mattbw/backend/Makefile
==============================================================================
--- soc2013/mattbw/backend/Makefile Mon Jul 1 08:30:29 2013 (r253779)
+++ soc2013/mattbw/backend/Makefile Mon Jul 1 08:49:15 2013 (r253780)
@@ -3,7 +3,10 @@
LIB= pk_backend_pkgng
SHLIB_MAJOR= 1
SRCS= pk-backend-pkgng.c groups.c db.c licenses.c iterate.c utils.c
-SRCS+= actions/get-details.c actions/get-files.c actions/get-repo-list.c
+SRCS+= actions/get-details.c \
+ actions/get-files.c \
+ actions/get-repo-list.c \
+ actions/install-packages.c
LIBDIR= /usr/local/lib/packagekit-backend
Added: soc2013/mattbw/backend/actions/actions.h
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ soc2013/mattbw/backend/actions/actions.h Mon Jul 1 08:49:15 2013 (r253780)
@@ -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_ACTIONS_H_
+#define _PKGNG_BACKEND_ACTIONS_H_
+
+#include <glib.h> /* gboolean */
+#include "../pk-backend.h" /* PkBackend */
+
+/* Each thread is implemented in its namesake C file. */
+gboolean get_details_thread(PkBackend *backend);
+gboolean get_files_thread(PkBackend *backend);
+gboolean get_repo_list_thread(PkBackend *backend);
+gboolean install_packages_thread(PkBackend *backend);
+
+#endif /* !_PKGNG_BACKEND_ACTIONS_H_ */
Modified: soc2013/mattbw/backend/actions/get-details.c
==============================================================================
--- soc2013/mattbw/backend/actions/get-details.c Mon Jul 1 08:30:29 2013 (r253779)
+++ soc2013/mattbw/backend/actions/get-details.c Mon Jul 1 08:49:15 2013 (r253780)
@@ -27,7 +27,7 @@
#include "../iterate.h" /* Package iteration */
#include "../licenses.h" /* license_from_pkg */
-#include "get-details.h" /* get_details_thread prototype */
+#include "actions.h" /* get_details_thread prototype */
static const int LOAD_FLAGS = PKG_LOAD_BASIC | PKG_LOAD_LICENSES;
Modified: soc2013/mattbw/backend/actions/get-files.c
==============================================================================
--- soc2013/mattbw/backend/actions/get-files.c Mon Jul 1 08:30:29 2013 (r253779)
+++ soc2013/mattbw/backend/actions/get-files.c Mon Jul 1 08:49:15 2013 (r253780)
@@ -28,7 +28,7 @@
#include "../iterate.h" /* Package iteration */
#include "../licenses.h" /* license_from_pkg */
-#include "get-files.h" /* get_files_thread prototype */
+#include "actions.h" /* get_files_thread prototype */
static const int FILE_NAME_STEP = 10;
static const int LOAD_FLAGS = PKG_LOAD_BASIC | PKG_LOAD_FILES;
Modified: soc2013/mattbw/backend/actions/get-repo-list.c
==============================================================================
--- soc2013/mattbw/backend/actions/get-repo-list.c Mon Jul 1 08:30:29 2013 (r253779)
+++ soc2013/mattbw/backend/actions/get-repo-list.c Mon Jul 1 08:49:15 2013 (r253780)
@@ -23,7 +23,7 @@
#include "pkg.h"
#include "../hash_traverse.h" /* HASH_FOR */
-#include "get-repo-list.h" /* Prototypes */
+#include "actions.h" /* get_repo_list_thread prototype */
/*
* The thread that performs a GetRepoList operation. Should be invoked by the
Modified: soc2013/mattbw/backend/actions/install-packages.c
==============================================================================
--- soc2013/mattbw/backend/actions/install-packages.c Mon Jul 1 08:30:29 2013 (r253779)
+++ soc2013/mattbw/backend/actions/install-packages.c Mon Jul 1 08:49:15 2013 (r253780)
@@ -23,13 +23,10 @@
#include "pkg.h"
#include "../db.h" /* db_query_from_id */
-#include "../groups.h" /* group_from_origin */
#include "../iterate.h" /* Package iteration */
-#include "../licenses.h" /* license_from_pkg */
-#include "get-details.h" /* get_details_thread prototype */
+#include "actions.h" /* install_packages_thread prototype */
-static void emit_pkg(struct pkg *pkg, const gchar *id, PkBackend *backend);
static gboolean get_for(const gchar *id, PkBackend *backend, struct pkgdb *db);
/*
@@ -49,33 +46,19 @@
get_for(const gchar *id, PkBackend *backend, struct pkgdb *db)
{
struct pkg_jobs *jobs;
- db_query_to_job(id, backend, db, LOAD_FLAGS, emit_pkg);
-}
+ int err;
-/*
- * Emits the given package's details. To be used as an iterating function.
- */
-static void
-emit_pkg(struct pkg *pkg, const gchar *id, PkBackend *backend)
-{
-
- const char *description;
- const char *origin;
- const char *www;
- int64_t flatsize;
-
- /* Information not already part of the PackageID */
- pkg_get(pkg,
- PKG_DESC, &description,
- PKG_FLATSIZE, &flatsize,
- PKG_ORIGIN, &origin,
- PKG_WWW, &www);
-
- pk_backend_details(backend,
- id,
- license_name_from_pkg(pkg),
- group_from_origin(origin),
- description,
- www,
- flatsize);
+ jobs = NULL;
+ err = pkg_jobs_new(&jobs, PKG_JOBS_INSTALL, db);
+
+ if (err != E_OK)
+ pk_backend_error_code(backend,
+ PK_ERROR_ENUM_INTERNAL_ERROR,
+ "pkg_jobs_new failed");
+ else
+ err = db_query_to_job(id, backend, db, LOAD_FLAGS, jobs);
+
+ /* TODO: actually install */
+ pk_backend_error_code(backend, PK_ERROR_ENUM_NOT_SUPPORTED, NULL);
+ return err;
}
Modified: soc2013/mattbw/backend/pk-backend-pkgng.c
==============================================================================
--- soc2013/mattbw/backend/pk-backend-pkgng.c Mon Jul 1 08:30:29 2013 (r253779)
+++ soc2013/mattbw/backend/pk-backend-pkgng.c Mon Jul 1 08:49:15 2013 (r253780)
@@ -30,9 +30,7 @@
#include "pkg.h"
#include "groups.h" /* available_groups */
-#include "actions/get-files.h" /* get_files_thread */
-#include "actions/get-details.h"/* get_details_thread */
-#include "actions/get-repo-list.h" /* get_repo_list_thread */
+#include "actions/actions.h" /* Actions threads */
#define INTENTIONALLY_IGNORE(x) (void)(x)
@@ -407,7 +405,7 @@
pk_backend_set_status(backend, PK_STATUS_ENUM_QUERY);
pk_backend_set_percentage(backend, PK_BACKEND_PERCENTAGE_INVALID);
- pk_backend_thread_create(backend, get_repo_list_thread);
+ pk_backend_thread_create(backend, install_packages_thread);
pk_backend_finished(backend);
}
More information about the svn-soc-all
mailing list