Commit 37859e50 authored by Bernhard Link's avatar Bernhard Link

add Exportoptions, allowing to give "noexport" to never export a distribution.

parent 2763c61e
2015-06-13 Bernhard R. Link <brlink@debian.org>
* add Exportoptions: to conf/distributions,
allowing to give "noexport" to never export a distribution.
2014-08-24 Bernhard R. Link <brlink@debian.org>
* fix DownloadListsAs not accepting .lz
* add support for unpacking .xz and .lzma files with liblzma
......
......@@ -149,6 +149,7 @@ static retvalue createtargets(struct distribution *distribution) {
c, a,
&distribution->deb,
distribution->readonly,
distribution->exportoptions[deo_noexport],
distribution->fakecomponentprefix,
&t);
if (RET_IS_OK(r)) {
......@@ -167,6 +168,8 @@ static retvalue createtargets(struct distribution *distribution) {
c, a,
&distribution->udeb,
distribution->readonly,
distribution->exportoptions
[deo_noexport],
distribution->fakecomponentprefix,
&t);
if (RET_IS_OK(r)) {
......@@ -189,6 +192,8 @@ static retvalue createtargets(struct distribution *distribution) {
r = target_initialize_source(distribution,
c, &distribution->dsc,
distribution->readonly,
distribution->exportoptions
[deo_noexport],
distribution->fakecomponentprefix, &t);
if (last != NULL) {
last->next = t;
......@@ -432,6 +437,18 @@ CFUSETPROC(distribution, byhandhooks) {
return byhandhooks_parse(iter, &d->byhandhooks);
}
static const struct constant exportnames[deo_COUNT+1] = {
{"noexport", deo_noexport},
{"keepunknown", deo_keepunknown},
{NULL, 0}
};
CFUSETPROC(distribution, exportoptions) {
CFSETPROCVAR(distribution, d);
return config_getflags(iter, name, exportnames, d->exportoptions,
IGNORABLE(unknownfield),
"(allowed values: noexport, keepunknown)");
}
static const struct configfield distributionconfigfields[] = {
CF("AlsoAcceptFor", distribution, alsoaccept),
......@@ -456,6 +473,7 @@ static const struct configfield distributionconfigfields[] = {
CF("Origin", distribution, origin),
CF("Pull", distribution, pulls),
CF("ReadOnly", distribution, readonly),
CF("ExportOptions", distribution, exportoptions),
CF("SignWith", distribution, signwith),
CF("Suite", distribution, suite),
CF("Tracking", distribution, Tracking),
......@@ -791,6 +809,9 @@ static retvalue export(struct distribution *distribution, bool onlyneeded) {
assert (distribution != NULL);
if (distribution->exportoptions[deo_noexport])
return RET_NOTHING;
if (distribution->readonly) {
fprintf(stderr,
"Error: trying to re-export read-only distribution %s\n",
......@@ -914,6 +935,8 @@ retvalue distribution_exportlist(enum exportwhen when, struct distribution *dist
result = RET_NOTHING;
for (d=distributions; d != NULL; d = d->next) {
if (d->exportoptions[deo_noexport])
continue;
if (d->omitted || !d->selected)
continue;
if (!d->lookedat) {
......
......@@ -25,6 +25,12 @@ struct distribution;
struct overridefile;
struct uploaders;
enum exportoptions {
deo_noexport = 0,
deo_keepunknown,
deo_COUNT,
};
struct distribution {
struct distribution *next;
/* the primary name to access this distribution: */
......@@ -59,8 +65,8 @@ struct distribution {
struct atomlist udebcomponents;
/* what kind of index files to generate */
struct exportmode dsc, deb, udeb;
/* is tracking enabled for this distribution?
* (NONE must be 0 so it is the default) */
bool exportoptions[deo_COUNT];
/* (NONE must be 0 so it is the default) */
enum trackingtype { dt_NONE=0, dt_KEEP, dt_ALL, dt_MINIMAL } tracking;
struct trackingoptions { bool includechanges;
bool includebyhand;
......
......@@ -1404,6 +1404,17 @@ UDebIndices: Packages . .gz
.br
DscIndices: Sources Release .gz
.TP
.B ExportOptions
Options to modify how and if exporting is done:
.br
.B noexport
Never export this distribution.
That means there will be no directory below \fBdists/\fP generated and the distribution is only useful to copy packages to other distributions.
.br
.B keepunknown
Ignore unknown files and directories in the exported directory.
This is currently the only available option and the default, but might change in the future, so it can already be requested explicitely.
.TP
.B Contents
Enable the creation of Contents files listing all the files
within the binary packages of a distribution.
......
......@@ -1608,6 +1608,14 @@ ACTION_F(n, n, y, y, export) {
if (!d->selected)
continue;
if (d->exportoptions[deo_noexport]) {
/* if explicitely selected, warn if not used: */
if (argc > 1 && verbose >= 0 ) {
printf("No exporting %s (as it has the noexport option set).\n", d->codename);
}
continue;
}
if (verbose > 0) {
printf("Exporting %s...\n", d->codename);
}
......
......@@ -59,7 +59,7 @@ static char *calc_identifier(const char *codename, component_t component, archit
}
static retvalue target_initialize(/*@dependant@*/struct distribution *distribution, component_t component, architecture_t architecture, packagetype_t packagetype, get_version getversion, get_installdata getinstalldata, get_architecture getarchitecture, get_filekeys getfilekeys, get_checksums getchecksums, get_sourceandversion getsourceandversion, do_reoverride doreoverride, do_retrack doretrack, complete_checksums docomplete, /*@null@*//*@only@*/char *directory, /*@dependent@*/const struct exportmode *exportmode, bool readonly, /*@out@*/struct target **d) {
static retvalue target_initialize(/*@dependant@*/struct distribution *distribution, component_t component, architecture_t architecture, packagetype_t packagetype, get_version getversion, get_installdata getinstalldata, get_architecture getarchitecture, get_filekeys getfilekeys, get_checksums getchecksums, get_sourceandversion getsourceandversion, do_reoverride doreoverride, do_retrack doretrack, complete_checksums docomplete, /*@null@*//*@only@*/char *directory, /*@dependent@*/const struct exportmode *exportmode, bool readonly, bool noexport, /*@out@*/struct target **d) {
struct target *t;
assert(exportmode != NULL);
......@@ -96,6 +96,7 @@ static retvalue target_initialize(/*@dependant@*/struct distribution *distributi
t->doretrack = doretrack;
t->completechecksums = docomplete;
t->readonly = readonly;
t->noexport = noexport;
*d = t;
return RET_OK;
}
......@@ -114,7 +115,7 @@ static const char *dist_component_name(component_t component, /*@null@*/const ch
return c + len + 1;
}
retvalue target_initialize_ubinary(struct distribution *d, component_t component, architecture_t architecture, const struct exportmode *exportmode, bool readonly, const char *fakecomponentprefix, struct target **target) {
retvalue target_initialize_ubinary(struct distribution *d, component_t component, architecture_t architecture, const struct exportmode *exportmode, bool readonly, bool noexport, const char *fakecomponentprefix, struct target **target) {
return target_initialize(d, component, architecture, pt_udeb,
binaries_getversion,
binaries_getinstalldata,
......@@ -127,9 +128,9 @@ retvalue target_initialize_ubinary(struct distribution *d, component_t component
dist_component_name(component,
fakecomponentprefix),
atoms_architectures[architecture]),
exportmode, readonly, target);
exportmode, readonly, noexport, target);
}
retvalue target_initialize_binary(struct distribution *d, component_t component, architecture_t architecture, const struct exportmode *exportmode, bool readonly, const char *fakecomponentprefix, struct target **target) {
retvalue target_initialize_binary(struct distribution *d, component_t component, architecture_t architecture, const struct exportmode *exportmode, bool readonly, bool noexport, const char *fakecomponentprefix, struct target **target) {
return target_initialize(d, component, architecture, pt_deb,
binaries_getversion,
binaries_getinstalldata,
......@@ -142,10 +143,10 @@ retvalue target_initialize_binary(struct distribution *d, component_t component,
dist_component_name(component,
fakecomponentprefix),
atoms_architectures[architecture]),
exportmode, readonly, target);
exportmode, readonly, noexport, target);
}
retvalue target_initialize_source(struct distribution *d, component_t component, const struct exportmode *exportmode, bool readonly, const char *fakecomponentprefix, struct target **target) {
retvalue target_initialize_source(struct distribution *d, component_t component, const struct exportmode *exportmode, bool readonly, bool noexport, const char *fakecomponentprefix, struct target **target) {
return target_initialize(d, component, architecture_source, pt_dsc,
sources_getversion,
sources_getinstalldata,
......@@ -156,7 +157,7 @@ retvalue target_initialize_source(struct distribution *d, component_t component,
sources_complete_checksums,
mprintf("%s/source", dist_component_name(component,
fakecomponentprefix)),
exportmode, readonly, target);
exportmode, readonly, noexport, target);
}
retvalue target_free(struct target *target) {
......@@ -168,7 +169,7 @@ retvalue target_free(struct target *target) {
result = target_closepackagesdb(target);
} else
result = RET_OK;
if (target->wasmodified) {
if (target->wasmodified && !target->noexport) {
fprintf(stderr,
"Warning: database '%s' was modified but no index file was exported.\n"
"Changes will only be visible after the next 'export'!\n",
......@@ -920,6 +921,8 @@ retvalue target_export(struct target *target, bool onlyneeded, bool snapshot, st
retvalue result;
bool onlymissing;
assert (!target->noexport);
if (verbose > 5) {
if (onlyneeded)
printf(" looking for changes in '%s'...\n",
......
......@@ -68,14 +68,16 @@ struct target {
struct table *packages;
/* do not allow write operations */
bool readonly;
/* has noexport option */
bool noexport;
/* was updated without tracking data (no problem when distribution
* has no tracking, otherwise cause warning later) */
bool staletracking;
};
retvalue target_initialize_ubinary(/*@dependant@*/struct distribution *, component_t, architecture_t, /*@dependent@*/const struct exportmode *, bool /*readonly*/, /*@NULL@*/const char *fakecomponentprefix, /*@out@*/struct target **);
retvalue target_initialize_binary(/*@dependant@*/struct distribution *, component_t, architecture_t, /*@dependent@*/const struct exportmode *, bool /*readonly*/, /*@NULL@*/const char *fakecomponentprefix, /*@out@*/struct target **);
retvalue target_initialize_source(/*@dependant@*/struct distribution *, component_t, /*@dependent@*/const struct exportmode *, bool /*readonly*/, /*@NULL@*/const char *fakecomponentprefix, /*@out@*/struct target **);
retvalue target_initialize_ubinary(/*@dependant@*/struct distribution *, component_t, architecture_t, /*@dependent@*/const struct exportmode *, bool /*readonly*/, bool /*noexport*/, /*@NULL@*/const char *fakecomponentprefix, /*@out@*/struct target **);
retvalue target_initialize_binary(/*@dependant@*/struct distribution *, component_t, architecture_t, /*@dependent@*/const struct exportmode *, bool /*readonly*/, bool /*noexport*/, /*@NULL@*/const char *fakecomponentprefix, /*@out@*/struct target **);
retvalue target_initialize_source(/*@dependant@*/struct distribution *, component_t, /*@dependent@*/const struct exportmode *, bool /*readonly*/, bool /*noexport*/, /*@NULL@*/const char *fakecomponentprefix, /*@out@*/struct target **);
retvalue target_free(struct target *);
retvalue target_export(struct target *, bool /*onlyneeded*/, bool /*snapshot*/, struct release *);
......
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