CocoaPods / cocoapods-downloader

A small library that provides downloaders for various source types (HTTP/SVN/Git/Mercurial)
MIT License
84 stars 71 forks source link

Error downloading pod using nexus proxy with cdn remote #100

Open guyyosan opened 4 years ago

guyyosan commented 4 years ago

Feature Request: sonatype nexus cocoapods repo is sometimes not providing file type when downloading, maybe cocoapods can figure it out if from the :http request? some info

Analyzing dependencies

Inspecting targets to integrate Using ARCHS setting to build architectures of target Pods-podtest: (``)

Resolving dependencies of Podfile CDN: 200-repository-cocoapods-cache Relative path: CocoaPods-version.yml exists! Returning local because checking is only perfomed in repo update CDN: cocoapods- Relative path: CocoaPods-version.yml exists! Returning local because checking is only perfomed in repo update CDN: 200-repository-cocoapods-cache Relative path: all_pods_versions_9_c_c.txt exists! Returning local because checking is only perfomed in repo update CDN: 200-repository-cocoapods-cache Relative path: Specs/9/c/c/AppLovinSDK/6.12.8/AppLovinSDK.podspec.json exists! Returning local because checking is only perfomed in repo update CDN: 200-repository-cocoapods-cache Relative path: Specs/9/c/c/AppLovinSDK/6.12.4/AppLovinSDK.podspec.json exists! Returning local because checking is only perfomed in repo update

Comparing resolved specification to the sandbox manifest A AppLovinSDK

Downloading dependencies

-> Installing AppLovinSDK (6.12.4) my comment - download target: /var/folders/43/cnq_n_r130l9cmgh27r8kyvw0000gp/T/d20200602-18863-sig1kl my comment - download params: {:http=>"https://192.168.200.39:8443/repository/cocoapods-cache/pods/AppLovinSDK/6.12.4/https/bintray.com/applovin/iOS/download_file?file_path=applovin-ios-sdk-6.12.4.zip"}

Http download my comment type is:

[!] Error installing AppLovinSDK

Command

/Users/guym/.rvm/gems/ruby-2.4.0/bin/pod install --verbose

Report

Stack

   CocoaPods : 1.7.2
        Ruby : ruby 2.4.0p0 (2016-12-24 revision 57164) [x86_64-darwin18]
    RubyGems : 2.7.9
        Host : Mac OS X 10.15.1 (19B88)
       Xcode : 11.3 (11C29)
         Git : git version 2.25.0
Ruby lib dir : /Users/guym/.rvm/rubies/ruby-2.4.0/lib
Repositories :
               amazonaws-v1-repos-cocoapods - https://git-codecommit.us-east-1.amazonaws.com/v1/repos/CocoaPods @ 26f1dcf0c42a348c7ffa5c9ebc6a267a1f098a09

               vungle - https://github.com/Vungle/ios-sdk-beta.git @ b9d4955a563e402a8bf73b51f334605c99594152

Plugins

cocoapods-deintegrate : 1.0.4
cocoapods-plugins     : 1.0.0
cocoapods-search      : 1.0.0
cocoapods-stats       : 1.1.0
cocoapods-trunk       : 1.5.0
cocoapods-try         : 1.2.0

Podfile

# Uncomment the next line to define a global platform for your project
# platform :ios, '9.0'

source 'https://192.168.200.39:8443/repository/cocoapods-cache/'

target 'podtest' do
  # Uncomment the next line if you're using Swift or would like to use dynamic frameworks
  # use_frameworks!

  # Pods for podtest
  pod 'AppLovinSDK', '6.12.4'
end

Error

