Added distro/arch information in package version page
authorJean-Philippe Orsini <jeanfi@gmail.com>
Sat, 3 Sep 2011 10:09:41 +0000 (10:09 +0000)
committerJean-Philippe Orsini <jeanfi@gmail.com>
Sat, 3 Sep 2011 10:09:41 +0000 (10:09 +0000)
NEWS
configure
configure.ac
src/html.c
src/ppastats.c
src/ppastats.h
www/css/ppastats.css
www/js/ppastats.js

diff --git a/NEWS b/NEWS
index 9323cbc..c3c953a 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -1,5 +1,6 @@
 * v0.0.3
 ** Generated HTML pages for package versions.
+** Added distro/arch information in package version page.
 
 * v0.0.2
 ** Generated HTML pages are now using JQuery+JQPlout instead of Google Chart.
index 5936c42..4768a41 100755 (executable)
--- a/configure
+++ b/configure
@@ -1,6 +1,6 @@
 #! /bin/sh
 # Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.67 for ppastats 0.0.2.
+# Generated by GNU Autoconf 2.67 for ppastats 0.0.3.
 #
 # Report bugs to <jeanfi@gmail.com>.
 #
@@ -552,8 +552,8 @@ MAKEFLAGS=
 # Identity of this package.
 PACKAGE_NAME='ppastats'
 PACKAGE_TARNAME='ppastats'
-PACKAGE_VERSION='0.0.2'
-PACKAGE_STRING='ppastats 0.0.2'
+PACKAGE_VERSION='0.0.3'
+PACKAGE_STRING='ppastats 0.0.3'
 PACKAGE_BUGREPORT='jeanfi@gmail.com'
 PACKAGE_URL='http://wpitchoune.net/ppastats'
 
@@ -1253,7 +1253,7 @@ if test "$ac_init_help" = "long"; then
   # Omit some internal or obsolete options to make the list less imposing.
   # This message is too long to be a string in the A/UX 3.1 sh.
   cat <<_ACEOF
