patches/rzip-02-maintain_times.diff
author trisk
Fri, 18 Apr 2008 02:52:35 +0000
changeset 1042 d98721f05b97
permissions -rw-r--r--
2008-04-17 Albert Lee <[email protected]> * SFErzip.spec: *NEW* rzip, a compression program using extremely large windows * patches/rzip-01-makefile.diff: Install with DESTDIR and add runzip * patches/rzip-02-maintain_times.diff: Keep file times (from Debian)
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1042
d98721f05b97 2008-04-17 Albert Lee <[email protected]>
trisk
parents:
diff changeset
     1
#! /bin/sh /usr/share/dpatch/dpatch-run
d98721f05b97 2008-04-17 Albert Lee <[email protected]>
trisk
parents:
diff changeset
     2
## 10_maintain_times.dpatch by David Frey <[email protected]>
d98721f05b97 2008-04-17 Albert Lee <[email protected]>
trisk
parents:
diff changeset
     3
##
d98721f05b97 2008-04-17 Albert Lee <[email protected]>
trisk
parents:
diff changeset
     4
## All lines beginning with `## DP:' are a description of the patch.
d98721f05b97 2008-04-17 Albert Lee <[email protected]>
trisk
parents:
diff changeset
     5
## DP: Maintain modification times.
d98721f05b97 2008-04-17 Albert Lee <[email protected]>
trisk
parents:
diff changeset
     6
d98721f05b97 2008-04-17 Albert Lee <[email protected]>
trisk
parents:
diff changeset
     7
@DPATCH@
d98721f05b97 2008-04-17 Albert Lee <[email protected]>
trisk
parents:
diff changeset
     8
diff -urNad rzip-2.1~/main.c rzip-2.1/main.c
d98721f05b97 2008-04-17 Albert Lee <[email protected]>
trisk
parents:
diff changeset
     9
--- rzip-2.1~/main.c	2006-02-14 00:38:23.000000000 +0000
d98721f05b97 2008-04-17 Albert Lee <[email protected]>
trisk
parents:
diff changeset
    10
+++ rzip-2.1/main.c	2006-03-13 15:52:17.000000000 +0000
d98721f05b97 2008-04-17 Albert Lee <[email protected]>
trisk
parents:
diff changeset
    11
