Skip to content

Instantly share code, notes, and snippets.

@cnelson
Created March 23, 2017 02:03
Show Gist options
  • Save cnelson/3db18183281b8ce434e51bc6fe30b947 to your computer and use it in GitHub Desktop.
Save cnelson/3db18183281b8ce434e51bc6fe30b947 to your computer and use it in GitHub Desktop.
#!/usr/bin/env python3
import re
import requests
import subprocess
import yaml
buildpacks = {}
bpack_info = subprocess.check_output(['cf', 'buildpacks'])
for item in bpack_info.decode('utf-8').split("\n"):
if not item.endswith('.zip'):
continue
name, rest = item.split(' ', 1)
name = name.replace('_', '-')
try:
buildpacks[name] = re.search('(v\d+.*)\.zip$', rest).group(1)
except AttributeError:
pass
# buildpacks = {'binary-buildpack': 'v1.0.10', 'nodejs-test-buildpack': 'v1.5.19', 'staticfile-buildpack': 'v1.3.18', 'go-test-buildpack': 'v1.7.11', 'ruby-buildpack': 'v1.6.35', 'python-buildpack': 'v1.5.16', 'java-buildpack': 'v3.14', 'dotnet-core-buildpack': 'v1.0.13', 'go-buildpack': 'v1.7.19', 'php-buildpack': 'v4.3.29', 'nodejs-buildpack': 'v1.5.30'}
for name, version in buildpacks.items():
resp = requests.get('https://raw.githubusercontent.com/cloudfoundry/{0}/{1}/manifest.yml'.format(name, version))
manifest = yaml.load(resp.text)
if 'dependency_deprecation_dates' not in manifest:
continue
print("{0} {1}".format(name, version))
for item in sorted(manifest['dependency_deprecation_dates'], key=lambda k: k['date']):
print("\t{date} - {name} {version_line}".format(**item))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment