From a2107904e747dfa4b71cc34e4dd5bb660a45a665 Mon Sep 17 00:00:00 2001 From: "Ing. Michal SVAMBERG" Date: Mon, 25 Feb 2019 09:46:31 +0100 Subject: [PATCH 1/5] Use package manager with zero return value On Debian you cat installed rpm package without database (needs for alien package). In this case return 'rpm -qa' error status and pakiti-client exited. Now pakiti-client tried dpkg. --- pakiti-client | 66 +++++++++++++++++++++++++-------------------------- 1 file changed, 33 insertions(+), 33 deletions(-) diff --git a/pakiti-client b/pakiti-client index 1861525..36460cf 100755 --- a/pakiti-client +++ b/pakiti-client @@ -263,16 +263,16 @@ sub find_packages ($) { $format = "%{NAME}\t%{EPOCH}:%{VERSION}-%{RELEASE}\t%{ARCH}"; ## no critic 'InputOutput::ProhibitBacktickOperators' @output = qx($cmd -qa --queryformat "$format\n"); - return if $?; - - if (@output) { - foreach my $line (@output) { - $line =~ s{\t\(none\):}{\t0:}g; - push(@list, $line) unless $line =~ /^gpg-pubkey\t/; - } - $data->{packages} = join("", sort(@list)); - return; - } + if ($? == 0) { + if (@output) { + foreach my $line (@output) { + $line =~ s{\t\(none\):}{\t0:}g; + push(@list, $line) unless $line =~ /^gpg-pubkey\t/; + } + $data->{packages} = join("", sort(@list)); + return; + } + } } # Debian packages $cmd = $Option{"dpkg-query"}; @@ -282,18 +282,18 @@ sub find_packages ($) { qw(Status Package Version Architecture)); ## no critic 'InputOutput::ProhibitBacktickOperators' @output = qx($cmd -W --showformat="$format\n"); - return if $?; - - if (@output) { - foreach my $line (@output) { - if ($line =~ /^install ok installed/) { - $line =~ s{^.+?=}{}g; - push(@list, $line); - } - } - $data->{packages} = join("", sort(@list)); - return; - } + if ($? == 0) { + if (@output) { + foreach my $line (@output) { + if ($line =~ /^install ok installed/) { + $line =~ s{^.+?=}{}g; + push(@list, $line); + } + } + $data->{packages} = join("", sort(@list)); + return; + } + } } # OpenBSD (pkg) or FreeBSD (pkgng) packages $cmd = $Option{"pkg"}; @@ -301,17 +301,17 @@ sub find_packages ($) { $data->{packager} = "pkg"; ## no critic 'InputOutput::ProhibitBacktickOperators' @output = qx($cmd info); - return if $?; - - if (@output) { - foreach my $line (@output) { - $line =~ s{\s+.*$}{}; - $line =~ s{-([0-9])}{\t$1}; - push(@list, "$line\t$data->{arch}\n"); - } - $data->{packages} = join("", sort(@list)); - return; - } + if ($? == 0) { + if (@output) { + foreach my $line (@output) { + $line =~ s{\s+.*$}{}; + $line =~ s{-([0-9])}{\t$1}; + push(@list, "$line\t$data->{arch}\n"); + } + $data->{packages} = join("", sort(@list)); + return; + } + } } # unknown or not working! die("$Script: package manager unknown or not working properly\n"); From 7562e850003e5124519373b2760b8736211844d5 Mon Sep 17 00:00:00 2001 From: "Ing. Michal SVAMBERG" Date: Mon, 25 Feb 2019 10:03:19 +0100 Subject: [PATCH 2/5] Update debian/changelog to 3.0.3 release --- debian/changelog | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/debian/changelog b/debian/changelog index 3d875e3..4e831be 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,10 @@ +pakiti (3.0.3) stable; urgency=medium + + * Improve selection of package manager + * Change detecting OS from issue.net to os-release file + + -- Michal Svamberg Mon, 25 Feb 2019 10:01:34 +0100 + pakiti (3.0.2) stable; urgency=medium * Support for installations with multiple package managers From 2a1ae974d49f3591cc1d977b688302845d00684b Mon Sep 17 00:00:00 2001 From: "Ing. Michal SVAMBERG" Date: Mon, 25 Feb 2019 10:40:18 +0100 Subject: [PATCH 3/5] Fix uninitalized value Debian/Sid has not VERSION_ID as numeric identification of distribution release. --- pakiti-client | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/pakiti-client b/pakiti-client index 36460cf..4852ad9 100755 --- a/pakiti-client +++ b/pakiti-client @@ -170,7 +170,7 @@ sub find_host ($) { sub find_system ($) { my($data) = @_; - my($path, $output, @list); + my($path, $output, @list, %os_release); # running kernel if ($Option{uname}) { @@ -187,8 +187,16 @@ sub find_system ($) { if (-f "/etc/os-release") { $_ = read_file("/etc/os-release"); $_ =~ s/"//g; - my %os_release = map{split /=/, $_}(split /\n/, $_); - $data->{system} = "$os_release{NAME} $os_release{VERSION_ID}"; + %os_release = map{split /=/, $_}(split /\n/, $_); + if ($os_release{PRETTY_NAME} ne "") { + $data->{system} = "$os_release{PRETTY_NAME}"; + return; + } + if ($os_release{VERSION_ID}) { + $data->{system} = "$os_release{NAME} $os_release{VERSION_ID}"; + } else { + $data->{system} = "$os_release{NAME}"; + } return; } $path = "/etc/SuSE-release"; From 2ec8d9f4e55f7aed5326657d70f66805720b2f61 Mon Sep 17 00:00:00 2001 From: "Ing. Michal SVAMBERG" Date: Mon, 25 Feb 2019 10:48:32 +0100 Subject: [PATCH 4/5] Fix uninitialized value on Debian/Sid --- debian/changelog | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/debian/changelog b/debian/changelog index 4e831be..84bfbaf 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,9 @@ +pakiti (3.0.4) stable; urgency=medium + + * Fix uninitialized value on Debian/Sid + + -- Michal Svamberg Mon, 25 Feb 2019 10:43:58 +0100 + pakiti (3.0.3) stable; urgency=medium * Improve selection of package manager From be44772ded170f589de104b8e8040bb953598793 Mon Sep 17 00:00:00 2001 From: "Ing. Michal SVAMBERG" Date: Mon, 25 Feb 2019 10:52:08 +0100 Subject: [PATCH 5/5] Add .gitignore with build temporary files --- .gitignore | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/.gitignore b/.gitignore index e69de29..a384207 100644 --- a/.gitignore +++ b/.gitignore @@ -0,0 +1,7 @@ +debian/debhelper-build-stamp +debian/files +debian/pakiti-client.debhelper.log +debian/pakiti-client.substvars +debian/pakiti-client/ +pakiti-client.1 +