@@ -128,6 +128,8 @@
d98721f05b97 2008-04-17 Albert Lee <[email protected]>
trisk
parents:
diff changeset
    12
 {
d98721f05b97 2008-04-17 Albert Lee <[email protected]>
trisk
parents:
diff changeset
    13
 	int fd_in, fd_out = -1, fd_hist = -1;
d98721f05b97 2008-04-17 Albert Lee <[email protected]>
trisk
parents:
diff changeset
    14
 	off_t expected_size;
d98721f05b97 2008-04-17 Albert Lee <[email protected]>
trisk
parents:
diff changeset
    15
+	struct stat sb;
d98721f05b97 2008-04-17 Albert Lee <[email protected]>
trisk
parents:
diff changeset
    16
+	struct utimbuf utb;
d98721f05b97 2008-04-17 Albert Lee <[email protected]>
trisk
parents:
diff changeset
    17
 
d98721f05b97 2008-04-17 Albert Lee <[email protected]>
trisk
parents:
diff changeset
    18
 	if (control->outname) {
d98721f05b97 2008-04-17 Albert Lee <[email protected]>
trisk
parents:
diff changeset
    19
 		control->outfile = strdup(control->outname);
d98721f05b97 2008-04-17 Albert Lee <[email protected]>
trisk
parents:
diff changeset
    20
@@ -143,6 +145,8 @@
d98721f05b97 2008-04-17 Albert Lee <[email protected]>
trisk
parents:
diff changeset
    21
 		control->outfile[strlen(control->infile) - strlen(control->suffix)] = 0;
d98721f05b97 2008-04-17 Albert Lee <[email protected]>
trisk
parents:
diff changeset
    22
 	}
d98721f05b97 2008-04-17 Albert Lee <[email protected]>
trisk
parents:
diff changeset
    23
 
d98721f05b97 2008-04-17 Albert Lee <[email protected]>
trisk
parents:
diff changeset
    24
+	stat(control->infile,&sb);
d98721f05b97 2008-04-17 Albert Lee <[email protected]>
trisk
parents:
diff changeset
    25
+
d98721f05b97 2008-04-17 Albert Lee <[email protected]>
trisk
parents:
diff changeset
    26
 	fd_in = open(control->infile,O_RDONLY);
d98721f05b97 2008-04-17 Albert Lee <[email protected]>
trisk
parents:
diff changeset
    27
 	if (fd_in == -1) {
d98721f05b97 2008-04-17 Albert Lee <[email protected]>
trisk
parents:
diff changeset
    28
 		fatal("Failed to open %s: %s\n", 
d98721f05b97 2008-04-17 Albert Lee <[email protected]>
trisk
parents:
diff changeset
    29
@@ -190,6 +194,10 @@
d98721f05b97 2008-04-17 Albert Lee <[email protected]>
trisk
parents:
diff changeset
    30
 		}
d98721f05b97 2008-04-17 Albert Lee <[email protected]>
trisk
parents:
diff changeset
    31
 	}
d98721f05b97 2008-04-17 Albert Lee <[email protected]>
trisk
parents:
diff changeset
    32
 
d98721f05b97 2008-04-17 Albert Lee <[email protected]>
trisk
parents:
diff changeset
    33
+	utb.actime=sb.st_atime;
d98721f05b97 2008-04-17 Albert Lee <[email protected]>
trisk
parents:
diff changeset
    34
+	utb.modtime=sb.st_mtime;
d98721f05b97 2008-04-17 Albert Lee <[email protected]>
trisk
parents:
diff changeset
    35
+	utime(control->outfile,&utb);
d98721f05b97 2008-04-17 Albert Lee <[email protected]>
trisk
parents:
diff changeset
    36
+
d98721f05b97 2008-04-17 Albert Lee <[email protected]>
trisk
parents:
diff changeset
    37
 	free(control->outfile);
d98721f05b97 2008-04-17 Albert Lee <[email protected]>
trisk
parents:
diff changeset
    38
 }
d98721f05b97 2008-04-17 Albert Lee <[email protected]>
trisk
parents:
diff changeset
    39
 
d98721f05b97 2008-04-17 Albert Lee <[email protected]>
trisk
parents:
diff changeset
    40
@@ -199,6 +207,8 @@
d98721f05b97 2008-04-17 Albert Lee <[email protected]>
trisk
parents:
diff changeset
    41
 static void compress_file(struct rzip_control *control)
d98721f05b97 2008-04-17 Albert Lee <[email protected]>
trisk
parents:
diff changeset
    42
 {
d98721f05b97 2008-04-17 Albert Lee <[email protected]>
trisk
parents:
diff changeset
    43
 	int fd_in, fd_out;
d98721f05b97 2008-04-17 Albert Lee <[email protected]>
trisk
parents:
diff changeset
    44
+	struct stat sb;
d98721f05b97 2008-04-17 Albert Lee <[email protected]>
trisk
parents:
diff changeset
    45
+	struct utimbuf utb;
d98721f05b97 2008-04-17 Albert Lee <[email protected]>
trisk
parents:
diff changeset
    46
 
d98721f05b97 2008-04-17 Albert Lee <[email protected]>
trisk
parents:
diff changeset
    47
 	if (strlen(control->suffix) <= strlen(control->infile) &&
d98721f05b97 2008-04-17 Albert Lee <[email protected]>
trisk
parents:
diff changeset
    48
 	    strcmp(control->suffix, control->infile + strlen(control->infile) - strlen(control->suffix)) == 0) {
d98721f05b97 2008-04-17 Albert Lee <[email protected]>
trisk
parents:
diff changeset
    49
@@ -218,6 +228,8 @@
d98721f05b97 2008-04-17 Albert Lee <[email protected]>
trisk
parents:
diff changeset
    50
 		strcat(control->outfile, control->suffix);
d98721f05b97 2008-04-17 Albert Lee <[email protected]>
trisk
parents:
diff changeset
    51
 	}
d98721f05b97 2008-04-17 Albert Lee <[email protected]>
trisk
parents:
diff changeset
    52
 
d98721f05b97 2008-04-17 Albert Lee <[email protected]>
trisk
parents:
diff changeset
    53
+	stat(control->infile,&sb);
d98721f05b97 2008-04-17 Albert Lee <[email protected]>
trisk
parents:
diff changeset
    54
+	
d98721f05b97 2008-04-17 Albert Lee <[email protected]>
trisk
parents:
diff changeset
    55
 	fd_in = open(control->infile,O_RDONLY);
d98721f05b97 2008-04-17 Albert Lee <[email protected]>
trisk
parents:
diff changeset
    56
 	if (fd_in == -1) {
d98721f05b97 2008-04-17 Albert Lee <[email protected]>
trisk
parents:
diff changeset
    57
 		fatal("Failed to open %s: %s\n", control->infile, strerror(errno));
d98721f05b97 2008-04-17 Albert Lee <[email protected]>
trisk
parents:
diff changeset
    58
@@ -248,6 +260,10 @@
d98721f05b97 2008-04-17 Albert Lee <[email protected]>
trisk
parents:
diff changeset
    59
 		}
d98721f05b97 2008-04-17 Albert Lee <[email protected]>
trisk
parents:
diff changeset
    60
 	}
