Trisquel distro-info for 10.0

This commit is contained in:
Luis Guzmán 2021-12-20 03:48:57 +00:00
parent 6f15229c56
commit 199f6cf527
6 changed files with 826 additions and 0 deletions

View file

@ -0,0 +1,119 @@
diff -Nru source/distro-info-util.c source_b/distro-info-util.c
--- source/distro-info-util.c 2019-03-07 13:33:56.000000000 -0600
+++ source_b/distro-info-util.c 2021-12-17 09:47:58.217720979 -0600
@@ -545,7 +545,7 @@
#endif
" -a --all list all known versions\n"
" -d --devel latest development version\n"
-#ifdef UBUNTU
+#ifdef TRISQUEL
" --lts latest long term support (LTS) version\n"
#endif
#ifdef DEBIAN
@@ -553,9 +553,6 @@
#endif
" -s --stable latest stable version\n"
" --supported list of all supported stable versions\n"
-#ifdef UBUNTU
- " --supported-esm list of all Ubuntu Advantage supported stable versions\n"
-#endif
#ifdef DEBIAN
" -t --testing current testing version\n"
#endif
@@ -573,16 +570,13 @@
"--alias, "
#endif
"--all, --devel, "
-#ifdef UBUNTU
+#ifdef TRISQUEL
"--latest, --lts, "
#endif
#ifdef DEBIAN
"--oldstable, "
#endif
"--stable, --supported, "
-#ifdef UBUNTU
- "--supported-esm, "
-#endif
"--series, "
#ifdef DEBIAN
"--testing, "
@@ -611,7 +605,7 @@
#ifdef DEBIAN
char *alias_codename = NULL;
#endif
-#ifdef UBUNTU
+#ifdef TRISQUEL
bool filter_latest = false;
#endif
@@ -624,9 +618,6 @@
{"devel", no_argument, NULL, 'd' },
{"stable", no_argument, NULL, 's' },
{"supported", no_argument, NULL, 'S' },
-#ifdef UBUNTU
- {"supported-esm", no_argument, NULL, 'e' },
-#endif
{"unsupported", no_argument, NULL, 'U' },
{"codename", no_argument, NULL, 'c' },
{"fullname", no_argument, NULL, 'f' },
@@ -636,14 +627,14 @@
{"oldstable", no_argument, NULL, 'o' },
{"testing", no_argument, NULL, 't' },
#endif
-#ifdef UBUNTU
+#ifdef TRISQUEL
{"latest", no_argument, NULL, 'l' },
{"lts", no_argument, NULL, 'L' },
#endif
{NULL, 0, NULL, '\0' }
};
-#ifdef UBUNTU
+#ifdef TRISQUEL
const char *short_options = "hadscrfly::";
#endif
#ifdef DEBIAN
@@ -689,7 +680,7 @@
case 'd':
selected_filters++;
filter_cb = filter_devel;
-#ifdef UBUNTU
+#ifdef TRISQUEL
select_cb = select_latest_created;
#endif
#ifdef DEBIAN
@@ -740,7 +731,7 @@
free(date);
return EXIT_SUCCESS;
-#ifdef UBUNTU
+#ifdef TRISQUEL
case 'l':
selected_filters++;
filter_latest = true;
@@ -782,15 +773,6 @@
select_cb = NULL;
break;
-#ifdef UBUNTU
- case 'e':
- // Only long option --supported-esm is used
- selected_filters++;
- filter_cb = filter_esm_supported;
- select_cb = NULL;
- break;
-
-#endif
#ifdef DEBIAN
case 't':
selected_filters++;
@@ -922,7 +904,7 @@
selected = select_series(distro_list, series_name);
} else {
selected = get_distro(distro_list, date, filter_cb, select_cb);
-#ifdef UBUNTU
+#ifdef TRISQUEL
if(selected == NULL && filter_latest) {
selected = get_distro(distro_list, date, filter_stable, select_latest_release);
}

View file

@ -0,0 +1,67 @@
diff -Nru source/python/distro_info.py source_b/python/distro_info.py
--- source/python/distro_info.py 2019-03-07 13:33:56.000000000 -0600
+++ source_b/python/distro_info.py 2021-12-17 15:44:54.509722643 -0600
@@ -1,3 +1,4 @@
+# Copyright (C) 2021, Trisquel GNU/Linux developers <trisquel-devel@listas.trisquel.info>
# Copyright (C) 2009-2012, Benjamin Drung <bdrung@debian.org>
#
# Permission to use, copy, modify, and/or distribute this software for any
@@ -12,7 +13,7 @@
# 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"""
+"""provides information about Trisquel's and Debian's distributions"""
import csv
import datetime
@@ -83,7 +84,7 @@
class DistroInfo(object):
"""Base class for distribution information.
- Use DebianDistroInfo or UbuntuDistroInfo instead of using this directly.
+ Use DebianDistroInfo or TrisquelDistroInfo instead of using this directly.
"""
def __init__(self, distro):
@@ -237,14 +238,14 @@
codename in ["unstable", "testing", "stable", "oldstable"])
-class UbuntuDistroInfo(DistroInfo):
- """provides information about Ubuntu's distributions"""
+class TrisquelDistroInfo(DistroInfo):
+ """provides information about Trisquel's distributions"""
def __init__(self):
- super(UbuntuDistroInfo, self).__init__("Ubuntu")
+ super(TrisquelDistroInfo, self).__init__("Trisquel")
def lts(self, date=None, result="codename"):
- """Get latest long term support (LTS) Ubuntu distribution based on the
+ """Get latest long term support (LTS) Trisquel distribution based on the
given date."""
if date is None:
date = self._date
@@ -262,7 +263,7 @@
return "LTS" in distros[0].version
def supported(self, date=None, result="codename"):
- """Get list of all supported Ubuntu distributions based on the given
+ """Get list of all supported Trisquel distributions based on the given
date."""
if date is None:
date = self._date
@@ -270,12 +271,3 @@
if date <= x.eol or
(x.eol_server is not None and date <= x.eol_server)]
return distros
-
- def supported_esm(self, date=None, result="codename"):
- """Get list of all ESM supported Ubuntu distributions based on the
- given date."""
- if date is None:
- date = self._date
- distros = [self._format(result, x) for x in self._avail(date)
- if x.eol_esm is not None and date <= x.eol_esm]
- return distros

