Hi,
I have not been working on the svn version but on the 1.3.1 version since
I'm using Etch.
Here is the patch I have to far to get reprepro to use stderr only when
errors occur and be silent when the output is only informative.
This patch might need to be extended since I only patched the parts I
needed.
Regards,
Raphaël
On 3/12/07, Bernhard R. Link <[EMAIL PROTECTED]> wrote:
* Raphaël Pinson <[EMAIL PROTECTED]> [070312 13:57]:
> I run the update function in crons.
>
> If I don't use the verbose option I still get outputs like
>
> --------------- 8< ---------------
> Calculating packages to get...
> Getting packages...
> Installing (and possibly deleting) packages...
Indeed. Those should only be stderr in the checkupdate but not in the
update functions. Fixed in cvs.
> Exporting indices...
In this I will have to take a closer look. Changed in cvs to stdout but
as it is used in more code, I will need perhaps a more sophisticated
solution.
I've also added a --silent option to reduce verbosity. (verbosity is
signed, default is 0 and most things already check for >= even for
always to show messages, I just never added the option to actually
make it negative.)
> Let me know what I can do to help you fix this.
If you find more of them, tell me.
Hochachtungsvoll,
Bernhard R. Link
--
----------------------------------------------------------------------------------------
Raphaël Pinson - [EMAIL PROTECTED]
http://www.raphink.info
Ichthux - http://www.ichthux.com - Linux for Christians
diff -ruN reprepro-1.3.1/aptmethod.c reprepro-1.3.1.new/aptmethod.c
--- reprepro-1.3.1/aptmethod.c 2006-11-01 14:22:35.000000000 +0100
+++ reprepro-1.3.1.new/aptmethod.c 2007-03-19 10:25:38.000000000 +0100
@@ -670,7 +670,7 @@
if( RET_WAS_ERROR(r) )
return r;
if( RET_IS_OK(r) ) {
- fprintf(stderr,"aptmethod '%s': '%s'\n",method->baseuri,message);
+ fprintf(stdout,"aptmethod '%s': '%s'\n",method->baseuri,message);
free(message);
return RET_OK;
}
@@ -678,11 +678,11 @@
if( RET_WAS_ERROR(r) )
return r;
if( RET_IS_OK(r) ) {
- fprintf(stderr,"aptmethod %s '%s'\n",type,message);
+ fprintf(stdout,"aptmethod %s '%s'\n",type,message);
free(message);
return RET_OK;
}
- fprintf(stderr,"aptmethod '%s': '%s'\n",method->baseuri,type);
+ fprintf(stdout,"aptmethod '%s': '%s'\n",method->baseuri,type);
return RET_OK;
}
static inline retvalue gotcapabilities(struct aptmethod *method,const char *chunk) {
diff -ruN reprepro-1.3.1/contents.c reprepro-1.3.1.new/contents.c
--- reprepro-1.3.1/contents.c 2006-11-01 14:22:36.000000000 +0100
+++ reprepro-1.3.1.new/contents.c 2007-03-19 10:40:48.000000000 +0100
@@ -217,7 +217,7 @@
if( r == RET_NOTHING ) {
if( d->rate <= 1 || d->work <= d->leisure/(d->rate-1) ) {
if( verbose > 2 )
- fprintf(stderr, "Reading filelist for %s\n", filekey);
+ fprintf(stdout, "Reading filelist for %s\n", filekey);
r = files_genfilelist(d->files, filekey, package, d->contents);
if( RET_IS_OK(r) )
d->work++;
@@ -275,7 +275,7 @@
return r;
}
if( verbose > 0 ) {
- fprintf(stderr, " generating %s...\n",contentsfilename);
+ fprintf(stdout, " generating %s...\n",contentsfilename);
}
free(contentsfilename);
@@ -351,7 +351,7 @@
return r;
}
if( verbose > 0 ) {
- fprintf(stderr, " generating %s...\n",contentsfilename);
+ fprintf(stdout, " generating %s...\n",contentsfilename);
}
free(contentsfilename);
r = filelist_init(&data.contents);
diff -ruN reprepro-1.3.1/dirs.c reprepro-1.3.1.new/dirs.c
--- reprepro-1.3.1/dirs.c 2006-11-01 14:22:35.000000000 +0100
+++ reprepro-1.3.1.new/dirs.c 2007-03-19 10:38:59.000000000 +0100
@@ -36,7 +36,7 @@
ret = mkdir(dirname,0775);
if( ret == 0 ) {
if( verbose > 0)
- fprintf(stderr,"Created directory \"%s\"\n",dirname);
+ fprintf(stdout,"Created directory \"%s\"\n",dirname);
return RET_OK;
} else if( ret < 0 && errno != EEXIST ) {
fprintf(stderr,"Can not create directory \"%s\": %m\n",dirname);
diff -ruN reprepro-1.3.1/distribution.c reprepro-1.3.1.new/distribution.c
--- reprepro-1.3.1/distribution.c 2007-03-12 16:01:29.000000000 +0100
+++ reprepro-1.3.1.new/distribution.c 2007-03-12 16:00:08.000000000 +0100
@@ -581,7 +581,7 @@
}
if( (verbose >= 0 && todo) || verbose >= 10 )
- fprintf(stderr,"Exporting indices...\n");
+ fprintf(stdout,"Exporting indices...\n");
result = RET_NOTHING;
while( distributions != NULL ) {
@@ -673,7 +673,7 @@
return RET_NOTHING;
}
if( verbose >= 0 )
- fprintf(stderr, "Exporting indices...\n");
+ fprintf(stdout, "Exporting indices...\n");
return export(distribution,confdir,dbdir,distdir,files, TRUE);
}
diff -ruN reprepro-1.3.1/main.c reprepro-1.3.1.new/main.c
--- reprepro-1.3.1/main.c 2006-11-01 14:22:35.000000000 +0100
+++ reprepro-1.3.1.new/main.c 2007-03-19 10:40:16.000000000 +0100
@@ -1324,7 +1324,7 @@
trackingdb tracks;
if( verbose > 0 ) {
- fprintf(stderr,"Deleting all tracks for %s...\n",d->codename);
+ fprintf(stdout,"Deleting all tracks for %s...\n",d->codename);
}
r = tracking_initialize(&tracks,dbdir,d);
if( RET_WAS_ERROR(r) ) {
@@ -1934,7 +1934,7 @@
continue;
}
}
- fprintf(stderr,
+ fprintf(stdout,
"Deleting vanished identifier '%s'.\n", identifier);
/* derference anything left */
references_remove(references, identifier, dereferenced);
@@ -2160,7 +2160,7 @@
assert(references!=NULL);
if( verbose >= 0 )
- fprintf(stderr,
+ fprintf(stdout,
"Deleting files no longer referenced...\n");
r = removeunreferencedfiles(
references,filesdb,
diff -ruN reprepro-1.3.1/signature.c reprepro-1.3.1.new/signature.c
--- reprepro-1.3.1/signature.c 2006-11-01 14:22:35.000000000 +0100
+++ reprepro-1.3.1.new/signature.c 2007-03-19 10:39:22.000000000 +0100
@@ -421,7 +421,7 @@
}
}
if( verbose > 1 ) {
- fprintf(stderr,"Successfully created '%s'\n",signaturename);
+ fprintf(stdout,"Successfully created '%s'\n",signaturename);
}
return r;
diff -ruN reprepro-1.3.1/updates.c reprepro-1.3.1.new/updates.c
--- reprepro-1.3.1/updates.c 2007-03-12 16:01:29.000000000 +0100
+++ reprepro-1.3.1.new/updates.c 2007-03-19 10:33:13.000000000 +0100
@@ -988,10 +988,10 @@
d->distribution->dsc_override != NULL ||
d->distribution->udeb_override != NULL ) {
if( verbose >= 0 )
- fprintf(stderr,"Warning: Override-Files of '%s' ignored as not yet supported while updating!\n",d->distribution->codename);
+ fprintf(stdout,"Warning: Override-Files of '%s' ignored as not yet supported while updating!\n",d->distribution->codename);
}
if( d->distribution->tracking != dt_NONE ) {
- fprintf(stderr,"WARNING: Updating does not update trackingdata. Trackingdata of %s will be outdated!\n",d->distribution->codename);
+ fprintf(stdout,"WARNING: Updating does not update trackingdata. Trackingdata of %s will be outdated!\n",d->distribution->codename);
}
for( origin=d->origins; origin != NULL ; origin=origin->next ) {
if( origin->pattern == NULL)
@@ -1307,12 +1307,12 @@
if( u->nothingnew ) {
if( verbose >= 0 ) {
- fprintf(stderr," nothing new for '%s' (use --noskipold to process anyway)\n",u->target->identifier);
+ fprintf(stdout," nothing new for '%s' (use --noskipold to process anyway)\n",u->target->identifier);
}
return RET_NOTHING;
}
if( verbose > 2 )
- fprintf(stderr," processing updates for '%s'\n",u->target->identifier);
+ fprintf(stdout," processing updates for '%s'\n",u->target->identifier);
r = upgradelist_initialize(&u->upgradelist,u->target,dbdir);
if( RET_WAS_ERROR(r) )
return r;
@@ -1343,7 +1343,7 @@
}
if( verbose > 4 )
- fprintf(stderr," reading '%s'\n",index->filename);
+ fprintf(stdout," reading '%s'\n",index->filename);
assert(index->origin->download!= NULL);
r = upgradelist_update(u->upgradelist,
index->origin->download,index->filename,
@@ -1501,7 +1501,7 @@
if( nolistsdownload ) {
if( skipold && verbose >= 0 ) {
- fprintf(stderr,"Ignoring --skipold because of --nolistsdownload\n");
+ fprintf(stdout,"Ignoring --skipold because of --nolistsdownload\n");
}
skipold = FALSE;
}
@@ -1514,7 +1514,7 @@
}
if( nolistsdownload ) {
if( verbose >= 0 )
- fprintf(stderr,"Warning: As --nolistsdownload is given, index files are NOT checked.\n");
+ fprintf(stdout,"Warning: As --nolistsdownload is given, index files are NOT checked.\n");
} else {
bool_t anythingtodo = !skipold;
@@ -1528,7 +1528,7 @@
* add a check if some of the upstreams without Release files
* are unchanged and if this changes anything? */
if( !anythingtodo ) {
- fprintf(stderr,"Nothing to do found. (Use --noskipold to force processing)\n");
+ fprintf(stdout,"Nothing to do found. (Use --noskipold to force processing)\n");
aptmethod_shutdown(run);
if( RET_IS_OK(result) )
return RET_NOTHING;
@@ -1548,7 +1548,7 @@
/* Then get all packages */
if( verbose >= 0 )
- fprintf(stderr,"Calculating packages to get...\n");
+ fprintf(stdout,"Calculating packages to get...\n");
r = downloadcache_initialize(&cache);
if( !RET_IS_OK(r) ) {
aptmethod_shutdown(run);
@@ -1580,15 +1580,15 @@
return result;
}
if( verbose >= 0 )
- fprintf(stderr,"Getting packages...\n");
+ fprintf(stdout,"Getting packages...\n");
r = aptmethod_download(run,methoddir,filesdb);
RET_UPDATE(result,r);
if( verbose > 0 )
- fprintf(stderr,"Freeing some memory...\n");
+ fprintf(stdout,"Freeing some memory...\n");
r = downloadcache_free(cache);
RET_UPDATE(result,r);
if( verbose > 0 )
- fprintf(stderr,"Shutting down aptmethods...\n");
+ fprintf(stdout,"Shutting down aptmethods...\n");
r = aptmethod_shutdown(run);
RET_UPDATE(result,r);
@@ -1603,7 +1603,7 @@
return result;
}
if( verbose >= 0 )
- fprintf(stderr,"Installing (and possibly deleting) packages...\n");
+ fprintf(stdout,"Installing (and possibly deleting) packages...\n");
for( d=distributions ; d != NULL ; d=d->next) {
r = updates_install(dbdir,filesdb,refs,d,dereferencedfilekeys);
@@ -1634,7 +1634,7 @@
if( nolistsdownload ) {
if( skipold && verbose >= 0 ) {
- fprintf(stderr,"Ignoring --skipold because of --nolistsdownload\n");
+ fprintf(stdout,"Ignoring --skipold because of --nolistsdownload\n");
}
skipold = FALSE;
}
@@ -1646,7 +1646,7 @@
}
if( nolistsdownload ) {
if( verbose >= 0 )
- fprintf(stderr,"Warning: As --nolistsdownload is given, index files are NOT checked.\n");
+ fprintf(stdout,"Warning: As --nolistsdownload is given, index files are NOT checked.\n");
} else {
bool_t anythingtodo = !skipold;
r = updates_downloadlists(methoddir,run,distributions,skipold,&anythingtodo);
@@ -1656,7 +1656,7 @@
return result;
}
if( !anythingtodo ) {
- fprintf(stderr,"Nothing to do found. (Use --noskipold to force processing)\n");
+ fprintf(stdout,"Nothing to do found. (Use --noskipold to force processing)\n");
return result;
}
}
@@ -1669,7 +1669,7 @@
return result;
}
if( verbose > 0 )
- fprintf(stderr,"Shutting down aptmethods...\n");
+ fprintf(stdout,"Shutting down aptmethods...\n");
r = aptmethod_shutdown(run);
RET_UPDATE(result,r);
if( RET_WAS_ERROR(result) ) {
@@ -1678,7 +1678,7 @@
/* Then look what packages to get */
if( verbose >= 0 )
- fprintf(stderr,"Calculating packages to get...\n");
+ fprintf(stdout,"Calculating packages to get...\n");
for( d=distributions ; d != NULL ; d=d->next) {
r = updates_readindices(dbdir,d);
@@ -1702,7 +1702,7 @@
if( nolistsdownload ) {
if( skipold && verbose >= 0 ) {
- fprintf(stderr,"Ignoring --skipold because of --nolistsdownload\n");
+ fprintf(stdout,"Ignoring --skipold because of --nolistsdownload\n");
}
skipold = FALSE;
}
@@ -1715,7 +1715,7 @@
}
if( nolistsdownload ) {
if( verbose >= 0 )
- fprintf(stderr,"Warning: As --nolistsdownload is given, index files are NOT checked.\n");
+ fprintf(stdout,"Warning: As --nolistsdownload is given, index files are NOT checked.\n");
} else {
bool_t anythingtodo = !skipold;
@@ -1729,7 +1729,7 @@
* add a check if some of the upstreams without Release files
* are unchanged and if this changes anything? */
if( !anythingtodo ) {
- fprintf(stderr,"Nothing to do found. (Use --noskipold to force processing)\n");
+ fprintf(stdout,"Nothing to do found. (Use --noskipold to force processing)\n");
aptmethod_shutdown(run);
if( RET_IS_OK(result) )
return RET_NOTHING;
@@ -1748,7 +1748,7 @@
}
if( verbose > 0 )
- fprintf(stderr,"Shutting down aptmethods...\n");
+ fprintf(stdout,"Shutting down aptmethods...\n");
r = aptmethod_shutdown(run);
RET_UPDATE(result,r);
@@ -1757,7 +1757,7 @@
}
if( verbose >= 0 )
- fprintf(stderr,"Removing obsolete or to be replaced packages...\n");
+ fprintf(stdout,"Removing obsolete or to be replaced packages...\n");
for( d=distributions ; d != NULL ; d=d->next) {
struct update_target *u;
@@ -1891,7 +1891,7 @@
}
/* Then get all packages */
if( verbose >= 0 )
- fprintf(stderr,"Calculating packages to get for %s's %s...\n",d->distribution->codename,target->target->identifier);
+ fprintf(stdout,"Calculating packages to get for %s's %s...\n",d->distribution->codename,target->target->identifier);
r = downloadcache_initialize(&cache);
RET_UPDATE(result,r);
if( !RET_IS_OK(r) ) {
@@ -1925,7 +1925,7 @@
return result;
}
if( verbose >= 0 )
- fprintf(stderr,"Getting packages for %s's %s...\n",d->distribution->codename,target->target->identifier);
+ fprintf(stdout,"Getting packages for %s's %s...\n",d->distribution->codename,target->target->identifier);
r = aptmethod_download(run,methoddir,filesdb);
RET_UPDATE(result,r);
if( RET_WAS_ERROR(r) ) {
@@ -1937,7 +1937,7 @@
RET_UPDATE(result,r);
if( verbose >= 0 )
- fprintf(stderr,"Installing/removing packages for %s's %s...\n",d->distribution->codename,target->target->identifier);
+ fprintf(stdout,"Installing/removing packages for %s's %s...\n",d->distribution->codename,target->target->identifier);
r = upgradelist_install(target->upgradelist,dbdir,filesdb,refs,target->ignoredelete,dereferencedfilekeys);
if( RET_WAS_ERROR(r) )
target->incomplete = TRUE;
@@ -1951,7 +1951,7 @@
markdone(target);
}
if( verbose > 0 )
- fprintf(stderr,"Shutting down aptmethods...\n");
+ fprintf(stdout,"Shutting down aptmethods...\n");
r = aptmethod_shutdown(run);
RET_UPDATE(result,r);
@@ -1964,9 +1964,9 @@
if( nolistsdownload ) {
if( verbose >= 0 )
- fprintf(stderr,"Warning: As --nolistsdownload is given, index files are NOT checked.\n");
+ fprintf(stdout,"Warning: As --nolistsdownload is given, index files are NOT checked.\n");
if( skipold && verbose >= 0 ) {
- fprintf(stderr,"Ignoring --skipold because of --nolistsdownload\n");
+ fprintf(stdout,"Ignoring --skipold because of --nolistsdownload\n");
}
skipold = FALSE;
}
@@ -1977,10 +1977,10 @@
d->distribution->dsc_override != NULL ||
d->distribution->udeb_override!= NULL ) {
if( verbose >= 0 )
- fprintf(stderr,"Warning: Override-Files of '%s' ignored as not yet supported while updating!\n",d->distribution->codename);
+ fprintf(stdout,"Warning: Override-Files of '%s' ignored as not yet supported while updating!\n",d->distribution->codename);
}
if( d->distribution->tracking != dt_NONE ) {
- fprintf(stderr,"WARNING: Updating does not update trackingdata. Trackingdata of %s will be outdated!\n",d->distribution->codename);
+ fprintf(stdout,"WARNING: Updating does not update trackingdata. Trackingdata of %s will be outdated!\n",d->distribution->codename);
}
r = singledistributionupdate(dbdir,methoddir,filesdb,refs,d,nolistsdownload,skipold,dereferencedfilekeys);
RET_ENDUPDATE(d->distribution->status,r);