From 7131b2891cbf6afaae51cce4026727991530f0c5 Mon Sep 17 00:00:00 2001 From: Guillem Jover Date: Mon, 17 Jun 2019 13:11:42 +0200 Subject: [PATCH] TT#60670 Use dpkg-query -W instead of -s to fetch the Version field value The dpkg-query command already has an interface to fetch the field value, so there is no need to use --status, grep and then parse the output. Change-Id: I13a2f601bde4ca01bfbd7db35f8a1ff11175fba3 --- helper/sync-db | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/helper/sync-db b/helper/sync-db index 690a0f5f..add376d0 100755 --- a/helper/sync-db +++ b/helper/sync-db @@ -208,14 +208,13 @@ sub sync_db_timezones { } my ($tzinfo_version, undef, undef) = capture { - system('dpkg -s tzdata | grep Version:'); + system('dpkg-query -f "\${Version}" -W tzdata'); }; - - unless ($tzinfo_version && $tzinfo_version =~ /Version:\s*(\S+)/) { + unless ($tzinfo_version) { print "Error: Could not retrieve tzdata package version\n"; return; } - $tzinfo_version = $1; + chomp $tzinfo_version; my $pe = $dbh->{PrintError}; $dbh->{PrintError} = 0;