Revision 5756c277 image_creator/util.py
b/image_creator/util.py | ||
---|---|---|
108 | 108 |
return stat.f_bavail * stat.f_frsize |
109 | 109 |
|
110 | 110 |
|
111 |
def check_guestfs_version(ghandler, major, minor, release): |
|
112 |
"""Checks if the version of the used libguestfs is smaller, equal or |
|
113 |
greater than the one specified by the major, minor and release triplet |
|
114 |
|
|
115 |
Returns: |
|
116 |
< 0 if the installed version is smaller than the specified one |
|
117 |
= 0 if they are equal |
|
118 |
> 0 if the installed one is greater than the specified one |
|
119 |
""" |
|
120 |
|
|
121 |
ver = ghandler.version() |
|
122 |
|
|
123 |
for (a, b) in (ver['major'], major), (ver['minor'], minor), \ |
|
124 |
(ver['release'], release): |
|
125 |
if a != b: |
|
126 |
return a - b |
|
127 |
|
|
128 |
return 0 |
|
129 |
|
|
130 |
|
|
131 | 111 |
class MD5: |
132 | 112 |
"""Represents MD5 computations""" |
133 | 113 |
def __init__(self, output): |
Also available in: Unified diff