Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 10 Jul 2013 07:37:12 -0500
From:      Jimmy Kelley <ljboiler@gmail.com>
To:        freebsd-ports@freebsd.org
Subject:   Re: order of patches under ports/xxx/zzz/files
Message-ID:  <20130710123712.GA12775@jmobile.jimmy.localnet>

next in thread | raw e-mail | index | archive | help

In article <mailpost.1373447036.2906182.1611.mailing.freebsd.ports@FreeBSD.cs.nctu.edu.tw> you wrote:
> I'm trying to understand exactly how the patches
> located in files directory in a port apply.
> For example, port math/metis-edf has under files:
> 
> # ls files/
> medis-patch-Lib_Makefile.txt    patch-Lib::proto.h              patch-Test::Makefile
> patch-CONFIG::configure         patch-Lib_Makefile              patch-onmetis
> patch-CONFIG_onmetis.in         patch-Programs::Makefile
> # 
> 
> Patch medis-patch-Lib_Makefile.txt must be applied
> on top of patch-Lib_Makefile. This does seem to
> work, but what process makes sure that the order
> of patch application is exactly that.
> 
> I can see that it works manually:
> 
> # cd ./work/metis-edf-4.1/
> /usr/ports/math/metis-edf/work/metis-edf-4.1
> # patch < ../../files/patch-Lib_Makefile 
> Hmm...  Looks like a unified diff to me...
> The text leading up to this was:
> --------------------------
> |--- Lib/Makefile.orig  2008-12-03 11:08:03.000000000 +0100
> |+++ Lib/Makefile       2010-05-16 16:33:40.000000000 +0200
> --------------------------
> Patching file Lib/Makefile using Plan A...
> Hunk #1 succeeded at 2.
> Hunk #2 succeeded at 22.
> done
> # patch < ../../files/medis-patch-Lib_Makefile.txt 
> Hmm...  Looks like a unified diff to me...
> The text leading up to this was:
> --------------------------
> |--- Lib/Makefile.intermediate  2013-03-22 20:40:34.429173000 +0000
> |+++ Lib/Makefile
> --------------------------
> Patching file Lib/Makefile using Plan A...
> Hunk #1 succeeded at 22.
> done
> # 
> 
> and that applying the second patch directly does not
> work:
> 
> # cd ../..
> # make clean extract
> ===>  Cleaning for metis-edf-4.1.2_3
> ===>   metis-edf-4.1.2_3 depends on file: /usr/local/sbin/pkg - found
> ===> Fetching all distfiles required by metis-edf-4.1.2_3 for building
> ===>  Extracting for metis-edf-4.1.2_3
> => SHA256 Checksum OK for aster-full-src-10.8.0-3.noarch.tar.gz.
> (cd /usr/ports/math/metis-edf/work &&    /usr/bin/tar -xf /usr/ports/math/metis-edf/work/aster-full-src-10.8.0/SRC/metis-edf-4.1-2.noarch.tar.gz --no-same-owner --no-same-permissions)
> # cd work/metis-edf-4.1/
> # patch < ../../files/medis-patch-Lib_Makefile.txt
> Hmm...  Looks like a unified diff to me...
> The text leading up to this was:
> --------------------------
> |--- Lib/Makefile.intermediate  2013-03-22 20:40:34.429173000 +0000
> |+++ Lib/Makefile
> --------------------------
> Patching file Lib/Makefile using Plan A...
> Hunk #1 failed at 22.
> 1 out of 1 hunks failed--saving rejects to Lib/Makefile.rej
> done
> # 
> 
> But how does the ports environment know the order
> of patch application?
> 
> Thanks
> 
> Anton
> 
> _______________________________________________
> freebsd-ports@freebsd.org mailing list
> http://lists.freebsd.org/mailman/listinfo/freebsd-ports
> To unsubscribe, send any mail to "freebsd-ports-unsubscribe@freebsd.org"
> 

The application of patches in a ports "files" directory is done with a for-loop of
all files named patch-* (see /usr/ports/Mk/bsd.port.mk), so I imagine the file names
would be sorted alphabetically by the wildcard.  It is not required, but each
patch file generally is meant to patch a specific source file, and the individual
sections of a patch file are applied in the order that they appear.  If your
new patch just adds to the existing patch, you could just concatenate it to the
end of the existing patch file, and the patch command will handle the ordering.

Jimmy 




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20130710123712.GA12775>