Class: Yast::ImageInstallationClass
- Inherits:
-
Module
- Object
- Module
- Yast::ImageInstallationClass
- Includes:
- Logger
- Defined in:
- ../../src/modules/ImageInstallation.rb
Instance Method Summary (collapse)
-
- (Boolean) _DeployImage(id, target, temporary)
Deploy an image (internal implementation).
-
- (Object) AddImage(name, file, type)
Add information about new image.
- - (Object) AdjustProgressLayout(id, steps_total, label)
-
- (Boolean) CleanTemporaryImage(id, target)
UnDeploy an image temporarily (if possible, only for the FS images).
-
- (Object) CountMatchingPatterns(imageset_patterns, installed_patterns)
Returns the intersection of both patterns supported by the imageset and patterns going to be installed.
- - (Object) DeployDiskImage(id, target)
-
- (Boolean) DeployFsImage(id, target)
Deploy an image of the filesystem type.
-
- (Boolean) DeployImage(id, target)
Deploy an image.
-
- (Object) DeployImages(images, target, progress)
Deploy all images.
-
- (Boolean) DeployImageTemporarily(id, target)
Deploy an image temporarily (just mount if possible).
-
- (Boolean) DeployTarImage(id, target)
Deploy an image of the filesystem type.
- - (Object) EnoughPatternsMatching(matching_patterns, patterns_in_imagesets)
-
- (Boolean) FileSystemCopy(from, to, progress_start, progress_finish)
Copy a subtree, limit to a single filesystem.
-
- (Object) FillUpImagesDetails
Loads non-mandatory details for every single selected image.
-
- (Boolean) FindImageSet(patterns)
Find a set of images which suites selected patterns.
-
- (Object) FreeInternalVariables
<– Storing and restoring states.
- - (Object) GetCurrentImageDetails
-
- (Hash <String,Hash{String => Object>}) GetCurrentImages
Returns list of currently selected images.
- - (Object) GetProgressLayoutDetails(id, details)
- - (Object) GetProgressLayoutLabel(id)
-
- (Object) ImageOrder
Order of images to be deployed.
-
- (Hash) ImagesToUse
Returns map with description which images will be used.
-
- (Object) InitRepo
Adjusts the repository for images.
- - (Object) main
-
- (Boolean) MountFsImage(id, target)
Mount an image of the filesystem type Does not integrate to the system, mounts on target.
- - (Object) PrepareOEMImage(path)
-
- (Boolean) ProceedWithSelected(one_object, one_type)
Whether the package should be additionally installed.
-
- (Object) RemoveTemporaryImage(image)
Removes the downloaded image.
-
- (Boolean) RestoreAllChanges
Restores packages statuses from 'objects_state': Selects packages for removal, installation, upgrade.
-
- (Object) selected_images
Only for checking in tests now.
- - (Object) SetCurrentImageDetails(img)
- - (Object) SetDeployTarImageProgress(tip)
- - (Object) SetDownloadTarImageProgress(tip)
- - (Object) SetOverallDeployingProgress(odp)
-
- (Object) SetRepo(repo)
Set the repository to get images from.
-
- (Object) SetStartDownloadImageProgress(sdi)
BNC #449792.
-
- (Object) StoreAllChanges
Function stores all new/requested states of all handled/supported types.
-
- (String) SwMgmtImage
Name of image containing software management metadata (if exists).
- - (Object) ThisIsADebugMode
- - (Object) TotalSize
Instance Method Details
- (Boolean) _DeployImage(id, target, temporary)
Deploy an image (internal implementation)
600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 |
# File '../../src/modules/ImageInstallation.rb', line 600 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) if type == "fs" return temporary ? MountFsImage(id, target) : DeployFsImage(id, target) elsif type == "tar" return DeployTarImage(id, target) elsif type == "raw" return DeployDiskImage(id, target) end Builtins.y2error("Unknown type of image: %1", type) false end |
- (Object) AddImage(name, file, type)
Add information about new image
213 214 215 216 217 218 219 220 221 |
# File '../../src/modules/ImageInstallation.rb', line 213 def AddImage(name, file, type) Ops.set( @_images, file, { "file" => file, "type" => type, "name" => name } ) nil end |
- (Object) AdjustProgressLayout(id, steps_total, label)
1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 |
# File '../../src/modules/ImageInstallation.rb', line 1196 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 |
- (Boolean) CleanTemporaryImage(id, target)
UnDeploy an image temporarily (if possible, only for the FS images)
642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 |
# File '../../src/modules/ImageInstallation.rb', line 642 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 |
- (Object) CountMatchingPatterns(imageset_patterns, installed_patterns)
Returns the intersection of both patterns supported by the imageset and patterns going to be installed.
776 777 778 779 780 781 782 783 784 785 786 787 788 |
# File '../../src/modules/ImageInstallation.rb', line 776 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| if Builtins.contains(imageset_patterns, one_installed_pattern) ret = Ops.add(ret, 1) end end ret end |
- (Object) DeployDiskImage(id, target)
480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 |
# File '../../src/modules/ImageInstallation.rb', line 480 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 |
- (Boolean) DeployFsImage(id, target)
Deploy an image of the filesystem type
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 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 |
# File '../../src/modules/ImageInstallation.rb', line 430 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 |
- (Boolean) DeployImage(id, target)
Deploy an image
624 625 626 627 |
# File '../../src/modules/ImageInstallation.rb', line 624 def DeployImage(id, target) Builtins.y2milestone("Deploying image %1 to %2", id, target) _DeployImage(id, target, false) end |
- (Object) DeployImages(images, target, progress)
Deploy all images
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 |
# File '../../src/modules/ImageInstallation.rb', line 728 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 if @download_image_progress != nil Pkg.CallbackProgressDownload(@download_image_progress) end # register own callback for start downloading if @start_download_handler != nil Pkg.CallbackStartDownload(@start_download_handler) end num = -1 @_current_image_from_imageset = -1 aborted = nil Builtins.foreach(images) do |img| num = Ops.add(num, 1) progress.call(num, 0) if progress != nil if !DeployImage(img, target) aborted = true Builtins.y2milestone("Aborting...") raise Break end progress.call(num, 100) if progress != nil 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 |
- (Boolean) DeployImageTemporarily(id, target)
Deploy an image temporarily (just mount if possible)
633 634 635 636 |
# File '../../src/modules/ImageInstallation.rb', line 633 def DeployImageTemporarily(id, target) Builtins.y2milestone("Temporarily delploying image %1 to %2", id, target) _DeployImage(id, target, true) end |
- (Boolean) DeployTarImage(id, target)
Deploy an image of the filesystem type
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 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 |
# File '../../src/modules/ImageInstallation.rb', line 293 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) if @tar_image_progress != nil 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 if Builtins.regexpmatch(image, ".lzma$") cmd = 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$") cmd = 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 cmd = 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)) newline = "" 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 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 == "" if @tar_image_progress != nil @tar_image_progress.call( Ops.add(Builtins.tointeger(newline), better_feeling_constant) ) end else ret = UI.PollInput if ret == :abort || ret == :cancel if Popup.ConfirmAbort(:unusable) Builtins.y2warning("Aborted!") aborted = true break end else SlideShow.HandleInput(ret) Builtins.sleep(200) end 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) if @tar_image_progress != nil RemoveTemporaryImage(image) true end |
- (Object) EnoughPatternsMatching(matching_patterns, patterns_in_imagesets)
790 791 792 793 794 795 796 797 798 799 800 801 |
# File '../../src/modules/ImageInstallation.rb', line 790 def EnoughPatternsMatching(matching_patterns, patterns_in_imagesets) if matching_patterns == nil || Ops.less_than(matching_patterns, 0) return false end if patterns_in_imagesets == nil || Ops.less_than(patterns_in_imagesets, 0) return false end # it's actually matching_patterns = patterns_in_imagesets Ops.greater_or_equal(matching_patterns, patterns_in_imagesets) end |
- (Boolean) FileSystemCopy(from, to, progress_start, progress_finish)
Copy a subtree, limit to a single filesystem
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 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 |
# File '../../src/modules/ImageInstallation.rb', line 1043 def FileSystemCopy(from, to, progress_start, progress_finish) cmd = Builtins.sformat("df -P -k %1", from) 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, "") total_mb = Ops.divide( Builtins.tointeger( Ops.get(Builtins.filter(Builtins.splitstring(total_str, " ")) do |s| s != "" end, 2, "0") ), 1024 ) # 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 = 1024 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) ) while line != nil if pid == "" if !Builtins.regexpmatch( line, Builtins.sformat( "dd bs=1048576 if=%1 of=%2", tmp_pipe1, tmp_pipe2 ) ) pid = "" else 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) 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) 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) ), 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 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 |
- (Object) FillUpImagesDetails
Loads non-mandatory details for every single selected image.
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 |
# File '../../src/modules/ImageInstallation.rb', line 662 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 read_details = XML.XMLToYCPFile(filename) if read_details == nil Builtins.y2error("Cannot parse imagesets details") 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 |
- (Boolean) FindImageSet(patterns)
Find a set of images which suites selected patterns
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 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 |
# File '../../src/modules/ImageInstallation.rb', line 813 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 image_descr = XML.XMLToYCPFile(filename) if image_descr == nil @image_installation_available = false Installation.image_installation = false Installation.image_only = false Report.Error(_("Failed to read information about installation images")) 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 if Builtins.size(imageset_archs) == 0 next true # does architecture match? else if Builtins.contains(imageset_archs, arch_short) next true else # For debugging purpose Builtins.y2milestone( "Filtered-out, Patterns: %1, Archs: %2", Ops.get_string(image, "patterns", ""), Ops.get_string(image, "archs", "") ) next false end end 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 |
- (Object) FreeInternalVariables
<– Storing and restoring states
1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 |
# File '../../src/modules/ImageInstallation.rb', line 1485 def FreeInternalVariables @last_patterns_selected = [] @_images = {} @_image_order = [] @images_details = {} @_mounted_images = [] @selected_images = {} nil end |
- (Object) GetCurrentImageDetails
591 592 593 |
# File '../../src/modules/ImageInstallation.rb', line 591 def GetCurrentImageDetails deep_copy(@_current_image) end |
- (Hash <String,Hash{String => Object>}) GetCurrentImages
Returns list of currently selected images.
Structure:
$[
"image_id":$[
"file":filename,
"type":type
], ...
]
205 206 207 |
# File '../../src/modules/ImageInstallation.rb', line 205 def GetCurrentImages deep_copy(@_images) end |
- (Object) GetProgressLayoutDetails(id, details)
1188 1189 1190 |
# File '../../src/modules/ImageInstallation.rb', line 1188 def GetProgressLayoutDetails(id, details) Ops.get_integer(@progress_layout, [id, details], 0) end |
- (Object) GetProgressLayoutLabel(id)
1192 1193 1194 |
# File '../../src/modules/ImageInstallation.rb', line 1192 def GetProgressLayoutLabel(id) Ops.get_locale(@progress_layout, [id, "label"], _("Deploying...")) end |
- (Object) ImageOrder
Order of images to be deployed
187 188 189 |
# File '../../src/modules/ImageInstallation.rb', line 187 def ImageOrder deep_copy(@_image_order) end |
- (Hash) ImagesToUse
Returns map with description which images will be used
Structure:
$[
"deploying_enabled" : boolean,
"images" : returned by GetCurrentImages()
]
1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 |
# File '../../src/modules/ImageInstallation.rb', line 1025 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 |
- (Object) InitRepo
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 |
- (Object) main
41 42 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 41 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 = 10240 @last_patterns_selected = [] @changed_by_user = false # Defines whether some installation images are available @image_installation_available = nil @debug_mode = 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 |
- (Boolean) MountFsImage(id, target)
Mount an image of the filesystem type Does not integrate to the system, mounts on target
510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 |
# File '../../src/modules/ImageInstallation.rb', line 510 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 |
- (Object) PrepareOEMImage(path)
803 804 805 806 807 808 |
# File '../../src/modules/ImageInstallation.rb', line 803 def PrepareOEMImage(path) AddImage( "OEM", path, "raw" ) @_image_order = [ path ] end |
- (Boolean) ProceedWithSelected(one_object, one_type)
Returns whether the package should be additionally installed
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 1303 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 |
# File '../../src/modules/ImageInstallation.rb', line 1272 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 = Pkg.ResolvableProperties( Ops.get_string(one_object.value, "name", "-x-"), one_type.value, Ops.get_string(one_object.value, "version", "-x-") ) if ThisIsADebugMode() Builtins.y2milestone( "Looking for %1 returned %2", one_object.value, resolvable_properties ) end # Leave only already installed (and matching the same architecture) resolvable_properties = Builtins.filter(resolvable_properties) do |one_resolvable| Ops.get_symbol(one_resolvable, "status", :unknown) == :installed && Ops.get_string(one_resolvable, "arch", "") == arch end if ThisIsADebugMode() Builtins.y2milestone("Resolvables installed: %1", resolvable_properties) end 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 |
- (Object) RemoveTemporaryImage(image)
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://).
226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 |
# File '../../src/modules/ImageInstallation.rb', line 226 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 |
- (Boolean) RestoreAllChanges
Restores packages statuses from 'objects_state': Selects packages for removal, installation, upgrade.
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 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 |
# File '../../src/modules/ImageInstallation.rb', line 1344 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) if @generic_set_progress != nil Builtins.foreach(@all_supported_types) do |one_type| resolvable_properties = Pkg.ResolvableProperties("", one_type, "") # All packages selected for installation # both `to-install and `to-upgrade (already) installed to_install = Builtins.filter(resolvable_properties) do |one_resolvable| Ops.get_symbol(one_resolvable, "status", :unknown) == :selected end @generic_set_progress.call(id, nil) if @generic_set_progress != nil # List of all packages selected for installation (just names) selected_for_installation_pkgnames = Builtins.maplist( Ops.get(@objects_state, [one_type, "install"], []) ) do |one_resolvable| Ops.get_string(one_resolvable, "name", "") end # 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" => Ops.get_string(one_resolvable, "arch", ""), "name" => Ops.get_string(one_resolvable, "name", ""), "version" => Ops.get_string(one_resolvable, "version", "") } end @generic_set_progress.call(id, nil) if @generic_set_progress != 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 Ops.get_symbol(one_resolvable, "status", :unknown) != :installed && Ops.get_symbol(one_resolvable, "status", :unknown) != :selected next end one_already_installed_resolvable = { "arch" => Ops.get_string(one_resolvable, "arch", ""), "name" => Ops.get_string(one_resolvable, "name", ""), "version" => Ops.get_string(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, Ops.get_string(one_resolvable, "name", "-x-") ) Builtins.y2milestone( "Not Removing type: %1, name: %2 version: %3", one_type, Ops.get_string(one_resolvable, "name", "-x-"), Ops.get_string(one_resolvable, "version", "-x-") ) # Package is installed or selected but should not be, remove it else Builtins.y2milestone( "Removing type: %1, name: %2 version: %3", one_type, Ops.get_string(one_resolvable, "name", "-x-"), Ops.get_string(one_resolvable, "version", "-x-") ) Pkg.ResolvableRemove( Ops.get_string(one_resolvable, "name", "-x-"), one_type ) end end end @generic_set_progress.call(id, nil) if @generic_set_progress != 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_to_install = one_to_install_ref.value one_type = one_type_ref.value end @generic_set_progress.call(id, nil) if @generic_set_progress != 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.\nSoftware manager will be opened for you to solve them manually." ) ) ret = false # BNC #Trying to solve deps. manually while true 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 |
- (Object) selected_images
Only for checking in tests now
1497 1498 1499 |
# File '../../src/modules/ImageInstallation.rb', line 1497 def selected_images @selected_images end |
- (Object) SetCurrentImageDetails(img)
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 |
# File '../../src/modules/ImageInstallation.rb', line 553 def SetCurrentImageDetails(img) img = deep_copy(img) @_current_image_from_imageset = Ops.add(@_current_image_from_imageset, 1) if Builtins.size(@images_details) == 0 Builtins.y2warning("Images details are empty") end @_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 |
- (Object) SetDeployTarImageProgress(tip)
247 248 249 250 251 252 253 |
# File '../../src/modules/ImageInstallation.rb', line 247 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 |
- (Object) SetDownloadTarImageProgress(tip)
255 256 257 258 259 260 261 262 263 264 |
# File '../../src/modules/ImageInstallation.rb', line 255 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 |
- (Object) SetOverallDeployingProgress(odp)
278 279 280 281 282 283 284 285 286 287 |
# File '../../src/modules/ImageInstallation.rb', line 278 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 |
- (Object) SetRepo(repo)
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 |
- (Object) SetStartDownloadImageProgress(sdi)
BNC #449792
267 268 269 270 271 272 273 274 275 276 |
# File '../../src/modules/ImageInstallation.rb', line 267 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 |
- (Object) StoreAllChanges
Function stores all new/requested states of all handled/supported types.
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 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 |
# File '../../src/modules/ImageInstallation.rb', line 1212 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) if @generic_set_progress != nil # 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 = Pkg.ResolvableProperties("", one_type, "") # FIXME: Store only those keys we need (arch, name, version?) Ops.set(@objects_state, one_type, {}) remove_resolvables = Builtins.filter(resolvable_properties) do |one_object| Ops.get_symbol(one_object, "status", :unknown) == :removed end Ops.set(@objects_state, [one_type, "remove"], remove_resolvables) @generic_set_progress.call(id, nil) if @generic_set_progress != nil install_resolvables = Builtins.filter(resolvable_properties) do |one_object| Ops.get_symbol(one_object, "status", :unknown) == :selected end Ops.set(@objects_state, [one_type, "install"], install_resolvables) @generic_set_progress.call(id, nil) if @generic_set_progress != nil taboo_resolvables = Builtins.filter(resolvable_properties) do |one_object| Ops.get_symbol(one_object, "status", :unknown) == :available && Ops.get_boolean(one_object, "locked", false) == true end Ops.set(@objects_state, [one_type, "taboo"], taboo_resolvables) @generic_set_progress.call(id, nil) if @generic_set_progress != nil lock_resolvables = Builtins.filter(resolvable_properties) do |one_object| Ops.get_symbol(one_object, "status", :unknown) == :installed && Ops.get_boolean(one_object, "locked", false) == true end Ops.set(@objects_state, [one_type, "lock"], lock_resolvables) @generic_set_progress.call(id, nil) if @generic_set_progress != nil end if ThisIsADebugMode() # 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| Builtins.y2milestone( "Object type: %1, New status: %2, List of objects: %3", object_type, one_status, list_of_objects ) end end end nil end |
- (String) SwMgmtImage
Name of image containing software management metadata (if exists)
181 182 183 |
# File '../../src/modules/ImageInstallation.rb', line 181 def SwMgmtImage @_metadata_image end |
- (Object) ThisIsADebugMode
167 168 169 170 171 172 173 174 175 176 177 |
# File '../../src/modules/ImageInstallation.rb', line 167 def ThisIsADebugMode if @debug_mode == nil @debug_mode = ProductFeatures.GetBooleanFeature( "globals", "debug_deploying" ) == true Builtins.y2milestone("ImageInstallation debug mode: %1", @debug_mode) end @debug_mode end |
- (Object) TotalSize
535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 |
# File '../../src/modules/ImageInstallation.rb', line 535 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"], 134217728)) end Builtins.y2milestone("Total images size: %1", sum) sum end |