socsvn commit: r255240 - in soc2013/mattbw/backend: . actions
mattbw at FreeBSD.org
mattbw at FreeBSD.org
Sat Jul 27 23:47:35 UTC 2013
Author: mattbw
Date: Sat Jul 27 23:47:35 2013
New Revision: 255240
URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=255240
Log:
(Untested) Implement UpdateSystem.
UpdateSystem can't yet be said to do anything other than proceed to
install at the moment, as the lack of decent error reporting means that it
is just failing with a flat "couldn't install packages". It is, however,
now properly plumbed in and available through `pkcon update`.
Next: UpdatePackages, hopefully.
Modified:
soc2013/mattbw/backend/Makefile
soc2013/mattbw/backend/actions.h
soc2013/mattbw/backend/actions/update_system.c
soc2013/mattbw/backend/pk-backend-pkgng.c
Modified: soc2013/mattbw/backend/Makefile
==============================================================================
--- soc2013/mattbw/backend/Makefile Sat Jul 27 22:44:55 2013 (r255239)
+++ soc2013/mattbw/backend/Makefile Sat Jul 27 23:47:35 2013 (r255240)
@@ -45,7 +45,7 @@
actions/search_files.c \
actions/search_groups.c \
actions/search_names.c \
- actions/update_packages.c
+ actions/update_system.c
SRCS+= \
query/core.c \
Modified: soc2013/mattbw/backend/actions.h
==============================================================================
--- soc2013/mattbw/backend/actions.h Sat Jul 27 22:44:55 2013 (r255239)
+++ soc2013/mattbw/backend/actions.h Sat Jul 27 23:47:35 2013 (r255240)
@@ -43,7 +43,6 @@
gboolean simulate_install_files_thread(PkBackend *backend);
gboolean simulate_install_packages_thread(PkBackend *backend);
gboolean simulate_remove_packages_thread(PkBackend *backend);
-gboolean simulate_update_system_thread(PkBackend *backend);
gboolean update_system_thread(PkBackend *backend);
#endif /* !_PKGNG_BACKEND_ACTIONS_H_ */
Modified: soc2013/mattbw/backend/actions/update_system.c
==============================================================================
--- soc2013/mattbw/backend/actions/update_system.c Sat Jul 27 22:44:55 2013 (r255239)
+++ soc2013/mattbw/backend/actions/update_system.c Sat Jul 27 23:47:35 2013 (r255240)
@@ -25,11 +25,11 @@
#include "pkg.h" /* pkg... */
#include "../actions.h" /* update_system_thread prototype */
+#include "../db.h" /* db_open_remote */
+#include "../utils.h" /* ERR */
#include "../pkgutils.h" /* pkgutils_... */
#include "../jobs.h" /* jobs_... */
-static gboolean update_system(PkBackend *backend, bool simulate);
-
/*
* The thread that performs an UpdateSystem operation. Should be invoked
* by the pk_backend_update_system hook.
@@ -37,26 +37,14 @@
gboolean
update_system_thread(PkBackend *backend)
{
-
- return update_system(backend, false);
-}
-
-gboolean
-simulate_update_system_thread(PkBackend *backend)
-{
-
- return update_system(backend, true);
-}
-
-static gboolean
-update_system(PkBackend *backend, bool simulate)
-{
bool success;
struct pkgdb *db;
struct pkg_jobs *jobs;
assert(backend != NULL);
+ success = false;
+
db = db_open_remote(backend);
if (db == NULL)
goto cleanup;
@@ -65,7 +53,7 @@
* the full query approach.
*/
jobs = NULL;
- if (pkg_jobs_new(&jobs, type, db) != EPKG_OK) {
+ if (pkg_jobs_new(&jobs, PKG_JOBS_UPGRADE, db) != EPKG_OK) {
ERR(backend,
PK_ERROR_ENUM_INTERNAL_ERROR,
"could not init pkg_jobs");
@@ -80,14 +68,9 @@
(void)pk_backend_set_status(backend, PK_STATUS_ENUM_UPDATE);
- if (simulate) {
- success = true;
- jobs_emit_packages(jobs, backend,
- pkgutils_pkg_install_state);
- } else
- success = jobs_apply(jobs, backend,
- PK_ERROR_ENUM_NO_PACKAGES_TO_UPDATE,
- PK_ERROR_ENUM_PACKAGE_FAILED_TO_INSTALL);
+ success = jobs_apply(jobs, backend,
+ PK_ERROR_ENUM_NO_PACKAGES_TO_UPDATE,
+ PK_ERROR_ENUM_PACKAGE_FAILED_TO_INSTALL);
cleanup:
(void)pk_backend_finished(backend);
Modified: soc2013/mattbw/backend/pk-backend-pkgng.c
==============================================================================
--- soc2013/mattbw/backend/pk-backend-pkgng.c Sat Jul 27 22:44:55 2013 (r255239)
+++ soc2013/mattbw/backend/pk-backend-pkgng.c Sat Jul 27 23:47:35 2013 (r255240)
@@ -270,6 +270,8 @@
THREAD(backend, simulate_remove_packages_thread);
}
+#if 0
+
void
pk_backend_simulate_update_packages(PkBackend *backend, gchar **package_ids)
{
@@ -289,3 +291,14 @@
assert(backend != NULL);
THREAD(backend, update_packages_thread);
}
+
+#endif
+
+void
+pk_backend_update_system(PkBackend *backend, gboolean only_trusted)
+{
+
+ INTENTIONALLY_IGNORE(only_trusted); /* not yet supported */
+ assert(backend != NULL);
+ THREAD(backend, update_system_thread);
+}
More information about the svn-soc-all
mailing list