Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
understanding patches
View unanswered posts
View posts from last 24 hours

Goto page 1, 2  Next  
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo
View previous topic :: View next topic  
Author Message
hedmo
Veteran
Veteran


Joined: 29 Aug 2009
Posts: 1331
Location: sweden

PostPosted: Sat Nov 30, 2019 7:35 pm    Post subject: understanding patches Reply with quote

hi all

can someone tell a noob how what this mean in a patch:

Code:
@@ -96,9 +96,9 @@


and

Code:
@@ -377,6 +378,7 @@


regards hedmo
Back to top
View user's profile Send private message
GDH-gentoo
Veteran
Veteran


Joined: 20 Jul 2019
Posts: 1687
Location: South America

PostPosted: Sat Nov 30, 2019 8:23 pm    Post subject: Re: understanding patches Reply with quote

Basically, line numbers in the original and modified files.

hedmo wrote:
Code:
@@ -96,9 +96,9 @@
"The following 9 lines, starting at line 96 in the original file, become 9 lines, starting at line 96 in the patched file, after applying the changes specified below, up to the next @@ line (or end-of-file)"

hedmo wrote:
Code:
@@ -377,6 +378,7 @@
"The following 6 lines, starting at line 377 in the original file, become 7 lines, starting at line 378 in the patched file, after applying the changes specified below, up to the next @@ line (or end-of-file)"
Back to top
View user's profile Send private message
fedeliallalinea
Administrator
Administrator


Joined: 08 Mar 2003
Posts: 31257
Location: here

PostPosted: Sat Nov 30, 2019 8:23 pm    Post subject: Reply with quote

See here.
_________________
Questions are guaranteed in life; Answers aren't.
Back to top
View user's profile Send private message
hedmo
Veteran
Veteran


Joined: 29 Aug 2009
Posts: 1331
Location: sweden

PostPosted: Sun Dec 01, 2019 4:03 pm    Post subject: Reply with quote

GDH-gentoo and fedeliallalinea

thanks .i am starting to understand a bit but far from all..i have a problem with a patch that i can not work out:

the patch=

Code:


diff --git a/src/dxvk/meson.build b/src/dxvk/meson.build
index 867f3002..bc76c68b 100644
--- a/src/dxvk/meson.build
+++ b/src/dxvk/meson.build
@@ -43,14 +43,18 @@ dxvk_shaders = files([
   'shaders/dxvk_unpack_d24s8_as_d32s8.comp',
   'shaders/dxvk_unpack_d24s8.comp',
   'shaders/dxvk_unpack_d32s8.comp',

-  'hud/shaders/hud_line_frag.frag',
-  'hud/shaders/hud_line_vert.vert',
-
-  'hud/shaders/hud_text_frag.frag',
-  'hud/shaders/hud_text_vert.vert',
])