View file

@ -0,0 +1,282 @@
#!/bin/sh
# Copyright (C) 2021, Trisquel GNU/Linux developers <trisquel-devel@listas.trisquel.info>
# Copyright (C) 2012-2014, Benjamin Drung <bdrung@debian.org>
#
# 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.
COMMAND="${0%/*}/trisquel-distro-info"
. "${0%/*}/shunit2-helper-functions.sh"
testAll() {
local result="toutanis
belenos
flidas
etiona"
local pattern=$(echo $result | sed "s/ /\\\\|/g")
success "--date 2019-07-07 --all | grep -w \"$pattern\"" "$result"
success "-a | grep -w \"$pattern\"" "$result"
}
testDevel() {
success "--date 2019-01-10 --devel" "etiona"
success "--date 2017-05-10 -d --codename" "flidas"
}
testLatest() {
success "--date 2014-01-10 --latest" "belenos"
success "--date 2015-05-10 -l --codename" "belenos"
}
testLTS() {
success "--lts --date=2013-05-10" "toutanis"
}
testStable() {
success "--date=2014-01-10 -c --stable" "toutanis"
success "--date=2019-01-10 -s" "flidas"
}
testSupported() {
local result="belenos
flidas
etiona"
success "--date=2018-05-10 --supported" "$result"
}
testUnsupported() {
local result="dwyn"
success "--date=2011-01-10 --unsupported" "$result"
}
testFullname() {
success "--date=2013-08-10 --fullname --lts" \
'Trisquel GNU/Linux 6.0 LTS "Toutanis"'
success "--date=2013-08-10 --fullname --lts -y" \
'Trisquel GNU/Linux 6.0 LTS "Toutanis" -152'
success "--date=2013-08-10 --fullname --lts --days" \
'Trisquel GNU/Linux 6.0 LTS "Toutanis" -152'
success "--date=2013-08-10 --fullname --lts -ycreated" \
'Trisquel GNU/Linux 6.0 LTS "Toutanis" -667'
success "--date=2013-08-10 --fullname --lts --days=created" \
'Trisquel GNU/Linux 6.0 LTS "Toutanis" -667'
success "--date=2013-08-10 --fullname --lts -yrelease" \
'Trisquel GNU/Linux 6.0 LTS "Toutanis" -152'
success "--date=2013-08-10 --fullname --lts --days=release" \
'Trisquel GNU/Linux 6.0 LTS "Toutanis" -152'
success "--date=2013-08-10 --fullname --lts -yeol" \
'Trisquel GNU/Linux 6.0 LTS "Toutanis" 1357'
success "--date=2013-08-10 --fullname --lts --days=eol" \
'Trisquel GNU/Linux 6.0 LTS "Toutanis" 1357'
}
testRelease() {
success "--date=2013-08-10 --lts --release" "6.0 LTS"
success "--date=2013-08-10 --lts --release -ycreated" \
"6.0 LTS -667"
success "--date=2013-08-10 --lts --release --days=created" \
"6.0 LTS -667"
success "--date=2013-08-10 --lts --release --days" \
"6.0 LTS -152"
success "--date=2013-08-10 --lts --release -y" \
"6.0 LTS -152"
success "--date=2013-08-10 --lts --release --days=release" \
"6.0 LTS -152"
success "--date=2013-08-10 --lts --release -yrelease" \
"6.0 LTS -152"
success "--date=2013-08-10 --lts --release --days=eol" \
"6.0 LTS 1357"
success "--date=2013-08-10 --lts --release -yeol" \
"6.0 LTS 1357"
success "--date=2013-11-10 -r --stable" "6.0 LTS"
}
testSeries() {
success "-r --series etiona" "9.0 LTS"
}
testCombinedShortform() {
success "-fs --date=2013-08-10" 'Trisquel GNU/Linux 6.0 LTS "Toutanis"'
}
testReleaseDate() {
success "--date 2013-08-10 -s" "toutanis"
success "--date 2016-11-03 -d" "flidas"
success "--date 2018-04-18 -s" "flidas"
success "--date 2020-10-16 -d" "nabia"
}
testHelp() {
local help='Usage: trisquel-distro-info [options]
Options:
-h --help show this help message and exit
--date=DATE date for calculating the version (default: today)
--series=SERIES series to calculate the version for
-y[MILESTONE] additionally, display days until milestone
--days=[MILESTONE] (created, release, eol)
-a --all list all known versions
-d --devel latest development version
--lts latest long term support (LTS) version
-s --stable latest stable version
--supported list of all supported stable versions
--unsupported list of all unsupported stable versions
-c --codename print the codename (default)
-f --fullname print the full name
-r --release print the release version
See trisquel-distro-info(1) for more info.'
success "--help" "$help"
success "-h" "$help"
}
testExactlyOne() {
local result='trisquel-distro-info: You have to select exactly one of --all, --devel, --latest, --lts, --stable, --supported, --series, --unsupported.'
failure "" "$result"
failure "--date=2013-08-10 -sad" "$result"
}
testUnrecognizedOption() {
failure "--bar" "trisquel-distro-info: unrecognized option \`--bar'"
failure "-z" "trisquel-distro-info: unrecognized option \`-z'"
failure "--testing" "trisquel-distro-info: unrecognized option \`--testing'"
failure "--oldstable" "trisquel-distro-info: unrecognized option \`--oldstable'"
}
testUnrecognizedArguments() {
failure "foo" "trisquel-distro-info: unrecognized arguments: foo"
failure "foo --all bar" "trisquel-distro-info: unrecognized arguments: foo bar"
}
testMissingArgumentDate() {
failure "--date" "trisquel-distro-info: option \`--date' requires an argument DATE"
}
testMissingArgumentSeries() {
failure "--series" "trisquel-distro-info: option \`--series' requires an argument SERIES"
}
testDistributionDataOutdated() {
local future_year=$(expr $(date +"%Y" --date=now) + 7)
local outdated_e="Distribution data outdated.
Please check for an update for distro-info-data. See /usr/share/doc/distro-info-data/README.Debian for details."
failure "--date 1970-10-03 --lts" "trisquel-distro-info: $outdated_e"
failure "--date ${future_year}-10-03 -s" "trisquel-distro-info: $outdated_e"
failure "--date ${future_year}-10-03 -d" "trisquel-distro-info: $outdated_e"
failure "--date ${future_year}-10-03 -l" "trisquel-distro-info: $outdated_e"
}
testInvalidDate() {
failure "--date fail -s" "trisquel-distro-info: invalid date \`fail'"
failure "--date=2010-02-30 -d" "trisquel-distro-info: invalid date \`2010-02-30'"
}
testInvalidSeries() {
failure "--series wr0ng" "trisquel-distro-info: invalid distribution series \`wr0ng'"
}
testMultipleDates() {
failure "--date 2007-06-05 -s --date 2004-03-02" "trisquel-distro-info: Date specified multiple times."
}
testMultipleSeries() {
failure "--series flidas --series etiona" "trisquel-distro-info: series requested multiple times."
}
testUnknownSeries() {
failure "--series foobar" "trisquel-distro-info: unknown distribution series \`foobar'"
}
testDays() {
# day after belenos released
date=2014-11-04
success "--date=$date --lts" "belenos"
success "--date=$date --lts --days=created" "-383"
success "--date=$date --lts --days=created -c" "belenos -383"
success "--date=$date --lts --days=created -f" "Trisquel GNU/Linux 7.0 LTS \"Belenos\" -383"
success "--date=$date --lts --days=created -r" "7.0 LTS -383"
success "--date=$date --lts --days=release" "-1"
success "--date=$date --lts --days=release -c" "belenos -1"
success "--date=$date --lts --days=release -f" "Trisquel GNU/Linux 7.0 LTS \"Belenos\" -1"
success "--date=$date --lts --days=release -r" "7.0 LTS -1"
success "--date=$date --lts --days" "-1"
success "--date=$date --lts --days -c" "belenos -1"
success "--date=$date --lts --days -f" "Trisquel GNU/Linux 7.0 LTS \"Belenos\" -1"
success "--date=$date --lts --days -r" "7.0 LTS -1"
success "--date=$date --lts --days=eol" "1633"
success "--date=$date --lts --days=eol -c" "belenos 1633"
success "--date=$date --lts --days=eol -f" "Trisquel GNU/Linux 7.0 LTS \"Belenos\" 1633"
success "--date=$date --lts --days=eol -r" "7.0 LTS 1633"
# date flidas released
date=2018-04-18
success "--date=$date --lts" "flidas"
success "--date=$date --lts --days=created" "-909"
success "--date=$date --lts --days=created -c" "flidas -909"
success "--date=$date --lts --days=created -f" "Trisquel GNU/Linux 8.0 LTS \"Flidas\" -909"
success "--date=$date --lts --days=created -r" "8.0 LTS -909"
success "--date=$date --lts --days=release" "0"
success "--date=$date --lts --days=release -c" "flidas 0"
success "--date=$date --lts --days=release -f" "Trisquel GNU/Linux 8.0 LTS \"Flidas\" 0"
success "--date=$date --lts --days=release -r" "8.0 LTS 0"
success "--date=$date --lts --days" "0"
success "--date=$date --lts --days -c" "flidas 0"
success "--date=$date --lts --days -f" "Trisquel GNU/Linux 8.0 LTS \"Flidas\" 0"
success "--date=$date --lts --days -r" "8.0 LTS 0"
success "--date=$date --lts --days=eol" "1099"
success "--date=$date --lts --days=eol -c" "flidas 1099"
success "--date=$date --lts --days=eol -f" "Trisquel GNU/Linux 8.0 LTS \"Flidas\" 1099"
success "--date=$date --lts --days=eol -r" "8.0 LTS 1099"
# day before etiona was released
date=2020-10-15
success "--devel --date=$date" "nabia"
success "--devel --date=$date --days=created" "-364"
success "--devel --date=$date --days=created -c" "nabia -364"
success "--devel --date=$date --days=created -r" "10.0 LTS -364"
success "--devel --date=$date --days=created -f" "Trisquel GNU/Linux 10.0 LTS \"Nabia\" -364"
success "--devel --date=$date --days" "427"
success "--devel --date=$date --days -c" "nabia 427"
success "--devel --date=$date --days -r" "10.0 LTS 427"
success "--devel --date=$date --days -f" "Trisquel GNU/Linux 10.0 LTS \"Nabia\" 427"
success "--devel --date=$date --days=release" "427"
success "--devel --date=$date --days=release -c" "nabia 427"
success "--devel --date=$date --days=release -r" "10.0 LTS 427"
success "--devel --date=$date --days=release -f" "Trisquel GNU/Linux 10.0 LTS \"Nabia\" 427"
success "--devel --date=$date --days=eol" "1651"
success "--devel --date=$date --days=eol -c" "nabia 1651"
success "--devel --date=$date --days=eol -r" "10.0 LTS 1651"
success "--devel --date=$date --days=eol -f" "Trisquel GNU/Linux 10.0 LTS \"Nabia\" 1651"
}
. shunit2

