Mageia Bugzilla – Attachment 3814 Details for
Bug 9744
Push mageia-prepare-upgrade & mgaonline to mga2 on mga3 release
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
New Account
|
Forgot Password
Pseudo-perl patch to implement the logic required
0001-Add-support-for-upgrades-that-need-some-form-of-prep.patch (text/plain), 4.26 KB, created by
Colin Guthrie
on 2013-04-25 22:33:11 CEST
(
hide
)
Description:
Pseudo-perl patch to implement the logic required
Filename:
MIME Type:
Creator:
Colin Guthrie
Created:
2013-04-25 22:33:11 CEST
Size:
4.26 KB
patch
obsolete
>From bbca4eb593df9077a5c27b63a535bad276719dbc Mon Sep 17 00:00:00 2001 >From: Colin Guthrie <colin@mageia.org> >Date: Thu, 25 Apr 2013 21:24:24 +0100 >Subject: [PATCH] Add support for upgrades that need some form of preparation > before continuing. > >The basic principle of this is to do the following: > 1. Check the releases webservice API to see if the distro version 'needs_preparation'. > 2. If it does, check for a file /var/lib/mageia-prepare-upgrade/state. > If it says 'ready' then we are ready and the user is not questioned further. > 3. If it does not exist or says anything else, the user is prompted to install the > package 'mageia-prepare-upgrade'. > 4. After package installation, check the state file again as this may be > all that is required. If the state file does not yet say 'ready', then > display the text from the /usr/share/doc/mageia-prepare-upgrade/README.prepare > file (todo: add i18n) > 5. Assuming that further action is required by the user (e.g. rebooting to > convert the filesystem), then the upgrade helper will exit. > 6. After the user has taken the action required to do the preparation, > the state file should contain 'ready'. The next time the distro upgrade > dialog shows, the preparation checks will pass and the user can continue. > >TODO: > 1. Handle i18n in the README.prepare file. > 2. Update dracut to write the state file when FS conversion is done. > 3. Add README.prepare to mageia-prepare-upgrade. >--- > mgaapplet-upgrade-helper | 33 ++++++++++++++++++++++++++++++++- > mgaonline.pm | 2 +- > 2 files changed, 33 insertions(+), 2 deletions(-) > >diff --git a/mgaapplet-upgrade-helper b/mgaapplet-upgrade-helper >index 1089a80..9f4227e 100755 >--- a/mgaapplet-upgrade-helper >+++ b/mgaapplet-upgrade-helper >@@ -33,6 +33,8 @@ BEGIN { unshift @::textdomains, 'mgaonline' } > > use mygtk2 qw(gtknew); #- do not import gtkadd which conflicts with ugtk2 version > use ugtk2 qw(:all); >+use interactive; >+use do_pkgs; > use lib qw(/usr/lib/libDrakX/drakfirsttime); > use mgaonline; > use Rpmdrake::open_db; >@@ -55,7 +57,36 @@ foreach my $opt (@ARGV) { > > my $root = Rpmdrake::open_db::fast_open_urpmi_db()->{root}; > >-my $product_id = common::parse_LDAP_namespace_structure(cat_("$root/etc/product.id")); >+my $product_id = mgaonline::get_product_id(); >+ >+# Find the matching new_distro_version >+my @distros = mgaonline::get_distro_list(); >+@distros or exit(1); >+my $new_distro = find { $_->{version} eq $new_distro_version } @distros; >+$new_distro or exit(1); >+ >+if ($new_distro->{needs_preparation}) { >+ my $statefile = "$root/var/lib/mageia-prepare-upgrade/state"; >+ my $prepared = (cat_($statefile) =~ /ready/) if ( -f $statefile ); >+ >+ if (!$prepared) { >+ ugtk2::ask_yesorno(N("Preparation Required"), N("In order to upgrade, your current installation needs to be prepared.\n\nDo you wish to do this preparation now?")) or exit(0); >+ >+ my $in = interactive->vnew; >+ my $do_pkgs = do_pkgs::do_pkgs($in); >+ $do_pkgs->ensure_is_installed("mageia-prepare-upgrade") or exit(0); >+ >+ # Check to see if installation alone is enough to ensure things are in the right state? >+ $prepared = (cat_($statefile) =~ /ready/) if ( -f $statefile ); >+ if (!$prepared) { >+ my $infofile = "$root/usr/share/doc/mageia-prepare-upgrade/README.prepare"; >+ my $info = cat_($infofile) if ( -f $infofile); >+ $info = N("Further action is required before you can continue. Please see $new_distro->{url} for more information.") if !$info; >+ ugtk2::ask_warn(N("Next Steps"), $info); >+ exit(0); >+ } >+ } >+} > > if (!$ENV{URPMI_IGNORESIZE}) { > check_available_free_space('/usr', 800) && >diff --git a/mgaonline.pm b/mgaonline.pm >index ff64b62..9288db1 100644 >--- a/mgaonline.pm >+++ b/mgaonline.pm >@@ -92,7 +92,7 @@ sub get_distro_list_() { > my $extra_path = $::testing || uc($config{TEST_DISTRO_UPGRADE}) eq 'YES' ? 'testing-' : ''; > my $list = > join('&', >- "https://releases.mageia.org/api/a/$extra_path$product_id->{arch}?product=$product_id->{product}", >+ "https://releases.mageia.org/api/b/$extra_path$product_id->{arch}?product=$product_id->{product}", > "version=$product_id->{version}", > "mgaonline_version=$mgaonline::version", > ); >-- >1.8.1.5 >
From bbca4eb593df9077a5c27b63a535bad276719dbc Mon Sep 17 00:00:00 2001 From: Colin Guthrie <colin@mageia.org> Date: Thu, 25 Apr 2013 21:24:24 +0100 Subject: [PATCH] Add support for upgrades that need some form of preparation before continuing. The basic principle of this is to do the following: 1. Check the releases webservice API to see if the distro version 'needs_preparation'. 2. If it does, check for a file /var/lib/mageia-prepare-upgrade/state. If it says 'ready' then we are ready and the user is not questioned further. 3. If it does not exist or says anything else, the user is prompted to install the package 'mageia-prepare-upgrade'. 4. After package installation, check the state file again as this may be all that is required. If the state file does not yet say 'ready', then display the text from the /usr/share/doc/mageia-prepare-upgrade/README.prepare file (todo: add i18n) 5. Assuming that further action is required by the user (e.g. rebooting to convert the filesystem), then the upgrade helper will exit. 6. After the user has taken the action required to do the preparation, the state file should contain 'ready'. The next time the distro upgrade dialog shows, the preparation checks will pass and the user can continue. TODO: 1. Handle i18n in the README.prepare file. 2. Update dracut to write the state file when FS conversion is done. 3. Add README.prepare to mageia-prepare-upgrade. --- mgaapplet-upgrade-helper | 33 ++++++++++++++++++++++++++++++++- mgaonline.pm | 2 +- 2 files changed, 33 insertions(+), 2 deletions(-) diff --git a/mgaapplet-upgrade-helper b/mgaapplet-upgrade-helper index 1089a80..9f4227e 100755 --- a/mgaapplet-upgrade-helper +++ b/mgaapplet-upgrade-helper @@ -33,6 +33,8 @@ BEGIN { unshift @::textdomains, 'mgaonline' } use mygtk2 qw(gtknew); #- do not import gtkadd which conflicts with ugtk2 version use ugtk2 qw(:all); +use interactive; +use do_pkgs; use lib qw(/usr/lib/libDrakX/drakfirsttime); use mgaonline; use Rpmdrake::open_db; @@ -55,7 +57,36 @@ foreach my $opt (@ARGV) { my $root = Rpmdrake::open_db::fast_open_urpmi_db()->{root}; -my $product_id = common::parse_LDAP_namespace_structure(cat_("$root/etc/product.id")); +my $product_id = mgaonline::get_product_id(); + +# Find the matching new_distro_version +my @distros = mgaonline::get_distro_list(); +@distros or exit(1); +my $new_distro = find { $_->{version} eq $new_distro_version } @distros; +$new_distro or exit(1); + +if ($new_distro->{needs_preparation}) { + my $statefile = "$root/var/lib/mageia-prepare-upgrade/state"; + my $prepared = (cat_($statefile) =~ /ready/) if ( -f $statefile ); + + if (!$prepared) { + ugtk2::ask_yesorno(N("Preparation Required"), N("In order to upgrade, your current installation needs to be prepared.\n\nDo you wish to do this preparation now?")) or exit(0); + + my $in = interactive->vnew; + my $do_pkgs = do_pkgs::do_pkgs($in); + $do_pkgs->ensure_is_installed("mageia-prepare-upgrade") or exit(0); + + # Check to see if installation alone is enough to ensure things are in the right state? + $prepared = (cat_($statefile) =~ /ready/) if ( -f $statefile ); + if (!$prepared) { + my $infofile = "$root/usr/share/doc/mageia-prepare-upgrade/README.prepare"; + my $info = cat_($infofile) if ( -f $infofile); + $info = N("Further action is required before you can continue. Please see $new_distro->{url} for more information.") if !$info; + ugtk2::ask_warn(N("Next Steps"), $info); + exit(0); + } + } +} if (!$ENV{URPMI_IGNORESIZE}) { check_available_free_space('/usr', 800) && diff --git a/mgaonline.pm b/mgaonline.pm index ff64b62..9288db1 100644 --- a/mgaonline.pm +++ b/mgaonline.pm @@ -92,7 +92,7 @@ sub get_distro_list_() { my $extra_path = $::testing || uc($config{TEST_DISTRO_UPGRADE}) eq 'YES' ? 'testing-' : ''; my $list = join('&', - "https://releases.mageia.org/api/a/$extra_path$product_id->{arch}?product=$product_id->{product}", + "https://releases.mageia.org/api/b/$extra_path$product_id->{arch}?product=$product_id->{product}", "version=$product_id->{version}", "mgaonline_version=$mgaonline::version", ); -- 1.8.1.5
View Attachment As Raw
Actions:
View
Attachments on
bug 9744
:
3814
|
3815
|
3913