-\`configure' configures ppastats 0.0.2 to adapt to many kinds of systems.
+\`configure' configures ppastats 0.0.3 to adapt to many kinds of systems.
 
 Usage: $0 [OPTION]... [VAR=VALUE]...
 
@@ -1323,7 +1323,7 @@ fi
 
 if test -n "$ac_init_help"; then
   case $ac_init_help in
-     short | recursive ) echo "Configuration of ppastats 0.0.2:";;
+     short | recursive ) echo "Configuration of ppastats 0.0.3:";;
    esac
   cat <<\_ACEOF
 
@@ -1426,7 +1426,7 @@ fi
 test -n "$ac_init_help" && exit $ac_status
 if $ac_init_version; then
   cat <<\_ACEOF
-ppastats configure 0.0.2
+ppastats configure 0.0.3
 generated by GNU Autoconf 2.67
 
 Copyright (C) 2010 Free Software Foundation, Inc.
@@ -1728,7 +1728,7 @@ cat >config.log <<_ACEOF
 This file contains any messages produced by compilers while
 running configure, to aid debugging if configure makes a mistake.
 
-It was created by ppastats $as_me 0.0.2, which was
+It was created by ppastats $as_me 0.0.3, which was
 generated by GNU Autoconf 2.67.  Invocation command line was
 
   $ $0 $@
@@ -2544,7 +2544,7 @@ fi
 
 # Define the identity of the package.
  PACKAGE='ppastats'
- VERSION='0.0.2'
+ VERSION='0.0.3'
 
 
 cat >>confdefs.h <<_ACEOF
@@ -5270,7 +5270,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
 # report actual input values of CONFIG_FILES etc. instead of their
 # values after options handling.
 ac_log="
-This file was extended by ppastats $as_me 0.0.2, which was
+This file was extended by ppastats $as_me 0.0.3, which was
 generated by GNU Autoconf 2.67.  Invocation command line was
 
   CONFIG_FILES    = $CONFIG_FILES
@@ -5337,7 +5337,7 @@ _ACEOF
 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
 ac_cs_version="\\
-ppastats config.status 0.0.2
+ppastats config.status 0.0.3
 configured by $0, generated by GNU Autoconf 2.67,
   with options \\"\$ac_cs_config\\"
 
index 1caffa4..e11923f 100644 (file)
@@ -2,7 +2,7 @@
 # Process this file with autoconf to produce a configure script.
 
 AC_PREREQ([2.64])
-AC_INIT([ppastats], [0.0.2],[jeanfi@gmail.com],[ppastats],[http://wpitchoune.net/ppastats])
+AC_INIT([ppastats], [0.0.3],[jeanfi@gmail.com],[ppastats],[http://wpitchoune.net/ppastats])
 
 AM_INIT_AUTOMAKE([-Wall -Werror gnu])
 
index 9a35c14..6ae462d 100644 (file)
@@ -98,6 +98,10 @@ enum file_copy_error {
           <span id=\"ppa_owner\">N/A</span>/<span id=\"ppa_name\">N/A</span>\n\
        </a></p>\n\
     <div id=\"chart\"></div>\n\
+    <div class=\"distros\">\n\
+       <em>Distros</em>:\n\
+       <ul id=\"distros\"></ul>\n\
+    </div>\n\
   </body>\n\
 </html>"
 
@@ -255,8 +259,10 @@ static char *version_to_json(struct ppa_stats *ppa,
                             struct package_stats *pkg,
                             struct version_stats *ver)
 {
-       json_object *json;
        char *ret;
+       struct distro_stats **distros, *distro;
+       json_object *json, *json_distros, *json_distro, *json_archs, *json_arch;
+       struct arch_stats **archs;
 
        json = json_object_new_object();
 
@@ -274,6 +280,42 @@ static char *version_to_json(struct ppa_stats *ppa,
 
        json_add_ddts(json, ver->daily_download_totals);
 
+       distros = ver->distros;
+       json_distros = json_object_new_array();
+       json_object_object_add(json, "distros", json_distros);
+       while (*distros) {
+               distro = *distros;
+               json_distro = json_object_new_object();
+
+               json_object_array_add(json_distros, json_distro);
+
+               json_object_object_add(json_distro,
+                                      "name",
+                                      json_object_new_string(distro->name));
+
+               archs = distro->archs;
+               json_archs = json_object_new_array();
+               json_object_object_add(json_distro, "archs", json_archs);
+               while (*archs) {
+                       json_arch = json_object_new_object();
+
+                       json_object_object_add
+                               (json_arch,
+                                "name",
+                                json_object_new_string((*archs)->name));
+
+                       json_object_object_add
+                               (json_arch,
+                                "count",
+                                json_object_new_int((*archs)->download_count));
+
+                       json_object_array_add(json_archs, json_arch);
+                       archs++;
+               }
+
+               distros++;
+       }
+
        ret = strdup(json_object_to_json_string(json));
 
        json_object_put(json);
index 032a537..1fa0e81 100644 (file)
@@ -100,7 +100,6 @@ static struct distro_stats *get_distro_stats(struct version_stats *version,
        d->name = strdup(name);
        d->archs = NULL;
        d->download_count = 0;
-       d->daily_download_totals = NULL;
 
        version->distros
                = (struct distro_stats **)list_add((void **)version->distros,
@@ -126,7 +125,6 @@ static struct arch_stats *get_arch_stats(struct distro_stats *distro,
 
        a = malloc(sizeof(struct arch_stats));
        a->name = strdup(name);
-       a->daily_download_totals = NULL;
        a->download_count = 0;
 
        distro->archs
index 615e2c2..0c1a90f 100644 (file)
@@ -27,7 +27,6 @@ extern int debug;
 struct arch_stats {
        char *name;
 
-       struct daily_download_total *daily_download_totals;
        int download_count;
 };
 
@@ -36,7 +35,6 @@ struct distro_stats {
 
        struct arch_stats **archs;
        int download_count;
-       struct daily_download_total *daily_download_totals;
 };
 
 struct version_stats {
index 1d3f636..d266644 100644 (file)
@@ -28,8 +28,21 @@ a:hover {
     font-size: 0.75em;
 }
 
-#versions {
+#versions, div.distros {
     width: 20%;
     float: left;
 }
 
+li {
+    list-style: none;
+    padding: 0em 0em 0em 1em;
+}
+
+h1 {
+    text-transform: uppercase;
+}
+
+ul {
+    margin: 0 0 0 0;
+    padding: 0 0 0;
+}
\ No newline at end of file
index 4a1e5b8..43c75be 100644 (file)
@@ -53,10 +53,12 @@ function ppastats_ver() {
        var ddts = data["ddts"];
        var max_date = null;
        var min_date = null;
+       var pkg_url = data["pkg_name"]+".html";
        
        $("#ppa_owner").html(data["ppa_owner"]);
        $("#ppa_name").html(data["ppa_name"]);
-       $("#pkg_name").html(data["name"]);
+       $("#pkg_name").html("<a href='"+pkg_url+"'>"+data["pkg_name"]+"</a>");
+       $("#version").append(" "+data["name"]);
        
        $.each(ddts, function(i, item) {
             var tm = item["time"];
@@ -72,6 +74,12 @@ function ppastats_ver() {
                min_date = d;
             }
        });
+
+       $.each(data["distros"], function(i, distro) {
+           $.each(distro["archs"], function(i, arch) {
+               $("#distros").append("<li><em>"+distro["name"]+"_"+arch["name"]+"</em>: "+arch["count"]+"</li");
+           });
+       });
        
        var plot1 = $.jqplot ('chart', [data_chart], {
             axes: {