summaryrefslogtreecommitdiffstats
path: root/meta/recipes-devtools/patch/patch-2.6.1/global-reject-file.diff
diff options
context:
space:
mode:
authorMarko Lindqvist <cazfi74@gmail.com>2012-12-17 09:25:40 +0200
committerRichard Purdie <richard.purdie@linuxfoundation.org>2012-12-19 17:54:53 +0000
commitb6db3f06ccfc9cdff482905061b13098ab3e3554 (patch)
tree294c219f589f747159d805a927b8cc16b80564eb /meta/recipes-devtools/patch/patch-2.6.1/global-reject-file.diff
parent9e941bbfaa4785ed5870a3ecde35191957871adb (diff)
downloadpoky-b6db3f06ccfc9cdff482905061b13098ab3e3554.tar.gz
patch: drop global-reject-file patch
global-reject-file.diff was patch ported from Debian that Debian itself has dropped as upstream now has equivalent functionality. To update users of this functionality, replace "--global-reject-file=file" with simple "--reject-file=file" which no longer overwrites reject hunks from different files. (From OE-Core rev: 1c15ffab4d68e86f1ffcfd538e1d0ab77c21cb97) Signed-off-by: Marko Lindqvist <cazfi74@gmail.com> Signed-off-by: Saul Wold <sgw@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/recipes-devtools/patch/patch-2.6.1/global-reject-file.diff')
-rw-r--r--meta/recipes-devtools/patch/patch-2.6.1/global-reject-file.diff188
1 files changed, 0 insertions, 188 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
deleted file mode 100644
index 2eaee8a243..0000000000
--- a/meta/recipes-devtools/patch/patch-2.6.1/global-reject-file.diff
+++ /dev/null
@@ -1,188 +0,0 @@
1Upstream-Status: Inappropriate [debian patch]
2
3Index: patch-2.6.1/patch.man
4===================================================================
5--- patch-2.6.1.orig/patch.man
6+++ patch-2.6.1/patch.man
7@@ -557,6 +557,15 @@ instead of the default
8 .B \&.rej
9 file. When \fIrejectfile\fP is \fB\-\fP, discard rejects.
10 .TP
11+.BI \*=global\-reject\-file= rejectfile
12+Put all rejects into
13+.I rejectfile
14+instead of creating separate reject files for all files that have rejects. The
15+.I rejectfile
16+will contain headers that identify which file each reject refers to. Note that
17+the global reject file is created even if \-\-dry\-run is specified (while
18+non-global reject files will only be created without \-\-dry\-run).
19+.TP
20 \fB\-R\fP or \fB\*=reverse\fP
21 Assume that this patch was created with the old and new files swapped.
22 (Yes, I'm afraid that does happen occasionally, human nature being what it
23Index: patch-2.6.1/src/patch.c
24===================================================================
25--- patch-2.6.1.orig/src/patch.c
26+++ patch-2.6.1/src/patch.c
27@@ -52,6 +52,7 @@ static void reinitialize_almost_everythi
28 static void remove_if_needed (char const *, int volatile *);
29 static void usage (FILE *, int) __attribute__((noreturn));
30
31+static void reject_header (const char *filename);
32 static void abort_hunk (bool, bool);
33 static void abort_hunk_context (bool, bool);
34 static void abort_hunk_unified (bool, bool);
35@@ -83,6 +84,7 @@ static int Argc;
36 static char * const *Argv;
37
38 static FILE *rejfp; /* reject file pointer */
39+static char *global_reject;
40
41 static char const *patchname;
42 static char *rejname;
43@@ -159,6 +161,10 @@ main (int argc, char **argv)
44 /* Make sure we clean up in case of disaster. */
45 set_signals (false);
46
47+ /* initialize global reject file */
48+ if (global_reject)
49+ init_reject ();
50+
51 if (inname && outfile)
52 {
53 apply_empty_patch = true;
54@@ -205,8 +211,9 @@ main (int argc, char **argv)
55 init_output (TMPOUTNAME, exclusive, &outstate);
56 }
57
58- /* initialize reject file */
59- init_reject ();
60+ /* initialize per-patch reject file */
61+ if (!global_reject)
62+ init_reject ();
63
64 /* find out where all the lines are */
65 if (!skip_rest_of_patch)
66@@ -295,6 +302,8 @@ main (int argc, char **argv)
67 || ! where
68 || ! apply_hunk (&outstate, where))))
69 {
70+ if (!failed)
71+ reject_header(outname);
72 abort_hunk (! failed, reverse);
73 failed++;
74 if (verbosity == VERBOSE ||
75@@ -331,7 +340,8 @@ main (int argc, char **argv)
76 fclose (outstate.ofp);
77 outstate.ofp = 0;
78 }
79- fclose (rejfp);
80+ if (!global_reject)
81+ fclose (rejfp);
82 continue;
83 }
84
85@@ -430,13 +440,13 @@ main (int argc, char **argv)
86 struct stat rejst;
87
88 if ((failed && fstat (fileno (rejfp), &rejst) != 0)
89- || fclose (rejfp) != 0)
90+ || (( !global_reject && fclose (rejfp) != 0)))
91 write_fatal ();
92 if (failed) {
93 somefailed = true;
94 say ("%d out of %d hunk%s %s", failed, hunk, "s" + (hunk == 1),
95 skip_rest_of_patch ? "ignored" : "FAILED");
96- if (outname && (! rejname || strcmp (rejname, "-") != 0)) {
97+ if (!global_reject && outname && (! rejname || strcmp (rejname, "-") != 0)) {
98 char *rej = rejname;
99 if (!rejname) {
100 /* FIXME: This should really be done differnely! */
101@@ -485,6 +495,23 @@ main (int argc, char **argv)
102 }
103 set_signals (true);
104 }
105+ if (global_reject)
106+ {
107+ struct stat rejst;
108+
109+ if ((somefailed && fstat (fileno (rejfp), &rejst) != 0)
110+ || fclose (rejfp) != 0)
111+ write_fatal ();
112+ if (somefailed)
113+ {
114+ say (" -- saving rejects to file %s\n", quotearg (global_reject));
115+ /*if (! dry_run)
116+ {*/
117+ move_file (TMPREJNAME, &TMPREJNAME_needs_removal,
118+ &rejst, global_reject, 0644, false);
119+ /*}*/
120+ }
121+ }
122 if (outstate.ofp && (ferror (outstate.ofp) || fclose (outstate.ofp) != 0))
123 write_fatal ();
124 cleanup ();
125@@ -572,6 +599,7 @@ static struct option const longopts[] =
126 {"posix", no_argument, NULL, CHAR_MAX + 7},
127 {"quoting-style", required_argument, NULL, CHAR_MAX + 8},
128 {"reject-format", required_argument, NULL, CHAR_MAX + 9},
129+ {"global-reject-file", required_argument, NULL, CHAR_MAX + 10},
130 {NULL, no_argument, NULL, 0}
131 };
132
133@@ -636,6 +664,7 @@ static char const *const option_help[] =
134 "",
135 " -d DIR --directory=DIR Change the working directory to DIR first.",
136 " --reject-format=FORMAT Create 'context' or 'unified' rejects.",
137+" --global-reject-file=file Put all rejects into one file.",
138 " --binary Read and write data in binary mode.",
139 "",
140 " -v --version Output version info.",
141@@ -852,6 +881,9 @@ get_some_switches (void)
142 else
143 usage (stderr, 2);
144 break;
145+ case CHAR_MAX + 10:
146+ global_reject = savestr (optarg);
147+ break;
148 default:
149 usage (stderr, 2);
150 }
151@@ -1512,6 +1544,37 @@ similar (register char const *a, registe
152 }
153 }
154
155+ static char *
156+format_timestamp (char timebuf[37], bool which)
157+{
158+ time_t ts = pch_timestamp(which);
159+ if (ts != -1)
160+ {
161+ struct tm *tm = localtime(&ts);
162+ strftime(timebuf, 37, "\t%Y-%m-%d %H:%M:%S.000000000 %z", tm);
163+ }
164+ else
165+ timebuf[0] = 0;
166+ return timebuf;
167+}
168+
169+/* Write a header in a reject file that combines multiple hunks. */
170+static void
171+reject_header (const char *outname)
172+{
173+ char timebuf0[37], timebuf1[37];
174+ if (!global_reject)
175+ return;
176+ if (diff_type == UNI_DIFF)
177+ fprintf(rejfp, "--- %s.orig%s\n+++ %s%s\n",
178+ outname, format_timestamp(timebuf0, reverse),
179+ outname, format_timestamp(timebuf1, !reverse));
180+ else
181+ fprintf(rejfp, "*** %s.orig%s\n--- %s%s\n",
182+ outname, format_timestamp(timebuf0, reverse),
183+ outname, format_timestamp(timebuf1, !reverse));
184+}
185+
186 /* Make a temporary file. */
187
188 #if HAVE_MKTEMP && ! HAVE_DECL_MKTEMP && ! defined mktemp