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

Version solver should skip versions with unparseable pubspecs #1479

Closed
kevmoo opened this issue Dec 1, 2016 · 5 comments
Closed

Version solver should skip versions with unparseable pubspecs #1479

kevmoo opened this issue Dec 1, 2016 · 5 comments
Labels
type-enhancement A request for a change that isn't a bug

Comments

@kevmoo
Copy link
Member

kevmoo commented Dec 1, 2016

From @stephan-gruen on December 1, 2016 11:2

sdk 1.21.0-dev.11.0
Windows 7 / WebStorm 2016.3.1
All works well with the stable sdk version 1.20.1, but I'm not able to use the latest dev sdk version (I tryed 9 and 11) anymore, because pub throws "Duplicate mapping key" if polymer_elements are used.

Not really sure if this is a sdk or a pub error or what to do or update to solve it.

Pub:

Working dir: C:\Users\Stephan\dart\Angular2\test
D:\dart\dartium-1.21.0-dev.11.0\dart-sdk\bin\pub.bat get
Resolving dependencies...
Error on line 198, column 1 of ..\..\..\AppData\Roaming\Pub\Cache\hosted\pub.dartlang.org\polymer_elements-1.0.0-rc.9\pubspec.yaml: Duplicate mapping key.
environment:
^^^^^^^^^^^
Process finished with exit code 65

yaml:

name: test
description: A Dart app that uses Angular 2
version: 0.0.1
environment:
  sdk: '>=1.19.0 <2.0.0'
dependencies:
  angular2: ^2.1.1
  angular2_components: ^0.2.0
  browser: ^0.10.0
  polymer: ^1.0.0-rc.18
  polymer_elements: ^1.0.0-rc.9
  web_components: ^0.12.0
dev_dependencies:
  dart_to_js_script_rewriter: ^1.0.1
transformers:
- polymer:
    entry_points: web/index.html
- angular2:
    platform_directives:
    - 'package:angular2/common.dart#COMMON_DIRECTIVES'
    platform_pipes:
    - 'package:angular2/common.dart#COMMON_PIPES'
    entry_points: web/main.dart
- dart_to_js_script_rewriter
- $dart2js:
    $include: '**/*.bootstrap.initialize.dart'
    minify: true
    commandLineOptions:
    - --trust-type-annotations
    - --trust-primitives

If you do not specify a version for polymer_elements pub will simply get the first version:

Working dir: C:\Users\Stephan\dart\Angular2\test
D:\dart\dartium-1.21.0-dev.11.0\dart-sdk\bin\pub.bat get
Resolving dependencies...
+ polymer_elements 0.0.2 (0.3.0 available)
Changed 1 dependency!
Process finished with exit code 0

Copied from original issue: dart-lang/sdk#27956

@nex3
Copy link
Member

nex3 commented Dec 1, 2016

This all seems like the expected behavior to me. If you look at the polymer_elements 1.0.0-rc.9 pubspec, it does in fact have two environment: keys in the root mapping. This is invalid. Pub is telling you it's invalid. What's the issue?

@nex3 nex3 added the needs-info Additional information needed from the issue author label Dec 1, 2016
@kevmoo
Copy link
Member Author

kevmoo commented Dec 1, 2016

@nex3 I believe the issue is that the user did nothing but updated Dart and now things are broken. The publisher of polymer_elements had no idea that the uploaded package would break at a future date.

@nex3
Copy link
Member

nex3 commented Dec 1, 2016

Hmm, I suppose pub should probably skip versions with unparseable pubspecs rather than crashing.

@nex3 nex3 added type-enhancement A request for a change that isn't a bug and removed needs-info Additional information needed from the issue author labels Dec 1, 2016
@nex3 nex3 changed the title SDK 1.21.0-dev.11.0: pub triggers "Duplicate mapping key" error if polymer_elements are used Version solver should skip versions with unparseable pubspecs Dec 1, 2016
@nex3
Copy link
Member

nex3 commented Dec 1, 2016

Looking at this more, I don't think it's something we can do efficiently on the client side. We don't consume pubspecs directly while version solving, we consume JSON from pub.dartlang.org that's derived from the pubspecs. We'll need the server to mark these packages as invalid somehow.

@nex3
Copy link
Member

nex3 commented Dec 1, 2016

I've filed dart-lang/pub-dev#62 to track the necessary change to pub.dartlang.org. I'm going to leave this open for now because we should at least be resilient to busted pubspecs in the local pub cache, especially when running with --offline.

whesse added a commit to dart-lang/sdk that referenced this issue Dec 5, 2016
Rejecting duplicate keys breaks download of existing Dart packages.
BUG=dart-lang/pub#1479
R=lrn@google.com
CC=mit@google.com,nweiz@google.com,kustermann@google.com

Review URL: https://codereview.chromium.org/2548313002 .
whesse added a commit to dart-lang/sdk that referenced this issue Dec 5, 2016
Rejecting duplicate keys breaks download of existing Dart packages.
BUG=dart-lang/pub#1479
R=lrn@google.com
CC=mit@google.com,nweiz@google.com,kustermann@google.com

Review URL: https://codereview.chromium.org/2548313002 .
nex3 added a commit that referenced this issue Dec 7, 2016
In particular, "pub get --offline" and "pub cache repair" shouldn't
choke when there are parse failures in the version cache.

See #1479
nex3 added a commit that referenced this issue Dec 7, 2016
In particular, "pub get --offline" and "pub cache repair" shouldn't
choke when there are parse failures in the version cache.

Closes #1479
@nex3 nex3 closed this as completed in #1488 Dec 7, 2016
nex3 added a commit that referenced this issue Dec 7, 2016
In particular, "pub get --offline" and "pub cache repair" shouldn't
choke when there are parse failures in the version cache.

Closes #1479
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type-enhancement A request for a change that isn't a bug
Projects
None yet
Development

No branches or pull requests

2 participants