summaryrefslogtreecommitdiffstats
path: root/installclasses/fedora.py
diff options
context:
space:
mode:
authorChris Lumens <clumens@redhat.com>2009-02-13 13:13:25 -0500
committerChris Lumens <clumens@redhat.com>2009-02-16 10:59:39 -0500
commit87bf4551dbd14722f8400b973d9dd6f98b16710c (patch)
treeb70a96d28d000557c31541ea0c4cf00d7f9a9133 /installclasses/fedora.py
parenta395392eca0abb3dfd2d7e66665d0621360c32f0 (diff)
downloadanaconda-87bf4551dbd14722f8400b973d9dd6f98b16710c.tar.gz
anaconda-87bf4551dbd14722f8400b973d9dd6f98b16710c.tar.xz
anaconda-87bf4551dbd14722f8400b973d9dd6f98b16710c.zip
Encode our upgrade policy in productMatches/versionMatches and enforce it.
For Fedora, this means we will not allow upgrades of detected root filesystems more than two releases old, or "upgrading" a newer install with an older one. For RHEL, we don't yet know what to do so just allow things to continue as they always have. Using "upgradeany" still circumvents this check.
Diffstat (limited to 'installclasses/fedora.py')
-rw-r--r--installclasses/fedora.py32
1 files changed, 32 insertions, 0 deletions
diff --git a/installclasses/fedora.py b/installclasses/fedora.py
index 3e529c501..0eda0b5c8 100644
--- a/installclasses/fedora.py
+++ b/installclasses/fedora.py
@@ -19,6 +19,7 @@
from installclass import BaseInstallClass
from constants import *
+from product import *
from filer import *
from flags import flags
import os, types
@@ -76,5 +77,36 @@ class InstallClass(BaseInstallClass):
else:
return yuminstall.YumBackend
+ def productMatches(self, oldprod):
+ if oldprod.startswith(productName):
+ return True
+
+ productUpgrades = {
+ "Fedora Core": ("Red Hat Linux", ),
+ "Fedora": ("Fedora Core", )
+ }
+
+ if productUpgrades.has_key(productName):
+ acceptable = productUpgrades[productName]
+ else:
+ acceptable = ()
+
+ for p in acceptable:
+ if oldprod.startswith(p):
+ return True
+
+ return False
+
+ def versionMatches(self, oldver):
+ try:
+ oldVer = float(oldver)
+ newVer = float(productVersion)
+ except ValueError:
+ return True
+
+ # This line means we do not support upgrading from anything older
+ # than two versions ago!
+ return newVer > oldVer and newVer - oldVer <= 2
+
def __init__(self):
BaseInstallClass.__init__(self)