Pod::Downloader::RemoteFile::UnsupportedFileTypeError - Unsupported file type:
/Users/guym/.rvm/gems/ruby-2.4.0/gems/cocoapods-downloader-1.3.0/lib/cocoapods-downloader/remote_file.rb:83:in `filename_with_type'
/Users/guym/.rvm/gems/ruby-2.4.0/gems/cocoapods-downloader-1.3.0/lib/cocoapods-downloader/remote_file.rb:24:in `download!'
/Users/guym/.rvm/gems/ruby-2.4.0/gems/cocoapods-downloader-1.3.0/lib/cocoapods-downloader/base.rb:82:in `block in download'
/Users/guym/.rvm/gems/ruby-2.4.0/gems/cocoapods-1.7.2/lib/cocoapods/downloader.rb:159:in `block in ui_action'
/Users/guym/.rvm/gems/ruby-2.4.0/gems/cocoapods-1.7.2/lib/cocoapods/user_interface.rb:64:in `section'
/Users/guym/.rvm/gems/ruby-2.4.0/gems/cocoapods-1.7.2/lib/cocoapods/downloader.rb:158:in `ui_action'
/Users/guym/.rvm/gems/ruby-2.4.0/gems/cocoapods-downloader-1.3.0/lib/cocoapods-downloader/base.rb:80:in `download'
/Users/guym/.rvm/gems/ruby-2.4.0/gems/cocoapods-1.7.2/lib/cocoapods/downloader.rb:110:in `download_source'
/Users/guym/.rvm/gems/ruby-2.4.0/gems/cocoapods-1.7.2/lib/cocoapods/downloader.rb:75:in `download_request'
/Users/guym/.rvm/gems/ruby-2.4.0/gems/cocoapods-1.7.2/lib/cocoapods/downloader/cache.rb:171:in `download'
/Users/guym/.rvm/gems/ruby-2.4.0/gems/cocoapods-1.7.2/lib/cocoapods/downloader/cache.rb:154:in `block in uncached_pod'
/Users/guym/.rvm/gems/ruby-2.4.0/gems/cocoapods-1.7.2/lib/cocoapods/downloader/cache.rb:181:in `in_tmpdir'
/Users/guym/.rvm/gems/ruby-2.4.0/gems/cocoapods-1.7.2/lib/cocoapods/downloader/cache.rb:153:in `uncached_pod'
/Users/guym/.rvm/gems/ruby-2.4.0/gems/cocoapods-1.7.2/lib/cocoapods/downloader/cache.rb:33:in `download_pod'
/Users/guym/.rvm/gems/ruby-2.4.0/gems/cocoapods-1.7.2/lib/cocoapods/downloader.rb:42:in `download'
/Users/guym/.rvm/gems/ruby-2.4.0/gems/cocoapods-1.7.2/lib/cocoapods/installer/pod_source_installer.rb:109:in `download_source'
/Users/guym/.rvm/gems/ruby-2.4.0/gems/cocoapods-1.7.2/lib/cocoapods/installer/pod_source_installer.rb:62:in `install!'
/Users/guym/.rvm/gems/ruby-2.4.0/gems/cocoapods-1.7.2/lib/cocoapods/installer.rb:545:in `install_source_of_pod'
/Users/guym/.rvm/gems/ruby-2.4.0/gems/cocoapods-1.7.2/lib/cocoapods/installer.rb:496:in `block (2 levels) in install_pod_sources'
/Users/guym/.rvm/gems/ruby-2.4.0/gems/cocoapods-1.7.2/lib/cocoapods/user_interface.rb:86:in `titled_section'
/Users/guym/.rvm/gems/ruby-2.4.0/gems/cocoapods-1.7.2/lib/cocoapods/installer.rb:495:in `block in install_pod_sources'
/Users/guym/.rvm/gems/ruby-2.4.0/gems/cocoapods-1.7.2/lib/cocoapods/installer.rb:478:in `each'
/Users/guym/.rvm/gems/ruby-2.4.0/gems/cocoapods-1.7.2/lib/cocoapods/installer.rb:478:in `install_pod_sources'
/Users/guym/.rvm/gems/ruby-2.4.0/gems/cocoapods-1.7.2/lib/cocoapods/installer.rb:235:in `block in download_dependencies'
/Users/guym/.rvm/gems/ruby-2.4.0/gems/cocoapods-1.7.2/lib/cocoapods/user_interface.rb:64:in `section'
/Users/guym/.rvm/gems/ruby-2.4.0/gems/cocoapods-1.7.2/lib/cocoapods/installer.rb:234:in `download_dependencies'
/Users/guym/.rvm/gems/ruby-2.4.0/gems/cocoapods-1.7.2/lib/cocoapods/installer.rb:157:in `install!'
/Users/guym/.rvm/gems/ruby-2.4.0/gems/cocoapods-1.7.2/lib/cocoapods/command/install.rb:51:in `run'
/Users/guym/.rvm/gems/ruby-2.4.0/gems/claide-1.0.3/lib/claide/command.rb:334:in `run'
/Users/guym/.rvm/gems/ruby-2.4.0/gems/cocoapods-1.7.2/lib/cocoapods/command.rb:52:in `run'
/Users/guym/.rvm/gems/ruby-2.4.0/gems/cocoapods-1.7.2/bin/pod:55:in `<top (required)>'
/Users/guym/.rvm/gems/ruby-2.4.0/bin/pod:23:in `load'
/Users/guym/.rvm/gems/ruby-2.4.0/bin/pod:23:in `<main>'
/Users/guym/.rvm/gems/ruby-2.4.0/bin/ruby_executable_hooks:24:in `eval'
/Users/guym/.rvm/gems/ruby-2.4.0/bin/ruby_executable_hooks:24:in `<main>'
guyyosan commented 4 years ago

The following ugly hack works:

/Users/guym/.rvm/gems/ruby-2.4.0/gems/cocoapods-1.7.2/lib/cocoapods/downloader.rb


105     def self.download_source(target, params)
106       puts("download target: #{target}")
107       params[:type] = File.extname(URI.parse(params[:http].gsub("?", "/").gsub("=", "/")).path).gsub(".", "").to_sym
dnkoutso commented 4 years ago

Please update to CocoaPods 1.9.3 and try again via gem update cocoapods.

dnkoutso commented 4 years ago

Also if you want to keep 1.7.2 of CocoaPods then try updating cocoapods-downloader via gem update cocoapods-downloader.

guyyosan commented 4 years ago

sure. here: ✔  pod install Analyzing dependencies Downloading dependencies Installing AWSCore (2.12.2) lolol first type tgz lololguy type is: tgz Installing AWSKinesis (2.12.2) lolol first type tgz lololguy type is: tgz Installing AppLovinSDK (6.12.4) lolol first type lololguy type is:

[!] Error installing AppLovinSDK

――― MARKDOWN TEMPLATE ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――――

Command

/Users/guym/.rvm/gems/ruby-2.4.0/bin/pod install

Report

Stack

   CocoaPods : 1.9.3
        Ruby : ruby 2.4.0p0 (2016-12-24 revision 57164) [x86_64-darwin18]
    RubyGems : 2.7.9
        Host : Mac OS X 10.15.1 (19B88)
       Xcode : 11.3 (11C29)
         Git : git version 2.25.0
Ruby lib dir : /Users/guym/.rvm/rubies/ruby-2.4.0/lib
Repositories : 200-repository-cocoapods-cache - CDN - https://192.168.200.39:8443/repository/cocoapods-cache/
               amazonaws-v1-repos-cocoapods - git - https://git-codecommit.us-east-1.amazonaws.com/v1/repos/CocoaPods @ 26f1dcf0c42a348c7ffa5c9ebc6a267a1f098a09

               cocoapods- - CDN - https://cdn.cocoapods.org/
               vungle - git - https://github.com/Vungle/ios-sdk-beta.git @ b9d4955a563e402a8bf73b51f334605c99594152

Plugins

cocoapods-deintegrate : 1.0.4
cocoapods-plugins     : 1.0.0
cocoapods-search      : 1.0.0
cocoapods-stats       : 1.1.0
cocoapods-trunk       : 1.5.0
cocoapods-try         : 1.2.0

Podfile

# Uncomment the next line to define a global platform for your project
# platform :ios, '9.0'

source 'https://192.168.200.39:8443/repository/cocoapods-cache/'

target 'podtest' do
  # Uncomment the next line if you're using Swift or would like to use dynamic frameworks
  # use_frameworks!

  # Pods for podtest
  pod 'AWSKinesis' , '2.12.2'
  pod 'AppLovinSDK', '6.12.4'
end

Error

Pod::Downloader::RemoteFile::UnsupportedFileTypeError - Unsupported file type:
/Users/guym/.rvm/gems/ruby-2.4.0/gems/cocoapods-downloader-1.3.0/lib/cocoapods-downloader/remote_file.rb:83:in `filename_with_type'
/Users/guym/.rvm/gems/ruby-2.4.0/gems/cocoapods-downloader-1.3.0/lib/cocoapods-downloader/remote_file.rb:24:in `download!'
/Users/guym/.rvm/gems/ruby-2.4.0/gems/cocoapods-downloader-1.3.0/lib/cocoapods-downloader/base.rb:82:in `block in download'
/Users/guym/.rvm/gems/ruby-2.4.0/gems/cocoapods-1.9.3/lib/cocoapods/downloader.rb:157:in `block in ui_action'
/Users/guym/.rvm/gems/ruby-2.4.0/gems/cocoapods-1.9.3/lib/cocoapods/user_interface.rb:64:in `section'
/Users/guym/.rvm/gems/ruby-2.4.0/gems/cocoapods-1.9.3/lib/cocoapods/downloader.rb:156:in `ui_action'
/Users/guym/.rvm/gems/ruby-2.4.0/gems/cocoapods-downloader-1.3.0/lib/cocoapods-downloader/base.rb:80:in `download'
/Users/guym/.rvm/gems/ruby-2.4.0/gems/cocoapods-1.9.3/lib/cocoapods/downloader.rb:108:in `download_source'
/Users/guym/.rvm/gems/ruby-2.4.0/gems/cocoapods-1.9.3/lib/cocoapods/downloader.rb:75:in `download_request'
/Users/guym/.rvm/gems/ruby-2.4.0/gems/cocoapods-1.9.3/lib/cocoapods/downloader/cache.rb:171:in `download'
/Users/guym/.rvm/gems/ruby-2.4.0/gems/cocoapods-1.9.3/lib/cocoapods/downloader/cache.rb:154:in `block in uncached_pod'
/Users/guym/.rvm/gems/ruby-2.4.0/gems/cocoapods-1.9.3/lib/cocoapods/downloader/cache.rb:181:in `in_tmpdir'
/Users/guym/.rvm/gems/ruby-2.4.0/gems/cocoapods-1.9.3/lib/cocoapods/downloader/cache.rb:153:in `uncached_pod'
/Users/guym/.rvm/gems/ruby-2.4.0/gems/cocoapods-1.9.3/lib/cocoapods/downloader/cache.rb:33:in `download_pod'
/Users/guym/.rvm/gems/ruby-2.4.0/gems/cocoapods-1.9.3/lib/cocoapods/downloader.rb:42:in `download'
/Users/guym/.rvm/gems/ruby-2.4.0/gems/cocoapods-1.9.3/lib/cocoapods/installer/pod_source_installer.rb:117:in `download_source'
/Users/guym/.rvm/gems/ruby-2.4.0/gems/cocoapods-1.9.3/lib/cocoapods/installer/pod_source_installer.rb:69:in `install!'
/Users/guym/.rvm/gems/ruby-2.4.0/gems/cocoapods-1.9.3/lib/cocoapods/installer.rb:557:in `install_source_of_pod'
/Users/guym/.rvm/gems/ruby-2.4.0/gems/cocoapods-1.9.3/lib/cocoapods/installer.rb:508:in `block (2 levels) in install_pod_sources'
/Users/guym/.rvm/gems/ruby-2.4.0/gems/cocoapods-1.9.3/lib/cocoapods/user_interface.rb:86:in `titled_section'
/Users/guym/.rvm/gems/ruby-2.4.0/gems/cocoapods-1.9.3/lib/cocoapods/installer.rb:507:in `block in install_pod_sources'
/Users/guym/.rvm/gems/ruby-2.4.0/gems/cocoapods-1.9.3/lib/cocoapods/installer.rb:490:in `each'
/Users/guym/.rvm/gems/ruby-2.4.0/gems/cocoapods-1.9.3/lib/cocoapods/installer.rb:490:in `install_pod_sources'
/Users/guym/.rvm/gems/ruby-2.4.0/gems/cocoapods-1.9.3/lib/cocoapods/installer.rb:249:in `block in download_dependencies'
/Users/guym/.rvm/gems/ruby-2.4.0/gems/cocoapods-1.9.3/lib/cocoapods/user_interface.rb:64:in `section'
/Users/guym/.rvm/gems/ruby-2.4.0/gems/cocoapods-1.9.3/lib/cocoapods/installer.rb:248:in `download_dependencies'
/Users/guym/.rvm/gems/ruby-2.4.0/gems/cocoapods-1.9.3/lib/cocoapods/installer.rb:157:in `install!'
/Users/guym/.rvm/gems/ruby-2.4.0/gems/cocoapods-1.9.3/lib/cocoapods/command/install.rb:52:in `run'
/Users/guym/.rvm/gems/ruby-2.4.0/gems/claide-1.0.3/lib/claide/command.rb:334:in `run'
/Users/guym/.rvm/gems/ruby-2.4.0/gems/cocoapods-1.9.3/lib/cocoapods/command.rb:52:in `run'
/Users/guym/.rvm/gems/ruby-2.4.0/gems/cocoapods-1.9.3/bin/pod:55:in `<top (required)>'
/Users/guym/.rvm/gems/ruby-2.4.0/bin/pod:23:in `load'
/Users/guym/.rvm/gems/ruby-2.4.0/bin/pod:23:in `<main>'
/Users/guym/.rvm/gems/ruby-2.4.0/bin/ruby_executable_hooks:24:in `eval'
/Users/guym/.rvm/gems/ruby-2.4.0/bin/ruby_executable_hooks:24:in `<main>'

