Send commitlog mailing list submissions to
        [email protected]

To subscribe or unsubscribe via the World Wide Web, visit
        http://lists.openmoko.org/mailman/listinfo/commitlog
or, via email, send a message with subject or body 'help' to
        [EMAIL PROTECTED]

You can reach the person managing the list at
        [EMAIL PROTECTED]

When replying, please edit your Subject line so it is more specific
than "Re: Contents of commitlog digest..."
Today's Topics:

   1. r4015 - trunk/src/target/opkg ([EMAIL PROTECTED])
   2. r4016 - trunk/src/target/opkg ([EMAIL PROTECTED])
   3. r4017 - trunk/src/target/opkg ([EMAIL PROTECTED])
--- Begin Message ---
Author: thomas
Date: 2008-02-04 12:33:41 +0100 (Mon, 04 Feb 2008)
New Revision: 4015

Modified:
   trunk/src/target/opkg/pkg_parse.c
Log:
opkg: fix pkg_parse_raw() bug where architecture is set to an invalid value


Modified: trunk/src/target/opkg/pkg_parse.c
===================================================================
--- trunk/src/target/opkg/pkg_parse.c   2008-02-03 23:31:11 UTC (rev 4014)
+++ trunk/src/target/opkg/pkg_parse.c   2008-02-04 11:33:41 UTC (rev 4015)
@@ -274,7 +274,6 @@
                    pkg->auto_installed = 1;
                }
                free(auto_installed_value);
-               pkg->architecture = parseGenericFieldType("Auto-Installed", 
*lines);
            }
            break;
 




--- End Message ---
--- Begin Message ---
Author: thomas
Date: 2008-02-05 10:25:03 +0100 (Tue, 05 Feb 2008)
New Revision: 4016

Added:
   trunk/src/target/opkg/opkg_state.c
   trunk/src/target/opkg/opkg_state.h
Modified:
   trunk/src/target/opkg/Makefile.am
   trunk/src/target/opkg/libopkg.h
Log:
opkg: add internal state framework


Modified: trunk/src/target/opkg/Makefile.am
===================================================================
--- trunk/src/target/opkg/Makefile.am   2008-02-04 11:33:41 UTC (rev 4015)
+++ trunk/src/target/opkg/Makefile.am   2008-02-05 09:25:03 UTC (rev 4016)
@@ -57,7 +57,7 @@
 opkg_core_sources = args.c args.h opkg.c \
                    user.c user.h 
 opkg_libcore_sources = args.c args.h libopkg.c libopkg.h opkg.h\
-                   user.c user.h 
+                   user.c user.h opkg_state.c opkg_state.h
 opkg_cmd_sources = opkg_cmd.c opkg_cmd.h \
                   opkg_configure.c opkg_configure.h \
                   opkg_download.c opkg_download.h \

Modified: trunk/src/target/opkg/libopkg.h
===================================================================
--- trunk/src/target/opkg/libopkg.h     2008-02-04 11:33:41 UTC (rev 4015)
+++ trunk/src/target/opkg/libopkg.h     2008-02-05 09:25:03 UTC (rev 4016)
@@ -25,6 +25,7 @@
 
 #include "opkg_conf.h"
 #include "opkg_message.h"
+#include "opkg_state.h"
 
 #include "args.h"
 #include "pkg.h"
@@ -37,6 +38,7 @@
        void *userdata);
 typedef char* (*opkg_response_callback)(char *question);
 typedef void (*opkg_download_progress_callback)(int percent, char *url);
