[maemo-commits] [maemo-commits] r15229 - in projects/haf/trunk/apt: . debian methods

From: subversion at stage.maemo.org subversion at stage.maemo.org
Date: Tue Feb 26 13:30:52 EET 2008
Author: marivoll
Date: 2008-02-26 13:30:51 +0200 (Tue, 26 Feb 2008)
New Revision: 15229

Modified:
   projects/haf/trunk/apt/configure.in
   projects/haf/trunk/apt/debian/changelog
   projects/haf/trunk/apt/http-tablet-identification.patch
   projects/haf/trunk/apt/methods/http.cc
Log:


Modified: projects/haf/trunk/apt/configure.in
===================================================================
--- projects/haf/trunk/apt/configure.in	2008-02-26 11:10:32 UTC (rev 15228)
+++ projects/haf/trunk/apt/configure.in	2008-02-26 11:30:51 UTC (rev 15229)
@@ -18,7 +18,7 @@
 AC_CONFIG_HEADER(include/config.h:buildlib/config.h.in include/apti18n.h:buildlib/apti18n.h.in)
 
 dnl -- SET THIS TO THE RELEASE VERSION --
-AC_DEFINE_UNQUOTED(VERSION,"0.7.6maemo0")
+AC_DEFINE_UNQUOTED(VERSION,"0.7.6maemo1~unreleased")
 PACKAGE="apt"
 AC_DEFINE_UNQUOTED(PACKAGE,"$PACKAGE")
 AC_SUBST(PACKAGE)

Modified: projects/haf/trunk/apt/debian/changelog
===================================================================
--- projects/haf/trunk/apt/debian/changelog	2008-02-26 11:10:32 UTC (rev 15228)
+++ projects/haf/trunk/apt/debian/changelog	2008-02-26 11:30:51 UTC (rev 15229)
@@ -1,3 +1,10 @@
+apt (0.7.6maemo2~unreleased) unstable; urgency=low
+
+  * Updated http-tablet-identification.patch: Get product hardware id from
+    /proc/component_version, not from environment.  This is more reliable.
+
+ -- Marius Vollmer <marius.vollmer at nokia.com>  Tue, 18 Dec 2007 20:25:13 +0200
+
 apt (0.7.6maemo1) unstable; urgency=low
 
   * Don't depend on debian-archive-keyring.  Don't don't do anything with

Modified: projects/haf/trunk/apt/http-tablet-identification.patch
===================================================================
--- projects/haf/trunk/apt/http-tablet-identification.patch	2008-02-26 11:10:32 UTC (rev 15228)
+++ projects/haf/trunk/apt/http-tablet-identification.patch	2008-02-26 11:30:51 UTC (rev 15229)
@@ -1,15 +1,56 @@
-Index: methods/http.cc
-===================================================================
---- methods/http.cc	(revision 14875)
-+++ methods/http.cc	(working copy)
-@@ -714,6 +714,21 @@
+--- methods/http.cc.noid	2007-12-18 19:48:17.000000000 +0200
++++ methods/http.cc	2007-12-18 20:07:00.000000000 +0200
+@@ -631,6 +631,42 @@
+    return true;
+ }
+ 									/*}}}*/
++static const char *
++get_osso_product_hardware ()
++{
++  static char *product_hardware = NULL;
++
++  if (product_hardware)
++    return product_hardware;
++
++  /* XXX - There is a library in maemo somewhere to do this, but it is
++           not included in the maemo SDK, so we have to do it
++           ourselves.  Ridiculous, I know.
++  */
++
++  product_hardware = "";
++  FILE *f = fopen ("/proc/component_version", "r");
++  if (f)
++    {
++      char *line = NULL;
++      size_t len = 0;
++      ssize_t n;
++
++      while ((n = getline (&line, &len, f)) != -1)
++	{
++	  if (n > 0 && line[n-1] == '\n')
++	    line[n-1] = '\0';
++
++	  if (sscanf (line, "product %as", &product_hardware) == 1)
++	    break;
++	}
++
++      free (line);
++      fclose (f);
++    }
++
++  return product_hardware;
++}
+ 
+ // HttpMethod::SendReq - Send the HTTP request				/*{{{*/
+ // ---------------------------------------------------------------------
+@@ -714,6 +750,21 @@
     if (Uri.User.empty() == false || Uri.Password.empty() == false)
        Req += string("Authorization: Basic ") + 
            Base64Encode(Uri.User + ":" + Uri.Password) + "\r\n";
 +   else
 +     {
-+       const char *product_hardware = getenv ("OSSO_PRODUCT_HARDWARE");
-+       if (product_hardware)
++       const char *product_hardware = get_osso_product_hardware ();
++       if (product_hardware && product_hardware[0])
 +	 {
 +	   /* This is a cookie that identifies Internet Tablets to the
 +	      server.  We use the Authorization header since that is

Modified: projects/haf/trunk/apt/methods/http.cc
===================================================================
--- projects/haf/trunk/apt/methods/http.cc	2008-02-26 11:10:32 UTC (rev 15228)
+++ projects/haf/trunk/apt/methods/http.cc	2008-02-26 11:30:51 UTC (rev 15229)
@@ -631,7 +631,43 @@
    return true;
 }
 									/*}}}*/
+static const char *
+get_osso_product_hardware ()
+{
+  static char *product_hardware = NULL;
 
+  if (product_hardware)
+    return product_hardware;
+
+  /* XXX - There is a library in maemo somewhere to do this, but it is
+           not included in the maemo SDK, so we have to do it
+           ourselves.  Ridiculous, I know.
+  */
+
+  product_hardware = "";
+  FILE *f = fopen ("/proc/component_version", "r");
+  if (f)
+    {
+      char *line = NULL;
+      size_t len = 0;
+      ssize_t n;
+
+      while ((n = getline (&line, &len, f)) != -1)
+	{
+	  if (n > 0 && line[n-1] == '\n')
+	    line[n-1] = '\0';
+
+	  if (sscanf (line, "product %as", &product_hardware) == 1)
+	    break;
+	}
+
+      free (line);
+      fclose (f);
+    }
+
+  return product_hardware;
+}
+
 // HttpMethod::SendReq - Send the HTTP request				/*{{{*/
 // ---------------------------------------------------------------------
 /* This places the http request in the outbound buffer */
@@ -716,8 +752,8 @@
           Base64Encode(Uri.User + ":" + Uri.Password) + "\r\n";
    else
      {
-       const char *product_hardware = getenv ("OSSO_PRODUCT_HARDWARE");
-       if (product_hardware)
+       const char *product_hardware = get_osso_product_hardware ();
+       if (product_hardware && product_hardware[0])
 	 {
 	   /* This is a cookie that identifies Internet Tablets to the
 	      server.  We use the Authorization header since that is


More information about the maemo-commits mailing list