cocoapods-downloader icon indicating copy to clipboard operation
cocoapods-downloader copied to clipboard

Feature Request: Rename spec.source

Open CaiJingLong opened this issue 5 years ago • 4 comments

Protocol types can be set in podspec's source, which is good.

But I have a dynamic library file about 150 MB. I use tar.xz to compress this file, up to 35MB. But the network in China is not very good, so I want to use https://dev.azure.com to provide the library file. This seems to have CDN support, and downloads are very fast in China and the United States West.

The URL downloaded from the file on this site is like this:

https://dev.azure.com/cjlspy/45712d4b-2fcf-403d-92a0-3a6848a955d8/_apis/git/repositories/397233d0-159f-4f02-9d54-6fa854eb61d1/Items?path=%2FIJKMediaFramework.txz&versionDescriptor%5BversionOptions%5D=0&versionDescriptor%5BversionType%5D=1&versionDescriptor%5Bversion%5D=0.0.6&download=true&resolveLfs=true&%24format=octetStream&api-version=5.0-preview.1

log like this

-> FlutterIJK (0.0.7)
    - WARN  | description: The description is shorter than the summary.
    - ERROR | [iOS] unknown: Encountered an unknown error (Unsupported file type: 
/Library/Ruby/Gems/2.3.0/gems/cocoapods-downloader-1.2.2/lib/cocoapods-downloader/remote_file.rb:77:in `filename_with_type'
/Library/Ruby/Gems/2.3.0/gems/cocoapods-downloader-1.2.2/lib/cocoapods-downloader/remote_file.rb:23:in `download!'
/Library/Ruby/Gems/2.3.0/gems/cocoapods-downloader-1.2.2/lib/cocoapods-downloader/base.rb:82:in `block in download'
/Library/Ruby/Gems/2.3.0/gems/cocoapods-1.6.1/lib/cocoapods/downloader.rb:157:in `block in ui_action'
/Library/Ruby/Gems/2.3.0/gems/cocoapods-1.6.1/lib/cocoapods/user_interface.rb:64:in `section'
/Library/Ruby/Gems/2.3.0/gems/cocoapods-1.6.1/lib/cocoapods/downloader.rb:156:in `ui_action'
/Library/Ruby/Gems/2.3.0/gems/cocoapods-downloader-1.2.2/lib/cocoapods-downloader/base.rb:80:in `download'
/Library/Ruby/Gems/2.3.0/gems/cocoapods-1.6.1/lib/cocoapods/downloader.rb:108:in `download_source'
/Library/Ruby/Gems/2.3.0/gems/cocoapods-1.6.1/lib/cocoapods/downloader.rb:75:in `download_request'
/Library/Ruby/Gems/2.3.0/gems/cocoapods-1.6.1/lib/cocoapods/downloader/cache.rb:171:in `download'
/Library/Ruby/Gems/2.3.0/gems/cocoapods-1.6.1/lib/cocoapods/downloader/cache.rb:154:in `block in uncached_pod'
/Library/Ruby/Gems/2.3.0/gems/cocoapods-1.6.1/lib/cocoapods/downloader/cache.rb:181:in `in_tmpdir'
/Library/Ruby/Gems/2.3.0/gems/cocoapods-1.6.1/lib/cocoapods/downloader/cache.rb:153:in `uncached_pod'
/Library/Ruby/Gems/2.3.0/gems/cocoapods-1.6.1/lib/cocoapods/downloader/cache.rb:33:in `download_pod'
/Library/Ruby/Gems/2.3.0/gems/cocoapods-1.6.1/lib/cocoapods/downloader.rb:42:in `download'
/Library/Ruby/Gems/2.3.0/gems/cocoapods-1.6.1/lib/cocoapods/installer/pod_source_installer.rb:104:in `download_source'
/Library/Ruby/Gems/2.3.0/gems/cocoapods-1.6.1/lib/cocoapods/installer/pod_source_installer.rb:62:in `install!'
/Library/Ruby/Gems/2.3.0/gems/cocoapods-1.6.1/lib/cocoapods/installer.rb:426:in `install_source_of_pod'
/Library/Ruby/Gems/2.3.0/gems/cocoapods-1.6.1/lib/cocoapods/installer.rb:377:in `block (2 levels) in install_pod_sources'
/Library/Ruby/Gems/2.3.0/gems/cocoapods-1.6.1/lib/cocoapods/user_interface.rb:86:in `titled_section'
/Library/Ruby/Gems/2.3.0/gems/cocoapods-1.6.1/lib/cocoapods/installer.rb:376:in `block in install_pod_sources'
/Library/Ruby/Gems/2.3.0/gems/cocoapods-1.6.1/lib/cocoapods/installer.rb:359:in `each'
/Library/Ruby/Gems/2.3.0/gems/cocoapods-1.6.1/lib/cocoapods/installer.rb:359:in `install_pod_sources'
/Library/Ruby/Gems/2.3.0/gems/cocoapods-1.6.1/lib/cocoapods/installer.rb:189:in `block in download_dependencies'
/Library/Ruby/Gems/2.3.0/gems/cocoapods-1.6.1/lib/cocoapods/user_interface.rb:64:in `section'
/Library/Ruby/Gems/2.3.0/gems/cocoapods-1.6.1/lib/cocoapods/installer.rb:188:in `download_dependencies'
/Library/Ruby/Gems/2.3.0/gems/cocoapods-1.6.1/lib/cocoapods/validator.rb:520:in `block in download_pod'
/Library/Ruby/Gems/2.3.0/gems/cocoapods-1.6.1/lib/cocoapods/validator.rb:520:in `each'
/Library/Ruby/Gems/2.3.0/gems/cocoapods-1.6.1/lib/cocoapods/validator.rb:520:in `download_pod'
/Library/Ruby/Gems/2.3.0/gems/cocoapods-1.6.1/lib/cocoapods/validator.rb:365:in `block in perform_extensive_analysis'
/Library/Ruby/Gems/2.3.0/gems/cocoapods-1.6.1/lib/cocoapods/validator.rb:359:in `each'
/Library/Ruby/Gems/2.3.0/gems/cocoapods-1.6.1/lib/cocoapods/validator.rb:359:in `perform_extensive_analysis'
/Library/Ruby/Gems/2.3.0/gems/cocoapods-1.6.1/lib/cocoapods/validator.rb:128:in `validate'
/Library/Ruby/Gems/2.3.0/gems/cocoapods-1.6.1/lib/cocoapods/command/spec/lint.rb:77:in `block in run'
/Library/Ruby/Gems/2.3.0/gems/cocoapods-1.6.1/lib/cocoapods/command/spec/lint.rb:63:in `each'
/Library/Ruby/Gems/2.3.0/gems/cocoapods-1.6.1/lib/cocoapods/command/spec/lint.rb:63:in `run'
/Library/Ruby/Gems/2.3.0/gems/claide-1.0.2/lib/claide/command.rb:334:in `run'
/Library/Ruby/Gems/2.3.0/gems/cocoapods-1.6.1/lib/cocoapods/command.rb:52:in `run'
/Library/Ruby/Gems/2.3.0/gems/cocoapods-1.6.1/bin/pod:55:in `<top (required)>'
/usr/local/bin/pod:22:in `load'
/usr/local/bin/pod:22:in `<main>'
) during validation.

Analyzed 1 podspec.

[!] The spec did not pass validation, due to 1 error and 1 warning.

/Library/Ruby/Gems/2.3.0/gems/cocoapods-1.6.1/lib/cocoapods/command/spec/lint.rb:94:in `run'
/Library/Ruby/Gems/2.3.0/gems/claide-1.0.2/lib/claide/command.rb:334:in `run'
/Library/Ruby/Gems/2.3.0/gems/cocoapods-1.6.1/lib/cocoapods/command.rb:52:in `run'
/Library/Ruby/Gems/2.3.0/gems/cocoapods-1.6.1/bin/pod:55:in `<top (required)>'
/usr/local/bin/pod:22:in `load'
/usr/local/bin/pod:22:in `<main>'
Pod::Spec.new do |spec|

  spec.name         = "FlutterIJK"
  spec.version      = "0.0.7"
  spec.summary      = "IJKPlayer for Flutter."
  spec.description  = <<-DESC
  IJKPlayer for flutter
                   DESC
  
  spec.homepage     = "https://github.com/CaiJingLong/flutter_ijkplayer_pod"
  spec.license      = { :type => 'MIT', :file => 'LICENSE' }
  spec.author             = { "Caijinglong" => "[email protected]" }
  # spec.source       = { :http => "https://github.com/CaiJingLong/flutter_ijkplayer_pod/releases/download/0.0.6/IJKMediaFramework.txz"}
  spec.source       = { :http => "https://dev.azure.com/cjlspy/45712d4b-2fcf-403d-92a0-3a6848a955d8/_apis/git/repositories/397233d0-159f-4f02-9d54-6fa854eb61d1/Items?versionDescriptor%5BversionOptions%5D=0&versionDescriptor%5BversionType%5D=1&versionDescriptor%5Bversion%5D=0.0.6&download=true&resolveLfs=true&%24format=octetStream&api-version=5.0-preview.1&path=%2FIJKMediaFramework.txz"}
  spec.vendored_frameworks = 'IJKMediaFramework.framework'
  spec.frameworks  = "AudioToolbox", "AVFoundation", "CoreGraphics", "CoreMedia", "CoreVideo", "MobileCoreServices", "OpenGLES", "QuartzCore", "VideoToolbox", "Foundation", "UIKit", "MediaPlayer"
  spec.libraries   = "bz2", "z", "stdc++"

  spec.platform = :ios
  spec.ios.deployment_target = '8.0'
  spec.requires_arc = true

end

So can you provide spec.source with an attribute in the future so that it can be read when curl downloads to specify the file name?

Such as:

spec.source = {:http => "https://example.com/abc?name=lib.txz&path=master", :rename=>"lib.txz" }

CaiJingLong avatar Mar 19 '19 07:03 CaiJingLong

Yeah, this feels reasonable to me - this would need to go in the cocoapods-downloader gem (which CocoaPods uses to handle this kind of thing) 👍

orta avatar Mar 19 '19 10:03 orta

Looking forward to that day.

CaiJingLong avatar Mar 19 '19 12:03 CaiJingLong

https://dev.azure.com/cjlspy/45712d4b-2fcf-403d-92a0-3a6848a955d8/_apis/git/repositories/397233d0-159f-4f02-9d54-6fa854eb61d1/Items?path=%2FIJKMediaFramework.txz&versionDescriptor%5BversionOptions%5D=0&versionDescriptor%5BversionType%5D=1&versionDescriptor%5Bversion%5D=0.0.6&download=true&resolveLfs=true&%24format=octetStream&api-version=5.0-preview.1

In addition, the file name is correct if the specified file is opened using a chrome.

The same can happen with bintray.

The following two files can be downloaded correctly with browser. https://bintray.com/caijinglong/generic/download_file?file_path=IJKMediaFramework.txz https://bintray.com/caijinglong/generic/download_file?file_path=IJKMediaFramework.framework.tar.gz


But I can't use the url to trunk my library.

Pod::Spec.new do |spec|

  spec.name         = "FlutterIJK"
  spec.version      = "0.0.7"
  spec.summary      = "IJKPlayer for Flutter."
  spec.description  = <<-DESC
  IJKPlayer for flutter
                   DESC
  
  spec.homepage     = "https://github.com/CaiJingLong/flutter_ijkplayer_pod"
  spec.license      = { :type => 'MIT', :file => 'LICENSE' }
  spec.author             = { "Caijinglong" => "[email protected]" }
  spec.source       = { :http => "https://bintray.com/caijinglong/generic/download_file?file_path=IJKMediaFramework.txz"}
  spec.vendored_frameworks = 'IJKMediaFramework.framework'
  spec.frameworks  = "AudioToolbox", "AVFoundation", "CoreGraphics", "CoreMedia", "CoreVideo", "MobileCoreServices", "OpenGLES", "QuartzCore", "VideoToolbox", "Foundation", "UIKit", "MediaPlayer"
  spec.libraries   = "bz2", "z", "stdc++"

  spec.platform = :ios
  spec.ios.deployment_target = '8.0'
  spec.requires_arc = true

end

I use pod spec lint ./FlutterIJK.podspec --verbose to check my podspec will return the result.

pod spec lint ./FlutterIJK.podspec --verbose

    FlutterIJK (0.0.7) - Analyzing on iOS 8.0 platform.
  Preparing

Analyzing dependencies

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

Fetching external sources
-> Fetching podspec for `FlutterIJK` from `/private/tmp/download/spec/FlutterIJK.podspec`

Resolving dependencies of

Comparing resolved specification to the sandbox manifest
  A FlutterIJK

Downloading dependencies

-> Installing FlutterIJK (0.0.7)
 > Http download

[!] Error installing FlutterIJK
 -> FlutterIJK (0.0.7)
    - WARN  | description: The description is shorter than the summary.
    - ERROR | [iOS] unknown: Encountered an unknown error (Unsupported file type:
/usr/local/Cellar/cocoapods/1.6.1/libexec/gems/cocoapods-downloader-1.2.2/lib/cocoapods-downloader/remote_file.rb:77:in `filename_with_type'
/usr/local/Cellar/cocoapods/1.6.1/libexec/gems/cocoapods-downloader-1.2.2/lib/cocoapods-downloader/remote_file.rb:23:in `download!'
/usr/local/Cellar/cocoapods/1.6.1/libexec/gems/cocoapods-downloader-1.2.2/lib/cocoapods-downloader/base.rb:82:in `block in download'
/usr/local/Cellar/cocoapods/1.6.1/libexec/gems/cocoapods-1.6.1/lib/cocoapods/downloader.rb:157:in `block in ui_action'
/usr/local/Cellar/cocoapods/1.6.1/libexec/gems/cocoapods-1.6.1/lib/cocoapods/user_interface.rb:64:in `section'
/usr/local/Cellar/cocoapods/1.6.1/libexec/gems/cocoapods-1.6.1/lib/cocoapods/downloader.rb:156:in `ui_action'
/usr/local/Cellar/cocoapods/1.6.1/libexec/gems/cocoapods-downloader-1.2.2/lib/cocoapods-downloader/base.rb:80:in `download'
/usr/local/Cellar/cocoapods/1.6.1/libexec/gems/cocoapods-1.6.1/lib/cocoapods/downloader.rb:108:in `download_source'
/usr/local/Cellar/cocoapods/1.6.1/libexec/gems/cocoapods-1.6.1/lib/cocoapods/downloader.rb:75:in `download_request'
/usr/local/Cellar/cocoapods/1.6.1/libexec/gems/cocoapods-1.6.1/lib/cocoapods/downloader/cache.rb:171:in `download'
/usr/local/Cellar/cocoapods/1.6.1/libexec/gems/cocoapods-1.6.1/lib/cocoapods/downloader/cache.rb:154:in `block in uncached_pod'
/usr/local/Cellar/cocoapods/1.6.1/libexec/gems/cocoapods-1.6.1/lib/cocoapods/downloader/cache.rb:181:in `in_tmpdir'
/usr/local/Cellar/cocoapods/1.6.1/libexec/gems/cocoapods-1.6.1/lib/cocoapods/downloader/cache.rb:153:in `uncached_pod'
/usr/local/Cellar/cocoapods/1.6.1/libexec/gems/cocoapods-1.6.1/lib/cocoapods/downloader/cache.rb:33:in `download_pod'
/usr/local/Cellar/cocoapods/1.6.1/libexec/gems/cocoapods-1.6.1/lib/cocoapods/downloader.rb:42:in `download'
/usr/local/Cellar/cocoapods/1.6.1/libexec/gems/cocoapods-1.6.1/lib/cocoapods/installer/pod_source_installer.rb:104:in `download_source'
/usr/local/Cellar/cocoapods/1.6.1/libexec/gems/cocoapods-1.6.1/lib/cocoapods/installer/pod_source_installer.rb:62:in `install!'
/usr/local/Cellar/cocoapods/1.6.1/libexec/gems/cocoapods-1.6.1/lib/cocoapods/installer.rb:426:in `install_source_of_pod'
/usr/local/Cellar/cocoapods/1.6.1/libexec/gems/cocoapods-1.6.1/lib/cocoapods/installer.rb:377:in `block (2 levels) in install_pod_sources'
/usr/local/Cellar/cocoapods/1.6.1/libexec/gems/cocoapods-1.6.1/lib/cocoapods/user_interface.rb:86:in `titled_section'
/usr/local/Cellar/cocoapods/1.6.1/libexec/gems/cocoapods-1.6.1/lib/cocoapods/installer.rb:376:in `block in install_pod_sources'
/usr/local/Cellar/cocoapods/1.6.1/libexec/gems/cocoapods-1.6.1/lib/cocoapods/installer.rb:359:in `each'
/usr/local/Cellar/cocoapods/1.6.1/libexec/gems/cocoapods-1.6.1/lib/cocoapods/installer.rb:359:in `install_pod_sources'
/usr/local/Cellar/cocoapods/1.6.1/libexec/gems/cocoapods-1.6.1/lib/cocoapods/installer.rb:189:in `block in download_dependencies'
/usr/local/Cellar/cocoapods/1.6.1/libexec/gems/cocoapods-1.6.1/lib/cocoapods/user_interface.rb:64:in `section'
/usr/local/Cellar/cocoapods/1.6.1/libexec/gems/cocoapods-1.6.1/lib/cocoapods/installer.rb:188:in `download_dependencies'
/usr/local/Cellar/cocoapods/1.6.1/libexec/gems/cocoapods-1.6.1/lib/cocoapods/validator.rb:520:in `block in download_pod'
/usr/local/Cellar/cocoapods/1.6.1/libexec/gems/cocoapods-1.6.1/lib/cocoapods/validator.rb:520:in `each'
/usr/local/Cellar/cocoapods/1.6.1/libexec/gems/cocoapods-1.6.1/lib/cocoapods/validator.rb:520:in `download_pod'
/usr/local/Cellar/cocoapods/1.6.1/libexec/gems/cocoapods-1.6.1/lib/cocoapods/validator.rb:365:in `block in perform_extensive_analysis'
/usr/local/Cellar/cocoapods/1.6.1/libexec/gems/cocoapods-1.6.1/lib/cocoapods/validator.rb:359:in `each'
/usr/local/Cellar/cocoapods/1.6.1/libexec/gems/cocoapods-1.6.1/lib/cocoapods/validator.rb:359:in `perform_extensive_analysis'
/usr/local/Cellar/cocoapods/1.6.1/libexec/gems/cocoapods-1.6.1/lib/cocoapods/validator.rb:128:in `validate'
/usr/local/Cellar/cocoapods/1.6.1/libexec/gems/cocoapods-1.6.1/lib/cocoapods/command/spec/lint.rb:77:in `block in run'
/usr/local/Cellar/cocoapods/1.6.1/libexec/gems/cocoapods-1.6.1/lib/cocoapods/command/spec/lint.rb:63:in `each'
/usr/local/Cellar/cocoapods/1.6.1/libexec/gems/cocoapods-1.6.1/lib/cocoapods/command/spec/lint.rb:63:in `run'
/usr/local/Cellar/cocoapods/1.6.1/libexec/gems/claide-1.0.2/lib/claide/command.rb:334:in `run'
/usr/local/Cellar/cocoapods/1.6.1/libexec/gems/cocoapods-1.6.1/lib/cocoapods/command.rb:52:in `run'
/usr/local/Cellar/cocoapods/1.6.1/libexec/gems/cocoapods-1.6.1/bin/pod:55:in `<top (required)>'
/usr/local/Cellar/cocoapods/1.6.1/libexec/bin/pod:22:in `load'
/usr/local/Cellar/cocoapods/1.6.1/libexec/bin/pod:22:in `<main>'
) during validation.

