From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:39940) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dGrku-0001ws-8f for qemu-devel@nongnu.org; Fri, 02 Jun 2017 14:57:05 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dGrkt-0006Ej-DC for qemu-devel@nongnu.org; Fri, 02 Jun 2017 14:57:04 -0400 Received: from mail-oi0-x241.google.com ([2607:f8b0:4003:c06::241]:33744) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dGrkt-0006ER-8n for qemu-devel@nongnu.org; Fri, 02 Jun 2017 14:57:03 -0400 Received: by mail-oi0-x241.google.com with SMTP id h4so13123908oib.0 for ; Fri, 02 Jun 2017 11:57:03 -0700 (PDT) Sender: =?UTF-8?Q?Philippe_Mathieu=2DDaud=C3=A9?= From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Date: Fri, 2 Jun 2017 15:56:10 -0300 Message-Id: <20170602185630.5059-5-f4bug@amsat.org> In-Reply-To: <20170602185630.5059-1-f4bug@amsat.org> References: <20170602185630.5059-1-f4bug@amsat.org> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Subject: [Qemu-devel] [PATCH v5 04/24] docker: add 'apt-fake' script which generate fake debian packages List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org, =?UTF-8?q?Alex=20Benn=C3=A9e?= , Fam Zheng Cc: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Alex Bennée --- tests/docker/dockerfiles/debian-apt-fake.sh | 46 +++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100755 tests/docker/dockerfiles/debian-apt-fake.sh diff --git a/tests/docker/dockerfiles/debian-apt-fake.sh b/tests/docker/dockerfiles/debian-apt-fake.sh new file mode 100755 index 0000000000..387522c174 --- /dev/null +++ b/tests/docker/dockerfiles/debian-apt-fake.sh @@ -0,0 +1,46 @@ +#! /bin/sh +# +# Generate fake debian package to resolve unimportant unmet dependencies held +# by upstream multiarch broken packages. +# +# Copyright (c) 2017 Philippe Mathieu-Daudé +# +# This work is licensed under the terms of the GNU GPL, version 2 +# or (at your option) any later version. See the COPYING file in +# the top-level directory. + +test $1 = "install" && shift 1 + +fake_install() +{ + echo "Generating fake $2 $1 $3 ..." + (cd /var/cache/apt/archives + (cat << 'EOF' +Section: misc +Priority: optional +Standards-Version: 3.9.2 + +Package: NAME +Version: VERSION +Maintainer: qemu-devel@nongnu.org +Architecture: any +Multi-Arch: same +Description: fake NAME +EOF + ) | sed s/NAME/$2/g | sed s/VERSION/$3/g > $2.control + equivs-build -a $1 $2.control 1>/dev/null 2>/dev/null + dpkg -i $2_$3_$1.deb + ) +} + +try_install() +{ + name=$(echo $1|sed "s/\(.*\):\(.*\)=\(.*\)/\1/") + arch=$(echo $1|sed "s/\(.*\):\(.*\)=\(.*\)/\2/") + vers=$(echo $1|sed "s/\(.*\):\(.*\)=\(.*\)/\3/") + apt-get install -q -yy $1 || fake_install $arch $name $vers +} + +for package in $*; do + try_install $package +done -- 2.11.0