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
Hypernode patch info outdated #73
Labels
Comments
This thing? cat /srv/app/tools/patch_spreadsheet_to_json.py
#!/usr/bin/env python3
import json
import os
from collections import defaultdict
import gspread # this is a modified version! see requirements.txt
import logging
# https://docs.google.com/spreadsheets/d/1MTbU9Bq130zrrsJwLIB9d8qnGfYZnkm4jBlfNaBF19M/pubhtml
SPREADSHEET_ID = '1MTbU9Bq130zrrsJwLIB9d8qnGfYZnkm4jBlfNaBF19M'
PATH = os.path.dirname(os.path.realpath(__file__))
debug = False
if debug:
import requests_cache
requests_cache.install_cache(
'cache',
backend='sqlite',
allowable_methods=('GET', 'POST'),
allowable_codes=(200, 401, 403, 404, 502, 503, 301, 302, 303),
)
def find_patches_for_row(row, patches):
required_patches = set()
for col_id, cell in enumerate(row):
if cell in ('', 'Not Required', 'Not Supported', 'Under investigation', 'Ask support'):
continue
elif cell.startswith('Replaced by'):
continue
elif cell == 'Required':
patch = patches[col_id]
elif cell.startswith('Use '):
patch = cell[4:]
else:
logging.warning("Unsupported status: %s" % cell)
continue
# requires different patch id's per mag version, so not usable for automatic parsing
if 'APPSEC' in patch:
continue
patch = patch.replace(' V', ' v')
required_patches.add(patch)
# sort patches alphabetically on patch version and take the latest (v2 over v1.1)
return sorted(required_patches)
gc = gspread.public()
document = gc.open_by_key(SPREADSHEET_ID)
giant_blob = {}
for sheet in document.worksheets():
matrix = sheet.get_all_values()
assert matrix[1][0] == 'Version'
edition = matrix[2][0] # Community or Enterprise
patches = matrix[1][2:] # skip first 2 cols
giant_blob[edition] = {}
for row_id in range(3, 50):
version = matrix[row_id][0]
# break on first empty row
if not version:
break
required_patches = find_patches_for_row(matrix[row_id][2:], patches)
giant_blob[edition][version] = required_patches
try:
assert 'SUPEE-8788' in giant_blob['Community']['1.7.0.0']
assert 'SUPEE-8788 v2' in giant_blob['Community']['1.7.0.0']
assert 'SUPEE-6788' in giant_blob['Enterprise']['1.6.x']
assert 'SUPEE-7405 v1.1' in giant_blob['Enterprise']['1.14.2.1']
assert 'SUPEE-7405' in giant_blob['Enterprise']['1.14.2.1']
assert 'SUPEE-6079' not in giant_blob['Enterprise']['1.14.2.0']
assert 'SUPEE-3762' not in giant_blob['Community']['1.4.0.0']
except AssertionError:
print("Patch parsing didn't work out. Result is:\n%s" % json.dumps(giant_blob, indent=2))
raise
with open(PATH + '/../static/required_magento_patches.json', 'w') as f:
f.write(json.dumps(giant_blob, indent=2, sort_keys=True))
sheet.get_all_values() now returns:
|
fixed in Hypernode/tools.hypernode.com#10
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
https://tools.hypernode.com/patches/community/1.9.2.0 gives:
AFAIK, there was an auto-syncer for the spreadsheet but it might got broken because the syntax in the spreadsheet changed.
The text was updated successfully, but these errors were encountered: