From patchwork Tue Jul 25 15:00:29 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Roger_Pau_Monn=C3=A9?= X-Patchwork-Id: 9862191 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 79C81601A1 for ; Tue, 25 Jul 2017 15:02:44 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6CF1C28671 for ; Tue, 25 Jul 2017 15:02:44 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 61BEA28696; Tue, 25 Jul 2017 15:02:44 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id E1B03286C2 for ; Tue, 25 Jul 2017 15:02:43 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1da1KE-000334-HN; Tue, 25 Jul 2017 15:00:42 +0000 Received: from mail6.bemta6.messagelabs.com ([193.109.254.103]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1da1KD-000325-2a for xen-devel@lists.xenproject.org; Tue, 25 Jul 2017 15:00:41 +0000 Received: from [85.158.143.35] by server-9.bemta-6.messagelabs.com id B1/70-03406-81D57795; Tue, 25 Jul 2017 15:00:40 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFlrBIsWRWlGSWpSXmKPExsXitHRDpK54bHm kwYr1uhbft0xmcmD0OPzhCksAYxRrZl5SfkUCa8amoy/YCmaJVmz5vouxgfGYQBcjJ4eEgL/E je4FzCA2m4COxMW5O9m6GDk4RARUJG7vNQAJMwuESLQe+8IOYgsL+Ems3tXKAmKzCKhKzNl7m hXE5hWwkHgy+Q0TxEg9ibcTXzCC2JwClhLnWs+BxYWAanb3fGCBqBeUODnzCQvEfE2J1u2/2S FseYnmrbOZIeoVJfrnPWCbwMg3C0nLLCQts5C0LGBkXsWoUZxaVJZapGtkpJdUlJmeUZKbmJm ja2hgppebWlycmJ6ak5hUrJecn7uJERhqDECwg3HN/MBDjJIcTEqivN90yyOF+JLyUyozEosz 4otKc1KLDzHKcHAoSfBujgbKCRalpqdWpGXmAIMeJi3BwaMkwtsPkuYtLkjMLc5Mh0idYtTle DXh/zcmIZa8/LxUKXHe/yBFAiBFGaV5cCNgEXiJUVZKmJcR6CghnoLUotzMElT5V4ziHIxKwr yxIFN4MvNK4Da9AjqCCeiIOTNKQY4oSURISTUw6j2Y97X17O68nicXn3OucGhStL62RWDnDVs /fenv7yfoKjEsYGWs2Nz4l4fz27XQ3XmP+v0rd8sUJZystGw5ckcpIS1aRaHg0JMvnw7pM7+x 0n6zb5FAzPd1f+a8lRdkeLo73Vh75ZMQg9n3vuw1k9q+Jch0Ed9sZ1seSY99Fa4FD3PFpaYWK 7EUZyQaajEXFScCAB5eI4e7AgAA X-Env-Sender: prvs=372c1d2af=roger.pau@citrix.com X-Msg-Ref: server-12.tower-21.messagelabs.com!1500994838!74856097!1 X-Originating-IP: [66.165.176.89] X-SpamReason: No, hits=0.0 required=7.0 tests=sa_preprocessor: VHJ1c3RlZCBJUDogNjYuMTY1LjE3Ni44OSA9PiAyMDMwMDc=\n, received_headers: No Received headers X-StarScan-Received: X-StarScan-Version: 9.4.25; banners=-,-,- X-VirusChecked: Checked Received: (qmail 56729 invoked from network); 25 Jul 2017 15:00:39 -0000 Received: from smtp.citrix.com (HELO SMTP.CITRIX.COM) (66.165.176.89) by server-12.tower-21.messagelabs.com with RC4-SHA encrypted SMTP; 25 Jul 2017 15:00:39 -0000 X-IronPort-AV: E=Sophos;i="5.40,411,1496102400"; d="scan'208";a="432884904" From: Roger Pau Monne To: Date: Tue, 25 Jul 2017 16:00:29 +0100 Message-ID: <20170725150032.9225-3-roger.pau@citrix.com> X-Mailer: git-send-email 2.11.0 (Apple Git-81) In-Reply-To: <20170725150032.9225-1-roger.pau@citrix.com> References: <20170725150032.9225-1-roger.pau@citrix.com> MIME-Version: 1.0 Cc: Ian Jackson , Roger Pau Monne Subject: [Xen-devel] [PATCH v7 12/20] osstest: add support for the FreeBSD package manager X-BeenThere: xen-devel@lists.xen.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xen.org Sender: "Xen-devel" X-Virus-Scanned: ClamAV using ClamSMTP FreeBSD support is added to target_install_packages and target_install_packages_norec, although there's no equivalent to the --no-install-recommends in the FreeBSD package manager. Signed-off-by: Roger Pau Monné Acked-by: Ian Jackson --- Changes since v6: - Use $ho->{Os} in order to detect the target OS. Changes since v5: - Add prototype for package_install_cmd. - Use $ho->{Ident} instead of hardcoding "host" in get_hostflags. Changes since v4: - Unify more code between FreeBSD and Debian: introduce an OS-agnostic package_install_cmd to generate the install cmd. Changes since v3: - New in this version. --- Osstest/TestSupport.pm | 29 +++++++++++++++++++++-------- 1 file changed, 21 insertions(+), 8 deletions(-) diff --git a/Osstest/TestSupport.pm b/Osstest/TestSupport.pm index 7642a95b..4cb939e7 100644 --- a/Osstest/TestSupport.pm +++ b/Osstest/TestSupport.pm @@ -68,7 +68,6 @@ BEGIN { http_proxy_envsettings target_editfile_root target_file_exists target_editfile_kvp_replace - target_run_apt target_install_packages target_install_packages_norec target_jobdir target_extract_jobdistpath_subdir target_extract_jobdistpath target_tftp_prefix @@ -523,19 +522,33 @@ sub target_putfile ($$$$;$) { sub target_putfile_root ($$$$;$) { tputfileex('root', @_); } -sub target_run_apt { - my ($ho, @aptopts) = @_; - target_cmd_root($ho, - "DEBIAN_PRIORITY=critical UCF_FORCE_CONFFOLD=y \\ - with-lock-ex -w /var/lock/osstest-apt apt-get @aptopts", 3000); + +sub package_install_cmd ($;$) { + my ($ho, $norec) = @_; + my @cmd; + + if ($ho->{Os} eq "freebsd") { + push @cmd, qw(lockf /var/run/osstest-pkg-lock pkg-static install); + } else { + push @cmd, qw(DEBIAN_PRIORITY=critical UCF_FORCE_CONFFOLD=y + with-lock-ex -w /var/lock/osstest-apt apt-get); + push @cmd, qw(--no-install-recommends) if $norec; + push @cmd, qw(-y install); + } + + return @cmd; } sub target_install_packages ($@) { my ($ho, @packages) = @_; - target_run_apt($ho, qw(-y install), @packages); + my @cmd = package_install_cmd($ho); + + target_cmd_root($ho,"@cmd @packages", 3000); } sub target_install_packages_norec ($@) { my ($ho, @packages) = @_; - target_run_apt($ho, qw(--no-install-recommends -y install), @packages); + my @cmd = package_install_cmd($ho, 1); + + target_cmd_root($ho,"@cmd @packages", 3000); } sub target_somefile_getleaf ($$$) {