diff mbox series

[OSSTEST,1/3] Provide target_install_packages_nonfree_nonconcurrent

Message ID 20191219175730.12484-1-ian.jackson@eu.citrix.com (mailing list archive)
State New, archived
Headers show
Series [OSSTEST,1/3] Provide target_install_packages_nonfree_nonconcurrent | expand

Commit Message

Ian Jackson Dec. 19, 2019, 5:57 p.m. UTC
Right now this is only useful with Debian.  We will call it from
ts-host-install to install the microcode.

We enable and then disable non-free so that we don't install non-free
packages unintentionally.

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
---
 Osstest/TestSupport.pm | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)
diff mbox series

Patch

diff --git a/Osstest/TestSupport.pm b/Osstest/TestSupport.pm
index 44f01a86..63087260 100644
--- a/Osstest/TestSupport.pm
+++ b/Osstest/TestSupport.pm
@@ -71,6 +71,7 @@  BEGIN {
                       target_editfile_kvp_replace
                       target_run_pkgmanager_install
                       target_install_packages target_install_packages_norec
+		      target_install_packages_nonfree_nonconcurrent
                       target_jobdir target_extract_jobdistpath_subdir
                       target_extract_jobdistpath target_extract_distpart
 		      target_tftp_prefix
@@ -627,6 +628,21 @@  sub target_install_packages_norec ($@) {
     my ($ho, @packages) = @_;
     target_run_pkgmanager_install($ho,\@packages,1);
 }
+sub target_install_packages_nonfree_nonconcurrent ($@) {
+    # inadequate locking, should be called during installation only
+    my ($ho, @packages) = @_;
+    my $slist= '/etc/apt/sources.list';
+    my $xsuites= 'contrib non-free';
+    target_cmd_root($ho, <<END, 30);
+    perl -i~ -pe 'next unless m/^deb/; s{ main\$}{\$& $xsuites};' $slist
+    apt update
+END
+    target_run_pkgmanager_install($ho,\@packages);
+    target_cmd_root($ho, <<END, 30);
+    mv $slist~ $slist
+    apt update
+END
+}
 
 sub tpfcs_core {
     my ($tputfilef,$ho,$timeout,$filedata, $rdest,$lleaf) = @_;