Commit 07be844a authored by Bernhard Link's avatar Bernhard Link

fix -A source for include, warn against impossible -T -A combinations

parent 222cd8e2
......@@ -4,6 +4,9 @@
version of checkupdate when using delete rules.
(Showed 'unavailable for reload').
* fix segfault and memory leak in checkupdate
* fix including a changes file with source and restricting
to some binary distribution or to binary package type.
* add some warnings against impossible combinations of -T and -A
2006-04-29 Bernhard R. Link <brlink@debian.org>
* fix some minor memory leaks
......
......@@ -8,6 +8,8 @@ Updates since 0.8.2:
file:/path/to/basedir Method, but faster and a bit
more limited (files cannot change components)
- fix segfault of checkupdate
- fix including a changes file with source and restricting
to some binary distribution or to binary package type.
Updates since 0.8.1:
- mark process list files and only skip those not marked
......
/* This file is part of "reprepro"
* Copyright (C) 2003,2004,2005 Bernhard R. Link
* Copyright (C) 2003,2004,2005,2006 Bernhard R. Link
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
......@@ -571,7 +571,7 @@ static inline retvalue checkforarchitecture(const struct fileentry *e,const char
return RET_OK;
}
static retvalue changes_check(const char *filename,struct changes *changes,/*@null@*/const char *forcearchitecture) {
static retvalue changes_check(const char *filename,struct changes *changes,/*@null@*/const char *forcearchitecture, /*@null@*/const char *packagetypeonly) {
int i;
struct fileentry *e;
retvalue r = RET_OK;
......@@ -590,14 +590,31 @@ static retvalue changes_check(const char *filename,struct changes *changes,/*@nu
r = checkforarchitecture(changes->files,forcearchitecture);
if( RET_WAS_ERROR(r) )
return r;
} else if( packagetypeonly == NULL ) {
for( i = 0 ; i < changes->architectures.count ; i++ ) {
const char *architecture = changes->architectures.values[i];
r = checkforarchitecture(changes->files,
architecture);
if( RET_WAS_ERROR(r) )
return r;
}
} else if( strcmp(packagetypeonly,"dsc") == 0 ) {
if( strlist_in(&changes->architectures,"source") ) {
r = checkforarchitecture(changes->files, "source");
if( RET_WAS_ERROR(r) )
return r;
}
} else {
for( i = 0 ; i < changes->architectures.count ; i++ ) {
const char *architecture = changes->architectures.values[i];
if( strcmp(architecture,"source") != 0 ) {
r = checkforarchitecture(changes->files,
changes->architectures.values[i]);
architecture);
if( RET_WAS_ERROR(r) )
return r;
}
}
}
/* Then check for each file, if its architecture is sensible
* and listed. */
e = changes->files;
......@@ -654,7 +671,12 @@ static retvalue changes_check(const char *filename,struct changes *changes,/*@nu
fprintf(stderr,"I don't know what to do having a .tar.gz not being a .orig.tar.gz and a .diff.gz in '%s'!\n",filename);
return RET_ERROR;
}
if( strlist_in(&changes->architectures,"source") && !havedsc ) {
if( strlist_in(&changes->architectures,"source") && !havedsc &&
( forcearchitecture == NULL
|| strcmp(forcearchitecture,"source") == 0 ) &&
( packagetypeonly == NULL
|| strcmp(packagetypeonly,"dsc") == 0 )
) {
fprintf(stderr,"I don't know what to do with a source-upload not containing a .dsc in '%s'!\n",filename);
return RET_ERROR;
}
......@@ -851,7 +873,7 @@ retvalue changes_add(const char *dbdir,trackingdb const tracks,references refs,f
/* do some tests if values are sensible */
if( !RET_WAS_ERROR(r) )
r = changes_check(changesfilename,changes,forcearchitecture);
r = changes_check(changesfilename,changes,forcearchitecture,packagetypeonly);
/* add files in the pool */
//TODO: D_DELETE would fail here, what to do?
......
......@@ -1286,6 +1286,10 @@ ACTION_D(includedeb) {
fprintf(stderr,"reprepro [--delete] include[u]deb <distribution> <package>\n");
return RET_ERROR;
}
if( architecture != NULL && strcmp(architecture,"source") == 0 ) {
fprintf(stderr,"Error: -A source is not possible with includedeb!\n");
return RET_ERROR;
}
if( onlyacceptsigned ) {
fprintf(stderr,"include[u]deb together with --onlyacceptsigned is not yet possible,\n as .[u]deb files cannot be signed yet.\n");
return RET_ERROR;
......@@ -1452,6 +1456,20 @@ ACTION_D(include) {
"(Did you mean includedeb or includedsc?)\n") )
return RET_ERROR;
if( architecture != NULL && packagetype != NULL ) {
if( strcmp(packagetype,"dsc") == 0 ) {
if( strcmp(architecture,"source") != 0 ) {
fprintf(stderr,"Error: Only -A source is possible with -T dsc!\n");
return RET_ERROR;
}
} else {
if( strcmp(architecture,"source") == 0 ) {
fprintf(stderr,"Error: -A source is not possible with -T deb or -T udeb!\n");
return RET_ERROR;
}
}
}
result = distribution_get(&distribution,confdir,argv[1]);
assert( result != RET_NOTHING );
if( RET_WAS_ERROR(result) )
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment