From 6626d6173090c35279a0c7e6e8acc448403ea1c7 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Henrik=20Grubbstr=C3=B6m=20=28Grubba=29?=
 <grubba@grubba.org>
Date: Wed, 8 Mar 2017 16:52:25 +0100
Subject: [PATCH] mkpackage: Support multiple sub-packages with the same name.

Gnu-tar doesn't like being asked to extract the same file multiple
times from the same tar-file. It claims that the second file doesn't
exist in the archive.

This can happen when a sub-package has been replaced with a fixed version.
---
 bin/mkpackage.pike | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/bin/mkpackage.pike b/bin/mkpackage.pike
index 004fd50cd8..d6bd7bb11b 100644
--- a/bin/mkpackage.pike
+++ b/bin/mkpackage.pike
@@ -182,6 +182,9 @@ class Package
 		    // Figure out the contents.
 		    "CONTENTS=`tar tf \"$TARFILE\" | sed -ne '/^"+
 		    replace(basename(install_filename), ".", "\\.")+"/,$p'`\n"
+		    // The same file may appear multiple times
+		    // in a tar archive if it has been replaced.
+		    "CONTENTS=`echo $CONTENTS|sort|uniq`\n"
 		    // Check if we're going to use a special tar for e.g. --add.
 		    "[ x\"$TAR\" = x ] && TAR=tar\n"
 		    "[ x\"$CPIO\" = x ] && CPIO=cpio\n"
-- 
GitLab