+typedef void (*opkg_state_changed_callback)(opkg_state_t state, const char 
*data);
 
 extern int opkg_op(int argc, char *argv[]); /* opkglib.c */
 extern int opkg_init (opkg_message_callback mcall, 
@@ -79,7 +81,8 @@
 extern opkg_response_callback opkg_cb_response;
 extern opkg_status_callback opkg_cb_status;
 extern opkg_list_callback opkg_cb_list;
-extern opkg_download_progress_callback opkg_cb_download_progress; /* 
ipkg_download.c */
+extern opkg_download_progress_callback opkg_cb_download_progress; /* 
opkg_download.c */
+extern opkg_state_changed_callback opkg_cb_state_changed; /* opkg_state.c */
 
 extern void push_error_list(struct errlist **errors,char * msg);
 extern void reverse_error_list(struct errlist **errors);

Added: trunk/src/target/opkg/opkg_state.c
===================================================================
--- trunk/src/target/opkg/opkg_state.c  2008-02-04 11:33:41 UTC (rev 4015)
+++ trunk/src/target/opkg/opkg_state.c  2008-02-05 09:25:03 UTC (rev 4016)
@@ -0,0 +1,41 @@
+/* opkg_state.c - the opkg package management system
+
+   Thomas Wood <[EMAIL PROTECTED]>
+
+   Copyright (C) 2008 by OpenMoko Inc
+
+   This program is free software; you can redistribute it and/or
+   modify it under the terms of the GNU General Public License as
+   published by the Free Software Foundation; either version 2, or (at
+   your option) any later version.
+
+   This program is distributed in the hope that it will be useful, but
+   WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   General Public License for more details.
+*/
+
+#include "libopkg.h"
+
+opkg_state_changed_callback opkg_cb_state;
+
+static opkg_state_t opkg_state = 0;
+static char *opkg_state_data = NULL;
+
+void
+opkg_set_current_state (opkg_state_t state, const char *data)
+{
+  if (opkg_state_data)
+    free (opkg_state_data);
+  opkg_state_data = malloc (strlen (data));
+  strcpy (opkg_state_data, data);
+
+  opkg_state = state;
+}
+
+void
+opkg_get_current_state (opkg_state_t *state, const char **data)
+{
+  *state = opkg_state;
+  *data = opkg_state_data;
+}

Added: trunk/src/target/opkg/opkg_state.h
===================================================================
--- trunk/src/target/opkg/opkg_state.h  2008-02-04 11:33:41 UTC (rev 4015)
+++ trunk/src/target/opkg/opkg_state.h  2008-02-05 09:25:03 UTC (rev 4016)
@@ -0,0 +1,30 @@
+/* opkg_state.c - the opkg package management system
+
+   Thomas Wood <[EMAIL PROTECTED]>
+
+   Copyright (C) 2008 by OpenMoko Inc
+
+   This program is free software; you can redistribute it and/or
+   modify it under the terms of the GNU General Public License as
+   published by the Free Software Foundation; either version 2, or (at
+   your option) any later version.
+
+   This program is distributed in the hope that it will be useful, but
+   WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   General Public License for more details.
+*/
+
+
+
+typedef enum _opkg_state {
+  OPKG_STATE_NONE,
+  OPKG_STATE_DOWNLOADING_PKG,
+  OPKG_STATE_INSTALLING_PKG,
+  OPKG_STATE_CONFIGURING_PKG,
+  OPKG_STATE_UPGRADING_PKG,
+  OPKG_STATE_REMOVING_PKG,
+  OPKG_STATE_DOWNLOADING_REPOSITORY,
+  OPKG_STATE_VERIFYING_REPOSITORY_SIGNITURE
+} opkg_state_t;
+




--- End Message ---
--- Begin Message ---
Author: thomas
Date: 2008-02-05 11:11:00 +0100 (Tue, 05 Feb 2008)
New Revision: 4017

Modified:
   trunk/src/target/opkg/opkg_configure.c
   trunk/src/target/opkg/opkg_download.c
   trunk/src/target/opkg/opkg_install.c
   trunk/src/target/opkg/opkg_state.c
   trunk/src/target/opkg/opkg_state.h
Log:
opkg: add downloading, configuring and installing state changes


Modified: trunk/src/target/opkg/opkg_configure.c
===================================================================
--- trunk/src/target/opkg/opkg_configure.c      2008-02-05 09:25:03 UTC (rev 
4016)
+++ trunk/src/target/opkg/opkg_configure.c      2008-02-05 10:11:00 UTC (rev 
4017)
@@ -18,6 +18,7 @@
 #include "opkg.h"
 
 #include "opkg_configure.h"
+#include "opkg_state.h"
 
 int opkg_configure(opkg_conf_t *conf, pkg_t *pkg)
 {
@@ -28,6 +29,12 @@
        end of opkg_install(). Do we care? */
     /* DPKG_INCOMPATIBILITY:
        dpkg actually includes a version number to this script call */
+
+    char *pkgid;
+    sprintf_alloc (&pkgid, "%s;%s;%s;", pkg->name, pkg->version, 
pkg->architecture);
+    opkg_set_current_state (OPKG_STATE_CONFIGURING_PKG, pkgid);
+    free (pkgid);
+
     err = pkg_run_script(conf, pkg, "postinst", "configure");
     if (err) {
        printf("ERROR: %s.postinst returned %d\n", pkg->name, err);
@@ -35,6 +42,7 @@
     }
 
     opkg_state_changed++;
+    opkg_set_current_state (OPKG_STATE_NONE, NULL);
     return 0;
 }
 

Modified: trunk/src/target/opkg/opkg_download.c
===================================================================
--- trunk/src/target/opkg/opkg_download.c       2008-02-05 09:25:03 UTC (rev 
4016)
+++ trunk/src/target/opkg/opkg_download.c       2008-02-05 10:11:00 UTC (rev 
4017)
@@ -201,6 +201,7 @@
 {
     int err;
     char *url;
+    char *pkgid;
 
     if (pkg->src == NULL) {
        opkg_message(conf,OPKG_ERROR, "ERROR: Package %s (parent %s) is not 
available from any configured src.\n",
@@ -208,6 +209,10 @@
        return -1;
     }
 
+    sprintf_alloc (&pkgid, "%s;%s;%s;", pkg->name, pkg->version, 
pkg->architecture);
+    opkg_set_current_state (OPKG_STATE_DOWNLOADING_PKG, pkgid);
+    free (pkgid);
+
     sprintf_alloc(&url, "%s/%s", pkg->src->value, pkg->filename);
 
     /* XXX: BUG: The pkg->filename might be something like
@@ -219,6 +224,7 @@
     err = opkg_download(conf, url, pkg->local_filename);
     free(url);
 
+    opkg_set_current_state (OPKG_STATE_NONE, NULL);
     return err;
 }
 

Modified: trunk/src/target/opkg/opkg_install.c
===================================================================
--- trunk/src/target/opkg/opkg_install.c        2008-02-05 09:25:03 UTC (rev 
4016)
+++ trunk/src/target/opkg/opkg_install.c        2008-02-05 10:11:00 UTC (rev 
4017)
@@ -34,6 +34,7 @@
 
 #include "opkg_utils.h"
 #include "opkg_message.h"
+#include "opkg_state.h"
 
 #include "sprintf_alloc.h"
 #include "file_util.h"
@@ -751,6 +752,7 @@
      abstract_pkg_t *ab_pkg = NULL;
      int old_state_flag;
      char* file_md5;
+     char *pkgid;
 
     
      if ( from_upgrade ) 
@@ -851,6 +853,10 @@
      replacees = pkg_vec_alloc();
      pkg_get_installed_replacees(conf, pkg, replacees);
 
+     sprintf_alloc (&pkgid, "%s;%s;%s;", pkg->name, pkg->version, 
pkg->architecture);
+     opkg_set_current_state (OPKG_STATE_INSTALLING_PKG, pkgid);
+     free (pkgid);
+
      /* this next section we do with SIGINT blocked to prevent inconsistency 
between opkg database and filesystem */
      {
          sigset_t newset, oldset;
@@ -991,6 +997,7 @@
 
          return err;
      }
+     opkg_set_current_state (OPKG_STATE_NONE, NULL);
 }
 
 static int prerm_upgrade_old_pkg(opkg_conf_t *conf, pkg_t *pkg, pkg_t *old_pkg)

Modified: trunk/src/target/opkg/opkg_state.c
===================================================================
--- trunk/src/target/opkg/opkg_state.c  2008-02-05 09:25:03 UTC (rev 4016)
+++ trunk/src/target/opkg/opkg_state.c  2008-02-05 10:11:00 UTC (rev 4017)
@@ -16,7 +16,23 @@
 */
 
 #include "libopkg.h"
+#include "opkg_state.h"
 
+
+static char *state_strings[] =
+{
+  "None",
+  "Downloading Package",
+  "Installing Package",
+  "Configuring Package",
+  "Upgrading Package",
+  "Removing Package",
+  "Downloading Repository",
+  "Verifying Repository Signature"
+};
+
+
+
 opkg_state_changed_callback opkg_cb_state;
 
 static opkg_state_t opkg_state = 0;
@@ -27,10 +43,19 @@
 {
   if (opkg_state_data)
     free (opkg_state_data);
-  opkg_state_data = malloc (strlen (data));
-  strcpy (opkg_state_data, data);
+  if (data)
+  {
+    opkg_state_data = malloc (strlen (data));
+    strcpy (opkg_state_data, data);
+  }
+  else
+  {
+    opkg_state_data = NULL;
+  }
 
   opkg_state = state;
+
+  printf ("opkg state set to %s: %s\n", state_strings[state], data);
 }
 
 void

Modified: trunk/src/target/opkg/opkg_state.h
===================================================================
--- trunk/src/target/opkg/opkg_state.h  2008-02-05 09:25:03 UTC (rev 4016)
+++ trunk/src/target/opkg/opkg_state.h  2008-02-05 10:11:00 UTC (rev 4017)
@@ -15,8 +15,9 @@
    General Public License for more details.
 */
 
+#ifndef OPKG_STATE_H
+#define OPKG_STATE_H
 
-
 typedef enum _opkg_state {
   OPKG_STATE_NONE,
   OPKG_STATE_DOWNLOADING_PKG,
@@ -25,6 +26,7 @@
   OPKG_STATE_UPGRADING_PKG,
   OPKG_STATE_REMOVING_PKG,
   OPKG_STATE_DOWNLOADING_REPOSITORY,
-  OPKG_STATE_VERIFYING_REPOSITORY_SIGNITURE
+  OPKG_STATE_VERIFYING_REPOSITORY_SIGNATURE
 } opkg_state_t;
 
+#endif /* OPKG_STATE_H */




--- End Message ---
_______________________________________________
commitlog mailing list
[email protected]
http://lists.openmoko.org/mailman/listinfo/commitlog

Reply via email to