#!/usr/bin/env python # -*- coding: utf-8 -*- # # fedserverdb.py # # Copyright 2010 Joerg Stephan <johe.stephan@googlemail.com> # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, # MA 02110-1301, USA. import os import commands import datetime import wikitools now = datetime.datetime.now() Release = '' Version = '' Retstr = '' dblist = ['firebird', 'mysql','postgresql','db4','sqlite'] udblist = ['openldap-servers'] webserverlist = ['httpd'] baselist = ['bind','dhcp','dnsmasq','dovecot','nfs','ntp','openvpn','ppp','rp-pppoe','samba','squid','at','cronie','cronie-anacron'] monilist =['mrtg','munin','nagios','net-snmp','zabbix'] versionlist = ['cvs','git-daemon','subversion'] fedlist = ['koji-builder','koji-hub','koji-utils','koji-web'] applist = ['trytond'] alllist =[dblist, udblist,webserverlist,baselist,monilist,versionlist,fedlist,applist] alllist_names =["Databases","UserManagement","Webserver","Baseapps","Monitoring","Versioncontrol","Fedora","Applications"] counter = 0 Retstr = "== Fedora Server Packages ==\n This page will give an overview about server related software.\n Last modified at " + str(now) + " by script \n\n" filename = "./wiki/" for list in alllist : Retstr += "=== "+ alllist_names[counter] + " [http://fedoraproject.org/wiki/SIGs/Server/ServersOverview_alpha/" + alllist_names[counter] + " read more] === \n{| border = \"1\" cellspacing = \"20\" \n! Package !! Current_version !! GUI !! X !! list of deps\n|-" subfile = open('./wiki/'+ alllist_names[counter],'w') counter += 1 subret = '' for prog in list : subret += '== ' + str(prog) + ' == \n=== Installation ===\n <pre> yum install ' + str(prog) + '
'
cmd = 'yum info ' + str(prog) cmd_result = commands.getoutput(cmd) line = cmd_result.splitlines() for res in line : res2 = res.split(":") if (res2[0].strip(' ') == 'Version'): Version = res2[1].strip(' ') if (res2[0].strip(' ') == 'Release'): Release = res2[1].strip(' ') if (res2[0].strip(' ') == 'Summary'): Desc = res2[1].strip(' ') Retstr += "\n| " + prog +" || " + Version + "-" + Release + " || || || \n|-\n" subcmd = 'yum deplist ' + str(prog) subcmd_result = commands.getoutput(subcmd) subline = subcmd_result.splitlines() depstr = deplist = [] for subres in subline : subres2 = subres.split(":") if (subres2[0].strip(' ') == 'dependency'): dep = subres2[1].split('(')[0].strip(' ') if (deplist.count(dep) == 0 ) : deplist.append(dep) subret += "\n=== Description ===\n" + Desc subret += "\n=== Dependencys ===\n" for subdep in deplist : subret += " * " + str(subdep) + "\n" Retstr += "|}\n\n" subret subfile.write(subret) file = open(filename + "Server",'w') file.write(Retstr)