Re: adding a directory tree to package source
Jon Turney via Cygwin-apps <[email protected]> Wed, 29 Jul 2026 21:17:18 +0100
| Newsgroups | gmane.os.cygwin.applications |
|---|---|
| Message-ID | <[email protected]> |
On 28/07/2026 17:55, Andrew Schulman via Cygwin-apps wrote:
> For fish I have a directory structure of Cygwin-specific files that I need to
> have copied into the source tree:
>
> $ git ls
> Cygwin/etc/fish/conf.d/00_PATH.fish
> Cygwin/etc/fish/conf.d/01_fish_variables.fish
> Cygwin/etc/fish/conf.d/cygwin.fish
> Cygwin/usr/share/fish/vendor_completions.d/mount.fish
> Cygwin/usr/share/fish/vendor_completions.d/umount.fish
> Cygwin/usr/share/fish/vendor_functions.d/fish_is_root_user.fish
> Cygwin/usr/share/fish/vendor_functions.d/sudo.fish
> fish.cygport
>
> Is there a supported way to do this? I've tried multiple ways, and all of them
> fail.
Thanks for doing this investigation.
Yeah, it seems this needs a bit of work to have the desired functionality.
> (1) Add the files to CYGWIN_FILES:
>
> CYGWIN_FILES=Cygwin/*
>
> As I reported in [1], this doesn't work because cygport and scallywag seem to
> handle CYGWIN_FILES differently. On my local build host the above works fine:
> cygport prep copies the extra directories into the source tree. But when I
> push it up to scallywag, the build fails [2]:
>
> cp: cannot stat
> '/cygdrive/d/a/scallywag/fish/fish-4.8.1-2.x86_64/src/fish-4.8.1/CYGWIN-PATCHES/Cygwin/*':
> No such file or directory
Looking into this, as part of 'prep' we do
> for cygwin_file in ${CYGWIN_FILES}
> do
> cp -a ${top}/${cygwin_file} ${C}/
> done
then making the source package does:
> for cygwin_file in ${CYGWIN_FILES}
> do
> cp --preserve=timestamps ${C}/${cygwin_file} ${spkgdir}
> done
cp only uses the basename for what it copies to the target directory,
right? (so in this case we get directories /etc and /usr in ${C}, and
their contents recursively).
Then attempting to copy Cygwin/etc/ from ${C} into the srcpkg isn't
going to work as Cygwin/ doesn't exist?
(I'm not sure how this is working locally for you, unless you have some
left-over files in CYGWIN-PATCHES maybe?)
I'm not sure how this can be made work as desired?
Potentially this might work if you moved the contents of the Cygwin/
directory up and specified CYGWIN_FILES="etc/ usr/"; although we
probably need to do some fixing to get directories treated correctly
everywhere.
At the very least, the documentation of CYGWIN_FILES should mention that
only basenames, not pathnames are allowed.
>
> (2) Add the files to SRC_URI. Something like:
>
> SRC_URI="
>
> https://github.com/fish-shell/fish-shell/releases/download/$VERSION/fish-$VERSION.tar.xz
> Cygwin/etc
> Cygwin/usr
> "
>
> I've tried several variations of this, but all of them give errors from
> cygport. I've concluded that it's not going to work as cygport is written now,
> because cygport allows only single files in SRC_URI, not directories.
>
> (3) Use src_unpack_hook to copy in the files:
>
> CYGPORT_USE_UNSTABLE_API=1
> src_unpack_hook ()
> {
> inform "Copying in Cygwin"
> cp -av ${top}/Cygwin "${S/\/src\///origsrc/}"
> }
>
> This used to work, but it's stopped working recently in scallywag[3]. It's
> also unsupported, and isn't really right.
Yeah, this is not a good approach.
(I guess this stopped working because scallywag now does the install
package build from a source package, rather than from a checkout of the
packaging repo (to identify places where we're not including everything
needed into the source package))
>
> (4) Maintain the files as patches, and add them to PATCH_URI. Forget it. It's
> unmaintainable.
>
> (5) Tar up and commit the tree of extra files, and add the tarball to SRC_URI:
>
> SRC_URI="
>
> https://github.com/fish-shell/fish-shell/releases/download/$VERSION/fish-$VERSION.tar.xz
> Cygwin.tar.xz
> "
>
> Then copy the files in in src_install(). This isn't ideal, but it does work on
> my local build host. But it fails when I try to push it up - git rejects the
> commit because the tarball is more than 1024 bytes.
pushing commits containing tarballs is disallowed to (hopefully) prevent
people from accidentally adding the upstream source.
>
> --
>
> So I'm currently blocked here, and looking for a solution. If there's not
> currently a way to do this, my preference would be either:
>
> * Fix (1), by fixing scallywag to treat CYGWIN_FILES the same as cygport does;
> or
> * Fix (2), by letting cygport accept directories as well as single files in
> SRC_URI. This would be super easy to do, I'm happy to offer a patch if it
> would be of interest. I guess that scallywag would need to be updated too.
I'd certainly accept patches fixing (1) or (2) (or both! :) ).