Bugzilla – Attachment 181139 Details for
Bug 332663
yast-backup - tar-file
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Forgot Password
[patch]
Patch
yast2-backup-332663.diff (text/plain), 9.44 KB, created by
Lukas Ocilka
on 2007-10-30 08:50:49 UTC
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Lukas Ocilka
Created:
2007-10-30 08:50:49 UTC
Size:
9.44 KB
patch
obsolete
>Index: src/functions.ycp >=================================================================== >--- src/functions.ycp (revision 41628) >+++ src/functions.ycp (working copy) >@@ -722,22 +722,25 @@ > return []; > } > >- string cmd = sformat("%1 backup_get_packages %2", yastbin, temporary_file); >+ string cmd = sformat("%1 backup_get_packages %2 1>/dev/null 2>/dev/null", yastbin, temporary_file); > y2milestone ("Running command: '%1'", cmd); > map command = (map) SCR::Execute(.target.bash_output, cmd); > >- list <string> ret = nil; >+ list <string> ret = []; > > if (command["exit"]:nil != 0) { > y2error ("Unexpected error: %1", command); >- return []; >+ ret = []; > } else { > if (FileUtils::Exists (temporary_file)) { > ret = (list <string>) SCR::Read (.target.ycp, temporary_file); > SCR::Execute (.target.remove, temporary_file); >+ > if (ret == nil) { >- return []; >+ ret = []; > y2error ("Error while reading %1", temporary_file); >+ } else { >+ y2milestone ("backup_get_packages found %1 packages", ret); > } > } > } >Index: src/scripts/backup_archive.pl >=================================================================== >--- src/scripts/backup_archive.pl (revision 41628) >+++ src/scripts/backup_archive.pl (working copy) >@@ -23,6 +23,19 @@ > use File::Temp qw( tempdir ); > use POSIX qw( strftime ); > >+# command line options >+my $archive_name = ''; >+my $archive_type = ''; >+my $help = '0'; >+my $store_pt = '0'; >+my @ext2_parts = (); >+my $verbose = '0'; >+my $files_info = ''; >+my $comment_file = ''; >+my $complete_backup = ''; >+my $multi_volume = undef; >+my $temp_dir = '/tmp'; >+ > # return all harddisks present in system > sub harddisks($) > { >@@ -61,6 +74,9 @@ > if ($ix > 0) > { > my $dirs = substr($f, 0, $ix); >+ if ($verbose) { >+ print "Running: /bin/mkdir -p $dirs 2> /dev/null\n"; >+ } > system("/bin/mkdir -p $dirs 2> /dev/null"); # create directory with parents > } > } >@@ -115,20 +131,6 @@ > return $result; > } > >- >-# command line options >-my $archive_name = ''; >-my $archive_type = ''; >-my $help = '0'; >-my $store_pt = '0'; >-my @ext2_parts = (); >-my $verbose = '0'; >-my $files_info = ''; >-my $comment_file = ''; >-my $complete_backup = ''; >-my $multi_volume = undef; >-my $temp_dir = '/tmp'; >- > # parse command line options > GetOptions('archive-name=s' => \$archive_name, > 'archive-type=s' => \$archive_type, 'help' => \$help, >@@ -210,9 +212,16 @@ > } > > # create parent temporary directory >-system("/bin/mkdir -p $temp_dir"); >+system("/bin/mkdir -p '$temp_dir'"); >+if (! -d $temp_dir) { >+ die "Cannot create directory $temp_dir: ".$!; >+} > > my $tmp_dir_root = tempdir($temp_dir."/backup_tmp_XXXXXXXX", CLEANUP => 1); # remove directory content at exit >+system("/bin/mkdir -p '$tmp_dir_root'"); >+if (! -d $tmp_dir_root) { >+ die "Cannot create directory $tmp_dir_root: ".$!; >+} > > my $tmp_dir = $tmp_dir_root."/tmp"; > if (!mkdir($tmp_dir)) >@@ -244,7 +253,6 @@ > print OUT "info/packages_info.gz\n"; > $files_num++; > >- > # store host name > use Sys::Hostname; > my $host = hostname(); >@@ -490,9 +498,11 @@ > > if ($line =~ /^\/.+/) > { >- if (-r remove_escape($line) or -l remove_escape($line)) # output only readable files from files-info >- # symlinked files need not to be readable >- { >+ my $esc_line = remove_escape($line); >+ >+# if (-r $esc_line or -l $esc_line) # output only readable files from files-info >+# # symlinked files need not to be readable >+# { > print FILES_INFO $line."\n"; > > if (defined $opened) >@@ -504,14 +514,14 @@ > else > { > # star doesn't use escape sequences >- print PKGLIST remove_escape($line)."\n"; >+ print PKGLIST $esc_line."\n"; > } > } >- } >- else >- { >- print "/File not readable: $line\n"; >- } >+# } >+# else >+# { >+# print "/File not readable: $line\n"; >+# } > } > else > { >@@ -639,12 +649,22 @@ > close(FILES_INFO); > > # compress file packages_info (avg. ratio is ~10:1) >-while (!-e $tmp_dir.'/packages_info.gz') { >+my $wait_sec = 60; >+if (-e "$tmp_dir/packages_info") { >+ print "Gzipping $tmp_dir/packages_info\n"; > system("/usr/bin/gzip -9 $tmp_dir/packages_info"); >- warn 'Cannot create '.$tmp_dir.'/packages_info.gz: '.$!."\n"; >- sleep(15); >+ while ($wait_sec > 0 && ! -e "$tmp_dir/packages_info.gz") { >+ --$wait_sec; >+ sleep(1); >+ } >+} elsif (! -e "$tmp_dir/packages_info.gz") { >+ print ("No such file : $tmp_dir/packages_info"); > } > >+if (! -e "$tmp_dir/packages_info.gz") { >+ print 'Cannot create '.$tmp_dir.'/packages_info.gz: '.$!."\n"; >+} >+ > close(OUT); > > >@@ -671,7 +691,7 @@ > # -L <size> volume size in kiB > # -V <str> volume prefix label > >-my $tar_command = "(export LC_ALL=C; tar -c --files-from $tmp_dir/files --ignore-failed-read -C $tmp_dir_root/tmp -S"; >+my $tar_command = "(export LC_ALL=C; cd $tmp_dir_root/tmp; tar -c --files-from $tmp_dir/files --ignore-failed-read -C $tmp_dir_root/tmp -S"; > > if ($verbose) > { >@@ -781,6 +801,7 @@ > # create standard (no multi volume) archive > $tar_command .= " -f $archive_name 2> /dev/null)"; > >+ print "Tar command: $tar_command\n"; > system($tar_command); > } > >Index: src/scripts/backup_search.pl >=================================================================== >--- src/scripts/backup_search.pl (revision 41628) >+++ src/scripts/backup_search.pl (working copy) >@@ -346,6 +346,7 @@ > # uses global variable exclude_reg_comp (precompiled regular expressions) > sub PrintFoundFile($$$$$) > { >+ my ($package_name, $file_for_ycp); > my ($file, $ref_package, $widget_file, $output_files, $start_directory) = @_; > > # $widget_index <-> using the global one >@@ -394,10 +395,18 @@ > > # escaping newline characters is needed because each file > # is reported on separate line >+ >+ $file_for_ycp = $file; > >- $file =~ s/\\/\\\\/g; >- $file =~ s/\n/\\n/g; >+ $file_for_ycp =~ s/\\/\\\\/g; >+ $file_for_ycp =~ s/\n/\\n/g; >+ $file_for_ycp =~ s/\"/\\"/g; > >+ $package_name = $$ref_package; >+ $package_name =~ s/\\/\\\\/g; >+ $package_name =~ s/\n/\\n/g; >+ $package_name =~ s/\"/\\"/g; >+ > if (!$output_files) { > my $size = 0; > if ((! -d $file) && (! -l $file)) { >@@ -410,12 +419,12 @@ > > if ($widget_file ne "") > { >- print WIDGETFILE '`item(`id('.$widget_index.'), "X", "'.$file.'", "'.$$ref_package.'"),'."\n"; >- print WIDGETFILE2 '`item(`id('.$widget_index.'), " ", "'.$file.'", "'.$$ref_package.'"),'."\n"; >+ print WIDGETFILE '`item(`id('.$widget_index.'), "X", "'.$file_for_ycp.'", "'.$package_name.'"),'."\n"; >+ print WIDGETFILE2 '`item(`id('.$widget_index.'), " ", "'.$file_for_ycp.'", "'.$package_name.'"),'."\n"; > } > > if ($list_items_file ne "") { >- print LISTITEMSFILE '['.$widget_index.', "'.$file.'"],'."\n"; >+ print LISTITEMSFILE '['.$widget_index.', "'.$file_for_ycp.'"],'."\n"; > } > } > } >Index: src/ui.ycp >=================================================================== >--- src/ui.ycp (revision 41628) >+++ src/ui.ycp (working copy) >@@ -2002,7 +2002,7 @@ > > string size_str = substring(line, 0, findfirstof(line, " ")); > integer size_line = nil; >- if (size_str != nil) { >+ if (size_str != nil && size_str != "") { > size_line = tointeger(size_str); > if (size_line != nil) nopkg_size = nopkg_size + size_line; > } >@@ -2171,20 +2171,28 @@ > > integer t1 = time(); > >- list< list<any> > items = (list< list<any> >) SCR::Read(.target.ycp, (string) SCR::Read(.target.tmpdir) + "/items-list.ycp"); >+ list< list<any> > items = []; >+ string items_filename = Directory::tmpdir + "/items-list.ycp"; > >+ if (FileUtils::Exists (items_filename)) { >+ y2milestone ("Reading %1", items_filename); >+ items = (list< list<any> >) SCR::Read(.target.ycp, items_filename); >+ } else { >+ y2error ("File %1 doesn't exist!", items_filename); >+ } >+ > // dialog header > Wizard::SetContents( _("File Selection"), > `VBox( > `VSpacing(0.5), > // label text > `Left(`Label(_("Files to Back Up"))), >- `Table(`id(`table), >+ `Table ( >+ `id(`table), > `opt(`notify), > // table header > `header(" ", _("Filename"), _("Package")), >- // Items are pre-defined in the file >- (list<term>) SCR::Read(.target.ycp, (string) SCR::Read(.target.tmpdir) + "/items.ycp") >+ [] > ), > `HBox( > // push button label >@@ -2199,6 +2207,16 @@ > backup_help_file_selection(), true, true > ); > >+ // Items are pre-defined in the file >+ string items_filename_show = Directory::tmpdir + "/items.ycp"; >+ UI::ChangeWidget (`id (`table), `Items, >+ (FileUtils::Exists (items_filename_show) ? >+ (list<term>) SCR::Read (.target.ycp, items_filename_show) >+ : >+ [`item (`id("none"), ["", _("Internal error"), ""])] >+ ) >+ ); >+ > integer t2 = time(); > y2milestone("UI finished after %1 seconds", t2 - t1); > >Index: src/backup_get_packages.ycp >=================================================================== >--- src/backup_get_packages.ycp (revision 41628) >+++ src/backup_get_packages.ycp (working copy) >@@ -30,7 +30,7 @@ > > string filename = nil; > if (is(WFM::Args(0), string)) { >- string filename = (string) WFM::Args (0); >+ filename = (string) WFM::Args (0); > } else { > y2error ("Wrong parameter for script"); > return false; >@@ -67,7 +67,7 @@ > y2debug("Source %1 description: %2", source_id, source_description); > > // TODO: really compare whole maps? Have they same keys? >- if (contains(installed_products, source_description)) >+ if (source_description != nil && source_description != $[] && contains(installed_products, source_description)) > { > product_sources = add(product_sources, source_id); > }
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
Actions:
View
|
Diff
Attachments on
bug 332663
:
179498
|
179501
|
180031
|
180094
|
180480
| 181139