――― TEMPLATE END ――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――

[!] Oh no, an error occurred.

Search for existing GitHub issues similar to yours: https://github.com/CocoaPods/CocoaPods/search?q=Unsupported+file+type%3A+&type=Issues

If none exists, create a ticket, with the template displayed above, on: https://github.com/CocoaPods/CocoaPods/issues/new

Be sure to first read the contributing guide for details on how to properly submit a ticket: https://github.com/CocoaPods/CocoaPods/blob/master/CONTRIBUTING.md

Don't forget to anonymize any private data!

Looking for related issues on cocoapods/cocoapods...

and 22 more at: https://github.com/cocoapods/cocoapods/search?q=Unsupported%20file%20type%3A%20&type=Issues&utf8=✓

[!] Automatically assigning platform iOS with version 13.2 on target podtest because no platform was specified. Please specify a platform for this target in your Podfile. See https://guides.cocoapods.org/syntax/podfile.html#platform.

dnkoutso commented 4 years ago

I am not sure what extension you are using but cocoapods-downloader does not seem to support it.

https://github.com/CocoaPods/cocoapods-downloader/blob/master/lib/cocoapods-downloader/remote_file.rb#L76-L83

dnkoutso commented 4 years ago

You will need to paste the podspec of AppLovinSDK

guyyosan commented 4 years ago

