Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
ebuild: SRC_URI with patches
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Portage & Programming
View previous topic :: View next topic  
Author Message
bpoint
Tux's lil' helper
Tux's lil' helper


Joined: 07 Oct 2008
Posts: 75
Location: Japan

PostPosted: Sun Apr 07, 2013 3:55 pm    Post subject: ebuild: SRC_URI with patches Reply with quote

Hello all,

This is my first time writing my own ebuild, so please bear with my noobyness. :)

I'm attempting to patch an older ebuild which is no longer in portage, and have pulled a copy of it from the Portage attic to a local overlay. The source needs to be patched before it is compiled though, and I am able to have the patch downloaded by adding it to the end of the SRC_URI line, like so:

Code:
SRC_URI="x86? ( http://us.download.nvidia.com/XFree86/Linux-x86/${PV}/${X86_NV_PACKAGE}.run )
    amd64? ( http://us.download.nvidia.com/XFree86/Linux-x86_64/${PV}/${AMD64_NV_PACKAGE}.run )
    amd64-fbsd? ( http://us.download.nvidia.com/XFree86/FreeBSD-x86_64/${PV}/${AMD64_FBSD_NV_PACKAGE}.tar.gz )
    x86-fbsd? ( http://us.download.nvidia.com/XFree86/FreeBSD-x86/${PV}/${X86_FBSD_NV_PACKAGE}.tar.gz )
    http://cvs.rpmfusion.org/viewvc/%2Acheckout%2A/rpms/nvidia-kmod/devel/3.6_kernel.patch?root=nonfree -> ${P}-3.6_kernel.patch"


The fetch stage proceeds fine, but when the source is unpacked, ebuild attempts to use a combination of both the source and the patch filename, causing it to fail:

Code:
pikachu nvidia-drivers # ebuild nvidia-drivers-295.59.ebuild compile
 * NVIDIA-Linux-x86_64-295.59.run SHA256 SHA512 WHIRLPOOL size ;-) ...                                                       [ ok ]
 * nvidia-drivers-295.59-3.6_kernel.patch SHA256 SHA512 WHIRLPOOL size ;-) ...                                               [ ok ]
 * checking ebuild checksums ;-) ...                                                                                         [ ok ]
 * Determining the location of the kernel source code
 * Found kernel source directory:
 *     /usr/src/linux
 * Found kernel object directory:
 *     /lib/modules/3.6.11-gentoo-r2/build
 * Found sources for kernel version:
 *     3.6.11-gentoo-r2
 * Checking for MTRR support ...                                                                                             [ ok ]
>>> Unpacking source...
 * ERROR: x11-drivers/nvidia-drivers-295.59 failed (unpack phase):
 *   Could not locate source for 'NVIDIA-Linux-x86_64-295.59.run nvidia-drivers-295.59-3.6_kernel.patch'
 *
 * Call stack:
 *     ebuild.sh, line   93:  Called src_unpack
 *   environment, line 4157:  Called unpack_makeself
 *   environment, line 4782:  Called die
 * The specific snippet of code:
 *       [[ -z ${src} ]] && die "Could not locate source for '${src_input}'";
 *
 * If you need support, post the output of `emerge --info '=x11-drivers/nvidia-drivers-295.59'`,
 * the complete build log and the output of `emerge -pqv '=x11-drivers/nvidia-drivers-295.59'`.
 * This ebuild is from an overlay named 'pikachu': '/usr/portage-overlay/pikachu/'
 * The complete build log is located at '/var/tmp/portage/x11-drivers/nvidia-drivers-295.59/temp/build.log'.
 * The ebuild environment file is located at '/var/tmp/portage/x11-drivers/nvidia-drivers-295.59/temp/environment'.
 * Working directory: '/var/tmp/portage/x11-drivers/nvidia-drivers-295.59/work'
 * S: '/var/tmp/portage/x11-drivers/nvidia-drivers-295.59/work/'


Could anyone give me a hint on what I might be doing wrong here? Is there a different way to specify patches so they aren't combined into the source filename?

Thanks for any suggestions!
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 31365
Location: 56N 3W

PostPosted: Sun Apr 07, 2013 7:38 pm    Post subject: Reply with quote

bpoint,

Put the patch file(s) into the x11-drivers/nvidia-drivers/files directory with the file name <something>.patch
They need not be in the source URI.

Call epatch in the ebuild to apply the patch - once per patch.

Look at other ebuilds to see how its done.

Some ebuilds call userpatch (thats probably not the name) that allows random patches to br dropped into for example
/etc/portage/patches/x11-drivers/nvidia-drivers-313.18/kernel-3.8.0.patch
Thats a real working example as 313.18 would not build against the 3.8.0 kernel.
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
Hu
Watchman
Watchman


Joined: 06 Mar 2007
Posts: 8602

PostPosted: Sun Apr 07, 2013 7:55 pm    Post subject: Reply with quote

NeddySeagoon wrote:
Some ebuilds call userpatch (thats probably not the name) that allows random patches to br dropped into for example
The usage example sounds like you were thinking of epatch_user, which requires that the ebuild inherit eutils to obtain the definition.
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 31365
Location: 56N 3W

PostPosted: Sun Apr 07, 2013 8:14 pm    Post subject: Reply with quote

Hu,

Thank you.
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
bpoint
Tux's lil' helper
Tux's lil' helper


Joined: 07 Oct 2008
Posts: 75
Location: Japan

PostPosted: Mon Apr 08, 2013 5:43 am    Post subject: Reply with quote

Ah, I see. My intent was to fetch the patch from a remote server and streamline it in at build time, but I guess having a local copy might be better in the long run (URLs might change, etc).

It's working now, thanks for the help!
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Portage & Programming All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum