Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Latest version of phantomjs not available for OS... #25

Closed
davidjeddy opened this issue Dec 21, 2015 · 8 comments
Closed

Latest version of phantomjs not available for OS... #25

davidjeddy opened this issue Dec 21, 2015 · 8 comments

Comments

@davidjeddy
Copy link

CentOS release 6.7 (Final) x64

Logic does a good job of detecting the OS and the most recent stable release of phantomjs. However, there is no stable release at the current version for the OS detected.

 [Composer\Downloader\TransportException]                                                                                                          
  The "https://bitbucket.org/ariya/phantomjs/downloads/phantomjs-2.0.0-linux-x86_64.tar.bz2" file could not be downloaded (HTTP/1.1 404 NOT FOUND)

...per https://bitbucket.org/ariya/phantomjs/downloads/

Solution: if the request returns anything other than status 200, tick down one version and try again but no go below the lowest supported version.

@jakoch
Copy link
Owner

jakoch commented Dec 21, 2015

Hey David,

yes, its a know issue, see #12.

Your solution of automatically re-trying the download while lowering the version number
is a great idea. I wonder why nobody came up with that, yet. Thank you.

Ok, lets see how we could implement that:

  • we need an array for versions, ordering high to low
  • the retry is based on the return value of the Composer Downloader
  • foreach versions as version - download()
    • if download failed, message (download not found) and continue
    • else return

Did i mess up? Suggestions welcome..

@jakoch
Copy link
Owner

jakoch commented Dec 21, 2015

Follow up:

if i extend that idea a bit, we could re-try the same version, but use a fallback URL, right?
That would address #24

  • 1th try: 2.0.0 - original download source
  • 2nd try: 2.0.0 - eugene or vitalliums source
  • if failing, go lower... 1.9.8

And then we get into trouble, because it seems that the custom releases have a different folder structure... binary in /bin folder. We need to apply that fix, too.

@jakoch
Copy link
Owner

jakoch commented Dec 22, 2015

Ok, i checked the Composer Downloader API. doDownload() returns the $filename.

https://github.com/composer/composer/blob/master/src/Composer/Downloader/FileDownloader.php#L172

@davidjeddy
Copy link
Author

Personally, I would not depend on the custom releases for a production system. IE if your goal for phantom is to be at the level of, for example, Selenium go with the source teams releases.

Try for current version, if failed step back 0.1.0 and try for the next oldest version.

This is my personal opinion of course.

@davidjeddy
Copy link
Author

Any movement on this?

@jakoch
Copy link
Owner

jakoch commented Jan 23, 2016

Ok, i've implemented download retrying with lowering the version numbers.

The call to Composer\DownloadManager->download() is now wrapped in a while loop.
The inital while expression is the number of phantomjs versions,
which is basically the maximum number of download retries.
The phantomjs versions are hardcoded in static function getPhantomJsVersions().
When the download succeeds, we simply break out of the try/catch.
But, if a Composer\Downloader\TransportException with HttpStatusCode 404 happens,
we get the next lower version from the versions array with getLowerVersion() and
init a new in-memory-package (with that lower version and url) ... and try again.

Not sure, if that will work out :) But its alive on dev-master and needs testing and feedback.
All bugfixes welcome.

I would not depend on the custom releases for a production system.

I'm trying to avoid adding custom release URLs and would love to see official releases getting back on track.

Best, Jens

@davidjeddy
Copy link
Author

Almost...

[163.0MB/87.10s]     Downloading: Connecting...[163.1MB/87.41s] Script PhantomInstaller\Installer::installPhantomJS handling the post-update-cmd event terminated with an exception


  [Composer\Downloader\TransportException]                                                                                                          
  The "https://bitbucket.org/ariya/phantomjs/downloads/phantomjs-2.0.0-linux-x86_64.tar.bz2" file could not be downloaded (HTTP/1.1 404 NOT FOUND)  

@jakoch
Copy link
Owner

jakoch commented Jan 27, 2016

The alias wasn't properly detected, when using
dev-master#commit-ref as <version> or dev-master as <version>.
I've added a test case and some commits on top to fix this issue.

You may find an example composer.json for triggering a "2.0.0" to "1.9.8" tickdown here:
https://github.com/jakoch/phantomjs-installer/blob/master/tests/example-v2.0.0-v1.9.8/composer.json

Referencing the version lowering on the PHP7 branch from this build matrix.

Please give me a little feedback, if its also working on your side.
Thanks, Jens

@jakoch jakoch closed this as completed Jan 29, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants