author | Michael Krelin <hacker@klever.net> | 2007-02-21 00:54:53 (UTC) |
---|---|---|
committer | Michael Krelin <hacker@klever.net> | 2007-02-21 00:54:53 (UTC) |
commit | 7232b0256da0c1b1577ce3bf55868d74f36f4dd4 (patch) (side-by-side diff) | |
tree | 11324c1b2f045a39594c757845389d9808608115 /www-misc | |
parent | a76fc1c7bbf5bc64dbb377752c98414b62af8353 (diff) | |
download | misc-7232b0256da0c1b1577ce3bf55868d74f36f4dd4.zip misc-7232b0256da0c1b1577ce3bf55868d74f36f4dd4.tar.gz misc-7232b0256da0c1b1577ce3bf55868d74f36f4dd4.tar.bz2 |
mergelog: added splitlog patch
-rw-r--r-- | www-misc/mergelog/Manifest | 12 | ||||
-rw-r--r-- | www-misc/mergelog/files/mergelog-split.patch | 516 | ||||
-rw-r--r-- | www-misc/mergelog/mergelog-4.5.ebuild | 21 |
3 files changed, 541 insertions, 8 deletions
diff --git a/www-misc/mergelog/Manifest b/www-misc/mergelog/Manifest index 52c5c07..569a966 100644 --- a/www-misc/mergelog/Manifest +++ b/www-misc/mergelog/Manifest @@ -1,8 +1,12 @@ +AUX mergelog-split.patch 16343 RMD160 314dc54a99913b0b35689732a92654c019ff76e1 SHA1 97bbaeeaf44126645fdad339aa4d20aa7589f5ed SHA256 cf1a462e63899bb42eedd5b83c50affb20a929ab22b927620da8abbc30d62fc0 +MD5 e4b9af887aa72b82cfd3e694765ceeae files/mergelog-split.patch 16343 +RMD160 314dc54a99913b0b35689732a92654c019ff76e1 files/mergelog-split.patch 16343 +SHA256 cf1a462e63899bb42eedd5b83c50affb20a929ab22b927620da8abbc30d62fc0 files/mergelog-split.patch 16343 DIST mergelog-4.5.tar.gz 39407 RMD160 19e7d067816ebab79da30ab326aa7aa49c3f6ab0 SHA1 bc9bdfddc561301e417a2de949ce3c4203b54c94 SHA256 fd97c5b9ae88fbbf57d3be8d81c479e0df081ed9c4a0ada48b1ab8248a82676d -EBUILD mergelog-4.5.ebuild 666 RMD160 6d79bcd4ae13f0c328ee17ce37da851c885b9f93 SHA1 40ebadea358b67e7db2b1a5241c8c71a08066d9c SHA256 e2e4cc8e923cad0b5f304914cd06c83d3a7854dc66af1cb767a7bf6d5ba7cb2d -MD5 0b44f7aa04e447cca91625c55fa948c1 mergelog-4.5.ebuild 666 -RMD160 6d79bcd4ae13f0c328ee17ce37da851c885b9f93 mergelog-4.5.ebuild 666 -SHA256 e2e4cc8e923cad0b5f304914cd06c83d3a7854dc66af1cb767a7bf6d5ba7cb2d mergelog-4.5.ebuild 666 +EBUILD mergelog-4.5.ebuild 746 RMD160 87f2f0c281171b45d3d93c51f4ba2d62fd43f7b1 SHA1 f34d5ce5522da2068fd3c78e46622f57b9d5f811 SHA256 36b07d8603b5d0d424147d04f2d9b414c16f7523d873d58d6f44145b66e8c642 +MD5 fc60ae699248054729710d1d476f9c7b mergelog-4.5.ebuild 746 +RMD160 87f2f0c281171b45d3d93c51f4ba2d62fd43f7b1 mergelog-4.5.ebuild 746 +SHA256 36b07d8603b5d0d424147d04f2d9b414c16f7523d873d58d6f44145b66e8c642 mergelog-4.5.ebuild 746 MISC ChangeLog 1074 RMD160 f99b633203753c1b928ae114e9e592bcf1fc4bf4 SHA1 1bebcfefa6f9646ef135cda9da8938cc0679d98f SHA256 3cb577c0cab0ba6cea0d038fd1400d122948b2c64e06694bf2b460047b8c15ea MD5 21aa020bc18331c4d91c20bc03be1208 ChangeLog 1074 RMD160 f99b633203753c1b928ae114e9e592bcf1fc4bf4 ChangeLog 1074 diff --git a/www-misc/mergelog/files/mergelog-split.patch b/www-misc/mergelog/files/mergelog-split.patch new file mode 100644 index 0000000..e542107 --- a/dev/null +++ b/www-misc/mergelog/files/mergelog-split.patch @@ -0,0 +1,516 @@ +diff -car mergelog-4.5.orig/configure.in mergelog-4.5/configure.in +*** mergelog-4.5.orig/configure.in Wed Apr 11 13:55:58 2001 +--- mergelog-4.5/configure.in Fri Jun 22 18:17:12 2001 +*************** +*** 2,8 **** + AC_INIT(src/mergelog.c) + + PACKAGE=mergelog +! VERSION=4.5 + AM_INIT_AUTOMAKE($PACKAGE,$VERSION,nosubst) + + AC_ARG_PROGRAM +--- 2,8 ---- + AC_INIT(src/mergelog.c) + + PACKAGE=mergelog +! VERSION=4.5-split + AM_INIT_AUTOMAKE($PACKAGE,$VERSION,nosubst) + + AC_ARG_PROGRAM +diff -car mergelog-4.5.orig/man/mergelog.1 mergelog-4.5/man/mergelog.1 +*** mergelog-4.5.orig/man/mergelog.1 Mon Mar 5 12:45:30 2001 +--- mergelog-4.5/man/mergelog.1 Wed Jun 20 22:16:20 2001 +*************** +*** 1,8 **** +! .TH MERGELOG 1 "22 Jan 2001" + .SH NAME + mergelog \- a fast tool to merge http log files by date + .SH SYNOPSIS + .B mergelog + .IR logfile1 + .IR logfile2 \ ... + .SH DESCRIPTION +--- 1,9 ---- +! .TH MERGELOG 1 "20 Jun 2001" + .SH NAME + mergelog \- a fast tool to merge http log files by date + .SH SYNOPSIS + .B mergelog ++ .IR [-vh]\ [-o\ outfmt] + .IR logfile1 + .IR logfile2 \ ... + .SH DESCRIPTION +diff -car mergelog-4.5.orig/man/zmergelog.1 mergelog-4.5/man/zmergelog.1 +*** mergelog-4.5.orig/man/zmergelog.1 Mon Mar 5 12:45:42 2001 +--- mergelog-4.5/man/zmergelog.1 Wed Jun 20 22:16:13 2001 +*************** +*** 1,8 **** +! .TH ZMERGELOG 1 "22 Jan 2001" + .SH NAME + zmergelog \- a fast tool to merge gzipped http log files by date + .SH SYNOPSIS + .B zmergelog + .IR logfile1 + .IR logfile2 \ ... + .SH DESCRIPTION +--- 1,9 ---- +! .TH ZMERGELOG 1 "20 Jun 2001" + .SH NAME + zmergelog \- a fast tool to merge gzipped http log files by date + .SH SYNOPSIS + .B zmergelog ++ .IR [-vh]\ [-o\ outfmt] + .IR logfile1 + .IR logfile2 \ ... + .SH DESCRIPTION +diff -car mergelog-4.5.orig/src/mergelog.c mergelog-4.5/src/mergelog.c +*** mergelog-4.5.orig/src/mergelog.c Wed Apr 11 13:54:53 2001 +--- mergelog-4.5/src/mergelog.c Fri Jun 22 17:16:05 2001 +*************** +*** 45,56 **** +--- 45,60 ---- + #define mygets(a,b,c,d) fast_gzgets(a,b,c,d) + #define myrewind gzrewind + #define myclose gzclose ++ #define mywrite(f,b,l) gzwrite((f),(b),(l)) ++ #define MYSUFFIX ".gz" + #else + #define myFH FILE + #define myopen fopen + #define mygets(a,b,c,d) fgets(a,b,c) + #define myrewind rewind + #define myclose fclose ++ #define mywrite(f,b,l) fwrite((b),1,(l),(f)) ++ #define MYSUFFIX + #endif + + +*************** +*** 112,131 **** + char *trans_digits[60]; + char *trans_year[200]; + char months[24]="anebarprayunulugepctovec"; + +! /* +! print usage if necessary +! */ +! if (argc == 1) { +! fprintf(stderr,"usage: %s logfile1 logfile2 ...\nmergelog %s Copyright (C) 2000-2001 Bertrand Demiddelaer\n",argv[0],VERSION); + exit(1); + } + + #ifdef USE_ZLIB + /* + check if there are enough gunzip buffers + */ +! if(argc>MAX_FILES) { + fputs("too many gzipped log files, aborting\n",stderr); + exit(1); + } +--- 116,256 ---- + char *trans_digits[60]; + char *trans_year[200]; + char months[24]="anebarprayunulugepctovec"; ++ int goc; ++ int goUsage = 0, goVerbose = 0; ++ const char* goOutput = NULL; ++ const char* argv0 = *argv; ++ struct tm gotmFlags; ++ const char* goOutPtr; ++ myFH *outFile = NULL; ++ char outFileName[512]; ++ struct tm outFileTM; ++ char outFileNewName[512]; ++ size_t outBytes; ++ ++ while((goc=getopt(argc,argv,"vho:"))!=-1) { ++ switch(goc) { ++ case 'h': /* -h print usage */ ++ goUsage++; ++ break; ++ case 'v': /* -v verbose */ ++ goVerbose++; ++ break; ++ case 'o': /* -o fmt output specification */ ++ goOutput = optarg; ++ break; ++ default: /* whatever.. but we better print out usage */ ++ goUsage++; ++ break; ++ } ++ } ++ argv = &argv[optind]; ++ argc -= optind; + +! if(argc<1) +! goUsage++; +! if(goUsage) { +! printf( +! "mergelog " VERSION " Copyright (c) 2000-2001 Bertrand Demiddelaer\n\n" +! "I have at least %d reason(s) for lending you a helping hand on using the program.\n\n" +! "Usage: %s [-vh] [-o fmt] logfile1 logfile2 ..\n\n" +! " -h Print this message\n" +! " -v Increase verbosity\n" +! " -o Give template for output file name to write log to\n" +! " instead of standard output in strftime(3) form.\n" +! " ( eg. -o %%Y-%%m-%%d-access.log" MYSUFFIX ")\n", +! goUsage,argv0); + exit(1); + } + ++ /* Analyze output format if given. It's better than trying to ++ * regenerate file name and compare it to the filename currently being ++ * written each time we want to dump one line. */ ++ if(goOutput) { ++ memset(&gotmFlags,0,sizeof(gotmFlags)); ++ for(goOutPtr=goOutput;*goOutPtr;goOutPtr++) { ++ if( (*goOutPtr=='%') && goOutPtr[1]) { ++ switch(*(++goOutPtr)) { ++ case 'a': /* abbreviated weekday */ ++ case 'A': /* full weekday */ ++ case 'u': /* day of week number */ ++ case 'w': /* zerobased weekday number */ ++ gotmFlags.tm_wday = 1; ++ break; ++ case 'b': /* abbreviated month */ ++ case 'h': /* %b */ ++ case 'B': /* full month */ ++ case 'm': /* month number */ ++ gotmFlags.tm_mon = 1; ++ break; ++ case 'C': /* century */ ++ case 'y': /* centuryless year */ ++ case 'Y': /* year with a century */ ++ gotmFlags.tm_year = 1; ++ break; ++ case 'd': /* day of month */ ++ case 'e': /* day of month space padded */ ++ gotmFlags.tm_mday = 1; ++ break; ++ case 'D': /* %m/%d/%y americanism */ ++ gotmFlags.tm_mon = gotmFlags.tm_mday = gotmFlags.tm_year = 1; ++ break; ++ case 'G': /* ISO 8601 year repsesentation. depends on week */ ++ case 'g': /* ISO 8601 year repsesentation without century. depends on week */ ++ case 'U': /* sunday-based week number */ ++ case 'V': /* ISO 8601 week number */ ++ case 'W': /* monday-based week number */ ++ case 'x': /* preferred date representation for locale without the time */ ++ gotmFlags.tm_yday = gotmFlags.tm_year = 1; ++ break; ++ case 'H': /* 24h format hour */ ++ case 'I': /* 12h format hour */ ++ case 'k': /* 24h format hour space padded */ ++ case 'l': /* 12h format hour space padded */ ++ case 'p': /* AM/PM indicator */ ++ case 'P': /* am/pm indicator */ ++ gotmFlags.tm_hour = 1; ++ break; ++ case 'j': /* day of year */ ++ gotmFlags.tm_yday = 1; ++ break; ++ case 'M': /* minute */ ++ gotmFlags.tm_min = 1; ++ break; ++ case 'n': /* newline character */ ++ case 't': /* tab character */ ++ case 'z': /* time zone as an offset from GMT */ ++ case 'Z': /* timezone name or abbreviation */ ++ case '%': /* % character */ ++ break; ++ case 'r': /* %I:%M:%S %p time in am/pm notation*/ ++ case 'T': /* %H:%M:%S time in 24h notation */ ++ case 'X': /* preferred time representation for locale without the date */ ++ gotmFlags.tm_hour = gotmFlags.tm_min = gotmFlags.tm_sec = 1; ++ break; ++ case 'R': /* %H:%M time in 24h notation without seconds */ ++ gotmFlags.tm_hour = gotmFlags.tm_min = 1; ++ break; ++ case 'S': /* second */ ++ gotmFlags.tm_sec = 1; ++ break; ++ case 'c': /* preferred date and time representation for locale */ ++ case 'E': /* weird modifier */ ++ case 'O': /* weird modifier */ ++ case 's': /* number of seconds since epoch */ ++ case '+': /* date and time in date(1) format */ ++ memset(&gotmFlags,0xFF,sizeof(gotmFlags)); ++ break; ++ } ++ } ++ } ++ } ++ + #ifdef USE_ZLIB + /* + check if there are enough gunzip buffers + */ +! if(argc>=MAX_FILES) { + fputs("too many gzipped log files, aborting\n",stderr); + exit(1); + } +*************** +*** 134,142 **** + /* + open log files + */ +! for (i=1;i<argc;i++) { +! log_file[i-1]=myopen(argv[i],"r"); +! if (log_file[i-1] == NULL) { + fprintf(stderr,"can't open %s, aborting\n",argv[i]); + exit(1); + } +--- 259,267 ---- + /* + open log files + */ +! for (i=0;i<argc;i++) { +! log_file[i]=myopen(argv[i],"r"); +! if (log_file[i] == NULL) { + fprintf(stderr,"can't open %s, aborting\n",argv[i]); + exit(1); + } +*************** +*** 174,181 **** + /* + init things for each log file and get the older date to start with + */ +! nb_files=argc-1; +! for (i=0;i<argc-1;i++) { + + #ifdef USE_ZLIB + /* +--- 299,306 ---- + /* + init things for each log file and get the older date to start with + */ +! nb_files=argc; +! for (i=0;i<argc;i++) { + + #ifdef USE_ZLIB + /* +*************** +*** 230,236 **** + */ + log_date=memchr(log_scan[i],'[',SCAN_SIZE); + if (log_date == NULL) { +! fprintf(stderr,"abort due to a problem with %s:\n%s\n",argv[i+1],log_buffer[i]); + exit(1); + } + +--- 355,361 ---- + */ + log_date=memchr(log_scan[i],'[',SCAN_SIZE); + if (log_date == NULL) { +! fprintf(stderr,"abort due to a problem with %s:\n%s\n",argv[i],log_buffer[i]); + exit(1); + } + +*************** +*** 239,245 **** + */ + for (j=0;((j == 12)&&(memcmp(months+2*j,log_date+5,2) != 0));j++); + if (j == 12) { +! fprintf(stderr,"abort due to a problem with %s:\n%s\n",argv[i+1],log_buffer[i]); + exit(1); + } + memcpy(log_month[i],trans_digits[j],2); +--- 364,370 ---- + */ + for (j=0;((j == 12)&&(memcmp(months+2*j,log_date+5,2) != 0));j++); + if (j == 12) { +! fprintf(stderr,"abort due to a problem with %s:\n%s\n",argv[i],log_buffer[i]); + exit(1); + } + memcpy(log_month[i],trans_digits[j],2); +*************** +*** 255,261 **** + extract the date of this first line + */ + if (sscanf(log_date+1,"%d/%3c/%d:%d:%d:%d",&day,month,&year,&hour,&minut,&second) < 6) { +! fprintf(stderr,"abort due to a problem with %s:\n%s\n",argv[i+1],log_buffer[i]); + exit(1); + } + +--- 380,386 ---- + extract the date of this first line + */ + if (sscanf(log_date+1,"%d/%3c/%d:%d:%d:%d",&day,month,&year,&hour,&minut,&second) < 6) { +! fprintf(stderr,"abort due to a problem with %s:\n%s\n",argv[i],log_buffer[i]); + exit(1); + } + +*************** +*** 270,276 **** + date->tm_isdst=-1; + for (j=0;((j<12)&&(memcmp(months+2*j,month+1,2) != 0));j++); + if (j == 12) { +! fprintf(stderr,"abort due to a problem with %s:\n%s\n",argv[i+1],log_buffer[i]); + exit(1); + } + date->tm_mon=j; +--- 395,401 ---- + date->tm_isdst=-1; + for (j=0;((j<12)&&(memcmp(months+2*j,month+1,2) != 0));j++); + if (j == 12) { +! fprintf(stderr,"abort due to a problem with %s:\n%s\n",argv[i],log_buffer[i]); + exit(1); + } + date->tm_mon=j; +*************** +*** 303,308 **** +--- 428,435 ---- + exit if we have only empty files + */ + if (nb_files == 0) { ++ if(outFile) ++ myclose(outFile); + exit(0); + } + +*************** +*** 323,329 **** + /* + start to compute since this date + */ +! nb_files_orig=argc-1; + for(;;) { + + /* +--- 450,456 ---- + /* + start to compute since this date + */ +! nb_files_orig=argc; + for(;;) { + + /* +*************** +*** 377,383 **** + write the log line + faster than a puts and we are sure to find a '\0' in log_buffer[i] + */ +! write(1,log_buffer[i],(size_t)((char *)memchr(log_buffer[i],0,BUFFER_SIZE)-log_buffer[i])); + + /* + is it an end of file ? +--- 504,558 ---- + write the log line + faster than a puts and we are sure to find a '\0' in log_buffer[i] + */ +! if(goOutput) { +! /* Check whether any of the date/time components concerned +! * have changes or if we have no output file opened. It +! * doesn't make much sense to do all the comparinsons in case +! * we have no output file opened, but it makes even less sense +! * to check for file handle each time we evaluate date. */ +! if( +! # define TMCOMPARE(tmpart) ( gotmFlags.tm_##tmpart && (outFileTM.tm_##tmpart!=date->tm_##tmpart) ) +! TMCOMPARE(sec) || TMCOMPARE(min) || TMCOMPARE(hour) +! || TMCOMPARE(mday) || TMCOMPARE(mon) || TMCOMPARE(year) +! || TMCOMPARE(wday) || TMCOMPARE(yday) +! || !outFile +! # undef TMCOMPARE +! ) { +! if(!strftime(outFileNewName,sizeof(outFileNewName)-1,goOutput,date)) { +! fprintf(stderr,"abort due to a failed attempt to generate output file name\n"); +! if(outFile) +! myclose(outFile); +! exit(1); +! } +! if( (!outFile) || strcmp(outFileName,outFileNewName) ) { +! /* okay, we're about to change output file or start +! * writing first file */ +! if(outFile) { +! myclose(outFile); +! } +! if(goVerbose) +! fprintf(stderr, "Writing to \"%s\"..\n",outFileNewName); +! outFile = myopen(outFileNewName,"a"); +! if(!outFile) { +! fprintf(stderr, "abort due to a failed attempt to open/create output file %s: %m\n",outFileNewName); +! exit(1); +! } +! memmove(outFileName,outFileNewName,sizeof(outFileName)); +! memmove(&outFileTM,date,sizeof(outFileTM)); +! } +! } +! /* %Y-%m-%d_%H-%M-%S-access.log */ +! outBytes = (size_t)((char *)memchr(log_buffer[i],0,BUFFER_SIZE)-log_buffer[i]); +! if( mywrite(outFile,log_buffer[i],outBytes) != outBytes) { +! fprintf(stderr,"abort due to a failed write operation on output file %s: %m\n",outFileName); +! if(outFile) +! myclose(outFile); +! exit(1); +! } +! }else{ +! /* do it the way we would do without */ +! write(1,log_buffer[i],(size_t)((char *)memchr(log_buffer[i],0,BUFFER_SIZE)-log_buffer[i])); +! } + + /* + is it an end of file ? +*************** +*** 388,394 **** + close all log files and exit if all end of files are reached + */ + if (--nb_files == 0) { +! for (j=0;j<argc-1;j++) { + myclose(log_file[j]); + } + exit(0); +--- 563,571 ---- + close all log files and exit if all end of files are reached + */ + if (--nb_files == 0) { +! if(outFile) +! myclose(outFile); +! for (j=0;j<argc;j++) { + myclose(log_file[j]); + } + exit(0); +*************** +*** 425,431 **** + } else { + for (j=0;((j<12)&&(memcmp(months+2*j,log_date+5,2) != 0));j++); + if (j == 12) { +! fprintf(stderr,"problem with %s:\n%s\ncontinuing...\n",argv[i+1],log_buffer[i]); + } else { + memcpy(log_month[i],trans_digits[j],2); + memcpy(log_month[i]+2,months+2*j,2); +--- 602,608 ---- + } else { + for (j=0;((j<12)&&(memcmp(months+2*j,log_date+5,2) != 0));j++); + if (j == 12) { +! fprintf(stderr,"problem with %s:\n%s\ncontinuing...\n",argv[i],log_buffer[i]); + } else { + memcpy(log_month[i],trans_digits[j],2); + memcpy(log_month[i]+2,months+2*j,2); +*************** +*** 439,445 **** + } + } + } else { +! fprintf(stderr,"problem with %s:\n%s\ncontinuing...\n",argv[i+1],log_buffer[i]); + } + } + } +--- 616,622 ---- + } + } + } else { +! fprintf(stderr,"problem with %s:\n%s\ncontinuing...\n",argv[i],log_buffer[i]); + } + } + } +*************** +*** 451,453 **** +--- 628,634 ---- + */ + exit(1); + } ++ /* vim:set textwidth=72: */ ++ /* vim:set cindent smartindent: */ ++ /* vim:set formatoptions-=t formatoptions+=croql: */ ++ /* vim:set expandtab shiftwidth=2: */ diff --git a/www-misc/mergelog/mergelog-4.5.ebuild b/www-misc/mergelog/mergelog-4.5.ebuild index 3944793..e3c14e7 100644 --- a/www-misc/mergelog/mergelog-4.5.ebuild +++ b/www-misc/mergelog/mergelog-4.5.ebuild @@ -1,18 +1,31 @@ # Copyright 1999-2006 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 -# $Header: /var/cvsroot/gentoo-x86/www-misc/mergelog/mergelog-4.5.ebuild,v 1.3 2006/10/28 11:03:32 tomk Exp $ +# $Header: $ + +inherit eutils autotools DESCRIPTION="A utility to merge apache logs in chronological order" SRC_URI="mirror://sourceforge/mergelog/${P}.tar.gz" HOMEPAGE="http://mergelog.sourceforge.net" -IUSE="" +IUSE="splitlog" SLOT="0" LICENSE="GPL-2" KEYWORDS="~x86 ppc ~amd64" -DEPEND="virtual/libc" -RDEPEND="" +DEPEND=" + virtual/libc + splitlog? ( sys-devel/autoconf ) +" + +src_unpack() { + unpack $A + cd $S + if use splitlog ; then + epatch ${FILESDIR}/${PN}-split.patch + eautoreconf + fi +} src_compile() { econf || die "configure failed" |