[pacman-dev,0/2] makepkg: Allow placing local sources in subdirectories

Message ID 20180428093108.8263-1-archlinux@thecybershadow.net
Headers show


Vladimir Panteleev April 28, 2018, 9:31 a.m. UTC
Currently, makepkg doesn't support (actually, mishandles) sources in a
subdirectory of the package directory. Though there aren't many uses
for such a feature, it is useful for an otherwise source-less package
of Arch- or site-specific scripts, to be installed on one or a few
systems, for which it doesn't make sense to have a separate source
repository. In this case, it would be nice to either move the source
files in a subdirectory, or allow pulling them from somewhere else on
the filesystem.

Whether or not this is considered a valid usecase, the current
behavior is broken (makepkg computes broken paths and attempts to
operate on files that aren't there), so this probably ought to be
fixed regardless.

I couldn't find a test suite for makepkg (only pacman and
makepkg-template), so, here is the test case:

mkdir dir
touch a dir/b /tmp/c
cat > PKGBUILD <<'EOF'
source=(a dir/b /tmp/c)
md5sums=(SKIP SKIP SKIP)
package() { cp "$srcdir"/* "$pkgdir/" ; }

One thing to note is that this doesn't protect against filename
collisions: specifying dir1/file and dir2/file as sources will just
make makepkg clobber the first file. Still, that's not new:
source=(http://xxx/a http://yyy/a) are going to have the same problem.

Vladimir Panteleev (2):
  libmakepkg: Fix handling of file paths in get_filepath
  libmakepkg: Use the correct path in extract_sources

 scripts/libmakepkg/source.sh.in      |  2 +-
 scripts/libmakepkg/util/source.sh.in | 22 ++++++++++++++++++++--
 2 files changed, 21 insertions(+), 3 deletions(-)