From owner-svn-soc-all@FreeBSD.ORG Thu Jun 20 00:56:21 2013 Return-Path: Delivered-To: svn-soc-all@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id B0370AB3 for ; Thu, 20 Jun 2013 00:56:21 +0000 (UTC) (envelope-from mattbw@FreeBSD.org) Received: from socsvn.freebsd.org (socsvn.freebsd.org [IPv6:2001:1900:2254:206a::16:124]) by mx1.freebsd.org (Postfix) with ESMTP id A014B1AA3 for ; Thu, 20 Jun 2013 00:56:21 +0000 (UTC) Received: from socsvn.freebsd.org ([127.0.1.124]) by socsvn.freebsd.org (8.14.7/8.14.7) with ESMTP id r5K0uLrc003574 for ; Thu, 20 Jun 2013 00:56:21 GMT (envelope-from mattbw@FreeBSD.org) Received: (from www@localhost) by socsvn.freebsd.org (8.14.7/8.14.6/Submit) id r5K0uL6u003570 for svn-soc-all@FreeBSD.org; Thu, 20 Jun 2013 00:56:21 GMT (envelope-from mattbw@FreeBSD.org) Date: Thu, 20 Jun 2013 00:56:21 GMT Message-Id: <201306200056.r5K0uL6u003570@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: r253264 - soc2013/mattbw/dummy 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: Thu, 20 Jun 2013 00:56:21 -0000 Author: mattbw Date: Thu Jun 20 00:56:21 2013 New Revision: 253264 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=253264 Log: initial work on get-details; does not work yet; heavily inspired by opkg Added: soc2013/mattbw/dummy/pk-backend-pkgng.c Modified: soc2013/mattbw/dummy/Makefile soc2013/mattbw/dummy/pk-backend-dummy.c Modified: soc2013/mattbw/dummy/Makefile ============================================================================== --- soc2013/mattbw/dummy/Makefile Wed Jun 19 23:09:10 2013 (r253263) +++ soc2013/mattbw/dummy/Makefile Thu Jun 20 00:56:21 2013 (r253264) @@ -1,8 +1,8 @@ # $FreeBSD$ -LIB= pk_backend_dummy +LIB= pk_backend_pkgng SHLIB_MAJOR= 1 -SRCS= pk-backend-dummy.c +SRCS= pk-backend-pkgng.c USE_PK_PKGCONF= 0 Modified: soc2013/mattbw/dummy/pk-backend-dummy.c ============================================================================== --- soc2013/mattbw/dummy/pk-backend-dummy.c Wed Jun 19 23:09:10 2013 (r253263) +++ soc2013/mattbw/dummy/pk-backend-dummy.c Thu Jun 20 00:56:21 2013 (r253264) @@ -30,34 +30,34 @@ #include "pk-backend.h" /* static bodges */ -static guint _progress_percentage = 0; -static gulong _signal_timeout = 0; -static gchar **_package_ids; -static gchar **_values; -static guint _package_current = 0; -static gboolean _repo_enabled_local = FALSE; -static gboolean _repo_enabled_fedora = TRUE; -static gboolean _repo_enabled_devel = TRUE; -static gboolean _repo_enabled_livna = TRUE; -static gboolean _updated_gtkhtml = FALSE; -static gboolean _updated_kernel = FALSE; -static gboolean _updated_powertop = FALSE; -static gboolean _has_signature = FALSE; -static gboolean _use_blocked = FALSE; -static gboolean _use_eula = FALSE; -static gboolean _use_media = FALSE; -static gboolean _use_gpg = FALSE; -static gboolean _use_trusted = TRUE; -static gboolean _use_distro_upgrade = FALSE; +static guint _progress_percentage = 0; +static gulong _signal_timeout = 0; +static gchar **_package_ids; +static gchar **_values; +static guint _package_current = 0; +static gboolean _repo_enabled_local = FALSE; +static gboolean _repo_enabled_fedora = TRUE; +static gboolean _repo_enabled_devel = TRUE; +static gboolean _repo_enabled_livna = TRUE; +static gboolean _updated_gtkhtml = FALSE; +static gboolean _updated_kernel = FALSE; +static gboolean _updated_powertop = FALSE; +static gboolean _has_signature = FALSE; +static gboolean _use_blocked = FALSE; +static gboolean _use_eula = FALSE; +static gboolean _use_media = FALSE; +static gboolean _use_gpg = FALSE; +static gboolean _use_trusted = TRUE; +static gboolean _use_distro_upgrade = FALSE; static PkBitfield _filters = 0; static GSocket *_socket = NULL; -static guint _socket_listen_id = 0; +static guint _socket_listen_id = 0; /** * pk_backend_initialize: */ void -pk_backend_initialize (PkBackend *backend) +pk_backend_initialize(PkBackend * backend) { _progress_percentage = 0; } @@ -66,7 +66,7 @@ * pk_backend_destroy: */ void -pk_backend_destroy (PkBackend *backend) +pk_backend_destroy(PkBackend * backend) { } @@ -74,50 +74,50 @@ * pk_backend_get_groups: */ PkBitfield -pk_backend_get_groups (PkBackend *backend) +pk_backend_get_groups(PkBackend * backend) { - return pk_bitfield_from_enums (PK_GROUP_ENUM_ACCESSIBILITY, - PK_GROUP_ENUM_GAMES, - PK_GROUP_ENUM_SYSTEM, - -1); + return pk_bitfield_from_enums(PK_GROUP_ENUM_ACCESSIBILITY, + PK_GROUP_ENUM_GAMES, + PK_GROUP_ENUM_SYSTEM, + -1); } /** * pk_backend_get_filters: */ PkBitfield -pk_backend_get_filters (PkBackend *backend) +pk_backend_get_filters(PkBackend * backend) { - return pk_bitfield_from_enums (PK_FILTER_ENUM_GUI, - PK_FILTER_ENUM_INSTALLED, - PK_FILTER_ENUM_DEVELOPMENT, - -1); + return pk_bitfield_from_enums(PK_FILTER_ENUM_GUI, + PK_FILTER_ENUM_INSTALLED, + PK_FILTER_ENUM_DEVELOPMENT, + -1); } /** * pk_backend_get_mime_types: */ -gchar * -pk_backend_get_mime_types (PkBackend *backend) +gchar * +pk_backend_get_mime_types(PkBackend * backend) { - return g_strdup ("application/x-rpm;application/x-deb"); + return g_strdup("application/x-rpm;application/x-deb"); } /** * pk_backend_cancel_timeout: */ -static gboolean -pk_backend_cancel_timeout (gpointer data) +static gboolean +pk_backend_cancel_timeout(gpointer data) { - PkBackend *backend = (PkBackend *) data; + PkBackend *backend = (PkBackend *) data; /* we can now cancel again */ _signal_timeout = 0; /* now mark as finished */ - pk_backend_error_code (backend, PK_ERROR_ENUM_TRANSACTION_CANCELLED, - "The task was stopped successfully"); - pk_backend_finished (backend); + pk_backend_error_code(backend, PK_ERROR_ENUM_TRANSACTION_CANCELLED, + "The task was stopped successfully"); + pk_backend_finished(backend); return FALSE; } @@ -125,14 +125,14 @@ * pk_backend_cancel: */ void -pk_backend_cancel (PkBackend *backend) +pk_backend_cancel(PkBackend * backend) { /* cancel the timeout */ if (_signal_timeout != 0) { - g_source_remove (_signal_timeout); + g_source_remove(_signal_timeout); /* emulate that it takes us a few ms to cancel */ - g_timeout_add (1500, pk_backend_cancel_timeout, backend); + g_timeout_add(1500, pk_backend_cancel_timeout, backend); } } @@ -140,220 +140,220 @@ * pk_backend_get_depends: */ void -pk_backend_get_depends (PkBackend *backend, PkBitfield filters, gchar **package_ids, gboolean recursive) +pk_backend_get_depends(PkBackend * backend, PkBitfield filters, gchar ** package_ids, gboolean recursive) { - pk_backend_set_status (backend, PK_STATUS_ENUM_QUERY); + pk_backend_set_status(backend, PK_STATUS_ENUM_QUERY); - if (g_strcmp0 (package_ids[0], "scribus;1.3.4-1.fc8;i386;fedora") == 0) { - pk_backend_package (backend, PK_INFO_ENUM_AVAILABLE, - "scribus-clipart;1.3.4-1.fc8;i386;fedora", "Clipart for scribus"); + if (g_strcmp0(package_ids[0], "scribus;1.3.4-1.fc8;i386;fedora") == 0) { + pk_backend_package(backend, PK_INFO_ENUM_AVAILABLE, + "scribus-clipart;1.3.4-1.fc8;i386;fedora", "Clipart for scribus"); } else { - pk_backend_package (backend, PK_INFO_ENUM_INSTALLED, - "glib2;2.14.0;i386;fedora", "The GLib library"); - pk_backend_package (backend, PK_INFO_ENUM_AVAILABLE, - "gtk2;gtk2-2.11.6-6.fc8;i386;fedora", "GTK+ Libraries for GIMP"); + pk_backend_package(backend, PK_INFO_ENUM_INSTALLED, + "glib2;2.14.0;i386;fedora", "The GLib library"); + pk_backend_package(backend, PK_INFO_ENUM_AVAILABLE, + "gtk2;gtk2-2.11.6-6.fc8;i386;fedora", "GTK+ Libraries for GIMP"); } - pk_backend_finished (backend); + pk_backend_finished(backend); } /** * pk_backend_get_details: */ void -pk_backend_get_details (PkBackend *backend, gchar **package_ids) +pk_backend_get_details(PkBackend * backend, gchar ** package_ids) { - guint i; - guint len; - const gchar *package_id; + guint i; + guint len; + const gchar *package_id; - pk_backend_set_status (backend, PK_STATUS_ENUM_QUERY); - pk_backend_set_percentage (backend, 0); + pk_backend_set_status(backend, PK_STATUS_ENUM_QUERY); + pk_backend_set_percentage(backend, 0); /* each one has a different detail for testing */ - len = g_strv_length (package_ids); - for (i=0; i 1.6.0-10\n" - "- xserver-1.6.0-selinux-less.patch: Don't init selinux unless the policy\n" - " says to be an object manager.\n" - "\n" - "**Wed Mar 11 2009** Adam Jackson 1.6.0-11\n" - "- xserver-1.6.0-less-acpi-brokenness.patch: Don't build the (broken)\n" - " ACPI code.\n" - "\n" - "**Wed Mar 11 2009** Adam Jackson 1.6.0-12\n" - "- Requires: pixman >= 0.14.0\n" - "\n" - "**Fri Mar 6 2009** Adam Jackson 1.6.0-8\n" - "- xserver-1.6.0-primary.patch: Really, only look at VGA devices. (#488869)\n"; + "- xselinux-1.6.0-selinux-nlfd.patch: Acquire the netlink socket from selinux,\n" + " check it ourselves rather than having libselinux bang on it all the time.\n" + "\n" + "**Wed Mar 11 2009** Adam Jackson 1.6.0-10\n" + "- xserver-1.6.0-selinux-less.patch: Don't init selinux unless the policy\n" + " says to be an object manager.\n" + "\n" + "**Wed Mar 11 2009** Adam Jackson 1.6.0-11\n" + "- xserver-1.6.0-less-acpi-brokenness.patch: Don't build the (broken)\n" + " ACPI code.\n" + "\n" + "**Wed Mar 11 2009** Adam Jackson 1.6.0-12\n" + "- Requires: pixman >= 0.14.0\n" + "\n" + "**Fri Mar 6 2009** Adam Jackson 1.6.0-8\n" + "- xserver-1.6.0-primary.patch: Really, only look at VGA devices. (#488869)\n"; /* each one has a different detail for testing */ - pk_backend_set_percentage (backend, 0); - len = g_strv_length (_package_ids); - for (i=0; i 30 && _progress_percentage < 50) { - sub_percent = ((gfloat) (_progress_percentage - 30.0f) / 20.0f) * 100.0f; - pk_backend_set_sub_percentage (backend, sub_percent); + sub_percent = ((gfloat) (_progress_percentage - 30.0 f) / 20.0 f) * 100.0 f; + pk_backend_set_sub_percentage(backend, sub_percent); } else { - pk_backend_set_sub_percentage (backend, PK_BACKEND_PERCENTAGE_INVALID); + pk_backend_set_sub_percentage(backend, PK_BACKEND_PERCENTAGE_INVALID); } _progress_percentage += 1; - pk_backend_set_percentage (backend, _progress_percentage); + pk_backend_set_percentage(backend, _progress_percentage); return TRUE; } @@ -462,109 +462,107 @@ * pk_backend_install_packages: */ void -pk_backend_install_packages (PkBackend *backend, gboolean only_trusted, gchar **package_ids) +pk_backend_install_packages(PkBackend * backend, gboolean only_trusted, gchar ** package_ids) { - const gchar *license_agreement; - const gchar *eula_id; - gboolean has_eula; + const gchar *license_agreement; + const gchar *eula_id; + gboolean has_eula; /* FIXME: support only_trusted */ - if (g_strcmp0 (package_ids[0], "vips-doc;7.12.4-2.fc8;noarch;linva") == 0) { + if (g_strcmp0(package_ids[0], "vips-doc;7.12.4-2.fc8;noarch;linva") == 0) { if (_use_gpg && !_has_signature) { - pk_backend_repo_signature_required (backend, package_ids[0], "updates", - "http://example.com/gpgkey", - "Test Key (Fedora) fedora@example.com", - "BB7576AC", - "D8CC 06C2 77EC 9C53 372F C199 B1EE 1799 F24F 1B08", - "2007-10-04", PK_SIGTYPE_ENUM_GPG); - pk_backend_error_code (backend, PK_ERROR_ENUM_GPG_FAILURE, - "GPG signed package could not be verified"); - pk_backend_finished (backend); + pk_backend_repo_signature_required(backend, package_ids[0], "updates", + "http://example.com/gpgkey", + "Test Key (Fedora) fedora@example.com", + "BB7576AC", + "D8CC 06C2 77EC 9C53 372F C199 B1EE 1799 F24F 1B08", + "2007-10-04", PK_SIGTYPE_ENUM_GPG); + pk_backend_error_code(backend, PK_ERROR_ENUM_GPG_FAILURE, + "GPG signed package could not be verified"); + pk_backend_finished(backend); return; } eula_id = "eula_hughsie_dot_com"; - has_eula = pk_backend_is_eula_valid (backend, eula_id); + has_eula = pk_backend_is_eula_valid(backend, eula_id); if (_use_eula && !has_eula) { license_agreement = "Narrator: In A.D. 2101, war was beginning.\n" - "Captain: What happen ?\n" - "Mechanic: Somebody set up us the bomb.\n\n" - "Operator: We get signal.\n" - "Captain: What !\n" - "Operator: Main screen turn on.\n" - "Captain: It's you !!\n" - "CATS: How are you gentlemen !!\n" - "CATS: All your base are belong to us.\n" - "CATS: You are on the way to destruction.\n\n" - "Captain: What you say !!\n" - "CATS: You have no chance to survive make your time.\n" - "CATS: Ha Ha Ha Ha ....\n\n" - "Operator: Captain!! *\n" - "Captain: Take off every 'ZIG' !!\n" - "Captain: You know what you doing.\n" - "Captain: Move 'ZIG'.\n" - "Captain: For great justice.\n"; - pk_backend_eula_required (backend, eula_id, package_ids[0], - "CATS Inc.", license_agreement); - pk_backend_error_code (backend, PK_ERROR_ENUM_NO_LICENSE_AGREEMENT, - "licence not installed so cannot install"); - pk_backend_finished (backend); + "Captain: What happen ?\n" + "Mechanic: Somebody set up us the bomb.\n\n" + "Operator: We get signal.\n" + "Captain: What !\n" + "Operator: Main screen turn on.\n" + "Captain: It's you !!\n" + "CATS: How are you gentlemen !!\n" + "CATS: All your base are belong to us.\n" + "CATS: You are on the way to destruction.\n\n" + "Captain: What you say !!\n" + "CATS: You have no chance to survive make your time.\n" + "CATS: Ha Ha Ha Ha ....\n\n" + "Operator: Captain!! *\n" + "Captain: Take off every 'ZIG' !!\n" + "Captain: You know what you doing.\n" + "Captain: Move 'ZIG'.\n" + "Captain: For great justice.\n"; + pk_backend_eula_required(backend, eula_id, package_ids[0], + "CATS Inc.", license_agreement); + pk_backend_error_code(backend, PK_ERROR_ENUM_NO_LICENSE_AGREEMENT, + "licence not installed so cannot install"); + pk_backend_finished(backend); return; } if (_use_media) { _use_media = FALSE; - pk_backend_media_change_required (backend, PK_MEDIA_TYPE_ENUM_DVD, "linux-disk-1of7", "Linux Disc 1 of 7"); - pk_backend_error_code (backend, PK_ERROR_ENUM_MEDIA_CHANGE_REQUIRED, - "additional media linux-disk-1of7 required"); - pk_backend_finished (backend); + pk_backend_media_change_required(backend, PK_MEDIA_TYPE_ENUM_DVD, "linux-disk-1of7", "Linux Disc 1 of 7"); + pk_backend_error_code(backend, PK_ERROR_ENUM_MEDIA_CHANGE_REQUIRED, + "additional media linux-disk-1of7 required"); + pk_backend_finished(backend); return; } } - if (_use_trusted && only_trusted) { - pk_backend_error_code (backend, PK_ERROR_ENUM_CANNOT_INSTALL_REPO_UNSIGNED, - "Can't install as untrusted"); - pk_backend_finished (backend); + pk_backend_error_code(backend, PK_ERROR_ENUM_CANNOT_INSTALL_REPO_UNSIGNED, + "Can't install as untrusted"); + pk_backend_finished(backend); return; } - - pk_backend_set_allow_cancel (backend, TRUE); + pk_backend_set_allow_cancel(backend, TRUE); _progress_percentage = 0; - pk_backend_package (backend, PK_INFO_ENUM_DOWNLOADING, - "gtkhtml2;2.19.1-4.fc8;i386;fedora", - "An HTML widget for GTK+ 2.0"); - _signal_timeout = g_timeout_add (100, pk_backend_install_timeout, backend); + pk_backend_package(backend, PK_INFO_ENUM_DOWNLOADING, + "gtkhtml2;2.19.1-4.fc8;i386;fedora", + "An HTML widget for GTK+ 2.0"); + _signal_timeout = g_timeout_add(100, pk_backend_install_timeout, backend); } /** * pk_backend_install_signature: */ void -pk_backend_install_signature (PkBackend *backend, PkSigTypeEnum type, - const gchar *key_id, const gchar *package_id) +pk_backend_install_signature(PkBackend * backend, PkSigTypeEnum type, + const gchar * key_id, const gchar * package_id) { - pk_backend_set_status (backend, PK_STATUS_ENUM_INSTALL); + pk_backend_set_status(backend, PK_STATUS_ENUM_INSTALL); if (type == PK_SIGTYPE_ENUM_GPG && - /* egg_strequal (package_id, "vips-doc;7.12.4-2.fc8;noarch;linva") && */ - g_strcmp0 (key_id, "BB7576AC") == 0) { - g_debug ("installed signature %s for %s", key_id, package_id); + /* egg_strequal (package_id, "vips-doc;7.12.4-2.fc8;noarch;linva") && */ + g_strcmp0(key_id, "BB7576AC") == 0) { + g_debug("installed signature %s for %s", key_id, package_id); _has_signature = TRUE; } else { - pk_backend_error_code (backend, PK_ERROR_ENUM_GPG_FAILURE, - "GPG key %s not recognised for package_id %s", - key_id, package_id); + pk_backend_error_code(backend, PK_ERROR_ENUM_GPG_FAILURE, + "GPG key %s not recognised for package_id %s", + key_id, package_id); } - pk_backend_finished (backend); + pk_backend_finished(backend); } /** * pk_backend_refresh_cache_timeout: */ -static gboolean -pk_backend_install_files_timeout (gpointer data) +static gboolean +pk_backend_install_files_timeout(gpointer data) { - PkBackend *backend = (PkBackend *) data; - pk_backend_finished (backend); + PkBackend *backend = (PkBackend *) data; + pk_backend_finished(backend); return FALSE; } @@ -572,28 +570,28 @@ * pk_backend_install_files: */ void -pk_backend_install_files (PkBackend *backend, gboolean only_trusted, gchar **full_paths) +pk_backend_install_files(PkBackend * backend, gboolean only_trusted, gchar ** full_paths) { - pk_backend_set_status (backend, PK_STATUS_ENUM_INSTALL); - pk_backend_set_percentage (backend, 101); - _signal_timeout = g_timeout_add (2000, pk_backend_install_files_timeout, backend); + pk_backend_set_status(backend, PK_STATUS_ENUM_INSTALL); + pk_backend_set_percentage(backend, 101); + _signal_timeout = g_timeout_add(2000, pk_backend_install_files_timeout, backend); } /** * pk_backend_refresh_cache_timeout: */ -static gboolean -pk_backend_refresh_cache_timeout (gpointer data) +static gboolean +pk_backend_refresh_cache_timeout(gpointer data) { - PkBackend *backend = (PkBackend *) data; + PkBackend *backend = (PkBackend *) data; if (_progress_percentage == 100) { - pk_backend_finished (backend); + pk_backend_finished(backend); return FALSE; } if (_progress_percentage == 80) - pk_backend_set_allow_cancel (backend, FALSE); + pk_backend_set_allow_cancel(backend, FALSE); _progress_percentage += 10; - pk_backend_set_percentage (backend, _progress_percentage); + pk_backend_set_percentage(backend, _progress_percentage); return TRUE; } @@ -601,7 +599,7 @@ * pk_backend_refresh_cache: */ void -pk_backend_refresh_cache (PkBackend *backend, gboolean force) +pk_backend_refresh_cache(PkBackend * backend, gboolean force) { _progress_percentage = 0; @@ -610,50 +608,50 @@ _updated_kernel = FALSE; _updated_powertop = FALSE; - pk_backend_set_allow_cancel (backend, TRUE); - pk_backend_set_status (backend, PK_STATUS_ENUM_REFRESH_CACHE); - _signal_timeout = g_timeout_add (500, pk_backend_refresh_cache_timeout, backend); + pk_backend_set_allow_cancel(backend, TRUE); + pk_backend_set_status(backend, PK_STATUS_ENUM_REFRESH_CACHE); + _signal_timeout = g_timeout_add(500, pk_backend_refresh_cache_timeout, backend); } /** * pk_backend_resolve_timeout: */ -static gboolean -pk_backend_resolve_timeout (gpointer data) +static gboolean +pk_backend_resolve_timeout(gpointer data) { - PkBackend *backend = (PkBackend *) data; - guint i; - guint len; - gchar **packages = _package_ids; + PkBackend *backend = (PkBackend *) data; + guint i; + guint len; + gchar **packages = _package_ids; - pk_backend_set_status (backend, PK_STATUS_ENUM_QUERY); - pk_backend_set_percentage (backend, 0); + pk_backend_set_status(backend, PK_STATUS_ENUM_QUERY); + pk_backend_set_percentage(backend, 0); /* each one has a different detail for testing */ - len = g_strv_length (packages); - for (i=0; i