120
helpers/DATA/distro-info/test.pl Executable file
View file

@ -0,0 +1,120 @@
#!/usr/bin/perl
# Copyright (C) 2011-2012, Stefano Rivera <stefanor@debian.org>
#
# 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.
use strict;
use warnings;
use Test::Simple tests => 28;
use lib '.';
use Debian::DistroInfo;
sub unique {
my ($needles, $haystack) = @_;
my $unique = 0;
my %hash = ();
@hash{@$haystack}=();
for my $needle (@$needles) {
$unique++ if not exists($hash{$needle});
}
return $unique;
}
sub symmetric_difference {
my ($a, $b) = @_;
return unique($a, $b) + unique($b, $a);
}
my @all = ();
my @returned = ();
# Test our helpers:
@all = ('a', 'b', 'c');
@returned = ('a', 'b', 'c');
ok(unique(\@all, \@returned) == 0, 'unique: Matching lists');
ok(symmetric_difference(\@all, \@returned) == 0,
'symmetric_difference: Matching lists');
@returned = ('a', 'b');
ok(unique(\@all, \@returned) == 1, 'unique: 1 Unique Item');
ok(unique(\@returned, \@all) == 0, 'unique: 1 Unique Item in the haystack');
ok(symmetric_difference(\@all, \@returned) == 1,
'symmetric_difference: 1 Unique Item');
# Test DistroInfo:
my @expected = ();
my $date = Debian::DistroInfo::convert_date('2011-01-10');
my $deb = DebianDistroInfo->new();
@all = ('buzz', 'rex', 'bo', 'hamm', 'slink', 'potato', 'woody', 'sarge',
'etch', 'lenny', 'squeeze', 'sid', 'experimental');
@returned = $deb->all($date);
ok(unique(\@all, \@returned) == 0, 'Debian all');
ok($deb->devel($date) eq 'sid', 'Debian devel');
ok($deb->old($date) eq 'etch', 'Debian oldstable');
ok($deb->stable($date) eq 'lenny', 'Debian stable');
ok($deb->testing($date) eq 'squeeze', 'Debian testing');
ok($deb->valid('sid'), 'Debian valid');
ok($deb->valid('stable'), 'Debian valid');
ok(!$deb->valid('foobar'), 'Debian invalid');
@expected = ('lenny', 'squeeze', 'sid', 'experimental');
@returned = $deb->supported($date);
ok(symmetric_difference(\@expected, \@returned) == 0,
'Debian supported');
@expected = ('buzz', 'rex', 'bo', 'hamm', 'slink', 'potato', 'woody', 'sarge',
'etch');
@returned = $deb->unsupported($date);
ok(symmetric_difference(\@expected, \@returned) == 0,
'Debian unsupported');
ok(!defined($deb->codename('foo')), 'Debian codename, invalid');
ok($deb->codename('testing', $date) eq $deb->testing($date),
'Debian codename');
my $tris = TrisquelDistroInfo->new();
@all = ('robur',
'dwyn',
'awen',
'taranis',
'slaine',
'dagda');
@returned = $tris->all($date);
ok(unique(\@all, \@returned) == 0, 'Trisquel GNU/Linux all');
ok($tris->devel($date) eq 'dagda', 'Trisquel GNU/Linux devel');
ok($tris->lts($date) eq 'taranis', 'Trisquel GNU/Linux LTS');
ok($tris->stable($date) eq 'taranis', 'Trisquel GNU/Linux stable');
ok($tris->valid('taranis'), 'Trisquel GNU/Linux valid');
ok(!$tris->valid(42), 'Trisquel GNU/Linux invalid');
ok($tris->is_lts('taranis'), 'Trisquel GNU/Linux is_lts');
ok(!$tris->is_lts(42), 'Trisquel GNU/Linux !is_lts');
ok(!$tris->is_lts('awen'), 'Trisquel GNU/Linux !is_lts');
#@expected = ('robur', 'awen', 'taranis');
@expected = ('robur', 'awen', 'taranis', 'slaine', 'dagda');
@returned = $tris->supported($date);
ok(symmetric_difference(\@expected, \@returned) == 0,
'Trisquel GNU/Linux supported');
@expected = ('dwyn');
@returned = $tris->unsupported($date);
ok(symmetric_difference(\@expected, \@returned) == 0,
'Trisquel GNU/Linux unsupported');
# vi: set et sta sw=4 ts=4:

