diff options
author | Nitin A Kamble <nitin.a.kamble@intel.com> | 2010-12-07 08:49:26 -0800 |
---|---|---|
committer | Richard Purdie <rpurdie@linux.intel.com> | 2010-12-16 15:53:09 +0000 |
commit | a7f3a2fa27a0453bf7d0d6858b7527a3192c000c (patch) | |
tree | 169be03ce4e84a657f0621d33f481fc48d28921a | |
parent | f528a1530ebb1834ee9034805b0ace34ac6a530f (diff) | |
download | poky-a7f3a2fa27a0453bf7d0d6858b7527a3192c000c.tar.gz |
patch-2.6.1: implement new patch recipe with latest upstream
This commit patch recipe based on latest upstream code. This is GPLv3
code based. Hence the earlier patch-2.5.9 recipe is left intact for
GPLv2 needs.
Patches from 2.5.9 patch recipe are rebased to this new recipe except
these exceptions:
unified-reject-files.diff: dropped
This patch implements this new parameter:
" --unified-reject-files Create unified reject files."
And upstream has implemented very similar parameter like this:
" --reject-format=FORMAT Create 'context' or 'unified' rejects."
Hence this patch is dropped for the 2.6.1 recipe.
global-reject-file.diff: rebased
This patch is rebased to the newer upstream codebase.
install.patch: dropped
Newer upstream code now includes code form this patch.
debian.patch: dropped
This huge (10k lines) patch was specific for 2.5.9 version of GPLv2 patch.
Signed-off-by: Nitin A Kamble <nitin.a.kamble@intel.com>
-rw-r--r-- | meta/recipes-devtools/patch/patch-2.6.1/global-reject-file.diff | 186 | ||||
-rw-r--r-- | meta/recipes-devtools/patch/patch_2.6.1.bb | 14 |
2 files changed, 200 insertions, 0 deletions
diff --git a/meta/recipes-devtools/patch/patch-2.6.1/global-reject-file.diff b/meta/recipes-devtools/patch/patch-2.6.1/global-reject-file.diff new file mode 100644 index 0000000000..cd3a600f3a --- /dev/null +++ b/meta/recipes-devtools/patch/patch-2.6.1/global-reject-file.diff | |||
@@ -0,0 +1,186 @@ | |||
1 | Index: patch-2.6.1/patch.man | ||
2 | =================================================================== | ||
3 | --- patch-2.6.1.orig/patch.man | ||
4 | +++ patch-2.6.1/patch.man | ||
5 | @@ -557,6 +557,15 @@ instead of the default | ||
6 | .B \&.rej | ||
7 | file. When \fIrejectfile\fP is \fB\-\fP, discard rejects. | ||
8 | .TP | ||
9 | +.BI \*=global\-reject\-file= rejectfile | ||
10 | +Put all rejects into | ||
11 | +.I rejectfile | ||
12 | +instead of creating separate reject files for all files that have rejects. The | ||
13 | +.I rejectfile | ||
14 | +will contain headers that identify which file each reject refers to. Note that | ||
15 | +the global reject file is created even if \-\-dry\-run is specified (while | ||
16 | +non-global reject files will only be created without \-\-dry\-run). | ||
17 | +.TP | ||
18 | \fB\-R\fP or \fB\*=reverse\fP | ||
19 | Assume that this patch was created with the old and new files swapped. | ||
20 | (Yes, I'm afraid that does happen occasionally, human nature being what it | ||
21 | Index: patch-2.6.1/src/patch.c | ||
22 | =================================================================== | ||
23 | --- patch-2.6.1.orig/src/patch.c | ||
24 | +++ patch-2.6.1/src/patch.c | ||
25 | @@ -52,6 +52,7 @@ static void reinitialize_almost_everythi | ||
26 | static void remove_if_needed (char const *, int volatile *); | ||
27 | static void usage (FILE *, int) __attribute__((noreturn)); | ||
28 | |||
29 | +static void reject_header (const char *filename); | ||
30 | static void abort_hunk (bool, bool); | ||
31 | static void abort_hunk_context (bool, bool); | ||
32 | static void abort_hunk_unified (bool, bool); | ||
33 | @@ -83,6 +84,7 @@ static int Argc; | ||
34 | static char * const *Argv; | ||
35 | |||
36 | static FILE *rejfp; /* reject file pointer */ | ||
37 | +static char *global_reject; | ||
38 | |||
39 | static char const *patchname; | ||
40 | static char *rejname; | ||
41 | @@ -159,6 +161,10 @@ main (int argc, char **argv) | ||
42 | /* Make sure we clean up in case of disaster. */ | ||
43 | set_signals (false); | ||
44 | |||
45 | + /* initialize global reject file */ | ||
46 | + if (global_reject) | ||
47 | + init_reject (); | ||
48 | + | ||
49 | if (inname && outfile) | ||
50 | { | ||
51 | apply_empty_patch = true; | ||
52 | @@ -205,8 +211,9 @@ main (int argc, char **argv) | ||
53 | init_output (TMPOUTNAME, exclusive, &outstate); | ||
54 | } | ||
55 | |||
56 | - /* initialize reject file */ | ||
57 | - init_reject (); | ||
58 | + /* initialize per-patch reject file */ | ||
59 | + if (!global_reject) | ||
60 | + init_reject (); | ||
61 | |||
62 | /* find out where all the lines are */ | ||
63 | if (!skip_rest_of_patch) | ||
64 | @@ -295,6 +302,8 @@ main (int argc, char **argv) | ||
65 | || ! where | ||
66 | || ! apply_hunk (&outstate, where)))) | ||
67 | { | ||
68 | + if (!failed) | ||
69 | + reject_header(outname); | ||
70 | abort_hunk (! failed, reverse); | ||
71 | failed++; | ||
72 | if (verbosity == VERBOSE || | ||
73 | @@ -331,7 +340,8 @@ main (int argc, char **argv) | ||
74 | fclose (outstate.ofp); | ||
75 | outstate.ofp = 0; | ||
76 | } | ||
77 | - fclose (rejfp); | ||
78 | + if (!global_reject) | ||
79 | + fclose (rejfp); | ||
80 | continue; | ||
81 | } | ||
82 | |||
83 | @@ -430,13 +440,13 @@ main (int argc, char **argv) | ||
84 | struct stat rejst; | ||
85 | |||
86 | if ((failed && fstat (fileno (rejfp), &rejst) != 0) | ||
87 | - || fclose (rejfp) != 0) | ||
88 | + || (( !global_reject && fclose (rejfp) != 0))) | ||
89 | write_fatal (); | ||
90 | if (failed) { | ||
91 | somefailed = true; | ||
92 | say ("%d out of %d hunk%s %s", failed, hunk, "s" + (hunk == 1), | ||
93 | skip_rest_of_patch ? "ignored" : "FAILED"); | ||
94 | - if (outname && (! rejname || strcmp (rejname, "-") != 0)) { | ||
95 | + if (!global_reject && outname && (! rejname || strcmp (rejname, "-") != 0)) { | ||
96 | char *rej = rejname; | ||
97 | if (!rejname) { | ||
98 | /* FIXME: This should really be done differnely! */ | ||
99 | @@ -485,6 +495,23 @@ main (int argc, char **argv) | ||
100 | } | ||
101 | set_signals (true); | ||
102 | } | ||
103 | + if (global_reject) | ||
104 | + { | ||
105 | + struct stat rejst; | ||
106 | + | ||
107 | + if ((somefailed && fstat (fileno (rejfp), &rejst) != 0) | ||
108 | + || fclose (rejfp) != 0) | ||
109 | + write_fatal (); | ||
110 | + if (somefailed) | ||
111 | + { | ||
112 | + say (" -- saving rejects to file %s\n", quotearg (global_reject)); | ||
113 | + /*if (! dry_run) | ||
114 | + {*/ | ||
115 | + move_file (TMPREJNAME, &TMPREJNAME_needs_removal, | ||
116 | + &rejst, global_reject, 0644, false); | ||
117 | + /*}*/ | ||
118 | + } | ||
119 | + } | ||
120 | if (outstate.ofp && (ferror (outstate.ofp) || fclose (outstate.ofp) != 0)) | ||
121 | write_fatal (); | ||
122 | cleanup (); | ||
123 | @@ -572,6 +599,7 @@ static struct option const longopts[] = | ||
124 | {"posix", no_argument, NULL, CHAR_MAX + 7}, | ||
125 | {"quoting-style", required_argument, NULL, CHAR_MAX + 8}, | ||
126 | {"reject-format", required_argument, NULL, CHAR_MAX + 9}, | ||
127 | + {"global-reject-file", required_argument, NULL, CHAR_MAX + 10}, | ||
128 | {NULL, no_argument, NULL, 0} | ||
129 | }; | ||
130 | |||
131 | @@ -636,6 +664,7 @@ static char const *const option_help[] = | ||
132 | "", | ||
133 | " -d DIR --directory=DIR Change the working directory to DIR first.", | ||
134 | " --reject-format=FORMAT Create 'context' or 'unified' rejects.", | ||
135 | +" --global-reject-file=file Put all rejects into one file.", | ||
136 | " --binary Read and write data in binary mode.", | ||
137 | "", | ||
138 | " -v --version Output version info.", | ||
139 | @@ -852,6 +881,9 @@ get_some_switches (void) | ||
140 | else | ||
141 | usage (stderr, 2); | ||
142 | break; | ||
143 | + case CHAR_MAX + 10: | ||
144 | + global_reject = savestr (optarg); | ||
145 | + break; | ||
146 | default: | ||
147 | usage (stderr, 2); | ||
148 | } | ||
149 | @@ -1512,6 +1544,37 @@ similar (register char const *a, registe | ||
150 | } | ||
151 | } | ||
152 | |||
153 | + static char * | ||
154 | +format_timestamp (char timebuf[37], bool which) | ||
155 | +{ | ||
156 | + time_t ts = pch_timestamp(which); | ||
157 | + if (ts != -1) | ||
158 | + { | ||
159 | + struct tm *tm = localtime(&ts); | ||
160 | + strftime(timebuf, 37, "\t%Y-%m-%d %H:%M:%S.000000000 %z", tm); | ||
161 | + } | ||
162 | + else | ||
163 | + timebuf[0] = 0; | ||
164 | + return timebuf; | ||
165 | +} | ||
166 | + | ||
167 | +/* Write a header in a reject file that combines multiple hunks. */ | ||
168 | +static void | ||
169 | +reject_header (const char *outname) | ||
170 | +{ | ||
171 | + char timebuf0[37], timebuf1[37]; | ||
172 | + if (!global_reject) | ||
173 | + return; | ||
174 | + if (diff_type == UNI_DIFF) | ||
175 | + fprintf(rejfp, "--- %s.orig%s\n+++ %s%s\n", | ||
176 | + outname, format_timestamp(timebuf0, reverse), | ||
177 | + outname, format_timestamp(timebuf1, !reverse)); | ||
178 | + else | ||
179 | + fprintf(rejfp, "*** %s.orig%s\n--- %s%s\n", | ||
180 | + outname, format_timestamp(timebuf0, reverse), | ||
181 | + outname, format_timestamp(timebuf1, !reverse)); | ||
182 | +} | ||
183 | + | ||
184 | /* Make a temporary file. */ | ||
185 | |||
186 | #if HAVE_MKTEMP && ! HAVE_DECL_MKTEMP && ! defined mktemp | ||
diff --git a/meta/recipes-devtools/patch/patch_2.6.1.bb b/meta/recipes-devtools/patch/patch_2.6.1.bb new file mode 100644 index 0000000000..8d07a7811c --- /dev/null +++ b/meta/recipes-devtools/patch/patch_2.6.1.bb | |||
@@ -0,0 +1,14 @@ | |||
1 | require patch.inc | ||
2 | LICENSE = "GPLv3" | ||
3 | |||
4 | PR = "r0" | ||
5 | |||
6 | SRC_URI += " file://global-reject-file.diff;patch=1 " | ||
7 | |||
8 | SRC_URI[md5sum] = "d758eb96d3f75047efc004a720d33daf" | ||
9 | SRC_URI[sha256sum] = "ecb5c6469d732bcf01d6ec1afe9e64f1668caba5bfdb103c28d7f537ba3cdb8a" | ||
10 | |||
11 | LIC_FILES_CHKSUM = "file://COPYING;md5=d32239bcb673463ab874e80d47fae504" | ||
12 | |||
13 | acpaths = "-I ${S}/gl/m4 -I ${S}/m4 " | ||
14 | |||