2 Handle FreeBSD port audit files and map the names to OpenEmbedded
7 Handles an entry like the one below:
8 vulnerability-test-port>=2000<2010.02.26|http://cvsweb.freebsd.org/ports/security/vulnerability-test-port/|Not vulnerable, just a test port (database: 2010-02-26)
10 def __init__(self
, name
, versions
, link
, kind
):
12 self
.versions
= versions
16 def split_versions(self
, input):
18 Split versions by <, >, >=, >=
23 # Try to determine <, >, >=, <=
24 # we will have to carry stuff on to find the
27 while i
< len(input) - 1:
30 if c1
!= '<' and c1
!= '>' and c1
!= '=':
34 # is a '=' coming behind it?
41 versions
.append((next_type
, input[last_pos
:i
]))
44 next_type
= input[i
:next
]
49 versions
.append((next_type
, input[last_pos
:len(input)]))
53 return "%s: %s" % (self
.name
, self
.versions
)
57 """Map a FreeBSD name to OE"""
59 "libpurple" : "pidgin",
63 "freeciv-gtk" : "freeciv",
66 "python23" : "python",
67 "python24" : "python",
68 "python25" : "python",
69 "python+ipv6" : "python",
70 "wget-devel" : "wget",
72 "freetype" : "freetype",
73 "qemu-devel" : "qemu",
75 "freeciv-gtk2": "freeciv",
79 "openvpn-devel" : "openvpn",
80 "mpeg123-esound" : "mpeg123",
81 "mpeg123-nas" : "mpeg123",
82 "cdrtools-cjk" : "cdrtools",
83 "apache+mod_ssl+mod_deflate" : "apache2",
84 "apache+mod_ssl*" : "apache2",
87 "{ja-,}bugzilla" : "bugzilla",
89 "mozilla+ipv6": "mozilla",
90 "mozilla-embeddded" : "mozilla",
92 "libsndfile" : "libsndfile1",
93 "sylpheed-gtk2": "sylpheed",
94 "cdrtools-devel": "cdrtools",
97 "ghostscript-gpl" : "gs",
98 "ghostscript-gnu-nox11" : "gs",
99 "ghostscript8" : "gs",
100 "ghostscript-afpl-nox11" : "gs",
101 "ghostscript-afpl" : "gs",
103 "mplayer-gtk" : "mplayer",
104 "xerces-c2" : "xerces-c",
105 "libxml" : "libxml2",
107 "mplayer{,-gtk}{,-esound}" : "mplayer",
108 "proftpd-devel": "proftpd",
111 "php5-{cgi,cli}" : "php",
120 def is_not_in_oe(name
):
121 """Method to reject packages not in OE"""
123 # packages that we will never have...
124 "linux-firefox", "fr-linux-netscape", "linux-netscape-{communicator,navigator}",
125 "linux_base", "ja-netscape7", "{ja,ko}-netscape-{communicator,navigator}-linux", "zhTW-linux-mozillafirebird", "ja-linux-mozillafirebird-gtk1", "el-linux-mozillafirebird", "mozilla-firebird", "netscape7",
126 "acroread4", "acroread7", "acroread5",
127 "linux-openmotif", "linux-flock", "linux-jdk", "linux-curl", "linux-png", "linux-firefox-devel",
129 # packages that we don't have now but maybe will have in
130 # the future and blacklisting them here might be a problem
131 "openoffice.org-2-devel", "openoffice.org-2", "it-openoffice", "ca-openoffice","sl-openoffice-SI", "ja-openoffice",
132 "drupal4", "drupal5", "drupal6", "drupal-pubcookie",
135 "kdenetwork", "ja-kdelibs", "kdegraphics", "kdepim", "kdebase4-runtime",
136 "xemacs-devel", "xemacs-devel-21.5", "xemacs-mule", "zh-xemacs", "zh-xemacs-mule",
137 "geeklog", "apach13-ssl", "nvidia-driver", "eGroupWare", "varnish", "heimdal",
138 "bugzilla", "agenda-snow-libs", "mozilla",
141 return name
in not_in
143 def create_infos(line
):
144 split
= line
.split("|")
145 for i
in range(0, len(split
[0])):
147 if c
!= '<' and c
!= '=' and c
!= '>':
149 name
= map_names(split
[0][0:i
])
150 versions
= freebsd_info
.split_versions(split
[0][i
:])
153 if is_not_in_oe(name
):
154 #print "Not in oe %s" % name
159 return [freebsd_info(name
, versions
, link
, kind
)]
162 def read_auditfile(filename
):
164 Read an uncompressed audit file from freebsd
169 if line
.startswith("#"):
172 infos
= create_infos(line
)
175 packages
[info
.name
].append(info
)
177 packages
[info
.name
] = []
178 packages
[info
.name
].append(info
)
182 def prepare_version(bsd_version
):
184 FreeBSD is adding ,1 for revisions.. remove that
186 # FIXME return a tuple with a revision...
188 split
= bsd_version
.rsplit(',', 1)
190 split
= split
.rsplit('_', 1)
192 rev
= "r%s" % split
[1]
193 return (split
[0], rev
)