Analyzed 1 podspec.

[!] The spec did not pass validation, due to 1 error and 1 warning.
/usr/local/Cellar/cocoapods/1.6.1/libexec/gems/cocoapods-1.6.1/lib/cocoapods/command/spec/lint.rb:94:in `run'
/usr/local/Cellar/cocoapods/1.6.1/libexec/gems/claide-1.0.2/lib/claide/command.rb:334:in `run'
/usr/local/Cellar/cocoapods/1.6.1/libexec/gems/cocoapods-1.6.1/lib/cocoapods/command.rb:52:in `run'
/usr/local/Cellar/cocoapods/1.6.1/libexec/gems/cocoapods-1.6.1/bin/pod:55:in `<top (required)>'
/usr/local/Cellar/cocoapods/1.6.1/libexec/bin/pod:22:in `load'
/usr/local/Cellar/cocoapods/1.6.1/libexec/bin/pod:22:in `<main>'

CaiJingLong avatar Mar 19 '19 13:03 CaiJingLong

@orta I tried run $ curl-L-O "https://bintray.com/caijinglong/generic/download_file?File_path=IJKMediaFramework.txz" to download the file with the correct extension.

For partial downloads, the file name may be incorrect due to redirection.

CaiJingLong avatar Mar 21 '19 06:03 CaiJingLong