From owner-freebsd-questions@freebsd.org Tue Oct 22 00:09:27 2019 Return-Path: Delivered-To: freebsd-questions@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id AA4A6165977 for ; Tue, 22 Oct 2019 00:09:27 +0000 (UTC) (envelope-from yasu@utahime.org) Received: from gate.utahime.jp (gate.utahime.jp [183.180.29.210]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 46xv522vXFz43m4 for ; Tue, 22 Oct 2019 00:09:26 +0000 (UTC) (envelope-from yasu@utahime.org) Received: from eastasia.home.utahime.org (eastasia.home.utahime.org [192.168.174.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by gate.utahime.jp (Postfix) with ESMTPS id D990417CB8 for ; Tue, 22 Oct 2019 09:09:21 +0900 (JST) Received: from localhost (rolling.home.utahime.org [192.168.174.11]) (using TLSv1.3 with cipher TLS_CHACHA20_POLY1305_SHA256 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by eastasia.home.utahime.org (Postfix) with ESMTPSA id 17F934D00E; Tue, 22 Oct 2019 09:09:21 +0900 (JST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.102.0-rc at eastasia.home.utahime.org Date: Tue, 22 Oct 2019 09:08:14 +0900 (JST) Message-Id: <20191022.090814.157299176887147047.yasu@utahime.org> To: freebsd-questions@freebsd.org Subject: Re: How to apply a patch to a port From: Yasuhiro KIMURA In-Reply-To: <9ac08912-0415-0830-9381-6df157fe6ab1@gmail.com> References: <20191022.053926.1076439053946694541.yasu@utahime.org> <9ac08912-0415-0830-9381-6df157fe6ab1@gmail.com> X-Mailer: Mew version 6.8 on Emacs 26.3 Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: 46xv522vXFz43m4 X-Spamd-Bar: / Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=none; spf=pass (mx1.freebsd.org: domain of yasu@utahime.org designates 183.180.29.210 as permitted sender) smtp.mailfrom=yasu@utahime.org X-Spamd-Result: default: False [-0.02 / 15.00]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; NEURAL_HAM_MEDIUM(-0.85)[-0.847,0]; FROM_HAS_DN(0.00)[]; R_SPF_ALLOW(-0.20)[+a:spf-authorized.utahime.org]; TO_MATCH_ENVRCPT_ALL(0.00)[]; MIME_GOOD(-0.10)[text/plain]; TO_DN_NONE(0.00)[]; PREVIOUSLY_DELIVERED(0.00)[freebsd-questions@freebsd.org]; RCPT_COUNT_ONE(0.00)[1]; NEURAL_HAM_LONG(-0.69)[-0.689,0]; RCVD_COUNT_THREE(0.00)[3]; DMARC_NA(0.00)[utahime.org]; MV_CASE(0.50)[]; MID_CONTAINS_FROM(1.00)[]; IP_SCORE(0.32)[ip: (0.21), ipnet: 183.180.0.0/16(0.10), asn: 2519(1.29), country: JP(-0.00)]; FROM_EQ_ENVFROM(0.00)[]; R_DKIM_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; ASN(0.00)[asn:2519, ipnet:183.180.0.0/16, country:JP]; RCVD_TLS_ALL(0.00)[] X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 22 Oct 2019 00:09:27 -0000 From: Clay Daniels Subject: Re: How to apply a patch to a port Date: Mon, 21 Oct 2019 18:21:19 -0500 >> 1. cd /usr/ports/graphics/drm-current-kmod > OK, but should my patch file be here, or do I need to make a /files > subdirectory and put it there? Patch file should be put somewhere out of ports tree. And you don't have to create files subdirectory because it will be created at step 6. >> 2. make patch >> 3. cd work/kms-drm-2d2852e >> 4. patch -p 0 -s -i >> /path/to/patch/patch-linuxkpi_gplv2_src_linux__page.c >> (You may need to change '-p 0' to '-p 1' or '-p 2' or ...) >> 5. cd ../.. >> 6. make makepatch >> 7. make clean >> >> Then new patch file is created under files subdirectory. > > Then change back to main port directory & run make install (clean) for > the whole port, right? Yes. And in fact, if you succeeded to apply patch with '-p 0' in step 4, then you don't have to follow above procedure. Instead take following steps. 1. cd /usr/ports/graphics/drm-current-kmod 2'. mkdir files 3'. cp /path/to/patch/patch-linuxkpi_gplv2_src_linux__page.c files Then 'make install' should work. The reason that I recommended first procedure is that there are some different patch formats. If the patch is created by 'diff' or 'svn diff' then it can be applied with 'patch -p 0'. So you can use second procedure. But if it is created by 'git diff' or 'git format-patch' then it need to be applied with 'patch -p 1'. In this case you can't use second one. I don't know how your patch is created. So I recommended one that can be used everytime. --- Yasuhiro KIMURA