[PackageKit-commit] packagekit: Branch 'master' - 6 commits
Richard Hughes
hughsient at kemper.freedesktop.org
Mon Nov 30 02:23:29 PST 2009
backends/yum/yumBackend.py | 16 ++++++++
lib/packagekit-glib2/pk-enum.c | 12 ++++++
lib/packagekit-glib2/pk-enum.h | 12 ++++++
lib/packagekit-qt/src/client.cpp | 7 +++
lib/packagekit-qt/src/client.h | 1
src/egg-debug.c | 63 ++++++++++++++++++++++------------
tools/pk-refresh-licenses.c | 71 ++++++++++++++++++++++++++++-----------
7 files changed, 139 insertions(+), 43 deletions(-)
New commits:
commit f3d5c1f9567d28e13c7e7e536599a32fd809aa08
Author: Richard Hughes <richard at hughsie.com>
Date: Mon Nov 30 09:37:35 2009 +0000
Use the license generator to update the list of free licenses to include font licences. Should fix rh#519394
diff --git a/lib/packagekit-glib2/pk-enum.c b/lib/packagekit-glib2/pk-enum.c
index 02ddcbf..bd4e453 100644
--- a/lib/packagekit-glib2/pk-enum.c
+++ b/lib/packagekit-glib2/pk-enum.c
@@ -374,16 +374,19 @@ static const PkEnumMatch enum_free_licenses[] = {
{PK_LICENSE_ENUM_AMPAS_BSD, "AMPAS BSD"},
{PK_LICENSE_ENUM_APSL_2_DOT_0, "APSL 2.0"},
{PK_LICENSE_ENUM_ARL, "ARL"},
+ {PK_LICENSE_ENUM_ARPHIC, "Arphic"},
{PK_LICENSE_ENUM_ARTISTIC_2_DOT_0, "Artistic 2.0"},
{PK_LICENSE_ENUM_ARTISTIC_CLARIFIED, "Artistic clarified"},
{PK_LICENSE_ENUM_ASL_1_DOT_0, "ASL 1.0"},
{PK_LICENSE_ENUM_ASL_1_DOT_1, "ASL 1.1"},
{PK_LICENSE_ENUM_ASL_2_DOT_0, "ASL 2.0"},
+ {PK_LICENSE_ENUM_BAEKMUK, "Baekmuk"},
{PK_LICENSE_ENUM_BITTORRENT, "BitTorrent"},
{PK_LICENSE_ENUM_BOOST, "Boost"},
{PK_LICENSE_ENUM_BSD, "BSD"},
{PK_LICENSE_ENUM_BSD_WITH_ADVERTISING, "BSD with advertising"},
{PK_LICENSE_ENUM_CATOSL, "CATOSL"},
+ {PK_LICENSE_ENUM_CC0, "CC0"},
{PK_LICENSE_ENUM_CC_BY, "CC-BY"},
{PK_LICENSE_ENUM_CC_BY_SA, "CC-BY-SA"},
{PK_LICENSE_ENUM_CDDL, "CDDL"},
@@ -441,6 +444,7 @@ static const PkEnumMatch enum_free_licenses[] = {
{PK_LICENSE_ENUM_IMLIB2, "Imlib2"},
{PK_LICENSE_ENUM_INTEL_ACPI, "Intel ACPI"},
{PK_LICENSE_ENUM_INTERBASE, "Interbase"},
+ {PK_LICENSE_ENUM_IPA, "IPA"},
{PK_LICENSE_ENUM_ISC, "ISC"},
{PK_LICENSE_ENUM_JABBER, "Jabber"},
{PK_LICENSE_ENUM_JASPER, "JasPer"},
@@ -456,6 +460,7 @@ static const PkEnumMatch enum_free_licenses[] = {
{PK_LICENSE_ENUM_LGPLV3_PLUS, "LGPLv3+"},
{PK_LICENSE_ENUM_LGPLV3_PLUS_WITH_EXCEPTIONS, "LGPLv3+ with exceptions"},
{PK_LICENSE_ENUM_LGPLV3_WITH_EXCEPTIONS, "LGPLv3 with exceptions"},
+ {PK_LICENSE_ENUM_LIBERATION, "Liberation"},
{PK_LICENSE_ENUM_LIBTIFF, "libtiff"},
{PK_LICENSE_ENUM_LLGPL, "LLGPL"},
{PK_LICENSE_ENUM_LOGICA, "Logica"},
@@ -465,7 +470,9 @@ static const PkEnumMatch enum_free_licenses[] = {
{PK_LICENSE_ENUM_MIROS, "MirOS"},
{PK_LICENSE_ENUM_MIT, "MIT"},
{PK_LICENSE_ENUM_MIT_WITH_ADVERTISING, "MIT with advertising"},
+ {PK_LICENSE_ENUM_MOD_MACRO, "mod_macro"},
{PK_LICENSE_ENUM_MOTOSOTO, "Motosoto"},
+ {PK_LICENSE_ENUM_MPLUS, "mplus"},
{PK_LICENSE_ENUM_MPLV1_DOT_0, "MPLv1.0"},
{PK_LICENSE_ENUM_MPLV1_DOT_1, "MPLv1.1"},
{PK_LICENSE_ENUM_MS_PL, "MS-PL"},
@@ -479,6 +486,7 @@ static const PkEnumMatch enum_free_licenses[] = {
{PK_LICENSE_ENUM_NOSL, "NOSL"},
{PK_LICENSE_ENUM_NOWEB, "Noweb"},
{PK_LICENSE_ENUM_OAL, "OAL"},
+ {PK_LICENSE_ENUM_OFL, "OFL"},
{PK_LICENSE_ENUM_OFSFDL, "OFSFDL"},
{PK_LICENSE_ENUM_OPENLDAP, "OpenLDAP"},
{PK_LICENSE_ENUM_OPENPBS, "OpenPBS"},
@@ -510,6 +518,7 @@ static const PkEnumMatch enum_free_licenses[] = {
{PK_LICENSE_ENUM_SLIB, "SLIB"},
{PK_LICENSE_ENUM_SNIA, "SNIA"},
{PK_LICENSE_ENUM_SPL, "SPL"},
+ {PK_LICENSE_ENUM_STIX, "STIX"},
{PK_LICENSE_ENUM_TCL, "TCL"},
{PK_LICENSE_ENUM_TMATE, "TMate"},
{PK_LICENSE_ENUM_TPL, "TPL"},
@@ -519,11 +528,14 @@ static const PkEnumMatch enum_free_licenses[] = {
{PK_LICENSE_ENUM_VOSTROM, "VOSTROM"},
{PK_LICENSE_ENUM_VSL, "VSL"},
{PK_LICENSE_ENUM_W3C, "W3C"},
+ {PK_LICENSE_ENUM_WADALAB, "Wadalab"},
{PK_LICENSE_ENUM_WEBMIN, "Webmin"},
{PK_LICENSE_ENUM_WTFPL, "WTFPL"},
{PK_LICENSE_ENUM_WXWIDGETS, "wxWidgets"},
+ {PK_LICENSE_ENUM_XANO, "XANO"},
{PK_LICENSE_ENUM_XEROX, "Xerox"},
{PK_LICENSE_ENUM_XINETD, "xinetd"},
+ {PK_LICENSE_ENUM_XSKAT, "XSkat"},
{PK_LICENSE_ENUM_YPLV1_DOT_1, "YPLv1.1"},
{PK_LICENSE_ENUM_ZEND, "Zend"},
{PK_LICENSE_ENUM_ZLIB, "zlib"},
diff --git a/lib/packagekit-glib2/pk-enum.h b/lib/packagekit-glib2/pk-enum.h
index de9d5dc..e2591a4 100644
--- a/lib/packagekit-glib2/pk-enum.h
+++ b/lib/packagekit-glib2/pk-enum.h
@@ -463,16 +463,19 @@ typedef enum {
PK_LICENSE_ENUM_AMPAS_BSD,
PK_LICENSE_ENUM_APSL_2_DOT_0,
PK_LICENSE_ENUM_ARL,
+ PK_LICENSE_ENUM_ARPHIC,
PK_LICENSE_ENUM_ARTISTIC_2_DOT_0,
PK_LICENSE_ENUM_ARTISTIC_CLARIFIED,
PK_LICENSE_ENUM_ASL_1_DOT_0,
PK_LICENSE_ENUM_ASL_1_DOT_1,
PK_LICENSE_ENUM_ASL_2_DOT_0,
+ PK_LICENSE_ENUM_BAEKMUK,
PK_LICENSE_ENUM_BITTORRENT,
PK_LICENSE_ENUM_BOOST,
PK_LICENSE_ENUM_BSD,
PK_LICENSE_ENUM_BSD_WITH_ADVERTISING,
PK_LICENSE_ENUM_CATOSL,
+ PK_LICENSE_ENUM_CC0,
PK_LICENSE_ENUM_CC_BY,
PK_LICENSE_ENUM_CC_BY_SA,
PK_LICENSE_ENUM_CDDL,
@@ -530,6 +533,7 @@ typedef enum {
PK_LICENSE_ENUM_IMLIB2,
PK_LICENSE_ENUM_INTEL_ACPI,
PK_LICENSE_ENUM_INTERBASE,
+ PK_LICENSE_ENUM_IPA,
PK_LICENSE_ENUM_ISC,
PK_LICENSE_ENUM_JABBER,
PK_LICENSE_ENUM_JASPER,
@@ -545,6 +549,7 @@ typedef enum {
PK_LICENSE_ENUM_LGPLV3_PLUS,
PK_LICENSE_ENUM_LGPLV3_PLUS_WITH_EXCEPTIONS,
PK_LICENSE_ENUM_LGPLV3_WITH_EXCEPTIONS,
+ PK_LICENSE_ENUM_LIBERATION,
PK_LICENSE_ENUM_LIBTIFF,
PK_LICENSE_ENUM_LLGPL,
PK_LICENSE_ENUM_LOGICA,
@@ -554,7 +559,9 @@ typedef enum {
PK_LICENSE_ENUM_MIROS,
PK_LICENSE_ENUM_MIT,
PK_LICENSE_ENUM_MIT_WITH_ADVERTISING,
+ PK_LICENSE_ENUM_MOD_MACRO,
PK_LICENSE_ENUM_MOTOSOTO,
+ PK_LICENSE_ENUM_MPLUS,
PK_LICENSE_ENUM_MPLV1_DOT_0,
PK_LICENSE_ENUM_MPLV1_DOT_1,
PK_LICENSE_ENUM_MS_PL,
@@ -568,6 +575,7 @@ typedef enum {
PK_LICENSE_ENUM_NOSL,
PK_LICENSE_ENUM_NOWEB,
PK_LICENSE_ENUM_OAL,
+ PK_LICENSE_ENUM_OFL,
PK_LICENSE_ENUM_OFSFDL,
PK_LICENSE_ENUM_OPENLDAP,
PK_LICENSE_ENUM_OPENPBS,
@@ -599,6 +607,7 @@ typedef enum {
PK_LICENSE_ENUM_SLIB,
PK_LICENSE_ENUM_SNIA,
PK_LICENSE_ENUM_SPL,
+ PK_LICENSE_ENUM_STIX,
PK_LICENSE_ENUM_TCL,
PK_LICENSE_ENUM_TMATE,
PK_LICENSE_ENUM_TPL,
@@ -608,11 +617,14 @@ typedef enum {
PK_LICENSE_ENUM_VOSTROM,
PK_LICENSE_ENUM_VSL,
PK_LICENSE_ENUM_W3C,
+ PK_LICENSE_ENUM_WADALAB,
PK_LICENSE_ENUM_WEBMIN,
PK_LICENSE_ENUM_WTFPL,
PK_LICENSE_ENUM_WXWIDGETS,
+ PK_LICENSE_ENUM_XANO,
PK_LICENSE_ENUM_XEROX,
PK_LICENSE_ENUM_XINETD,
+ PK_LICENSE_ENUM_XSKAT,
PK_LICENSE_ENUM_YPLV1_DOT_1,
PK_LICENSE_ENUM_ZEND,
PK_LICENSE_ENUM_ZLIB,
commit 401294b62fb340982162ac594e83342cef01da6b
Author: Richard Hughes <richard at hughsie.com>
Date: Mon Nov 30 09:33:27 2009 +0000
Fix up the free license checker to include the free font licenses too
diff --git a/tools/pk-refresh-licenses.c b/tools/pk-refresh-licenses.c
index 002b6fb..b0345e7 100644
--- a/tools/pk-refresh-licenses.c
+++ b/tools/pk-refresh-licenses.c
@@ -22,6 +22,7 @@
#include <stdlib.h>
#include <math.h>
#include <glib/gi18n.h>
+#include <glib/gstdio.h>
typedef struct {
gchar *enum_name;
@@ -71,6 +72,39 @@ pk_refresh_licenses_compare_func (gconstpointer a, gconstpointer b)
}
/**
+ * pk_refresh_licenses_get_data:
+ **/
+static gchar *
+pk_refresh_licenses_get_data (const gchar *url)
+{
+ gchar *command;
+ gboolean ret;
+ GError *error = NULL;
+ gchar *contents = NULL;
+
+ /* get file */
+ command = g_strdup_printf ("wget \"%s&action=edit\" --output-document=./Licensing.wiki", url);
+ ret = g_spawn_command_line_sync (command, NULL, NULL, NULL, &error);
+ if (!ret) {
+ g_warning ("failed to download file: %s", error->message);
+ g_error_free (error);
+ goto out;
+ }
+
+ /* get contents */
+ ret = g_file_get_contents ("./Licensing.wiki", &contents, NULL, &error);
+ if (!ret) {
+ g_warning ("failed to get contents: %s", error->message);
+ g_error_free (error);
+ goto out;
+ }
+out:
+ g_unlink ("./Licensing.wiki");
+ g_free (command);
+ return contents;
+}
+
+/**
* main:
**/
int
@@ -79,8 +113,8 @@ main (int argc, char *argv[])
gboolean ret;
gint retval = EXIT_FAILURE;
GError *error = NULL;
- const gchar *command;
- gchar *contents = NULL;
+ gchar *contents_tmp = NULL;
+ GString *contents;
gchar **lines = NULL;
gchar **parts;
guint i, j;
@@ -94,29 +128,26 @@ main (int argc, char *argv[])
GString *string_c = NULL;
PkRefreshLicenseItem *item;
PkRefreshLicenseItem *item_tmp;
-
- /* get file */
- command = "wget \"https://fedoraproject.org/w/index.php?title=Licensing:Main&action=edit\" --output-document=./Licensing.wiki";
- ret = g_spawn_command_line_sync (command, NULL, NULL, NULL, &error);
- if (!ret) {
- g_warning ("failed to download file: %s", error->message);
- g_error_free (error);
- goto out;
- }
-
- /* get contents */
- ret = g_file_get_contents ("./Licensing.wiki", &contents, NULL, &error);
- if (!ret) {
- g_warning ("failed to get contents: %s", error->message);
- g_error_free (error);
- goto out;
+ const gchar *locations[] = {
+ "https://fedoraproject.org/w/index.php?title=Licensing:Main",
+ "https://fedoraproject.org/w/index.php?title=Licensing:Fonts/Preferred",
+ "https://fedoraproject.org/w/index.php?title=Licensing:Fonts/Good",
+ NULL };
+
+ /* get all the data from several sources */
+ contents = g_string_new ("");
+ for (i=0; locations[i] != NULL; i++) {
+ g_print ("GETTING: %s\n", locations[i]);
+ contents_tmp = pk_refresh_licenses_get_data (locations[i]);
+ g_string_append (contents, contents_tmp);
+ g_free (contents_tmp);
}
/* output arrays */
data = g_ptr_array_new ();
/* split into lines */
- lines = g_strsplit (contents, "\n", -1);
+ lines = g_strsplit (contents->str, "\n", -1);
for (i=0; lines[i] != NULL; i++) {
if (lines[i][0] != '|') {
fullname = -1;
@@ -282,7 +313,7 @@ out:
g_string_free (string_c, TRUE);
if (data != NULL)
g_ptr_array_unref (data);
- g_free (contents);
+ g_string_free (contents, TRUE);
g_strfreev (lines);
return retval;
}
commit d6b606f1ba06c9e9ccd10b1c50935e6c3ada0aae
Author: Richard Hughes <richard at hughsie.com>
Date: Mon Nov 30 09:06:07 2009 +0000
trivial: make the egg debug code more useful when using the environment variables
diff --git a/src/egg-debug.c b/src/egg-debug.c
index 77bfa20..f734ee2 100644
--- a/src/egg-debug.c
+++ b/src/egg-debug.c
@@ -122,6 +122,24 @@ egg_debug_filter_function (const gchar *function)
}
/**
+ * egg_debug_is_console:
+ *
+ * Returns: TRUE if we are on a console
+ **/
+static gboolean
+egg_debug_is_console (void)
+{
+ /* local first */
+ if (_console)
+ return TRUE;
+
+ /* fall back to env variable */
+ if (g_getenv ("CONSOLE") != NULL)
+ return TRUE;
+ return FALSE;
+}
+
+/**
* egg_debug_set_console_mode:
**/
static void
@@ -130,7 +148,7 @@ egg_debug_set_console_mode (guint console_code)
gchar command[13];
/* don't put extra commands into logs */
- if (!_console)
+ if (!egg_debug_is_console ())
return;
/* Command is the control command to the terminal */
@@ -232,6 +250,24 @@ egg_debug_print_line (const gchar *func, const gchar *file, const int line, cons
}
/**
+ * egg_debug_is_verbose:
+ *
+ * Returns: TRUE if we have debugging enabled
+ **/
+gboolean
+egg_debug_is_verbose (void)
+{
+ /* local first */
+ if (_verbose)
+ return TRUE;
+
+ /* fall back to env variable */
+ if (g_getenv ("VERBOSE") != NULL)
+ return TRUE;
+ return FALSE;
+}
+
+/**
* egg_debug_real:
**/
void
@@ -240,7 +276,7 @@ egg_debug_real (const gchar *func, const gchar *file, const int line, const gcha
va_list args;
gchar *buffer = NULL;
- if (!_verbose && !egg_debug_filter_module (file) && !egg_debug_filter_function (func))
+ if (!egg_debug_is_verbose () && !egg_debug_filter_module (file) && !egg_debug_filter_function (func))
return;
va_start (args, format);
@@ -261,7 +297,7 @@ egg_warning_real (const gchar *func, const gchar *file, const int line, const gc
va_list args;
gchar *buffer = NULL;
- if (!_verbose && !egg_debug_filter_module (file) && !egg_debug_filter_function (func))
+ if (!egg_debug_is_verbose () && !egg_debug_filter_module (file) && !egg_debug_filter_function (func))
return;
va_start (args, format);
@@ -269,7 +305,7 @@ egg_warning_real (const gchar *func, const gchar *file, const int line, const gc
va_end (args);
/* do extra stuff for a warning */
- if (!_console)
+ if (!egg_debug_is_console ())
printf ("*** WARNING ***\n");
egg_debug_print_line (func, file, line, buffer, CONSOLE_RED);
@@ -290,7 +326,7 @@ egg_error_real (const gchar *func, const gchar *file, const int line, const gcha
va_end (args);
/* do extra stuff for a warning */
- if (!_console)
+ if (!egg_debug_is_console ())
printf ("*** ERROR ***\n");
egg_debug_print_line (func, file, line, buffer, CONSOLE_RED);
g_free (buffer);
@@ -302,17 +338,6 @@ egg_error_real (const gchar *func, const gchar *file, const int line, const gcha
}
/**
- * egg_debug_is_verbose:
- *
- * Returns: TRUE if we have debugging enabled
- **/
-gboolean
-egg_debug_is_verbose (void)
-{
- return _verbose;
-}
-
-/**
* egg_debug_set_log_filename:
**/
void
@@ -357,7 +382,6 @@ out:
static gboolean
egg_debug_pre_parse_hook (GOptionContext *context, GOptionGroup *group, gpointer data, GError **error)
{
- const gchar *env_string;
const GOptionEntry main_entries[] = {
{ "verbose", 'v', 0, G_OPTION_ARG_NONE, &_verbose,
/* TRANSLATORS: turn on all debugging */
@@ -365,11 +389,6 @@ egg_debug_pre_parse_hook (GOptionContext *context, GOptionGroup *group, gpointer
{ NULL}
};
- /* global variable */
- env_string = g_getenv ("VERBOSE");
- if (env_string != NULL)
- _verbose = TRUE;
-
/* add main entry */
g_option_context_add_main_entries (context, main_entries, NULL);
commit 4fb54a5c0da723400db5328e6293221f349114fa
Author: Richard Hughes <richard at hughsie.com>
Date: Mon Nov 30 09:05:39 2009 +0000
yum: protect against yum, rpm and glibc from being removd manually or as deps in RemovePackages()
diff --git a/backends/yum/yumBackend.py b/backends/yum/yumBackend.py
index 823fc72..dcdafac 100755
--- a/backends/yum/yumBackend.py
+++ b/backends/yum/yumBackend.py
@@ -2138,6 +2138,22 @@ class PackageKitYumBackend(PackageKitBaseBackend, PackagekitPackage):
if pkg and not inst:
self.error(ERROR_PACKAGE_NOT_INSTALLED, "The package %s is not installed" % pkg.name)
if txmbrs:
+ # check to find any system packages
+ try:
+ rc, msgs = self.yumbase.buildTransaction()
+ except yum.Errors.RepoError, e:
+ self.error(ERROR_REPO_NOT_AVAILABLE, _to_unicode(e))
+ except Exception, e:
+ self.error(ERROR_INTERNAL_ERROR, _format_str(traceback.format_exc()))
+ if rc != 2:
+ self.error(ERROR_DEP_RESOLUTION_FAILED, _format_msgs(msgs))
+ else:
+ for txmbr in self.yumbase.tsInfo:
+ pkg = txmbr.po
+ system_packages = ['yum','rpm', 'glibc']
+ if pkg.name in system_packages:
+ self.error(ERROR_CANNOT_REMOVE_SYSTEM_PACKAGE, "The package %s is essential to correct operation and cannot be removed using this tool." % pkg.name, exit=False)
+ return
try:
if not allowdep:
self._runYumTransaction(allow_remove_deps=False)
commit a5837c3e9cd7ae6ea62d3270b21d5e8a00a02779
Author: Daniel Nicoletti <dantti85-pk at yahoo.com.br>
Date: Fri Nov 27 17:23:44 2009 -0200
packagekit-qt: Oops forgot to return the transaction in searchFile
diff --git a/lib/packagekit-qt/src/client.cpp b/lib/packagekit-qt/src/client.cpp
index abc0013..e3577be 100644
--- a/lib/packagekit-qt/src/client.cpp
+++ b/lib/packagekit-qt/src/client.cpp
@@ -426,7 +426,7 @@ Transaction* Client::searchFile(const QString& search, Filters filters)
Transaction* Client::searchFile(const QStringList& search, Filters filters)
{
- searchFile(search.join("&"), filters);
+ return searchFile(search.join("&"), filters);
}
Transaction* Client::searchDetails(const QString& search, Filters filters)
commit 8b39d9c73079ca52441df41c92c3b2c6c48772de
Author: Daniel Nicoletti <dantti85-pk at yahoo.com.br>
Date: Fri Nov 27 16:53:29 2009 -0200
packagekit-qt: added support to what provides with a QStringList
diff --git a/lib/packagekit-qt/src/client.cpp b/lib/packagekit-qt/src/client.cpp
index 9cd8a8c..abc0013 100644
--- a/lib/packagekit-qt/src/client.cpp
+++ b/lib/packagekit-qt/src/client.cpp
@@ -526,6 +526,11 @@ Transaction* Client::whatProvides(ProvidesType type, const QString& search, Filt
RUN_TRANSACTION(WhatProvides(Util::filtersToString(filters), Util::enumToString<Client>(type, "ProvidesType", "Provides"), search))
}
+Transaction* Client::whatProvides(ProvidesType type, const QStringList& search, Filters filters)
+{
+ return whatProvides(type, search.join("&"), filters);
+}
+
void Client::setLastError (DaemonError e)
{
d->error = e;
diff --git a/lib/packagekit-qt/src/client.h b/lib/packagekit-qt/src/client.h
index 8921257..377fcfe 100644
--- a/lib/packagekit-qt/src/client.h
+++ b/lib/packagekit-qt/src/client.h
@@ -838,6 +838,7 @@ public:
* Searchs for a package providing a file/a mimetype
*/
Transaction* whatProvides(ProvidesType type, const QString& search, Filters filters = NoFilter);
+ Transaction* whatProvides(ProvidesType type, const QStringList& search, Filters filters = NoFilter);
Q_SIGNALS:
/**
More information about the PackageKit-commit
mailing list