Class: Yast::ImageInstallationClass
- Inherits:
-
Module
- Object
- Module
- Yast::ImageInstallationClass
- Includes:
- Logger
- Defined in:
- src/modules/ImageInstallation.rb
Constant Summary collapse
- IMAGE_COMPRESS_RATIO =
3.6
- MEGABYTE =
2**20
Instance Attribute Summary collapse
-
#selected_images ⇒ Object
readonly
Only for checking in tests now.
Instance Method Summary collapse
-
#_DeployImage(id, target, temporary) ⇒ Boolean
Deploy an image (internal implementation).
-
#AddImage(name, file, type) ⇒ Object
Add information about new image.
- #AdjustProgressLayout(id, steps_total, label) ⇒ Object
- #calculate_fs_size(mountpoint) ⇒ Object
-
#CleanTemporaryImage(id, target) ⇒ Boolean
UnDeploy an image temporarily (if possible, only for the FS images).
-
#CountMatchingPatterns(imageset_patterns, installed_patterns) ⇒ Object
Returns the intersection of both patterns supported by the imageset and patterns going to be installed.
- #DeployDiskImage(id, target) ⇒ Object
-
#DeployFsImage(id, target) ⇒ Boolean
Deploy an image of the filesystem type.
-
#DeployImage(id, target) ⇒ Boolean
Deploy an image.
-
#DeployImages(images, target, progress) ⇒ Object
Deploy all images.
-
#DeployImageTemporarily(id, target) ⇒ Boolean
Deploy an image temporarily (just mount if possible).
-
#DeployTarImage(id, target) ⇒ Boolean
Deploy an image of the filesystem type.
- #EnoughPatternsMatching(matching_patterns, patterns_in_imagesets) ⇒ Object
-
#FileSystemCopy(from, to, progress_start, progress_finish) ⇒ Boolean
Copy a subtree, limit to a single filesystem.
-
#FillUpImagesDetails ⇒ Object
Loads non-mandatory details for every single selected image.
-
#FindImageSet(patterns) ⇒ Boolean
Find a set of images which suites selected patterns.
-
#FreeInternalVariables ⇒ Object
<-- Storing and restoring states.
- #GetCurrentImageDetails ⇒ Object
-
#GetCurrentImages ⇒ Hash <String,Hash{String => Object>}
Returns list of currently selected images.
- #GetProgressLayoutDetails(id, details) ⇒ Object
- #GetProgressLayoutLabel(id) ⇒ Object
-
#ImageOrder ⇒ Object
Order of images to be deployed.
-
#ImagesToUse ⇒ Hash
Returns map with description which images will be used.
-
#InitRepo ⇒ Object
Adjusts the repository for images.
- #main ⇒ Object
-
#MountFsImage(id, target) ⇒ Boolean
Mount an image of the filesystem type Does not integrate to the system, mounts on target.
- #PrepareOEMImage(path) ⇒ Object
-
#ProceedWithSelected(one_object, one_type) ⇒ Boolean
Whether the package should be additionally installed.
-
#RemoveTemporaryImage(image) ⇒ Object
Removes the downloaded image.
-
#RestoreAllChanges ⇒ Boolean
Restores packages statuses from 'objects_state': Selects packages for removal, installation and upgrade.
- #SetCurrentImageDetails(img) ⇒ Object
- #SetDeployTarImageProgress(tip) ⇒ Object
- #SetDownloadTarImageProgress(tip) ⇒ Object
- #SetOverallDeployingProgress(odp) ⇒ Object
-
#SetRepo(repo) ⇒ Object
Set the repository to get images from.
-
#SetStartDownloadImageProgress(sdi) ⇒ Object
BNC #449792.
-
#StoreAllChanges ⇒ Object
Function stores all new/requested states of all handled/supported types.
- #TotalSize ⇒ Object
Instance Attribute Details
#selected_images ⇒ Object (readonly)
Only for checking in tests now
1456 1457 1458 |
# File 'src/modules/ImageInstallation.rb', line 1456 def selected_images @selected_images end |
Instance Method Details
#_DeployImage(id, target, temporary) ⇒ Boolean
Deploy an image (internal implementation)
578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 |
# File 'src/modules/ImageInstallation.rb', line 578 def _DeployImage(id, target, temporary) img = Ops.get(@_images, id, {}) Builtins.y2error("Image %1 does not exist", id) if img == {} type = Ops.get_string(img, "type", "") SetCurrentImageDetails(img) case type when "fs" temporary ? MountFsImage(id, target) : DeployFsImage(id, target) when "tar" DeployTarImage(id, target) when "raw" DeployDiskImage(id, target) else Builtins.y2error("Unknown type of image: %1", type) false end end |
#AddImage(name, file, type) ⇒ Object
Add information about new image
195 196 197 198 199 200 201 202 203 |
# File 'src/modules/ImageInstallation.rb', line 195 def AddImage(name, file, type) Ops.set( @_images, file, "file" => file, "type" => type, "name" => name ) nil end |
#AdjustProgressLayout(id, steps_total, label) ⇒ Object
1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 |
# File 'src/modules/ImageInstallation.rb', line 1172 def AdjustProgressLayout(id, steps_total, label) if !Builtins.haskey(@progress_layout, id) Builtins.y2error("Unknown key: %1", id) return end Ops.set(@progress_layout, [id, "label"], label) Ops.set(@progress_layout, [id, "steps_total"], steps_total) nil end |
#calculate_fs_size(mountpoint) ⇒ Object
1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 |
# File 'src/modules/ImageInstallation.rb', line 1005 def calculate_fs_size(mountpoint) cmd = Builtins.sformat("df -P -k %1", mountpoint) Builtins.y2milestone("Executing %1", cmd) out = Convert.to_map(SCR.Execute(path(".target.bash_output"), cmd)) Builtins.y2milestone("Output: %1", out) total_str = Ops.get_string(out, "stdout", "") total_str = Ops.get(Builtins.splitstring(total_str, "\n"), 1, "") Ops.divide( Builtins.tointeger( Ops.get(Builtins.filter(Builtins.splitstring(total_str, " ")) do |s| s != "" end, 2, "0") ), 1024 ) end |
#CleanTemporaryImage(id, target) ⇒ Boolean
UnDeploy an image temporarily (if possible, only for the FS images)
621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 |
# File 'src/modules/ImageInstallation.rb', line 621 def CleanTemporaryImage(id, target) Builtins.y2milestone( "UnDelploying temporary image %1 from %2", id, target ) if Ops.get_string(@_images, [id, "type"], "") == "fs" cmd = Builtins.sformat("umount %1", target) out = Convert.to_map(SCR.Execute(path(".target.bash_output"), cmd)) Builtins.y2milestone("Executing %1 returned %2", cmd, out) return Ops.get_integer(out, "exit", -1) == 0 end Builtins.y2milestone( "Cannot undeploy image of type %1", Ops.get_string(@_images, [id, "type"], "") ) true end |
#CountMatchingPatterns(imageset_patterns, installed_patterns) ⇒ Object
Returns the intersection of both patterns supported by the imageset and patterns going to be installed.
753 754 755 756 757 758 759 760 761 762 763 |
# File 'src/modules/ImageInstallation.rb', line 753 def CountMatchingPatterns(imageset_patterns, installed_patterns) imageset_patterns = deep_copy(imageset_patterns) installed_patterns = deep_copy(installed_patterns) ret = 0 Builtins.foreach(installed_patterns) do |one_installed_pattern| ret = Ops.add(ret, 1) if Builtins.contains(imageset_patterns, one_installed_pattern) end ret end |
#DeployDiskImage(id, target) ⇒ Object
460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 |
# File 'src/modules/ImageInstallation.rb', line 460 def DeployDiskImage(id, target) InitRepo() file = Ops.get_string(@_images, [id, "file"], "") Builtins.y2milestone("Deploying disk image %1 (%2) on %3", id, file, target) file = Builtins.sformat("%1/%2", @_image_path, file) # BNC #409927 # Checking files for signatures image = Pkg.SourceProvideDigestedFile(@_repo, 1, file, false) if image.nil? Builtins.y2error("File %1 not found on media", file) return false end Builtins.y2milestone("Copying the image") cmd = Builtins.sformat("dd bs=1048576 if=%1 of=%2", image, target) # 1MB of block size out = SCR.Execute(path(".target.bash_output"), cmd) Builtins.y2milestone("Executing %1 returned %2", cmd, out) RemoveTemporaryImage(image) out["exit"] == 0 end |
#DeployFsImage(id, target) ⇒ Boolean
Deploy an image of the filesystem type
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 454 455 456 457 458 |
# File 'src/modules/ImageInstallation.rb', line 410 def DeployFsImage(id, target) InitRepo() file = Ops.get_string(@_images, [id, "file"], "") Builtins.y2milestone("Deploying FS image %1 (%2) on %3", id, file, target) file = Builtins.sformat("%1/%2", @_image_path, file) # BNC #409927 # Checking files for signatures image = Pkg.SourceProvideDigestedFile(@_repo, 1, file, false) if image.nil? Builtins.y2error("File %1 not found on media", file) return false end Builtins.y2milestone("Creating temporary directory") tmpdir = Ops.add( Convert.to_string(SCR.Read(path(".target.tmpdir"))), Builtins.sformat("/images/%1", id) ) cmd = Builtins.sformat("test -d %1 || mkdir -p %1", tmpdir) out = Convert.to_map(SCR.Execute(path(".target.bash_output"), cmd)) Builtins.y2milestone("Executing %1 returned %2", cmd, out) Builtins.y2milestone("Mounting the image") cmd = Builtins.sformat("mount -o noatime,loop %1 %2", image, tmpdir) out = Convert.to_map(SCR.Execute(path(".target.bash_output"), cmd)) Builtins.y2milestone("Executing %1 returned %2", cmd, out) Builtins.y2milestone("Creating target directory") cmd = Builtins.sformat("test -d %1 || mkdir -p %1", target) out = Convert.to_map(SCR.Execute(path(".target.bash_output"), cmd)) Builtins.y2milestone("Executing %1 returned %2", cmd, out) Builtins.y2milestone("Copying contents of the image") cmd = Builtins.sformat("cp -a %1/* %2", tmpdir, target) out = Convert.to_map(SCR.Execute(path(".target.bash_output"), cmd)) Builtins.y2milestone("Executing %1 returned %2", cmd, out) Builtins.y2milestone("Unmounting image from temporary directory") cmd = Builtins.sformat("umount -d -f -l %1", tmpdir) out = Convert.to_map(SCR.Execute(path(".target.bash_output"), cmd)) Builtins.y2milestone("Executing %1 returned %2", cmd, out) RemoveTemporaryImage(image) Ops.get_integer(out, "exit", -1) == 0 # FIXME: error checking end |
#DeployImage(id, target) ⇒ Boolean
Deploy an image
603 604 605 606 |
# File 'src/modules/ImageInstallation.rb', line 603 def DeployImage(id, target) Builtins.y2milestone("Deploying image %1 to %2", id, target) _DeployImage(id, target, false) end |
#DeployImages(images, target, progress) ⇒ Object
Deploy all images
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 |
# File 'src/modules/ImageInstallation.rb', line 709 def DeployImages(images, target, progress) images = deep_copy(images) progress = deep_copy(progress) # unregister callbacks PackageCallbacks.RegisterEmptyProgressCallbacks # downloads details*.xml file FillUpImagesDetails() # register own callback for downloading Pkg.CallbackProgressDownload(@download_image_progress) if !@download_image_progress.nil? # register own callback for start downloading Pkg.CallbackStartDownload(@start_download_handler) if !@start_download_handler.nil? num = -1 @_current_image_from_imageset = -1 aborted = nil Builtins.foreach(images) do |img| num = Ops.add(num, 1) progress&.call(num, 0) if !DeployImage(img, target) aborted = true Builtins.y2milestone("Aborting...") raise Break end progress&.call(num, 100) end return nil if aborted == true # unregister downloading progress Pkg.CallbackProgressDownload(nil) if !@download_image_progress.nil? # reregister callbacks PackageCallbacks.RestorePreviousProgressCallbacks true # TODO: error checking end |
#DeployImageTemporarily(id, target) ⇒ Boolean
Deploy an image temporarily (just mount if possible)
612 613 614 615 |
# File 'src/modules/ImageInstallation.rb', line 612 def DeployImageTemporarily(id, target) Builtins.y2milestone("Temporarily delploying image %1 to %2", id, target) _DeployImage(id, target, true) end |
#DeployTarImage(id, target) ⇒ Boolean
Deploy an image of the filesystem type
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 305 306 307 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 |
# File 'src/modules/ImageInstallation.rb', line 275 def DeployTarImage(id, target) InitRepo() file = Ops.get_string(@_images, [id, "file"], "") Builtins.y2milestone("Untarring image %1 (%2) to %3", id, file, target) file = Builtins.sformat("%1/%2", @_image_path, file) # BNC #409927 # Checking files for signatures image = Pkg.SourceProvideDigestedFile(@_repo, 1, file, false) if image.nil? Builtins.y2error("File %1 not found on media", file) return false end # reset, adjust labels, etc. @tar_image_progress&.call(0) Builtins.y2milestone("Creating target directory") cmd = Builtins.sformat("test -d %1 || mkdir -p %1", target) out = Convert.to_map(SCR.Execute(path(".target.bash_output"), cmd)) Builtins.y2milestone("Executing %1 returned %2", cmd, out) if Ops.get_integer(out, "exit", -1) != 0 Builtins.y2error("no directory to extract into, aborting") return false end Builtins.y2milestone("Untarring the image") # lzma cmd = if Builtins.regexpmatch(image, ".lzma$") Builtins.sformat( "lzmadec < '%1' | tar --numeric-owner --totals --checkpoint=%3 --record-size=%4 " \ "-C '%2' -xf -", String.Quote(image), String.Quote(target), @_checkpoint, @_record_size ) # xzdec # BNC #476079 elsif Builtins.regexpmatch(image, ".xz$") Builtins.sformat( "xzdec < '%1' | tar --numeric-owner --totals --checkpoint=%3 --record-size=%4 " \ "-C '%2' -xf -", String.Quote(image), String.Quote(target), @_checkpoint, @_record_size ) # bzip2, gzip else Builtins.sformat( "tar --numeric-owner --checkpoint=%3 --record-size=%4 --totals -C '%2' -xf '%1'", String.Quote(image), String.Quote(target), @_checkpoint, @_record_size ) end Builtins.y2milestone("Calling: %1", cmd) pid = Convert.to_integer(SCR.Execute(path(".process.start_shell"), cmd)) read_checkpoint_str = "^tar: Read checkpoint ([0123456789]+)$" # Otherwise it will never make 100% better_feeling_constant = @_checkpoint ret = nil aborted = false while SCR.Read(path(".process.running"), pid) == true newline = Convert.to_string( SCR.Read(path(".process.read_line_stderr"), pid) ) if newline.nil? ret = UI.PollInput if [:abort, :cancel].include?(ret) if Popup.ConfirmAbort(:unusable) Builtins.y2warning("Aborted!") aborted = true break end else SlideShow.HandleInput(ret) Builtins.sleep(200) end else if !Builtins.regexpmatch(newline, read_checkpoint_str) Builtins.y2milestone("Deploying image: %1", newline) next end newline = Builtins.regexpsub(newline, read_checkpoint_str, "\\1") next if newline.nil? || newline == "" @tar_image_progress&.call( Ops.add(Builtins.tointeger(newline), better_feeling_constant) ) end end # BNC #456337 # Checking the exit code (0 = OK, nil = still running, 'else' = error) exitcode = Convert.to_integer(SCR.Read(path(".process.status"), pid)) if !exitcode.nil? && exitcode != 0 Builtins.y2milestone( "Deploying has failed, exit code was: %1, stderr: %2", exitcode, SCR.Read(path(".process.read_stderr"), pid) ) aborted = true end Builtins.y2milestone("Finished") return false if aborted # adjust labels etc. @tar_image_progress&.call(100) RemoveTemporaryImage(image) true end |
#EnoughPatternsMatching(matching_patterns, patterns_in_imagesets) ⇒ Object
765 766 767 768 769 770 771 772 |
# File 'src/modules/ImageInstallation.rb', line 765 def EnoughPatternsMatching(matching_patterns, patterns_in_imagesets) return false if matching_patterns.nil? || Ops.less_than(matching_patterns, 0) return false if patterns_in_imagesets.nil? || Ops.less_than(patterns_in_imagesets, 0) # it's actually matching_patterns = patterns_in_imagesets Ops.greater_or_equal(matching_patterns, patterns_in_imagesets) end |
#FileSystemCopy(from, to, progress_start, progress_finish) ⇒ Boolean
Copy a subtree, limit to a single filesystem
1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 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 |
# File 'src/modules/ImageInstallation.rb', line 1026 def FileSystemCopy(from, to, progress_start, progress_finish) total_mb = if from == "/" # root is a merge of two filesystems, df returns only one part for / calculate_fs_size("/read-write") + calculate_fs_size("/read-only") else 0 end total_mb = calculate_fs_size(from) if total_mb == 0 # Using df-based progress estimation, is rather faster # may be less precise # see bnc#555288 # string cmd = sformat ("du -x -B 1048576 -s %1", from); # y2milestone ("Executing %1", cmd); # map out = (map)SCR::Execute (.target.bash_output, cmd); # y2milestone ("Output: %1", out); # string total_str = out["stdout"]:""; # integer total_mb = tointeger (total_str); total_mb = (total_mb * IMAGE_COMPRESS_RATIO).to_i # compression ratio - rough estimate total_mb = 4096 if total_mb == 0 # should be big enough tmp_pipe1 = Ops.add( Convert.to_string(SCR.Read(path(".target.tmpdir"))), "/system_clone_fifo_1" ) tmp_pipe2 = Ops.add( Convert.to_string(SCR.Read(path(".target.tmpdir"))), "/system_clone_fifo_2" ) # FIXME: this does not copy pipes in filesystem (usually not an issue) cmd = Builtins.sformat( "mkfifo %3 ;\n" \ "\t mkfifo %4 ;\n" \ "\t tar -C %1 --hard-dereference --numeric-owner -cSf %3 --one-file-system . &\n" \ "\t dd bs=1048576 if=%3 of=%4 >&2 &\n" \ "\t jobs -l >&2;\n" \ "\t tar -C %2 --numeric-owner -xSf %4", from, to, tmp_pipe1, tmp_pipe2 ) Builtins.y2milestone("Executing %1", cmd) process = Convert.to_integer( SCR.Execute(path(".process.start_shell"), cmd, {}) ) pid = "" while Convert.to_boolean(SCR.Read(path(".process.running"), process)) done = nil line = Convert.to_string( SCR.Read(path(".process.read_line_stderr"), process) ) until line.nil? if pid == "" if Builtins.regexpmatch( line, Builtins.sformat( "dd bs=1048576 if=%1 of=%2", tmp_pipe1, tmp_pipe2 ) ) pid = Builtins.regexpsub(line, "([0-9]+) [^ 0-9]+ +dd", "\\1") Builtins.y2milestone("DD's pid: %1", pid) # sleep in order not to kill -USR1 to dd too early, otherwise it finishes Builtins.sleep(5000) else pid = "" end elsif Builtins.regexpmatch(line, "^[0-9]+ ") done = Builtins.regexpsub(line, "^([0-9]+) ", "\\1") end Builtins.y2debug("Done: %1", done) line = Convert.to_string( SCR.Read(path(".process.read_line_stderr"), process) ) end if pid != "" cmd = Builtins.sformat("/bin/kill -USR1 %1", pid) Builtins.y2debug("Executing %1", cmd) SCR.Execute(path(".target.bash"), cmd) end Builtins.sleep(300) next if done.nil? progress = Ops.add( progress_start, Ops.divide( Ops.divide( Ops.divide( Ops.multiply( Ops.subtract(progress_finish, progress_start), Builtins.tointeger(done) / MEGABYTE # count megabytes ), total_mb ), 1024 ), 1024 ) ) Builtins.y2debug("Setting progress to %1", progress) SlideShow.StageProgress(progress, nil) SlideShow.SubProgress( Ops.divide( Ops.divide( Ops.divide( Ops.multiply( Ops.subtract(progress_finish, progress_start), Builtins.tointeger(done) ), total_mb ), 1024 ), 1024 ), nil ) end copy_result = Convert.to_integer( SCR.Read(path(".process.status"), process) ) Builtins.y2milestone("Result: %1", copy_result) SCR.Execute(path(".target.remove"), tmp_pipe1) SCR.Execute(path(".target.remove"), tmp_pipe2) cmd = Builtins.sformat( "chown --reference=%1 %2; chmod --reference=%1 %2", from, to ) Builtins.y2milestone("Executing %1", cmd) out = Convert.to_map(SCR.Execute(path(".target.bash_output"), cmd)) Builtins.y2milestone("Result: %1", out) Ops.get_integer(out, "exit", -1) == 0 && copy_result == 0 end |
#FillUpImagesDetails ⇒ Object
Loads non-mandatory details for every single selected image.
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 |
# File 'src/modules/ImageInstallation.rb', line 641 def FillUpImagesDetails InitRepo() # bnc #439104 if @_repo.nil? Builtins.y2warning("No images-repository defined") return true end # ppc (covers also ppc64), i386, x86_64 ... filename = nil possible_files = [ Builtins.sformat("%1/details-%2.xml", @_image_path, Arch.arch_short), Builtins.sformat("%1/details.xml", @_image_path) ] Builtins.foreach(possible_files) do |try_file| # BNC #409927 # Checking files for signatures filename = Pkg.SourceProvideDigestedFile(@_repo, 1, try_file, true) if !filename.nil? && filename != "" Builtins.y2milestone( "Using details file: %1 (%2)", filename, try_file ) raise Break end end if filename.nil? Builtins.y2milestone("No image installation details found") return false end begin read_details = XML.XMLToYCPFile(filename) rescue XMLDeserializationError => e Builtins.y2error("Cannot parse imagesets details. #{e.inspect}") return false end if !Builtins.haskey(read_details, "details") Builtins.y2warning("No images details in details.xml") return false end @images_details = {} Builtins.foreach(Ops.get_list(read_details, "details", [])) do |image_detail| file = Ops.get_string(image_detail, "file", "") next if file.nil? || file == "" files = Builtins.tointeger(Ops.get_string(image_detail, "files", "0")) isize = Builtins.tointeger(Ops.get_string(image_detail, "size", "0")) Ops.set(@images_details, file, "files" => files, "size" => isize) end # FIXME: y2debug Builtins.y2milestone("Details: %1", @images_details) true end |
#FindImageSet(patterns) ⇒ Boolean
Find a set of images which suites selected patterns
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 840 841 842 843 844 845 846 847 848 849 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 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 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 |
# File 'src/modules/ImageInstallation.rb', line 784 def FindImageSet(patterns) patterns = deep_copy(patterns) InitRepo() # reset all data @_images = {} @_image_order = [] @_metadata_image = "" # checking whether images are supported # BNC #409927 # Checking files for signatures filename = Pkg.SourceProvideDigestedFile( @_repo, 1, Builtins.sformat("%1/images.xml", @_image_path), false ) if filename.nil? @image_installation_available = false Installation.image_installation = false Installation.image_only = false Builtins.y2milestone("Image list for installation not found") return true end begin image_descr = XML.XMLToYCPFile(filename) rescue RuntimeError => e @image_installation_available = false Installation.image_installation = false Installation.image_only = false Report.Error(_("Failed to read information about installation images")) log.error "xml failed to read #{e.inspect}" return false end # images are supported # bnc #492745: Do not offer images if there are none @image_installation_available = true image_sets = Ops.get_list(image_descr, "image_sets", []) Builtins.y2debug("Image set descriptions: %1", image_sets) result = {} # more patterns could match at once # as we can't merge the meta image, only one can be selected possible_patterns = {} matching_patterns = {} patterns_in_imagesets = {} # ppc (covers also ppc64), i386, x86_64 ... arch_short = Arch.arch_short Builtins.y2milestone("Current architecture is: %1", arch_short) # filter out imagesets for another architecture image_sets = Builtins.filter(image_sets) do |image| imageset_archs = Builtins.splitstring( Ops.get_string(image, "archs", ""), " ," ) # no architecture defined == noarch next true if Builtins.size(imageset_archs) == 0 # does architecture match? next true if Builtins.contains(imageset_archs, arch_short) # For debugging purpose Builtins.y2milestone( "Filtered-out, Patterns: %1, Archs: %2", Ops.get_string(image, "patterns", ""), Ops.get_string(image, "archs", "") ) false end # trying to find all matching patterns Builtins.foreach(image_sets) do |image| pattern = image["patterns"] imageset_patterns = Builtins.splitstring(pattern, ", ") Ops.set( patterns_in_imagesets, pattern, Builtins.size(imageset_patterns) ) # no image-pattern defined, matches all patterns if Builtins.size(imageset_patterns) == 0 Ops.set(possible_patterns, pattern, image) # image-patterns matches to patterns got as parameter else Ops.set( matching_patterns, pattern, CountMatchingPatterns(imageset_patterns, patterns) ) if Ops.greater_than(Ops.get(matching_patterns, pattern, 0), 0) Ops.set(possible_patterns, pattern, image) else # For debugging purpose Builtins.y2milestone( "Filtered-out, Patterns: %1, Matching: %2", Ops.get_string(image, "patterns", ""), Ops.get(matching_patterns, pattern, -1) ) end end end log.info "Matching patterns: #{possible_patterns}, sizes: #{matching_patterns}" # selecting the best imageset last_pattern = "" if Ops.greater_than(Builtins.size(possible_patterns), 0) last_number_of_matching_patterns = -1 last_pattern = "" Builtins.foreach(possible_patterns) do |pattern, image| if Ops.greater_than( Ops.get( # imageset matches more patterns than the currently best-one matching_patterns, pattern, 0 ), last_number_of_matching_patterns ) && # enough patterns matches the selected imageset EnoughPatternsMatching( Ops.get(matching_patterns, pattern, 0), Ops.get(patterns_in_imagesets, pattern, 0) ) last_number_of_matching_patterns = Ops.get( matching_patterns, pattern, 0 ) result = deep_copy(image) last_pattern = pattern end end end Builtins.y2milestone("Result: %1/%2", last_pattern, result) @selected_images = result # No matching pattern if result == {} Installation.image_installation = false Installation.image_only = false Builtins.y2milestone("No image for installation found") return true end # We've selected one Installation.image_installation = true if Builtins.haskey(result, "pkg_image") @_metadata_image = Ops.get_string(result, "pkg_image", "") else Installation.image_only = true end # Adding images one by one into the pool Builtins.foreach(Ops.get_list(result, "images", [])) do |img| # image must have unique <file>...</file> defined if Ops.get(img, "file", "") == "" Builtins.y2error("No file defined for %1", img) next end @_image_order = Builtins.add(@_image_order, Ops.get(img, "file", "")) AddImage( Ops.get(img, "name", ""), Ops.get(img, "file", ""), Ops.get(img, "type", "") ) end Builtins.y2milestone( "Image-only installation: %1", Installation.image_only ) Builtins.y2milestone("Images: %1", @_images) Builtins.y2milestone("Image installation order: %1", @_image_order) if !Installation.image_only Builtins.y2milestone( "Image with software management metadata: %1", @_metadata_image ) end true end |
#FreeInternalVariables ⇒ Object
<-- Storing and restoring states
1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 |
# File 'src/modules/ImageInstallation.rb', line 1444 def FreeInternalVariables @last_patterns_selected = [] @_images = {} @_image_order = [] @images_details = {} @_mounted_images = [] @selected_images = {} nil end |
#GetCurrentImageDetails ⇒ Object
569 570 571 |
# File 'src/modules/ImageInstallation.rb', line 569 def GetCurrentImageDetails deep_copy(@_current_image) end |
#GetCurrentImages ⇒ Hash <String,Hash{String => Object>}
Returns list of currently selected images.
Structure:
$[
"image_id":$[
"file":filename,
"type":type
], ...
]
187 188 189 |
# File 'src/modules/ImageInstallation.rb', line 187 def GetCurrentImages deep_copy(@_images) end |
#GetProgressLayoutDetails(id, details) ⇒ Object
1164 1165 1166 |
# File 'src/modules/ImageInstallation.rb', line 1164 def GetProgressLayoutDetails(id, details) Ops.get_integer(@progress_layout, [id, details], 0) end |
#GetProgressLayoutLabel(id) ⇒ Object
1168 1169 1170 |
# File 'src/modules/ImageInstallation.rb', line 1168 def GetProgressLayoutLabel(id) Ops.get_locale(@progress_layout, [id, "label"], _("Deploying...")) end |
#ImageOrder ⇒ Object
Order of images to be deployed
169 170 171 |
# File 'src/modules/ImageInstallation.rb', line 169 def ImageOrder deep_copy(@_image_order) end |
#ImagesToUse ⇒ Hash
Returns map with description which images will be used
Structure:
$[
"deploying_enabled" : boolean,
"images" : returned by GetCurrentImages()
]
993 994 995 996 997 998 999 1000 1001 1002 1003 |
# File 'src/modules/ImageInstallation.rb', line 993 def ImagesToUse ret = {} if Installation.image_installation == true ret = { "deploying_enabled" => true, "images" => GetCurrentImages() } else Ops.set(ret, "deploying_enabled", false) end deep_copy(ret) end |
#InitRepo ⇒ Object
Adjusts the repository for images
159 160 161 162 163 164 165 |
# File 'src/modules/ImageInstallation.rb', line 159 def InitRepo return if !@_repo.nil? SetRepo(Ops.get(Packages.theSources, 0, 0)) nil end |
#main ⇒ Object
43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 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 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 |
# File 'src/modules/ImageInstallation.rb', line 43 def main Yast.import "UI" Yast.import "Pkg" Yast.import "Installation" Yast.import "XML" Yast.import "Progress" Yast.import "Report" Yast.import "String" Yast.import "Arch" Yast.import "PackageCallbacks" Yast.import "Popup" Yast.import "SlideShow" Yast.import "ProductControl" Yast.import "ProductFeatures" Yast.import "Packages" Yast.import "PackagesUI" textdomain "installation" # Repository holding all images @_repo = nil # Description of all available images @_images = {} # Order of images @_image_order = [] # Image with software management metadata @_metadata_image = "" # Template for the path for an image on the media @_image_path = "/images" # List of already mounted images @_mounted_images = [] # # **Structure:** # # $[ # "image_filaname" : $[ # // size of an unpacked image in bytes # "size" : integer, # // number of files and directories in an image # "files" : integer, # ] # ] @images_details = {} # Image currently being deployed @_current_image = {} # display progress messages every NUMBERth record @_checkpoint = 400 # NUMBER of bytes per record, multiple of 512 @_record_size = 10_240 @last_patterns_selected = [] @changed_by_user = false # Defines whether some installation images are available @image_installation_available = nil @tar_image_progress = nil @download_image_progress = nil @start_download_handler = nil @generic_set_progress = nil @_current_image_from_imageset = -1 # --> Storing and restoring states # List of all handled types. # list <symbol> all_supported_types = [`product, `pattern, `language, `package, `patch]; # Zypp currently counts [ `product, `pattern, `language ] @all_supported_types = [:package, :patch] # Map that stores all the requested states of all handled/supported types. @objects_state = {} @progress_layout = { "storing_user_prefs" => { "steps_start_at" => 0, "steps_reserved" => 6 }, "deploying_images" => { "steps_start_at" => 6, "steps_reserved" => 84 }, "restoring_user_prefs" => { "steps_start_at" => 90, "steps_reserved" => 10 } } # Images selected by FindImageSet() @selected_images = {} end |
#MountFsImage(id, target) ⇒ Boolean
Mount an image of the filesystem type Does not integrate to the system, mounts on target
490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 |
# File 'src/modules/ImageInstallation.rb', line 490 def MountFsImage(id, target) InitRepo() file = Ops.get_string(@_images, [id, "file"], "") Builtins.y2milestone("Mounting image %1 (%2) on %3", id, file, target) file = Builtins.sformat("%1/%2", @_image_path, file) # BNC #409927 # Checking files for signatures image = Pkg.SourceProvideDigestedFile(@_repo, 1, file, false) if image.nil? Builtins.y2error("File %1 not found on media", file) return false end cmd = Builtins.sformat("test -d %1 || mkdir -p %1", target) out = Convert.to_map(SCR.Execute(path(".target.bash_output"), cmd)) Builtins.y2milestone("Executing %1 returned %2", cmd, out) cmd = Builtins.sformat("mount -o noatime,loop %1 %2", image, target) out = Convert.to_map(SCR.Execute(path(".target.bash_output"), cmd)) Builtins.y2milestone("Executing %1 returned %2", cmd, out) Ops.get_integer(out, "exit", -1) == 0 # FIXME: error checking # FIXME: unmounting end |
#PrepareOEMImage(path) ⇒ Object
774 775 776 777 778 779 |
# File 'src/modules/ImageInstallation.rb', line 774 def PrepareOEMImage(path) AddImage( "OEM", path, "raw" ) @_image_order = [path] end |
#ProceedWithSelected(one_object, one_type) ⇒ Boolean
Returns whether the package should be additionally installed.
1245 1246 1247 1248 1249 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 |
# File 'src/modules/ImageInstallation.rb', line 1245 def ProceedWithSelected(one_object, one_type) # This package has been selected to be installed arch = Ops.get_string(one_object.value, "arch", "") # Query for all packages of the same version resolvable_properties = Y2Packager::Resolvable.find( kind: one_type.value, name: one_object.value.name, version: one_object.value.version, status: :installed, arch: arch ) log.debug("Resolvables installed: #{resolvable_properties.map(&:name)}") ret = nil # There are some installed (matching the same arch, version, and name) if Ops.greater_than(Builtins.size(resolvable_properties), 0) Builtins.y2milestone( "Resolvable type: %1, name: %2 already installed", one_type.value, Ops.get_string(one_object.value, "name", "-x-") ) # Let's keep the installed version Pkg.ResolvableNeutral( Ops.get_string(one_object.value, "name", "-x-"), one_type.value, true ) # is already installed ret = false # They are not installed else Builtins.y2milestone( "Installing type: %1, details: %2,%3,%4", one_type.value, Ops.get_string(one_object.value, "name", ""), Ops.get_string(one_object.value, "arch", ""), Ops.get_string(one_object.value, "version", "") ) # Confirm we want to install them (they might have been added as dependencies) Pkg.ResolvableInstallArchVersion( Ops.get_string(one_object.value, "name", ""), one_type.value, Ops.get_string(one_object.value, "arch", ""), Ops.get_string(one_object.value, "version", "") ) # should be installed ret = true end ret end |
#RemoveTemporaryImage(image) ⇒ Object
Removes the downloaded image. If the file is writable, releases all sources because only libzypp knows which files are copies and which are just symlinks to sources (e.g., nfs://, smb://).
208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 |
# File 'src/modules/ImageInstallation.rb', line 208 def RemoveTemporaryImage(image) out = Convert.to_map( SCR.Execute( path(".target.bash_output"), Builtins.sformat( "test -w '%1' && echo -n writable", String.Quote(image) ) ) ) # Command has either failed or file is writable (non-empty stdout) if Ops.get_integer(out, "exit", -1) != 0 || Ops.get_string(out, "stdout", "") != "" Builtins.y2milestone("Releasing sources to remove temporary files") Pkg.SourceReleaseAll end nil end |
#RestoreAllChanges ⇒ Boolean
Restores packages statuses from 'objects_state': Selects packages for removal, installation and upgrade.
1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 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 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 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 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 |
# File 'src/modules/ImageInstallation.rb', line 1304 def RestoreAllChanges nr_steps = Ops.multiply(4, Builtins.size(@all_supported_types)) id = "restoring_user_prefs" AdjustProgressLayout(id, nr_steps, _("Restoring user preferences...")) @generic_set_progress&.call(id, 0) Builtins.foreach(@all_supported_types) do |one_type| resolvable_properties = Y2Packager::Resolvable.find(kind: one_type) # All packages selected for installation # both `to-install and `to-upgrade (already) installed to_install = Builtins.filter(resolvable_properties) do |one_resolvable| one_resolvable.status == :selected end @generic_set_progress&.call(id, nil) # List of all packages selected for installation (just names) selected_for_installation_pkgnames = Builtins.maplist( Ops.get(@objects_state, [one_type, "install"], []), &:name ) # All packages selected to be installed # [ $[ "arch" : ... , "name" : ... , "version" : ... ], ... ] selected_for_installation = Builtins.maplist( Ops.get(@objects_state, [one_type, "install"], []) ) do |one_resolvable| { "arch" => one_resolvable.arch, "name" => one_resolvable.name, "version" => one_resolvable.version } end @generic_set_progress&.call(id, nil) # Delete all packages that are installed but should not be one_already_installed_resolvable = {} Builtins.foreach(resolvable_properties) do |one_resolvable| # We are interested in the already installed resolvables only if one_resolvable.status != :installed && one_resolvable.status != :selected next end one_already_installed_resolvable = { "arch" => one_resolvable.arch, "name" => one_resolvable.name, "version" => one_resolvable.version } # Already installed resolvable but not in list of resolvables to be installed if !Builtins.contains( selected_for_installation, one_already_installed_resolvable ) # BNC #489448: Do not remove package which is installed in different version and/or arch # It will be upgraded later if Builtins.contains( selected_for_installation_pkgnames, one_resolvable.name ) Builtins.y2milestone( "Not Removing type: %1, name: %2 version: %3", one_type, one_resolvable.name, one_resolvable.version ) # Package is installed or selected but should not be, remove it else Builtins.y2milestone( "Removing type: %1, name: %2 version: %3", one_type, one_resolvable.name, one_resolvable.version ) Pkg.ResolvableRemove( one_resolvable.name, one_type ) end end end @generic_set_progress&.call(id, nil) # Install all packages that aren't yet Builtins.foreach(to_install) do |one_to_install| one_to_install_ref = arg_ref(one_to_install) one_type_ref = arg_ref(one_type) ProceedWithSelected(one_to_install_ref, one_type_ref) one_type = one_type_ref.value end @generic_set_progress&.call(id, nil) end # Free the memory @objects_state = {} # Return 'true' if YaST can solve deps. automatically if Pkg.PkgSolve(true) == true Builtins.y2milestone("Dependencies solved atomatically") return true end # Error message Report.Error( _( "Installation was unable to solve package dependencies automatically.\n" \ "Software manager will be opened for you to solve them manually." ) ) ret = false # BNC #Trying to solve deps. manually loop do Builtins.y2warning( "Cannot solve dependencies automatically, opening Packages UI" ) diaret = PackagesUI.RunPackageSelector( "enable_repo_mgr" => false, "mode" => :summaryMode ) Builtins.y2milestone("RunPackageSelector returned %1", diaret) # User didn't solve the deps manually if diaret == :cancel ret = false if Popup.ConfirmAbort(:unusable) Builtins.y2warning("User abort...") break end # Aborting not confirmed, next round next # Solved! (somehow) else ret = true break end end Builtins.y2milestone("Dependencies solved: %1", ret) ret end |
#SetCurrentImageDetails(img) ⇒ Object
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 |
# File 'src/modules/ImageInstallation.rb', line 533 def SetCurrentImageDetails(img) img = deep_copy(img) @_current_image_from_imageset = Ops.add(@_current_image_from_imageset, 1) Builtins.y2warning("Images details are empty") if Builtins.size(@images_details) == 0 @_current_image = { "file" => Ops.get_string(img, "file", ""), "name" => Ops.get_string(img, "name", ""), "size" => Ops.get( @images_details, [Ops.get_string(img, "file", ""), "size"], 0 ), "files" => Ops.get( @images_details, [Ops.get_string(img, "file", ""), "files"], 0 ), # 100% progress "max_progress" => Builtins.tointeger( Ops.divide( Ops.get( @images_details, [Ops.get_string(img, "file", ""), "size"], 0 ), @_record_size ) ), "image_nr" => @_current_image_from_imageset } nil end |
#SetDeployTarImageProgress(tip) ⇒ Object
229 230 231 232 233 234 235 |
# File 'src/modules/ImageInstallation.rb', line 229 def SetDeployTarImageProgress(tip) tip = deep_copy(tip) @tar_image_progress = deep_copy(tip) Builtins.y2milestone("New tar_image_progress: %1", @tar_image_progress) nil end |
#SetDownloadTarImageProgress(tip) ⇒ Object
237 238 239 240 241 242 243 244 245 246 |
# File 'src/modules/ImageInstallation.rb', line 237 def SetDownloadTarImageProgress(tip) tip = deep_copy(tip) @download_image_progress = deep_copy(tip) Builtins.y2milestone( "New download_image_progress: %1", @download_image_progress ) nil end |
#SetOverallDeployingProgress(odp) ⇒ Object
260 261 262 263 264 265 266 267 268 269 |
# File 'src/modules/ImageInstallation.rb', line 260 def SetOverallDeployingProgress(odp) odp = deep_copy(odp) @generic_set_progress = deep_copy(odp) Builtins.y2milestone( "New generic_set_progress: %1", @generic_set_progress ) nil end |
#SetRepo(repo) ⇒ Object
Set the repository to get images from
151 152 153 154 155 156 |
# File 'src/modules/ImageInstallation.rb', line 151 def SetRepo(repo) @_repo = repo Builtins.y2milestone("New images repo: %1", @_repo) nil end |
#SetStartDownloadImageProgress(sdi) ⇒ Object
BNC #449792
249 250 251 252 253 254 255 256 257 258 |
# File 'src/modules/ImageInstallation.rb', line 249 def SetStartDownloadImageProgress(sdi) sdi = deep_copy(sdi) @start_download_handler = deep_copy(sdi) Builtins.y2milestone( "New start_download_handler: %1", @start_download_handler ) nil end |
#StoreAllChanges ⇒ Object
Function stores all new/requested states of all handled/supported types.
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 |
# File 'src/modules/ImageInstallation.rb', line 1188 def StoreAllChanges nr_steps = Ops.multiply(4, Builtins.size(@all_supported_types)) id = "storing_user_prefs" AdjustProgressLayout(id, nr_steps, _("Storing user preferences...")) @generic_set_progress&.call(id, 0) # Query for changed state of all knwon types # 'changed' means that they were 'installed' and 'not locked' before Builtins.foreach(@all_supported_types) do |one_type| # list of $[ "name":string, "version":string, "arch":string, "source":integer, # "status":symbol, "locked":boolean ] # status is `installed, `removed, `selected or `available, source is source ID or # -1 if the resolvable is installed in the target # if status is `available and locked is true then the object is set to taboo # if status is `installed and locked is true then the object locked resolvable_properties = Y2Packager::Resolvable.find(kind: one_type) Ops.set(@objects_state, one_type, {}) remove_resolvables = Builtins.filter(resolvable_properties) do |one_object| one_object.status == :removed end Ops.set(@objects_state, [one_type, "remove"], remove_resolvables) @generic_set_progress&.call(id, nil) install_resolvables = Builtins.filter(resolvable_properties) do |one_object| one_object.status == :selected end Ops.set(@objects_state, [one_type, "install"], install_resolvables) @generic_set_progress&.call(id, nil) taboo_resolvables = Builtins.filter(resolvable_properties) do |one_object| one_object.status == :available && one_object.locked end Ops.set(@objects_state, [one_type, "taboo"], taboo_resolvables) @generic_set_progress&.call(id, nil) lock_resolvables = Builtins.filter(resolvable_properties) do |one_object| one_object.status == :installed && one_object.locked end Ops.set(@objects_state, [one_type, "lock"], lock_resolvables) @generic_set_progress&.call(id, nil) end # map <symbol, map <string, list <map> > > objects_state = $[]; Builtins.foreach(@objects_state) do |object_type, objects_status| Builtins.foreach(objects_status) do |one_status, list_of_objects| log.debug( "Object type: #{object_type}, New status: #{one_status},"\ "List of objects: #{list_of_objects}" ) end end nil end |
#TotalSize ⇒ Object
515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 |
# File 'src/modules/ImageInstallation.rb', line 515 def TotalSize sum = 0 Builtins.y2milestone( "Computing total images size from [%1], data %2", @_image_order, @images_details ) Builtins.foreach(@_image_order) do |image| # 128 MB as a fallback size # otherwise progress would not move at all sum = Ops.add(sum, Ops.get(@images_details, [image, "size"], 134_217_728)) end Builtins.y2milestone("Total images size: %1", sum) sum end |