You are not logged in.

#1 2011-12-06 11:05:07

roygbiv
Member
Registered: 2011-05-18
Posts: 204

[SOLVED] DWM - how do you apply patches with patch?

I'm totally new to dwm (it's working great by the way) and patching. I'm having problems understanding how to use the patch program. The basic usage on dwm site says basically:

patch -p1 < path/to/patch.diff

Great, now I have the patch file ~/builds/dwn/patch/dwm-5.9-statuscolors.diff and my altered ~/builds/dwn/config.h. Here's what I did

herman@sam ~/builds/dwm $ patch -p1 <patch/dwm-5.9-statuscolors.diff
can't find file to patch at input line 4
Perhaps you used the wrong -p or --strip option?
The text leading up to this was:
--------------------------
|diff -up dwm-5.9/config.def.h dwm-5.9-colors/config.def.h
|--- dwm-5.9/config.def.h       2011-07-10 16:24:25.000000000 -0400
|+++ dwm-5.9-colors/config.def.h        2011-08-18 02:02:47.033830823 -0400
--------------------------
File to patch: config.def.h
config.def.h: No such file or directory
Skip this patch? [y] 
Skipping patch.
2 out of 2 hunks ignored
can't find file to patch at input line 41
Perhaps you used the wrong -p or --strip option?
The text leading up to this was:
--------------------------
|Only in dwm-5.9: config.h
|Only in dwm-5.9: dwm
|diff -up dwm-5.9/dwm.c dwm-5.9-colors/dwm.c
|--- dwm-5.9/dwm.c      2011-07-10 16:24:25.000000000 -0400
|+++ dwm-5.9-colors/dwm.c       2011-08-18 02:07:20.788935100 -0400
--------------------------
File to patch: dwm.c
dwm.c: No such file or directory
Skip this patch? [y] 
Skipping patch.
12 out of 12 hunks ignored

and it asks me for the filename it didn't find at line 4. Looking at the patch, I see it's a diff on config.def.h so I suppose this is the file to be patched and that I should supply this filename and the same with dwm.c? I'm not new to C coding but fresh out when it comes to diffing and patching, how do I actually go forward from here?

Edit:
More info  - I used the description using ABS to download the PKGBUILD for dwm and making dwm. My files

herman@sam ~/builds/dwm $ ls -R
.:
PKGBUILD  config.h  dwm-5.9-2-x86_64.pkg.tar.xz  dwm-5.9.tar.gz  dwm.desktop  dwm.install  patch  pkg  src

./patch:
dwm-5.9-statuscolors.diff

./pkg:
usr

./pkg/usr:
bin  share

./pkg/usr/bin:
dwm

./pkg/usr/share:
doc  licenses  man  xsessions

./pkg/usr/share/doc:
dwm

./pkg/usr/share/doc/dwm:
README

./pkg/usr/share/licenses:
dwm

./pkg/usr/share/licenses/dwm:
LICENSE

./pkg/usr/share/man:
man1

./pkg/usr/share/man/man1:
dwm.1.gz

./pkg/usr/share/xsessions:
dwm.desktop

./src:
config.h  dwm-5.9  dwm-5.9.tar.gz  dwm.desktop

./src/dwm-5.9:
LICENSE  Makefile  README  config.def.h  config.def.h.orig  config.def.h.rej  config.h  config.mk  dwm  dwm.1  dwm.c  dwm.o

Last edited by roygbiv (2011-12-06 20:37:40)

Offline

#2 2011-12-06 15:05:54

iTwenty
Member
From: India
Registered: 2010-10-24
Posts: 63
Website

Re: [SOLVED] DWM - how do you apply patches with patch?

The patch file and the source files that the patch modifies should be in same directory. For dwm, I have found that installing via AUR is more trouble than it's worth. I have the source files of dwm in $HOME and just run make clean install inside this directory whenever I modify my config.h


“Twenty years from now you will be more disappointed by the things that you didn't do than by the ones you did do. So throw off the bowlines. Sail away from the safe harbor. Catch the trade winds in your sails. Explore. Dream. Discover.” - Mark Twain

Offline

#3 2011-12-06 16:05:11

bohoomil
Member
Registered: 2010-09-04
Posts: 2,376
Website

Re: [SOLVED] DWM - how do you apply patches with patch?

I have the source files of dwm in $HOME and just run make clean install inside this directory whenever I modify my config.h

That's my way, too. Don't forget to modify the config.mk so that it meets your system's specs, though.


:: Registered Linux User No. 223384

:: github
:: infinality-bundle+fonts: good looking fonts made easy

Offline

#4 2011-12-06 16:23:21

roygbiv
Member
Registered: 2011-05-18
Posts: 204

Re: [SOLVED] DWM - how do you apply patches with patch?

iTwenty wrote:

