Skip to content

Instantly share code, notes, and snippets.

@rlaager
Last active March 1, 2020 04:45
Show Gist options
  • Save rlaager/af889ff70a7aff8fbdef5a82add6839e to your computer and use it in GitHub Desktop.
Save rlaager/af889ff70a7aff8fbdef5a82add6839e to your computer and use it in GitHub Desktop.
--- zfs.py.orig 2020-02-29 22:33:35.944829078 -0600
+++ zfs.py 2020-02-29 22:43:04.105212366 -0600
@@ -98,14 +98,11 @@
return sources
sources = {
- 'ZFS on Linux': zfsonlinux(),
+ 'OpenZFS on Linux': zfsonlinux(),
'FreeBSD': freebsd(),
- 'OpenZFS on OSX': openzfsonosx(),
- 'OmniOSCE': omniosce(),
+ 'OpenZFS on OS X': openzfsonosx(),
+ 'OmniOS CE': omniosce(),
'Joyent': joyent(),
- 'OpenZFS': {
- 'master': 'https://raw.githubusercontent.com/openzfs/openzfs/master/usr/src/man/man5/zpool-features.5',
- },
'DragonFlyBSD': {
'zfsport': 'https://raw.githubusercontent.com/victoredwardocallaghan/DragonFlyBSD/zfs-port/cddl/contrib/opensolaris/cmd/zpool/zpool-features.7',
},
@@ -121,7 +118,6 @@
}
features = defaultdict(list)
-guids = dict()
readonly = dict()
for name, sub in sources.items():
@@ -135,23 +131,22 @@
guid = line.split()[-1]
if guid == 'org.open-zfs:large_block':
guid += 's'
- feature = guid.split(':')[1]
- guids[feature] = guid
- features[feature].append((name, ver))
+ (domain, feature) = guid.split(':')
+ features[(feature, domain, guid)].append((name, ver))
elif line.startswith('READ\\-ONLY COMPATIBLE'):
- readonly[feature] = (line.split()[-1] == 'yes')
+ readonly[guid] = (line.split()[-1] == 'yes')
header = list(sorted(sources.keys()))
header = list(zip(header, (sorted(sources[name],
key=lambda x: regex(r'[^0-9]', '', x) or x) for name in header)))
-header.append(('Sortix', ('current',)))
html = open(path + '/zfs.html', 'w')
html.write('''<!DOCTYPE html>
<title>ZFS Feature Matrix</title>
<meta charset="utf-8" /><meta name="referrer" content="never" />
-<style>body{font-family: "Helvetica", "Arial", sans-serif}
+<style>
+body{font-family: "Helvetica", "Arial", sans-serif}
.yes{background-color:lightgreen}
.warn{background-color:yellow}
.no{background-color:lightsalmon}
@@ -159,7 +154,9 @@
table{border-collapse: collapse}
th,td{padding:0.2em 0.4em;border:1px solid #aaa;background-color:#f9f9f9}
th{background-color:#eaecf0}
-th[scope=row]{text-align:left}</style>
+th[scope=row]{text-align:left}
+th[scope=row] small{color: #777}
+</style>
''')
html.write('<table>\n')
@@ -174,9 +171,11 @@
html.write('<td>' + ver + '</td>')
html.write('</tr>\n')
-for feature, names in sorted(features.items()):
- html.write('<tr><th scope="row"><abbr title="' + guids[feature] + '">' + feature + '</abbr></th>')
- if readonly[feature]:
+for (feature, domain, guid), names in sorted(features.items()):
+ html.write(
+ '<tr><th scope="row">' + feature +' <small>(' + domain +
+ ')</small></th>')
+ if readonly[guid]:
html.write('<td class="yes">yes</td>')
else:
html.write('<td class="warn">no</td>')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment