Date: Mon, 21 Oct 2019 21:57:42 -0500 From: "Clay Daniels Jr." <clay.daniels.jr@gmail.com> To: Yasuhiro KIMURA <yasu@utahime.org> Cc: "freebsd-questions@freebsd.org" <freebsd-questions@freebsd.org> Subject: Re: How to apply a patch to a port Message-ID: <CAGLDxTWYYCwmO67EVioriNO_QZB5U8zXQwM-mCzOPgapPk6opQ@mail.gmail.com> In-Reply-To: <20191022.090814.157299176887147047.yasu@utahime.org> References: <CAGLDxTW8VCjfKGAEp9b1gn_==XsxRjSizvRbiw%2BTkzRgt49hDA@mail.gmail.com> <20191022.053926.1076439053946694541.yasu@utahime.org> <9ac08912-0415-0830-9381-6df157fe6ab1@gmail.com> <20191022.090814.157299176887147047.yasu@utahime.org>
next in thread | previous in thread | raw e-mail | index | archive | help
Thanks Yasuhiro. My patch file is a text file named patch-linuxkpi_gplv2_src_linux__page.c with this content: diff --git a/linuxkpi/gplv2/src/linux_page.c b/linuxkpi/gplv2/src/linux_page.c index e2b85c45c..060ae85ed 100644 --- a/linuxkpi/gplv2/src/linux_page.c +++ b/linuxkpi/gplv2/src/linux_page.c @@ -239,7 +239,7 @@ retry: page = vm_page_lookup(devobj, i); if (page == NULL) continue; - if (vm_page_sleep_if_busy(page, "linuxkpi")) + if (!vm_page_busy_acquire(page, VM_ALLOC_WAITFAIL)) goto retry; cdev_pager_free_page(devobj, page); } I copied it, as root, from my thumbdrive to a /root/files directory I created. Then i went to the main port directory for drm-current-kmod, ran make patch, which did a lot of activity and created a /work/kms-drm-2d2852e directory, where I tried to run: patch -p 1 -s -i /root/files/patch-linuxkpi_gplv2_src_linux__page.c It said 1 of 1 hunks failed - saving rejects... Then I changed it to say -p 1, ran that and it asks: "File to patch:" I answered linux_page.c because I could not think of anything else, but the file was not found. There are a lot of files created by the "make patch" command and I'm looking through them now, though I'm not really sure what I'm looking for. Between our emails, I discovered the FreeBSD Porter's Handbook and it has a lot of info I need to read. Of course I want to get this one patch installed, but most importantly I want to know how to do it again, and understand what I'm doing. By Friday there will be another snapshot, and this patch will not be necessary I hope. For now I will retire to my reading the Porter's Handbook. Thanks so much, Yasuhiro. Clay On Mon, Oct 21, 2019 at 7:09 PM Yasuhiro KIMURA <yasu@utahime.org> wrote: > From: Clay Daniels <clay.daniels.jr@gmail.com> > 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 > _______________________________________________ > freebsd-questions@freebsd.org mailing list > https://lists.freebsd.org/mailman/listinfo/freebsd-questions > To unsubscribe, send any mail to " > freebsd-questions-unsubscribe@freebsd.org" >
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAGLDxTWYYCwmO67EVioriNO_QZB5U8zXQwM-mCzOPgapPk6opQ>