Sean Whitton <[email protected]> writes:

> One comment about your patch is that it refers to the other tools'
> documentation for what the contents of the fields should be.  But Policy
> should probably become the canonical source here.  So can you instead
> document the format of the contents of the fields?

Okay.  I am reaching the limits of my knowledge, so would need help to
finish this.  Attaching a first draft for specification.

This would ideally have to be reviewed by someone familiar with how
uscan/mk-origtargz works (or by me, or someone else, who could be made
to compare code with text).

The text is silence on how multiple occurances of these lines behave.
The simplest is to just ban that, which could be added.

If multiple occurances are permitted, the text needs to say something if
the ORDER of those lines matters.

I think there are two possible interpretations:

1) Multiple headers are merged into just one before processing.  That
is, first merge all Files-Excluded* headers and exclude all files
mentioned in the merged list of fiels.  Then merge all Files-Included*
headers and then re-include all those files.

2) Multiple headers are processed in order of occurance in the file.
This means walking through the directives imperatively, applying them
sequentially.

The corner-case I'm thinking of something like this:

Files-Excluded: foo/*
Files-Included: foo/bar*
Files-Excluded: foo/bar_foo*
Files-Included: foo/bar_foo_baz

And a tree like this:

foo/hej
foo/bar
foo/barbar
foo/bar_foo
foo/bar_foofoo
foo/bar_foo_baz

With 1) it would merge this into

Files-Excluded: foo/* foo/bar_foo*

in which means the second foo/bar_foo* is redundant (which suggest this
is not a valid interpretation) and all files would be excluded, and then
we would have

Files-Included: foo/bar* foo/bar_foo_baz

which also contains a redundant line (also suggesting this is not a good
interpretation) so that the resulting tree would be:

foo/bar
foo/barbar
foo/bar_foo
foo/bar_foofoo
foo/bar_foo_baz

With 2) the first 'Files-Excluded: foo/*' would exclude ALL files, and
the next 'Files-Included: foo/bar*' would make the tree contain:

foo/bar
foo/barbar
foo/bar_foo
foo/bar_foofoo
foo/bar_foo_baz

and then 'Files-Excluded: foo/bar_foo*' would turn the tree into:

foo/bar
foo/barbar

and the final 'Files-Included: foo/bar_foo_baz' would turn the tree
into:

foo/bar
foo/barbar
foo/bar_foo_baz

So I think 2) is the better interpretation.  Now I only wonder if this
is actually how uscan/mk-origtargz really behaves.

Another question is how to deal with paths containing odd characters
like SPC.

/Simon
From ade39360947659e363578c18e46db0c779fce6d3 Mon Sep 17 00:00:00 2001
From: Simon Josefsson <[email protected]>
Date: Mon, 16 Mar 2026 11:01:42 +0100
Subject: [PATCH] Mention Files-Excluded/Included in copyright-format

---
 copyright-format-1.0.xml | 25 +++++++++++++++++++++++++
 1 file changed, 25 insertions(+)

diff --git a/copyright-format-1.0.xml b/copyright-format-1.0.xml
index 954a65b..59db5d9 100644
--- a/copyright-format-1.0.xml
+++ b/copyright-format-1.0.xml
@@ -246,6 +246,11 @@
             <link linkend="copyright-field">Copyright</link>: optional.
           </para>
         </listitem>
+        <listitem>
+          <para>
+            <link linkend="files-excluded-included-field">Files-Excluded, Files-Excluded-*, Files-Included, Files-Included-*</link>: optional.
+          </para>
+        </listitem>
       </itemizedlist>
       <para>
         The <varname>Copyright</varname> and <varname>License</varname>
@@ -498,6 +503,26 @@ License: MPL-1.1
       </para>
     </section>
 
+    <section id="files-excluded-included-field">
+      <title><varname>Files-Excluded, Files-Excluded-*, Files-Included, Files-Included-*</varname></title>
+      <para>
+        Formatted text, no synopsis: these fields are used by <ulink
+        url="https://manpages.debian.org/testing/devscripts/uscan.1.en.html#COPYRIGHT_FILE_EXAMPLES";>uscan</ulink>
+        and <ulink
+        url="https://manpages.debian.org/testing/devscripts/mk-origtargz.1.en.html";>mk-origtargz</ulink>
+        to repack an upstream tarball.  Files-Excluded contains one or
+        more file names (including directory names), and normal
+        shell-style wildcards (i.e., * and ?) are permitted.
+        Files-Excluded-COMPONENT behave the same, but is applied to a
+        particular orig.tar component only (replacing COMPONENT with
+        the component name), for multi-orig.tar sources.
+        Files-Included is used to include some files (or directories)
+        that were excluded by a Files-Excluded expression.
+        Files-Included-COMPONENT is similarily used to re-include
+        paths excluded by Files-Excluded-COMPONENT.
+      </para>
+    </section>
+
     <section id="license-field">
       <title><varname>License</varname></title>
       <para>
-- 
2.52.0

Attachment: signature.asc
Description: PGP signature

Reply via email to