[packagekit] packagekit: Branch 'master' - 10 commits
Richard Hughes
hughsient at kemper.freedesktop.org
Mon Dec 31 06:17:15 PST 2007
NEWS | 6 +
backends/apt/Makefile.am | 23 +++++--
backends/dummy/pk-backend-dummy.c | 7 +-
data/95packagekit | 18 +++++
data/Makefile.am | 4 +
src/pk-backend.c | 116 +++++++++++++++++++++-----------------
src/pk-backend.h | 2
src/pk-spawn.c | 4 -
8 files changed, 120 insertions(+), 60 deletions(-)
New commits:
commit ff29907404ca5e09db59f76b77a461bcfb9c73b0
Author: Richard Hughes <richard at hughsie.com>
Date: Mon Dec 31 13:54:47 2007 +0000
dist the pm-utils resume file to fix make distcheck
diff --git a/data/Makefile.am b/data/Makefile.am
index b3a8d83..f766fdd 100644
--- a/data/Makefile.am
+++ b/data/Makefile.am
@@ -34,6 +34,7 @@ database_DATA = \
$(NULL)
EXTRA_DIST = \
+ 95packagekit \
org.freedesktop.PackageKit.conf.in \
packagekit.pc.in \
$(service_in_files) \
commit c321f96bdc878202b8a91e90d5b5ce5a02d8b3a7
Author: Richard Hughes <richard at hughsie.com>
Date: Mon Dec 31 13:48:18 2007 +0000
Add a pm-utils hook so we can drop caches and check for updates on resume
diff --git a/TODO b/TODO
index fa24469..c77cbf4 100644
--- a/TODO
+++ b/TODO
@@ -1,7 +1,5 @@
Order of no particular importance:
-* Add a pm-utils hook so we can drop caches and check for updates on resume
-
* Lots of the functions are not well commented with gtk-doc. Most
important is to get the libpackagekit/*.c annotated as it's used in
other projects. This is probably quite a boring job but is a good way to
diff --git a/data/95packagekit b/data/95packagekit
new file mode 100755
index 0000000..2b5544d
--- /dev/null
+++ b/data/95packagekit
@@ -0,0 +1,18 @@
+#!/bin/bash
+
+. /usr/lib/pm-utils/functions
+
+case "$1" in
+ thaw|resume)
+ # get PackageKit to invalidate its caches and get new updates
+ dbus-send --system --dest=org.freedesktop.PackageKit \
+ --type=method_call --print-reply \
+ /org/freedesktop/PackageKit \
+ org.freedesktop.PackageKit.StateHasChanged
+ ;;
+ *)
+ ;;
+esac
+
+exit $?
+
diff --git a/data/Makefile.am b/data/Makefile.am
index 8bc0ed7..b3a8d83 100644
--- a/data/Makefile.am
+++ b/data/Makefile.am
@@ -10,6 +10,9 @@ SUBDIRS = \
pkgconfigdir = $(libdir)/pkgconfig
pkgconfig_DATA = packagekit.pc
+pmutilsdir = $(libdir)/pm-utils/sleep.d
+pmutils_DATA = 95packagekit
+
dbusdir = ${SYSCONFDIR}/dbus-1/system.d
dist_dbus_DATA = org.freedesktop.PackageKit.conf
commit 015742444fdd81e3913c2104c4aa8fd40ae4a5e0
Author: Richard Hughes <richard at hughsie.com>
Date: Mon Dec 31 10:49:02 2007 +0000
update TOOD
diff --git a/TODO b/TODO
index c77cbf4..fa24469 100644
--- a/TODO
+++ b/TODO
@@ -1,5 +1,7 @@
Order of no particular importance:
+* Add a pm-utils hook so we can drop caches and check for updates on resume
+
* Lots of the functions are not well commented with gtk-doc. Most
important is to get the libpackagekit/*.c annotated as it's used in
other projects. This is probably quite a boring job but is a good way to
commit 416f38637727c199f7f5eaa9af5340cdc3244d36
Author: Richard Hughes <richard at hughsie.com>
Date: Mon Dec 31 10:32:57 2007 +0000
add the release dates to NEWS
diff --git a/NEWS b/NEWS
index fbe0cdd..2a8374e 100644
--- a/NEWS
+++ b/NEWS
@@ -1,5 +1,6 @@
Version 0.1.5
~~~~~~~~~~~~~
+Released: 2007-12-21
* Backends:
- apt: Commit a general cleanup patch (Michael Vogt's)
@@ -45,6 +46,7 @@ Version 0.1.5
Version 0.1.4
~~~~~~~~~~~~~
+Released: 2007-11-26
* Backends:
- yum: Mark our status as QUERY when we have finished setting up the
@@ -97,6 +99,7 @@ Version 0.1.4
Version 0.1.3
~~~~~~~~~~~~~
+Released: 2007-11-10
* Backends:
- smart: Add installed filter (James Bowes)
@@ -142,6 +145,7 @@ Version 0.1.3
~~~~~~~~~~~~~
Version 0.1.2
~~~~~~~~~~~~~
+Released: 2007-11-01
* Backends:
- Add a new python based APT backend (Ali Sabil)
@@ -185,6 +189,7 @@ Version 0.1.2
~~~~~~~~~~~~~
Version 0.1.1
~~~~~~~~~~~~~
+Released: 2007-10-23
* New backends:
- A SMART backend (James Bowes)
@@ -232,6 +237,7 @@ Version 0.1.1
~~~~~~~~~~~~~
Version 0.1.0
~~~~~~~~~~~~~
+Released: 2007-10-16
* The first public release of PackageKit:
- New gobject client library for session software to easily talk to PackageKit.
commit e61b2571e4fab8cb414f513c1d39b49fdeb4aa55
Author: Richard Hughes <richard at hughsie.com>
Date: Mon Dec 31 01:46:33 2007 +0000
debugging notices shouldn't scare me
diff --git a/backends/dummy/pk-backend-dummy.c b/backends/dummy/pk-backend-dummy.c
index 69b097c..5b64909 100644
--- a/backends/dummy/pk-backend-dummy.c
+++ b/backends/dummy/pk-backend-dummy.c
@@ -175,8 +175,8 @@ backend_get_updates (PkBackend *backend)
/* only find updates one in 5 times */
if (number != 1) {
- pk_backend_message (backend, PK_MESSAGE_ENUM_DAEMON,
- "Ignoring this GetUpdate!");
+ pk_backend_message (backend, PK_MESSAGE_ENUM_NOTICE,
+ "Ignoring this GetUpdate as 4/5!");
pk_backend_finished (backend);
return;
}
commit 8cfe6058488212863e5f0376dce5d5ccdc506352
Author: Richard Hughes <richard at hughsie.com>
Date: Mon Dec 31 01:35:33 2007 +0000
add what we are winging about in the message
diff --git a/src/pk-backend.c b/src/pk-backend.c
index 213996f..97fe5cd 100644
--- a/src/pk-backend.c
+++ b/src/pk-backend.c
@@ -1136,7 +1136,7 @@ pk_backend_finished (PkBackend *backend)
if (backend->priv->set_error == FALSE &&
backend->priv->status == PK_STATUS_ENUM_SETUP) {
pk_backend_message (backend, PK_MESSAGE_ENUM_DAEMON,
- "Backends should send status <value> signals to update the UI!\n"
+ "Backends should send status <value> signals for %s!\n"
"If you are:\n"
"* Calling out to external tools, the compiled backend "
"should call pk_backend_change_status() manually.\n"
@@ -1145,7 +1145,7 @@ pk_backend_finished (PkBackend *backend)
" - see helpers/yumBackend.py:self.status()\n"
"* Using a scripted backend with clever commands then a "
" callback should use map values into status enums\n"
- " - see helpers/yumBackend.py:self.state_actions");
+ " - see helpers/yumBackend.py:self.state_actions", role_text);
pk_warning ("GUI will remain unchanged!");
}
commit 0b06b9ee8c0a1825933d644413dbc3f00fdce2f3
Author: Richard Hughes <richard at hughsie.com>
Date: Mon Dec 31 01:35:16 2007 +0000
add some more status calls to shut up the daemon
diff --git a/backends/dummy/pk-backend-dummy.c b/backends/dummy/pk-backend-dummy.c
index b527a35..69b097c 100644
--- a/backends/dummy/pk-backend-dummy.c
+++ b/backends/dummy/pk-backend-dummy.c
@@ -167,6 +167,8 @@ backend_get_updates (PkBackend *backend)
g_return_if_fail (backend != NULL);
+ pk_backend_change_status (backend, PK_STATUS_ENUM_QUERY);
+
rand = g_rand_new ();
number = g_rand_int_range (rand, 1, 5);
g_rand_free (rand);
@@ -276,6 +278,7 @@ backend_refresh_cache (PkBackend *backend, gboolean force)
{
g_return_if_fail (backend != NULL);
progress_percentage = 0;
+ pk_backend_change_status (backend, PK_STATUS_ENUM_REFRESH_CACHE);
g_timeout_add (500, backend_refresh_cache_timeout, backend);
}
commit 19fed75eada2dc6bd151b516cf04dd3109efc36e
Author: Richard Hughes <richard at hughsie.com>
Date: Sun Dec 30 10:13:20 2007 +0000
check more enum types, and message if they are incorrect
diff --git a/src/pk-backend.c b/src/pk-backend.c
index 73a8eae..213996f 100644
--- a/src/pk-backend.c
+++ b/src/pk-backend.c
@@ -36,6 +36,8 @@
#endif /* HAVE_UNISTD_H */
#include <glib/gi18n.h>
+#include <glib/gprintf.h>
+
#include <gmodule.h>
#include <libgbus.h>
@@ -263,29 +265,26 @@ pk_backend_parse_common_output (PkBackend *backend, const gchar *line)
if (pk_strequal (command, "package") == TRUE) {
if (size != 4) {
- g_warning ("invalid command '%s'", command);
+ pk_warning ("invalid command '%s'", command);
ret = FALSE;
goto out;
}
- if (pk_package_id_check (sections[2]) == TRUE) {
- info = pk_info_enum_from_text (sections[1]);
- /* just until we've converted the backends */
- if (info == PK_INFO_ENUM_UNKNOWN) {
- g_print ("Info enumerated type '%s' not recognised\n", sections[1]);
- g_print ("See src/pk-enum.c for allowed values.\n");
- pk_warning ("Runtime error, cannot continue");
- ret = FALSE;
- goto out;
- }
- pk_debug ("info=%s, package='%s' shortdesc='%s'",
- pk_info_enum_to_text (info), sections[2], sections[3]);
- pk_backend_package (backend, info, sections[2], sections[3]);
- } else {
+ if (pk_package_id_check (sections[2]) == FALSE) {
pk_warning ("invalid package_id");
+ ret = FALSE;
+ goto out;
}
+ info = pk_info_enum_from_text (sections[1]);
+ if (info == PK_INFO_ENUM_UNKNOWN) {
+ pk_backend_message (backend, PK_MESSAGE_ENUM_DAEMON,
+ "Info enum not recognised, and hence ignored: '%s'", sections[1]);
+ ret = FALSE;
+ goto out;
+ }
+ pk_backend_package (backend, info, sections[2], sections[3]);
} else if (pk_strequal (command, "description") == TRUE) {
if (size != 8) {
- g_warning ("invalid command '%s'", command);
+ pk_warning ("invalid command '%s'", command);
ret = FALSE;
goto out;
}
@@ -295,22 +294,22 @@ pk_backend_parse_common_output (PkBackend *backend, const gchar *line)
package_size = atol (sections[6]);
if (package_size > 1073741824) {
pk_warning ("package size cannot be larger than one Gb");
- } else {
- pk_backend_description (backend, sections[1], sections[2],
- group, sections[4], sections[5],
- package_size, sections[7]);
+ ret = FALSE;
+ goto out;
}
+ pk_backend_description (backend, sections[1], sections[2],
+ group, sections[4], sections[5],
+ package_size, sections[7]);
} else if (pk_strequal (command, "files") == TRUE) {
if (size != 3) {
- g_warning ("invalid command '%s'", command);
+ pk_warning ("invalid command '%s'", command);
ret = FALSE;
goto out;
}
-
pk_backend_files (backend, sections[1], sections[2]);
} else if (pk_strequal (command, "repo-detail") == TRUE) {
if (size != 4) {
- g_warning ("invalid command '%s'", command);
+ pk_warning ("invalid command '%s'", command);
ret = FALSE;
goto out;
}
@@ -319,13 +318,13 @@ pk_backend_parse_common_output (PkBackend *backend, const gchar *line)
} else if (pk_strequal (sections[3], "false") == TRUE) {
pk_backend_repo_detail (backend, sections[1], sections[2], FALSE);
} else {
- g_warning ("invalid qualifier '%s'", sections[3]);
+ pk_warning ("invalid qualifier '%s'", sections[3]);
ret = FALSE;
goto out;
}
} else if (pk_strequal (command, "updatedetail") == TRUE) {
if (size != 7) {
- g_warning ("invalid command '%s'", command);
+ pk_warning ("invalid command '%s'", command);
ret = FALSE;
goto out;
}
@@ -371,7 +370,7 @@ pk_backend_parse_common_error (PkBackend *backend, const gchar *line)
if (pk_strequal (command, "percentage") == TRUE) {
if (size != 2) {
- g_warning ("invalid command '%s'", command);
+ pk_warning ("invalid command '%s'", command);
ret = FALSE;
goto out;
}
@@ -386,7 +385,7 @@ pk_backend_parse_common_error (PkBackend *backend, const gchar *line)
}
} else if (pk_strequal (command, "subpercentage") == TRUE) {
if (size != 2) {
- g_warning ("invalid command '%s'", command);
+ pk_warning ("invalid command '%s'", command);
ret = FALSE;
goto out;
}
@@ -401,22 +400,21 @@ pk_backend_parse_common_error (PkBackend *backend, const gchar *line)
}
} else if (pk_strequal (command, "error") == TRUE) {
if (size != 3) {
- g_warning ("invalid command '%s'", command);
+ pk_warning ("invalid command '%s'", command);
ret = FALSE;
goto out;
}
error_enum = pk_error_enum_from_text (sections[1]);
if (error_enum == PK_ERROR_ENUM_UNKNOWN) {
- command = g_strdup_printf ("Error enum not recognised, and hence ignored: '%s'", sections[1]);
- pk_backend_message (backend, PK_MESSAGE_ENUM_DAEMON, command);
- g_free (command);
- } else {
- /* only emit if known */
- pk_backend_error_code (backend, error_enum, sections[2]);
+ pk_backend_message (backend, PK_MESSAGE_ENUM_DAEMON,
+ "Error enum not recognised, and hence ignored: '%s'", sections[1]);
+ ret = FALSE;
+ goto out;
}
+ pk_backend_error_code (backend, error_enum, sections[2]);
} else if (pk_strequal (command, "requirerestart") == TRUE) {
if (size != 3) {
- g_warning ("invalid command '%s'", command);
+ pk_warning ("invalid command '%s'", command);
ret = FALSE;
goto out;
}
@@ -424,30 +422,42 @@ pk_backend_parse_common_error (PkBackend *backend, const gchar *line)
pk_backend_require_restart (backend, restart_enum, sections[2]);
} else if (pk_strequal (command, "message") == TRUE) {
if (size != 3) {
- g_warning ("invalid command '%s'", command);
+ pk_warning ("invalid command '%s'", command);
ret = FALSE;
goto out;
}
message_enum = pk_message_enum_from_text (sections[1]);
+ if (message_enum == PK_MESSAGE_ENUM_UNKNOWN) {
+ pk_backend_message (backend, PK_MESSAGE_ENUM_DAEMON,
+ "Message enum not recognised, and hence ignored: '%s'", sections[1]);
+ ret = FALSE;
+ goto out;
+ }
pk_backend_message (backend, message_enum, sections[2]);
} else if (pk_strequal (command, "change-transaction-data") == TRUE) {
if (size != 2) {
- g_warning ("invalid command '%s'", command);
+ pk_warning ("invalid command '%s'", command);
ret = FALSE;
goto out;
}
pk_backend_change_transaction_data (backend, sections[1]);
} else if (pk_strequal (command, "status") == TRUE) {
if (size != 2) {
- g_warning ("invalid command '%s'", command);
+ pk_warning ("invalid command '%s'", command);
ret = FALSE;
goto out;
}
status_enum = pk_status_enum_from_text (sections[1]);
+ if (status_enum == PK_STATUS_ENUM_UNKNOWN) {
+ pk_backend_message (backend, PK_MESSAGE_ENUM_DAEMON,
+ "Status enum not recognised, and hence ignored: '%s'", sections[1]);
+ ret = FALSE;
+ goto out;
+ }
pk_backend_change_status (backend, status_enum);
} else if (pk_strequal (command, "allow-interrupt") == TRUE) {
if (size != 2) {
- g_warning ("invalid command '%s'", command);
+ pk_warning ("invalid command '%s'", command);
ret = FALSE;
goto out;
}
@@ -462,7 +472,7 @@ pk_backend_parse_common_error (PkBackend *backend, const gchar *line)
}
} else if (pk_strequal (command, "no-percentage-updates") == TRUE) {
if (size != 1) {
- g_warning ("invalid command '%s'", command);
+ pk_warning ("invalid command '%s'", command);
ret = FALSE;
goto out;
}
@@ -479,7 +489,7 @@ out:
}
/**
- * pk_backend_spawn_helper_new:
+ * pk_backend_spawn_helper_delete:
**/
static gboolean
pk_backend_spawn_helper_delete (PkBackend *backend)
@@ -887,13 +897,21 @@ pk_backend_require_restart (PkBackend *backend, PkRestartEnum restart, const gch
* pk_backend_message:
**/
gboolean
-pk_backend_message (PkBackend *backend, PkMessageEnum message, const gchar *details)
+pk_backend_message (PkBackend *backend, PkMessageEnum message, const gchar *format, ...)
{
+ va_list args;
+ gchar *buffer;
+
g_return_val_if_fail (backend != NULL, FALSE);
g_return_val_if_fail (PK_IS_BACKEND (backend), FALSE);
- pk_debug ("emit message %i, %s", message, details);
- g_signal_emit (backend, signals [PK_BACKEND_MESSAGE], 0, message, details);
+ va_start (args, format);
+ g_vasprintf (&buffer, format, args);
+ va_end (args);
+
+ pk_debug ("emit message %i, %s", message, buffer);
+ g_signal_emit (backend, signals [PK_BACKEND_MESSAGE], 0, message, buffer);
+ g_free (buffer);
return TRUE;
}
@@ -2373,12 +2391,12 @@ libst_backend (LibSelfTest *test)
}
/************************************************************/
- libst_title (test, "test pk_backend_parse_common_error Error2");
+ libst_title (test, "test pk_backend_parse_common_error failure");
ret = pk_backend_parse_common_error (backend, "error\tnot-present-woohoo\tdescription text");
- if (ret == TRUE) {
+ if (ret == FALSE) {
libst_success (test, NULL);
} else {
- libst_failed (test, "did not validate correctly");
+ libst_failed (test, "did not detect incorrect enum");
}
/************************************************************/
diff --git a/src/pk-backend.h b/src/pk-backend.h
index 912bd46..742a618 100644
--- a/src/pk-backend.h
+++ b/src/pk-backend.h
@@ -62,7 +62,7 @@ gboolean pk_backend_require_restart (PkBackend *backend,
const gchar *details);
gboolean pk_backend_message (PkBackend *backend,
PkMessageEnum message,
- const gchar *details);
+ const gchar *details, ...);
gboolean pk_backend_description (PkBackend *backend,
const gchar *package_id,
const gchar *license,
commit f1879b668694ff6120338e9d3a6744c060e53b12
Author: Richard Hughes <richard at hughsie.com>
Date: Sun Dec 30 09:32:41 2007 +0000
Include pk-apt-search.h in the tarball to fix fd:13406
diff --git a/backends/apt/Makefile.am b/backends/apt/Makefile.am
index 4930e74..e205138 100644
--- a/backends/apt/Makefile.am
+++ b/backends/apt/Makefile.am
@@ -1,19 +1,30 @@
+NULL =
+
SUBDIRS = helpers
plugindir = @PK_PLUGIN_DIR@
plugin_LTLIBRARIES = libpk_backend_apt.la
-libpk_backend_apt_la_SOURCES = pk-backend-apt.c
+
libpk_backend_apt_la_LIBADD = @PK_PLUGIN_LIBS@
libpk_backend_apt_la_LDFLAGS = -module -avoid-version $(APT_LIBS)
libpk_backend_apt_la_CFLAGS = @PK_PLUGIN_CFLAGS@ $(APT_CFLAGS)
libpk_backend_apt_la_CXXFLAGS = @PK_PLUGIN_CFLAGS@ $(APT_CFLAGS) -DPK_DB_DIR=\""$(PK_DB_DIR)"\"
+libpk_backend_apt_la_SOURCES = \
+ pk-backend-apt.c \
+ pk-apt-search.h \
+ $(NULL)
+
if APT_SEARCH_PLAIN
-libpk_backend_apt_la_SOURCES += pk-apt-search-plain.c
+libpk_backend_apt_la_SOURCES += \
+ pk-apt-search-plain.c \
+ $(NULL)
endif
if APT_SEARCH_SQLITE
-libpk_backend_apt_la_SOURCES += pk-sqlite-pkg-cache.h \
- pk-sqlite-pkg-cache.cpp \
- pk-apt-build-db.cpp \
- pk-apt-search-sqlite.cpp
+libpk_backend_apt_la_SOURCES += \
+ pk-sqlite-pkg-cache.h \
+ pk-sqlite-pkg-cache.cpp \
+ pk-apt-build-db.cpp \
+ pk-apt-search-sqlite.cpp \
+ $(NULL)
endif
commit c962a06d01d138248e753c88d642a245efaa1a04
Author: Richard Hughes <richard at hughsie.com>
Date: Sat Dec 29 16:32:32 2007 +0000
properly use g_strv_length
diff --git a/src/pk-spawn.c b/src/pk-spawn.c
index f7f9094..2cbb7c0 100644
--- a/src/pk-spawn.c
+++ b/src/pk-spawn.c
@@ -115,14 +115,14 @@ pk_spawn_emit_whole_lines (PkSpawn *spawn, GString *string, gboolean is_stdout)
return FALSE;
}
- /* split into lines - the las line may be incomplete */
+ /* split into lines - the last line may be incomplete */
lines = g_strsplit (string->str, "\n", 0);
if (lines == NULL) {
return FALSE;
}
/* find size */
- for (size=0; lines[size]; size++);
+ size = g_strv_length (lines);
bytes_processed = 0;
/* we only emit n-1 strings */
More information about the PackageKit
mailing list