mirror of
https://git.launchpad.net/ubuntu-dev-tools
synced 2025-03-12 15:41:09 +00:00
Move debian-distro-info, distro-info, and ubuntu-distro-info from
ubuntu-dev-tools into distro-info.
This commit is contained in:
parent
0737f186fe
commit
a03fa654f3
@ -1,15 +0,0 @@
|
||||
version,codename,series,created,release,eol
|
||||
1.1,Buzz,buzz,1993-08-16,1996-06-17,1997-06-05
|
||||
1.2,Rex,rex,1996-06-17,1996-12-12,1998-06-05
|
||||
1.3,Bo,bo,1996-12-12,1997-06-05,1999-03-09
|
||||
2.0,Hamm,hamm,1997-06-05,1998-07-24,2000-03-09
|
||||
2.1,Slink,slink,1998-07-24,1999-03-09,2000-10-30
|
||||
2.2,Potato,potato,1999-03-09,2000-08-15,2003-07-30
|
||||
3.0,Woody,woody,2000-08-15,2002-07-19,2006-06-30
|
||||
3.1,Sarge,sarge,2002-07-19,2005-06-06,2008-03-30
|
||||
4.0,Etch,etch,2005-06-06,2007-04-08,2010-02-15
|
||||
5.0,Lenny,lenny,2007-04-08,2009-02-14,2012-02-06
|
||||
6.0,Squeeze,squeeze,2009-02-14,2011-02-06
|
||||
7.0,Wheezy,wheezy,2011-02-06
|
||||
,Sid,sid,1993-08-16
|
||||
,Experimental,experimental,1993-08-16
|
Can't render this file because it has a wrong number of fields in line 12.
|
@ -1,16 +0,0 @@
|
||||
version,codename,series,created,release,eol,eol-server
|
||||
4.10,Warty Warthog,warty,2004-03-05,2004-10-26,2006-04-26
|
||||
5.04,Hoary Hedgehog,hoary,2004-10-26,2005-04-08,2006-10-08
|
||||
5.10,Breezy Badger,breezy,2005-04-08,2005-10-12,2007-04-12
|
||||
6.06 LTS,Dapper Drake,dapper,2005-10-12,2006-06-01,2009-07-14,2011-06-01
|
||||
6.10,Edgy Eft,edgy,2006-06-01,2006-10-26,2008-04-25
|
||||
7.04,Feisty Fawn,feisty,2006-10-26,2007-04-19,2008-10-19
|
||||
7.10,Gutsy Gibbon,gutsy,2007-04-19,2007-10-18,2009-04-18
|
||||
8.04 LTS,Hardy Heron,hardy,2007-10-18,2008-04-24,2011-05-12,2013-04
|
||||
8.10,Intrepid Ibex,intrepid,2008-04-24,2008-10-30,2010-04-30
|
||||
9.04,Jaunty Jackalope,jaunty,2008-10-30,2009-04-23,2010-10-23
|
||||
9.10,Karmic Koala,karmic,2009-04-23,2009-10-29,2011-04-30
|
||||
10.04 LTS,Lucid Lynx,lucid,2009-10-29,2010-04-29,2013-04,2015-04
|
||||
10.10,Maverick Meerkat,maverick,2010-04-29,2010-10-10,2012-04
|
||||
11.04,Natty Narwhal,natty,2010-10-10,2011-04-28,2012-10
|
||||
11.10,Oneiric Ocelot,oneiric,2011-04-28,2011-10-13,2013-04
|
|
@ -1,94 +0,0 @@
|
||||
#!/usr/bin/python
|
||||
|
||||
# Copyright (C) 2009-2011, Benjamin Drung <bdrung@ubuntu.com>
|
||||
#
|
||||
# Permission to use, copy, modify, and/or distribute this software for any
|
||||
# purpose with or without fee is hereby granted, provided that the above
|
||||
# copyright notice and this permission notice appear in all copies.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
|
||||
"""provides information about Debian's distributions"""
|
||||
|
||||
import optparse
|
||||
import os
|
||||
import sys
|
||||
|
||||
from ubuntutools.distro_info import convert_date, DebianDistroInfo
|
||||
|
||||
def main():
|
||||
script_name = os.path.basename(sys.argv[0])
|
||||
usage = "%s [options]" % (script_name)
|
||||
epilog = "See %s(1) for more info." % (script_name)
|
||||
parser = optparse.OptionParser(usage=usage, epilog=epilog)
|
||||
|
||||
parser.add_option("--date", dest="date", default=None,
|
||||
help="date for calculating the version (default: today).")
|
||||
parser.add_option("-a", "--all", dest="all",
|
||||
help="list all known versions",
|
||||
action="store_true", default=False)
|
||||
parser.add_option("-d", "--devel", dest="devel",
|
||||
help="latest development version",
|
||||
action="store_true", default=False)
|
||||
parser.add_option("-o", "--old", dest="old",
|
||||
help="latest old (stable) version",
|
||||
action="store_true", default=False)
|
||||
parser.add_option("-s", "--stable", dest="stable",
|
||||
help="latest stable version",
|
||||
action="store_true", default=False)
|
||||
parser.add_option("--supported", dest="supported",
|
||||
help="list of all supported stable versions",
|
||||
action="store_true", default=False)
|
||||
parser.add_option("-t", "--testing", dest="testing",
|
||||
help="current testing version",
|
||||
action="store_true", default=False)
|
||||
parser.add_option("--unsupported", dest="unsupported",
|
||||
help="list of all unsupported stable versions",
|
||||
action="store_true", default=False)
|
||||
|
||||
(options, args) = parser.parse_args()
|
||||
|
||||
if len(args) != 0:
|
||||
parser.error("This script does not take any additional parameters.")
|
||||
|
||||
versions = [options.all, options.devel, options.old, options.stable,
|
||||
options.supported, options.testing, options.unsupported]
|
||||
if len([x for x in versions if x]) != 1:
|
||||
parser.error("You have to select exactly one of --all, --devel, --old, "
|
||||
"--stable, --supported, --testing, --unsupported.")
|
||||
|
||||
if options.date is None:
|
||||
date = None
|
||||
else:
|
||||
try:
|
||||
date = convert_date(options.date)
|
||||
except ValueError:
|
||||
parser.error("Option --date needs to be a date in ISO 8601 "
|
||||
"format.")
|
||||
|
||||
if options.all:
|
||||
for distro in DebianDistroInfo().all:
|
||||
print distro
|
||||
elif options.devel:
|
||||
print DebianDistroInfo().devel(date)
|
||||
elif options.old:
|
||||
print DebianDistroInfo().old(date)
|
||||
elif options.stable:
|
||||
print DebianDistroInfo().stable(date)
|
||||
elif options.supported:
|
||||
for distro in DebianDistroInfo().supported(date):
|
||||
print distro
|
||||
elif options.testing:
|
||||
print DebianDistroInfo().testing(date)
|
||||
elif options.unsupported:
|
||||
for distro in DebianDistroInfo().unsupported(date):
|
||||
print distro
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
7
debian/changelog
vendored
7
debian/changelog
vendored
@ -1,3 +1,10 @@
|
||||
ubuntu-dev-tools (0.127) UNRELEASED; urgency=low
|
||||
|
||||
* Move debian-distro-info, distro-info, and ubuntu-distro-info from
|
||||
ubuntu-dev-tools into distro-info.
|
||||
|
||||
-- Benjamin Drung <bdrung@debian.org> Sat, 25 Jun 2011 17:52:05 +0200
|
||||
|
||||
ubuntu-dev-tools (0.126) unstable; urgency=low
|
||||
|
||||
[ Evan Broder ]
|
||||
|
2
debian/control
vendored
2
debian/control
vendored
@ -9,6 +9,7 @@ Vcs-Browser: https://code.launchpad.net/~ubuntu-dev/ubuntu-dev-tools/trunk
|
||||
Build-Depends: dctrl-tools,
|
||||
debhelper (>= 7.0.50~),
|
||||
devscripts (>= 2.11.0~),
|
||||
distro-info (>= 0.2~),
|
||||
libwww-perl,
|
||||
lsb-release,
|
||||
pylint,
|
||||
@ -31,6 +32,7 @@ Depends: binutils,
|
||||
dctrl-tools,
|
||||
devscripts (>= 2.11.0~),
|
||||
diffstat,
|
||||
distro-info (>= 0.2~),
|
||||
dpkg-dev,
|
||||
lsb-release,
|
||||
python-apt (>= 0.7.93~),
|
||||
|
9
debian/copyright
vendored
9
debian/copyright
vendored
@ -168,25 +168,18 @@ License: GPL-3+
|
||||
On Debian systems, the complete text of the GNU General Public License
|
||||
version 3 can be found in the /usr/share/common-licenses/GPL-3 file.
|
||||
|
||||
Files: data/*
|
||||
debian-distro-info
|
||||
doc/debian-distro-info.1
|
||||
doc/distro-info.1
|
||||
doc/pull-debian-debdiff.1
|
||||
Files: doc/pull-debian-debdiff.1
|
||||
doc/pull-debian-source.1
|
||||
doc/sponsor-patch.1
|
||||
doc/ubuntu-dev-tools.5
|
||||
doc/ubuntu-distro-info.1
|
||||
doc/update-maintainer.1
|
||||
pull-debian-debdiff
|
||||
pull-debian-source
|
||||
sponsor-patch
|
||||
test-data/*
|
||||
ubuntu-distro-info
|
||||
ubuntutools/archive.py
|
||||
ubuntutools/builder.py
|
||||
ubuntutools/config.py
|
||||
ubuntutools/distro_info.py
|
||||
ubuntutools/question.py
|
||||
ubuntutools/sponsor_patch/*
|
||||
ubuntutools/test/*
|
||||
|
4
debian/rules
vendored
4
debian/rules
vendored
@ -3,10 +3,6 @@
|
||||
%:
|
||||
dh $@ --with python2
|
||||
|
||||
override_dh_auto_install:
|
||||
dh_auto_install
|
||||
ln -s $(shell dpkg-vendor --query Vendor | tr '[:upper:]' '[:lower:]')-distro-info debian/ubuntu-dev-tools/usr/bin/distro-info
|
||||
|
||||
ifeq (,$(filter nocheck,$(DEB_BUILD_OPTIONS)))
|
||||
override_dh_auto_test:
|
||||
set -e; \
|
||||
|
@ -1,54 +0,0 @@
|
||||
.\" Copyright (c) 2009-2011, Benjamin Drung <bdrung@ubuntu.com>
|
||||
.\"
|
||||
.\" Permission to use, copy, modify, and/or distribute this software for any
|
||||
.\" purpose with or without fee is hereby granted, provided that the above
|
||||
.\" copyright notice and this permission notice appear in all copies.
|
||||
.\"
|
||||
.\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
.\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
.\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
.\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
.\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
.\"
|
||||
.TH DEBIAN\-DISTRO\-INFO "1" "January 2011" "ubuntu\-dev\-tools"
|
||||
.SH NAME
|
||||
debian\-distro\-info \- provides information about Debian's distributions
|
||||
.SH SYNOPSIS
|
||||
.B debian\-distro\-info
|
||||
[\fIOPTIONS\fR]
|
||||
.SH OPTIONS
|
||||
.TP
|
||||
\fB\-\-date\fR=\fIDATE
|
||||
date for calculating the version (default: today)
|
||||
.TP
|
||||
\fB\-h\fR, \fB\-\-help\fR
|
||||
display help message and exit
|
||||
.TP
|
||||
\fB\-a\fR, \fB\-\-all\fR
|
||||
list all known versions
|
||||
.TP
|
||||
\fB\-d\fR, \fB\-\-devel\fR
|
||||
latest development version
|
||||
.TP
|
||||
\fB\-o\fR, \fB\-\-old\fR
|
||||
latest old (stable) version
|
||||
.TP
|
||||
\fB\-s\fR, \fB\-\-stable\fR
|
||||
latest stable version
|
||||
.TP
|
||||
\fB\-\-supported\fR
|
||||
list of all supported stable versions
|
||||
.TP
|
||||
\fB\-t\fR, \fB\-\-testing\fR
|
||||
latest testing version
|
||||
.TP
|
||||
\fB\-\-unsupported\fR
|
||||
list of all unsupported stable versions
|
||||
.SH SEE ALSO
|
||||
.BR distro\-info (1),
|
||||
.BR ubuntu\-distro\-info (1)
|
||||
.SH AUTHOR
|
||||
The script and this manual page was written by
|
||||
Benjamin Drung <bdrung@ubuntu.com>.
|
@ -1,58 +0,0 @@
|
||||
.\" Copyright (c) 2009-2011, Benjamin Drung <bdrung@ubuntu.com>
|
||||
.\"
|
||||
.\" Permission to use, copy, modify, and/or distribute this software for any
|
||||
.\" purpose with or without fee is hereby granted, provided that the above
|
||||
.\" copyright notice and this permission notice appear in all copies.
|
||||
.\"
|
||||
.\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
.\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
.\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
.\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
.\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
.\"
|
||||
.TH DISTRO\-INFO "1" "January 2011" "ubuntu\-dev\-tools"
|
||||
.SH NAME
|
||||
distro\-info \- provides information about the distributions' releases
|
||||
.SH SYNOPSIS
|
||||
.B distro\-info
|
||||
[\fIOPTIONS\fR]
|
||||
.SH DESCRIPTION
|
||||
.B distro\-info
|
||||
is a symlink to the distro\-info command for your distribution.
|
||||
On Debian it links to
|
||||
.B debian\-distro\-info
|
||||
and on Ubuntu it links to \fBubuntu\-distro\-info\fR.
|
||||
All options described in this manual page are available in all
|
||||
.B distro\-info
|
||||
commands. All other options, which are not described here, are distribution
|
||||
specific.
|
||||
.SH OPTIONS
|
||||
.TP
|
||||
\fB\-\-date\fR=\fIDATE
|
||||
date for calculating the version (default: today)
|
||||
.TP
|
||||
\fB\-h\fR, \fB\-\-help\fR
|
||||
display help message and exit
|
||||
.TP
|
||||
\fB\-a\fR, \fB\-\-all\fR
|
||||
list all known versions
|
||||
.TP
|
||||
\fB\-d\fR, \fB\-\-devel\fR
|
||||
latest development version
|
||||
.TP
|
||||
\fB\-s\fR, \fB\-\-stable\fR
|
||||
latest stable version
|
||||
.TP
|
||||
\fB\-\-supported\fR
|
||||
list of all supported stable versions
|
||||
.TP
|
||||
\fB\-\-unsupported\fR
|
||||
list of all unsupported stable versions
|
||||
.SH SEE ALSO
|
||||
.BR debian\-distro\-info (1),
|
||||
.BR ubuntu\-distro\-info (1)
|
||||
.SH AUTHOR
|
||||
The script and this manual page was written by
|
||||
Benjamin Drung <bdrung@ubuntu.com>.
|
@ -1,51 +0,0 @@
|
||||
.\" Copyright (c) 2009-2011, Benjamin Drung <bdrung@ubuntu.com>
|
||||
.\"
|
||||
.\" Permission to use, copy, modify, and/or distribute this software for any
|
||||
.\" purpose with or without fee is hereby granted, provided that the above
|
||||
.\" copyright notice and this permission notice appear in all copies.
|
||||
.\"
|
||||
.\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
.\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
.\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
.\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
.\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
.\"
|
||||
.TH UBUNTU\-DISTRO\-INFO "1" "January 2011" "ubuntu\-dev\-tools"
|
||||
.SH NAME
|
||||
ubuntu\-distro\-info \- provides information about Ubuntu's distributions
|
||||
.SH SYNOPSIS
|
||||
.B ubuntu\-distro\-info
|
||||
[\fIOPTIONS\fR]
|
||||
.SH OPTIONS
|
||||
.TP
|
||||
\fB\-\-date\fR=\fIDATE
|
||||
date for calculating the version (default: today)
|
||||
.TP
|
||||
\fB\-h\fR, \fB\-\-help\fR
|
||||
display help message and exit
|
||||
.TP
|
||||
\fB\-a\fR, \fB\-\-all\fR
|
||||
list all known versions
|
||||
.TP
|
||||
\fB\-d\fR, \fB\-\-devel\fR
|
||||
latest development version
|
||||
.TP
|
||||
\fB\-\-lts\fR
|
||||
latest long term support (LTS) version
|
||||
.TP
|
||||
\fB\-s\fR, \fB\-\-stable\fR
|
||||
latest stable version
|
||||
.TP
|
||||
\fB\-\-supported\fR
|
||||
list of all supported stable versions
|
||||
.TP
|
||||
\fB\-\-unsupported\fR
|
||||
list of all unsupported stable versions
|
||||
.SH SEE ALSO
|
||||
.BR debian\-distro\-info (1),
|
||||
.BR distro\-info (1)
|
||||
.SH AUTHOR
|
||||
The script and this manual page was written by
|
||||
Benjamin Drung <bdrung@ubuntu.com>.
|
@ -33,8 +33,8 @@ import os
|
||||
import sys
|
||||
|
||||
from devscripts.logger import Logger
|
||||
from distro_info import DebianDistroInfo
|
||||
|
||||
from ubuntutools.distro_info import DebianDistroInfo
|
||||
import ubuntutools.misc
|
||||
from ubuntutools import subprocess
|
||||
|
||||
|
@ -20,10 +20,10 @@ import optparse
|
||||
import sys
|
||||
|
||||
from devscripts.logger import Logger
|
||||
from distro_info import DebianDistroInfo
|
||||
|
||||
from ubuntutools.archive import DebianSourcePackage, DownloadError, rmadison
|
||||
from ubuntutools.config import UDTConfig
|
||||
from ubuntutools.distro_info import DebianDistroInfo
|
||||
|
||||
def is_suite(version):
|
||||
"""If version could be considered to be a Debian suite, return the
|
||||
|
@ -28,10 +28,10 @@ import sys
|
||||
from optparse import OptionParser
|
||||
|
||||
from devscripts.logger import Logger
|
||||
from distro_info import UbuntuDistroInfo
|
||||
|
||||
from ubuntutools.archive import UbuntuSourcePackage, DownloadError
|
||||
from ubuntutools.config import UDTConfig
|
||||
from ubuntutools.distro_info import UbuntuDistroInfo
|
||||
from ubuntutools.lp.lpapicache import Distribution, Launchpad
|
||||
from ubuntutools.lp.udtexceptions import (SeriesNotFoundException,
|
||||
PackageNotFoundException,
|
||||
|
@ -31,9 +31,9 @@ import os
|
||||
import sys
|
||||
|
||||
from debian.changelog import Version
|
||||
from distro_info import UbuntuDistroInfo
|
||||
|
||||
from ubuntutools.config import UDTConfig, ubu_email
|
||||
from ubuntutools.distro_info import UbuntuDistroInfo
|
||||
from ubuntutools.lp import udtexceptions
|
||||
from ubuntutools.misc import require_utf8
|
||||
from ubuntutools.requestsync.common import (edit_report, getDebianChangelog,
|
||||
|
2
setup.py
2
setup.py
@ -19,7 +19,6 @@ scripts = ['404main',
|
||||
'check-mir',
|
||||
'check-symbols',
|
||||
'dch-repeat',
|
||||
'debian-distro-info',
|
||||
'dgetlp',
|
||||
'get-branches',
|
||||
'get-build-deps',
|
||||
@ -49,7 +48,6 @@ scripts = ['404main',
|
||||
'submittodebian',
|
||||
'syncpackage',
|
||||
'ubuntu-build',
|
||||
'ubuntu-distro-info',
|
||||
'ubuntu-iso',
|
||||
'update-maintainer',
|
||||
]
|
||||
|
@ -22,12 +22,15 @@
|
||||
#
|
||||
# ##################################################################
|
||||
|
||||
import re, os, sys
|
||||
import os
|
||||
import re
|
||||
import sys
|
||||
from tempfile import mkstemp
|
||||
|
||||
from distro_info import UbuntuDistroInfo
|
||||
|
||||
from ubuntutools.config import ubu_email
|
||||
from ubuntutools.question import YesNoQuestion
|
||||
from ubuntutools.distro_info import UbuntuDistroInfo
|
||||
|
||||
try:
|
||||
from debian.changelog import Changelog
|
||||
|
@ -1,89 +0,0 @@
|
||||
#!/usr/bin/python
|
||||
|
||||
# Copyright (C) 2009-2011, Benjamin Drung <bdrung@ubuntu.com>
|
||||
#
|
||||
# Permission to use, copy, modify, and/or distribute this software for any
|
||||
# purpose with or without fee is hereby granted, provided that the above
|
||||
# copyright notice and this permission notice appear in all copies.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
|
||||
"""provides information about Ubuntu's distributions"""
|
||||
|
||||
import optparse
|
||||
import os
|
||||
import sys
|
||||
|
||||
from ubuntutools.distro_info import convert_date, UbuntuDistroInfo
|
||||
|
||||
def main():
|
||||
script_name = os.path.basename(sys.argv[0])
|
||||
usage = "%s [options]" % (script_name)
|
||||
epilog = "See %s(1) for more info." % (script_name)
|
||||
parser = optparse.OptionParser(usage=usage, epilog=epilog)
|
||||
|
||||
parser.add_option("--date", dest="date", default=None,
|
||||
help="date for calculating the version (default: today).")
|
||||
parser.add_option("-a", "--all", dest="all",
|
||||
help="list all known versions",
|
||||
action="store_true", default=False)
|
||||
parser.add_option("-d", "--devel", dest="devel",
|
||||
help="latest development version",
|
||||
action="store_true", default=False)
|
||||
parser.add_option("--lts", dest="lts",
|
||||
help="latest long term support (LTS) version",
|
||||
action="store_true", default=False)
|
||||
parser.add_option("-s", "--stable", dest="stable",
|
||||
help="latest stable version",
|
||||
action="store_true", default=False)
|
||||
parser.add_option("--supported", dest="supported",
|
||||
help="list of all supported stable versions",
|
||||
action="store_true", default=False)
|
||||
parser.add_option("--unsupported", dest="unsupported",
|
||||
help="list of all unsupported stable versions",
|
||||
action="store_true", default=False)
|
||||
|
||||
(options, args) = parser.parse_args()
|
||||
|
||||
if len(args) != 0:
|
||||
parser.error("This script does not take any additional parameters.")
|
||||
|
||||
versions = [options.all, options.devel, options.lts, options.stable,
|
||||
options.supported, options.unsupported]
|
||||
if len([x for x in versions if x]) != 1:
|
||||
parser.error("You have to select exactly one of --all, --devel, --lts, "
|
||||
"--stable, --supported, --unsupported.")
|
||||
|
||||
if options.date is None:
|
||||
date = None
|
||||
else:
|
||||
try:
|
||||
date = convert_date(options.date)
|
||||
except ValueError:
|
||||
parser.error("Option --date needs to be a date in ISO 8601 "
|
||||
"format.")
|
||||
|
||||
if options.all:
|
||||
for distro in UbuntuDistroInfo().all:
|
||||
print distro
|
||||
elif options.devel:
|
||||
print UbuntuDistroInfo().devel(date)
|
||||
elif options.lts:
|
||||
print UbuntuDistroInfo().lts(date)
|
||||
elif options.stable:
|
||||
print UbuntuDistroInfo().stable(date)
|
||||
elif options.supported:
|
||||
for distro in UbuntuDistroInfo().supported(date):
|
||||
print distro
|
||||
elif options.unsupported:
|
||||
for distro in UbuntuDistroInfo().unsupported(date):
|
||||
print distro
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
@ -1,222 +0,0 @@
|
||||
# Copyright (C) 2009-2011, Benjamin Drung <bdrung@ubuntu.com>
|
||||
#
|
||||
# Permission to use, copy, modify, and/or distribute this software for any
|
||||
# purpose with or without fee is hereby granted, provided that the above
|
||||
# copyright notice and this permission notice appear in all copies.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
|
||||
"""provides information about Ubuntu's and Debian's distributions"""
|
||||
|
||||
import csv
|
||||
import datetime
|
||||
import os
|
||||
|
||||
def convert_date(string):
|
||||
"""Convert a date string in ISO 8601 into a datetime object."""
|
||||
if not string:
|
||||
date = None
|
||||
else:
|
||||
parts = [int(x) for x in string.split("-")]
|
||||
if len(parts) == 3:
|
||||
(year, month, day) = parts
|
||||
date = datetime.date(year, month, day)
|
||||
elif len(parts) == 2:
|
||||
(year, month) = parts
|
||||
if month == 12:
|
||||
date = datetime.date(year, month, 31)
|
||||
else:
|
||||
date = datetime.date(year, month + 1, 1) - datetime.timedelta(1)
|
||||
else:
|
||||
raise ValueError("Date not in ISO 8601 format.")
|
||||
return date
|
||||
|
||||
def _get_data_dir():
|
||||
"""Get the data directory based on the module location."""
|
||||
if __file__.startswith("/usr/lib"):
|
||||
data_dir = "/usr/share/ubuntu-dev-tools"
|
||||
else:
|
||||
data_dir = os.path.join(os.path.dirname(__file__), "..", "data")
|
||||
return data_dir
|
||||
|
||||
|
||||
class DistroDataOutdated(Exception):
|
||||
"""Distribution data outdated."""
|
||||
|
||||
def __init__(self):
|
||||
super(DistroDataOutdated, self).__init__("Distribution data outdated.")
|
||||
|
||||
|
||||
class DistroInfo(object):
|
||||
"""Base class for distribution information.
|
||||
Use DebianDistroInfo or UbuntuDistroInfo instead of using this directly.
|
||||
"""
|
||||
|
||||
def __init__(self, distro):
|
||||
filename = os.path.join(_get_data_dir(), distro + ".csv")
|
||||
csvfile = open(filename)
|
||||
csv_reader = csv.DictReader(csvfile)
|
||||
self._rows = []
|
||||
for row in csv_reader:
|
||||
for column in ("created", "release", "eol", "eol-server"):
|
||||
if column in row:
|
||||
row[column] = convert_date(row[column])
|
||||
self._rows.append(row)
|
||||
self._date = datetime.date.today()
|
||||
|
||||
@property
|
||||
def all(self):
|
||||
"""List all known distributions."""
|
||||
return [x["series"] for x in self._rows]
|
||||
|
||||
def _avail(self, date):
|
||||
"""Return all distributions that were available on the given date."""
|
||||
return [x for x in self._rows if date >= x["created"]]
|
||||
|
||||
def devel(self, date=None):
|
||||
"""Get latest development distribution based on the given date."""
|
||||
if date is None:
|
||||
date = self._date
|
||||
distros = [x for x in self._avail(date)
|
||||
if x["release"] is None or
|
||||
(date < x["release"] and
|
||||
(x["eol"] is None or date <= x["eol"]))]
|
||||
if not distros:
|
||||
raise DistroDataOutdated()
|
||||
return distros[-1]["series"]
|
||||
|
||||
def stable(self, date=None):
|
||||
"""Get latest stable distribution based on the given date."""
|
||||
if date is None:
|
||||
date = self._date
|
||||
distros = [x for x in self._avail(date)
|
||||
if x["release"] is not None and date >= x["release"] and
|
||||
(x["eol"] is None or date <= x["eol"])]
|
||||
if not distros:
|
||||
raise DistroDataOutdated()
|
||||
return distros[-1]["series"]
|
||||
|
||||
def supported(self, date=None):
|
||||
"""Get list of all supported distributions based on the given date."""
|
||||
raise NotImplementedError()
|
||||
|
||||
def valid(self, codename):
|
||||
"""Check if the given codename is known."""
|
||||
return codename in self.all
|
||||
|
||||
def codename(self, release, date=None, default=None):
|
||||
"""Map codename aliases to the codename they describe"""
|
||||
return release
|
||||
|
||||
def unsupported(self, date=None):
|
||||
"""Get list of all unsupported distributions based on the given date."""
|
||||
if date is None:
|
||||
date = self._date
|
||||
supported = self.supported(date)
|
||||
distros = [x["series"] for x in self._avail(date)
|
||||
if x["series"] not in supported]
|
||||
return distros
|
||||
|
||||
|
||||
class DebianDistroInfo(DistroInfo):
|
||||
"""provides information about Debian's distributions"""
|
||||
|
||||
def __init__(self):
|
||||
super(DebianDistroInfo, self).__init__("debian")
|
||||
|
||||
def codename(self, release, date=None, default=None):
|
||||
"""Map 'unstable', 'testing', etc. to their codenames."""
|
||||
if release == "unstable":
|
||||
codename = self.devel(date)
|
||||
elif release == "testing":
|
||||
codename = self.testing(date)
|
||||
elif release == "stable":
|
||||
codename = self.stable(date)
|
||||
elif release == "old":
|
||||
codename = self.old(date)
|
||||
else:
|
||||
codename = default
|
||||
return codename
|
||||
|
||||
def devel(self, date=None):
|
||||
"""Get latest development distribution based on the given date."""
|
||||
if date is None:
|
||||
date = self._date
|
||||
distros = [x for x in self._avail(date)
|
||||
if x["release"] is None or
|
||||
(date < x["release"] and
|
||||
(x["eol"] is None or date <= x["eol"]))]
|
||||
if len(distros) < 2:
|
||||
raise DistroDataOutdated()
|
||||
return distros[-2]["series"]
|
||||
|
||||
def old(self, date=None):
|
||||
"""Get old (stable) Debian distribution based on the given date."""
|
||||
if date is None:
|
||||
date = self._date
|
||||
distros = [x for x in self._avail(date)
|
||||
if x["release"] is not None and date >= x["release"]]
|
||||
if len(distros) < 2:
|
||||
raise DistroDataOutdated()
|
||||
return distros[-2]["series"]
|
||||
|
||||
def supported(self, date=None):
|
||||
"""Get list of all supported Debian distributions based on the given
|
||||
date."""
|
||||
if date is None:
|
||||
date = self._date
|
||||
distros = [x["series"] for x in self._avail(date)
|
||||
if x["eol"] is None or date <= x["eol"]]
|
||||
return distros
|
||||
|
||||
def testing(self, date=None):
|
||||
"""Get latest testing Debian distribution based on the given date."""
|
||||
if date is None:
|
||||
date = self._date
|
||||
distros = [x for x in self._avail(date)
|
||||
if (x["release"] is None and x["version"]) or
|
||||
(x["release"] is not None and date < x["release"] and
|
||||
(x["eol"] is None or date <= x["eol"]))]
|
||||
if not distros:
|
||||
raise DistroDataOutdated()
|
||||
return distros[-1]["series"]
|
||||
|
||||
def valid(self, codename):
|
||||
"""Check if the given codename is known."""
|
||||
return DistroInfo.valid(self, codename) or \
|
||||
codename in ["unstable", "testing", "stable", "old"]
|
||||
|
||||
|
||||
class UbuntuDistroInfo(DistroInfo):
|
||||
"""provides information about Ubuntu's distributions"""
|
||||
|
||||
def __init__(self):
|
||||
super(UbuntuDistroInfo, self).__init__("ubuntu")
|
||||
|
||||
def lts(self, date=None):
|
||||
"""Get latest long term support (LTS) Ubuntu distribution based on the
|
||||
given date."""
|
||||
if date is None:
|
||||
date = self._date
|
||||
distros = [x for x in self._rows if x["version"].find("LTS") >= 0 and
|
||||
date >= x["release"] and
|
||||
date <= x["eol"]]
|
||||
if not distros:
|
||||
raise DistroDataOutdated()
|
||||
return distros[-1]["series"]
|
||||
|
||||
def supported(self, date=None):
|
||||
"""Get list of all supported Ubuntu distributions based on the given
|
||||
date."""
|
||||
if date is None:
|
||||
date = self._date
|
||||
distros = [x["series"] for x in self._avail(date)
|
||||
if date <= x["eol"] or
|
||||
(x["eol-server"] is not None and date <= x["eol-server"])]
|
||||
return distros
|
@ -28,7 +28,8 @@ import os
|
||||
import os.path
|
||||
import sys
|
||||
|
||||
from ubuntutools import distro_info
|
||||
import distro_info
|
||||
|
||||
from ubuntutools.lp.udtexceptions import PocketDoesNotExistError
|
||||
from ubuntutools.subprocess import Popen, PIPE
|
||||
|
||||
|
@ -20,7 +20,8 @@
|
||||
# Please see the /usr/share/common-licenses/GPL-2 file for the full text
|
||||
# of the GNU General Public License license.
|
||||
|
||||
from ubuntutools.distro_info import DebianDistroInfo
|
||||
from distro_info import DebianDistroInfo
|
||||
|
||||
from ubuntutools.requestsync.common import raw_input_exit_on_ctrlc
|
||||
from ubuntutools.lp.lpapicache import (Launchpad, Distribution, PersonTeam,
|
||||
DistributionSourcePackage)
|
||||
|
@ -24,9 +24,11 @@ import os
|
||||
import sys
|
||||
import smtplib
|
||||
import socket
|
||||
|
||||
from debian.changelog import Version
|
||||
from distro_info import DebianDistroInfo
|
||||
|
||||
from ubuntutools.archive import rmadison, FakeSPPH
|
||||
from ubuntutools.distro_info import DebianDistroInfo
|
||||
from ubuntutools.requestsync.common import raw_input_exit_on_ctrlc
|
||||
from ubuntutools import subprocess
|
||||
from ubuntutools.lp.udtexceptions import PackageNotFoundException
|
||||
|
@ -20,11 +20,10 @@ import re
|
||||
import urllib
|
||||
|
||||
import debian.debian_support
|
||||
import distro_info
|
||||
|
||||
from devscripts.logger import Logger
|
||||
|
||||
from ubuntutools.distro_info import DebianDistroInfo
|
||||
|
||||
class BugTask(object):
|
||||
def __init__(self, bug_task, launchpad):
|
||||
self.bug_task = bug_task
|
||||
@ -98,9 +97,9 @@ class BugTask(object):
|
||||
if "experimental" in title:
|
||||
series = "experimental"
|
||||
elif "testing" in title:
|
||||
series = DebianDistroInfo().testing()
|
||||
series = distro_info.DebianDistroInfo().testing()
|
||||
else:
|
||||
series = DebianDistroInfo().devel()
|
||||
series = distro_info.DebianDistroInfo().devel()
|
||||
status = "Pending"
|
||||
else:
|
||||
project = self.project
|
||||
|
@ -1,125 +0,0 @@
|
||||
# test_distro_info.py - Test suite for ubuntutools.distro_info
|
||||
#
|
||||
# Copyright (C) 2011, Benjamin Drung <bdrung@ubuntu.com>
|
||||
#
|
||||
# Permission to use, copy, modify, and/or distribute this software for any
|
||||
# purpose with or without fee is hereby granted, provided that the above
|
||||
# copyright notice and this permission notice appear in all copies.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
|
||||
"""Test suite for ubuntutools.distro_info"""
|
||||
|
||||
import datetime
|
||||
|
||||
from ubuntutools.test import unittest
|
||||
from ubuntutools.distro_info import DebianDistroInfo, UbuntuDistroInfo
|
||||
|
||||
#pylint: disable=R0904
|
||||
class DebianDistroInfoTestCase(unittest.TestCase):
|
||||
"""TestCase object for ubuntutools.distro_info.DebianDistroInfo"""
|
||||
|
||||
#pylint: disable=C0103
|
||||
def setUp(self):
|
||||
self._distro_info = DebianDistroInfo()
|
||||
self._date = datetime.date(2011, 01, 10)
|
||||
|
||||
#pylint: enable=C0103
|
||||
def test_all(self):
|
||||
"""Test: List all known Debian distributions."""
|
||||
all_distros = set(["buzz", "rex", "bo", "hamm", "slink", "potato",
|
||||
"woody", "sarge", "etch", "lenny", "squeeze", "sid",
|
||||
"experimental"])
|
||||
self.assertEqual(all_distros - set(self._distro_info.all), set())
|
||||
|
||||
def test_devel(self):
|
||||
"""Test: Get latest development Debian distribution."""
|
||||
self.assertEqual(self._distro_info.devel(self._date), "sid")
|
||||
|
||||
def test_old(self):
|
||||
"""Test: Get old (stable) Debian distribution."""
|
||||
self.assertEqual(self._distro_info.old(self._date), "etch")
|
||||
|
||||
def test_stable(self):
|
||||
"""Test: Get latest stable Debian distribution."""
|
||||
self.assertEqual(self._distro_info.stable(self._date), "lenny")
|
||||
|
||||
def test_supported(self):
|
||||
"""Test: List all supported Debian distribution."""
|
||||
self.assertEqual(self._distro_info.supported(self._date),
|
||||
["lenny", "squeeze", "sid", "experimental"])
|
||||
|
||||
def test_testing(self):
|
||||
"""Test: Get latest testing Debian distribution."""
|
||||
self.assertEqual(self._distro_info.testing(self._date), "squeeze")
|
||||
|
||||
def test_valid(self):
|
||||
"""Test: Check for valid Debian distribution."""
|
||||
self.assertTrue(self._distro_info.valid("sid"))
|
||||
self.assertTrue(self._distro_info.valid("stable"))
|
||||
self.assertFalse(self._distro_info.valid("foobar"))
|
||||
|
||||
def test_unsupported(self):
|
||||
"""Test: List all unsupported Debian distribution."""
|
||||
unsupported = ["buzz", "rex", "bo", "hamm", "slink", "potato", "woody",
|
||||
"sarge", "etch"]
|
||||
self.assertEqual(self._distro_info.unsupported(self._date), unsupported)
|
||||
|
||||
|
||||
#pylint: disable=R0904
|
||||
class UbuntuDistroInfoTestCase(unittest.TestCase):
|
||||
"""TestCase object for ubuntutools.distro_info.UbuntuDistroInfo"""
|
||||
|
||||
#pylint: disable=C0103
|
||||
def setUp(self):
|
||||
self._distro_info = UbuntuDistroInfo()
|
||||
self._date = datetime.date(2011, 01, 10)
|
||||
|
||||
#pylint: enable=C0103
|
||||
def test_all(self):
|
||||
"""Test: List all known Ubuntu distributions."""
|
||||
all_distros = set(["warty", "hoary", "breezy", "dapper", "edgy",
|
||||
"feisty", "gutsy", "hardy", "intrepid", "jaunty",
|
||||
"karmic", "lucid", "maverick", "natty"])
|
||||
self.assertEqual(all_distros - set(self._distro_info.all), set())
|
||||
|
||||
def test_devel(self):
|
||||
"""Test: Get latest development Ubuntu distribution."""
|
||||
self.assertEqual(self._distro_info.devel(self._date), "natty")
|
||||
|
||||
def test_lts(self):
|
||||
"""Test: Get latest long term support (LTS) Ubuntu distribution."""
|
||||
self.assertEqual(self._distro_info.lts(self._date), "lucid")
|
||||
|
||||
def test_stable(self):
|
||||
"""Test: Get latest stable Ubuntu distribution."""
|
||||
self.assertEqual(self._distro_info.stable(self._date), "maverick")
|
||||
|
||||
def test_supported(self):
|
||||
"""Test: List all supported Ubuntu distribution."""
|
||||
supported = ["dapper", "hardy", "karmic", "lucid", "maverick", "natty"]
|
||||
self.assertEqual(self._distro_info.supported(self._date), supported)
|
||||
|
||||
def test_unsupported(self):
|
||||
"""Test: List all unsupported Ubuntu distributions."""
|
||||
unsupported = ["warty", "hoary", "breezy", "edgy", "feisty", "gutsy",
|
||||
"intrepid", "jaunty"]
|
||||
self.assertEqual(self._distro_info.unsupported(self._date), unsupported)
|
||||
|
||||
def test_current_unsupported(self):
|
||||
"""Test: List all unsupported Ubuntu distributions today."""
|
||||
unsupported = set(["warty", "hoary", "breezy", "edgy", "feisty",
|
||||
"gutsy", "intrepid", "jaunty"])
|
||||
self.assertEqual(unsupported -
|
||||
set(self._distro_info.unsupported()), set())
|
||||
|
||||
def test_valid(self):
|
||||
"""Test: Check for valid Ubuntu distribution."""
|
||||
self.assertTrue(self._distro_info.valid("lucid"))
|
||||
self.assertFalse(self._distro_info.valid("42"))
|
Loading…
x
Reference in New Issue
Block a user