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

adapt schema files #598

Merged
merged 7 commits into from
May 6, 2020
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
10 changes: 10 additions & 0 deletions package/autoyast2.changes
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
-------------------------------------------------------------------
Wed May 6 14:59:26 UTC 2020 - Josef Reidinger <jreidinger@suse.com>

- AutoYaST schema improvements (bsc#1170886)
-- Allow optional types for string and map objects
-- Allow type specification without namespace
-- Add type specification with 't' shortcut

jreidinger marked this conversation as resolved.
Show resolved Hide resolved
- 4.3.0

-------------------------------------------------------------------
Tue Apr 1 11:51:35 UTC 2020 - schubi@suse.de

Expand Down
2 changes: 1 addition & 1 deletion package/autoyast2.spec
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
%endif

Name: autoyast2
Version: 4.2.34
Version: 4.3.0
Release: 0
Summary: YaST2 - Automated Installation
License: GPL-2.0-only
Expand Down
6 changes: 3 additions & 3 deletions src/autoyast-rnc/classes-decl.rnc
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ namespace config = "http://www.suse.com/1.0/configns"

include "common.rnc"

autoinstall = element autoinstall { classes }
autoinstall = element autoinstall { MAP, classes }
classes =
element classes {
LIST,
Expand All @@ -20,8 +20,8 @@ class =
name&
order
}
description = element description { text }
name = element name { text }
description = element description { STRING }
name = element name { STRING }
order = element order { INTEGER }

start = autoinstall
19 changes: 11 additions & 8 deletions src/autoyast-rnc/classes-use.rnc
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,20 @@ element classes {

class =
element class {
class_name &
configuration &
element dont_merge {
LIST,
element element { text }*
}?
MAP,
(
class_name &
configuration &
element dont_merge {
LIST,
element element { STRING }*
}?
)
}

class_name =
element class_name { text }
element class_name { STRING }
configuration =
element configuration { text }
element configuration { STRING }


29 changes: 25 additions & 4 deletions src/autoyast-rnc/common.rnc
Original file line number Diff line number Diff line change
@@ -1,27 +1,48 @@
default namespace = "http://www.suse.com/1.0/yast2ns"
namespace config = "http://www.suse.com/1.0/configns"
namespace a = "http://relaxng.org/ns/compatibility/annotations/1.0"
datatypes xsd = "http://www.w3.org/2001/XMLSchema-datatypes"

# Single hash comments # become <!-- XML comments-->
# Double hash comments ## are preserved in .rng as <a:documentation>

## Defined data-types

BOOLEAN =
(
attribute config:type { "boolean" },
## Historically we used config:type
## but it is unnecessarily long to type and read.
## Shorter variants are allowed.
attribute ( t | type | config:type ) { "boolean" },
( "true" | "false" )
)

INTEGER =
(
attribute config:type { "integer" },
attribute ( t | type | config:type ) { "integer" },
xsd:integer
)

# Usage: foo = element foo { STRING_ATTR, ( "bar" | "baz") }
STRING_ATTR = attribute ( t | type | config:type ) { "string" }?

STRING =
(
STRING_ATTR,
text
)

SYMBOL =
(
attribute config:type { "symbol" },
attribute ( t | type | config:type ) { "symbol" },
text
)

LIST =
attribute config:type { "list" }
attribute ( t | type | config:type ) { "list" }

MAP =
attribute ( t | type | config:type ) { "map" }?

# this is useful for testing
Anything =
Copy link
Member

Choose a reason for hiding this comment

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

BTW the * aka <anyName/> that this uses would crash REXML RelaxNG if used. But it does not implement include either so it

a. won't crash
b. won't be able to use the AY schema

I will make a REXML issue/PR about this.

Expand Down
24 changes: 16 additions & 8 deletions src/autoyast-rnc/files.rnc
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,20 @@ file_src = file_contents
files =
element files {
LIST,
element file { file_src? & file_path & file_permissions?
& file_owner? & file_script? }+
element file {
MAP,
(
file_src? &
file_path &
file_permissions? &
file_owner? &
file_script?
)
}+
}
file_contents = element file_contents { text }
file_location = element file_location { text }
file_path = element file_path { text }
file_permissions = element file_permissions { text }
file_owner = element file_owner { text }
file_script = element file_script { interpreter & source? & element location { text }? }
file_contents = element file_contents { STRING }
file_location = element file_location { STRING }
file_path = element file_path { STRING }
file_permissions = element file_permissions { STRING }
file_owner = element file_owner { STRING }
file_script = element file_script { MAP, (interpreter & source? & element location { STRING }? ) }
Copy link
Member

Choose a reason for hiding this comment

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

multiple lines please

Also, interpreter and source are from scripts.rnc, we may want to clean up these dependencies

Copy link
Member Author

Choose a reason for hiding this comment

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

well, I do not do any reformatting just, fixes.

185 changes: 101 additions & 84 deletions src/autoyast-rnc/general.rnc
Original file line number Diff line number Diff line change
Expand Up @@ -3,97 +3,87 @@ namespace config = "http://www.suse.com/1.0/configns"
namespace a = "http://relaxng.org/ns/compatibility/annotations/1.0"

general = element general {
element mode {
element confirm { BOOLEAN }? &
element halt { BOOLEAN }? &
element second_stage { BOOLEAN }? &
element final_halt { BOOLEAN }? &
element final_reboot { BOOLEAN }? &
element forceboot { BOOLEAN }? &
element confirm_base_product_license { BOOLEAN }? &
element ntp_sync_time_before_installation { text }? &
element max_systemd_wait { INTEGER }?
}? &
mouse? &
ask-list? &
semi-automatic? &
minimal-configuration? &
signature-handling? &
element self_update { BOOLEAN }? &
element self_update_url { text }? &
element proposals {
LIST,
element proposal { text }*
}? &
element storage {
element start_multipath { BOOLEAN }?
}? &
element wait {
element pre-modules {
LIST,
element module {
element name { text }? &
element sleep {
element time { INTEGER }? &
element feedback { BOOLEAN }?
}? &
element script {
element debug { BOOLEAN }? &
element source { text }?
}
}*
}? &
element post-modules {
LIST,
element module {
element name { text }? &
element sleep {
element time { INTEGER }? &
element feedback { BOOLEAN }?
}? &
element script {
element debug { BOOLEAN }? &
element source { text }?
}
}*
}?
}? &
cio_ignore?
MAP,
(
element mode {
MAP,
(
element confirm { BOOLEAN }? &
element halt { BOOLEAN }? &
element second_stage { BOOLEAN }? &
element final_halt { BOOLEAN }? &
element final_reboot { BOOLEAN }? &
element forceboot { BOOLEAN }? &
element confirm_base_product_license { BOOLEAN }? &
element ntp_sync_time_before_installation { STRING }? &
element max_systemd_wait { INTEGER }?
)
}? &
mouse? &
ask-list? &
semi-automatic? &
minimal-configuration? &
signature-handling? &
element self_update { BOOLEAN }? &
element self_update_url { STRING }? &
element proposals {
LIST,
element proposal { STRING }*
}? &
element storage {
MAP,
element start_multipath { BOOLEAN }?
}? &
element wait {
MAP,
(
element pre-modules {
LIST,
module*
}? &
element post-modules {
LIST,
module*
}?
)
}? &
cio_ignore?
)
}
ask-list = element ask-list { LIST, ask* }
ask = element ask { ask_question? & ask_default? & ask_help? & ask_title? & ask_type? & ask_password? & ask_path? & ask_pathlist? & ask_stage? & ask_selection? & ask_file? & ask_dialog? & ask_element? & ask_width? & ask_height? & ask_frametitle? & ask_script? & ask_timeout? & ask_ok_label? & ask_back_label? & ask_default_value_script? }
ask_question = element question { text }
ask_default = element default { text }
ask_help = element help { text }
ask_title = element title { text }
ask_type = element type { ( "symbol" | "integer" | "boolean" | "string" ) }
ask = element ask { MAP, (ask_question? & ask_default? & ask_help? & ask_title? & ask_type? & ask_password? & ask_path? & ask_pathlist? & ask_stage? & ask_selection? & ask_file? & ask_dialog? & ask_element? & ask_width? & ask_height? & ask_frametitle? & ask_script? & ask_timeout? & ask_ok_label? & ask_back_label? & ask_default_value_script? ) }
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_password = element password { BOOLEAN }
ask_path = element path { text }
ask_stage = element stage { "cont" | "initial" }
ask_path = element path { STRING }
ask_stage = element stage { STRING_ATTR, ( "cont" | "initial" ) }
ask_selection = element selection { LIST, ask_selection_entry+ }
ask_selection_entry = element entry { ask_entry_value & ask_entry_label }
ask_file = element file { text }
ask_entry_value = element value { text }
ask_entry_label = element label { text }
ask_selection_entry = element entry { MAP, ( ask_entry_value & ask_entry_label ) }
ask_file = element file { STRING }
ask_entry_value = element value { STRING }
ask_entry_label = element label { STRING }
ask_dialog = element dialog { INTEGER }
ask_element = element element { INTEGER }
ask_width = element width { INTEGER }
ask_height = element height { INTEGER }
ask_frametitle = element frametitle { text }
ask_frametitle = element frametitle { STRING }
ask_timeout = element timeout { INTEGER }
ask_pathlist = element pathlist {
LIST,
ask_path*
}
ask_ok_label = element ok_label { text }
ask_back_label = element back_label { text }
ask_ok_label = element ok_label { STRING }
ask_back_label = element back_label { STRING }

semi-automatic = element semi-automatic { LIST, semi-automatic-modules* }
semi-automatic-modules = element module { "networking" | "partitioning" | "scc" }
semi-automatic-modules = element module { STRING_ATTR, ( "networking" | "partitioning" | "scc" ) }

minimal-configuration = element minimal-configuration { BOOLEAN }

signature-handling = element signature-handling { accept_unsigned_file? & accept_file_without_checksum? & accept_verification_failed? & accept_unknown_gpg_key? & import_gpg_key? & accept_non_trusted_gpg_key? }
signature-handling = element signature-handling { MAP, ( accept_unsigned_file? & accept_file_without_checksum? & accept_verification_failed? & accept_unknown_gpg_key? & import_gpg_key? & accept_non_trusted_gpg_key? ) }
accept_unsigned_file = element accept_unsigned_file { BOOLEAN }
accept_file_without_checksum = element accept_file_without_checksum { BOOLEAN }
accept_verification_failed = element accept_verification_failed { BOOLEAN }
Expand All @@ -102,16 +92,22 @@ accept_non_trusted_gpg_key = element accept_non_trusted_gpg_key { BOOLEAN }
import_gpg_key = element import_gpg_key { BOOLEAN }

ask_script = element script {
element filename { text }? &
element source { text }? &
element debug { BOOLEAN }? &
element feedback { BOOLEAN }? &
element environment { BOOLEAN }? &
element rerun_on_error { BOOLEAN }?
MAP,
(
element filename { STRING }? &
element source { STRING }? &
element debug { BOOLEAN }? &
element feedback { BOOLEAN }? &
element environment { BOOLEAN }? &
element rerun_on_error { BOOLEAN }?
)
}
ask_default_value_script = element default_value_script {
element source { text } &
element interpreter { text }?
MAP,
(
element source { STRING } &
element interpreter { STRING }?
)
}

confirm =
Expand All @@ -123,14 +119,35 @@ final_reboot =
forceboot =
element forceboot { BOOLEAN }
ntp_sync_time_before_installation =
element ntp_sync_time_before_installation {text}
element ntp_sync_time_before_installation {STRING}
halt =
element halt { BOOLEAN }
second_stage =
element second_stage { BOOLEAN }
mouse = element mouse {
element id { text }
mouse = element mouse {
element id { STRING }
}

module = element module {
MAP,
(
element name { STRING }? &
element sleep {
MAP,
(
element time { INTEGER }? &
element feedback { BOOLEAN }?
)
}? &
element script {
MAP,
(
element debug { BOOLEAN }? &
element source { STRING }?
)
}
)
}

cio_ignore =
element cio_ignore { BOOLEAN }