View file

@ -0,0 +1,182 @@
# test_distro_info.py - Test suite for distro_info
#
# Copyright (C) 2021, Trisquel GNU/Linux developers <trisquel-devel@listas.trisquel.info>
# Copyright (C) 2011, Benjamin Drung <bdrung@debian.org>
#
# 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 distro_info"""
import datetime
from distro_info_test import unittest
from distro_info import DebianDistroInfo, TrisquelDistroInfo
class DebianDistroInfoTestCase(unittest.TestCase): # pylint: disable=too-many-public-methods
"""TestCase object for distro_info.DebianDistroInfo"""
def setUp(self): # pylint: disable=invalid-name
self._distro_info = DebianDistroInfo()
self._date = datetime.date(2011, 1, 10)
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)
def test_codename(self):
"""Test: Codename decoding"""
self.assertIsNone(self._distro_info.codename('foobar'))
self.assertEqual(self._distro_info.codename('testing', self._date),
self._distro_info.testing(self._date))
def test_codename_result(self):
"""Test: Check result set to codename."""
self.assertEqual(self._distro_info.old(self._date, "codename"), "etch")
self.assertEqual(self._distro_info.devel(self._date, result="codename"),
"sid")
def test_fullname(self):
"""Test: Check result set to fullname."""
self.assertEqual(self._distro_info.stable(self._date, "fullname"),
'Debian 5.0 "Lenny"')
result = self._distro_info.testing(self._date, result="fullname")
self.assertEqual(result, 'Debian 6.0 "Squeeze"')
def test_release(self):
"""Test: Check result set to release."""
self.assertEqual(self._distro_info.devel(self._date, "release"), "")
self.assertEqual(self._distro_info.testing(self._date, "release"),
"6.0")
self.assertEqual(self._distro_info.stable(self._date, result="release"),
"5.0")
class TrisquelDistroInfoTestCase(unittest.TestCase): # pylint: disable=too-many-public-methods
"""TestCase object for distro_info.TrisquelDistroInfo"""
def setUp(self): # pylint: disable=invalid-name
self._distro_info = TrisquelDistroInfo()
self._date = datetime.date(2011, 1, 10)
def test_all(self):
"""Test: List all known Trisquel distributions."""
all_distros = set(["robur",
"dwyn",
"awen",
"taranis",
"slaine",
"dagda",
"brigantia",
"toutanis",
"belenos",
"flidas",
"etiona",
"nabia"])
self.assertEqual(all_distros - set(self._distro_info.all), set())
def test_devel(self):
"""Test: Get latest development Trisquel distribution."""
self.assertEqual(self._distro_info.devel(self._date), "dagda")
def test_lts(self):
"""Test: Get latest long term support (LTS) Trisquel distribution."""
self.assertEqual(self._distro_info.lts(self._date), "taranis")
def test_stable(self):
"""Test: Get latest stable Trisquel distribution."""
self.assertEqual(self._distro_info.stable(self._date), "taranis")
def test_supported(self):
"""Test: List all supported Trisquel distribution."""
supported = ["robur", "awen", "taranis", "slaine", "dagda"]
self.assertEqual(self._distro_info.supported(self._date), supported)
def test_unsupported(self):
"""Test: List all unsupported Trisquel distributions."""
unsupported = ["dwyn"]
self.assertEqual(self._distro_info.unsupported(self._date), unsupported)
def test_current_unsupported(self):
"""Test: List all unsupported Trisquel distributions today."""
unsupported = set(["robur",
"dwyn"])
self.assertEqual(unsupported -
set(self._distro_info.unsupported()), set())
def test_valid(self):
"""Test: Check for valid Trisquel distribution."""
self.assertTrue(self._distro_info.valid("taranis"))
self.assertFalse(self._distro_info.valid("42"))
def test_is_lts(self):
"""Test: Check if Trisquel distribution is an LTS."""
self.assertTrue(self._distro_info.is_lts("taranis"))
self.assertFalse(self._distro_info.is_lts("42"))
self.assertFalse(self._distro_info.is_lts("warty"))
def test_codename(self):
"""Test: Check result set to codename."""
self.assertEqual(self._distro_info.lts(self._date, "codename"), "taranis")
self.assertEqual(self._distro_info.devel(self._date, result="codename"),
"dagda")
def test_fullname(self):
"""Test: Check result set to fullname."""
self.assertEqual(self._distro_info.stable(self._date, "fullname"),
'Trisquel 4.0 LTS "Taranis"')
self.assertEqual(self._distro_info.lts(self._date, result="fullname"),
'Trisquel 4.0 LTS "Taranis"')
def test_release(self):
"""Test: Check result set to release."""
self.assertEqual(self._distro_info.devel(self._date, "release"),
"5.0")
self.assertEqual(self._distro_info.lts(self._date, result="release"),
"4.0 LTS")

