projects
/
ppastats.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
added --get-bpph-size to specify the size of the requests to get the list of binary...
[ppastats.git]
/
src
/
main.c
diff --git
a/src/main.c
b/src/main.c
index
9aac447
..
8af2dc6
100644
(file)
--- a/
src/main.c
+++ b/
src/main.c
@@
-27,6
+27,7
@@
#include "cache.h"
#include "html.h"
#include "cache.h"
#include "html.h"
+#include "http.h"
#include "log.h"
#include "lp_ws.h"
#include "config.h"
#include "log.h"
#include "lp_ws.h"
#include "config.h"
@@
-36,7
+37,8
@@
static const char *program_name;
static void display_published_binaries(const char *owner,
const char *ppa,
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 ppa_stats *ppastats;
struct package_stats **packages;
@@
-44,7
+46,7
@@
static void display_published_binaries(const char *owner,
struct distro_stats **distros;
struct arch_stats **archs;
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;
packages = ppastats->packages;
while (packages && *packages) {
struct package_stats *p = *packages;
@@
-93,14
+95,14
@@
static struct option long_options[] = {
{"debug", no_argument, 0, 'd'},
{"status", required_argument, 0, 's'},
{"skip-js-css", no_argument, 0, 'S'},
{"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}
};
static void print_version()
{
printf("ppastats %s\n", VERSION);
{0, 0, 0, 0}
};
static void print_version()
{
printf("ppastats %s\n", VERSION);
- printf(_(
-"Copyright (C) %s jeanfi@gmail.com\n"
+ printf(_("Copyright (C) %s jeanfi@gmail.com\n"
"License GPLv2: GNU GPL version 2 or later\n"
"<http://www.gnu.org/licenses/old-licenses/gpl-2.0.html>\n"
"This is free software: you are free to change and redistribute it.\n"
"License GPLv2: GNU GPL version 2 or later\n"
"<http://www.gnu.org/licenses/old-licenses/gpl-2.0.html>\n"
"This is free software: you are free to change and redistribute it.\n"
@@
-114,29
+116,29
@@
static void print_help()
puts(_(
"ppastats is a command application for generating PPA statistics.\n"));
puts(_(
"ppastats is a command application for generating PPA statistics.\n"));
-
puts(_(
"Prints number of downloads for each published packages of a PPA or generates\n"
"an HTML page containing a graph representation."));
puts("");
puts(_("Options:"));
puts(_(
"Prints number of downloads for each published packages of a PPA or generates\n"
"an HTML page containing a graph representation."));
puts("");
puts(_("Options:"));
- puts(_(
-" -h, --help display this help and exit\n"
-" -v, --version display version information and exit"));
+ puts(_(" -h, --help display this help and exit"));
+ puts(_(" -v, --version display version information and exit"));
puts("");
puts("");
- puts(_(
-" -o, --output-dir=[PATH] generates HTML pages into 'PATH'."));
+ puts(_(" -o, --output-dir=[PATH] generates HTML pages into 'PATH'"));
puts(_(
" -s, --status=[STATUS] retrieves only package of the given status\n"
" (possible values are: Pending, Published,\n"
puts(_(
" -s, --status=[STATUS] retrieves only package of the given status\n"
" (possible values are: Pending, Published,\n"
-" Superseded, Deleted or Obsolete)
.
"));
+" Superseded, Deleted or Obsolete)"));
puts(_(
" -S, --skip-js-css skip installation of js and css files"));
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);
puts("");
printf(_("Report bugs to: %s\n"), PACKAGE_BUGREPORT);
@@
-147,7
+149,7
@@
static void print_help()
int main(int argc, char **argv)
{
char *owner, *ppa, *package_status, *output_dir;
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];
program_name = argv[0];
@@
-160,10
+162,15
@@
int main(int argc, char **argv)
output_dir = NULL;
package_status = NULL;
output_html = 0;
output_dir = NULL;
package_status = NULL;
output_html = 0;
+ ws_size = -1;
while ((optc = getopt_long(argc, argv, "vho:ds:S", long_options,
while ((optc = getopt_long(argc, argv, "vho:ds:S", long_options,
-
NULL
)) != -1) {
+
&opti
)) != -1) {
switch (optc) {
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);
case 'o':
output_html = 1;
output_dir = strdup(optarg);
@@
-201,14
+208,14
@@
int main(int argc, char **argv)
if (output_html)
ppa_to_html(owner, ppa, package_status, output_dir,
if (output_html)
ppa_to_html(owner, ppa, package_status, output_dir,
- install_static_files);
+ install_static_files
, ws_size
);
else
else
- display_published_binaries(owner, ppa, package_status);
+ display_published_binaries(owner, ppa, package_status
, ws_size
);
/* for valgrind.... */
free(package_status);
free(output_dir);
/* for valgrind.... */
free(package_status);
free(output_dir);
-
lp_ws
_cleanup();
+
http
_cleanup();
cache_cleanup();
exit(EXIT_SUCCESS);
cache_cleanup();
exit(EXIT_SUCCESS);