Author: locilka Date: Tue Oct 30 09:53:19 2007 New Revision: 41630 URL: http://svn.opensuse.org/viewcvs/yast?rev=41630&view=rev Log: - Fixed several issues around creating the archive (#332663). - 2.16.0 Modified: trunk/backup/VERSION trunk/backup/package/yast2-backup.changes trunk/backup/src/backup_get_packages.ycp trunk/backup/src/functions.ycp trunk/backup/src/scripts/backup_archive.pl trunk/backup/src/scripts/backup_search.pl trunk/backup/src/ui.ycp Modified: trunk/backup/VERSION URL: http://svn.opensuse.org/viewcvs/yast/trunk/backup/VERSION?rev=41630&r1=41629&r2=41630&view=diff ============================================================================== --- trunk/backup/VERSION (original) +++ trunk/backup/VERSION Tue Oct 30 09:53:19 2007 @@ -1 +1 @@ -2.15.4 +2.16.0 Modified: trunk/backup/package/yast2-backup.changes URL: http://svn.opensuse.org/viewcvs/yast/trunk/backup/package/yast2-backup.changes?rev=41630&r1=41629&r2=41630&view=diff ============================================================================== --- trunk/backup/package/yast2-backup.changes (original) +++ trunk/backup/package/yast2-backup.changes Tue Oct 30 09:53:19 2007 @@ -1,4 +1,10 @@ ------------------------------------------------------------------- +Tue Oct 30 09:51:56 CET 2007 - locilka@suse.cz + +- Fixed several issues around creating the archive (#332663). +- 2.16.0 + +------------------------------------------------------------------- Wed Jul 4 11:13:22 CEST 2007 - locilka@suse.cz - Restart and/or enable cron service if needed for changed/added Modified: trunk/backup/src/backup_get_packages.ycp URL: http://svn.opensuse.org/viewcvs/yast/trunk/backup/src/backup_get_packages.ycp?rev=41630&r1=41629&r2=41630&view=diff ============================================================================== --- trunk/backup/src/backup_get_packages.ycp (original) +++ trunk/backup/src/backup_get_packages.ycp Tue Oct 30 09:53:19 2007 @@ -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); } Modified: trunk/backup/src/functions.ycp URL: http://svn.opensuse.org/viewcvs/yast/trunk/backup/src/functions.ycp?rev=41630&r1=41629&r2=41630&view=diff ============================================================================== --- trunk/backup/src/functions.ycp (original) +++ trunk/backup/src/functions.ycp Tue Oct 30 09:53:19 2007 @@ -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); } } } Modified: trunk/backup/src/scripts/backup_archive.pl URL: http://svn.opensuse.org/viewcvs/yast/trunk/backup/src/scripts/backup_archive.pl?rev=41630&r1=41629&r2=41630&view=diff ============================================================================== --- trunk/backup/src/scripts/backup_archive.pl (original) +++ trunk/backup/src/scripts/backup_archive.pl Tue Oct 30 09:53:19 2007 @@ -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,10 +649,20 @@ 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); } Modified: trunk/backup/src/scripts/backup_search.pl URL: http://svn.opensuse.org/viewcvs/yast/trunk/backup/src/scripts/backup_search.pl?rev=41630&r1=41629&r2=41630&view=diff ============================================================================== --- trunk/backup/src/scripts/backup_search.pl (original) +++ trunk/backup/src/scripts/backup_search.pl Tue Oct 30 09:53:19 2007 @@ -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,9 +395,17 @@ # 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; @@ -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"; } } } Modified: trunk/backup/src/ui.ycp URL: http://svn.opensuse.org/viewcvs/yast/trunk/backup/src/ui.ycp?rev=41630&r1=41629&r2=41630&view=diff ============================================================================== --- trunk/backup/src/ui.ycp (original) +++ trunk/backup/src/ui.ycp Tue Oct 30 09:53:19 2007 @@ -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,7 +2171,15 @@ 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"), @@ -2179,12 +2187,12 @@ `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); -- To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org For additional commands, e-mail: yast-commit+help@opensuse.org