From owner-freebsd-questions@FreeBSD.ORG Mon Nov 12 15:27:48 2007 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E437C16A473 for ; Mon, 12 Nov 2007 15:27:48 +0000 (UTC) (envelope-from M.Apitz@oclcpica.org) Received: from mail.pica.nl (mail.pica.nl [192.87.44.30]) by mx1.freebsd.org (Postfix) with ESMTP id 7B57313C494 for ; Mon, 12 Nov 2007 15:27:47 +0000 (UTC) (envelope-from M.Apitz@oclcpica.org) Received: from rebelion.Sisis.de ([193.31.10.34]) by mail.pica.nl with Microsoft SMTPSVC(6.0.3790.3959); Mon, 12 Nov 2007 16:27:28 +0100 Received: (from guru@localhost) by rebelion.Sisis.de (8.13.8/8.13.8/Submit) id lACFQ62d013462; Mon, 12 Nov 2007 16:26:06 +0100 (CET) (envelope-from m.apitz@oclcpica.org) X-Authentication-Warning: rebelion.Sisis.de: guru set sender to m.apitz@oclcpica.org using -f Date: Mon, 12 Nov 2007 16:26:06 +0100 From: Matthias Apitz To: Giorgos Keramidas Message-ID: <20071112152606.GA13290@rebelion.Sisis.de> References: <20071111150251.GA15448@rebelion.Sisis.de> <20071111171755.GC3038@kobe.laptop> Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20071111171755.GC3038@kobe.laptop> User-Agent: Mutt/1.4.2.2i X-Operating-System: FreeBSD 6.2-RELEASE (i386) X-OriginalArrivalTime: 12 Nov 2007 15:27:28.0162 (UTC) FILETIME=[88B2E820:01C82540] Cc: freebsd-questions@freebsd.org Subject: Re: problems with building a patch X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: Matthias Apitz List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 12 Nov 2007 15:27:49 -0000 El día Sunday, November 11, 2007 a las 07:17:55PM +0200, Giorgos Keramidas escribió: > On 2007-11-11 16:02, Matthias Apitz wrote: > > > > Hello, > > > > I've build a patch for 'nn-6.7.3' to add support for RFC1522 to my > > beloved news-reader. Before giving it away I was trying it on a fresh > > workspace of the /usr/ports/news/nn and run into the problem that > > new files which brings the patch to the tree are always created > > in the current working dir, even if I create them before with touch(1), > > existing files, like 'answer.c' in the example below, get patched > > correctly: > > > > $ /usr/ports/news/nn/work > > $ touch nn-6.7.3/PATCH.RFC1522 > > $ patch < ../myRFC1522.patch > > Hmm... Looks like a unified diff to me... > > The text leading up to this was: > > -------------------------- > > |diff -N -r -u -X exclude nn-6.7.3/PATCH.RFC1522 nn-6.7.3.patched/PATCH.RFC1522 > > |--- nn-6.7.3/PATCH.RFC1522 Thu Jan 1 01:00:00 1970 > > |+++ nn-6.7.3.patched/PATCH.RFC1522 Sat Nov 10 11:04:58 2007 > > -------------------------- > > Here's the problem. > > The patch files for ports should *not* include the `nn-6.7.3' part, like > this one. They should be relative to the toplevel directory of the > unzipped/untarred port, i.e.: > > diff -N -u PATCH.RFC1522.orig PATCH.RFC1522 > --- PATCH.RFC1522.orig Thu Jan 1 01:00:00 1970 > +++ PATCH.RFC1522 Sat Nov 10 11:04:58 2007 After a lot of tests I've found the solution: I'm creating the patch with: $ diff -Naur -X exclude nn-6.7.3 nn-6.7.3.patched > diff while having in 'nn-6.7.3' a 'make clean' version of the original tree and in 'nn-6.7.3.patched' a 'make clean' version of my modified source tree; the exclude file just says: $ cat exclude *.orig i.e. excludes the files *.orig which I also have in 'nn-6.7.3'; the trick is applying the patch as: $ cd /usr/ports/news/nn/work $ patch -p0 < ../.mywork/diff i.e. using the -p0; without -p0 the new files end up in the current directory, while with -p0 they get created in the right place. I've read the man page of patch again and again; it explains the function of -pN but not this effect :-( matthias -- Matthias Apitz