@dnkoutso the extension is zip. the http url looks like this (as you can see :type is missing) Maybe cocoapods downloader is having issues getting the file type from a url that has parameters? download params: {:http=>"https://192.168.200.39:8443/repository/cocoapods-cache/pods/AppLovinSDK/6.12.4/https/bintray.com/applovin/iOS/download_file?file_path=applovin-ios-sdk-6.12.4.zip"}

this is the podspec from sonatype nexus:


{
"name": "AppLovinSDK",
"authors": {
"AppLovin Corporation": "devsupport@applovin.com"
},
"version": "6.12.4",
"platforms": {
"ios": "9.0"
},
"summary": "AppLovin SDK for iOS",
"homepage": "https://www.applovin.com/",
"license": {
"type": "Commercial License",
"text": "\nCopyright 2019 AppLovin Corp. All rights reserved.\n\nThe AppLovin SDK is available under a commercial license (https://www.applovin.com/eula).\n\n"
},
"source": {
"http": "https://192.168.200.39:8443/repository/cocoapods-cache/pods/AppLovinSDK/6.12.4/https/bintray.com/applovin/iOS/download_file?file_path=applovin-ios-sdk-6.12.4.zip"
},
"vendored_frameworks": "applovin-ios-sdk-6.12.4/AppLovinSDK.framework",
"module_map": "applovin-ios-sdk-6.12.4/AppLovinSDK.framework/Modules/module.modulemap",
"preserve_paths": "applovin-ios-sdk-6.12.4/appledoc/*",
"resources": "applovin-ios-sdk-6.12.4/AppLovinSDKResources.bundle",
"frameworks": [
"AdSupport",
"AudioToolbox",
"AVFoundation",
"CoreGraphics",
"CoreMedia",
"CoreTelephony",
"SafariServices",
"StoreKit",
"SystemConfiguration",
"UIKit",
"WebKit"
],
"libraries": "z",
"xcconfig": {
"OTHER_LDFLAGS": "-ObjC",
"VALID_ARCHS": "arm64 arm64e armv7 armv7s x86_64",
"VALID_ARCHS[sdk=iphoneos*]": "arm64 arm64e armv7 armv7s",
"VALID_ARCHS[sdk=iphonesimulator*]": "x86_64"
},
"description": "AppLovin turns mobile into the medium of choice for advertisers.\n\nOUR MISSION\n\nEnable advertisers to make ROI-based marketing decisions and deliver relevant content on mobile.\n\nOur marketing platform reaches new users and matches them with relevant brands - ensuring you reach the users that are likely to engage.\n\nWe deliver relevant content to over a billion mobile consumers every month. With AppLovin, advertisers attain their mobile marketing goals."
}
dnkoutso commented 4 years ago

Probably yes, it would be nice if you can figure it out and we can fix it in cocoapods-downloader with a test case. We can then make a release to handle that.

dnkoutso commented 4 years ago

Going to move to cocoapods-downloader.

guyyosan commented 4 years ago

@dnkoutso updated the pr, ci is passing now, lmk what u think

g65g5nj commented 3 years ago

@dnkoutso updated the pr, ci is passing now, lmk what u think I meet the same problem,could you please tell me how to solve it?

guyyosan commented 3 years ago

@g65g5nj the issue is coming from cocoapods downloader it cannot find the type. nexus is uploading some files without adding their types. you can use the following fork. but it won't work forever: https://github.com/baxievski/cocoapods-downloader

g65g5nj commented 3 years ago

@g65g5nj the issue is coming from cocoapods downloader it cannot find the type. nexus is uploading some files without adding their types. you can use the following fork. but it won't work forever: https://github.com/baxievski/cocoapods-downloader

Thank you very much for your reply. I will try your solution!