[PackageKit-commit] packagekit: Branch 'master' - 9 commits
Richard Hughes
hughsient at kemper.freedesktop.org
Mon May 5 09:09:52 PDT 2008
backends/alpm/pk-backend-alpm.c | 1492 ++++++++++++++++++-------------------
backends/dummy/pk-backend-dummy.c | 7
backends/pisi/pk-backend-pisi.c | 10
backends/yum/helpers/yumBackend.py | 15
backends/zypp/zypp-utils.cpp | 17
docs/html/pk-faq.html | 47 -
po/pl.po | 223 +----
src/pk-interface-transaction.xml | 2
8 files changed, 877 insertions(+), 936 deletions(-)
New commits:
commit fb357a344ab25ea468fa6983c5e75d634a777279
Merge: 81842db... 34368f7...
Author: Valeriy Lyasotskiy <onestep at ukr.net>
Date: Mon May 5 18:10:41 2008 +0300
Merge branch 'master' of git+ssh://onestep_ua@git.packagekit.org/srv/git/PackageKit
commit 81842db5a4a5720c973a31dc81bc53a82047a8a9
Author: Valeriy Lyasotskiy <onestep at ukr.net>
Date: Mon May 5 18:10:11 2008 +0300
fixes for refresh_cache, partially reformatted to follow the coding standards
diff --git a/backends/alpm/pk-backend-alpm.c b/backends/alpm/pk-backend-alpm.c
index 578cf6c..8e54dc9 100644
--- a/backends/alpm/pk-backend-alpm.c
+++ b/backends/alpm/pk-backend-alpm.c
@@ -50,264 +50,253 @@ PkBackend *install_backend = NULL;
typedef struct _PackageSource
{
- pmpkg_t *pkg;
- gchar *repo;
- guint installed;
+ pmpkg_t *pkg;
+ gchar *repo;
+ guint installed;
} PackageSource;
void
package_source_free (PackageSource *source)
{
- alpm_pkg_free (source->pkg);
+ alpm_pkg_free (source->pkg);
}
void
cb_trans_evt (pmtransevt_t event, void *data1, void *data2)
{
- // TODO: Add code here
+ // TODO: Add code here
}
void
cb_trans_conv (pmtransconv_t conv, void *data1, void *data2, void *data3, int *response)
{
- // TODO: Add code here
+ // TODO: Add code here
}
void
cb_trans_progress (pmtransprog_t event, const char *pkgname, int percent, int howmany, int remain)
{
- pk_debug ("Percentage is %i", percent);
- pk_backend_set_percentage ((PkBackend *) install_backend, percent);
+ pk_debug ("alpm: percentage is %i", percent);
+ // pk_backend_set_percentage ((PkBackend *) install_backend, percent);
}
void
cb_dl_progress (const char *filename, int file_xfered, int file_total, int list_xfered, int list_total)
{
- int percent = (int) ((float) file_xfered / (float) file_total) * 100;
- pk_debug ("Percentage is %i", percent);
- pk_backend_set_percentage ((PkBackend *) install_backend, percent);
+ int percent = (int) ((float) file_xfered / (float) file_total) * 100;
+ pk_debug ("alpm: percentage is %i", percent);
+ // pk_backend_set_percentage ((PkBackend *) install_backend, percent);
}
gboolean
update_subprogress (void *data)
{
- if (subprogress_percentage == -1)
- return FALSE;
+ if (subprogress_percentage == -1)
+ return FALSE;
- pk_debug ("alpm: subprogress is %i", subprogress_percentage);
+ pk_debug ("alpm: subprogress is %i", subprogress_percentage);
- pk_backend_set_percentage ((PkBackend *) data, subprogress_percentage);
- return TRUE;
+ pk_backend_set_percentage ((PkBackend *) data, subprogress_percentage);
+ return TRUE;
}
gboolean
update_progress (void *data)
{
- if (progress_percentage == -1)
- return FALSE;
+ if (progress_percentage == -1)
+ return FALSE;
- pk_backend_set_percentage ((PkBackend *) data, progress_percentage);
- return TRUE;
+ pk_backend_set_percentage ((PkBackend *) data, progress_percentage);
+ return TRUE;
}
gpointer
state_notify (void *backend)
{
- g_timeout_add (300, update_subprogress, backend);
- return backend;
+ g_timeout_add (300, update_subprogress, backend);
+ return backend;
}
alpm_list_t *
my_list_remove_node (alpm_list_t *node)
{
- if (!node)
- return (NULL);
+ if (!node)
+ return (NULL);
- alpm_list_t *ret = NULL;
+ alpm_list_t *ret = NULL;
- if (node->prev) {
- node->prev->next = node->next;
- ret = node->prev;
- //node->prev = NULL;
- }
+ if (node->prev) {
+ node->prev->next = node->next;
+ ret = node->prev;
+ //node->prev = NULL;
+ }
- if (node->next) {
- node->next->prev = node->prev;
- ret = node->next;
- node->next = NULL;
- }
+ if (node->next) {
+ node->next->prev = node->prev;
+ ret = node->next;
+ node->next = NULL;
+ }
- return (ret);
+ return (ret);
}
gboolean
pkg_equal (pmpkg_t *p1, pmpkg_t *p2)
{
/*
- pk_debug (alpm_pkg_get_name (p1));
- pk_debug (alpm_pkg_get_name (p2));
+ pk_debug (alpm_pkg_get_name (p1));
+ pk_debug (alpm_pkg_get_name (p2));
*/
- if (strcmp (alpm_pkg_get_name (p1), alpm_pkg_get_name (p2)) != 0)
- return FALSE;
- if (strcmp (alpm_pkg_get_version (p1), alpm_pkg_get_version (p2)) != 0)
- return FALSE;
- return TRUE;
+ if (strcmp (alpm_pkg_get_name (p1), alpm_pkg_get_name (p2)) != 0)
+ return FALSE;
+ if (strcmp (alpm_pkg_get_version (p1), alpm_pkg_get_version (p2)) != 0)
+ return FALSE;
+ return TRUE;
}
gboolean
pkg_equals_to (pmpkg_t *pkg, const gchar *name, const gchar *version)
{
- if (strcmp (alpm_pkg_get_name (pkg), name) != 0)
- return FALSE;
- if (version != NULL)
- if (strcmp (alpm_pkg_get_version (pkg), version) != 0)
- return FALSE;
- return TRUE;
+ if (strcmp (alpm_pkg_get_name (pkg), name) != 0)
+ return FALSE;
+ if (version != NULL)
+ if (strcmp (alpm_pkg_get_version (pkg), version) != 0)
+ return FALSE;
+ return TRUE;
}
static void
add_package (PkBackend *backend, PackageSource *package)
{
- pk_debug ("add_package: hi, package_name=%s", alpm_pkg_get_name(package->pkg));
+ pk_debug ("add_package: hi, package_name=%s", alpm_pkg_get_name(package->pkg));
- PkInfoEnum info;
- gchar *pkg_string;
- gchar *arch = (gchar *) alpm_pkg_get_arch (package->pkg);
+ PkInfoEnum info;
+ gchar *pkg_string;
+ gchar *arch = (gchar *) alpm_pkg_get_arch (package->pkg);
- if (arch == NULL)
- arch = "unknown";
+ if (arch == NULL)
+ arch = "unknown";
- pkg_string = pk_package_id_build (alpm_pkg_get_name (package->pkg), alpm_pkg_get_version (package->pkg), arch, package->repo);
- if (package->installed)
- info = PK_INFO_ENUM_INSTALLED;
- else
- info = PK_INFO_ENUM_AVAILABLE;
- pk_backend_package (backend, info, pkg_string, alpm_pkg_get_desc (package->pkg));
+ pkg_string = pk_package_id_build (alpm_pkg_get_name (package->pkg), alpm_pkg_get_version (package->pkg), arch, package->repo);
+ if (package->installed)
+ info = PK_INFO_ENUM_INSTALLED;
+ else
+ info = PK_INFO_ENUM_AVAILABLE;
+ pk_backend_package (backend, info, pkg_string, alpm_pkg_get_desc (package->pkg));
- g_free(pkg_string);
+ g_free(pkg_string);
}
static void
add_packages_from_list (PkBackend *backend, alpm_list_t *list)
{
- PackageSource *package = NULL;
- alpm_list_t *li = NULL;
+ PackageSource *package = NULL;
+ alpm_list_t *li = NULL;
- if (list == NULL)
- pk_warning ("add_packages_from_list: list is empty!");
+ if (list == NULL)
+ pk_warning ("add_packages_from_list: list is empty!");
- for (li = list; li != NULL; li = alpm_list_next (li)) {
- package = (PackageSource *) li->data;
- add_package (backend, package);
- }
+ for (li = list; li != NULL; li = alpm_list_next (li)) {
+ package = (PackageSource *) li->data;
+ add_package (backend, package);
+ }
}
alpm_list_t *
find_packages_by_desc (const gchar *name, pmdb_t *db)
{
- if (db == NULL || name == NULL)
- return NULL;
-
- alpm_list_t *result = NULL;
-
- // determine if repository is local
- gboolean repo_is_local = (db == alpm_option_get_localdb ());
- // determine repository name
- const gchar *repo = alpm_db_get_name (db);
- // set search term
- alpm_list_t *needle = NULL;
- needle = alpm_list_add (needle, (gchar *) name);
- // execute query
- alpm_list_t *query_result = alpm_db_search (db, needle);
-
- alpm_list_t *iterator;
- for (iterator = query_result; iterator; iterator = alpm_list_next (iterator)) {
- PackageSource *source = g_malloc (sizeof (PackageSource));
-
- source->pkg = (pmpkg_t *) alpm_list_getdata (iterator);
- source->repo = (gchar *) repo;
- source->installed = repo_is_local;
-
- result = alpm_list_add (result, (PackageSource *) source);
- }
-
- alpm_list_free (query_result);
- alpm_list_free (needle);
- return result;
+ if (db == NULL || name == NULL)
+ return NULL;
+
+ alpm_list_t *result = NULL;
+
+ // determine if repository is local
+ gboolean repo_is_local = (db == alpm_option_get_localdb ());
+ // determine repository name
+ const gchar *repo = alpm_db_get_name (db);
+ // set search term
+ alpm_list_t *needle = NULL;
+ needle = alpm_list_add (needle, (gchar *) name);
+ // execute query
+ alpm_list_t *query_result = alpm_db_search (db, needle);
+
+ alpm_list_t *iterator;
+ for (iterator = query_result; iterator; iterator = alpm_list_next (iterator)) {
+ PackageSource *source = g_malloc (sizeof (PackageSource));
+
+ source->pkg = (pmpkg_t *) alpm_list_getdata (iterator);
+ source->repo = (gchar *) repo;
+ source->installed = repo_is_local;
+
+ result = alpm_list_add (result, (PackageSource *) source);
+ }
+
+ alpm_list_free (query_result);
+ alpm_list_free (needle);
+ return result;
}
alpm_list_t *
find_packages_by_name (const gchar *name, pmdb_t *db)
{
- if (db == NULL || name == NULL)
- return NULL;
+ if (db == NULL || name == NULL)
+ return NULL;
- alpm_list_t *result = NULL;
+ alpm_list_t *result = NULL;
- // determine if repository is local
- gboolean repo_is_local = (db == alpm_option_get_localdb ());
- // determine repository name
- const gchar *repo = alpm_db_get_name (db);
- // get list of packages in repository
- alpm_list_t *cache = alpm_db_getpkgcache (db);
+ // determine if repository is local
+ gboolean repo_is_local = (db == alpm_option_get_localdb ());
+ // determine repository name
+ const gchar *repo = alpm_db_get_name (db);
+ // get list of packages in repository
+ alpm_list_t *cache = alpm_db_getpkgcache (db);
- alpm_list_t *iterator;
- for (iterator = cache; iterator; iterator = alpm_list_next (iterator)) {
- pmpkg_t *pkg = alpm_list_getdata (iterator);
+ alpm_list_t *iterator;
+ for (iterator = cache; iterator; iterator = alpm_list_next (iterator)) {
+ pmpkg_t *pkg = alpm_list_getdata (iterator);
- if (strstr (alpm_pkg_get_name (pkg), name)) {
- PackageSource *source = g_malloc (sizeof (PackageSource));
+ if (strstr (alpm_pkg_get_name (pkg), name)) {
+ PackageSource *source = g_malloc (sizeof (PackageSource));
- source->pkg = (pmpkg_t *) pkg;
- source->repo = (gchar *) repo;
- source->installed = repo_is_local;
+ source->pkg = (pmpkg_t *) pkg;
+ source->repo = (gchar *) repo;
+ source->installed = repo_is_local;
- result = alpm_list_add (result, (PackageSource *) source);
+ result = alpm_list_add (result, (PackageSource *) source);
+ }
}
- }
- return result;
+ return result;
}
gboolean
pkg_is_installed (const gchar *name, const gchar *version)
{
- pmdb_t *localdb = NULL;
- alpm_list_t *result = NULL;
+ pmdb_t *localdb = NULL;
+ alpm_list_t *result = NULL;
- if (name == NULL)
- return FALSE;
- localdb = alpm_option_get_localdb ();
- if (localdb == NULL)
- return FALSE;
+ if (name == NULL)
+ return FALSE;
- result = find_packages_by_desc (name, localdb);
- if (result == NULL)
- return FALSE;
- if (!alpm_list_count (result))
- return FALSE;
+ localdb = alpm_option_get_localdb ();
+ if (localdb == NULL)
+ return FALSE;
- if (version == NULL)
- return TRUE;
+ result = find_packages_by_desc (name, localdb);
+ if (result == NULL)
+ return FALSE;
+ if (!alpm_list_count (result))
+ return FALSE;
- alpm_list_t *icmp = NULL;
- for (icmp = result; icmp; icmp = alpm_list_next (icmp))
- if (strcmp (alpm_pkg_get_version ((pmpkg_t *) icmp->data), version) == 0)
- return TRUE;
+ if (version == NULL)
+ return TRUE;
- return FALSE;
-}
-
-/**
- * backend_destroy:
- */
-static void
-backend_destroy (PkBackend *backend)
-{
- g_return_if_fail (backend != NULL);
+ alpm_list_t *icmp = NULL;
+ for (icmp = result; icmp; icmp = alpm_list_next (icmp))
+ if (strcmp (alpm_pkg_get_version ((pmpkg_t *) icmp->data), version) == 0)
+ return TRUE;
- if (alpm_release () == -1)
- pk_backend_error_code (backend, PK_ERROR_ENUM_FAILED_FINALISE, "Failed to release control");
+ return FALSE;
}
/**
@@ -317,30 +306,30 @@ backend_destroy (PkBackend *backend)
char *
strtrim (char *str)
{
- char *pch = str;
+ char *pch = str;
- if (str == NULL || *str == '\0')
- /* string is empty, so we're done. */
- return (str);
+ if (str == NULL || *str == '\0')
+ /* string is empty, so we're done. */
+ return (str);
- while (isspace (*pch))
- pch++;
+ while (isspace (*pch))
+ pch++;
- if (pch != str)
- memmove (str, pch, (strlen (pch) + 1));
+ if (pch != str)
+ memmove (str, pch, (strlen (pch) + 1));
- /* check if there wasn't anything but whitespace in the string. */
- if (*str == '\0')
- return (str);
+ /* check if there wasn't anything but whitespace in the string. */
+ if (*str == '\0')
+ return (str);
- pch = (str + (strlen (str) - 1));
+ pch = (str + (strlen (str) - 1));
- while (isspace (*pch))
- pch--;
+ while (isspace (*pch))
+ pch--;
- *++pch = '\0';
+ *++pch = '\0';
- return (str);
+ return (str);
}
/**
@@ -350,12 +339,12 @@ strtrim (char *str)
static void
_strnadd(char **str, const char *append, unsigned int count)
{
- if (*str)
- *str = realloc (*str, strlen (*str) + count + 1);
- else
- *str = calloc (sizeof (char), count + 1);
+ if (*str)
+ *str = realloc (*str, strlen (*str) + count + 1);
+ else
+ *str = calloc (sizeof (char), count + 1);
- strncat(*str, append, count);
+ strncat(*str, append, count);
}
/**
@@ -366,33 +355,35 @@ _strnadd(char **str, const char *append, unsigned int count)
char *
strreplace(const char *str, const char *needle, const char *replace)
{
- const char *p, *q;
- p = q = str;
-
- char *newstr = NULL;
- unsigned int needlesz = strlen (needle), replacesz = strlen (replace);
-
- while (1) {
- q = strstr(p, needle);
- if (!q) {
- /* not found */
- if (*p) /* add the rest of 'p' */
- _strnadd(&newstr, p, strlen(p));
-
- break;
- } else { /* found match */
- if (q > p) /* add chars between this occurance and last occurance, if any */
- _strnadd(&newstr, p, q - p);
-
- _strnadd(&newstr, replace, replacesz);
- p = q + needlesz;
- }
- }
-
- return newstr;
+ const char *p, *q;
+ p = q = str;
+
+ char *newstr = NULL;
+ unsigned int needlesz = strlen (needle), replacesz = strlen (replace);
+
+ while (1) {
+ q = strstr(p, needle);
+ if (!q) {
+ /* not found */
+ if (*p) /* add the rest of 'p' */
+ _strnadd(&newstr, p, strlen(p));
+
+ break;
+ } else { /* found match */
+ if (q > p) /* add chars between this occurance and last occurance, if any */
+ _strnadd(&newstr, p, q - p);
+
+ _strnadd(&newstr, replace, replacesz);
+ p = q + needlesz;
+ }
+ }
+
+ return newstr;
}
-/** Add repeating options such as NoExtract, NoUpgrade, etc to alpm settings.
+/**
+ * set_repeating_option:
+ * Add repeating options such as NoExtract, NoUpgrade, etc to alpm settings.
* @param ptr a pointer to the start of the multiple options
* @param option the string (friendly) name of the option, used for messages
* @param optionfunc a function pointer to an alpm_option_add_* function
@@ -400,179 +391,180 @@ strreplace(const char *str, const char *needle, const char *replace)
static void
set_repeating_option(const char *ptr, const char *option, void (*optionfunc) (const char*))
{
- char *p = (char*) ptr;
- char *q;
-
- while ((q = strchr(p, ' '))) {
- *q = '\0';
+ char *p = (char*) ptr;
+ char *q;
+
+ while ((q = strchr (p, ' '))) {
+ *q = '\0';
+ (*optionfunc) (p);
+ pk_debug ("config: %s: %s", option, p);
+ p = q;
+ p++;
+ }
(*optionfunc) (p);
- pk_debug("config: %s: %s", option, p);
- p = q;
- p++;
- }
- (*optionfunc) (p);
- pk_debug("config: %s: %s", option, p);
+ pk_debug ("config: %s: %s", option, p);
}
/**
* parse_config:
* Parse config file and set all the needed options
* Based heavily on the pacman source code
+ * @param file full name of config file
+ * @param givensection section to start from
+ * @param givendb db to start from
*/
static int
parse_config (const char *file, const char *givensection, pmdb_t * const givendb)
{
- FILE *fp = NULL;
- char line[PATH_MAX + 1];
- int linenum = 0;
- char *ptr, *section = NULL;
- pmdb_t *db = NULL;
-
- /* set default options */
- alpm_option_set_root (ALPM_ROOT);
- alpm_option_set_dbpath (ALPM_DBPATH);
- alpm_option_add_cachedir (ALPM_CACHEDIR);
- alpm_option_set_logfile (ALPM_LOGFILE);
- alpm_option_set_xfercommand (ALPM_XFERCOMMAND);
-
- fp = fopen(file, "r");
- if (fp == NULL) {
- pk_error ("config file %s could not be read", file);
- return (1);
- }
-
- /* if we are passed a section, use it as our starting point */
- if (givensection != NULL) {
- section = strdup (givensection);
- }
- /* if we are passed a db, use it as our starting point */
- if (givendb != NULL) {
- db = givendb;
- }
-
- while (fgets (line, PATH_MAX, fp))
- {
- linenum++;
- strtrim(line);
-
- if (strlen (line) == 0 || line[0] == '#')
- continue;
-
- if ((ptr = strchr (line, '#')))
- *ptr = '\0';
-
- if (line[0] == '[' && line[strlen (line) - 1] == ']') {
- /* new config section, skip the '[' */
- ptr = line;
- ptr++;
- if (section)
- free (section);
-
- section = strdup (ptr);
- section[strlen (section) - 1] = '\0';
- pk_debug ("config: new section '%s'", section);
- if (!strlen (section)) {
- pk_debug ("config file %s, line %d: bad section name", file, linenum);
- return (1);
- }
-
- /* if we are not looking at the options section, register a db */
- if (strcmp (section, "options") != 0)
- db = alpm_db_register_sync (section);
- } else {
- /* directive */
- char *key;
- key = line;
- ptr = line;
- /* strsep modifies the 'line' string: 'key \0 ptr' */
- strsep (&ptr, "=");
- strtrim (key);
- strtrim (ptr);
-
- if (key == NULL) {
- pk_error ("config file %s, line %d: syntax error in config file - missing key.", file, linenum);
- return (1);
- }
- if (section == NULL) {
- pk_error ("config file %s, line %d: all directives must belong to a section.", file, linenum);
+ FILE *fp = NULL;
+ char line[PATH_MAX + 1];
+ int linenum = 0;
+ char *ptr, *section = NULL;
+ pmdb_t *db = NULL;
+
+ /* set default options */
+ alpm_option_set_root (ALPM_ROOT);
+ alpm_option_set_dbpath (ALPM_DBPATH);
+ alpm_option_add_cachedir (ALPM_CACHEDIR);
+ alpm_option_set_logfile (ALPM_LOGFILE);
+
+ fp = fopen(file, "r");
+ if (fp == NULL) {
+ pk_error ("config file %s could not be read", file);
return (1);
- }
-
- if (ptr == NULL && strcmp (section, "options") == 0) {
- /* directives without settings, all in [options] */
- if (strcmp (key, "NoPassiveFTP") == 0) {
- alpm_option_set_nopassiveftp (1);
- pk_debug ("config: nopassiveftp");
- } else if (strcmp (key, "UseSyslog") == 0) {
- alpm_option_set_usesyslog (1);
- pk_debug ("config: usesyslog");
- } else if (strcmp (key, "UseDelta") == 0) {
- alpm_option_set_usedelta (1);
- pk_debug ("config: usedelta");
- } else {
- pk_error ("config file %s, line %d: directive '%s' not recognized.", file, linenum, key);
- return(1);
- }
- } else {
- /* directives with settings */
- if (strcmp (key, "Include") == 0) {
- pk_debug ("config: including %s", ptr);
- parse_config(ptr, section, db);
- /* Ignore include failures... assume non-critical */
- } else if (strcmp (section, "options") == 0) {
- if (strcmp (key, "NoUpgrade") == 0) {
- set_repeating_option (ptr, "NoUpgrade", alpm_option_add_noupgrade);
- } else if (strcmp (key, "NoExtract") == 0) {
- set_repeating_option (ptr, "NoExtract", alpm_option_add_noextract);
- } else if (strcmp (key, "IgnorePkg") == 0) {
- set_repeating_option (ptr, "IgnorePkg", alpm_option_add_ignorepkg);
- } else if (strcmp (key, "IgnoreGroup") == 0) {
- set_repeating_option (ptr, "IgnoreGroup", alpm_option_add_ignoregrp);
- } else if (strcmp (key, "HoldPkg") == 0) {
- set_repeating_option (ptr, "HoldPkg", alpm_option_add_holdpkg);
- } else if (strcmp (key, "DBPath") == 0) {
- alpm_option_set_dbpath (ptr);
- } else if (strcmp (key, "CacheDir") == 0) {
- if (alpm_option_add_cachedir(ptr) != 0) {
- pk_error ("problem adding cachedir '%s' (%s)", ptr, alpm_strerrorlast ());
- return (1);
+ }
+
+ /* if we are passed a section, use it as our starting point */
+ if (givensection != NULL)
+ section = strdup (givensection);
+
+ /* if we are passed a db, use it as our starting point */
+ if (givendb != NULL)
+ db = givendb;
+
+ while (fgets (line, PATH_MAX, fp)) {
+ linenum++;
+ strtrim (line);
+
+ if (strlen (line) == 0 || line[0] == '#')
+ continue;
+
+ if ((ptr = strchr (line, '#')))
+ *ptr = '\0';
+
+ if (line[0] == '[' && line[strlen (line) - 1] == ']') {
+ /* new config section, skip the '[' */
+ ptr = line;
+ ptr++;
+ if (section)
+ free (section);
+
+ section = strdup (ptr);
+ section[strlen (section) - 1] = '\0';
+ pk_debug ("config: new section '%s'", section);
+ if (!strlen (section)) {
+ pk_debug ("config file %s, line %d: bad section name", file, linenum);
+ return (1);
}
- pk_debug ("config: cachedir: %s", ptr);
- } else if (strcmp (key, "RootDir") == 0) {
- alpm_option_set_root (ptr);
- pk_debug ("config: rootdir: %s", ptr);
- } else if (strcmp (key, "LogFile") == 0) {
- alpm_option_set_logfile (ptr);
- pk_debug ("config: logfile: %s", ptr);
- } else if (strcmp (key, "XferCommand") == 0) {
- alpm_option_set_xfercommand (ptr);
- pk_debug ("config: xfercommand: %s", ptr);
- } else {
- pk_error ("config file %s, line %d: directive '%s' not recognized.", file, linenum, key);
- return (1);
- }
- } else if (strcmp (key, "Server") == 0) {
- /* let's attempt a replacement for the current repo */
- char *server = strreplace (ptr, "$repo", section);
- if (alpm_db_setserver (db, server) != 0) {
- /* pm_errno is set by alpm_db_setserver */
- return (1);
- }
- free (server);
+
+ /* if we are not looking at the options section, register a db */
+ if (strcmp (section, "options") != 0)
+ db = alpm_db_register_sync (section);
} else {
- pk_error ("config file %s, line %d: directive '%s' not recognized.", file, linenum, key);
- return (1);
+ /* directive */
+ char *key;
+ key = line;
+ ptr = line;
+ /* strsep modifies the 'line' string: 'key \0 ptr' */
+ strsep (&ptr, "=");
+ strtrim (key);
+ strtrim (ptr);
+
+ if (key == NULL) {
+ pk_error ("config file %s, line %d: syntax error in config file - missing key.", file, linenum);
+ return (1);
+ }
+ if (section == NULL) {
+ pk_error ("config file %s, line %d: all directives must belong to a section.", file, linenum);
+ return (1);
+ }
+
+ if (ptr == NULL && strcmp (section, "options") == 0) {
+ /* directives without settings, all in [options] */
+ if (strcmp (key, "NoPassiveFTP") == 0) {
+ alpm_option_set_nopassiveftp (1);
+ pk_debug ("config: nopassiveftp");
+ } else if (strcmp (key, "UseSyslog") == 0) {
+ alpm_option_set_usesyslog (1);
+ pk_debug ("config: usesyslog");
+ } else if (strcmp (key, "UseDelta") == 0) {
+ alpm_option_set_usedelta (1);
+ pk_debug ("config: usedelta");
+ } else {
+ pk_error ("config file %s, line %d: directive '%s' not recognized.", file, linenum, key);
+ return(1);
+ }
+ } else {
+ /* directives with settings */
+ if (strcmp (key, "Include") == 0) {
+ pk_debug ("config: including %s", ptr);
+ parse_config(ptr, section, db);
+ /* Ignore include failures... assume non-critical */
+ } else if (strcmp (section, "options") == 0) {
+ if (strcmp (key, "NoUpgrade") == 0) {
+ set_repeating_option (ptr, "NoUpgrade", alpm_option_add_noupgrade);
+ } else if (strcmp (key, "NoExtract") == 0) {
+ set_repeating_option (ptr, "NoExtract", alpm_option_add_noextract);
+ } else if (strcmp (key, "IgnorePkg") == 0) {
+ set_repeating_option (ptr, "IgnorePkg", alpm_option_add_ignorepkg);
+ } else if (strcmp (key, "IgnoreGroup") == 0) {
+ set_repeating_option (ptr, "IgnoreGroup", alpm_option_add_ignoregrp);
+ } else if (strcmp (key, "HoldPkg") == 0) {
+ set_repeating_option (ptr, "HoldPkg", alpm_option_add_holdpkg);
+ } else if (strcmp (key, "DBPath") == 0) {
+ alpm_option_set_dbpath (ptr);
+ } else if (strcmp (key, "CacheDir") == 0) {
+ if (alpm_option_add_cachedir(ptr) != 0) {
+ pk_error ("problem adding cachedir '%s' (%s)", ptr, alpm_strerrorlast ());
+ return (1);
+ }
+ pk_debug ("config: cachedir: %s", ptr);
+ } else if (strcmp (key, "RootDir") == 0) {
+ alpm_option_set_root (ptr);
+ pk_debug ("config: rootdir: %s", ptr);
+ } else if (strcmp (key, "LogFile") == 0) {
+ alpm_option_set_logfile (ptr);
+ pk_debug ("config: logfile: %s", ptr);
+ } else if (strcmp (key, "XferCommand") == 0) {
+ alpm_option_set_xfercommand (ptr);
+ pk_debug ("config: xfercommand: %s", ptr);
+ } else {
+ pk_error ("config file %s, line %d: directive '%s' not recognized.", file, linenum, key);
+ return (1);
+ }
+ } else if (strcmp (key, "Server") == 0) {
+ /* let's attempt a replacement for the current repo */
+ char *server = strreplace (ptr, "$repo", section);
+
+ if (alpm_db_setserver (db, server) != 0) {
+ /* pm_errno is set by alpm_db_setserver */
+ return (1);
+ }
+ free (server);
+ } else {
+ pk_error ("config file %s, line %d: directive '%s' not recognized.", file, linenum, key);
+ return (1);
+ }
+ }
}
- }
}
- }
- fclose (fp);
- if (section)
- free (section);
+ fclose (fp);
+ if (section)
+ free (section);
- pk_debug ("config: finished parsing %s", file);
- return 0;
+ pk_debug ("config: finished parsing %s", file);
+ return 0;
}
/**
@@ -581,516 +573,524 @@ parse_config (const char *file, const char *givensection, pmdb_t * const givendb
static void
backend_initialize (PkBackend *backend)
{
- g_return_if_fail (backend != NULL);
- progress_percentage = -1;
- subprogress_percentage = -1;
- pk_debug ("alpm: hi!");
-
- if (alpm_initialize () == -1)
- {
- pk_backend_error_code (backend,
- PK_ERROR_ENUM_FAILED_INITIALIZATION,
- "Failed to initialize package manager");
- pk_debug ("alpm: %s", alpm_strerror (pm_errno));
- //return;
- }
-
- // Read options from config file
- if (parse_config (ALPM_CONFIG_PATH, NULL, NULL) != 0)
- {
- pk_backend_error_code (backend,
- PK_ERROR_ENUM_FAILED_CONFIG_PARSING,
- "Failed to parse config file");
- backend_destroy (backend);
- return;
- }
-
- if (alpm_db_register_local () == NULL)
- {
- pk_backend_error_code (backend,
- PK_ERROR_ENUM_FAILED_CONFIG_PARSING,
- "Failed to load local database");
- backend_destroy (backend);
- return;
- }
- pk_debug ("alpm: ready to go");
-
- alpm_option_set_dlcb(cb_dl_progress);
-}
+ g_return_if_fail (backend != NULL);
-/**
- * backend_install_package:
- */
-static void
-backend_install_package (PkBackend *backend, const gchar *package_id)
-{
- pk_debug ("hello %i", GPOINTER_TO_INT (backend));
- g_return_if_fail (backend != NULL);
-/*
- alpm_list_t *syncdbs = alpm_option_get_syncdbs ();
-*/
- alpm_list_t *result = NULL;
- alpm_list_t *problems = NULL;
- PkPackageId *id = pk_package_id_new_from_string (package_id);
- pmtransflag_t flags = 0;
- GThread *progress = NULL;
+ pk_debug ("alpm: hi!");
- flags |= PM_TRANS_FLAG_NODEPS;
-
- // Next generation code?
-/*
- for (; syncdbs; syncdbs = alpm_list_next (syncdbs))
- result = alpm_list_join (result, find_packages_by_desc (id->name, (pmdb_t *) syncdbs->data));
-
- if (result == NULL) {
- pk_backend_error_code (backend,
- PK_ERROR_ENUM_PACKAGE_ID_INVALID,
- "Package not found");
- pk_backend_finished (backend);
- alpm_list_free (result);
- alpm_list_free (syncdbs);
- pk_package_id_free (id);
- return;
- }
-
- for (; result; result = alpm_list_next (result))
- if (pkg_equals_to ((pmpkg_t *) result->data, id->name, id->version))
- break;
-
- if (!result) {
- pk_backend_error_code (backend,
- PK_ERROR_ENUM_PACKAGE_ID_INVALID,
- "Package not found");
- pk_backend_finished (backend);
- alpm_list_free (result);
- alpm_list_free (syncdbs);
- pk_package_id_free (id);
- return;
- }
-*/
+ if (alpm_initialize () == -1) {
+ pk_backend_error_code (backend, PK_ERROR_ENUM_FAILED_INITIALIZATION, "Failed to initialize package manager");
+ pk_debug ("alpm: %s", alpm_strerror (pm_errno));
+ return;
+ }
- if (alpm_trans_init (PM_TRANS_TYPE_SYNC, flags, cb_trans_evt, cb_trans_conv, cb_trans_progress) == -1) {
- pk_backend_error_code (backend,
- PK_ERROR_ENUM_TRANSACTION_ERROR,
- alpm_strerror (pm_errno));
- pk_backend_finished (backend);
- alpm_list_free (result);
- pk_package_id_free (id);
- return;
- }
+ /* read options from config file */
+ if (parse_config (ALPM_CONFIG_PATH, NULL, NULL) != 0) {
+ pk_backend_error_code (backend, PK_ERROR_ENUM_FAILED_CONFIG_PARSING, "Failed to parse config file");
+ alpm_release ();
+ return;
+ }
- pk_debug ("init");
+ if (alpm_db_register_local () == NULL) {
+ pk_backend_error_code (backend, PK_ERROR_ENUM_REPO_NOT_AVAILABLE, "Failed to load local database");
+ pk_debug ("alpm: %s", alpm_strerror (pm_errno));
+ alpm_release ();
+ return;
+ }
- alpm_trans_addtarget (id->name);
+ alpm_option_set_dlcb (cb_dl_progress);
- if (alpm_trans_prepare (&problems) != 0) {
- pk_backend_error_code (backend,
- PK_ERROR_ENUM_TRANSACTION_ERROR,
- alpm_strerror (pm_errno));
- pk_backend_finished (backend);
- alpm_trans_release ();
- alpm_list_free (result);
- pk_package_id_free (id);
- return;
- }
+ pk_debug ("alpm: ready to go");
+}
- pk_backend_package (backend, PK_INFO_ENUM_DOWNLOADING, package_id, "An HTML widget for GTK+ 2.0");
+/**
+ * backend_destroy:
+ */
+static void
+backend_destroy (PkBackend *backend)
+{
+ g_return_if_fail (backend != NULL);
- progress = g_thread_create (state_notify, (void *) backend, TRUE, NULL);
- install_backend = backend;
+ if (alpm_release () == -1) {
+ pk_backend_error_code (backend, PK_ERROR_ENUM_FAILED_FINALISE, "Failed to release package manager");
+ pk_debug ("alpm: %s", alpm_strerror (pm_errno));
+ }
+}
- if (alpm_trans_commit (&problems) != 0) {
- pk_backend_error_code (backend,
- PK_ERROR_ENUM_TRANSACTION_ERROR,
- alpm_strerror (pm_errno));
- pk_backend_finished (backend);
- alpm_trans_release ();
- alpm_list_free (result);
- pk_package_id_free (id);
- return;
- }
+/**
+ * backend_get_groups:
+ */
+static PkGroupEnum
+backend_get_groups (PkBackend *backend)
+{
+ g_return_val_if_fail (backend != NULL, PK_GROUP_ENUM_UNKNOWN);
- alpm_trans_release ();
- alpm_list_free (result);
- pk_package_id_free (id);
- pk_backend_finished (backend);
+ // TODO: Provide support for groups in alpm
+ return PK_GROUP_ENUM_OTHER;
}
/**
- * backend_update_packages:
+ * backend_get_filters:
*/
-static void
-backend_update_packages (PkBackend *backend, gchar **package_ids)
+static PkFilterEnum
+backend_get_filters (PkBackend *backend)
{
- /* TODO: process the entire list */
- backend_install_package (backend, package_ids[0]);
+ g_return_val_if_fail (backend != NULL, PK_FILTER_ENUM_UNKNOWN);
+
+ return PK_FILTER_ENUM_INSTALLED;
}
/**
- * backend_refresh_cache:
+ * backend_get_details:
*/
static void
-backend_refresh_cache (PkBackend *backend, gboolean force)
+backend_get_details (PkBackend *backend, const gchar *package_id)
{
- g_return_if_fail (backend != NULL);
+ g_return_if_fail (backend != NULL);
+
+ pk_backend_set_status (backend, PK_STATUS_ENUM_QUERY);
+ PkPackageId *pkg_id = pk_package_id_new_from_string (package_id);
+
+ /* do all this fancy stuff */
+ pmdb_t *repo = NULL;
+ if (strcmp ("local", pkg_id->data) == 0)
+ repo = alpm_option_get_localdb ();
+ else {
+ alpm_list_t *iterator;
+ for (iterator = alpm_option_get_syncdbs (); iterator; iterator = alpm_list_next (iterator)) {
+ repo = alpm_list_getdata (iterator);
+ if (strcmp (alpm_db_get_name (repo), pkg_id->data) == 0)
+ break;
+ }
+ }
- if (!pk_backend_is_online (backend)) {
- pk_backend_error_code (backend, PK_ERROR_ENUM_NO_NETWORK, "Cannot refresh cache whilst offline");
- pk_backend_finished (backend);
- return;
- }
+ if (repo == NULL) {
+ pk_backend_error_code (backend, PK_ERROR_ENUM_REPO_NOT_FOUND, alpm_strerror (pm_errno));
+ pk_package_id_free (pkg_id);
+ pk_backend_finished (backend);
+ return;
+ }
- pk_backend_set_status (backend, PK_STATUS_ENUM_REFRESH_CACHE);
+ pmpkg_t *pkg = alpm_db_get_pkg (repo, pkg_id->name);
- install_backend = backend;
- if (alpm_trans_init (PM_TRANS_TYPE_SYNC, PM_TRANS_FLAG_NOSCRIPTLET, cb_trans_evt, cb_trans_conv, cb_trans_progress) != 0) {
- pk_backend_error_code (backend, PK_ERROR_ENUM_TRANSACTION_ERROR, alpm_strerror (pm_errno));
- pk_backend_finished (backend);
- return;
- }
- pk_debug ("alpm: %s", "transaction initialized");
-
- alpm_list_t *dbs = alpm_option_get_syncdbs ();
- alpm_list_t *iterator;
- for (iterator = dbs; iterator; iterator = alpm_list_next (iterator)) {
- if (alpm_db_update (0, (pmdb_t *) alpm_list_getdata (iterator))) {
- pk_backend_error_code (backend, PK_ERROR_ENUM_TRANSACTION_ERROR, alpm_strerror (pm_errno));
- pk_backend_finished (backend);
- return;
+ /* free package id as we no longer need it */
+ pk_package_id_free (pkg_id);
+
+ gchar *licenses;
+ alpm_list_t *licenses_list = alpm_pkg_get_licenses (pkg);
+ if (licenses_list == NULL)
+ licenses = "unknown";
+ else {
+ licenses = g_strnfill(100, '\0');
+ alpm_list_t *iterator;
+ for (iterator = licenses_list; iterator; iterator = alpm_list_next (iterator)) {
+ if (iterator != licenses_list)
+ g_strlcat (licenses, ", ", 100);
+ g_strlcat (licenses, alpm_list_getdata (iterator), 100);
+ }
}
- }
- alpm_trans_release ();
- pk_backend_finished (backend);
+ pk_backend_details (backend, package_id, licenses, PK_GROUP_ENUM_OTHER, alpm_pkg_get_desc (pkg), alpm_pkg_get_url(pkg), alpm_pkg_get_size (pkg));
+ pk_backend_finished (backend);
}
/**
- * backend_resolve:
- * Currently works only for local packages
+ * backend_get_repo_list:
*/
-static void
-backend_resolve (PkBackend *backend, PkFilterEnum filters, const gchar *package)
+void
+backend_get_repo_list (PkBackend *backend, PkFilterEnum filters)
{
- g_return_if_fail (backend != NULL);
+ g_return_if_fail (backend != NULL);
- pk_backend_set_status (backend, PK_STATUS_ENUM_QUERY);
+ pk_backend_set_status (backend, PK_STATUS_ENUM_QUERY);
- pmdb_t *localdb = alpm_option_get_localdb ();
- // result will be the list of PackageSource
- alpm_list_t *result = find_packages_by_desc (package, localdb);
+ alpm_list_t *repos = alpm_option_get_syncdbs ();
+ if (repos == NULL)
+ pk_backend_error_code (backend, PK_ERROR_ENUM_INTERNAL_ERROR, alpm_strerror (pm_errno));
- if (result != NULL)
- pk_debug ("alpm: package %s found, trying to resolve...", package);
+ // Iterate on repository list
+ alpm_list_t *iterator;
+ for (iterator = repos; iterator; iterator = alpm_list_next(iterator)) {
+ pmdb_t *db = alpm_list_getdata (repos);
+ pk_backend_repo_detail (backend, alpm_db_get_name (db), alpm_db_get_name (db), TRUE);
+ repos = alpm_list_next (repos);
+ }
- if (result == NULL) {
- pk_backend_error_code (backend, PK_ERROR_ENUM_PACKAGE_NOT_INSTALLED, "Package is not installed");
- pk_backend_finished (backend);
- return;
- } else if (alpm_list_count (result) != 1 || strcmp (alpm_pkg_get_name (((PackageSource *) result->data)->pkg), package) != 0) {
- pk_backend_error_code (backend, PK_ERROR_ENUM_PACKAGE_NOT_INSTALLED, "Package is not installed");
pk_backend_finished (backend);
- alpm_list_free_inner (result, (alpm_list_fn_free) package_source_free);
- alpm_list_free (result);
- return;
- }
-
- pmpkg_t *pkg = ((PackageSource *) result->data)->pkg;
- pk_backend_package (backend, PK_INFO_ENUM_INSTALLED,
- pk_package_id_build (alpm_pkg_get_name (pkg), alpm_pkg_get_version (pkg), alpm_pkg_get_arch (pkg), "local"),
- alpm_pkg_get_desc (pkg));
-
- alpm_list_free_inner (result, (alpm_list_fn_free) package_source_free);
- alpm_list_free (result);
- pk_backend_finished (backend);
}
/**
- * backend_remove_package:
+ * backend_install_file:
*/
static void
-backend_remove_package (PkBackend *backend, const gchar *package_id, gboolean allow_deps, gboolean autoremove)
+backend_install_file (PkBackend *backend, gboolean trusted, const gchar *path)
{
- g_return_if_fail (backend != NULL);
+ g_return_if_fail (backend != NULL);
- PkPackageId *id = pk_package_id_new_from_string (package_id);
- pmtransflag_t flags = 0;
- alpm_list_t *problems = NULL;
+ alpm_list_t *problems = NULL;
+ if (alpm_trans_init (PM_TRANS_TYPE_ADD, 0, cb_trans_evt, cb_trans_conv, cb_trans_progress) == -1) {
+ pk_backend_error_code (backend, PK_ERROR_ENUM_TRANSACTION_ERROR, alpm_strerror (pm_errno));
+ pk_backend_finished (backend);
+ return;
+ }
- if (allow_deps)
- flags |= PM_TRANS_FLAG_CASCADE;
+ alpm_trans_addtarget ((char *) path);
- if (alpm_trans_init (PM_TRANS_TYPE_REMOVE, flags, cb_trans_evt, cb_trans_conv, cb_trans_progress) == -1) {
- pk_backend_error_code (backend, PK_ERROR_ENUM_TRANSACTION_ERROR, alpm_strerror (pm_errno));
- pk_backend_finished (backend);
- pk_package_id_free (id);
- return;
- }
+ if (alpm_trans_prepare (&problems) != 0) {
+ pk_backend_error_code (backend, PK_ERROR_ENUM_TRANSACTION_ERROR, alpm_strerror (pm_errno));
+ pk_backend_finished (backend);
+ alpm_trans_release ();
+ return;
+ }
- alpm_trans_addtarget (id->name);
+ if (alpm_trans_commit (&problems) != 0) {
+ pk_backend_error_code (backend, PK_ERROR_ENUM_TRANSACTION_ERROR, alpm_strerror (pm_errno));
+ pk_backend_finished (backend);
+ alpm_trans_release ();
+ return;
+ }
- if (alpm_trans_prepare (&problems) != 0) {
- pk_backend_error_code (backend, PK_ERROR_ENUM_TRANSACTION_ERROR, alpm_strerror (pm_errno));
- pk_backend_finished (backend);
alpm_trans_release ();
- pk_package_id_free (id);
- return;
- }
-
- if (alpm_trans_commit (&problems) != 0) {
- pk_backend_error_code (backend, PK_ERROR_ENUM_TRANSACTION_ERROR, alpm_strerror (pm_errno));
pk_backend_finished (backend);
- alpm_trans_release ();
- pk_package_id_free (id);
- return;
- }
-
- pk_package_id_free (id);
- alpm_trans_release ();
- pk_backend_finished (backend);
}
/**
- * backend_search_details:
+ * backend_install_package:
*/
static void
-backend_search_details (PkBackend *backend, PkFilterEnum filters, const gchar *search)
+backend_install_package (PkBackend *backend, const gchar *package_id)
{
- g_return_if_fail (backend != NULL);
+ pk_debug ("hello %i", GPOINTER_TO_INT (backend));
+ g_return_if_fail (backend != NULL);
+/*
+ alpm_list_t *syncdbs = alpm_option_get_syncdbs ();
+*/
+ alpm_list_t *result = NULL;
+ alpm_list_t *problems = NULL;
+ PkPackageId *id = pk_package_id_new_from_string (package_id);
+ pmtransflag_t flags = 0;
+ GThread *progress = NULL;
- alpm_list_t *result = NULL;
+ flags |= PM_TRANS_FLAG_NODEPS;
- pk_backend_set_status (backend, PK_STATUS_ENUM_QUERY);
+ // Next generation code?
+/*
+ for (; syncdbs; syncdbs = alpm_list_next (syncdbs))
+ result = alpm_list_join (result, find_packages_by_desc (id->name, (pmdb_t *) syncdbs->data));
+
+ if (result == NULL) {
+ pk_backend_error_code (backend, PK_ERROR_ENUM_PACKAGE_ID_INVALID, "Package not found");
+ pk_backend_finished (backend);
+ alpm_list_free (result);
+ alpm_list_free (syncdbs);
+ pk_package_id_free (id);
+ return;
+ }
- gboolean search_installed = pk_enums_contain (filters, PK_FILTER_ENUM_INSTALLED);
- gboolean search_not_installed = pk_enums_contain (filters, PK_FILTER_ENUM_NOT_INSTALLED);
+ for (; result; result = alpm_list_next (result))
+ if (pkg_equals_to ((pmpkg_t *) result->data, id->name, id->version))
+ break;
+
+ if (!result) {
+ pk_backend_error_code (backend, PK_ERROR_ENUM_PACKAGE_ID_INVALID, "Package not found");
+ pk_backend_finished (backend);
+ alpm_list_free (result);
+ alpm_list_free (syncdbs);
+ pk_package_id_free (id);
+ return;
+ }
+*/
- if (!search_not_installed) {
- // Search in local db
- result = alpm_list_join (result, find_packages_by_desc (search, alpm_option_get_localdb ()));
- }
+ if (alpm_trans_init (PM_TRANS_TYPE_SYNC, flags, cb_trans_evt, cb_trans_conv, cb_trans_progress) == -1) {
+ pk_backend_error_code (backend, PK_ERROR_ENUM_TRANSACTION_ERROR, alpm_strerror (pm_errno));
+ pk_backend_finished (backend);
+ alpm_list_free (result);
+ pk_package_id_free (id);
+ return;
+ }
- if (!search_installed) {
- // Search in sync dbs
- alpm_list_t *iterator;
- for (iterator = alpm_option_get_syncdbs (); iterator; iterator = alpm_list_next (iterator))
- result = alpm_list_join (result, find_packages_by_desc (search, (pmdb_t *) alpm_list_getdata(iterator)));
- }
+ pk_debug ("init");
+
+ alpm_trans_addtarget (id->name);
+
+ if (alpm_trans_prepare (&problems) != 0) {
+ pk_backend_error_code (backend, PK_ERROR_ENUM_TRANSACTION_ERROR, alpm_strerror (pm_errno));
+ pk_backend_finished (backend);
+ alpm_trans_release ();
+ alpm_list_free (result);
+ pk_package_id_free (id);
+ return;
+ }
+
+ pk_backend_package (backend, PK_INFO_ENUM_DOWNLOADING, package_id, "An HTML widget for GTK+ 2.0");
- add_packages_from_list (backend, alpm_list_first (result));
+ progress = g_thread_create (state_notify, (void *) backend, TRUE, NULL);
+ install_backend = backend;
- alpm_list_free_inner (result, (alpm_list_fn_free) package_source_free);
- alpm_list_free (result);
+ if (alpm_trans_commit (&problems) != 0) {
+ pk_backend_error_code (backend, PK_ERROR_ENUM_TRANSACTION_ERROR, alpm_strerror (pm_errno));
+ pk_backend_finished (backend);
+ alpm_trans_release ();
+ alpm_list_free (result);
+ pk_package_id_free (id);
+ return;
+ }
- pk_backend_finished (backend);
+ alpm_trans_release ();
+ alpm_list_free (result);
+ pk_package_id_free (id);
+ pk_backend_finished (backend);
}
/**
- * backend_search_name:
+ * backend_refresh_cache_thread:
*/
-static void
-backend_search_name (PkBackend *backend, PkFilterEnum filters, const gchar *search)
+static gboolean
+backend_refresh_cache_thread (PkBackend *backend)
{
- g_return_if_fail (backend != NULL);
-
- alpm_list_t *result = NULL;
+ pk_backend_no_percentage_updates (backend);
- pk_backend_set_status (backend, PK_STATUS_ENUM_QUERY);
-
- gboolean search_installed = pk_enums_contain (filters, PK_FILTER_ENUM_INSTALLED);
- gboolean search_not_installed = pk_enums_contain (filters, PK_FILTER_ENUM_NOT_INSTALLED);
-
- if (!search_not_installed) {
- // Search in local db
- result = alpm_list_join (result, find_packages_by_name (search, alpm_option_get_localdb ()));
- }
+ if (alpm_trans_init (PM_TRANS_TYPE_SYNC, PM_TRANS_FLAG_NOSCRIPTLET, cb_trans_evt, cb_trans_conv, cb_trans_progress) != 0) {
+ pk_backend_error_code (backend, PK_ERROR_ENUM_TRANSACTION_ERROR, alpm_strerror (pm_errno));
+ pk_backend_finished (backend);
+ return FALSE;
+ }
+ pk_debug ("alpm: %s", "transaction initialized");
- if (!search_installed) {
- // Search in sync dbs
+ alpm_list_t *dbs = alpm_option_get_syncdbs ();
alpm_list_t *iterator;
- for (iterator = alpm_option_get_syncdbs (); iterator; iterator = alpm_list_next (iterator))
- result = alpm_list_join (result, find_packages_by_name (search, (pmdb_t *) alpm_list_getdata(iterator)));
- }
-
- add_packages_from_list (backend, alpm_list_first (result));
+ for (iterator = dbs; iterator; iterator = alpm_list_next (iterator)) {
+ int update_result = alpm_db_update (FALSE, (pmdb_t *) alpm_list_getdata (iterator));
+ pk_debug ("alpm: update_result is %i", update_result);
+ if (update_result == -1) {
+ pk_backend_error_code (backend, PK_ERROR_ENUM_TRANSACTION_ERROR, alpm_strerror (pm_errno));
+ pk_backend_finished (backend);
+ return FALSE;
+ }
+ }
- alpm_list_free_inner (result, (alpm_list_fn_free) package_source_free);
- alpm_list_free (result);
+ alpm_trans_release ();
+ pk_debug ("alpm: %s", "transaction released");
- pk_backend_finished (backend);
+ pk_backend_finished (backend);
+ return TRUE;
}
/**
- * backend_get_groups:
+ * backend_refresh_cache:
*/
-static PkGroupEnum
-backend_get_groups (PkBackend *backend)
+static void
+backend_refresh_cache (PkBackend *backend, gboolean force)
{
- g_return_val_if_fail (backend != NULL, PK_GROUP_ENUM_UNKNOWN);
+ g_return_if_fail (backend != NULL);
+
+ if (!pk_backend_is_online (backend)) {
+ pk_backend_error_code (backend, PK_ERROR_ENUM_NO_NETWORK, "Cannot refresh cache whilst offline");
+ pk_backend_finished (backend);
+ return;
+ }
+
+ pk_backend_set_status (backend, PK_STATUS_ENUM_REFRESH_CACHE);
- // TODO: Provide support for groups in alpm
- return PK_GROUP_ENUM_OTHER;
+ pk_backend_thread_create (backend, backend_refresh_cache_thread);
}
/**
- * backend_get_filters:
+ * backend_remove_package:
*/
-static PkFilterEnum
-backend_get_filters (PkBackend *backend)
+static void
+backend_remove_package (PkBackend *backend, const gchar *package_id, gboolean allow_deps, gboolean autoremove)
{
- g_return_val_if_fail (backend != NULL, PK_FILTER_ENUM_UNKNOWN);
+ g_return_if_fail (backend != NULL);
+
+ PkPackageId *id = pk_package_id_new_from_string (package_id);
+ pmtransflag_t flags = 0;
+ alpm_list_t *problems = NULL;
+
+ if (allow_deps)
+ flags |= PM_TRANS_FLAG_CASCADE;
- return PK_FILTER_ENUM_INSTALLED;
+ if (alpm_trans_init (PM_TRANS_TYPE_REMOVE, flags, cb_trans_evt, cb_trans_conv, cb_trans_progress) == -1) {
+ pk_backend_error_code (backend, PK_ERROR_ENUM_TRANSACTION_ERROR, alpm_strerror (pm_errno));
+ pk_backend_finished (backend);
+ pk_package_id_free (id);
+ return;
+ }
+
+ alpm_trans_addtarget (id->name);
+
+ if (alpm_trans_prepare (&problems) != 0) {
+ pk_backend_error_code (backend, PK_ERROR_ENUM_TRANSACTION_ERROR, alpm_strerror (pm_errno));
+ pk_backend_finished (backend);
+ alpm_trans_release ();
+ pk_package_id_free (id);
+ return;
+ }
+
+ if (alpm_trans_commit (&problems) != 0) {
+ pk_backend_error_code (backend, PK_ERROR_ENUM_TRANSACTION_ERROR, alpm_strerror (pm_errno));
+ pk_backend_finished (backend);
+ alpm_trans_release ();
+ pk_package_id_free (id);
+ return;
+ }
+
+ pk_package_id_free (id);
+ alpm_trans_release ();
+ pk_backend_finished (backend);
}
/**
- * backend_get_details:
+ * backend_resolve:
+ * Currently works only for local packages
*/
static void
-backend_get_details (PkBackend *backend, const gchar *package_id)
+backend_resolve (PkBackend *backend, PkFilterEnum filters, const gchar *package)
{
- g_return_if_fail (backend != NULL);
-
- pk_backend_set_status (backend, PK_STATUS_ENUM_QUERY);
- PkPackageId *pkg_id = pk_package_id_new_from_string (package_id);
- // do all this fancy stuff
- pmdb_t *repo = NULL;
- if (strcmp ("local", pkg_id->data) == 0)
- repo = alpm_option_get_localdb ();
- else {
- alpm_list_t *iterator;
- for (iterator = alpm_option_get_syncdbs (); iterator; iterator = alpm_list_next (iterator)) {
- repo = alpm_list_getdata (iterator);
- if (strcmp (alpm_db_get_name (repo), pkg_id->data) == 0)
- break;
- }
- }
+ g_return_if_fail (backend != NULL);
- if (repo == NULL) {
- pk_backend_error_code (backend, PK_ERROR_ENUM_REPO_NOT_FOUND, alpm_strerror (pm_errno));
- pk_package_id_free (pkg_id);
- pk_backend_finished (backend);
- return;
- }
-
- pmpkg_t *pkg = alpm_db_get_pkg (repo, pkg_id->name);
- // free package id as we no longer need it
- pk_package_id_free (pkg_id);
-
- gchar *licenses;
- alpm_list_t *licenses_list = alpm_pkg_get_licenses (pkg);
- if (licenses_list == NULL)
- licenses = "unknown";
- else {
- licenses = g_strnfill(100, '\0');
- alpm_list_t *iterator;
- for (iterator = licenses_list; iterator; iterator = alpm_list_next (iterator)) {
- if (iterator != licenses_list)
- g_strlcat (licenses, ", ", 100);
- g_strlcat (licenses, alpm_list_getdata (iterator), 100);
+ pk_backend_set_status (backend, PK_STATUS_ENUM_QUERY);
+
+ pmdb_t *localdb = alpm_option_get_localdb ();
+
+ /* result will be the list of PackageSource */
+ alpm_list_t *result = find_packages_by_desc (package, localdb);
+
+ if (result != NULL)
+ pk_debug ("alpm: package %s found, trying to resolve...", package);
+
+ if (result == NULL) {
+ pk_backend_error_code (backend, PK_ERROR_ENUM_PACKAGE_NOT_INSTALLED, "Package is not installed");
+ pk_backend_finished (backend);
+ return;
+ } else if (alpm_list_count (result) != 1 || strcmp (alpm_pkg_get_name (((PackageSource *) result->data)->pkg), package) != 0) {
+ pk_backend_error_code (backend, PK_ERROR_ENUM_PACKAGE_NOT_INSTALLED, "Package is not installed");
+ pk_backend_finished (backend);
+ alpm_list_free_inner (result, (alpm_list_fn_free) package_source_free);
+ alpm_list_free (result);
+ return;
}
- }
- pk_backend_details (backend, package_id, licenses, PK_GROUP_ENUM_OTHER, alpm_pkg_get_desc (pkg), alpm_pkg_get_url(pkg), alpm_pkg_get_size (pkg));
- pk_backend_finished (backend);
+ pmpkg_t *pkg = ((PackageSource *) result->data)->pkg;
+ pk_backend_package (backend, PK_INFO_ENUM_INSTALLED,
+ pk_package_id_build (alpm_pkg_get_name (pkg), alpm_pkg_get_version (pkg), alpm_pkg_get_arch (pkg), "local"),
+ alpm_pkg_get_desc (pkg));
+
+ alpm_list_free_inner (result, (alpm_list_fn_free) package_source_free);
+ alpm_list_free (result);
+ pk_backend_finished (backend);
}
/**
- * backend_install_file:
+ * backend_search_details:
*/
static void
-backend_install_file (PkBackend *backend, gboolean trusted, const gchar *path)
+backend_search_details (PkBackend *backend, PkFilterEnum filters, const gchar *search)
{
- g_return_if_fail (backend != NULL);
+ g_return_if_fail (backend != NULL);
- alpm_list_t *problems = NULL;
- if (alpm_trans_init (PM_TRANS_TYPE_ADD, 0, cb_trans_evt, cb_trans_conv, cb_trans_progress) == -1) {
- pk_backend_error_code (backend,
- PK_ERROR_ENUM_TRANSACTION_ERROR,
- alpm_strerror (pm_errno));
- pk_backend_finished (backend);
- return;
- }
+ alpm_list_t *result = NULL;
- alpm_trans_addtarget ((char *) path);
+ pk_backend_set_status (backend, PK_STATUS_ENUM_QUERY);
- if (alpm_trans_prepare (&problems) != 0) {
- pk_backend_error_code (backend,
- PK_ERROR_ENUM_TRANSACTION_ERROR,
- alpm_strerror (pm_errno));
- pk_backend_finished (backend);
- alpm_trans_release ();
- return;
- }
+ gboolean search_installed = pk_enums_contain (filters, PK_FILTER_ENUM_INSTALLED);
+ gboolean search_not_installed = pk_enums_contain (filters, PK_FILTER_ENUM_NOT_INSTALLED);
- if (alpm_trans_commit (&problems) != 0) {
- pk_backend_error_code (backend,
- PK_ERROR_ENUM_TRANSACTION_ERROR,
- alpm_strerror (pm_errno));
- pk_backend_finished (backend);
- alpm_trans_release ();
- return;
- }
+ if (!search_not_installed) {
+ // Search in local db
+ result = alpm_list_join (result, find_packages_by_desc (search, alpm_option_get_localdb ()));
+ }
+
+ if (!search_installed) {
+ // Search in sync dbs
+ alpm_list_t *iterator;
+ for (iterator = alpm_option_get_syncdbs (); iterator; iterator = alpm_list_next (iterator))
+ result = alpm_list_join (result, find_packages_by_desc (search, (pmdb_t *) alpm_list_getdata(iterator)));
+ }
+
+ add_packages_from_list (backend, alpm_list_first (result));
+
+ alpm_list_free_inner (result, (alpm_list_fn_free) package_source_free);
+ alpm_list_free (result);
- alpm_trans_release ();
- pk_backend_finished (backend);
+ pk_backend_finished (backend);
}
/**
- * backend_get_repo_list:
+ * backend_search_name:
*/
-void
-backend_get_repo_list (PkBackend *backend, PkFilterEnum filters)
+static void
+backend_search_name (PkBackend *backend, PkFilterEnum filters, const gchar *search)
{
- g_return_if_fail (backend != NULL);
+ g_return_if_fail (backend != NULL);
+
+ alpm_list_t *result = NULL;
- pk_backend_set_status (backend, PK_STATUS_ENUM_QUERY);
+ pk_backend_set_status (backend, PK_STATUS_ENUM_QUERY);
- alpm_list_t *repos = alpm_option_get_syncdbs ();
- if (repos == NULL)
- pk_backend_error_code (backend, PK_ERROR_ENUM_INTERNAL_ERROR, alpm_strerror (pm_errno));
+ gboolean search_installed = pk_enums_contain (filters, PK_FILTER_ENUM_INSTALLED);
+ gboolean search_not_installed = pk_enums_contain (filters, PK_FILTER_ENUM_NOT_INSTALLED);
- // Iterate on repository list
- alpm_list_t *iterator;
- for (iterator = repos; iterator; iterator = alpm_list_next(iterator)) {
- pmdb_t *db = alpm_list_getdata (repos);
- pk_backend_repo_detail (backend, alpm_db_get_name (db), alpm_db_get_name (db), TRUE);
- repos = alpm_list_next (repos);
- }
+ if (!search_not_installed) {
+ // Search in local db
+ result = alpm_list_join (result, find_packages_by_name (search, alpm_option_get_localdb ()));
+ }
+
+ if (!search_installed) {
+ // Search in sync dbs
+ alpm_list_t *iterator;
+ for (iterator = alpm_option_get_syncdbs (); iterator; iterator = alpm_list_next (iterator))
+ result = alpm_list_join (result, find_packages_by_name (search, (pmdb_t *) alpm_list_getdata(iterator)));
+ }
- pk_backend_finished (backend);
+ add_packages_from_list (backend, alpm_list_first (result));
+
+ alpm_list_free_inner (result, (alpm_list_fn_free) package_source_free);
+ alpm_list_free (result);
+
+ pk_backend_finished (backend);
}
-
+
+/**
+ * backend_update_packages:
+ */
+static void
+backend_update_packages (PkBackend *backend, gchar **package_ids)
+{
+ /* TODO: process the entire list */
+ backend_install_package (backend, package_ids[0]);
+}
+
PK_BACKEND_OPTIONS (
- "alpm", /* description */
- "Andreas Obergrusberger <tradiaz at yahoo.de>", /* author */
- backend_initialize, /* initialize */
- backend_destroy, /* destroy */
- backend_get_groups, /* get_groups */
- backend_get_filters, /* get_filters */
- NULL, /* cancel */
- NULL, /* get_depends */
- backend_get_details, /* get_details */
- NULL, /* get_files */
- NULL, /* get_packages */
- backend_get_repo_list, /* get_repo_list */
- NULL, /* get_requires */
- NULL, /* get_update_detail */
- NULL, /* get_updates */
- backend_install_file, /* install_file */
- backend_install_package, /* install_package */
- NULL, /* install_signature */
- backend_refresh_cache, /* refresh_cache */
- backend_remove_package, /* remove_package */
- NULL, /* repo_enable */
- NULL, /* repo_set_data */
- backend_resolve, /* resolve */
- NULL, /* rollback */
- backend_search_details, /* search_details */
- NULL, /* search_file */
- NULL, /* search_group */
- backend_search_name, /* search_name */
- NULL, /* service_pack */
- backend_update_packages, /* update_packages */
- NULL, /* update_system */
- NULL /* what_provides */
+ "alpm", /* description */
+ "Andreas Obergrusberger <tradiaz at yahoo.de>", /* author */
+ backend_initialize, /* initialize */
+ backend_destroy, /* destroy */
+ backend_get_groups, /* get_groups */
+ backend_get_filters, /* get_filters */
+ NULL, /* cancel */
+ NULL, /* get_depends */
+ backend_get_details, /* get_details */
+ NULL, /* get_files */
+ NULL, /* get_packages */
+ backend_get_repo_list, /* get_repo_list */
+ NULL, /* get_requires */
+ NULL, /* get_update_detail */
+ NULL, /* get_updates */
+ backend_install_file, /* install_file */
+ backend_install_package, /* install_package */
+ NULL, /* install_signature */
+ backend_refresh_cache, /* refresh_cache */
+ backend_remove_package, /* remove_package */
+ NULL, /* repo_enable */
+ NULL, /* repo_set_data */
+ backend_resolve, /* resolve */
+ NULL, /* rollback */
+ backend_search_details, /* search_details */
+ NULL, /* search_file */
+ NULL, /* search_group */
+ backend_search_name, /* search_name */
+ NULL, /* service_pack */
+ backend_update_packages, /* update_packages */
+ NULL, /* update_system */
+ NULL /* what_provides */
);
commit 34368f7fa13b3ac7d2a16d570d450a027e66dd75
Author: Luke Macken <lmacken at redhat.com>
Date: Mon May 5 10:57:17 2008 -0400
yum: Fix a bug in _get_update_extras caused by invalid tab->space conversion (rh#304527)
diff --git a/backends/yum/helpers/yumBackend.py b/backends/yum/helpers/yumBackend.py
index d5be742..c04c067 100644
--- a/backends/yum/helpers/yumBackend.py
+++ b/backends/yum/helpers/yumBackend.py
@@ -1379,14 +1379,13 @@ class PackageKitYumBackend(PackageKitBaseBackend):
if refs:
for ref in refs:
typ = ref['type']
- href = ref['href']
- title = ref['title']
- if typ in ('bugzilla','cve') and href != None:
- if title == None:
- title = ""
- urls[typ].append("%s;%s" % (href,title))
- else:
- urls['vendor'].append("%s;%s" % (ref['href'],ref['title']))
+ href = ref['href']
+ title = ref['title'] or ""
+ if href:
+ if typ in ('bugzilla','cve'):
+ urls[typ].append("%s;%s" % (href,title))
+ else:
+ urls['vendor'].append("%s;%s" % (href,ref['title']))
# Reboot flag
if notice.get_metadata().has_key('reboot_suggested') and notice['reboot_suggested']:
commit 5cafa1a5c70c2af2bf30b7e612e01f511b3a3169
Author: S.ÃaÄlar Onur <caglar at pardus.org.tr>
Date: Mon May 5 14:15:50 2008 +0300
PiSi: Use pk_backend_is_online instead of pk_network_is_online
diff --git a/backends/pisi/pk-backend-pisi.c b/backends/pisi/pk-backend-pisi.c
index a90210e..261b2af 100644
--- a/backends/pisi/pk-backend-pisi.c
+++ b/backends/pisi/pk-backend-pisi.c
@@ -20,13 +20,11 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
-#include <pk-network.h>
#include <pk-backend.h>
#include <pk-backend-spawn.h>
#include <pk-package-ids.h>
static PkBackendSpawn *spawn;
-static PkNetwork *network;
/**
* backend_initialize:
@@ -37,7 +35,6 @@ backend_initialize (PkBackend *backend)
{
g_return_if_fail (backend != NULL);
pk_debug ("FILTER: initialize");
- network = pk_network_new ();
spawn = pk_backend_spawn_new ();
pk_backend_spawn_set_name (spawn, "pisi");
}
@@ -52,7 +49,6 @@ backend_destroy (PkBackend *backend)
g_return_if_fail (backend != NULL);
g_return_if_fail (spawn != NULL);
pk_debug ("FILTER: destroy");
- g_object_unref (network);
g_object_unref (spawn);
}
@@ -194,7 +190,7 @@ backend_install_package (PkBackend *backend, const gchar *package_id)
g_return_if_fail (spawn != NULL);
/* check network state */
- if (pk_network_is_online (network) == FALSE) {
+ if (!pk_backend_is_online (backend)) {
pk_backend_error_code (backend, PK_ERROR_ENUM_NO_NETWORK, "Cannot install when offline");
pk_backend_finished (backend);
return;
@@ -224,7 +220,7 @@ backend_refresh_cache (PkBackend *backend, gboolean force)
g_return_if_fail (spawn != NULL);
/* check network state */
- if (pk_network_is_online (network) == FALSE) {
+ if (!pk_backend_is_online (backend)) {
pk_backend_error_code (backend, PK_ERROR_ENUM_NO_NETWORK, "Cannot refresh cache whilst offline");
pk_backend_finished (backend);
return;
@@ -312,7 +308,7 @@ backend_update_packages (PkBackend *backend, gchar **package_ids)
g_return_if_fail (spawn != NULL);
/* check network state */
- if (pk_network_is_online (network) == FALSE) {
+ if (!pk_backend_is_online (backend)) {
pk_backend_error_code (backend, PK_ERROR_ENUM_NO_NETWORK, "Cannot install when offline");
pk_backend_finished (backend);
return;
commit a6ecb6274552c33d64a8457aa04195d049422aae
Author: Piotr DrÄ
g <piotrdrag at gmail.com>
Date: Sat May 3 13:31:43 2008 +0000
2008-05-03 Piotr DrÄ
g <piotrdrag at gmail.com> (via raven at fedoraproject.org)
* po/pl.po: Updated Polish translation
diff --git a/po/pl.po b/po/pl.po
index b4b818c..5fef406 100644
--- a/po/pl.po
+++ b/po/pl.po
@@ -5,130 +5,49 @@ msgid ""
msgstr ""
"Project-Id-Version: pl\n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2008-04-18 16:49+0100\n"
-"PO-Revision-Date: 2008-04-21 23:59+0200\n"
+"POT-Creation-Date: 2008-05-03 01:34+0000\n"
+"PO-Revision-Date: 2008-05-03 15:25+0200\n"
"Last-Translator: Piotr DrÄ
g <piotrdrag at gmail.com>\n"
"Language-Team: Polish <pl at li.org>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
-#: ../policy/org.freedesktop.packagekit.policy.in.h:1
-msgid "Accept EULA"
-msgstr "Akceptacja EULA"
-
-#: ../policy/org.freedesktop.packagekit.policy.in.h:2
-msgid "Authentication is required to accept a EULA"
-msgstr "Aby zaakceptowaÄ EULA, wymagane jest uwierzytelnienie"
-
-#: ../policy/org.freedesktop.packagekit.policy.in.h:3
-msgid "Authentication is required to change software source parameters"
-msgstr ""
-"Aby zmieniÄ parametry źródeÅ oprogramowania, wymagane jest uwierzytelnienie"
-
-#: ../policy/org.freedesktop.packagekit.policy.in.h:4
-msgid "Authentication is required to install a local file"
-msgstr "Aby zainstalowaÄ lokalny plik, wymagane jest uwierzytelnienie"
-
-#: ../policy/org.freedesktop.packagekit.policy.in.h:5
-msgid "Authentication is required to install a package"
-msgstr "Aby zainstalowaÄ pakiet, wymagane jest uwierzytelnienie"
-
-#: ../policy/org.freedesktop.packagekit.policy.in.h:6
-msgid "Authentication is required to install a security signature"
-msgstr "Aby zainstalowaÄ podpis bezpieczeÅstwa, wymagane jest uwierzytelnienie"
-
-#: ../policy/org.freedesktop.packagekit.policy.in.h:7
-msgid "Authentication is required to refresh the package lists"
-msgstr "Aby odÅwieżyÄ listÄ pakietów, wymagane jest uwierzytelnienie"
-
-#: ../policy/org.freedesktop.packagekit.policy.in.h:8
-msgid "Authentication is required to remove packages"
-msgstr "Aby usunÄ
Ä pakiety, wymagane jest uwierzytelnienie"
-
-#: ../policy/org.freedesktop.packagekit.policy.in.h:9
-msgid "Authentication is required to rollback a transaction"
-msgstr "Aby przywróciÄ transakcjÄ, wymagane jest uwierzytelnienie"
-
-#: ../policy/org.freedesktop.packagekit.policy.in.h:10
-msgid "Authentication is required to update all packages"
-msgstr "Aby zaktualizowaÄ wszystkie pakiety, wymagane jest uwierzytelnienie"
-
-#: ../policy/org.freedesktop.packagekit.policy.in.h:11
-msgid "Authentication is required to update packages"
-msgstr "Aby zaktualizowaÄ pakiety, wymagane jest uwierzytelnienie"
-
-#: ../policy/org.freedesktop.packagekit.policy.in.h:12
-msgid "Change software source parameters"
-msgstr "Zmiana parametrów źródeŠoprogramowania"
-
-#: ../policy/org.freedesktop.packagekit.policy.in.h:13
-msgid "Install local file"
-msgstr "Instalacja lokalnego pliku"
-
-#: ../policy/org.freedesktop.packagekit.policy.in.h:14
-msgid "Install package"
-msgstr "Instalacja pakietu"
-
-#: ../policy/org.freedesktop.packagekit.policy.in.h:15
-msgid "Install security signature"
-msgstr "Instalacja podpisu bezpieczeÅstwa"
-
-#: ../policy/org.freedesktop.packagekit.policy.in.h:16
-msgid "Refresh package lists"
-msgstr "OdÅwieżenie listy pakietów"
-
-#: ../policy/org.freedesktop.packagekit.policy.in.h:17
-msgid "Remove package"
-msgstr "UsuniÄcie pakietu"
-
-#: ../policy/org.freedesktop.packagekit.policy.in.h:18
-msgid "Rollback to a previous transaction"
-msgstr "Przywrócenie poprzedniej transakcji"
-
-#: ../policy/org.freedesktop.packagekit.policy.in.h:19
-msgid "Update all packages"
-msgstr "Aktualizacja wszystkich pakietów"
-
-#: ../policy/org.freedesktop.packagekit.policy.in.h:20
-msgid "Update package"
-msgstr "Aktualizacja pakietu"
-
-#: ../client/pk-console.c:208
+#: ../client/pk-console.c:224
msgid "Update detail"
msgstr "SzczegóÅy aktualizacji"
-#: ../client/pk-console.c:400
+#: ../client/pk-console.c:425
msgid "A system restart is required"
msgstr "Wymagane jest ponowne uruchomienie systemu"
-#: ../client/pk-console.c:402
+#: ../client/pk-console.c:427
msgid "A logout and login is required"
msgstr "Wymagane jest wylogowanie siÄ i ponowne zalogowanie"
-#: ../client/pk-console.c:404
+#: ../client/pk-console.c:429
msgid "An application restart is required"
msgstr "Wymagane jest ponowne uruchomienie aplikacji"
-#: ../client/pk-console.c:443
+#: ../client/pk-console.c:474
#, c-format
msgid "Please enter a number from 1 to %i: "
msgstr "ProszÄ podaÄ numer od 1 do %i: "
-#: ../client/pk-console.c:493
+#: ../client/pk-console.c:524
msgid "Could not find a package match"
msgstr "Nie można znaleÅºÄ pasujÄ
cego pakietu"
-#: ../client/pk-console.c:507
+#: ../client/pk-console.c:538
msgid "There are multiple package matches"
msgstr "Pasuje kilka pakietów"
#. find out what package the user wants to use
-#: ../client/pk-console.c:514
+#: ../client/pk-console.c:545
msgid "Please enter the package number: "
msgstr "ProszÄ podaÄ numer pakietu: "
-#: ../client/pk-console.c:530
+#: ../client/pk-console.c:561
msgid ""
"Could not find a package with that name to install, or package already "
"installed"
@@ -136,208 +55,192 @@ msgstr ""
"Nie można znaleÅºÄ pakietu o tej nazwie do zainstalowania, lub pakiet jest "
"już zainstalowany"
-#: ../client/pk-console.c:612
+#: ../client/pk-console.c:643
msgid "Could not find a package with that name to remove"
msgstr "Nie można znaleÅºÄ pakietu o tej nazwie do usuniÄcia"
-#: ../client/pk-console.c:652
+#: ../client/pk-console.c:683
msgid "The following packages have to be removed"
msgstr "NastÄpujÄ
ce pakiety muszÄ
zostaÄ usuniÄte"
#. get user input
-#: ../client/pk-console.c:661
+#: ../client/pk-console.c:692
msgid "Okay to remove additional packages?"
msgstr "UsunÄ
Ä dodatkowe pakiety?"
-#: ../client/pk-console.c:665
+#: ../client/pk-console.c:696
msgid "Cancelled!"
msgstr "Anulowano!"
-#: ../client/pk-console.c:687
+#: ../client/pk-console.c:718
msgid "Could not find a package with that name to update"
msgstr "Nie można znaleÅºÄ pakietu o tej nazwie do zaktualizowania"
-#: ../client/pk-console.c:705
+#: ../client/pk-console.c:736
msgid "Could not find what packages require this package"
msgstr "Nie można znaleÅºÄ pakietów, które wymagajÄ
tego pakietu"
-#: ../client/pk-console.c:723
+#: ../client/pk-console.c:754
msgid "Could not get dependencies for this package"
msgstr "Nie można uzyskaÄ zależnoÅci tego pakietu"
-#: ../client/pk-console.c:741
-msgid "Could not find a description for this package"
-msgstr "Nie można znaleÅºÄ opisu pakietu"
+#: ../client/pk-console.c:772
+msgid "Could not find details for this package"
+msgstr "Nie można znaleÅºÄ szczegóÅów tego pakietu"
-#: ../client/pk-console.c:759
-#, c-format
+#: ../client/pk-console.c:790
msgid "Could not find the files for this package"
msgstr "Nie można znaleÅºÄ plików tego pakietu"
-#: ../client/pk-console.c:819
+#: ../client/pk-console.c:870
msgid "Package description"
msgstr "Opis pakietu"
-#: ../client/pk-console.c:842
+#: ../client/pk-console.c:893
msgid "Package files"
msgstr "Pliki pakiety"
-#: ../client/pk-console.c:850
+#: ../client/pk-console.c:901
msgid "No files"
msgstr "Brak plików"
#. get user input
-#: ../client/pk-console.c:882
+#: ../client/pk-console.c:933
msgid "Okay to import key?"
msgstr "ZaimportowaÄ klucz?"
-#: ../client/pk-console.c:885
+#: ../client/pk-console.c:936
msgid "Did not import key"
msgstr "Nie zaimportowano klucza"
#. get user input
-#: ../client/pk-console.c:925
+#: ../client/pk-console.c:976
msgid "Do you agree?"
msgstr "Zgadzasz siÄ?"
-#: ../client/pk-console.c:928
+#: ../client/pk-console.c:979
msgid "Did not agree to licence, task will fail"
msgstr "Nie zaakceptowano licencji, zadanie nie powiedzie siÄ"
-#: ../client/pk-console.c:957
+#: ../client/pk-console.c:1008
msgid "The daemon crashed mid-transaction!"
msgstr "Demon zawiesiÅ siÄ w poÅowie transakcji!"
#. header
-#: ../client/pk-console.c:1010
+#: ../client/pk-console.c:1061
msgid "PackageKit Console Interface"
msgstr "Interfejs konsoli PackageKit"
-#: ../client/pk-console.c:1010
+#: ../client/pk-console.c:1061
msgid "Subcommands:"
msgstr "Podpolecenia:"
-#: ../client/pk-console.c:1114 ../client/pk-monitor.c:100 ../src/pk-main.c:189
+#: ../client/pk-console.c:1165 ../client/pk-monitor.c:104 ../src/pk-main.c:189
msgid "Show extra debugging information"
msgstr "WyÅwietla dodatkowe informacje o debugowaniu"
-#: ../client/pk-console.c:1116 ../client/pk-monitor.c:102
+#: ../client/pk-console.c:1167 ../client/pk-monitor.c:106
msgid "Show the program version and exit"
msgstr "WyÅwietla wersjÄ programu i wyÅÄ
cza"
-#: ../client/pk-console.c:1118
+#: ../client/pk-console.c:1169
msgid "Set the filter, e.g. installed"
msgstr "Ustawia filtr, np. zainstalowane"
-#: ../client/pk-console.c:1120
+#: ../client/pk-console.c:1171
msgid "Exit without waiting for actions to complete"
msgstr "WyÅÄ
cza bez oczekiwania na zakoÅczenie dziaÅaÅ"
-#: ../client/pk-console.c:1143
+#: ../client/pk-console.c:1194
msgid "Could not connect to system DBUS."
msgstr "Nie można poÅÄ
czyÄ siÄ z systemowym D-Bus."
-#: ../client/pk-console.c:1231
-#, c-format
+#: ../client/pk-console.c:1288
msgid "You need to specify a search type"
msgstr "Należy podaÄ typ wyszukiwania"
-#: ../client/pk-console.c:1236 ../client/pk-console.c:1243
-#: ../client/pk-console.c:1250 ../client/pk-console.c:1257
-#: ../client/pk-console.c:1361 ../client/pk-console.c:1368
-#: ../client/pk-console.c:1375 ../client/pk-console.c:1382
-#, c-format
+#: ../client/pk-console.c:1293 ../client/pk-console.c:1300
+#: ../client/pk-console.c:1307 ../client/pk-console.c:1314
+#: ../client/pk-console.c:1421 ../client/pk-console.c:1428
+#: ../client/pk-console.c:1435 ../client/pk-console.c:1442
msgid "You need to specify a search term"
msgstr "Należy podaÄ termin wyszukiwania"
-#: ../client/pk-console.c:1262
-#, c-format
+#: ../client/pk-console.c:1319
msgid "Invalid search type"
msgstr "NieprawidÅowy typ wyszukiwania"
-#: ../client/pk-console.c:1267
-#, c-format
+#: ../client/pk-console.c:1324
msgid "You need to specify a package or file to install"
msgstr "Należy podaÄ pakiet lub plik do zainstalowania"
-#: ../client/pk-console.c:1280
-#, c-format
+#: ../client/pk-console.c:1339
msgid "You need to specify a type, key_id and package_id"
msgstr "Należy podaÄ typ, key_id i package_id"
-#: ../client/pk-console.c:1287
-#, c-format
+#: ../client/pk-console.c:1346
msgid "You need to specify a package to remove"
msgstr "Należy podaÄ pakiet do usuniÄcia"
-#: ../client/pk-console.c:1294
-#, c-format
+#: ../client/pk-console.c:1353
msgid "You need to specify a eula-id"
msgstr "Należy podaÄ eula-id"
-#: ../client/pk-console.c:1309
-#, c-format
+#: ../client/pk-console.c:1369
msgid "You need to specify a package name to resolve"
msgstr "Należy podaÄ nazwÄ pakietu do rozwiÄ
zania"
-#: ../client/pk-console.c:1316 ../client/pk-console.c:1323
-#, c-format
+#: ../client/pk-console.c:1376 ../client/pk-console.c:1383
msgid "You need to specify a repo name"
msgstr "Należy podaÄ nazwÄ repozytorium"
-#: ../client/pk-console.c:1330
-#, c-format
+#: ../client/pk-console.c:1390
msgid "You need to specify a repo name/parameter and value"
msgstr "Należy podaÄ nazwÄ/parametr repozytorium i wartoÅÄ"
-#: ../client/pk-console.c:1343
-#, c-format
+#: ../client/pk-console.c:1403
msgid "You need to specify a time term"
msgstr "Należy podaÄ termin czasu"
-#: ../client/pk-console.c:1348
-#, c-format
+#: ../client/pk-console.c:1408
msgid "You need to specify a correct role"
msgstr "Należy podaÄ poprawnÄ
rolÄ"
-#: ../client/pk-console.c:1353
-#, c-format
+#: ../client/pk-console.c:1413
msgid "Failed to get last time"
msgstr "Uzyskanie ostatniego czasu nie powiodÅo siÄ"
-#: ../client/pk-console.c:1389
-#, c-format
-msgid "You need to specify a package to find the description for"
-msgstr "Należy podaÄ pakiet do znalezienia opisu dla"
+#: ../client/pk-console.c:1449
+msgid "You need to specify a package to find the details for"
+msgstr "Należy podaÄ pakiet do znalezienia szczegóÅów dla"
-#: ../client/pk-console.c:1396
-#, c-format
+#: ../client/pk-console.c:1456
msgid "You need to specify a package to find the files for"
msgstr "Należy podaÄ pakiet do znalezienia plików dla"
-#: ../client/pk-console.c:1441
+#: ../client/pk-console.c:1503
#, c-format
msgid "Option '%s' not supported"
msgstr "Opcja \"%s\" nie jest obsÅugiwana"
-#: ../client/pk-console.c:1452
+#: ../client/pk-console.c:1514
msgid "Command failed"
msgstr "Polecenie nie powiodÅo siÄ"
-#: ../client/pk-console.c:1456
+#: ../client/pk-console.c:1518
msgid "You don't have the necessary privileges for this operation"
msgstr "Nie posiadasz niezbÄdnych uprawnieÅ dla tej operacji"
-#: ../client/pk-monitor.c:113
+#: ../client/pk-monitor.c:117
msgid "PackageKit Monitor"
msgstr "Monitor PackageKit"
-#: ../client/pk-import-desktop.c:283 ../client/pk-import-specspo.c:169
+#: ../client/pk-import-desktop.c:293 ../client/pk-import-specspo.c:169
#, c-format
msgid "Could not open database: %s"
msgstr "Nie można otworzyÄ bazy danych: %s"
-#: ../client/pk-import-desktop.c:284 ../client/pk-import-specspo.c:170
+#: ../client/pk-import-desktop.c:294 ../client/pk-import-specspo.c:170
msgid "You probably need to run this program as the root user"
msgstr "Prawdopodobnie należy uruchomiÄ ten program jako użytkownik root"
commit 122083f9fe3a4897b440b83a2629fbe6e266f3c5
Author: Scott Reeves <sreeves at novell.com>
Date: Fri May 2 18:21:44 2008 -0600
temp fix to make arch filter work
diff --git a/backends/zypp/zypp-utils.cpp b/backends/zypp/zypp-utils.cpp
index bd4ba55..eff5308 100644
--- a/backends/zypp/zypp-utils.cpp
+++ b/backends/zypp/zypp-utils.cpp
@@ -401,6 +401,14 @@ zypp_signature_required (PkBackend *backend, const std::string &file)
return ok;
}
+gboolean
+system_and_package_are_x86 (zypp::sat::Solvable item)
+{
+ // i586, i686, ... all should be considered the same arch for our comparison
+ return (!strcmp (item.arch ().asString ().c_str (), "i586") &&
+ !strcmp (zypp::ZConfig::defaultSystemArchitecture ().asString().c_str(), "i686"));
+}
+
void
zypp_emit_packages_in_list (PkBackend *backend, std::vector<zypp::sat::Solvable> *v, PkFilterEnum filters)
{
@@ -420,13 +428,18 @@ zypp_emit_packages_in_list (PkBackend *backend, std::vector<zypp::sat::Solvable>
if (i == PK_FILTER_ENUM_NOT_INSTALLED && it->isSystem ())
print = FALSE;;
if (i == PK_FILTER_ENUM_ARCH) {
- if (it->arch () != zypp::ZConfig::defaultSystemArchitecture () && it->arch () != zypp::Arch_noarch)
+ if (it->arch () != zypp::ZConfig::defaultSystemArchitecture () &&
+ it->arch () != zypp::Arch_noarch &&
+ ! system_and_package_are_x86 (*it))
print = FALSE;
}
if (i == PK_FILTER_ENUM_NOT_ARCH) {
- if (it->arch () == zypp::ZConfig::defaultSystemArchitecture ())
+ if (it->arch () == zypp::ZConfig::defaultSystemArchitecture () ||
+ system_and_package_are_x86 (*it))
print = FALSE;
}
+ //const gchar * myarch = zypp::ZConfig::defaultSystemArchitecture().asString().c_str();
+ //pk_debug ("my default arch is %s", myarch);
}
if (!print)
continue;
commit 72ea073cb3a70fe20d37f0342a88c91f84720d2f
Author: Richard Hughes <richard at hughsie.com>
Date: Sat May 3 00:15:46 2008 +0100
add some entries to the FAQ page
diff --git a/docs/html/pk-faq.html b/docs/html/pk-faq.html
index 3c17c81..f07c3eb 100644
--- a/docs/html/pk-faq.html
+++ b/docs/html/pk-faq.html
@@ -22,6 +22,7 @@
<h2>Table Of Contents</h2>
<ul>
<li><a href="#how-complete">How complete are the backends?</a></li>
+<li><a href="#session-system">Why is there a session service and and a system service?</a></li>
<li><a href="#session-methods">How do I use PackageKit in my application?</a></li>
<li><a href="#rawhide-updates">Why don't I get update details with Fedora Rawhide?</a></li>
<li><a href="#selinux">Why doesn't PackageKit work with SELinux?</a></li>
@@ -374,7 +375,7 @@
<td><img src="img/status-good.png" alt="[yes]"/></td><!-- poldek -->
<td><img src="img/status-bad.png" alt="[no]"/></td><!-- smart -->
<td><img src="img/status-good.png" alt="[yes]"/></td><!-- yum -->
-<td><img src="img/status-bad.png" alt="[no]"/></td><!-- yum2 -->
+<td><img src="img/status-good.png" alt="[yes]"/></td><!-- yum2 -->
<td><img src="img/status-bad.png" alt="[no]"/></td><!-- zypp -->
</tr>
<tr>
@@ -403,7 +404,7 @@
<td><img src="img/status-bad.png" alt="[no]"/></td><!-- pisi -->
<td><img src="img/status-bad.png" alt="[no]"/></td><!-- poldek -->
<td><img src="img/status-bad.png" alt="[no]"/></td><!-- smart -->
-<td><img src="img/status-bad.png" alt="[yes]"/></td><!-- yum -->
+<td><img src="img/status-good.png" alt="[yes]"/></td><!-- yum -->
<td><img src="img/status-bad.png" alt="[no]"/></td><!-- yum2 -->
<td><img src="img/status-good.png" alt="[yes]"/></td><!-- zypp -->
</tr>
@@ -418,9 +419,9 @@
<td><img src="img/status-bad.png" alt="[no]"/></td><!-- pisi -->
<td><img src="img/status-good.png" alt="[yes]"/></td><!-- poldek -->
<td><img src="img/status-bad.png" alt="[no]"/></td><!-- smart -->
-<td><img src="img/status-bad.png" alt="[yes]"/></td><!-- yum -->
+<td><img src="img/status-good.png" alt="[yes]"/></td><!-- yum -->
<td><img src="img/status-bad.png" alt="[no]"/></td><!-- yum2 -->
-<td><img src="img/status-good.png" alt="[no]"/></td><!-- zypp -->
+<td><img src="img/status-good.png" alt="[good]"/></td><!-- zypp -->
</tr>
</table>
@@ -497,7 +498,7 @@
<td><img src="img/status-bad.png" alt="[no]"/></td><!-- pisi -->
<td><img src="img/status-bad.png" alt="[no]"/></td><!-- poldek -->
<td><img src="img/status-bad.png" alt="[no]"/></td><!-- smart -->
-<td><img src="img/status-bad.png" alt="[yes]"/></td><!-- yum -->
+<td><img src="img/status-good.png" alt="[yes]"/></td><!-- yum -->
<td><img src="img/status-bad.png" alt="[no]"/></td><!-- yum2 -->
<td><img src="img/status-bad.png" alt="[no]"/></td><!-- zypp -->
</tr>
@@ -559,11 +560,40 @@
<td><img src="img/status-bad.png" alt="[no]"/></td><!-- smart -->
<td><img src="img/status-bad.png" alt="[no]"/></td><!-- yum -->
<td><img src="img/status-bad.png" alt="[no]"/></td><!-- yum2 -->
-<td><img src="img/status-bad.png" alt="[no]"/></td><!-- zypp -->
+<td><img src="img/status-good.png" alt="[yes]"/></td><!-- zypp -->
</tr>
</table>
<hr>
+<h3><a name="session-system">Why is there a session service <b>and</b> and a system service?</a></h3>
+<p>
+PackageKit runs a process <code>packagekitd</code> that is a daemon that runs per-system.
+The daemon lets you schedule transactions using either the raw
+<a href="http://gitweb.freedesktop.org/?p=packagekit.git;a=blob;f=src/pk-interface-transaction.xml">
+DBUS methods</a>, or using <a href="http://www.packagekit.org/gtk-doc/PkClient.html">libpackagekit</a>.
+The transactions are very fine grained, so an application would have to manage
+<a href="http://www.packagekit.org/pk-reference.html#introduction-ideas-transactions">
+the transaction process</a> itself.
+This would mean handling the EULA and GPG callbacks in each application. This is less than ideal.
+</p>
+<p>
+For this reason, a session helper is provided by the <code>gpk-update-icon</code> process which
+basically makes all the complexity go away; it handles all the GPG key authentication and
+EULA agreements, and also works with Seahorse and GConf to give some of the settings session persistence.
+Using the session service is also designed to be synchronous, which means you can send the DBUS call
+and just wait for the result, rather than managing callbacks to update custom GUIs.
+</p>
+<p>
+The session helper therefore depends on the shared code in <code>gpk-update-icon</code>, but
+because this is implemented as a DBUS service, can be coded as a QObject for KDE or a simpler
+object for XFCE or EFL.
+If you want full integration using <a href="http://www.packagekit.org/img/gpk-added-deps.png">
+custom dialogs</a> without running the extra session process, then use libpackagekit.
+If you don't care, and just want things to <i>work</i> then
+<a href="http://www.packagekit.org/pk-faq.html#session-methods">use the session interface</a>.
+</p>
+
+<hr>
<h3><a name="session-methods">How do I use PackageKit in my application?</a></h3>
<p>
If you are using <a href="http://www.gnome.org/">GNOME</a>, or running the
@@ -617,6 +647,7 @@ The methods available on this interface are:
<li><code>InstallPackageName("openoffice-clipart")</code></li>
<li><code>InstallProvideFile("/usr/share/fonts/sarai/Sarai_07.ttf")</code></li>
<li><code>InstallLocalFile("/home/dave/Desktop/lirc-0.6.6-4.rhfc1.dag.i686.rpm")</code></li>
+<li><code>InstallMimeType("application/x-rpm")</code></li>
</ul>
<p>
Please email me or the
@@ -748,8 +779,6 @@ The reasons for this are as follows:
<p>
EULAs or other agreements will have to be agreed to <b>before</b> the
transaction is processed using the <code>EulaRequired</code> signal.
-</p>
-<p>
EULAs should preferably be shown per-user - i.e. the first time an application is run.
</p>
<p>
@@ -851,7 +880,7 @@ can only be shown after the transaction has completed.</i>
<hr>
<h3><a name="translation">How do I translate gnome-packagekit?</a></h3>
<p>
-Please see the <a href="http://l10n.gnome.org/teams">GNOME Translation Team</a>
+See the <a href="http://l10n.gnome.org/teams">GNOME Translation Team</a>
web pages for how to contribute to GNOME localisation.
</p>
commit 2d010f16c7c60c1b75c010188de8ee93677d4c50
Author: Richard Hughes <richard at hughsie.com>
Date: Fri May 2 23:57:56 2008 +0100
fixup the dummy backend to be a bit more rich
diff --git a/backends/dummy/pk-backend-dummy.c b/backends/dummy/pk-backend-dummy.c
index 016bd46..a86e1d7 100644
--- a/backends/dummy/pk-backend-dummy.c
+++ b/backends/dummy/pk-backend-dummy.c
@@ -776,8 +776,11 @@ backend_what_provides (PkBackend *backend, PkFilterEnum filters, PkProvidesEnum
g_return_if_fail (backend != NULL);
pk_backend_set_status (backend, PK_STATUS_ENUM_REQUEST);
pk_backend_package (backend, PK_INFO_ENUM_INSTALLED,
- "update1;2.19.1-4.fc8;i386;fedora",
- "The first update");
+ "evince;0.9.3-5.fc8;i386;installed",
+ "PDF Document viewer");
+ pk_backend_package (backend, PK_INFO_ENUM_AVAILABLE,
+ "scribus;1.3.4-1.fc8;i386;fedora",
+ "Scribus is an desktop open source page layout program");
pk_backend_finished (backend);
}
commit 2d6c0cc07bb59c375249c43931490f4a0cd1caa4
Author: Richard Hughes <richard at hughsie.com>
Date: Fri May 2 23:57:30 2008 +0100
remove a comment that isn't valid anymore
diff --git a/src/pk-interface-transaction.xml b/src/pk-interface-transaction.xml
index 4a5d7f7..b29d752 100644
--- a/src/pk-interface-transaction.xml
+++ b/src/pk-interface-transaction.xml
@@ -1,7 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<node name="/">
- <!-- This is not used yet, but this will be the new transaction interface in
- PackageKit 0.2.0 -->
<interface name="org.freedesktop.PackageKit.Transaction">
<method name="AcceptEula">
More information about the PackageKit-commit
mailing list