]> git.deb.at Git - deb/packages.git/commitdiff
Do not fork out for touch(1) anymore
authorPeter Palfrader <peter@palfrader.org>
Sat, 7 Feb 2009 22:15:55 +0000 (22:15 +0000)
committerFrank Lichtenheld <frank@lichtenheld.de>
Sat, 7 Feb 2009 23:06:12 +0000 (00:06 +0100)
Signed-off-by: Frank Lichtenheld <frank@lichtenheld.de>
bin/extract_files

index 3bfc5599e4bcce91d11a45c1b5facb2a2468b81f..b5753b252e113fff955cbab1d53762af5c6077e7 100755 (executable)
@@ -130,6 +130,13 @@ sub add_log {
     $$log .= localtime().": @_\n";
 }
 
+sub touch {
+    my $filename = shift;
+    sysopen(H, $filename, O_WRONLY|O_NONBLOCK|O_CREAT) or return undef;
+    close(H);
+    return 1;
+}
+
 ##################################################
 # PACKAGE HANDLING (UNPACKING/CLEANUP)
 
@@ -228,7 +235,7 @@ sub to_update {
     if ($config_data->{structure} == PKGPOOL) {
        my $dir = "$target/".pkg_pool_directory( $pkg_data );
        if (!$force && -d $dir && -f "$dir/log") {
-           (system( "touch", "$dir/log" ) == 0)
+           touch("$dir/log")
                or do_warning( "touch of $dir/log failed" );
            return 0;
        } else {
@@ -302,7 +309,7 @@ sub extract_copyright_to_pkgpool {
                    or add_log( $log, "symlink generation failed" );
            } else {
                add_log( $log, "give up on $bin_pkg" );
-               (system( "touch", "$tgt.ERROR" ) == 0)
+               touch("$tgt.ERROR")
                    or add_log( $log, "even the touch of $tgt.ERROR failed :(" );
            }
        }
@@ -327,7 +334,7 @@ sub extract_copyright_to_pkgpool {
        }
        unless (-e $src_tgt) {
            add_log( $log, "give up" );
-           (system( "touch", "$src_tgt.ERROR" ) == 0) or
+           touch("$src_tgt.ERROR") or
                add_log( $log, "even the touch of $src_tgt.ERROR failed :(" );
        }
     }