Do not get field names from grep-aptavail
Avoids needing to parse the output.
Paul Wise
6 years ago
129 | 129 | |
130 | 130 | my $output; |
131 | 131 | eval { |
132 | $output = capturex(qw(grep-aptavail --show-field Package --field Build-IDs --pattern), $id); | |
132 | $output = capturex(qw(grep-aptavail --no-field-names --show-field Package --field Build-IDs --pattern), $id); | |
133 | 133 | }; |
134 | 134 | if ($@) { |
135 | 135 | return; |
136 | 136 | } |
137 | 137 | |
138 | my %pkgs; | |
139 | foreach my $line (split(/\n/, $output)) { | |
140 | chomp $line; | |
141 | if ($line =~ /^Package:\s*(\S+)$/) { | |
142 | $pkgs{$1} = 1; | |
143 | } else { | |
144 | warn "Cannot parse grep-aptavail output: '$line'\n"; | |
145 | } | |
146 | } | |
138 | my %pkgs = map { $_ => 1 } split(/\n/, $output); | |
147 | 139 | return sort keys %pkgs; |
148 | 140 | } |
149 | 141 |