Module: Yast::AddOnAddOnWorkflowInclude
- Includes:
- Logger
- Defined in:
- src/include/add-on/add-on-workflow.rb
Instance Method Summary (collapse)
-
- (Object) AddAddOnToStore(src_id)
used Add-Ons are stored in AddOnProduct::add_on_products bnc #393620.
- - (Object) AdjustInfoWidget
-
- (Object) AdjustRepositoryInfo(info)
Modifies repository info (adds some missing pieces).
-
- (Symbol) CatalogSelect
Run dialog for selecting the catalog on the media (if more than one present).
-
- (Object) CheckCompliance
Check new product compliance; may abort the installation.
-
- (Object) CreateAddOnsOverviewDialog
AddOnsOverviewDialog –>.
- - (Object) GetAllProductsInfo
- - (Object) GetInstalledProducts
- - (Object) GetProductInfos
-
- (Object) GetRepoInfo(this_product, all_products)
Structure:.
-
- (String) GetURLBeginsWith(source_type)
Returns begining string for source type.
- - (Object) initialize_add_on_add_on_workflow(include_target)
-
- (Object) InstallProduct
BNC #474745 Installs all the products from just added add-on media.
-
- (Object) IsAnyNetworkAvailable
Checks whether some network is available in the current moment, see the bug #170147 for more information.
-
- (Object) LoadLibzyppNow
Either there are no repositories now or they were changed, neutralized, etc.
-
- (Object) LogWrongProduct(one_product, log_this, return_this)
Logs wrong product with 'log_this' error and returns 'return_this'.
-
- (Symbol) MediaSelect
Run dialog for selecting the media.
-
- (Object) NeutralizeAllResolvables
BNC #476417: When user cancels removing an add-on, we have to neutralize all libzypp resolvables to their inital states.
- - (Object) ProductSelect
-
- (Object) Read
Initialize current inst.
-
- (Object) ReadFromSystem
List of all selected repositories.
- - (Object) Redraw(enable_back, enable_next, enable_abort, back_button, next_button, abort_button)
- - (Object) RedrawAddOnsOverviewTable
-
- (Boolean) RemoveProductWithDependencies
Removes the currently selected Add-On.
- - (Object) RemoveSelectedAddOn(selected)
- - (Object) ReturnCurrentlySelectedProductInfo
-
- (Object) RunAddOnMainDialog(enable_back, enable_next, enable_abort, back_button, next_button, abort_button, confirm_abort)
bugzilla #221377 the original control file is stored as /control.xml the other (added) control files are under the /tmp/$yast_tmp/control_files/ directory as $srcid.xml files.
- - (Object) RunAddOnsOverviewDialog
- - (Object) RunAddProductWorkflow
- - (Object) RunAutorunWizard
- - (Object) RunPackageSelector
- - (Object) RunWizard
-
- (Object) SetAddOnProductName(src_id)
bugzilla #304659 Sets the Add-On's product name.
-
- (Object) SetWizardWindowInProgress
Cleanup UI - Prepare it for progress callbacks.
-
- (Object) Write
Write (changed) inst.
Instance Method Details
- (Object) AddAddOnToStore(src_id)
used Add-Ons are stored in AddOnProduct::add_on_products bnc #393620
131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 |
# File 'src/include/add-on/add-on-workflow.rb', line 131 def AddAddOnToStore(src_id) if src_id == nil Builtins.y2error("Wrong src_id: %1", src_id) return end # BNC #450274 # Prevent from adding one product twice matching_products = Builtins.filter(AddOnProduct.add_on_products) do |one_product| Ops.get_integer(one_product, "media", -1) == src_id end if Ops.greater_than(Builtins.size(matching_products), 0) Builtins.y2milestone("Product already added: %1", matching_products) return end source_data = Pkg.SourceGeneralData(src_id) AddOnProduct.add_on_products = Builtins.add( AddOnProduct.add_on_products, { "media" => AddOnProduct.src_id, # table cell "product" => Ops.get_locale( source_data, "name", Ops.get_locale( source_data, "alias", _("No product found in the repository.") ) ), "media_url" => Ops.get_string(source_data, "url", ""), "product_dir" => Ops.get_string(source_data, "product_dir", "") } ) nil end |
- (Object) AdjustInfoWidget
1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 |
# File 'src/include/add-on/add-on-workflow.rb', line 1327 def AdjustInfoWidget pi = ReturnCurrentlySelectedProductInfo() if pi == nil || pi == {} UI.ChangeWidget(Id("product_details"), :Value, "") return end rt_description = Builtins.sformat( "<p>%1\n%2\n%3\n%4</p>", Builtins.sformat( _("<b>Vendor:</b> %1<br>"), Ops.get_locale(pi, ["product", "vendor"], _("Unknown vendor")) ), Builtins.sformat( _("<b>Version:</b> %1<br>"), Ops.get_locale(pi, ["product", "version"], _("Unknown version")) ), Builtins.sformat( _("<b>Repository URL:</b> %1<br>"), Ops.greater_than( Builtins.size(Ops.get_list(pi, ["info", "URLs"], [])), 0 ) ? Builtins.mergestring(Ops.get_list(pi, ["info", "URLs"], []), ",") : _("Unknown repository URL") ), Ops.greater_than( Builtins.size(Ops.get_list(pi, ["info", "aliases"], [])), 0 ) ? Builtins.sformat( _("<b>Repository Alias:</b> %1<br>"), Builtins.mergestring(Ops.get_list(pi, ["info", "aliases"], []), ",") ) : "" ) UI.ChangeWidget(Id("product_details"), :Value, rt_description) nil end |
- (Object) AdjustRepositoryInfo(info)
Modifies repository info (adds some missing pieces).
1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 |
# File 'src/include/add-on/add-on-workflow.rb', line 1379 def AdjustRepositoryInfo(info) Builtins.foreach( Convert.convert( Ops.get(info.value, "IDs", []), :from => "list", :to => "list <integer>" ) ) do |one_repo| if one_repo == nil || one_repo == -1 Builtins.y2warning("Wrong repo ID: %1", one_repo) next end source_data = Pkg.SourceGeneralData(one_repo) if source_data != nil && Builtins.haskey(source_data, "base_urls") Ops.set( info.value, "URLs", Ops.get_list(source_data, "base_urls", []) ) else Builtins.y2error("No URLs for repo ID %1", one_repo) end if source_data != nil && Builtins.haskey(source_data, "alias") Ops.set( info.value, "aliases", [Ops.get_string(source_data, "alias", "")] ) end end nil end |
- (Symbol) CatalogSelect
Run dialog for selecting the catalog on the media (if more than one present)
308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 |
# File 'src/include/add-on/add-on-workflow.rb', line 308 def CatalogSelect sources = deep_copy(SourceManager.newSources) Builtins.y2milestone("New sources: %1", sources) if Builtins.size(sources) == 0 # error report Report.Error(_("No software repository found on medium.")) Builtins.y2milestone("CatalogSelect Dialog ret: %1", :back) return :back end if Builtins.size(sources) == 1 if AddOnProduct.last_ret != :next Builtins.y2milestone("Deleting source %1", Ops.get(sources, 0, 0)) Pkg.SourceDelete(Ops.get(sources, 0, 0)) Builtins.y2milestone( "CatalogSelect Dialog ret: %1", AddOnProduct.last_ret ) return AddOnProduct.last_ret end # busy message UI.OpenDialog( Label(Id(:add_on_popup_id), _("Initializing new source...")) ) src_id = Ops.get(SourceManager.newSources, 0, 0) # BNC #481828: Using LABEL from content file as a repository name Packages.AdjustSourcePropertiesAccordingToProduct(src_id) # a little hack because of packager leaving # windows open... if UI.WidgetExists(:add_on_popup_id) UI.CloseDialog elsif UI.WidgetExists(:contents) Builtins.y2warning("Already in base dialog!") else Builtins.y2error("Error in packager, closing current dialog!") while !UI.WidgetExists(:contents) Builtins.y2milestone("Calling UI::CloseDialog") UI.CloseDialog end end AddOnProduct.src_id = src_id SourceManager.newSources = [src_id] Builtins.y2milestone("Only one source available - skipping dialog") Builtins.y2milestone( "CatalogSelect Dialog ret: %1", AddOnProduct.last_ret ) return AddOnProduct.last_ret end Builtins.y2milestone("Running catalog select dialog") catalogs = Builtins.maplist(sources) do |src| data = Pkg.SourceGeneralData(src) # placeholder for unknown directory dir = Ops.get_locale(data, "product_dir", _("Unknown")) dir = "/" if dir == "" Item( Id(src), Builtins.sformat( _("URL: %1, Directory: %2"), Ops.get_locale( # place holder for unknown URL data, "url", _("Unknown") ), dir ) ) end # dialog caption title = _("Software Repository Selection") # help text help_text = _( "<p><big><b>Software Repository Selection</b></big><br>\n" + "Multiple repositories were found on the selected medium.\n" + "Select the repository to use.</p>\n" ) contents = HBox( HSpacing(4), VBox( VSpacing(2), SelectionBox(Id(:catalogs), _("Repositories &Found"), catalogs), VSpacing(2) ), HSpacing(4) ) Wizard.SetContents(title, contents, help_text, true, true) ret = nil selected = nil while ret == nil ret = Convert.to_symbol(UI.UserInput) if ret == :abort || ret == :cancel ret = :abort break if Popup.YesNo(_("Really abort add-on product installation?")) next elsif ret == :back break elsif ret == :next selected = Convert.to_integer( UI.QueryWidget(Id(:catalogs), :CurrentItem) ) if selected == nil ret = nil # popup message Popup.Message(_("Select a repository.")) end end end if ret != :next Builtins.foreach(SourceManager.newSources) do |src| Builtins.y2milestone("Deleting source %1", src) Pkg.SourceDelete(src) end else Builtins.foreach(SourceManager.newSources) do |src| if src != selected Builtins.y2milestone("Deleting unused source %1", src) Pkg.SourceDelete(src) end end # BNC #481828: Using LABEL from content file as a repository name Packages.AdjustSourcePropertiesAccordingToProduct(selected) AddOnProduct.src_id = selected SourceManager.newSources = [selected] end AddOnProduct.last_ret = ret Builtins.y2milestone( "CatalogSelect Dialog ret: %1", AddOnProduct.last_ret ) ret end |
- (Object) CheckCompliance
Check new product compliance; may abort the installation
842 843 844 845 846 847 848 |
# File 'src/include/add-on/add-on-workflow.rb', line 842 def CheckCompliance if ProductProfile.CheckCompliance(AddOnProduct.src_id) return :next else return :abort end end |
- (Object) CreateAddOnsOverviewDialog
AddOnsOverviewDialog –>
1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 |
# File 'src/include/add-on/add-on-workflow.rb', line 1250 def CreateAddOnsOverviewDialog Builtins.y2milestone("Creating OverviewDialog") Wizard.SetContents( # TRANSLATORS: dialog caption _("Installed Add-on Products"), VBox( Table( Id("list_of_addons"), Opt(:notify, :immediate), Header( # TRANSLATORS: table header item _("Add-on Product"), # TRANSLATORS: table header item _("URL") ), [] ), VSquash( # Rich text plus border MinHeight(6, RichText(Id("product_details"), "")) ), HBox( PushButton(Id(:add), Label.AddButton), HSpacing(1), PushButton(Id(:delete), Label.DeleteButton), HStretch(), # TRANSLATORS: push button PushButton(Id(:packager), _("Run &Software Manager...")) ) ), # TRANSLATORS: dialog help adp/1 _("<p>All add-on products installed on your system are displayed.</p>") + # TRANSLATORS: dialog help adp/2 _( "<p>Click <b>Add</b> to add a new add-on product, or <b>Delete</b> to remove an add-on which is in use.</p>" ), false, true ) Wizard.SetTitleIcon("yast-addon") Wizard.HideBackButton Wizard.SetAbortButton(:abort, Label.CancelButton) Wizard.SetNextButton(:next, Label.OKButton) # BNC #517919: Broken layout in some obscure cases # Fixing it... UI.RecalcLayout nil end |
- (Object) GetAllProductsInfo
1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 |
# File 'src/include/add-on/add-on-workflow.rb', line 1453 def GetAllProductsInfo all_products = Pkg.ResolvableProperties("", :product, "") all_products = Builtins.maplist(all_products) do |one_product| # otherwise it fills the log too much Builtins.foreach(["license", "description"]) do |key| if Builtins.haskey(one_product, key) Ops.set( one_product, key, Ops.add( Builtins.substring(Ops.get_string(one_product, key, ""), 0, 40), "..." ) ) end end deep_copy(one_product) end deep_copy(all_products) end |
- (Object) GetInstalledProducts
1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 |
# File 'src/include/add-on/add-on-workflow.rb', line 1476 def GetInstalledProducts installed_products = Builtins.filter(GetAllProductsInfo()) do |one_product| # Do not list the base product next false if Ops.get_string(one_product, "category", "addon") == "base" # BNC #475591: Only those `installed or `selected ones should be actually visible Ops.get_symbol(one_product, "status", :unknown) == :installed || Ops.get_symbol(one_product, "status", :unknown) == :selected end deep_copy(installed_products) end |
- (Object) GetProductInfos
1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 |
# File 'src/include/add-on/add-on-workflow.rb', line 1488 def GetProductInfos all_products = GetAllProductsInfo() installed_products = GetInstalledProducts() repository_info = nil counter = -1 @product_infos = {} Builtins.foreach(installed_products) do |one_product| # only add-on products should be listed if Builtins.haskey(one_product, "type") && Ops.get_string(one_product, "type", "addon") != "addon" Builtins.y2milestone( "Skipping product: %1", Ops.get_string( one_product, "display_name", Ops.get_string(one_product, "name", "") ) ) next end counter = Ops.add(counter, 1) Builtins.y2milestone( "Product: %1, Info: %2", one_product, repository_info ) if repository_info == nil Builtins.y2warning( "No matching repository found for product listed above" ) end repository_info = ( one_product_ref = arg_ref(one_product); all_products_ref = arg_ref(all_products); _GetRepoInfo_result = GetRepoInfo(one_product_ref, all_products_ref); one_product = one_product_ref.value; all_products = all_products_ref.value; _GetRepoInfo_result ) Ops.set( @product_infos, Builtins.tostring(counter), { "product" => one_product, "info" => repository_info } ) end deep_copy(@product_infos) end |
- (Object) GetRepoInfo(this_product, all_products)
Structure:
1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 |
# File 'src/include/add-on/add-on-workflow.rb', line 1421 def GetRepoInfo(this_product, all_products) ret = { "IDs" => [], "URLs" => [], "aliases" => [] } product_arch = Ops.get_string(this_product.value, "arch", "") product_name = Ops.get_string(this_product.value, "name", "") product_version = Ops.get_string(this_product.value, "version", "") Builtins.foreach(all_products.value) do |one_product| # if (one_product["status"]:`unknown != `available) return; next if Ops.get_string(one_product, "arch", "") != product_arch next if Ops.get_string(one_product, "name", "") != product_name next if Ops.get_string(one_product, "version", "") != product_version if Builtins.haskey(one_product, "source") && Ops.get_integer(one_product, "source", -1) != -1 Ops.set( ret, "IDs", Builtins.add( Ops.get(ret, "IDs", []), Ops.get_integer(one_product, "source", -1) ) ) end end ret_ref = arg_ref(ret) AdjustRepositoryInfo(ret_ref) ret = ret_ref.value deep_copy(ret) end |
- (String) GetURLBeginsWith(source_type)
Returns begining string for source type
105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 |
# File 'src/include/add-on/add-on-workflow.rb', line 105 def GetURLBeginsWith(source_type) url = "" if source_type == :ftp url = "ftp://" elsif source_type == :http url = "http://" elsif source_type == :https url = "https://" elsif source_type == :samba url = "smb://" elsif source_type == :nfs url = "nfs://" elsif source_type == :cd url = "cd:///" elsif source_type == :dvd url = "dvd:///" elsif source_type == :local_dir url = "dir://" end url end |
- (Object) initialize_add_on_add_on_workflow(include_target)
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 |
# File 'src/include/add-on/add-on-workflow.rb', line 21 def initialize_add_on_add_on_workflow(include_target) Yast.import "UI" Yast.import "Pkg" textdomain "add-on" Yast.import "AddOnProduct" Yast.import "WorkflowManager" Yast.import "Linuxrc" Yast.import "Mode" Yast.import "Popup" Yast.import "Report" Yast.import "Sequencer" Yast.import "SourceManager" Yast.import "PackageSystem" Yast.import "ProductProfile" Yast.import "SuSEFirewall" Yast.import "Stage" Yast.import "Wizard" Yast.import "Confirm" Yast.import "GetInstArgs" Yast.import "Installation" Yast.import "PackageCallbacks" Yast.import "PackagesUI" Yast.import "Packages" Yast.include include_target, "packager/inst_source_dialogs.rb" Yast.include include_target, "packager/repositories_include.rb" Yast.include include_target, "add-on/misc.rb" # Used for adding sources @createResult = :again @new_addon_name = "" @product_infos = {} end |
- (Object) InstallProduct
BNC #474745 Installs all the products from just added add-on media
457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 |
# File 'src/include/add-on/add-on-workflow.rb', line 457 def InstallProduct Builtins.y2milestone("AddOnID: %1", AddOnProduct.src_id) if AddOnProduct.src_id == nil || Ops.less_than(AddOnProduct.src_id, 0) Builtins.y2error("No source has been added") return :next end all_products = Pkg.ResolvableProperties("", :product, "") # `selected and `installed products # each map contains "name" and "version" s_a_i_products = [] Builtins.foreach(all_products) do |one_product| s_a_i_products = Builtins.add( s_a_i_products, { "name" => Ops.get_string(one_product, "name", "xyz"), "version" => Ops.get_string(one_product, "version", "abc") } ) end Builtins.foreach(all_products) do |one_product| # map this_product = $["name":one_product["name"]:"zyx", "version":one_product["version"]:"cba"]; # Product doesn't match the new source ID if Ops.get_integer(one_product, "source", -255) != AddOnProduct.src_id next end # Product is not available (either `installed or `selected or ...) next if Ops.get_symbol(one_product, "status", :available) != :available # // Available but also already installed or selected # if (contains (s_a_i_products, this_product)) { # y2warning ("Product %1 is already installed", this_product); # return; # } product_name = Ops.get_string(one_product, "name", "-Unknown-Product-") Builtins.y2milestone( "Selecting product '%1' for installation -> %2", product_name, Pkg.ResolvableInstall(product_name, :product) ) end :next end |
- (Object) IsAnyNetworkAvailable
Checks whether some network is available in the current moment, see the bug #170147 for more information.
73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 |
# File 'src/include/add-on/add-on-workflow.rb', line 73 def IsAnyNetworkAvailable ret = false command = "TERM=dumb /sbin/ip -o address show | grep inet | grep -v scope.host" Builtins.y2milestone("Running %1", command) cmd_run = Convert.to_map( SCR.Execute(path(".target.bash_output"), command) ) Builtins.y2milestone("Command returned: %1", cmd_run) # command failed if Ops.get_integer(cmd_run, "exit", -1) != 0 # some errors were there, we don't know the status, rather return that it's available # `grep` also returns non zero exit code when there is nothing to do... if Ops.get_string(cmd_run, "stdout", "") != "" Builtins.y2error("Checking the network failed") ret = true end # some devices are listed elsif Ops.get_string(cmd_run, "stdout", "") != nil && Ops.get_string(cmd_run, "stdout", "") != "" && Ops.get_string(cmd_run, "stdout", "") != "\n" ret = true end ret end |
- (Object) LoadLibzyppNow
Either there are no repositories now or they were changed, neutralized, etc.
1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 |
# File 'src/include/add-on/add-on-workflow.rb', line 1898 def LoadLibzyppNow Builtins.y2milestone("Reloading libzypp") SetWizardWindowInProgress() # Reinitialize Pkg.TargetInitialize(Installation.destdir) Pkg.TargetLoad Pkg.SourceStartManager(true) nil end |
- (Object) LogWrongProduct(one_product, log_this, return_this)
Logs wrong product with 'log_this' error and returns 'return_this'. Added because of bnc #459461
1371 1372 1373 1374 1375 1376 |
# File 'src/include/add-on/add-on-workflow.rb', line 1371 def LogWrongProduct(one_product, log_this, return_this) one_product = deep_copy(one_product) Builtins.y2error("Erroneous product: %1: %2", log_this, one_product) return_this end |
- (Symbol) MediaSelect
Run dialog for selecting the media
174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 |
# File 'src/include/add-on/add-on-workflow.rb', line 174 def MediaSelect aliases = { "type" => lambda do ret = TypeDialog() log.debug "SourceDialogs.addon_enabled: #{SourceDialogs.addon_enabled}" # explicitly check for false (nil means the checkbox was not displayed) ret = :skip if ret == :next && SourceDialogs.addon_enabled == false log.debug "TypeDialog result: #{ret}" ret end, "edit" => lambda { EditDialog() }, "store" => lambda do StoreSource() end } sources_before = Pkg.SourceGetCurrent(false) Builtins.y2milestone("Sources before adding new one: %1", sources_before) sequence = { "ws_start" => "type", "type" => { :next => "edit", # bnc #392083 :finish => "store", :abort => :abort, :skip => :skip }, "edit" => { :next => "store", # bnc #392083 :finish => "store", :abort => :abort }, "store" => { :next => :next, # bnc #392083 :finish => :next, :abort => :abort } } Builtins.y2milestone("Starting repository sequence") ret = Sequencer.Run(aliases, sequence) log.info "Repository sequence result: #{ret}" if ret == :next sources_after = Pkg.SourceGetCurrent(false) Builtins.y2milestone("Sources with new one added: %1", sources_after) # bnc #393011 # AddOnProduct::src_id must be set to the latest source ID src_id_found = false Builtins.foreach(sources_after) do |one_source| if !Builtins.contains(sources_before, one_source) AddOnProduct.src_id = one_source Builtins.y2milestone("Added source ID is: %1", AddOnProduct.src_id) src_id_found = true raise Break end end if src_id_found # BNC #481828: Using LABEL from content file as a repository name Packages.AdjustSourcePropertiesAccordingToProduct(AddOnProduct.src_id) # used add-ons are stored in a special list AddAddOnToStore(AddOnProduct.src_id) else AddOnProduct.src_id = Ops.get( sources_after, Ops.subtract(Builtins.size(sources_after), 1), 0 ) Builtins.y2warning("Fallback src_id: %1", AddOnProduct.src_id) end # BNC #441380 # Refresh and load the added source, this is needed since the unified # functions from packager are used. Pkg.SourceRefreshNow(AddOnProduct.src_id) Pkg.SourceLoad # BNC #468449 # It may happen that the add-on control file contains some code that # would drop the changes made, so it's better to save the soruces now if Mode.normal Builtins.y2milestone("Saving all sources") Pkg.SourceSaveAll end end AddOnProduct.last_ret = ret Builtins.y2milestone("MediaSelect Dialog ret: %1", ret) ret end |
- (Object) NeutralizeAllResolvables
BNC #476417: When user cancels removing an add-on, we have to neutralize all libzypp resolvables to their inital states
1887 1888 1889 1890 1891 1892 1893 1894 |
# File 'src/include/add-on/add-on-workflow.rb', line 1887 def NeutralizeAllResolvables Builtins.foreach([:product, :patch, :package, :srcpackage, :pattern]) do |one_type| Builtins.y2milestone("Neutralizing all: %1", one_type) Pkg.ResolvableNeutral("", one_type, true) end nil end |
- (Object) ProductSelect
506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 |
# File 'src/include/add-on/add-on-workflow.rb', line 506 def ProductSelect all_products = Pkg.ResolvableProperties("", :product, "") already_used_urls = {} # getting all source urls and product_dirs Builtins.foreach(all_products) do |p| one_src_id = Builtins.tointeger(Ops.get(p, "source")) next if one_src_id == nil # the last source (just added) next if one_src_id == AddOnProduct.src_id src_general_data = Pkg.SourceGeneralData(one_src_id) source_url = Ops.get_string(src_general_data, "url", "") if source_url != "" && source_url != nil Ops.set( already_used_urls, source_url, Ops.get_string(src_general_data, "product_dir", "") ) end end Builtins.y2milestone( "Already used urls with product_dirs: %1", already_used_urls ) installed_products = Builtins.filter(all_products) do |p| Ops.get(p, "status") == :selected || Ops.get(p, "status") == :installed end Builtins.y2milestone( "Already installed/selected products: %1", installed_products ) products = Builtins.filter(all_products) do |p| Ops.get_integer(p, "source", -1) == AddOnProduct.src_id end Builtins.y2milestone("Products on the media: %1", products) # there are no product on the given url if Builtins.size(products) == 0 Builtins.y2milestone( "No poduct found on the media, but anyway, using it :-)" ) # Display /media.1/info.txt if such file exists # Display license and wait for agreement # FIXME the same code is below license_ret2 = AddOnProduct.AcceptedLicenseAndInfoFile( AddOnProduct.src_id ) if license_ret2 != true Builtins.y2milestone( "Removing the current source ID %1", AddOnProduct.src_id ) Pkg.SourceDelete(AddOnProduct.src_id) Builtins.y2milestone("ProductSelect Dialog ret: %1", :abort) return :abort end data = Pkg.SourceGeneralData(AddOnProduct.src_id) url = Ops.get_string(data, "url", "") product_dir = Ops.get_string(data, "product_dir", "") # bugzilla #304659 SetAddOnProductName(AddOnProduct.src_id) AddOnProduct.add_on_products = Builtins.add( AddOnProduct.add_on_products, { "media" => AddOnProduct.src_id, # table cell "product" => @new_addon_name != "" && @new_addon_name != nil ? @new_addon_name : _("No product found in the repository."), "media_url" => url, "product_dir" => product_dir } ) if Mode.config AddOnProduct.mode_config_sources = Builtins.add( AddOnProduct.mode_config_sources, AddOnProduct.src_id ) end Builtins.y2milestone("ProductSelect Dialog ret: %1", :next) return :next end # Display /media.1/info.txt if such file exists # Display license and wait for agreement # FIXME the same code is above license_ret = AddOnProduct.AcceptedLicenseAndInfoFile(AddOnProduct.src_id) if license_ret != true Builtins.y2milestone( "Removing the current source ID %1", AddOnProduct.src_id ) Pkg.SourceDelete(AddOnProduct.src_id) Builtins.y2milestone("ProductSelect Dialog ret: %1", :abort) return :abort end # there is only one product on the given url if Builtins.size(products) == 1 # bugzilla #227605 # this product with this url has been already installed or selected for installation src_general_data = Pkg.SourceGeneralData(AddOnProduct.src_id) current_url = Ops.get_string(src_general_data, "url", "") Builtins.y2milestone("Only one product available - skipping dialog") prod = Ops.get(products, 0, {}) if !AddOnProduct.CheckProductDependencies( [Ops.get_string(prod, "name", "")] ) Pkg.ResolvableRemove(Ops.get_string(prod, "name", ""), :product) # message popup Popup.Message( _("Dependencies of the add-on product cannot be fulfilled.") ) AddOnProduct.last_ret = :back Builtins.y2milestone("ProductSelect Dialog ret: %1", :back) return :back end # check whether the product is already available on some media - it is similar as below found_source = -1 Builtins.foreach(all_products) do |p| if Ops.get_string(p, "name", "") == Ops.get_string(prod, "name", "") && Ops.get_string(p, "version", "") == Ops.get_string(prod, "version", "") && Ops.get_integer(p, "media", -2) != Ops.get_integer(prod, "media", -3) Builtins.y2milestone( "Product %1 already available on media %2", p, Ops.get_integer(p, "media", -1) ) found_source = Ops.get_integer(p, "media", -1) raise Break end end if found_source != -1 Builtins.y2milestone("Deleting source %1", AddOnProduct.src_id) Pkg.SourceDelete(AddOnProduct.src_id) AddOnProduct.src_id = found_source end Pkg.ResolvableInstall(Ops.get_string(prod, "name", ""), :product) data = Pkg.SourceGeneralData(AddOnProduct.src_id) url = Ops.get_string(data, "url", "") product_dir = Ops.get_string(data, "product_dir", "") # bugzilla #304659 SetAddOnProductName(AddOnProduct.src_id) AddOnProduct.add_on_products = Builtins.add( AddOnProduct.add_on_products, { "media" => AddOnProduct.src_id, "product" => @new_addon_name != "" && @new_addon_name != nil ? @new_addon_name : Ops.get_string( prod, "display_name", Ops.get_string( prod, "short_name", Ops.get_string(prod, "name", "") ) ), "autoyast_product" => Ops.get_string(prod, "name", ""), "media_url" => url, "product_dir" => product_dir } ) if found_source == -1 && Mode.config AddOnProduct.mode_config_sources = Builtins.add( AddOnProduct.mode_config_sources, AddOnProduct.src_id ) end Builtins.y2milestone("ProductSelect Dialog ret: %1", :next) return :next end # there are more than one products on the given url Builtins.y2milestone("Running product selection dialog") ret = nil items = Builtins.maplist(products) do |product| Item( Id(Ops.get_string(product, "name", "")), Ops.get_string(product, "name", "") ) end # dialog caption title = _("Product Selection") contents = HBox( HStretch(), VBox( VStretch(), # multi selection list MultiSelectionBox(Id(:products), _("Available Products"), items), VStretch() ), HStretch() ) # help text help_text = _( "<p><b><big>Product Selection</big></b><br/>\n" + "Multiple products were found in the repository. Select the products\n" + "to install.</p>\n" ) Wizard.SetContents(title, contents, help_text, true, true) while ret == nil ret = Convert.to_symbol(UI.UserInput) if ret == :cancel || ret == :abort ret = :abort # if (Stage::initial()) # { # if (Popup::ConfirmAbort (`painless)) # break; # } # else # { # yes-no popup break if Popup.YesNo(_("Really abort add-on product installation?")) # } next end if ret == :next selected = Convert.convert( UI.QueryWidget(Id(:products), :SelectedItems), :from => "any", :to => "list <string>" ) # check whether the product is already available on some media - it is similar as above prods = Builtins.filter(products) do |p| Builtins.contains(selected, Ops.get_string(p, "name", "")) end all_found = true prod2src = {} Builtins.foreach(prods) do |prod| product_found = false Builtins.foreach(all_products) do |p| if Ops.get_string(p, "name", "") == Ops.get_string(prod, "name", "") && Ops.get_string(p, "version", "") == Ops.get_string(prod, "version", "") && Ops.get_integer(p, "media", -2) != Ops.get_integer(prod, "media", -3) product_found = true Ops.set( prod2src, Ops.get_string(prod, "name", ""), Ops.get_integer(p, "media", -3) ) raise Break end end all_found = all_found && product_found end if all_found Builtins.y2milestone("Deleting source %1", AddOnProduct.src_id) Pkg.SourceDelete(AddOnProduct.src_id) AddOnProduct.src_id = -1 end Builtins.foreach(selected) do |product| Pkg.ResolvableInstall(product, :product) end if !AddOnProduct.CheckProductDependencies(selected) Builtins.foreach(selected) do |product| Pkg.ResolvableRemove(product, :product) end # message popup Popup.Message( _( "Dependencies of the selected add-on products cannot be fulfilled." ) ) ret = nil next end data = Pkg.SourceGeneralData(AddOnProduct.src_id) url = Ops.get_string(data, "url", "") product_dir = Ops.get_string(data, "product_dir", "") Builtins.foreach(selected) do |product| src_id = AddOnProduct.src_id == -1 ? Ops.get(prod2src, product, -1) : AddOnProduct.src_id # bugzilla #304659 SetAddOnProductName(AddOnProduct.src_id) AddOnProduct.add_on_products = Builtins.add( AddOnProduct.add_on_products, { "media" => src_id, "product" => @new_addon_name != "" && @new_addon_name != nil ? @new_addon_name : product, "autoyast_prouduct" => product, "media_url" => url, "product_dir" => product_dir } ) end if AddOnProduct.src_id != -1 && Mode.config AddOnProduct.mode_config_sources = Builtins.add( AddOnProduct.mode_config_sources, AddOnProduct.src_id ) end elsif ret != :back ret = nil end end if ret == :abort Builtins.y2milestone("Deleting source %1", AddOnProduct.src_id) Pkg.SourceDelete(AddOnProduct.src_id) end AddOnProduct.last_ret = ret Builtins.y2milestone( "ProductSelect Dialog ret: %1", AddOnProduct.last_ret ) ret end |
- (Object) Read
Initialize current inst. sources
60 61 62 63 |
# File 'src/include/add-on/add-on-workflow.rb', line 60 def Read Pkg.SourceStartManager(true) :next end |
- (Object) ReadFromSystem
List of all selected repositories
Structure:
add_on_products = [
$[
"media" : 4, // ID of the source
"product_dir" : "/",
"product" : "openSUSE version XX.Y",
"autoyast_product" : "'PRODUCT' tag for AutoYaST Export",
"media_url" : "Zypp URL of the product",
],
...
]
1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 |
# File 'src/include/add-on/add-on-workflow.rb', line 1555 def ReadFromSystem AddOnProduct.add_on_products = [] product_infos = Convert.convert( GetProductInfos(), :from => "map", :to => "map <string, map>" ) if product_infos == nil || product_infos == {} Builtins.y2warning("No add-on products have been found") return true end src_id = nil Builtins.foreach(product_infos) do |index, product_desc| src_id = Ops.get_integer(product_desc, ["info", "IDs", 0], -1) if src_id == nil || src_id == -1 Builtins.y2error("Cannot get source ID from %1", product_desc) next end repo_data = Pkg.SourceGeneralData(src_id) AddOnProduct.add_on_products = Builtins.add( AddOnProduct.add_on_products, { "media" => src_id, "product_dir" => Ops.get_string(repo_data, "product_dir", "/"), "product" => Ops.get_locale( repo_data, "name", Ops.get_locale( repo_data, "alias", _("No product found in the repository.") ) ), "autoyast_product" => Ops.get_locale( product_desc, ["product", "name"], Ops.get_locale( repo_data, "name", Ops.get_locale( repo_data, "alias", _("No product found in the repository.") ) ) ), "media_url" => Pkg.SourceURL(src_id) } ) end Builtins.y2milestone("Add-Ons read: %1", AddOnProduct.add_on_products) true end |
- (Object) Redraw(enable_back, enable_next, enable_abort, back_button, next_button, abort_button)
904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 |
# File 'src/include/add-on/add-on-workflow.rb', line 904 def Redraw(enable_back, enable_next, enable_abort, , , ) Builtins.y2milestone("Called Redraw()") # main screen heading title = _("Add-On Product Installation") # Help for add-on products help = _( "<p><big><b>Add-On Product Installation</b></big><br/>\n" + "Here see all add-on products that are selected for installation.\n" + "To add a new product, click <b>Add</b>. To remove an already added one,\n" + "select it and click <b>Delete</b>.</p>" ) Builtins.y2milestone("Current products: %1", AddOnProduct.add_on_products) index = -1 items = Builtins.maplist(AddOnProduct.add_on_products) do |product| Builtins.y2milestone("%1", product) index = Ops.add(index, 1) data = {} # BNC #464162, In AytoYaST, there is no media nr. yet if Builtins.haskey(product, "media") && Ops.greater_than(Ops.get_integer(product, "media", -1), -1) data = Pkg.SourceGeneralData(Ops.get_integer(product, "media", -1)) else data = deep_copy(product) if Builtins.haskey(data, "media_url") Ops.set(data, "url", Ops.get_string(data, "media_url", "")) end end # placeholder for unknown path dir = Ops.get_locale(data, "product_dir", _("Unknown")) dir = "/" if dir == "" # table cell, %1 is URL, %2 is directory name media = Builtins.sformat( _("%1, Directory: %2"), Ops.get_locale( # placeholder for unknown URL data, "url", _("Unknown") ), dir ) Item( Id(index), Ops.get_string( # sformat (_("Product %1"), product["product"]:"") product, "product", "" ), media ) end contents = VBox( Table( Id(:summary), Header( # table header _("Product"), # table header _("Media") ), items ), Left( HBox( PushButton(Id(:add), Label.AddButton), PushButton(Id(:delete), Label.DeleteButton), HStretch() ) ) ) Wizard.SetContentsButtons(title, contents, help, , ) Wizard.SetAbortButton(:abort, ) # Disable next button according to settings Wizard.DisableNextButton if !enable_next # If back or abort buttons should not be enabled, hide them # -> [Cancel] [OK] dialog Wizard.HideBackButton if !enable_back Wizard.HideAbortButton if !enable_abort Wizard.SetTitleIcon("yast-addon") # disable delete button if no items listed # bug #203809 UI.ChangeWidget(Id(:delete), :Enabled, false) if Builtins.size(items) == 0 nil end |
- (Object) RedrawAddOnsOverviewTable
1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 |
# File 'src/include/add-on/add-on-workflow.rb', line 1614 def RedrawAddOnsOverviewTable products = [] product_infos = Convert.convert( GetProductInfos(), :from => "map", :to => "map <string, map>" ) product_infos = {} if product_infos == nil Builtins.y2milestone("Currently used add-ons: %1", product_infos) Builtins.foreach(product_infos) do |index, product_desc| products = Builtins.add( products, Item( Id(Builtins.sformat("product_%1", index)), Ops.get_locale( product_desc, ["product", "display_name"], Ops.get_locale( product_desc, ["product", "name"], _("Unknown product") ) ), Ops.get_locale(product_desc, ["info", "URLs", 0], _("Unknown URL")) ) ) end UI.ChangeWidget(Id("list_of_addons"), :Items, products) AdjustInfoWidget() # Nothing to do delete when there are no product listed UI.ChangeWidget( Id(:delete), :Enabled, Ops.greater_than(Builtins.size(products), 0) ) nil end |
- (Boolean) RemoveProductWithDependencies
Removes the currently selected Add-On
1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 |
# File 'src/include/add-on/add-on-workflow.rb', line 1681 def RemoveProductWithDependencies pi = ReturnCurrentlySelectedProductInfo() if pi == nil || pi == {} Builtins.y2error("Cannot remove unknown product") return nil end product_name = Ops.get_locale( pi, ["product", "display_name"], Ops.get_locale(pi, ["product", "name"], _("Unknown product")) ) if !Popup.AnyQuestion( Label.WarningMsg, Builtins.sformat( _( "Deleting the add-on product %1 may result in removing all the packages\n" + "installed from this add-on.\n" + "\n" + "Are sure you want to delete it?" ), product_name ), Label.DeleteButton, Label.CancelButton, :focus_no ) Builtins.y2milestone("Deleting '%1' canceled", product_name) return nil end # TRANSLATORS: busy popup message UI.OpenDialog(Label(_("Removing product dependencies..."))) # OpenDialog-BusyMessage src_ids = Ops.get_list(pi, ["info", "IDs"], []) # Temporary definitions pack_ret = false package_string = "" # ["pkg1 version release arch", "pkg2 version release arch", ... ] installed_packages = Builtins.maplist(Pkg.GetPackages(:installed, false)) do |inst_package| Builtins.regexpsub( inst_package, "(.*) (.*) (.*) (.*)", "\\1 \\2-\\3 \\4" ) end # y2milestone ("Installed packages: %1", installed_packages); # All packages from Add-On / Repository packages_from_repo = Pkg.ResolvableProperties("", :package, "") packages_from_repo = Builtins.filter(packages_from_repo) do |one_package| # Package is not at the repositories to be deleted if !Builtins.contains( src_ids, Ops.get_integer(one_package, "source", -1) ) next false end # Package *is* at the repository to delete # "name version-release arch", "version" already contains a release package_string = Builtins.sformat( "%1 %2 %3", Ops.get_string(one_package, "name", ""), Ops.get_string(one_package, "version", ""), Ops.get_string(one_package, "arch", "") ) # The very same package (which is avaliable at the source) is also installed Builtins.contains(installed_packages, package_string) end Builtins.y2milestone( "%1 packages installed from repository", Builtins.size(packages_from_repo) ) # Removing selected product, whatever it means # It might remove several products when they use the same name if (Ops.get_symbol(pi, ["product", "status"], :unknown) == :installed || Ops.get_symbol(pi, ["product", "status"], :unknown) == :selected) && Ops.get_string(pi, ["product", "name"], "") != "" Builtins.y2milestone( "Removing product: '%1'", Ops.get_string(pi, ["product", "name"], "") ) Pkg.ResolvableRemove( Ops.get_string(pi, ["product", "name"], ""), :product ) else Builtins.y2milestone("Product is neither `installed nor `selected") end # Removing repositories of the selected product Builtins.y2milestone( "Removing repositories: %1, url(s): %2", src_ids, Ops.get_list(pi, ["info", "URLs"], []) ) Builtins.foreach(src_ids) do |src_id| if Ops.greater_than(src_id, -1) Builtins.y2milestone("Removing repository ID: %1", src_id) Pkg.SourceDelete(src_id) else Builtins.y2milestone("Product doesn't have any repository in use") end end # The product repository is already removed, checking all installed packages # All available packages available_packages = Builtins.maplist(Pkg.GetPackages(:available, false)) do |inst_package| Builtins.regexpsub( inst_package, "(.*) (.*) (.*) (.*)", "\\1 \\2-\\3 \\4" ) end available_package_names = Pkg.GetPackages(:available, true) Builtins.y2milestone( "%1 available packages", Builtins.size(available_package_names) ) status_changed = false # check all packages installed from the just removed repository Builtins.foreach(packages_from_repo) do |one_package| # "name version-release arch", "version" already contains a release package_string = Builtins.sformat( "%1 %2 %3", Ops.get_string(one_package, "name", ""), Ops.get_string(one_package, "version", ""), Ops.get_string(one_package, "arch", "") ) # installed package is not available anymore if !Builtins.contains(available_packages, package_string) status_changed = true # it must be removed Builtins.y2milestone("Removing: %1", package_string) Pkg.ResolvableRemove( Ops.get_string(one_package, "name", "~~~"), :package ) # but if another version is present, select if for installation if Builtins.contains( available_package_names, Ops.get_string(one_package, "name", "~~~") ) Builtins.y2milestone( "Installing another version of %1", Ops.get_string(one_package, "name", "") ) Pkg.ResolvableInstall( Ops.get_string(one_package, "name", ""), :package ) end end end # See OpenDialog-BusyMessage UI.CloseDialog return RunPackageSelector() if status_changed true end |
- (Object) RemoveSelectedAddOn(selected)
1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 |
# File 'src/include/add-on/add-on-workflow.rb', line 1000 def RemoveSelectedAddOn(selected) Builtins.y2milestone( "Deleting %1 %2", selected, Ops.get(AddOnProduct.add_on_products, selected) ) # remove whole media if the product is the only one on the media media = Ops.get_integer( AddOnProduct.add_on_products, [selected, "media"], -1 ) med_count = Builtins.size(Builtins.filter(AddOnProduct.add_on_products) do |prod| Ops.get_integer(prod, "media", -1) == media end) if med_count == 1 Builtins.y2milestone("Deleting source %1", media) Pkg.SourceDelete(media) end # remove the selected record Ops.set(AddOnProduct.add_on_products, selected, nil) AddOnProduct.add_on_products = Builtins.filter( AddOnProduct.add_on_products ) { |prod| prod != nil } # Remove product from add-ons AddOnProduct.Disintegrate(media) # remove product from list of product to register (FATE #301312) AddOnProduct.RemoveRegistrationFlag(media) nil end |
- (Object) ReturnCurrentlySelectedProductInfo
1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 |
# File 'src/include/add-on/add-on-workflow.rb', line 1304 def ReturnCurrentlySelectedProductInfo if !UI.WidgetExists(Id("list_of_addons")) Builtins.y2error("No such widget: %1", "list_of_addons") return nil end item_id = Convert.to_string( UI.QueryWidget(Id("list_of_addons"), :CurrentItem) ) # no items return nil if item_id == nil if !Builtins.regexpmatch(item_id, "product_") Builtins.y2error("Wrong product ID '%1'", item_id) return nil end item_id = Builtins.substring(item_id, 8) Ops.get_map(@product_infos, item_id, {}) end |
- (Object) RunAddOnMainDialog(enable_back, enable_next, enable_abort, back_button, next_button, abort_button, confirm_abort)
bugzilla #221377 the original control file is stored as /control.xml the other (added) control files are under the /tmp/$yast_tmp/control_files/ directory as $srcid.xml files
bugzilla #237297 in the installation workflow - back/ next buttons in the installation proposal - cancel / accept buttons
bugzilla #449773 added enable_abort, abort_button
1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 |
# File 'src/include/add-on/add-on-workflow.rb', line 1052 def RunAddOnMainDialog(enable_back, enable_next, enable_abort, , , , confirm_abort) ret = nil not_enough_memory = Stage.initial && HasInsufficientMemory() no_addons = Builtins.size(AddOnProduct.add_on_products) == 0 # bugzilla #239630 # It might be dangerous to add more installation sources in installation # on machine with less memory # Do not report when some add-ons are already in use if not_enough_memory && !no_addons if !ContinueIfInsufficientMemory() # next time, it will be skipped too Installation.add_on_selected = false Installation.productsources_selected = false return :next end end # FATE #301928 - Saving one click # Bugzilla #893103 be consistent, so always when there is no add-on skip if no_addons Builtins.y2milestone("Skipping to media_select") ret = :skip_to_add end # Show Add-Ons table Redraw( enable_back, enable_next, enable_abort, , , ) # store the initial settings, only once WorkflowManager.SetBaseWorkflow(false) # added / removed some_addon_changed = false begin # FATE #301928 - Saving one click ret = Convert.to_symbol(UI.UserInput) unless ret == :skip_to_add # aborting if ret == :abort || ret == :cancel # User should confirm that if confirm_abort == true if Popup.ConfirmAbort(:incomplete) ret = :abort break else ret = nil end # Running system else break end # removing add-on elsif ret == :delete selected = Convert.to_integer( UI.QueryWidget(Id(:summary), :CurrentItem) ) if selected == nil # message report Report.Message(_("Select a product to delete.")) next end # bugzilla #305802 next if !Confirm.DeleteSelected # TRANSLATORS: busy message UI.OpenDialog(Label(_("Removing selected add-on..."))) RemoveSelectedAddOn(selected) some_addon_changed = true UI.CloseDialog Redraw( enable_back, enable_next, enable_abort, , , ) # adding new add-on elsif ret == :add || ret == :skip_to_add # show checkbox only first time in installation when there is no # other addons, so allow to quickly skip adding addons, otherwise # it make no sense as user explicitelly want add addon SourceDialogs.display_addon_checkbox = ret == :skip_to_add # bugzilla #293428 # Release all sources before adding a new one # because of CD/DVD + url cd:// Pkg.SourceReleaseAll # bugzilla #305788 # Use new wizard window for adding new Add-On. # Do not use "Steps" dialog. Wizard.OpenNextBackDialog Wizard.SetTitleIcon("yast-addon") ret2 = RunWizard() Wizard.CloseDialog log.info "Subworkflow result: ret2: #{ret2}" if ret2 == :next # Add-On product has been added, integrate it (change workflow, use y2update) AddOnProduct.Integrate(AddOnProduct.src_id) # check whether it requests registration (FATE #301312) AddOnProduct.PrepareForRegistration(AddOnProduct.src_id) some_addon_changed = true # do not keep first_time, otherwise summary won't be shown during installation ret = nil if ret == :skip_to_add elsif ret2 == :abort || ret2 == :cancel Builtins.y2milestone("Add-on sequence aborted") if AddOnProduct.src_id != nil Builtins.y2milestone( "Removing add-on repository: %1", AddOnProduct.src_id ) # remove the repository Pkg.SourceDelete(AddOnProduct.src_id) AddOnProduct.add_on_products = Builtins.filter( AddOnProduct.add_on_products ) do |add_on_product| Ops.get_integer(add_on_product, "media", -1) != AddOnProduct.src_id end end # properly return abort in installation ret = :abort if ret == :skip_to_add # extra handling for the global enable checkbox elsif ret == :skip_to_add ret = :back if ret2 == :back ret = :next if ret2 == :skip end Redraw( enable_back, enable_next, enable_abort, , , ) # bugzilla #293428 # Release all sources after adding a new one # because of CD/DVD + url cd:// Pkg.SourceReleaseAll end end until [:next, :back, :abort].include?(ret) Builtins.y2milestone( "Ret: %1, Some Add-on Added/Removed: %2", ret, some_addon_changed ) Builtins.y2milestone( "Registration will be requested: %1", AddOnProduct.ProcessRegistration ) # First stage installation, #247892 # installation, update or autoinstallation if Stage.initial # bugzilla #221377 AddOnProduct.ReIntegrateFromScratch if some_addon_changed end # bugzilla #293428 # Release all sources after all Add-Ons are added and merged Builtins.y2milestone("Releasing all sources...") Pkg.SourceReleaseAll # bugzilla #305788 Wizard.RestoreBackButton Wizard.RestoreAbortButton Wizard.RestoreNextButton ret end |
- (Object) RunAddOnsOverviewDialog
1910 1911 1912 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 |
# File 'src/include/add-on/add-on-workflow.rb', line 1910 def RunAddOnsOverviewDialog Builtins.y2milestone("Overview Dialog") ret = :next # to see which products are installed Pkg.PkgSolve(true) CreateAddOnsOverviewDialog() RedrawAddOnsOverviewTable() userret = nil while true userret = UI.UserInput # Abort if userret == :abort || userret == :cancel Builtins.y2warning("Aborting...") ret = :abort break # Closing elsif userret == :next || userret == :finish Builtins.y2milestone("Finishing...") ret = :next break # Addin new product elsif userret == :add Builtins.y2milestone("Using new Add-On...") RunAddProductWorkflow() if RunWizard() == :next # Something has disabled all the repositories or finished # libzypp, reload it current_repos = Pkg.SourceGetCurrent(true) if current_repos == nil || Builtins.size(current_repos) == 0 LoadLibzyppNow() end CreateAddOnsOverviewDialog() RedrawAddOnsOverviewTable() # Removing product elsif userret == :delete Builtins.y2milestone("Removing selected product...") rpwd = RemoveProductWithDependencies() Builtins.y2milestone("RPWD result was: %1", rpwd) # nil == user decided not to remove the product if rpwd == nil Builtins.y2milestone( "User decided not to remove the selected product" ) next # false == user decided not confirm the add-on removal # libzypp has been already changed # BNC #476417: Getting libzypp to the previous state elsif rpwd == false Builtins.y2milestone("User aborted the package manager") SetWizardWindowInProgress() # Neutralizing all resolvables (some are usually marked for removal) NeutralizeAllResolvables() Pkg.SourceFinishAll LoadLibzyppNow() # true == packages and sources have been removed else # Store sources state Pkg.SourceSaveAll end CreateAddOnsOverviewDialog() RedrawAddOnsOverviewTable() # Redrawing info widget elsif userret == "list_of_addons" AdjustInfoWidget() # Calling packager directly elsif userret == :packager Builtins.y2milestone("Calling packager...") RunPackageSelector() CreateAddOnsOverviewDialog() RedrawAddOnsOverviewTable() # Everything else else Builtins.y2error("Uknown ret: %1", userret) end end Wizard.RestoreBackButton ret end |
- (Object) RunAddProductWorkflow
1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 |
# File 'src/include/add-on/add-on-workflow.rb', line 1859 def RunAddProductWorkflow WFM.CallFunction("inst_addon_update_sources", []) AddOnProduct.DoInstall # Write only when there are some changes Write() Pkg.SourceReleaseAll nil end |
- (Object) RunAutorunWizard
889 890 891 892 893 894 895 896 897 898 899 900 |
# File 'src/include/add-on/add-on-workflow.rb', line 889 def RunAutorunWizard aliases = { "catalog" => lambda { CatalogSelect() }, "product" => lambda do ProductSelect() end } sequence = { "ws_start" => "catalog", "catalog" => { :abort => :abort, :next => "product", :finish => :next }, "product" => { :abort => :abort, :next => :next, :finish => :next } } Sequencer.Run(aliases, sequence) end |
- (Object) RunPackageSelector
1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 |
# File 'src/include/add-on/add-on-workflow.rb', line 1659 def RunPackageSelector solve_ret = Pkg.PkgSolve(false) Builtins.y2milestone("Calling Solve() returned: %1", solve_ret) result = PackagesUI.RunPackageSelector({ "mode" => :summaryMode }) return false if result != :accept Wizard.OpenNextBackDialog Builtins.y2milestone("Calling inst_rpmcopy") WFM.call("inst_rpmcopy") Builtins.y2milestone("Done") Wizard.CloseDialog true end |
- (Object) RunWizard
850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 |
# File 'src/include/add-on/add-on-workflow.rb', line 850 def RunWizard aliases = { "media" => lambda { MediaSelect() }, "install_product" => lambda { InstallProduct() }, "check_compliance" => lambda { CheckCompliance() } } sequence = { "ws_start" => "media", "media" => { :abort => :abort, :next => "check_compliance", :finish => "check_compliance", :skip => :skip }, # "catalog" : $[ # `abort : `abort, # `next : "product", # `finish : `next, # ], # "product" : $[ # `abort : `abort, # `next : `next, # `finish : `next, # ], "check_compliance" => { :abort => :abort, :next => "install_product" }, "install_product" => { :abort => :abort, :next => :next, :finish => :next } } Sequencer.Run(aliases, sequence) end |
- (Object) SetAddOnProductName(src_id)
bugzilla #304659 Sets the Add-On's product name
275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 |
# File 'src/include/add-on/add-on-workflow.rb', line 275 def SetAddOnProductName(src_id) @new_addon_name = "" if src_id == nil Builtins.y2error("Cannot set name, no ID!") return end @new_addon_name = SourceDialogs.GetRepoName # no name to change to if @new_addon_name == nil || @new_addon_name == "" Builtins.y2milestone("No special name set") return end new_addon_set = [{ "SrcId" => src_id, "name" => @new_addon_name }] result = Pkg.SourceEditSet(new_addon_set) Builtins.y2milestone( "Adjusting Add-On: %1 returned: %2", new_addon_set, result ) # do not use it next time SourceDialogs.SetRepoName("") nil end |
- (Object) SetWizardWindowInProgress
Cleanup UI - Prepare it for progress callbacks
1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 |
# File 'src/include/add-on/add-on-workflow.rb', line 1871 def SetWizardWindowInProgress Wizard.SetContents( _("Add-On Products"), Label(_("Initializing...")), _("<p>Initializing add-on products...</p>"), false, false ) Wizard.SetTitleIcon("yast-addon") nil end |
- (Object) Write
Write (changed) inst. sources
66 67 68 69 |
# File 'src/include/add-on/add-on-workflow.rb', line 66 def Write Pkg.SourceSaveAll :next end |