Mike Gabriel wrote:
> I have stumbled over an upstream use case where I had to bundle
> several upstream projects into one Debian source package.
> 
> For this I had to create several upstream branches with branch names
> equal to subproject name. Another requirement was that the base
> folder in each branch only contained _one_ folder with the name of
> the subproject and therein the actual source code of the subproject.
> 
> Same with the tarballs from upstream: each tarball
> <subproject>-<ver>.tar.gz contained a single folder <subproject> and
> in this folder one could find the source code of the subproject.
> 
> pristine-tar till now does not support such a construct. Attached
> you find a patch that adds functionality for the described use case
> without breaking other use cases (I hope!).

> +     # Test if $subdir is the only folder in $source, if so, also
> +     # use $subdir as subpath for $source... 
> +     opendir(DIR, "$source");
> +     my @FILES = readdir(DIR); 
> +     debug("files: @FILES");
> +
> +     # @FILES eq 3 means: `$subdir .. .'
> +     if (-d "$source$subdir" && length @FILES eq 3) {
> +             $source = "$source$subdir";
> +     }

This only works in the very specific case you mention, where you have a
branch containing a single subdirectory containing the upstream source.

pristine-tar geldelta and gentar can just be run from inside a
subdirectory, and will only use files from that subdirectory. So I think
a better approach would be to make pristine-tar commit and pristine-tar
checkout able to be run from a subdirectory inside the git repository,
and only use files under the current subdirectory. Currently in various
ways I have not investigated in detail, they assume they're run at the
top of the repository.

Once they support running in a subdirectory, you won't even necessarily
need separate branches, and a larger class of use cases will be
supported.

-- 
see shy jo

Attachment: signature.asc
Description: Digital signature

Reply via email to