dxvk_src = files([
   'dxvk_adapter.cpp',
   'dxvk_barrier.cpp',
+if get_option('enable_hud')
+  dxvk_shaders += files([
+    'hud/shaders/hud_line_frag.frag',
+    'hud/shaders/hud_line_vert.vert',
+
+    'hud/shaders/hud_text_frag.frag',
+    'hud/shaders/hud_text_vert.vert',
+  ])
+endif
+
 dxvk_src = files([
   'dxvk_adapter.cpp',
   'dxvk_barrier.cpp',
@@ -79,7 +83,6 @@ dxvk_src = files([
   'dxvk_meta_mipgen.cpp',
   'dxvk_meta_pack.cpp',
   'dxvk_meta_resolve.cpp',
-  'dxvk_openvr.cpp',
   'dxvk_options.cpp',
   'dxvk_pipecache.cpp',
   'dxvk_pipelayout.cpp',
@@ -97,14 +100,24 @@ dxvk_src = files([
   'dxvk_unbound.cpp',
   'dxvk_util.cpp',

   'platform/dxvk_win32_exts.cpp',
 
-
-  'hud/dxvk_hud.cpp',
-  'hud/dxvk_hud_config.cpp',
-  'hud/dxvk_hud_devinfo.cpp',
-  'hud/dxvk_hud_font.cpp',
-  'hud/dxvk_hud_fps.cpp',
-  'hud/dxvk_hud_renderer.cpp',
-  'hud/dxvk_hud_stats.cpp',
])
 
+if get_option('enable_hud')
+  dxvk_src += files([
+    'hud/dxvk_hud.cpp',
+    'hud/dxvk_hud_config.cpp',
+    'hud/dxvk_hud_devinfo.cpp',
+    'hud/dxvk_hud_font.cpp',
+    'hud/dxvk_hud_fps.cpp',
+    'hud/dxvk_hud_renderer.cpp',
+    'hud/dxvk_hud_stats.cpp',
+  ])
+endif
+
+if get_option('enable_openvr')
+  dxvk_src += files(['dxvk_openvr.cpp'])
+endif
+
 thread_dep = dependency('threads')
 
 dxvk_lib = static_library('dxvk', dxvk_src, glsl_generator.process(dxvk_shaders), dxvk_version,

   


and the code:
Code:

 'shaders/dxvk_unpack_d24s8_as_d32s8.comp',
  'shaders/dxvk_unpack_d24s8.comp',
  'shaders/dxvk_unpack_d32s8.comp',
 
  'hud/shaders/hud_line_frag.frag',
  'hud/shaders/hud_line_vert.vert',

  'hud/shaders/hud_text_frag.frag',
  'hud/shaders/hud_text_vert.vert',
])

dxvk_src = files([
  'dxvk_adapter.cpp',
  'dxvk_barrier.cpp',
==============================line 57
cutting here for a smaller topic...
==============================line 79
 'dxvk_meta_mipgen.cpp',
  'dxvk_meta_pack.cpp',
  'dxvk_meta_resolve.cpp',
  'dxvk_openvr.cpp',
  'dxvk_options.cpp',
  'dxvk_pipecache.cpp',
  'dxvk_pipelayout.cpp',
==============================line 87
cutting here for a smaller topic...
==============================line 98
'dxvk_unbound.cpp',
  'dxvk_util.cpp',

  'platform/dxvk_win32_exts.cpp',
 
  'hud/dxvk_hud.cpp',
  'hud/dxvk_hud_config.cpp',
  'hud/dxvk_hud_devinfo.cpp',
  'hud/dxvk_hud_font.cpp',
  'hud/dxvk_hud_fps.cpp',
  'hud/dxvk_hud_renderer.cpp',
  'hud/dxvk_hud_stats.cpp',
])

thread_dep = dependency('threads')

dxvk_lib = static_library('dxvk', dxvk_src, glsl_generator.process(dxvk_shaders), dxvk_version,


the error i am getting is :
Code:

patch: **** malformed patch at line 181: ])


and i can not figre out how to fix this.

regards
Back to top
View user's profile Send private message
GDH-gentoo
Veteran
Veteran


Joined: 20 Jul 2019
Posts: 1687
Location: South America

PostPosted: Sun Dec 01, 2019 4:11 pm    Post subject: Reply with quote

Which software package are you trying to patch?
Back to top
View user's profile Send private message
hedmo
Veteran
Veteran


Joined: 29 Aug 2009
Posts: 1331
Location: sweden

PostPosted: Sun Dec 01, 2019 4:16 pm    Post subject: Reply with quote

GDH-gentoo wrote:
Which software package are you trying to patch?


https://github.com/doitsujin/dxvk

and the package is:

https://github.com/pchome/proton-gentoo-overlay/tree/master/app-emulation/dxvk-module

regards
Back to top
View user's profile Send private message
Hu
Administrator
Administrator


Joined: 06 Mar 2007
Posts: 22625

PostPosted: Sun Dec 01, 2019 4:50 pm    Post subject: Reply with quote

Did you try to edit the patch by hand? Don't do that. It's possible, but you need to be very careful. You're usually better off applying the original patch to the original target, then editing the resulted modified file, then generating a new patch as a difference between the original target and the edited file.
Back to top
View user's profile Send private message
hedmo
Veteran
Veteran


Joined: 29 Aug 2009
Posts: 1331
Location: sweden

PostPosted: Sun Dec 01, 2019 5:01 pm    Post subject: Reply with quote

Hu wrote:
Did you try to edit the patch by hand? Don't do that. It's possible, but you need to be very careful. You're usually better off applying the original patch to the original target, then editing the resulted modified file, then generating a new patch as a difference between the original target and the edited file.


Hu
where is the modified you are talking about? .yes i am editing some patch files by hand to trying to update some packages but this patch i can not manage to edit.
Back to top
View user's profile Send private message
mv
Watchman
Watchman


Joined: 20 Apr 2005
Posts: 6780

PostPosted: Sun Dec 01, 2019 5:09 pm    Post subject: Reply with quote

There is a space missing at the beginning of the line "])" in the patch file. (Maybe there are other typos as well - I did not check.)
Back to top
View user's profile Send private message
GDH-gentoo
Veteran
Veteran


Joined: 20 Jul 2019
Posts: 1687
Location: South America

PostPosted: Sun Dec 01, 2019 7:15 pm    Post subject: Reply with quote

hedmo wrote:
Hu
where is the modified you are talking about? .yes i am editing some patch files by hand to trying to update some packages but this patch i can not manage to edit.
That's what Hu meant. Editing patches by hand is possible, but easy to get wrong. And spaces at the beginning of lines are important, as mv said.

This is what I get by directly editing the repository's current meson.build file according to the patch from proton-gentoo-overlay, and then using diff -u against the unmodified file to obtain a new patch.

Code:
--- a/src/dxvk/meson.build
+++ b/src/dxvk/meson.build
@@ -43,14 +43,18 @@
   'shaders/dxvk_unpack_d24s8_as_d32s8.comp',
   'shaders/dxvk_unpack_d24s8.comp',
   'shaders/dxvk_unpack_d32s8.comp',

-  'hud/shaders/hud_line_frag.frag',
-  'hud/shaders/hud_line_vert.vert',
-
-  'hud/shaders/hud_text_frag.frag',
-  'hud/shaders/hud_text_vert.vert',
 ])
 
+if get_option('enable-hud')
+  dxvk_shaders += files([
+    'hud/shaders/hud_line_frag.frag',
+    'hud/shaders/hud_line_vert.vert',
+
+    'hud/shaders/hud_text_frag.frag',
+    'hud/shaders/hud_text_vert.vert',
+  ])
+endif
+
 dxvk_src = files([
   'dxvk_adapter.cpp',
   'dxvk_barrier.cpp',
@@ -80,7 +84,6 @@
   'dxvk_meta_mipgen.cpp',
   'dxvk_meta_pack.cpp',
   'dxvk_meta_resolve.cpp',
-  'dxvk_openvr.cpp',
   'dxvk_options.cpp',
   'dxvk_pipecache.cpp',
   'dxvk_pipelayout.cpp',
@@ -100,16 +103,24 @@
   'dxvk_util.cpp',
 
   'platform/dxvk_win32_exts.cpp',

-  'hud/dxvk_hud.cpp',
-  'hud/dxvk_hud_config.cpp',
-  'hud/dxvk_hud_devinfo.cpp',
-  'hud/dxvk_hud_font.cpp',
-  'hud/dxvk_hud_fps.cpp',
-  'hud/dxvk_hud_renderer.cpp',
-  'hud/dxvk_hud_stats.cpp',
 ])
 
+if get_option('enable-hud')
+  dxvk_src += files([
+    'hud/dxvk_hud.cpp',
+    'hud/dxvk_hud_config.cpp',
+    'hud/dxvk_hud_devinfo.cpp',
+    'hud/dxvk_hud_font.cpp',
+    'hud/dxvk_hud_fps.cpp',
+    'hud/dxvk_hud_renderer.cpp',
+    'hud/dxvk_hud_stats.cpp',
+  ])
+endif
+
+if get_option('enable-openvr')
+  dxvk_src += files(['dxvk_openvr.cpp'])
+endif
+
 thread_dep = dependency('threads')
 
 dxvk_lib = static_library('dxvk', dxvk_src, glsl_generator.process(dxvk_shaders), dxvk_version,
Back to top
View user's profile Send private message
Hu
Administrator
Administrator


Joined: 06 Mar 2007
Posts: 22625

PostPosted: Sun Dec 01, 2019 8:06 pm    Post subject: Reply with quote

hedmo wrote:
Hu
where is the modified you are talking about? .yes i am editing some patch files by hand to trying to update some packages but this patch i can not manage to edit.
You create it:
  • Checkout clean upstream copy.
  • Checkout working copy for edits. (To be compact, you can just backup the files you will need, but that is more work.)
  • In the working copy for edits, run patch -p1 -i /path/to/original/patch
  • # Now some files are modified according to the patch.
  • $EDITOR files-to-change-more
  • # Now your local edits are present too.
  • diff -u $clean_checkout $modified_checkout > newpatch.patch
Back to top
View user's profile Send private message
hedmo
Veteran
Veteran


Joined: 29 Aug 2009
Posts: 1331
Location: sweden

PostPosted: Tue Dec 03, 2019 7:28 pm    Post subject: Reply with quote

Hu wrote:
hedmo wrote:
Hu
where is the modified you are talking about? .yes i am editing some patch files by hand to trying to update some packages but this patch i can not manage to edit.
You create it:
  • Checkout clean upstream copy.
  • Checkout working copy for edits. (To be compact, you can just backup the files you will need, but that is more work.)
  • In the working copy for edits, run patch -p1 -i /path/to/original/patch
  • # Now some files are modified according to the patch.
  • $EDITOR files-to-change-more
  • # Now your local edits are present too.
  • diff -u $clean_checkout $modified_checkout > newpatch.patch


as far as i understand.i need to edit the ebuild to use a working commit with the patch,download the commit.and diff the changes with the git/live version at dxvk.git?

regards
Back to top
View user's profile Send private message
Hu
Administrator
Administrator


Joined: 06 Mar 2007
Posts: 22625

PostPosted: Wed Dec 04, 2019 1:49 am    Post subject: Reply with quote

You need to start with a revision to which the patch applies, yes.
Back to top
View user's profile Send private message
charles17
Advocate
Advocate


Joined: 02 Mar 2008
Posts: 3684

PostPosted: Wed Dec 04, 2019 6:41 am    Post subject: Re: understanding patches Reply with quote

hedmo wrote:
hi all

can someone tell a noob how what this mean in a patch:

Code:
@@ -96,9 +96,9 @@


and

Code:
@@ -377,6 +378,7 @@

For getting a better understanding of patch you might run some tests with diff. I've tried to describe in https://wiki.gentoo.org/wiki/Patches#Creating_a_patch.
Back to top
View user's profile Send private message
hedmo
Veteran
Veteran


Joined: 29 Aug 2009
Posts: 1331
Location: sweden

PostPosted: Wed Dec 04, 2019 7:31 pm    Post subject: Reply with quote

hi again

this is quite hard for me to understand but i am trying...so i have patched the dxvk-1.4.4 :

Code:


hedmo@mya51 ~/Downloads/dxvk-1.4.4 $ patch -p1 -i /home/hedmo/Downloads/hud.patch
patching file meson.build
patching file meson_options.txt
patching file src/d3d11/d3d11_swapchain.cpp
Hunk #2 succeeded at 206 (offset 6 lines).
Hunk #3 succeeded at 303 (offset 6 lines).
Hunk #4 succeeded at 602 (offset 10 lines).
patching file src/d3d11/d3d11_swapchain.h
patching file src/dxvk/dxvk_instance.cpp
patching file src/dxvk/dxvk_instance.h
patching file src/dxvk/meson.build
Hunk #2 succeeded at 84 (offset 1 line).
Hunk #3 succeeded at 101 (offset 1 line).
hedmo@mya51 ~/Downloads/dxvk-1.4.4 $


and the patch worked.now i need to diff it with the dxvk-git as i understand but how?.i would like to see a command like this :
Code:


diff the files that i have patched in dxvk-1.4.4 and make a new patch for me to use in dxvk-git

This is HARD for me to understand


charles17

it is the same with your link ...i can not figure out where the magic happens

i know it is simple when you have done it some times but now it is like finding a pearl in the ocean for me.

regards
Back to top
View user's profile Send private message
charles17
Advocate
Advocate


Joined: 02 Mar 2008
Posts: 3684

PostPosted: Fri Dec 13, 2019 7:04 am    Post subject: Reply with quote

hedmo wrote:
charles17

it is the same with your link ...i can not figure out where the magic happens

i know it is simple when you have done it some times but now it is like finding a pearl in the ocean for me.

regards

You have started your ebuild so it can download and unpack the sources?
Do the ebuild <package and version> clean prepare, then cd to the work directory and apply the patch.
Come here again posting your ebuild
Back to top
View user's profile Send private message
hedmo
Veteran
Veteran


Joined: 29 Aug 2009
Posts: 1331
Location: sweden

PostPosted: Mon Dec 23, 2019 7:08 am    Post subject: Reply with quote

charles17 wrote:

You have started your ebuild so it can download and unpack the sources?
Do the ebuild <package and version> clean prepare, then cd to the work directory and apply the patch.
Come here again posting your ebuild


this is the ebuild :

Code:

# Copyright 1999-2019 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

EAPI=6

MULTILIB_COMPAT=( abi_x86_{32,64} )

inherit meson multilib-minimal

DESCRIPTION="A Vulkan-based translation layer for Direct3D 10/11"
HOMEPAGE="https://github.com/doitsujin/dxvk"

if [[ ${PV} == "9999" ]] ; then
   EGIT_REPO_URI="https://github.com/doitsujin/dxvk.git"
   EGIT_BRANCH="master"
   inherit git-r3
   SRC_URI=""
else
   SRC_URI="https://github.com/doitsujin/dxvk/archive/v${PV}.tar.gz -> ${P}.tar.gz"
   KEYWORDS="-* ~amd64"
fi

LICENSE="ZLIB"
SLOT="${PV}"
IUSE="+hud +openvr"
RESTRICT="test"

RDEPEND="app-emulation/wine-proton:*[${MULTILIB_USEDEP},vulkan]"

DEPEND="${RDEPEND}
   dev-util/glslang"

BDEPEND="dev-util/meson-common-winelib"

PATCHES=(
   "${FILESDIR}/install-each-lib-in-subdir.patch"
   "${FILESDIR}/ddraw-stub.patch"
   "${FILESDIR}/dxvk-hud-and-vr-options.patch"
)

dxvk_check_requirements() {
   if [[ ${MERGE_TYPE} != binary ]]; then
      if ! tc-is-gcc || [[ $(gcc-major-version) -lt 7 || $(gcc-major-version) -eq 7 && $(gcc-minor-version) -lt 3 ]]; then
         die "At least gcc 7.3 is required"
      fi
   fi
}

pkg_pretend() {
   dxvk_check_requirements
}

pkg_setup() {
   dxvk_check_requirements
}

cross_file() { [[ ${ABI} = amd64 ]] && echo "${CHOST_amd64}.x86_64.winelib" || echo "${CHOST_x86}.x86.winelib" ; }

winelib_flags() {
   # winelib specific flags for the project
   local winelib_cargs="${CFLAGS}"
   local winelib_cppargs="${CXXFLAGS}"
   local winelib_largs="${LDFLAGS}"

   # Do not emit STB_GNU_UNIQUE symbols for uuidof declarations, which prevents .so files from being unloaded.
   winelib_cppargs="${winelib_cppargs} --no-gnu-unique"

   # No min()/max()
   winelib_cppargs="${winelib_cppargs} -DNOMINMAX"

   # Hide symbols
   winelib_cargs="${winelib_cargs} -fvisibility=hidden"
   winelib_cppargs="${winelib_cppargs} -fvisibility=hidden -fvisibility-inlines-hidden"

   # Fix compilation for Wine >=4.15
   winelib_cargs="${winelib_cargs} -fpermissive"
   winelib_cppargs="${winelib_cppargs} -fpermissive"

   # For deps and entry points
   winelib_largs="${winelib_largs} -mwindows"

   if [[ $1 ]]; then
      [[ $1 = "cflags" ]] && echo "${winelib_cargs}"
      [[ $1 = "cppflags" ]] && echo "${winelib_cppargs}"
      [[ $1 = "ldflags" ]] && echo "${winelib_largs}"
   fi
}

multilib_src_configure() {
   local emesonargs=(
      --cross-file="$(cross_file)"
      --libdir="$(get_libdir)/wine-modules/dxvk"
      --bindir="$(get_libdir)/wine-modules/dxvk"
      $(meson_use hud enable_hud)
      $(meson_use openvr enable_openvr)
      -Dc_args="$(winelib_flags cflags)"
      -Dcpp_args="$(winelib_flags cppflags)"
      -Dc_link_args="$(winelib_flags ldflags)"
      -Dcpp_link_args="$(winelib_flags ldflags)"
      -Denable_tests=false
      --unity=on
   )
   meson_src_configure
}

multilib_src_install() {
   meson_src_install
}

multilib_src_install_all() {
   dodoc "${S}/dxvk.conf"

   einstalldocs
}


it is from: https://github.com/pchome/proton-gentoo-overlay . this is a good custom proton build for gentoo.this build makes you run SkyrimSE with ENB and Reshade together without a black screen

regards hedmo
Back to top
View user's profile Send private message
charles17
Advocate
Advocate


Joined: 02 Mar 2008
Posts: 3684

PostPosted: Mon Dec 23, 2019 8:15 am    Post subject: Reply with quote

Step 1
Code:
ebuild /var/db/repos/proton/app-emulation/dxvk-module/dxvk-module-9999.ebuild clean unpack
>>> Existing ${T}/environment for 'dxvk-module-9999' will be sourced. Run
>>> 'clean' to start with a fresh environment.
>>> Not marked as unpacked; recreating WORKDIR...
>>> Unpacking source...
...
GIT NEW branch -->
   repository:               https://github.com/doitsujin/dxvk.git
   at the commit:            b4f2094c02bea9b241f558a1c1888ba28a88d3f0
>>> Source unpacked in /var/tmp/portage/app-emulation/dxvk-module-9999/work


Step 2
Code:
su -c "cd /var/tmp/portage/app-emulation/dxvk-module-9999/work/dxvk-module-9999


Is this your package? Here, it is a git directory, so steps 3 and 4 can be skipped. Proceed with step 5 (apply your changes) and finally do the git diff and do it while in /var/tmp/portage/app-emulation/dxvk-module-9999/work/dxvk-module-9999/
Back to top
View user's profile Send private message
hedmo
Veteran
Veteran


Joined: 29 Aug 2009
Posts: 1331
Location: sweden

PostPosted: Thu Dec 26, 2019 1:18 pm    Post subject: Reply with quote

charles17

okej i am going to try this on.but do i need to :
Code:


ebuild /var/db/repos/proton/app-emulation/dxvk-module/dxvk-module-9999.ebuild clean unpack


cant i just :
Code:


git clone https://github.com/doitsujin/dxvk.git



and use that one:

i am using tempfs :

Code:

mya51 . # su -c "cd /var/tmp/portage/app-emulation/dxvk-module-9999/work/dxvk-module-9999"
job-working-directory: error retrieving current directory: getcwd: cannot access parent directories: No such file or directory
shell-init: error retrieving current directory: getcwd: cannot access parent directories: No such file or directory
chdir: error retrieving current directory: getcwd: cannot access parent directories: No such file or directory
mya51 . #



It is not my package but it is the package/ebuild i want to patch

regards hedmo
Back to top
View user's profile Send private message
charles17
Advocate
Advocate


Joined: 02 Mar 2008
Posts: 3684

PostPosted: Thu Dec 26, 2019 1:58 pm    Post subject: Reply with quote

hedmo wrote:
charles17

okej i am going to try this on.but do i need to :
Code:


ebuild /var/db/repos/proton/app-emulation/dxvk-module/dxvk-module-9999.ebuild clean unpack

It means using portage's unpack function for your ebuild.

hedmo wrote:
Quote:
mya51 . # su -c "cd /var/tmp/portage/app-emulation/dxvk-module-9999/work/dxvk-module-9999"
job-working-directory: error retrieving current directory: getcwd: cannot access parent directories: No such file or directory
...

That's because you did not cd into what your ebuild has unpacked ...
Back to top
View user's profile Send private message
hedmo
Veteran
Veteran


Joined: 29 Aug 2009
Posts: 1331
Location: sweden

PostPosted: Thu Dec 26, 2019 2:16 pm    Post subject: Reply with quote

this is how i patch to day :

Code:


hedmo@mya51 ~ $ git clone https://github.com/ValveSoftware/wine.git
Cloning into 'wine'...
remote: Enumerating objects: 991741, done.
remote: Total 991741 (delta 0), reused 0 (delta 0), pack-reused 991741
Receiving objects: 100% (991741/991741), 242.86 MiB | 8.51 MiB/s, done.
Resolving deltas: 100% (823796/823796), done.
hedmo@mya51 ~ $cp vulkan.patch wine
hedmo@mya51 ~ $ cd wine
hedmo@mya51 ~/wine $ cd dlls/winex11.drv/
hedmo@mya51 ~/wine/dlls/winex11.drv $cp vulkan.c vulkan1.c
hedmo@mya51 ~/wine/dlls/winex11.drv $ ls
Makefile.in  display.c   keyboard.c  pen.c       vulkan1.c         x11drv_main.c  xrandr.c
bitblt.c     event.c     mouse.c     settings.c  window.c          xcomposite.h   xrender.c
brush.c      graphics.c  mwm.h       systray.c   winex11.drv.spec  xdnd.c         xvidmode.c
clipboard.c  ime.c       opengl.c    version.rc  wintab.c          xim.c
desktop.c    init.c      palette.c   vulkan.c    x11drv.h          xinerama.c
hedmo@mya51 ~/wine $  patch -p1 -i /home/hedmo/wine/vulkan.patch
hedmo@mya51 ~/wine/dlls/winex11.drv $ diff -u vulkan1.c vulkan.c  > wine_proton_vulkan.patch
hedmo@mya51 ~/wine/dlls/winex11.drv $sudo cp wine_proton_vulkan.patch /etc/portage/patches/app-emulation/wine-proton/
hedmo@mya51 ~/wine/dlls/winex11.drv $sudo emerge -av wine-proton



this patch is simple because it has only one file that it is patching. but if the patch has many files to patch it is getting quite time killing to do it like this because i have to split out
the patch into many patches

regards hedmo
Back to top
View user's profile Send private message
John R. Graham
Administrator
Administrator


Joined: 08 Mar 2005
Posts: 10655
Location: Somewhere over Atlanta, Georgia

PostPosted: Thu Dec 26, 2019 4:45 pm    Post subject: Reply with quote

Why would you have to split a multi-file patch into multiple patches?

- John
_________________
I can confirm that I have received between 0 and 499 National Security Letters.
Back to top
View user's profile Send private message
hedmo
Veteran
Veteran


Joined: 29 Aug 2009
Posts: 1331
Location: sweden

PostPosted: Thu Dec 26, 2019 10:05 pm    Post subject: Reply with quote

John R. Graham wrote:
Why would you have to split a multi-file patch into multiple patches?

- John


John R. Graham i dont know how to work with a multi-file patch.the only way i can think of is to first clone the repo,rename,clone again,
patch one of them and diff the hole thing but that sounds like a NO go.but i dont know.manually edit patches was quite hard to.

regards
Back to top
View user's profile Send private message
John R. Graham
Administrator
Administrator


Joined: 08 Mar 2005
Posts: 10655
Location: Somewhere over Atlanta, Georgia

PostPosted: Thu Dec 26, 2019 10:48 pm    Post subject: Reply with quote

It's a lot easier than you're describing:
  1. Clone the repo.
  2. Checkout the branch or tag you want to base your modifications on.
  3. (Optional) Create a new local branch for your changes.
  4. Edit whatever files you want.
  5. (Optional) Commit those changes to your branch. This creates a convenient audit trail of your modifications.
  6. Use git to diff against the unmodified branch or tag to create your patch. That's as simple as
    Code:
    git diff master >mypatch.patch
  7. Repeat steps 4 - 6 until you've got it right.
You should never have to manually edit a patch, not because you can't but rather it's easier to edit the source code and do a diff to make a new patch.

- John
_________________
I can confirm that I have received between 0 and 499 National Security Letters.
Back to top
View user's profile Send private message
charles17
Advocate
Advocate


Joined: 02 Mar 2008
Posts: 3684

PostPosted: Fri Dec 27, 2019 8:11 am    Post subject: Reply with quote

John R. Graham wrote:
It's a lot easier than you're describing:
  1. Clone the repo.
  2. Checkout the branch or tag you want to base your modifications on.
  3. (Optional) Create a new local branch for your changes.
  4. Edit whatever files you want.
  5. (Optional) Commit those changes to your branch. This creates a convenient audit trail of your modifications.
  6. Use git to diff against the unmodified branch or tag to create your patch. That's as simple as
    Code:
    git diff master >mypatch.patch
  7. Repeat steps 4 - 6 until you've got it right.

John R. Graham

That's more or less the same as the procedure in the wiki article mentioned in post 8394822.
We might add that the command git diff can diff not only a single file but also a whole directory of files.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo All times are GMT
Goto page 1, 2  Next
Page 1 of 2

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum