[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Minios-devel] [UNIKRAFT PATCH v2] build: use -p1 instead of -p0 in patch command



The -p1 is more commonly used. And, what is more important, this is
the way git generates patches.

Getting unikraft build system compatible with git patches will save as
some headache in the feature. Better to change it now, before we got
tremendous amount of external libs.

Signed-off-by: Yuri Volchkov <yuri.volchkov@xxxxxxxxx>
---
 doc/guides/developers-app.rst | 41 +++++++++++++++++++++++++----------
 support/build/Makefile.rules  |  2 +-
 2 files changed, 31 insertions(+), 12 deletions(-)

diff --git a/doc/guides/developers-app.rst b/doc/guides/developers-app.rst
index cc4e1dc..12e4739 100644
--- a/doc/guides/developers-app.rst
+++ b/doc/guides/developers-app.rst
@@ -313,14 +313,33 @@ below: ::
 ============================
 Patch Creation
 ============================
-To create a patch, go to the base directory for your sources and run
-the ``diff`` command below. If you'll be using Unikraft's built-in
-``patch`` command make sure to place patches in the
-``LIBLIBNAME_BASE/patches`` directory. For the patch's name, as a
-convention, we use the format
-``[nnn]-[dash-separated-description].patch`` (e.g.,
-``001-ipv6-on.patch``). Putting all of this together, the following
-command creates a Unikraft patch: ::
-
-  diff -Uanm /path_to_file/source.c.orig /path_to_file/source.c >
-        LIBLIBNAME_BASE/patches/[nnn]-[description].patch
+
+Go to the directory containing sources of the application you are
+porting (e.g. ``build/libnewlibc/origin``). Copy over the folder with
+unmodified sources::
+
+  cp -r newlib-2.5.0.20170922 newlib.orig
+
+Do necessary modifications, test it and run ``diff`` tool::
+
+  diff -urNp newlib.orig newlib-2.5.0.20170922 >
+          LIBLIBNAME_BASE/patches/[nnnn]-[description].patch
+
+Open the generated patch in your favorite editor and add a short
+header to the patch. Start it with a ``From:`` field, and put your
+name in it. On the next line add a one-liner description of the patch
+in the ``Subject:`` filed. Optionally, write a little longer
+description after an empty line. And, finally, add ``---`` line at the
+end of the header.
+
+This should help people to get an idea why does this patch
+exist, and whom they should address questions. Header example::
+
+  From: Zaphod Beeblebrox <z.beeblebrox@xxxxxxxxx>
+  Subject: subject of an example patch
+
+  This is an example patch description
+  ---
+  diff -urNp newlib.orig/ChangeLog newlib-2.5.0.20170922/ChangeLog
+
+Or just use git to generate patches for you.
diff --git a/support/build/Makefile.rules b/support/build/Makefile.rules
index 0fee0d7..844cb4b 100644
--- a/support/build/Makefile.rules
+++ b/support/build/Makefile.rules
@@ -237,7 +237,7 @@ define patch =
 $(BUILD_DIR)/$(1)/.patched: $(BUILD_DIR)/$(1)/.origin
        @$(foreach P,$(sort $(wildcard $(2)/*)), \
          $(call verbose_cmd_inner,PATCH,$(1)':' $(notdir $(P)), \
-         $(PATCH) -sd $(BUILD_DIR)/$(1)/origin/$(3)/ -p0 < $(P)) &&)\
+         $(PATCH) -sd $(BUILD_DIR)/$(1)/origin/$(3)/ -p1 < $(P)) &&)\
        $(TOUCH) $(BUILD_DIR)/$(1)/.patched
 UK_FETCH-y += $(BUILD_DIR)/$(1)/.patched
 endef
-- 
2.17.0


_______________________________________________
Minios-devel mailing list
Minios-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/minios-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.