pakfire: Re-install previous core update when in testing mode

Message ID 20200224185124.16170-1-michael.tremer@ipfire.org
State Accepted
Commit 712425ff0bbe96700de5a1b865d58730ba9c6b90
Headers
Series pakfire: Re-install previous core update when in testing mode |

Commit Message

Michael Tremer Feb. 24, 2020, 6:51 p.m. UTC
  From: Arne Fitzenreiter <arne_f@ipfire.org>

Fixes: #12302
Signed-off-by: Arne Fitzenreiter <arne_f@ipfire.org>
Tested-by: Michael Tremer <michael.tremer@ipfire.org>
---
 src/pakfire/lib/functions.pl | 6 ++++++
 1 file changed, 6 insertions(+)
  

Comments

Peter Müller Feb. 24, 2020, 6:57 p.m. UTC | #1
Reviewed-by: Peter Müller <peter.mueller@ipfire.org>

> From: Arne Fitzenreiter <arne_f@ipfire.org>
> 
> Fixes: #12302
> Signed-off-by: Arne Fitzenreiter <arne_f@ipfire.org>
> Tested-by: Michael Tremer <michael.tremer@ipfire.org>
> ---
>  src/pakfire/lib/functions.pl | 6 ++++++
>  1 file changed, 6 insertions(+)
> 
> diff --git a/src/pakfire/lib/functions.pl b/src/pakfire/lib/functions.pl
> index ddb1e9aad..45e3427b1 100644
> --- a/src/pakfire/lib/functions.pl
> +++ b/src/pakfire/lib/functions.pl
> @@ -768,6 +768,12 @@ sub upgradecore {
>  	getcoredb("noforce");
>  	eval(`grep "core_" $Conf::dbdir/lists/core-list.db`);
>  	if ("$core_release" > "$Conf::core_mine") {
> +		# Safety check for lazy testers:
> +		# Before we upgrade to the latest release, we re-install the previous release
> +		# to make sure that the tester has always been on the latest version.
> +		my $tree = &get_tree();
> +		$Conf::core_mine-- if ($tree eq "testing" || $tree eq "unstable");
> +
>  		message("CORE UPGR: Upgrading from release $Conf::core_mine to $core_release");
>  		
>  		my @seq = `seq $Conf::core_mine $core_release`;
>
  

Patch

diff --git a/src/pakfire/lib/functions.pl b/src/pakfire/lib/functions.pl
index ddb1e9aad..45e3427b1 100644
--- a/src/pakfire/lib/functions.pl
+++ b/src/pakfire/lib/functions.pl
@@ -768,6 +768,12 @@  sub upgradecore {
 	getcoredb("noforce");
 	eval(`grep "core_" $Conf::dbdir/lists/core-list.db`);
 	if ("$core_release" > "$Conf::core_mine") {
+		# Safety check for lazy testers:
+		# Before we upgrade to the latest release, we re-install the previous release
+		# to make sure that the tester has always been on the latest version.
+		my $tree = &get_tree();
+		$Conf::core_mine-- if ($tree eq "testing" || $tree eq "unstable");
+
 		message("CORE UPGR: Upgrading from release $Conf::core_mine to $core_release");
 		
 		my @seq = `seq $Conf::core_mine $core_release`;