89 |
compare = version_cmp(version_new, version_old) |
compare = version_cmp(version_new, version_old) |
90 |
|
|
91 |
if compare == 0: |
if compare == 0: |
92 |
|
# 1.0.0 -> 1.0.1 |
93 |
return (-2, "Already at version %s!" % (version_old)) |
return (-2, "Already at version %s!" % (version_old)) |
94 |
|
|
95 |
if compare != 1: |
if compare != 1: |
96 |
|
# 1.0.1 -> 1.0.0 |
97 |
return (-3, "Version %s is older than current version %s!" % (version_new, version_old)) |
return (-3, "Version %s is older than current version %s!" % (version_new, version_old)) |
98 |
|
|
99 |
# Version is newer, but we don't want to see if it follows the GNOME versioning scheme |
# Version is newer, but we don't want to see if it follows the GNOME versioning scheme |
114 |
# Major+minor the same? Then go ahead and upgrade! |
# Major+minor the same? Then go ahead and upgrade! |
115 |
if majmins[0] == majmins[1]: |
if majmins[0] == majmins[1]: |
116 |
# Majmin of both versions are the same, looks good! |
# Majmin of both versions are the same, looks good! |
117 |
|
# 1.1.x -> 1.1.x or 1.0.x -> 1.0.x |
118 |
return (10, None) |
return (10, None) |
119 |
|
|
120 |
# More detailed analysis needed, so figure out the numbers |
# More detailed analysis needed, so figure out the numbers |
122 |
|
|
123 |
# Check/ensure major version number is the same |
# Check/ensure major version number is the same |
124 |
if majmin_nrs[0][0] != majmin_nrs[1][0]: |
if majmin_nrs[0][0] != majmin_nrs[1][0]: |
125 |
|
# 1.0.x -> 2.0.x |
126 |
return (1, "Major version number increase") |
return (1, "Major version number increase") |
127 |
|
|
128 |
# Minor indicates stable/unstable |
# Minor indicates stable/unstable |
131 |
# Upgrading to unstable is weird |
# Upgrading to unstable is weird |
132 |
if not devstate[1]: |
if not devstate[1]: |
133 |
if devstate[0]: |
if devstate[0]: |
134 |
|
# 1.2.x -> 1.3.x |
135 |
return (1, "Stable to unstable increase") |
return (1, "Stable to unstable increase") |
136 |
|
|
137 |
|
# 1.3.x -> 1.5.x |
138 |
return (4, "Unstable to unstable version increase") |
return (4, "Unstable to unstable version increase") |
139 |
|
|
140 |
# Unstable => stable is always ok |
# Unstable => stable is always ok |
141 |
if not devstate[0]: |
if not devstate[0]: |
142 |
|
# 1.1.x -> 1.2.x |
143 |
return (5, "Unstable to stable") |
return (5, "Unstable to stable") |
144 |
|
|
145 |
# Can only be increase of minors from one stable to the next |
# Can only be increase of minors from one stable to the next |
146 |
|
# 1.0.x -> 1.2.x |
147 |
return (6, "Stable version increase") |
return (6, "Stable version increase") |
148 |
|
|
149 |
def line_input (file): |
def line_input (file): |