56
helpers/make-distro-info Normal file
View file

@ -0,0 +1,56 @@
#!/bin/sh
#
# Copyright (C) 2021 Luis Guzman <ark@switnet.org>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#
VERSION=1
. ./config
#ubuntu-distro-info.c
mv ubuntu-distro-info.c trisquel-distro-info.c
sed -i 's|ubuntu|trisquel|g' trisquel-distro-info.c
sed -i 's|Ubuntu|Trisquel GNU/Linux|g' trisquel-distro-info.c
sed -i 's|UBUNTU|TRISQUEL|g' trisquel-distro-info.c
sed -i 's|,eol-server,eol-esm||' trisquel-distro-info.c
sed -i 's|Ubuntu|Trisquel GNU/Linux|' shell/ubuntu-distro-info.in
# distro-info-util.c
patch -p1 < $DATA/distro-info-util_c.patch
#test-ubuntu-distro-info
cp $DATA/test-trisquel-distro-info .
#python dir
patch -p1 < $DATA/distro_info_py.patch
replace Ubuntu Trisquel
replace ubuntu trisquel
#Maybe too much
#sed -i '/__init__/s|"Trisquel"|"Trisquel GNU/Linux"|' python/distro_info.py
mv python/ubuntu-distro-info python/trisquel-distro-info
cp $DATA/test_distro_info.py python/distro_info_test/
#perl
cp $DATA/test.pl perl/
#shell
mv shell/ubuntu-distro-info.in shell/trisquel-distro-info.in
changelog "Reworking and branding Trisquel GNU/Linux distro info."
compile