[28460] in Source-Commits

home help back first fref pref prev next nref lref last post

machtype commit: Add support for Utopic; deprecate older sysnames

daemon@ATHENA.MIT.EDU (Jonathan D Reed)
Wed Oct 1 19:33:02 2014

Date: Wed, 1 Oct 2014 19:32:56 -0400
From: Jonathan D Reed <jdreed@mit.edu>
Message-Id: <201410012332.s91NWuHG015958@drugstore.mit.edu>
To: source-commits@mit.edu

https://github.com/mit-athena/machtype/commit/8f5516e416a0993cb7fbc68ff838890c43bfc395
commit 8f5516e416a0993cb7fbc68ff838890c43bfc395
Author: Jonathan Reed <jdreed@mit.edu>
Date:   Wed Oct 1 09:04:05 2014 -0400

    Add support for Utopic; deprecate older sysnames
    
    - Add support for Utopic (14.10) (Trac: #1537)
    - generate_sysnames.py now knows about deprecated sysnames and
      will include them in its output for separate parsing
    - machtype now has a "-D" option to generate a list of deprecated
      sysnames that attach(1) and friends might use for notifying the
      user

 Makefile             |    2 ++
 debian/changelog     |    7 +++++--
 generate_sysnames.py |   29 +++++++++++++++++++++++------
 machtype_linux.sh    |   11 ++++++++++-
 4 files changed, 40 insertions(+), 9 deletions(-)

diff --git a/Makefile b/Makefile
index 623a485..f1d261c 100644
--- a/Makefile
+++ b/Makefile
@@ -8,6 +8,7 @@ ATHENA_MINOR_VERSION = 0
 SYSNAMES := $(shell ./generate_sysnames.py)
 MACHTYPE_ATHENA_SYS := $(word 1, $(SYSNAMES))
 MACHTYPE_ATHENA_SYS_COMPAT := $(word 2, $(SYSNAMES))
+MACHTYPE_ATHENA_SYS_DEPRECATED := $(word 3, $(SYSNAMES))
 ifeq ($(MACHTYPE_ATHENA_SYS),)
     $(error MACHTYPE_ATHENA_SYS unset)
 endif
@@ -25,6 +26,7 @@ machtype.sh: ${OS_SCRIPT}
 	    -e 's/@ATHENA_MINOR_VERSION@/${ATHENA_MINOR_VERSION}/' \
 	    -e 's/@ATHENA_SYS@/${MACHTYPE_ATHENA_SYS}/' \
 	    -e 's/@ATHENA_SYS_COMPAT@/${MACHTYPE_ATHENA_SYS_COMPAT}/' \
+	    -e 's/@ATHENA_SYS_DEPRECATED@/${MACHTYPE_ATHENA_SYS_DEPRECATED}/' \
 	    ${OS_SCRIPT} > $@
 
 install:
diff --git a/debian/changelog b/debian/changelog
index c7582a7..183e3d5 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,8 +1,11 @@
-debathena-machtype (10.5.3) UNRELEASED; urgency=low
+debathena-machtype (10.5.3) unstable; urgency=low
 
   * Depend on lsb-release (Trac: #1376)
+  * Add support for Utopic (Trac: #1537)
+  * Keep track of deprecated sysnames so that attach/add can use them in
+    the future, by adding a new "-D" option to machtype"
 
- -- Jonathan Reed <jdreed@mit.edu>  Wed, 01 Oct 2014 19:28:07 -0400
+ -- Jonathan Reed <jdreed@mit.edu>  Wed, 01 Oct 2014 19:31:08 -0400
 
 debathena-machtype (10.5.2) unstable; urgency=low
 
diff --git a/generate_sysnames.py b/generate_sysnames.py
index a6d4c21..7b4501a 100755
--- a/generate_sysnames.py
+++ b/generate_sysnames.py
@@ -71,16 +71,22 @@ class Distro(object):
         self.arches = kwargs.get('arches', DEFAULT_ARCHES)
         self.sysver = digits.sub('', kwargs.get('sysver', version))
         self.sysprefix = kwargs.get('sysprefix', 'linux')
+        self.deprecated = kwargs.get('deprecated', False)
 
-    def suitable(self):
+    def suitable(self, include_deprecated=False):
         if ARCH not in self.arches:
             return False
         if not compare_versions(self.vercmp, 'ge', self.version):
             return False
         if not IS_UBUNTU and isinstance(self, Ubuntu):
             return False
+        if self.deprecated and not include_deprecated:
+            return False
         return True
 
+    def historic(self):
+        return self.suitable(include_deprecated=True) and self.deprecated
+
     def sysnames(self):
         rv = []
         for a in archlist(ARCH):
@@ -104,14 +110,18 @@ class Ubuntu(Distro):
 
 # The master distro order
 # Update this when a new release comes online
-distros = [Ubuntu('14.04'),
+# add "deprecated=True" to distros when we stop building for
+# them.
+distros = [Ubuntu('14.10'),
+           Ubuntu('14.04'),
            Ubuntu('13.10'), Ubuntu('13.04'),
            Debian('7.0', arches=DEFAULT_ARCHES + ('armel',)),
            Ubuntu('12.10'), Ubuntu('12.04'),
-           Ubuntu('11.10'),
+           Ubuntu('11.10', deprecated=True),
            Debian('6.0'),
            Ubuntu('11.04'),
-           Ubuntu('10.10'), Ubuntu('10.04'),
+           Ubuntu('10.10', deprecated=True), Ubuntu('10.04'),
+           Ubuntu('9.10', deprecated=True),
            Ubuntu('9.04'),
            Debian('4.0.4', sysver='5.0'),
            Ubuntu('8.04'),
@@ -128,6 +138,9 @@ if not compare_versions(DEBIAN_VERSION, 'ge', '3.1'):
 sysnames = list(
     itertools.chain(*[d.sysnames() for d in distros if d.suitable()]))
 
+deprecated_sysnames = list(
+    itertools.chain(*[d.sysnames() for d in distros if d.historic()]))
+
 if len(sysnames) < len(archlist(ARCH)):
     fail("Insufficient number of sysnames, cannot proceed.",
          "sysnames: {0}".format(sysnames))
@@ -137,6 +150,8 @@ sysnames += ['i386_rhel4']
 
 if not compare_versions(DEBIAN_VERSION, 'ge', '7.0'):
     sysnames += ['i386_rhel3', 'i386_linux24']
+else:
+    deprecated_sysnames += ['i386_rhel3', 'i386_linux24']
 
 if len(sysnames) + 1 > MAX_SYSNAMES:
     fail("Sysname list too long")
@@ -152,7 +167,9 @@ elif not IS_UBUNTU:
              "{0} != {1}".format(Debian(deb_ver_compare).sysnames()[0],
                                  sysname))
 
-print "{sysname} {syscompat}".format(
+print "{sysname} {syscompat} {deprecated}".format(
     sysname=sysname.strip(),
-    syscompat=':'.join([x.strip() for x in sysnames]))
+    syscompat=':'.join([x.strip() for x in sysnames]),
+    deprecated=':'.join([x.strip() for x in deprecated_sysnames]),
+)
 sys.exit(0)
diff --git a/machtype_linux.sh b/machtype_linux.sh
index 1186a5f..74b3b80 100755
--- a/machtype_linux.sh
+++ b/machtype_linux.sh
@@ -12,6 +12,7 @@
 #  -v     : more verbose -- about memory mainly
 #  -A     : print Athena Release
 #  -C     : print out compatible Athena System names
+#  -D     : Print out deprecated compatible Athena System names
 #  -E     : print out the version of the Base OS
 #  -L     : version of athena from /etc/athena/version
 #  -M     : physical memory
@@ -24,7 +25,7 @@
 PATH=/bin:/usr/bin:/sbin:/usr/sbin
 QUICKSTATION_FILE=/afs/athena.mit.edu/system/config/quick/quickstations
 
-while getopts cdk:m:rvACELMNPSq i; do
+while getopts cdk:m:rvACDELMNPSq i; do
 	case "$i" in
 	c)
 		cpu=1
@@ -54,6 +55,9 @@ while getopts cdk:m:rvACELMNPSq i; do
 	C)
 		ath_sys_compat=1
 		;;
+	D)
+		ath_sys_deprecated=1
+		;;
 	E) 	
 		base_os_ver=1
 		;;
@@ -136,6 +140,11 @@ if [ $ath_sys_compat ]; then
 	printed=1
 fi
 
+if [ $ath_sys_deprecated ]; then
+	echo "@ATHENA_SYS_DEPRECATED@"
+	printed=1
+fi
+
 if [ $cpu ] ; then
 	if [ $verbose ]; then
 	        echo "`uname -s` `uname -r` on `uname -m`"

home help back first fref pref prev next nref lref last post