diff options
author | Paul Sherwood <paul.sherwood@codethink.co.uk> | 2014-02-25 17:19:09 +0000 |
---|---|---|
committer | Paul Sherwood <paul.sherwood@codethink.co.uk> | 2014-02-25 23:16:11 +0000 |
commit | 75fc79f6287a567b0e758daa101c59b6fe7bccec (patch) | |
tree | 16249a4c0c0f3c460d4cd413d21242a8e0029dee | |
parent | fe7238ac335d8591591eae8998c67c6c98ac595b (diff) | |
download | definitions-baserock/ps/add-subway-wip.tar.gz |
explicitly state subway dependencies, and proto-parser for npm filesbaserock/ps/add-subway-wip
-rw-r--r-- | devel-system-x86_64-generic.morph | 1 | ||||
-rw-r--r-- | node-stuff.morph | 12 | ||||
-rw-r--r-- | parser.py | 23 |
3 files changed, 30 insertions, 6 deletions
diff --git a/devel-system-x86_64-generic.morph b/devel-system-x86_64-generic.morph index ec251967..5a824eec 100644 --- a/devel-system-x86_64-generic.morph +++ b/devel-system-x86_64-generic.morph @@ -24,3 +24,4 @@ strata: - morph: genivi-x-x86_64-generic - morph: tools - morph: glanceclient +- morph: node-stuff diff --git a/node-stuff.morph b/node-stuff.morph index 07e0a71a..6664cf26 100644 --- a/node-stuff.morph +++ b/node-stuff.morph @@ -8,13 +8,13 @@ chunks: repo: file:///src2/ws-subway/add-subway/upstream:node ref: master build-depends: [] -- name: npm - repo: file:///src2/ws-subway/add-subway/upstream:npm - ref: master - build-depends: [] +- name: express + repo: file:///src2/ws-subway/add-subway/upstream:express + ref: master + build-depends: + - node - name: subway repo: file:///src2/ws-subway/add-subway/upstream:subway ref: master build-depends: - - npm - + - node diff --git a/parser.py b/parser.py new file mode 100644 index 00000000..5d229de1 --- /dev/null +++ b/parser.py @@ -0,0 +1,23 @@ +import sys, json +import subprocess +import yaml + +package = json.load(sys.stdin) + +deps = package['dependencies'].items() + package['devDependencies'].items() + +morphs = list() + +for chunk in deps: + cmd = "npm view %s repository.url" % chunk[0] + process = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE) + output = process.communicate() + print 'name:', chunk[0] + print 'morph:', output[0].splitlines()[0] + print 'ref:', chunk[1] + + morph={'morph':chunk[0] , 'repo':output[0].splitlines()[0], 'ref':chunk[1]} + morphs.append(morph) + +with open('data.yaml', 'a') as outfile: + outfile.write( yaml.safe_dump(morphs, default_flow_style=False) ) |