* v0.0.8
** set transfer encoding to gzip as recommended by LP documentation.
+ Only supported since Curl 7.21.6
** persistent cache for distro and arch information.
** fixed a '"' in the html output of the package page.
+** added --get-bpph-size to specify the size of the requests to get
+ the list of binary packages.
* v0.0.7
** More crash-resistant on network failure (patch from Peter
const char *ppa,
const char *package_status,
const char *output_dir,
- const int install_static_files)
+ const int install_static_files,
+ int ws_size)
{
struct ppa_stats *ppastats;
char *path, *f_dst;
free(js_dir);
}
- ppastats = create_ppa_stats(owner, ppa, package_status);
+ ppastats = create_ppa_stats(owner, ppa, package_status, ws_size);
path = path_new(output_dir, "ppa", ".html");
#include "lp.h"
+/*
+ * 'ws_size': size of the reply array of the getPublishedBinaries request.
+ */
void ppa_to_html(const char *owner,
const char *ppa,
const char *package_status,
const char *output_dir,
- const int install_static_files);
+ const int install_static_files,
+ int ws_size);
#endif
return NULL;
}
-/**
+/*
* 'archive_url': LP URL of the archive.
* 'size': size of the reply array. Between 1-300, else default value is used.
*/
static const char *default_opt = "?ws.op=getPublishedBinaries&ws.size=";
static const char *status_opt = "&status=";
char *url;
- int n;
+ size_t n;
if (size < 1 || size > 300)
size = DEFAULT_WS_SIZE;
return url;
}
-struct bpph **get_bpph_list(const char *archive_url, const char *pkg_status)
+struct bpph **get_bpph_list(const char *archive_url,
+ const char *pkg_status,
+ int ws_size)
{
char *url, *key, *tmp;
struct bpph **result;
char *date;
int ok;
- url = create_query_get_bpph(archive_url, pkg_status, -1);
+ url = create_query_get_bpph(archive_url, pkg_status, ws_size);
key = get_bpph_list_cache_key(archive_url);
#include "lp.h"
+/*
+ * 'ws_size': size of the reply array of the getPublishedBinaries request.
+ */
struct bpph **
-get_bpph_list(const char *archive_url, const char *package_status);
+get_bpph_list(const char *archive_url, const char *package_status, int ws_size);
int get_download_count(const char *archive_url);
static void display_published_binaries(const char *owner,
const char *ppa,
- const char *package_status)
+ const char *package_status,
+ int ws_size)
{
struct ppa_stats *ppastats;
struct package_stats **packages;
struct distro_stats **distros;
struct arch_stats **archs;
- ppastats = create_ppa_stats(owner, ppa, package_status);
+ ppastats = create_ppa_stats(owner, ppa, package_status, ws_size);
packages = ppastats->packages;
while (packages && *packages) {
struct package_stats *p = *packages;
{"debug", no_argument, 0, 'd'},
{"status", required_argument, 0, 's'},
{"skip-js-css", no_argument, 0, 'S'},
+ {"get-bpph-size", required_argument, 0, 0},
{0, 0, 0, 0}
};
puts(_(
" -S, --skip-js-css skip installation of js and css files"));
+ puts(_(
+" --get-bpph-size=[s] size of the replies of webservice requests to get\n"
+" the list of binary packages. Between 1 and 300."));
puts("");
printf(_("Report bugs to: %s\n"), PACKAGE_BUGREPORT);
int main(int argc, char **argv)
{
char *owner, *ppa, *package_status, *output_dir;
- int optc, output_html, cmdok, install_static_files;
+ int optc, output_html, cmdok, install_static_files, ws_size, opti;
program_name = argv[0];
output_dir = NULL;
package_status = NULL;
output_html = 0;
+ ws_size = -1;
while ((optc = getopt_long(argc, argv, "vho:ds:S", long_options,
- NULL)) != -1) {
+ &opti)) != -1) {
switch (optc) {
+ case 0:
+ if (!strcmp(long_options[opti].name, "get-bpph-size"))
+ ws_size = atoi(optarg);
+ break;
case 'o':
output_html = 1;
output_dir = strdup(optarg);
if (output_html)
ppa_to_html(owner, ppa, package_status, output_dir,
- install_static_files);
+ install_static_files, ws_size);
else
- display_published_binaries(owner, ppa, package_status);
+ display_published_binaries(owner, ppa, package_status, ws_size);
/* for valgrind.... */
free(package_status);
.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.40.4.
-.TH PPASTATS "1" "May 2012" "ppastats 0.0.x" "User Commands"
+.TH PPASTATS "1" "July 2012" "ppastats 0.0.x" "User Commands"
.SH NAME
ppastats \- PPA Statistics command line tool
.SH SYNOPSIS
.TP
\fB\-S\fR, \fB\-\-skip\-js\-css\fR
skip installation of js and css files
+.TP
+\fB\-\-get\-bpph\-size\fR=\fI[s]\fR
+size of the replies of webservice requests to get
+the list of binary packages. Between 1 and 300.
.SH "REPORTING BUGS"
Report bugs to: jeanfi@gmail.com
.PP
struct ppa_stats *
create_ppa_stats(const char *owner,
const char *ppa_name,
- const char *package_status)
+ const char *package_status,
+ int ws_size)
{
struct ppa_stats *ppa;
struct bpph **history, **h_cur, *h;
struct daily_download_total **totals;
ppa_url = get_archive_url(owner, ppa_name);
- history = get_bpph_list(ppa_url, package_status);
+ history = get_bpph_list(ppa_url, package_status, ws_size);
free(ppa_url);
if (!history) {
struct daily_download_total **daily_download_totals;
};
+/*
+ * 'ws_size': size of the reply array of the getPublishedBinaries request.
+ */
struct ppa_stats *create_ppa_stats(const char *owner,
const char *ppa,
- const char *package_status);
+ const char *package_status,
+ int ws_size);
void ppa_stats_free(struct ppa_stats *ppastats);
#endif