Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
slapos.core
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Cédric Le Ninivin
slapos.core
Commits
e2f53cce
Commit
e2f53cce
authored
Jan 18, 2013
by
Marco Mariani
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
check compatible platforms
parent
155b8629
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
3 deletions
+13
-3
slapos/cache.py
slapos/cache.py
+13
-3
No files found.
slapos/cache.py
View file @
e2f53cce
...
@@ -5,10 +5,13 @@ import argparse
...
@@ -5,10 +5,13 @@ import argparse
import
ConfigParser
import
ConfigParser
import
hashlib
import
hashlib
import
json
import
json
import
platform
import
re
import
re
import
sys
import
sys
import
urllib2
import
urllib2
from
slapos.grid
import
networkcache
def
maybe_md5
(
s
):
def
maybe_md5
(
s
):
return
re
.
match
(
'[0-9a-f]{32}'
,
s
)
return
re
.
match
(
'[0-9a-f]{32}'
,
s
)
...
@@ -42,8 +45,11 @@ def cache():
...
@@ -42,8 +45,11 @@ def cache():
entries
=
json
.
loads
(
response
.
read
())
entries
=
json
.
loads
(
response
.
read
())
linux_distribution
=
platform
.
linux_distribution
()
header_printed
=
False
header_printed
=
False
ostable
=
[]
for
entry
in
entries
:
for
entry
in
entries
:
meta
=
json
.
loads
(
entry
[
0
])
meta
=
json
.
loads
(
entry
[
0
])
os
=
ast
.
literal_eval
(
meta
[
'os'
])
os
=
ast
.
literal_eval
(
meta
[
'os'
])
...
@@ -52,9 +58,13 @@ def cache():
...
@@ -52,9 +58,13 @@ def cache():
print
'MD5: %s'
%
md5
print
'MD5: %s'
%
md5
print
'-------------'
print
'-------------'
print
'Available for: '
print
'Available for: '
print
'distribution | version |
id
'
print
'distribution | version |
id | compatible?
'
print
'-----------------+--------------+---------------'
print
'-----------------+--------------+---------------
-+-------------
'
header_printed
=
True
header_printed
=
True
ostable
.
append
(
os
)
ostable
.
sort
()
print
'%-16s | %12s | %s'
%
(
os
[
0
],
os
[
1
],
os
[
2
].
center
(
14
))
for
os
in
ostable
:
compatible
=
'yes'
if
networkcache
.
os_matches
(
os
,
linux_distribution
)
else
'no'
print
'%-16s | %12s | %s | %s'
%
(
os
[
0
],
os
[
1
],
os
[
2
].
center
(
14
),
compatible
)
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment