I was creating an ebuild today which requires the manual download of a package. I had a nice message that would display on src_unpack() which told the users where to go to download the package, and all was well. I was about to upload it here when I noticed that the digest file was zero-length. After playing around with the ebuild a bit more, I found that the only way to get the digest file to contain an accurate digest of the file was to add in the filename to SRC_URI. Unfortunately, when there's anything in the SRC_URI function, Portage will try to download the package, fail, and end with an error message. I tried putting my check for the file in both pkg_setup() and src_unpack(), to no avail. Next, I tried adding 'RESTRICT="fetch"' to the ebuild, but that only displays an uninformative message telling the user to "look at the ebuild for details." So, unless I'm missing something big, you can *either:* 1) Have a digest for the to-be-manually-downloaded file, or 2) Have a nice message to tell the user where to download the file from. Ideally, I'd like to be able to do both. I think that the nicest solution would be to create another user-overrideable function along the lines of src_fetch(), and then ebuild authors could put the necessary messages in there. Or possibly, change the behavior of setting RESTRICT="fetch" so that it executes a src_nofetch() command from tthe ebuild . . . There are probably some other solutions as well. Anyway, what does everyone think?
Created attachment 5429 [details, diff] Diff of /usr/lib/python-2.2/site-packages/portage.py I figured I might as well take a look to see how easy it would be to implement something like this. I'm probably doing a few things wrong here, but this solution does work. If RESTRICT="fetch" is defined in the ebuild, and the distfile is NOT present in /usr/portage/distfiles, it'll execute the function "pkg_nofetch" (if it exists) from the ebuild, wherein the ebuild author can provide a more meaningful error message. This patch I'm attaching now should be applied to /usr/lib/python-2.2/site-packages/portage.py. There's another patch which I'll upload in a second which should be applied to /usr/lib/portage/bin/ebuild.sh.
Created attachment 5430 [details, diff] Diff of /usr/lib/portage/ebuild.sh This patch is for /usr/lib/portage/ebuild.sh. Like I said, simple stuff, but it does work. Let me know what I'm doing wrong. :)
ebuild.sh now supports pkg_nofetch