You are not logged in.

#1 2012-03-10 20:07:42

megacyber
Member
Registered: 2011-11-30
Posts: 12

[Solved]How to patch dwm?

Sorry for my stupid question
I just want to patch DWM so I follow this introduction

PATCHES
diff generation
For mercurial users:

cd dwm-directory
hg diff > dwm-X.Y-yourpatchname.diff

patch application
For mercurial users:

cd dwm-directory
hg patch path/to/patch.diff

I think I got a .diff file and then run "hg diff > dwm-X.Y-yourpatchname.diff" in dwm-directory,right?(I got dwm by download using  'hg clone http://hg.suckless.org/dwm')
Everything went fine untill I try to do "hg patch path/to/patch.diff" where is exactly "path/to/patch.diff" be?

If you don't mind can you give me the step-by-step guild? I afraid that I did something wrong:(
I've try to find the way to solve it by using google and search in this forum but I still can't patch dwm:(

Last edited by megacyber (2012-03-11 04:28:14)


Sorry for my poor English:O

Offline

#2 2012-03-10 23:49:35

karol
Archivist
Registered: 2009-05-06
Posts: 25,440

Re: [Solved]How to patch dwm?

megacyber wrote:

Everything went fine untill I try to do "hg patch path/to/patch.diff" where is exactly "path/to/patch.diff" be?

You should know where do you have that patch you created with 'hg diff > dwm-X.Y-yourpatchname.diff'.

Offline

#3 2012-03-11 02:35:22

megacyber
Member
Registered: 2011-11-30
Posts: 12

Re: [Solved]How to patch dwm?

I created it in ~/dwm so I've used 'hg patch /homt/myuser/dwm/patch.diff
but then I recieve 'abort: outstanding uncommitted changes' I think there's something I did wrong:(


Sorry for my poor English:O

Offline

#4 2012-03-11 02:37:01

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

Re: [Solved]How to patch dwm?

Why don't you start with the ABS method described in the wiki, familiarize yourself with dwm and patching and then move to the hg method?


Arch + dwm   •   Mercurial repos  •   Surfraw

Registered Linux User #482438

Offline

#5 2012-03-11 03:05:16

megacyber
Member
Registered: 2011-11-30
Posts: 12

Re: [Solved]How to patch dwm?

I've already used ABS method but it still doesn't work
I want to apply hg method to patching surf also so that why I choose hg method:(

Can you give me the step-by-step for patching surf or dwm,please:(
(I try to patch both surf and dwm but I'm now working on surf)


Sorry for my poor English:O

Offline

#6 2012-03-11 03:15:45

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

Re: [Solved]How to patch dwm?

The ABS method works fine.

There are any number of threads here already with "step-by-step" instructions for patching dwm. I'm sure a quick search will turn one up...


Arch + dwm   •   Mercurial repos  •   Surfraw

Registered Linux User #482438

Offline

#7 2012-03-11 03:17:05

karol
Archivist
Registered: 2009-05-06
Posts: 25,440

Re: [Solved]How to patch dwm?

It would be easier if you told us what patch are you trying to apply.

Offline

#8 2012-03-11 03:26:59

megacyber
Member
Registered: 2011-11-30
Posts: 12

Re: [Solved]How to patch dwm?

Oh sorry:(
I'm trying to appy homepage patch(http://surf.suckless.org/patches/homepage) to surf:(


Sorry for my poor English:O

Offline

#9 2012-03-11 03:30:56

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

Re: [Solved]How to patch dwm?

Are you maintaining a patch set in mercurial? If not, then just follow the instructions on the surf page:

cd surf-directory
patch -p1 < path/to/patch.diff

#edit: the patch is only three lines - it's just as easy to copy it in by hand...

Last edited by jasonwryan (2012-03-11 03:33:56)


Arch + dwm   •   Mercurial repos  •   Surfraw

Registered Linux User #482438

Offline

#10 2012-03-11 03:37:44

karol
Archivist
Registered: 2009-05-06
Posts: 25,440

Re: [Solved]How to patch dwm?

jasonwryan wrote:

#edit: the patch is only three lines - it's just as easy to copy it in by hand...

You also have to edit config.h, otherwise the patch won't work (but surf gets compiled OK anyway).
I've just applied the patch, works as advertised.

Offline

#11 2012-03-11 03:43:17

megacyber
Member
Registered: 2011-11-30
Posts: 12

Re: [Solved]How to patch dwm?

It doesn't work this is an output sad

$ patch -p1 < /home/usrname/surf-0.3-homepage.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 -r dbb565b8d61c surf.c
|--- a/surf.c    Fri Jun 25 09:42:58 2010 +0200
|+++ b/surf.c    Mon Jul 05 21:56:52 2010 +0100
--------------------------
File to patch: surf-X.Y-yourpatchname.diff
patching file surf-X.Y-yourpatchname.diff
Hunk #1 FAILED at 833.
1 out of 1 hunk FAILED -- saving rejects to file surf-X.Y-yourpatchname.diff.rej


Sorry for my poor English:O

Offline

#12 2012-03-11 03:45:11

karol
Archivist
Registered: 2009-05-06
Posts: 25,440

Re: [Solved]How to patch dwm?

Are you applying this patch in the surf directory?

[karol@black surf]$ patch -p1 < ../surf-0.3-homepage.diff 
patching file surf.c
Hunk #1 succeeded at 878 (offset 45 lines).

When pasting code, please use [ code ] tags, not [ quote ] tags https://bbs.archlinux.org/help.php#bbcode

like this

Last edited by karol (2012-03-11 03:46:20)

Offline

#13 2012-03-11 03:46:33

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

Re: [Solved]How to patch dwm?

megacyber wrote:

It doesn't work this is an output sad

can't find file to patch at input line 4
Perhaps you used the wrong -p or --strip option?


Now, when you read the diff file, does that not tell you what file is being patched and where to place the diff in order for it to work?


Arch + dwm   •   Mercurial repos  •   Surfraw

Registered Linux User #482438

Offline

#14 2012-03-11 03:52:28

megacyber
Member
Registered: 2011-11-30
Posts: 12

Re: [Solved]How to patch dwm?

Yes,it ask me for file to patch like the quote below
so I have it patch to surf-X.Y-yourpatchname.diff

File to patch: surf-X.Y-yourpatchname.diff

but it fails:(


Sorry for my poor English:O

Offline

#15 2012-03-11 04:01:51

karol
Archivist
Registered: 2009-05-06
Posts: 25,440

Re: [Solved]How to patch dwm?

Please post the contents of the surf directory.

Offline

#16 2012-03-11 04:27:55

megacyber
Member
Registered: 2011-11-30
Posts: 12

Re: [Solved]How to patch dwm?

Thank you everyone
I patched it now
It fails at first because I put .diff in difference directory i should put it in surf directory

So this's what I do
1. In ter terminal 'hg clone http://hg.suckless.org/surf' (without ' )
2. In the terminal 'cd surf' then edit the config.mk file with my favorite editor find the 'PREFIX' , 'X11INC' and 'X11LIB' then edit to

PREFIX = /usr

X11INC = /usr/include/X11
X11LIB = /usr/lib/X11

3. download .diff file to surf directory I downloaded by command 'wget http://surf.suckless.org/patches/surf-0.3-homepage.diff' but this patch have to add '#define HOMEPAGE "http://google.com" ' to the config.h so I add it to config.def.h because config.haven't existed yet but it will be created from config.def.h
4. In the terminal 'hg diff > thenameyouwant.diff'
5. In ther terminal 'hg patch < surf-0.3-homepage.diff'
6. In the terminal 'sudo make clean install'
Done;)


Sorry for my poor English:O

Offline

Board footer

Powered by FluxBB