Last active
December 25, 2015 17:49
-
-
Save lmacken/7016045 to your computer and use it in GitHub Desktop.
List which Fedora updates suggest that the user reboot after
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import urllib | |
from BeautifulSoup import BeautifulSoup | |
from yum.update_md import UpdateMetadata | |
repos = { | |
'testing': 'http://dl.fedoraproject.org/pub/fedora/linux/updates/testing/20/x86_64/repodata/', | |
'stable': 'http://dl.fedoraproject.org/pub/fedora/linux/updates/20/x86_64/repodata/', | |
} | |
filename = 'updateinfo.xml.gz' | |
umd = UpdateMetadata() | |
def get_updateinfo(repo): | |
repodata_url = repos[repo] | |
html = urllib.urlopen(repodata_url).read() | |
soup = BeautifulSoup(html) | |
for link in soup.findAll('a'): | |
if filename in link.text: | |
url = repodata_url + link.text | |
mdfile = '%s-%s' % (repo, filename) | |
print('Downloading %s' % url) | |
urllib.urlretrieve(url, filename=mdfile) | |
return mdfile | |
umd.add(get_updateinfo('testing')) | |
umd.add(get_updateinfo('stable')) | |
print('%d update notices loaded' % len(umd.get_notices())) | |
for notice in umd.get_notices(): | |
if notice['reboot_suggested']: | |
print(notice['title']) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment