[Pkg-xen-devel] [PATCH 06/19] d/shuffle-binaries: Fix binary shuffling script for cross-building
Elliott Mitchell
ehem+debian at m5p.com
Sat Dec 5 02:57:55 GMT 2020
On Fri, Dec 04, 2020 at 10:04:35PM +0100, Hans van Kranenburg wrote:
> When I use git am --show-current-patch I get a big pile of crap because
> you're not using git send-email.
>
> I don't know what to do with this now.
Strong indicator of a missing patch. In this case you got 1-4, but then
missed #5 and started on #6. #5 and #6 don't modify the same lines, but
they modify lines next together and thus missing #5 kills the context
lines for #6.
Eventually you'll learn how to read patches whether you want to or not.
As such, a quick overview of the format:
--- a/debian/shuffle-binaries
+++ b/debian/shuffle-binaries
@@ -22,7 +22,7 @@ cd=/usr/lib/xen-common/bin
mkdir -p "$t/$vd"
-for binary in `find $t/usr/{bin,sbin} -type f`; do
+find "$t"/usr/*bin -type f | while read binary; do
# filter for executables (ignore scripts)
file "$binary" | grep -q -eELF.\\+version.\\+interpreter || continue
--end
The first two are the source and destination files, plus a triple
repetition of their respective prefixes. Most often '-' is used for
source and '+' is used for destination and the source is listed before
destination, but the format *DOES* *NOT* require this! Though now that
I've tried, `git am` doesn't like anything other than '-' for source and
'+' for destination (`patch` is perfectly happy with '%' and '$').
Hunks start with "@@". The '-' is the character used for the source
file, the '+' is the character used for the destination file. The first
number is the line number from the respective file, the second is the
number of lines included from that file.
The following lines start with one of 3 characters. Space is for lines
which are identical between both files. If a line starts with the source
prefix, then that line is *only* present in the source file. If a line
starts with the destination prefix, then that line is *only* present in
the destination file.
This likely isn't the greatest description of the patch format. Your
favored search engine can find other descriptions of the "patch" or
"unified diff" format. For reference, the below is considered
*identical* to the above:
### b/debian/shuffle-binaries
zzz a/debian/shuffle-binaries
@@ z22,7 #22,7 @@ cd=/usr/lib/xen-common/bin
mkdir -p "$t/$vd"
zfor binary in `find $t/usr/{bin,sbin} -type f`; do
#find "$t"/usr/*bin -type f | while read binary; do
reason=''
{ ldd "$binary" ||: ; } | { fgrep '=>' ||: ; } \
| (
--end
`diff -u $src $dst` can generate the same result. Generally
source/destination filenames include the parent directory. Any patch
acceptable to `git am` can also be applied using `patch -p1 < $file`
If you're doing this long enough you'll learn the basics of the patterns
since humans are great at pattern recognition and at some point you'll
need to deal with a funky patch due to wanting its result.
Perversions like the above are rare, but the format (though not `git am`)
allows it (yes, prior to sending this message I tested with `patch -p1`).
--
(\___(\___(\______ --=> 8-) EHM <=-- ______/)___/)___/)
\BS ( | ehem+sigmsg at m5p.com PGP 87145445 | ) /
\_CS\ | _____ -O #include <stddisclaimer.h> O- _____ | / _/
8A19\___\_|_/58D2 7E3D DDF4 7BA6 <-PGP-> 41D1 B375 37D0 8714\_|_/___/5445
More information about the Pkg-xen-devel
mailing list