Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Restore the installation repositories after going back #95

Merged
merged 5 commits into from
Mar 15, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion POTFILES

This file was deleted.

7 changes: 0 additions & 7 deletions data/know_downgrade

This file was deleted.

10 changes: 10 additions & 0 deletions package/yast2-update.changes
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
-------------------------------------------------------------------
Wed Mar 14 15:42:22 UTC 2018 - lslezak@suse.cz

- Properly restore the original installation repositories when
going back to the partition selection dialog (related to
bsc#1080979)
- Remove the very old and unused stuff (dead code, unsupported
file systems, ...)
- 4.0.11

-------------------------------------------------------------------
Thu Mar 8 09:25:38 UTC 2018 - lslezak@suse.cz

Expand Down
3 changes: 1 addition & 2 deletions package/yast2-update.spec
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@


Name: yast2-update
Version: 4.0.10
Version: 4.0.11
Release: 0

BuildRoot: %{_tmppath}/%{name}-%{version}-build
Expand Down Expand Up @@ -101,7 +101,6 @@ Use this component if you wish to update your system.

%files
%defattr(-,root,root)
%{yast_ybindir}/*
%dir %{yast_moduledir}
%{yast_moduledir}/*

Expand Down
3 changes: 0 additions & 3 deletions src/.cvsignore

This file was deleted.

6 changes: 1 addition & 5 deletions src/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -21,17 +21,13 @@ yncludedir = @yncludedir@/update
ynclude_DATA = \
include/update/rootpart.rb

ybin_SCRIPTS = \
bin/update_users_groups \
bin/remove_junk

desktop_DATA = \
desktop/update.desktop

ylibclientdir = "${yast2dir}/lib/update/clients"
ylibclient_DATA = \
lib/update/clients/inst_update_partition_auto.rb

EXTRA_DIST = $(module_DATA) $(client_DATA) $(ynclude_DATA) $(ybin_SCRIPTS) $(desktop_DATA) $(ylibclient_DATA)
EXTRA_DIST = $(module_DATA) $(client_DATA) $(ynclude_DATA) $(desktop_DATA) $(ylibclient_DATA)

include $(top_srcdir)/Makefile.am.common
17 changes: 0 additions & 17 deletions src/bin/remove_junk

This file was deleted.

17 changes: 0 additions & 17 deletions src/bin/update_users_groups

This file was deleted.

42 changes: 40 additions & 2 deletions src/clients/inst_update_partition.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

# ------------------------------------------------------------------------------
# Copyright (c) 2006-2012 Novell, Inc. All Rights Reserved.
#
# Copyright (c) 2018 SUSE LLC, All Rights Reserved.
#
# This program is free software; you can redistribute it and/or modify it under
# the terms of version 2 of the GNU General Public License as published by the
Expand All @@ -28,19 +28,30 @@
# RootPart::rootPartitions must be filled before
# calling this module.
#
# $Id$

module Yast
class InstUpdatePartitionClient < Client
include Yast::Logger

def main
Yast.import "UI"
Yast.import "Pkg"
textdomain "update"

Yast.import "ProductControl"
Yast.import "RootPart"
Yast.import "GetInstArgs"

Yast.include self, "update/rootpart.rb"

if Yast::GetInstArgs.going_back
# if going back restore the initial installation repositories
restore_installation_repos
else
# if going forward save the installation repos for later
save_installation_repos
end

if RootPart.Mounted
Update.restore_backup
Update.Detach
Expand All @@ -61,6 +72,33 @@ def main

@ret
end

private

# restore the repository setup from the saved config
def restore_installation_repos
log.info("Restoring the initial repository setup")

# drop the currently loaded repositories
Yast::Pkg.SourceFinishAll
# move the target from "/mnt" to "/"
Yast::Pkg.TargetFinish
Yast::Pkg.TargetInitialize("/")
# load the previous repositories from the inst-sys ("/")
Yast::Pkg.SourceRestore
Yast::Pkg.SourceLoad

restored = Yast::Pkg.SourceGetCurrent(false).map do |r|
Yast::Pkg.SourceGeneralData(r)["url"]
end
log.info("Restored repositories: #{restored}")
end

# save the current repository setup
def save_installation_repos
log.info("Storing a backup of the current repository setup")
Yast::Pkg.SourceSaveAll
end
end
end

Expand Down
6 changes: 0 additions & 6 deletions src/modules/RootPart.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1127,11 +1127,8 @@ def MountFSTab(fstab, message)
"ext3",
"ext4",
"btrfs",
"minix",
"reiserfs",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just are you sure that we without this can report error that reiserfs is not supported?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see, let me check that...

Copy link
Member Author

@lslezak lslezak Mar 15, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It turned out that I still have a SLES10 VM with ReiserFS, so I could test that. 🙂

And yes it works, the check is actually done at a different place:

sles10_upgrade_reiserfs

"jfs",
"xfs",
"xiafs",
"hpfs",
"vfat",
"auto",
Expand All @@ -1152,8 +1149,6 @@ def MountFSTab(fstab, message)

success = true

raidMounted = false

Builtins.foreach(fstab) do |mounts|
vfstype = Ops.get_string(mounts, "vfstype", "")
mntops = Ops.get_string(mounts, "mntops", "")
Expand Down Expand Up @@ -2004,7 +1999,6 @@ def FindRootPartitions
return if @didSearchForRootPartitions

modules_to_load = {
"reiserfs" => "Reiser FS",
"xfs" => "XFS",
"ext3" => "Ext3",
"ext4" => "Ext4",
Expand Down
14 changes: 1 addition & 13 deletions src/modules/Update.rb
Original file line number Diff line number Diff line change
Expand Up @@ -742,20 +742,8 @@ def SetDesktopPattern
def Detach
# release mounted devices
Pkg.SourceReleaseAll

# remove all repos except the initial installation repository
# to close the solv files and allow unmounting the target
repos_to_delete = Pkg.SourceGetCurrent(false)
repos_to_delete.delete(0)
log.info "Removing repositories: #{repos_to_delete}"

# the changes are not saved to the target system, the repositories
# are removed only from pkg-bindings
repos_to_delete.each do |repo_to_delete|
Pkg.SourceDelete(repo_to_delete)
end

Pkg.TargetFinish

@did_init1 = false
@did_init2 = false

Expand Down
2 changes: 0 additions & 2 deletions src/scripts/.cvsignore

This file was deleted.

5 changes: 5 additions & 0 deletions test/test_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@
require "yast/rspec"
require_relative "helpers"

# make sure we run the tests in English locale
# (some tests check the output which is marked for translation)
ENV["LANG"] = "en_US.UTF-8"
ENV["LC_ALL"] = "en_US.UTF-8"

RSpec.configure do |config|
config.extend Yast::I18n # available in context/describe
config.include Yast::I18n # available in it/let/before
Expand Down