d98721f05b97 2008-04-17 Albert Lee <[email protected]>
trisk
parents:
diff changeset
    61
 
d98721f05b97 2008-04-17 Albert Lee <[email protected]>
trisk
parents:
diff changeset
    62
+	utb.actime=sb.st_atime;
d98721f05b97 2008-04-17 Albert Lee <[email protected]>
trisk
parents:
diff changeset
    63
+	utb.modtime=sb.st_mtime;
d98721f05b97 2008-04-17 Albert Lee <[email protected]>
trisk
parents:
diff changeset
    64
+	utime(control->outfile,&utb);
d98721f05b97 2008-04-17 Albert Lee <[email protected]>
trisk
parents:
diff changeset
    65
+
d98721f05b97 2008-04-17 Albert Lee <[email protected]>
trisk
parents:
diff changeset
    66
 	free(control->outfile);
d98721f05b97 2008-04-17 Albert Lee <[email protected]>
trisk
parents:
diff changeset
    67
 }
d98721f05b97 2008-04-17 Albert Lee <[email protected]>
trisk
parents:
diff changeset
    68
 
d98721f05b97 2008-04-17 Albert Lee <[email protected]>
trisk
parents:
diff changeset
    69
diff -urNad rzip-2.1~/rzip.h rzip-2.1/rzip.h
d98721f05b97 2008-04-17 Albert Lee <[email protected]>
trisk
parents:
diff changeset
    70
--- rzip-2.1~/rzip.h	2006-02-14 00:38:23.000000000 +0000
d98721f05b97 2008-04-17 Albert Lee <[email protected]>
trisk
parents:
diff changeset
    71
+++ rzip-2.1/rzip.h	2006-03-13 15:44:26.000000000 +0000
d98721f05b97 2008-04-17 Albert Lee <[email protected]>
trisk
parents:
diff changeset
    72
@@ -33,6 +33,8 @@
d98721f05b97 2008-04-17 Albert Lee <[email protected]>
trisk
parents:
diff changeset
    73
 #include <stdlib.h>
d98721f05b97 2008-04-17 Albert Lee <[email protected]>
trisk
parents:
diff changeset
    74
 #include <string.h>
d98721f05b97 2008-04-17 Albert Lee <[email protected]>
trisk
parents:
diff changeset
    75
 #include <netinet/in.h>
d98721f05b97 2008-04-17 Albert Lee <[email protected]>
trisk
parents:
diff changeset
    76
+#include <utime.h>
d98721f05b97 2008-04-17 Albert Lee <[email protected]>
trisk
parents:
diff changeset
    77
+#include <sys/stat.h>
d98721f05b97 2008-04-17 Albert Lee <[email protected]>
trisk
parents:
diff changeset
    78
 
d98721f05b97 2008-04-17 Albert Lee <[email protected]>
trisk
parents:
diff changeset
    79
 #ifdef HAVE_STRING_H
d98721f05b97 2008-04-17 Albert Lee <[email protected]>
trisk
parents:
diff changeset
    80
 #include <string.h>