The patch file and the source files that the patch modifies should be in same directory. For dwm, I have found that installing via AUR is more trouble than it's worth. I have the source files of dwm in $HOME and just run make clean install inside this directory whenever I modify my config.h

Do you have all your files directly in your home folder? That's kinda messy?
Thanks bro! Ran the patch command in the dwm source dir:

herman@sam ~/build/dwm/src/dwm-5.9 $ patch < dwm-5.9-statuscolors.diff 
patching file config.def.h
patching file dwm.c
Reversed (or previously applied) patch detected!  Assume -R? [n] y

The files are modified according to the .diff patch file, so assuming this went well i should just recompile? I'm using makepkg -i for now, because it's kind of convenient for me right know. By the way, what is the difference between that and doing a standard make install in this case? I believe I got the PKGBUILD from [communty] not the AUR by the way.

bohoomil wrote:

That's my way, too. Don't forget to modify the config.mk so that it meets your system's specs, though.

Is this necessary each time I patch or just one time?

Last edited by roygbiv (2011-12-06 16:24:09)

Offline

#5 2011-12-06 16:45:44

bohoomil
Member
Registered: 2010-09-04
Posts: 2,376
Website

Re: [SOLVED] DWM - how do you apply patches with patch?

No, this is a one time operation. You'll see several paths there -- just make them point the right things in the right places. That's it. smile


:: Registered Linux User No. 223384

:: github
:: infinality-bundle+fonts: good looking fonts made easy

Offline

#6 2011-12-06 20:00:45

roygbiv
Member
Registered: 2011-05-18
Posts: 204

Re: [SOLVED] DWM - how do you apply patches with patch?

Ok thanks but I'm confused again (I know..). I managed to patch the files config.def.h and dwm.c in the source dir and noticed there is yet another config.h file there as well. Now, the in the top level dir with the PKGBUILD I also have a config.h, which is the one I do my config changes. I'm confused because I now have these three header files (2x config.h + config.def.h) which are supposed to have the same source code? I've read around on the net, but haven't gotten any further answers yet. What are the purpose of each config and how should I use/update/manage them when recompiling? This is my situation:

herman@sam ~/build/dwm $ tree .
.
├── PKGBUILD
├── config.h <----------------------------------------------------- this one
├── dwm-5.9-2-x86_64.pkg.tar.xz
├── dwm-5.9.tar.gz
├── dwm.desktop
├── dwm.install
├── pkg
│   └── usr
│       ├── bin
│       │   └── dwm
│       └── share
│           ├── doc
│           │   └── dwm
│           │       └── README
│           ├── licenses
│           │   └── dwm
│           │       └── LICENSE
│           ├── man
│           │   └── man1
│           │       └── dwm.1.gz
│           └── xsessions
│               └── dwm.desktop
└── src
    ├── config.h -> /home/herman/build/dwm/config.h
    ├── dwm-5.9
    │   ├── LICENSE
    │   ├── Makefile
    │   ├── README
    │   ├── config.def.h <-----------------------------------------------------this one
    │   ├── config.def.h.orig
    │   ├── config.h <----------------------------------------------------------this one
    │   ├── config.mk
    │   ├── dwm
    │   ├── dwm-5.9-statuscolors.diff
    │   ├── dwm.1
    │   ├── dwm.c
    │   ├── dwm.c.orig
    │   └── dwm.o
    ├── dwm-5.9.tar.gz -> /home/herman/build/dwm/dwm-5.9.tar.gz
    └── dwm.desktop -> /home/herman/build/dwm/dwm.desktop
 

Thanks guys!

Last edited by roygbiv (2011-12-06 20:06:10)

Offline

#7 2011-12-06 20:05:38

jasonwryan
Anarchist
From: .nz
Registered: 2009-05-09
Posts: 30,424
Website

Re: [SOLVED] DWM - how do you apply patches with patch?

config.def.h in src/dwm-5.9-2/ is the template - you copy this to your top level directory (as config.h) and make changes to that...


Arch + dwm   •   Mercurial repos  •   Surfraw

Registered Linux User #482438

Offline

#8 2011-12-06 20:11:53

roygbiv
Member
Registered: 2011-05-18
Posts: 204

Re: [SOLVED] DWM - how do you apply patches with patch?

Ok! So config.def.h is copied each time since it gets modified after patching, right. What about the src/dwm-5.9-2/config.h file?

Offline

#9 2011-12-06 20:19:30

jasonwryan
Anarchist
From: .nz
Registered: 2009-05-09
Posts: 30,424
Website

Re: [SOLVED] DWM - how do you apply patches with patch?

Ignore it: the PKGBUILD copies it to the top dir


Arch + dwm   •   Mercurial repos  •   Surfraw

Registered Linux User #482438

Offline

Board footer

Powered by FluxBB