Skip to content

Commit

Permalink
Merge pull request #754 from yast/refactor-ask-list
Browse files Browse the repository at this point in the history
Refactor <ask-list> feature
  • Loading branch information
imobachgs committed May 11, 2021
2 parents 5490d88 + 5ff5815 commit 3b4bb49
Show file tree
Hide file tree
Showing 54 changed files with 3,446 additions and 1,060 deletions.
10 changes: 10 additions & 0 deletions package/autoyast2.changes
@@ -1,3 +1,13 @@
-------------------------------------------------------------------
Tue May 11 08:50:30 UTC 2021 - Imobach Gonzalez Sosa <igonzalezsosa@suse.com>

- Refactor the <ask> mechanism (bsc#1185704):
- Split the code into several and testable classes.
- Fix 'Next' dialog calculation when the target does not exist.
- <script> and <default_value_script> support the same elements
than any other script.
- 4.4.4

-------------------------------------------------------------------
Fri May 7 10:24:22 UTC 2021 - Knut Anderssen <kanderssen@suse.com>

Expand Down
5 changes: 3 additions & 2 deletions package/autoyast2.spec
Expand Up @@ -22,7 +22,7 @@
%endif

Name: autoyast2
Version: 4.4.3
Version: 4.4.4
Release: 0
Summary: YaST2 - Automated Installation
License: GPL-2.0-only
Expand Down Expand Up @@ -260,7 +260,6 @@ done
%{yast_clientdir}/clone_system.rb

%{yast_yncludedir}/autoinstall/xml.rb
%{yast_yncludedir}/autoinstall/ask.rb

%dir %{yast_libdir}/autoinstall
%{yast_libdir}/autoinstall/*.rb
Expand All @@ -270,6 +269,8 @@ done

%{yast_libdir}/autoinstall/widgets
%{yast_libdir}/autoinstall/presenters
%{yast_libdir}/autoinstall/ask
%{yast_libdir}/autoinstall/autoinst_profile

%dir %{yast_libdir}/autoinstall/clients
%{yast_libdir}/autoinstall/clients/*.rb
Expand Down
36 changes: 28 additions & 8 deletions src/autoyast-rnc/general.rnc
Expand Up @@ -59,7 +59,7 @@ ask_question = element question { STRING }
ask_default = element default { STRING }
ask_help = element help { STRING }
ask_title = element title { STRING }
ask_type = element type { STRING_ATTR, ( "symbol" | "integer" | "boolean" | "string" ) }
ask_type = element type { STRING_ATTR, ( "symbol" | "integer" | "boolean" | "string" | "static_text" ) }
ask_password = element password { BOOLEAN }
ask_path = element path { STRING }
ask_stage = element stage { STRING_ATTR, ( "cont" | "initial" ) }
Expand Down Expand Up @@ -98,22 +98,42 @@ import_gpg_key = element import_gpg_key { BOOLEAN }
ask_script = element script {
MAP,
(
element filename { STRING }? &
element source { STRING }? &
element debug { BOOLEAN }? &
element feedback { BOOLEAN }? &
element environment { BOOLEAN }? &
element filename { STRING }? &
element interpreter { STRING }? &
element location { STRING }? &
element source { STRING }? &
element debug { BOOLEAN }? &
element feedback { BOOLEAN }? &
element feedback_type { STRING }? &
ask-param-list? &
element rerun { BOOLEAN }? &
element notification { STRING }? &
element environment { BOOLEAN }? &
element rerun_on_error { BOOLEAN }?
)
}

ask_default_value_script = element default_value_script {
MAP,
(
element source { STRING } &
element interpreter { STRING }?
element filename { STRING }? &
element interpreter { STRING }? &
element location { STRING }? &
element source { STRING }? &
element debug { BOOLEAN }? &
element feedback { BOOLEAN }? &
element feedback_type { STRING }? &
ask-param-list? &
element rerun { BOOLEAN }? &
element notification { STRING }?
)
}

ask-param-list = element param-list {
LIST,
element param { STRING }*
}

confirm =
element confirm { BOOLEAN }
final_halt =
Expand Down
7 changes: 5 additions & 2 deletions src/clients/inst_autopost.rb
Expand Up @@ -8,6 +8,8 @@

require "autoinstall/entries/registry"
require "autoinstall/importer"
require "autoinstall/ask/runner"
require "autoinstall/ask/stage"

module Yast
class InstAutopostClient < Client
Expand All @@ -24,7 +26,6 @@ def main
Yast.import "Progress"
Yast.import "PackageSystem"
Yast.import "AutoinstConfig"
Yast.include self, "autoinstall/ask.rb"

Builtins.y2debug("Profile=%1", Profile.current)
Report.Import(Ops.get_map(Profile.current, "report", {}))
Expand Down Expand Up @@ -69,7 +70,9 @@ def main
Progress.NextStage
Progress.Title(_("Checking for required packages..."))

askDialog
Y2Autoinstall::Ask::Runner.new(
Yast::Profile.current, stage: Y2Autoinstall::Ask::Stage::CONT
).run
# FIXME: too late here, even though it would be the better place
# if (Profile::current["general"]:$[] != $[])
# AutoinstGeneral::Import(Profile::current["general"]:$[]);
Expand Down

0 comments on commit 3b4bb49

Please sign in to comment.