2017-05-01 03:26:56 +03:00
#!/usr/bin/env python3
2015-05-20 02:35:02 +03:00
from html . parser import HTMLParser
from enum import Enum
class State ( Enum ) :
NOWHERE = 0
COMPANY = 1
AFTER_COMPANY = 2
PNPID = 3
AFTER_PNPID = 4
DATE = 5
class PNPTableParser ( HTMLParser ) :
def __init__ ( self ) :
HTMLParser . __init__ ( self )
self . state = State . NOWHERE
self . data = " "
self . pnpid = None
self . company = None
self . table = [ ]
def handle_starttag ( self , tag , attrs ) :
if tag == " td " :
if self . state == State . NOWHERE :
self . state = State . COMPANY
elif self . state == State . AFTER_COMPANY :
self . state = State . PNPID
elif self . state == State . AFTER_PNPID :
self . state = State . DATE
else :
2016-12-02 01:23:53 +03:00
raise ValueError
2015-05-20 02:35:02 +03:00
self . data = " "
def handle_endtag ( self , tag ) :
if tag == " td " :
if self . state == State . COMPANY :
self . company = ' ' . join ( self . data . strip ( ) . split ( ) )
self . state = State . AFTER_COMPANY
elif self . state == State . PNPID :
self . pnpid = self . data . strip ( )
self . state = State . AFTER_PNPID
self . table . append ( ( self . pnpid , self . company ) )
elif self . state == State . DATE :
self . state = State . NOWHERE
else :
2016-12-02 01:23:53 +03:00
raise ValueError
2015-05-20 02:35:02 +03:00
def handle_data ( self , data ) :
self . data + = data
def read_table ( a ) :
parser = PNPTableParser ( )
for line in a :
parser . feed ( line )
parser . close ( )
parser . table . sort ( )
for pnpid , company in parser . table :
print ( " \n acpi: {0} *: \n ID_VENDOR_FROM_DATABASE= {1} " . format ( pnpid , company ) )
a = open ( " acpi_id_registry.html " )
b = open ( " pnp_id_registry.html " )
print ( ' # This file is part of systemd. \n '
' # \n '
' # Data imported from: \n '
Update UEFI URLs (#12260)
* Use more secure https://www.uefi.org
http://www.uefi.org directs to https://uefi.org/, so this saves one
redirect.
$ curl -I http://www.uefi.org
HTTP/1.1 302 Found
Server: nginx
Date: Tue, 09 Apr 2019 14:54:46 GMT
Content-Type: text/html; charset=iso-8859-1
Connection: keep-alive
X-Content-Type-Options: nosniff
Location: https://uefi.org/
Cache-Control: max-age=1209600
Expires: Tue, 23 Apr 2019 14:54:46 GMT
Run the command below to update all occurrences.
git grep -l http://www.uefi.org | xargs sed -i 's,http://www.uefi.org,https://www.uefi.org,'
* Use https://uefi.org to save redirect
Save one redirect by using the target location.
$ curl -I https://www.uefi.org
HTTP/1.1 301 Moved Permanently
Server: nginx
Date: Tue, 09 Apr 2019 14:55:42 GMT
Content-Type: text/html; charset=iso-8859-1
Connection: keep-alive
X-Content-Type-Options: nosniff
Location: https://uefi.org/
Cache-Control: max-age=1209600
Expires: Tue, 23 Apr 2019 14:55:42 GMT
Run the command below to update all occurrences.
git grep -l https://www.uefi.org | xargs sed -i 's,https://www.uefi.org,https://uefi.org,'
2019-04-09 19:37:46 +03:00
' # https://uefi.org/uefi-pnp-export \n '
' # https://uefi.org/uefi-acpi-export ' )
2015-05-20 02:35:02 +03:00
read_table ( a )
read_table ( b )