haikuports / haikuporter

The tool that builds HaikuPorts recipes.
MIT License
41 stars 44 forks source link

Check for valid source code url and if invalid give error #116

Open scottmc opened 7 years ago

scottmc commented 7 years ago

Right now if you have an invalid source url Haikuporter bails out with a crypic "File Not Found" error. Add a check to see if the url is valid and if not it should bail out with a ""SourceCode URL not valid error".

This can happen if the source code url has a space in it for example: https://downloads.sourceforge.net/joe-editor/joe-$portVersion.tar.gz This has no spaces in it, but when you go to it, you are forwarded to this url: https://sourceforge.net/projects/joe-editor/files/JOE%20sources/joe-4.4/joe-4.4.tar.gz/download

Somewhere along the line that %20 was replaced by a space and then Haikuporter was failing with the File Not found error.

korli commented 7 years ago

The example looks wrong https://sourceforge.net/projects/joe-editor/files/JOE%20sources/joe-4.4/joe-4.4.tar.gz/download is a valid URL, it gets URL-encoded along the redirect, which is OK. The "file not found" about the work directory error is fixed in master.

Please recheck, for 404 URL, this would look like:

Downloading: https://github.com/michaelrsweet/htmldoc/releases/download/release1.8.29/htmldoc-1.8.29-source.tar.bz2 ...
--2017-05-11 03:18:42--  https://github.com/michaelrsweet/htmldoc/releases/download/release1.8.29/htmldoc-1.8.29-source.tar.bz2
Resolving github.com... 192.30.253.112, 192.30.253.113
Connecting to github.com|192.30.253.112|:443... connected.
HTTP request sent, awaiting response... 404 Not Found
2017-05-11 03:18:43 ERROR 404: Not Found.
Warning: Unable to fetch source from https://github.com/michaelrsweet/htmldoc/releases/download/release1.8.29/htmldoc-1.8.29-source.tar.bz2 (error: Command '['wget', '-c', '--timeout=10', '--tries=3', '-O', u'/boot/home/haikuports/app-text/htmldoc/download/htmldoc-1.8.29-source.tar.bz2', u'https://github.com/michaelrsweet/htmldoc/releases/download/release1.8.29/htmldoc-1.8.29-source.tar.bz2']' returned non-zero exit status 8), trying next location.

Downloading: https://ports-mirror.haiku-os.org/htmldoc/htmldoc-1.8.29-source.tar.bz2 ...
--2017-05-11 03:18:43--  https://ports-mirror.haiku-os.org/htmldoc/htmldoc-1.8.29-source.tar.bz2
Resolving ports-mirror.haiku-os.org... 2a01:4f8:190:64c3::2, 78.46.189.196
Connecting to ports-mirror.haiku-os.org|2a01:4f8:190:64c3::2|:443... failed: Network is unreachable.
Connecting to ports-mirror.haiku-os.org|78.46.189.196|:443... connected.
HTTP request sent, awaiting response... 404 Not Found
2017-05-11 03:18:43 ERROR 404: Not Found.
Warning: Unable to fetch source from https://ports-mirror.haiku-os.org/htmldoc/htmldoc-1.8.29-source.tar.bz2 (error: Command '['wget', '-c', '--timeout=10', '--tries=3', '-O', u'/boot/home/haikuports/app-text/htmldoc/download/htmldoc-1.8.29-source.tar.bz2', u'https://ports-mirror.haiku-os.org/htmldoc/htmldoc-1.8.29-source.tar.bz2']' returned non-zero exit status 8)
Error: Failed to fetch source from all known locations.