Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • trisquel/package-helpers
  • aklis/package-helpers
  • leny2010/package-helpers
  • fr33domlover/package-helpers
  • Legimet/package-helpers
  • ralphtheninja/package-helpers
  • damo22/package-helpers
  • wherrfrye/package-helpers
  • habs/package-helpers
  • pehjota/package-helpers
  • kpengboy/package-helpers
  • alvaro/package-helpers
  • salman/package-helpers
  • pabloyoyoista/package-helpers
  • mixalis/package-helpers
  • jorgesumle/package-helpers
  • a_slacker_here/package-helpers
  • chaosmonk/package-helpers
  • Beformed/package-helpers
  • dknight/package-helpers
  • proninyaroslav/package-helpers
  • adfeno/package-helpers
  • snd/package-helpers
  • davidpgil/package-helpers
  • diopon/package-helpers
  • ruben/package-helpers
  • bandali/package-helpers
  • joshaspinall/package-helpers
  • GNUtoo/package-helpers
  • Ark74/package-helpers
  • dragestil/package-helpers
  • bill-auger/package-helpers
  • andi89gi/package-helpers
  • Fikar/package-helpers
  • davidl/package-helpers
  • jas/package-helpers
  • parodper/package-helpers
  • David_Hedlund/package-helpers
  • dinomug/package-helpers
  • bf/package-helpers
  • hartkemd/package-helpers
  • del111/package-helpers
  • jxself/package-helpers
  • JacobK/package-helpers
44 results
Show changes
Showing
with 2344 additions and 0 deletions
trisquel
\ No newline at end of file
trisquel
\ No newline at end of file
default_mirror http://archive.trisquel.org/trisquel
mirror_style release
download_style apt
finddebs_style from-indices
variants - buildd fakechroot minbase
keyring /usr/share/keyrings/trisquel-archive-keyring.gpg
if doing_variant fakechroot; then
test "$FAKECHROOT" = "true" || error 1 FAKECHROOTREQ "This variant requires fakechroot environment to be started"
fi
case $ARCH in
alpha|ia64) LIBC="libc6.1" ;;
*) LIBC="libc6" ;;
esac
work_out_debs () {
required="$(get_debs Priority: required)"
if doing_variant -; then
#required="$required $(get_debs Priority: important)"
# ^^ should be getting debconf here somehow maybe
base="$(get_debs Priority: important)"
elif doing_variant buildd; then
base="$(get_debs Build-Essential: yes)"
elif doing_variant fakechroot || doing_variant minbase; then
base="apt"
fi
case $MIRRORS in
https://*)
base="$base apt-transport-https ca-certificates"
;;
esac
}
first_stage_install () {
extract $required
mkdir -p "$TARGET/var/lib/dpkg"
: >"$TARGET/var/lib/dpkg/status"
: >"$TARGET/var/lib/dpkg/available"
setup_etc
if [ ! -e "$TARGET/etc/fstab" ]; then
echo '# UNCONFIGURED FSTAB FOR BASE SYSTEM' > "$TARGET/etc/fstab"
chown 0:0 "$TARGET/etc/fstab"; chmod 644 "$TARGET/etc/fstab"
fi
setup_devices
x_feign_install () {
local pkg="$1"
local deb="$(debfor $pkg)"
local ver="$(extract_deb_field "$TARGET/$deb" Version)"
mkdir -p "$TARGET/var/lib/dpkg/info"
echo \
"Package: $pkg
Version: $ver
Status: install ok installed" >> "$TARGET/var/lib/dpkg/status"
touch "$TARGET/var/lib/dpkg/info/${pkg}.list"
}
x_feign_install dpkg
}
second_stage_install () {
x_core_install () {
smallyes '' | in_target dpkg --force-depends --install $(debfor "$@")
}
p () {
baseprog="$(($baseprog + ${1:-1}))"
}
if doing_variant fakechroot; then
setup_proc_fakechroot
else
setup_proc
in_target /sbin/ldconfig
fi
DEBIAN_FRONTEND=noninteractive
DEBCONF_NONINTERACTIVE_SEEN=true
export DEBIAN_FRONTEND DEBCONF_NONINTERACTIVE_SEEN
baseprog=0
bases=7
p; progress $baseprog $bases INSTCORE "Installing core packages" #1
info INSTCORE "Installing core packages..."
p; progress $baseprog $bases INSTCORE "Installing core packages" #2
ln -sf mawk "$TARGET/usr/bin/awk"
x_core_install base-passwd
x_core_install base-files
p; progress $baseprog $bases INSTCORE "Installing core packages" #3
x_core_install dpkg
if [ ! -e "$TARGET/etc/localtime" ]; then
ln -sf /usr/share/zoneinfo/Etc/UTC "$TARGET/etc/localtime"
fi
if doing_variant fakechroot; then
install_fakechroot_tools
fi
p; progress $baseprog $bases INSTCORE "Installing core packages" #4
x_core_install $LIBC
p; progress $baseprog $bases INSTCORE "Installing core packages" #5
x_core_install perl-base
p; progress $baseprog $bases INSTCORE "Installing core packages" #6
rm "$TARGET/usr/bin/awk"
x_core_install mawk
p; progress $baseprog $bases INSTCORE "Installing core packages" #7
if doing_variant -; then
x_core_install debconf
fi
baseprog=0
bases=$(set -- $required; echo $#)
info UNPACKREQ "Unpacking required packages..."
smallyes '' |
(repeatn 5 in_target_failmsg UNPACK_REQ_FAIL_FIVE "Failure while unpacking required packages. This will be attempted up to five times." "" \
dpkg --status-fd 8 --force-depends --unpack $(debfor $required) 8>&1 1>&7 |
dpkg_progress $baseprog $bases UNPACKREQ "Unpacking required packages" UNPACKING) 7>&1
info CONFREQ "Configuring required packages..."
if doing_variant fakechroot; then
# fix initscripts postinst (no mounting possible, and wrong if condition)
sed -i '/dpkg.*--compare-versions/ s/\<lt\>/lt-nl/' "$TARGET/var/lib/dpkg/info/initscripts.postinst"
fi
echo \
"#!/bin/sh
exit 101" > "$TARGET/usr/sbin/policy-rc.d"
chmod 755 "$TARGET/usr/sbin/policy-rc.d"
mv "$TARGET/sbin/start-stop-daemon" "$TARGET/sbin/start-stop-daemon.REAL"
echo \
"#!/bin/sh
echo
echo \"Warning: Fake start-stop-daemon called, doing nothing\"" > "$TARGET/sbin/start-stop-daemon"
chmod 755 "$TARGET/sbin/start-stop-daemon"
if [ -x "$TARGET/sbin/initctl" ]; then
mv "$TARGET/sbin/initctl" "$TARGET/sbin/initctl.REAL"
echo \
"#!/bin/sh
if [ \"\$1\" = version ]; then exec /sbin/initctl.REAL \"\$@\"; fi
echo
echo \"Warning: Fake initctl called, doing nothing\"" > "$TARGET/sbin/initctl"
chmod 755 "$TARGET/sbin/initctl"
fi
setup_dselect_method apt
smallyes '' |
(in_target_failmsg CONF_REQ_FAIL "Failure while configuring required packages." "" \
dpkg --status-fd 8 --configure --pending --force-configure-any --force-depends 8>&1 1>&7 |
dpkg_progress $baseprog $bases CONFREQ "Configuring required packages" CONFIGURING) 7>&1
baseprog=0
bases="$(set -- $base; echo $#)"
info UNPACKBASE "Unpacking the base system..."
setup_available $required $base
done_predeps=
while predep=$(get_next_predep); do
# We have to resolve dependencies of pre-dependencies manually because
# dpkg --predep-package doesn't handle this.
predep=$(without "$(without "$(resolve_deps $predep)" "$required")" "$done_predeps")
# XXX: progress is tricky due to how dpkg_progress works
# -- cjwatson 2009-07-29
p; smallyes '' |
in_target dpkg --force-overwrite --force-confold --skip-same-version --install $(debfor $predep)
base=$(without "$base" "$predep")
done_predeps="$done_predeps $predep"
done
smallyes '' |
(repeatn 5 in_target_failmsg INST_BASE_FAIL_FIVE "Failure while installing base packages. This will be re-attempted up to five times." "" \
dpkg --status-fd 8 --force-overwrite --force-confold --skip-same-version --unpack $(debfor $base) 8>&1 1>&7 |
dpkg_progress $baseprog $bases UNPACKBASE "Unpacking base system" UNPACKING) 7>&1
info CONFBASE "Configuring the base system..."
smallyes '' |
(repeatn 5 in_target_failmsg CONF_BASE_FAIL_FIVE "Failure while configuring base packages. This will be re-attempted up to five times." "" \
dpkg --status-fd 8 --force-confold --skip-same-version --configure -a 8>&1 1>&7 |
dpkg_progress $baseprog $bases CONFBASE "Configuring base system" CONFIGURING) 7>&1
if [ -x "$TARGET/sbin/initctl.REAL" ]; then
mv "$TARGET/sbin/initctl.REAL" "$TARGET/sbin/initctl"
fi
mv "$TARGET/sbin/start-stop-daemon.REAL" "$TARGET/sbin/start-stop-daemon"
rm -f "$TARGET/usr/sbin/policy-rc.d"
progress $bases $bases CONFBASE "Configuring base system"
info BASESUCCESS "Base system installed successfully."
}
default_mirror http://archive.trisquel.org/trisquel
mirror_style release
download_style apt
finddebs_style from-indices
variants - buildd fakechroot minbase
keyring /usr/share/keyrings/trisquel-archive-keyring.gpg
if doing_variant fakechroot; then
test "$FAKECHROOT" = "true" || error 1 FAKECHROOTREQ "This variant requires fakechroot environment to be started"
fi
case $ARCH in
alpha|ia64) LIBC="libc6.1" ;;
*) LIBC="libc6" ;;
esac
work_out_debs () {
required="$(get_debs Priority: required)"
if doing_variant -; then
#required="$required $(get_debs Priority: important)"
# ^^ should be getting debconf here somehow maybe
base="$(get_debs Priority: important)"
elif doing_variant buildd; then
base="$(get_debs Build-Essential: yes)"
elif doing_variant fakechroot || doing_variant minbase; then
base="apt"
fi
case $MIRRORS in
https://*)
base="$base apt-transport-https ca-certificates"
;;
esac
}
first_stage_install () {
extract $required
mkdir -p "$TARGET/var/lib/dpkg"
: >"$TARGET/var/lib/dpkg/status"
: >"$TARGET/var/lib/dpkg/available"
setup_etc
if [ ! -e "$TARGET/etc/fstab" ]; then
echo '# UNCONFIGURED FSTAB FOR BASE SYSTEM' > "$TARGET/etc/fstab"
chown 0:0 "$TARGET/etc/fstab"; chmod 644 "$TARGET/etc/fstab"
fi
setup_devices
x_feign_install () {
local pkg="$1"
local deb="$(debfor $pkg)"
local ver="$(extract_deb_field "$TARGET/$deb" Version)"
mkdir -p "$TARGET/var/lib/dpkg/info"
echo \
"Package: $pkg
Version: $ver
Status: install ok installed" >> "$TARGET/var/lib/dpkg/status"
touch "$TARGET/var/lib/dpkg/info/${pkg}.list"
}
x_feign_install dpkg
}
second_stage_install () {
x_core_install () {
smallyes '' | in_target dpkg --force-depends --install $(debfor "$@")
}
p () {
baseprog="$(($baseprog + ${1:-1}))"
}
if doing_variant fakechroot; then
setup_proc_fakechroot
else
setup_proc
in_target /sbin/ldconfig
fi
DEBIAN_FRONTEND=noninteractive
DEBCONF_NONINTERACTIVE_SEEN=true
export DEBIAN_FRONTEND DEBCONF_NONINTERACTIVE_SEEN
baseprog=0
bases=7
p; progress $baseprog $bases INSTCORE "Installing core packages" #1
info INSTCORE "Installing core packages..."
p; progress $baseprog $bases INSTCORE "Installing core packages" #2
ln -sf mawk "$TARGET/usr/bin/awk"
x_core_install base-passwd
x_core_install base-files
p; progress $baseprog $bases INSTCORE "Installing core packages" #3
x_core_install dpkg
if [ ! -e "$TARGET/etc/localtime" ]; then
ln -sf /usr/share/zoneinfo/Etc/UTC "$TARGET/etc/localtime"
fi
if doing_variant fakechroot; then
install_fakechroot_tools
fi
p; progress $baseprog $bases INSTCORE "Installing core packages" #4
x_core_install $LIBC
p; progress $baseprog $bases INSTCORE "Installing core packages" #5
x_core_install perl-base
p; progress $baseprog $bases INSTCORE "Installing core packages" #6
rm "$TARGET/usr/bin/awk"
x_core_install mawk
p; progress $baseprog $bases INSTCORE "Installing core packages" #7
if doing_variant -; then
x_core_install debconf
fi
baseprog=0
bases=$(set -- $required; echo $#)
info UNPACKREQ "Unpacking required packages..."
smallyes '' |
(repeatn 5 in_target_failmsg UNPACK_REQ_FAIL_FIVE "Failure while unpacking required packages. This will be attempted up to five times." "" \
dpkg --status-fd 8 --force-depends --unpack $(debfor $required) 8>&1 1>&7 |
dpkg_progress $baseprog $bases UNPACKREQ "Unpacking required packages" UNPACKING) 7>&1
info CONFREQ "Configuring required packages..."
if doing_variant fakechroot; then
# fix initscripts postinst (no mounting possible, and wrong if condition)
sed -i '/dpkg.*--compare-versions/ s/\<lt\>/lt-nl/' "$TARGET/var/lib/dpkg/info/initscripts.postinst"
fi
echo \
"#!/bin/sh
exit 101" > "$TARGET/usr/sbin/policy-rc.d"
chmod 755 "$TARGET/usr/sbin/policy-rc.d"
mv "$TARGET/sbin/start-stop-daemon" "$TARGET/sbin/start-stop-daemon.REAL"
echo \
"#!/bin/sh
echo
echo \"Warning: Fake start-stop-daemon called, doing nothing\"" > "$TARGET/sbin/start-stop-daemon"
chmod 755 "$TARGET/sbin/start-stop-daemon"
if [ -x "$TARGET/sbin/initctl" ]; then
mv "$TARGET/sbin/initctl" "$TARGET/sbin/initctl.REAL"
echo \
"#!/bin/sh
if [ \"\$1\" = version ]; then exec /sbin/initctl.REAL \"\$@\"; fi
echo
echo \"Warning: Fake initctl called, doing nothing\"" > "$TARGET/sbin/initctl"
chmod 755 "$TARGET/sbin/initctl"
fi
setup_dselect_method apt
smallyes '' |
(in_target_failmsg CONF_REQ_FAIL "Failure while configuring required packages." "" \
dpkg --status-fd 8 --configure --pending --force-configure-any --force-depends 8>&1 1>&7 |
dpkg_progress $baseprog $bases CONFREQ "Configuring required packages" CONFIGURING) 7>&1
baseprog=0
bases="$(set -- $base; echo $#)"
info UNPACKBASE "Unpacking the base system..."
setup_available $required $base
done_predeps=
while predep=$(get_next_predep); do
# We have to resolve dependencies of pre-dependencies manually because
# dpkg --predep-package doesn't handle this.
predep=$(without "$(without "$(resolve_deps $predep)" "$required")" "$done_predeps")
# XXX: progress is tricky due to how dpkg_progress works
# -- cjwatson 2009-07-29
p; smallyes '' |
in_target dpkg --force-overwrite --force-confold --skip-same-version --install $(debfor $predep)
base=$(without "$base" "$predep")
done_predeps="$done_predeps $predep"
done
smallyes '' |
(repeatn 5 in_target_failmsg INST_BASE_FAIL_FIVE "Failure while installing base packages. This will be re-attempted up to five times." "" \
dpkg --status-fd 8 --force-overwrite --force-confold --skip-same-version --unpack $(debfor $base) 8>&1 1>&7 |
dpkg_progress $baseprog $bases UNPACKBASE "Unpacking base system" UNPACKING) 7>&1
info CONFBASE "Configuring the base system..."
smallyes '' |
(repeatn 5 in_target_failmsg CONF_BASE_FAIL_FIVE "Failure while configuring base packages. This will be re-attempted up to five times." "" \
dpkg --status-fd 8 --force-confold --skip-same-version --configure -a 8>&1 1>&7 |
dpkg_progress $baseprog $bases CONFBASE "Configuring base system" CONFIGURING) 7>&1
if [ -x "$TARGET/sbin/initctl.REAL" ]; then
mv "$TARGET/sbin/initctl.REAL" "$TARGET/sbin/initctl"
fi
mv "$TARGET/sbin/start-stop-daemon.REAL" "$TARGET/sbin/start-stop-daemon"
rm -f "$TARGET/usr/sbin/policy-rc.d"
progress $bases $bases CONFBASE "Configuring base system"
info BASESUCCESS "Base system installed successfully."
}
From ef8fb0e94ce79d5fde2943e433ad0422eb7f70ec Mon Sep 17 00:00:00 2001
From: Marvin W <git@larma.de>
Date: Thu, 23 Mar 2023 10:13:30 -0600
Subject: [PATCH] Check sender of bookmark:1 updates
---
xmpp-vala/src/module/xep/0402_bookmarks2.vala | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/xmpp-vala/src/module/xep/0402_bookmarks2.vala b/xmpp-vala/src/module/xep/0402_bookmarks2.vala
index 406f37f43..d1e53e6e3 100644
--- a/xmpp-vala/src/module/xep/0402_bookmarks2.vala
+++ b/xmpp-vala/src/module/xep/0402_bookmarks2.vala
@@ -68,6 +68,11 @@ public class Module : BookmarksProvider, XmppStreamModule {
}
private void on_pupsub_item(XmppStream stream, Jid jid, string id, StanzaNode? node) {
+ if (!jid.equals(stream.get_flag(Bind.Flag.IDENTITY).my_jid.bare_jid)) {
+ warning("Received alleged bookmarks:1 item from %s, ignoring", jid.to_string());
+ return;
+ }
+
Conference conference = parse_item_node(node, id);
Flag? flag = stream.get_flag(Flag.IDENTITY);
if (flag != null) {
@@ -77,6 +82,11 @@ public class Module : BookmarksProvider, XmppStreamModule {
}
private void on_pupsub_retract(XmppStream stream, Jid jid, string id) {
+ if (!jid.equals(stream.get_flag(Bind.Flag.IDENTITY).my_jid.bare_jid)) {
+ warning("Received alleged bookmarks:1 retract from %s, ignoring", jid.to_string());
+ return;
+ }
+
try {
Jid jid_parsed = new Jid(id);
Flag? flag = stream.get_flag(Flag.IDENTITY);
--- a/debian/README.Debian 2019-10-17 15:10:30.000000000 -0500
+++ b/debian/README.Debian 2021-11-26 13:26:20.362971709 -0600
@@ -2,7 +2,7 @@
===========
The distro-info package provides centralized lists of code-names and release
-history for the supported distributions (Currently: Debian and Ubuntu).
+history for the supported distributions (Currently: Debian and Trisquel).
The distro-info data (in the distro-info-data package) can be updated once,
and all the packages using it will have the latest data. This avoids having to
hard-code current development release names (and other such volatile data)
@@ -17,8 +17,8 @@
On Debian, this is:
deb http://ftp.debian.org/debian stable-updates main
-On Ubuntu, it is:
-deb http://archive.ubuntu.com/ubuntu $RELEASE-updates main
+On Trisquel, it is:
+deb http://archive.trisquel.org/trisquel $RELEASE-updates main
where $RELEASE is the name of your release.
If there isn't an update available yet, you should be able to install the
--- a/lib/tools.py 2021-10-15 08:01:00.000000000 -0500
+++ a/lib/tools.py 2022-04-06 12:27:07.672427372 -0500
@@ -37,7 +37,7 @@
def main(validation_function):
"""Main function with command line parameter parsing."""
script_name = os.path.basename(sys.argv[0])
- usage = "%s [-h] -d|-u csv-file" % (script_name)
+ usage = "%s [-h] -d|-u|-t csv-file" % (script_name)
parser = argparse.ArgumentParser(usage=usage)
parser.add_argument(
@@ -56,15 +56,24 @@
default=False,
help="validate an Ubuntu CSV file",
)
+ parser.add_argument(
+ "-t",
+ "--trisquel",
+ dest="trisquel",
+ action="store_true",
+ default=False,
+ help="validate a Trisquel CSV file")
parser.add_argument("csv_file", metavar="csv-file", help="CSV file to validate")
args = parser.parse_args()
- if len([x for x in [args.debian, args.ubuntu] if x]) != 1:
- parser.error("You have to select exactly one of --debian, --ubuntu.")
+ if len([x for x in [args.trisquel, args.debian, args.ubuntu] if x]) != 1:
+ parser.error("You have to select exactly one of --trisquel, --debian, --ubuntu.")
if args.debian:
distro = "debian"
- else:
+ elif args.ubuntu:
distro = "ubuntu"
+ else:
+ distro = "trisquel"
return int(not validation_function(args.csv_file, distro))
--- a/validate-csv-data 2021-10-15 08:01:00.000000000 -0500
+++ b/validate-csv-data 2022-04-06 12:27:29.004706669 -0500
@@ -27,6 +27,13 @@
_COLUMNS = {
+ "trisquel": (
+ "version",
+ "codename",
+ "series",
+ "created",
+ "release",
+ "eol"),
"debian": (
"version",
"codename",
@@ -58,6 +65,7 @@
("eol-lts", "eol-elts"),
)
_STRINGS = {
+ "trisquel": ("version", "codename", "series"),
"debian": ("codename", "series"),
"ubuntu": ("version", "codename", "series"),
}
version,codename,series,created,release,eol,upstream
2.0 LTS,Robur,robur,2007-10-18,2008-07-24,2011-05-12,hardy
3.0,Dwyn,dwyn,2008-10-30,2009-09-08,2010-10-23,jaunty
3.5,Awen,awen,2009-04-23,2010-03-22,2011-04-30,karmik
4.0 LTS,Taranis,taranis,2009-10-29,2010-09-17,2013-05-09,lucid
4.5,Slaine,slaine,2010-04-29,2011-03-24,2012-04-10,maverick
5.0,Dagda,dagda,2010-10-10,2011-09-17,2012-10-28,natty
5.5,Brigantia,brigantia,2011-04-28,2012-04-16,2013-05-09,oneiric
6.0 LTS,Toutanis,toutanis,2011-10-13,2013-03-11,2017-04-28,precise
7.0 LTS,Belenos,belenos,2013-10-17,2014-11-03,2019-04-25,trusty
8.0 LTS,Flidas,flidas,2015-10-22,2018-04-18,2021-04-21,xenial
9.0 LTS,Etiona,etiona,2017-10-19,2020-10-16,2023-05-31,bionic
10.0 LTS,Nabia,nabia,2019-10-17,2021-12-16,2025-05-29,focal
11.0 LTS,Aramo,aramo,2021-10-14,2023-03-19,2027-06-01,jammy
12.0 LTS,Ecne,ecne,2023-10-12,2029-05-31,2029-05-31,noble
--- source/distro-info-util.c 2021-11-04 15:27:37.000000000 -0600
+++ source/distro-info-util.c_fix 2022-04-06 10:00:23.394992023 -0500
@@ -423,10 +423,6 @@
free(list->distro->milestones[MILESTONE_EOL_LTS]);
free(list->distro->milestones[MILESTONE_EOL_ELTS]);
#endif
-#ifdef UBUNTU
- free(list->distro->milestones[MILESTONE_EOL_SERVER]);
- free(list->distro->milestones[MILESTONE_EOL_ESM]);
-#endif
free(list->distro);
free(list);
list = next;
@@ -581,7 +577,7 @@
" -t --testing current testing version\n"
#endif
" -s --stable latest stable version\n"
-#ifdef UBUNTU
+#ifdef TRISQUEL
" --lts latest long term support (LTS) version\n"
#endif
#ifdef DEBIAN
@@ -592,9 +588,6 @@
" -l --lts list of all LTS supported versions\n"
" -e --elts list of all Extended LTS supported versions\n"
#endif
-#ifdef UBUNTU
- " --supported-esm list of all Ubuntu Advantage supported stable versions\n"
-#endif
" --unsupported list of all unsupported stable versions\n"
" -c --codename print the codename (default)\n"
" -f --fullname print the full name\n"
@@ -612,7 +605,7 @@
#ifdef DEBIAN
"--elts, "
#endif
-#ifdef UBUNTU
+#ifdef TRISQUEL
"--latest, "
#endif
"--lts, "
@@ -620,9 +613,6 @@
"--oldstable, "
#endif
"--stable, --supported, "
-#ifdef UBUNTU
- "--supported-esm, "
-#endif
"--series, "
#ifdef DEBIAN
"--testing, "
@@ -651,7 +641,7 @@
#ifdef DEBIAN
char *alias_codename = NULL;
#endif
-#ifdef UBUNTU
+#ifdef TRISQUEL
bool filter_latest = false;
#endif
@@ -664,9 +654,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' },
@@ -678,14 +665,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
@@ -731,7 +718,7 @@
case 'd':
selected_filters++;
filter_cb = filter_devel;
-#ifdef UBUNTU
+#ifdef TRISQUEL
select_cb = select_latest_created;
#endif
#ifdef DEBIAN
@@ -782,7 +769,7 @@
free(date);
return EXIT_SUCCESS;
-#ifdef UBUNTU
+#ifdef TRISQUEL
case 'l':
selected_filters++;
filter_latest = true;
@@ -836,15 +823,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++;
@@ -976,7 +954,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);
}
--- source/python/distro_info.py 2021-11-04 15:27:37.000000000 -0600
+++ source/python/distro_info.py_fix 2022-04-06 10:20:39.217365952 -0500
@@ -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
@@ -100,7 +101,7 @@
class DistroInfo:
"""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):
@@ -311,14 +312,14 @@
]
-class UbuntuDistroInfo(DistroInfo):
- """provides information about Ubuntu's distributions"""
+class TrisquelDistroInfo(DistroInfo):
+ """provides information about Trisquel's distributions"""
def __init__(self):
- super().__init__("Ubuntu")
+ super().__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
@@ -337,7 +338,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
@@ -347,15 +348,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
#!/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
-s --stable latest stable version
--lts latest long term support (LTS) version
--supported list of all supported versions (including development)
--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" "1687"
success "--devel --date=$date --days=eol -c" "nabia 1687"
success "--devel --date=$date --days=eol -r" "10.0 LTS 1687"
success "--devel --date=$date --days=eol -f" "Trisquel GNU/Linux 10.0 LTS \"Nabia\" 1687"
}
. shunit2
#!/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:
# 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")
# Copyright © 2008 Ian Jackson <ijackson@chiark.greenend.org.uk>
# Copyright © 2008 Canonical, Ltd.
# written by Colin Watson <cjwatson@ubuntu.com>
# Copyright © 2008 James Westby <jw+debian@jameswestby.net>
# Copyright © 2009 Raphaël Hertzog <hertzog@debian.org>
# Copyright © 2022 Ruben Rodriguez <ruben@trisquel.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, see <https://www.gnu.org/licenses/>.
package Dpkg::Vendor::Trisquel;
use strict;
use warnings;
our $VERSION = '0.01';
use Dpkg::ErrorHandling;
use Dpkg::Gettext;
use Dpkg::Control::Types;
use parent qw(Dpkg::Vendor::Debian);
=encoding utf8
=head1 NAME
Dpkg::Vendor::Trisquel - Trisquel vendor class
=head1 DESCRIPTION
This vendor class customizes the behaviour of dpkg scripts for Trisquel
specific behavior and policies.
=cut
sub run_hook {
my ($self, $hook, @params) = @_;
if ($hook eq 'package-keyrings') {
return ($self->SUPER::run_hook($hook),
'/usr/share/keyrings/trisquel-archive-keyring.gpg');
} elsif ($hook eq 'archive-keyrings') {
return ($self->SUPER::run_hook($hook),
'/usr/share/keyrings/trisquel-archive-keyring.gpg');
} elsif ($hook eq 'archive-keyrings-historic') {
return ($self->SUPER::run_hook($hook),
'/usr/share/keyrings/trisquel-archive-removed-keys.gpg');
} elsif ($hook eq 'update-buildflags') {
my $flags = shift @params;
# Run the Debian hook to add hardening flags
$self->SUPER::run_hook($hook, $flags);
require Dpkg::BuildOptions;
my $build_opts = Dpkg::BuildOptions->new();
if (!$build_opts->has('noopt')) {
require Dpkg::Arch;
my $arch = Dpkg::Arch::get_host_arch();
if (Dpkg::Arch::debarch_eq($arch, 'ppc64el')) {
for my $flag (qw(CFLAGS CXXFLAGS OBJCFLAGS OBJCXXFLAGS GCJFLAGS
FFLAGS FCFLAGS)) {
my $value = $flags->get($flag);
$value =~ s/-O[0-9]/-O3/;
$flags->set($flag, $value);
}
}
}
# Per https://wiki.ubuntu.com/DistCompilerFlags
$flags->prepend('LDFLAGS', '-Wl,-Bsymbolic-functions');
} else {
return $self->SUPER::run_hook($hook, @params);
}
# Default return value for unknown/unimplemented hooks
return;
}
=head1 CHANGES
=head2 Version 0.xx
This is a private module.
=cut
1;
diff -Nru finish-install-2.104+11.0trisquel0/finish-install.d/10update-initramfs finish-install-2.104+11.0trisquel0/finish-install.d/10update-initramfs
--- finish-install-2.104+11.0trisquel0/finish-install.d/10update-initramfs 2018-08-10 14:21:58.000000000 -0500
+++ finish-install-2.104+11.0trisquel0/finish-install.d/10update-initramfs 2022-12-18 17:56:21.817264252 -0600
@@ -4,7 +4,11 @@
# update-initramfs to make sure one can type the passphrase
# (see #694156, workaround for #696773):
/bin/in-target \
- /bin/sh -c "dpkg-query -s cryptsetup >/dev/null 2>&1 && dpkg-query -s console-setup >/dev/null 2>&1"
+ /bin/sh -c "dpkg-query -s console-setup >/dev/null 2>&1"
+
+#Fix bug keyboard not using the selected layout.
+/bin/in-target \
+ dpkg-reconfigure -f noninteractive keyboard-configuration
if [ $? = 0 ]; then
echo "Encrypted LVM detected, refreshing initramfs"
html {
font: message-box;
font-size: 100%;
background-color: hsl(0,0%,95%);
color: #000;
height: 100%;
}
body {
margin: 0;
display: -moz-box;
-moz-box-orient: vertical;
width: 100%;
height: 100%;
}
input,
button {
font-size: inherit;
font-family: inherit;
}
a {
color: -moz-nativehyperlinktext;
text-decoration: none;
}
.spacer {
-moz-box-flex: 1;
}
#topSection {
text-align: center;
}
#brandLogo {
height: 150px;
width: 420px;
margin: 22px auto 31px;
background-image: url("chrome://branding/content/about-logo.png");
background-size: 420px 150px;
background-position: center center;
background-repeat: no-repeat;
}
#searchIconAndTextContainer,
#snippets {
width: 470px;
}
#searchIconAndTextContainer {
display: -moz-box;
height: 36px;
position: relative;
}
#searchIcon {
border: 1px transparent;
padding: 0;
margin: 0;
width: 36px;
height: 36px;
background: url("chrome://browser/skin/search-indicator-magnifying-glass.svg") center center no-repeat;
position: absolute;
}
#searchText {
margin-left: 0;
-moz-box-flex: 1;
padding-top: 6px;
padding-bottom: 6px;
padding-inline-start: 34px;
padding-inline-end: 8px;
background: hsla(0,0%,100%,.9) padding-box;
border: 1px solid;
border-radius: 2px 0 0 2px;
border-color: hsla(210,54%,20%,.15) hsla(210,54%,20%,.17) hsla(210,54%,20%,.2);
box-shadow: 0 1px 0 hsla(210,65%,9%,.02) inset,
0 0 2px hsla(210,65%,9%,.1) inset,
0 1px 0 hsla(0,0%,100%,.2);
color: inherit;
unicode-bidi: plaintext;
}
#searchText:dir(rtl) {
border-radius: 0 2px 2px 0;
}
#searchText[aria-expanded="true"] {
border-radius: 2px 0 0 0;
}
#searchText[aria-expanded="true"]:dir(rtl) {
border-radius: 0 2px 0 0;
}
#searchText[keepfocus],
#searchText:focus,
#searchText[autofocus] {
border-color: hsla(206,100%,60%,.6) hsla(206,76%,52%,.6) hsla(204,100%,40%,.6);
}
#searchSubmit {
margin-inline-start: -1px;
color: transparent;
background: url("chrome://browser/skin/search-arrow-go.svg") center center no-repeat, linear-gradient(hsla(0,0%,100%,.8), hsla(0,0%,100%,.1)) padding-box;
-moz-context-properties: fill;
fill: #616366;
padding: 0;
border: 1px solid;
border-color: hsla(210,54%,20%,.15) hsla(210,54%,20%,.17) hsla(210,54%,20%,.2) transparent;
border-radius: 0 2px 2px 0;
box-shadow: 0 0 2px hsla(0,0%,100%,.5) inset,
0 1px 0 hsla(0,0%,100%,.2);
cursor: pointer;
transition-property: background-color, border-color, box-shadow;
transition-duration: 150ms;
width: 50px;
}
#searchSubmit:dir(rtl) {
transform: scaleX(-1);
}
#searchText:focus + #searchSubmit,
#searchText[keepfocus] + #searchSubmit,
#searchText + #searchSubmit:hover,
#searchText[autofocus] + #searchSubmit {
border-color: #59b5fc #45a3e7 #3294d5;
}
#searchText:focus + #searchSubmit,
#searchText[keepfocus] + #searchSubmit,
#searchText[autofocus] + #searchSubmit {
background-image: url("chrome://browser/skin/search-arrow-go.svg"), linear-gradient(#4cb1ff, #1793e5);
fill: white;
box-shadow: 0 1px 0 hsla(0,0%,100%,.2) inset,
0 0 0 1px hsla(0,0%,100%,.1) inset,
0 1px 0 hsla(210,54%,20%,.03);
}
#searchText + #searchSubmit:hover {
background-image: url("chrome://browser/skin/search-arrow-go.svg"), linear-gradient(#66bdff, #0d9eff);
fill: white;
box-shadow: 0 1px 0 hsla(0,0%,100%,.2) inset,
0 0 0 1px hsla(0,0%,100%,.1) inset,
0 1px 0 hsla(210,54%,20%,.03),
0 0 4px hsla(206,100%,20%,.2);
}
#searchText + #searchSubmit:hover:active {
box-shadow: 0 1px 1px hsla(211,79%,6%,.1) inset,
0 0 1px hsla(211,79%,6%,.2) inset;
transition-duration: 0ms;
}
#defaultSnippet1,
#defaultSnippet2,
#rightsSnippet {
display: block;
min-height: 38px;
background: 0 center no-repeat;
padding: 6px 0;
padding-inline-start: 49px;
}
#rightsSnippet[hidden] {
display: none;
}
#defaultSnippet1:dir(rtl),
#defaultSnippet2:dir(rtl),
#rightsSnippet:dir(rtl) {
background-position: right 0 center;
}
#defaultSnippet1 {
background-image: url("chrome://browser/content/abouthome/snippet1.png");
}
#defaultSnippet2 {
background-image: url("chrome://browser/content/abouthome/snippet2.png");
}
#snippets {
display: inline-block;
text-align: start;
margin: 12px 0;
color: #3c3c3c;
font-size: 75%;
/* 12px is the computed font size, 15px the computed line height of the snippets
with Segoe UI on a default Windows 7 setup. The 15/12 multiplier approximately
converts em from units of font-size to units of line-height. The goal is to
preset the height of a three-line snippet to avoid visual moving/flickering as
the snippets load. */
min-height: calc(15/12 * 3em);
}
#launcher {
display: -moz-box;
-moz-box-align: center;
-moz-box-pack: center;
width: 100%;
background-color: hsla(0,0%,0%,.03);
border-top: 1px solid hsla(0,0%,0%,.03);
box-shadow: 0 1px 2px hsla(0,0%,0%,.02) inset,
0 -1px 0 hsla(0,0%,100%,.25);
}
#launcher:not([session]),
body[narrow] #launcher[session] {
display: block; /* display separator and restore button on separate lines */
text-align: center;
white-space: nowrap; /* prevent navigational buttons from wrapping */
}
.launchButton {
display: -moz-box;
-moz-box-orient: vertical;
margin: 16px 1px;
padding: 14px 6px;
min-width: 88px;
max-width: 176px;
max-height: 85px;
vertical-align: top;
white-space: normal;
background: transparent padding-box;
border: 1px solid transparent;
border-radius: 2px;
color: #525c66;
font-size: 75%;
cursor: pointer;
transition-property: background-color, border-color, box-shadow;
transition-duration: 150ms;
}
body[narrow] #launcher[session] > .launchButton {
margin: 4px 1px;
}
.launchButton:hover {
background-color: hsla(211,79%,6%,.03);
border-color: hsla(210,54%,20%,.15) hsla(210,54%,20%,.17) hsla(210,54%,20%,.2);
}
.launchButton:hover:active {
background-image: linear-gradient(hsla(211,79%,6%,.02), hsla(211,79%,6%,.05));
border-color: hsla(210,54%,20%,.2) hsla(210,54%,20%,.23) hsla(210,54%,20%,.25);
box-shadow: 0 1px 1px hsla(211,79%,6%,.05) inset,
0 0 1px hsla(211,79%,6%,.1) inset;
transition-duration: 0ms;
}
.launchButton[hidden],
#launcher:not([session]) > #restorePreviousSessionSeparator,
#launcher:not([session]) > #restorePreviousSession {
display: none;
}
#restorePreviousSessionSeparator {
width: 3px;
height: 116px;
margin: 0 10px;
background-image: linear-gradient(hsla(0,0%,100%,0), hsla(0,0%,100%,.35), hsla(0,0%,100%,0)),
linear-gradient(hsla(211,79%,6%,0), hsla(211,79%,6%,.2), hsla(211,79%,6%,0)),
linear-gradient(hsla(0,0%,100%,0), hsla(0,0%,100%,.35), hsla(0,0%,100%,0));
background-position: left top, center, right bottom;
background-size: 1px auto;
background-repeat: no-repeat;
}
body[narrow] #restorePreviousSessionSeparator {
margin: 0 auto;
width: 512px;
height: 3px;
background-image: linear-gradient(to right, hsla(0,0%,100%,0), hsla(0,0%,100%,.35), hsla(0,0%,100%,0)),
linear-gradient(to right, hsla(211,79%,6%,0), hsla(211,79%,6%,.2), hsla(211,79%,6%,0)),
linear-gradient(to right, hsla(0,0%,100%,0), hsla(0,0%,100%,.35), hsla(0,0%,100%,0));
background-size: auto 1px;
}
#restorePreviousSession {
max-width: none;
font-size: 90%;
}
body[narrow] #restorePreviousSession {
font-size: 80%;
}
.launchButton::before {
display: block;
width: 32px;
height: 32px;
margin: 0 auto 6px;
line-height: 0; /* remove extra vertical space due to non-zero font-size */
}
#downloads::before {
content: url("chrome://browser/content/abouthome/downloads.png");
}
#bookmarks::before {
content: url("chrome://browser/content/abouthome/bookmarks.png");
}
#history::before {
content: url("chrome://browser/content/abouthome/history.png");
}
#addons::before {
content: url("chrome://browser/content/abouthome/addons.png");
}
#sync::before {
content: url("chrome://browser/content/abouthome/sync.png");
}
#settings::before {
content: url("chrome://browser/content/abouthome/settings.png");
}
#restorePreviousSession::before {
content: url("chrome://browser/content/abouthome/restore-large.png");
height: 48px;
width: 48px;
display: inline-block; /* display on same line as text label */
vertical-align: middle;
margin-bottom: 0;
margin-inline-end: 8px;
}
#restorePreviousSession:dir(rtl)::before {
transform: scaleX(-1);
}
body[narrow] #restorePreviousSession::before {
content: url("chrome://browser/content/abouthome/restore.png");
height: 32px;
width: 32px;
}
#aboutMozilla {
display: block;
position: relative; /* pin wordmark to edge of document, not of viewport */
-moz-box-ordinal-group: 0;
opacity: .2;
transition: opacity 150ms;
}
#aboutMozilla:hover {
opacity: .6;
}
#aboutMozilla::before {
content: url("chrome://browser/content/abouthome/mozilla.svg");
display: block;
position: absolute;
top: 12px;
offset-inline-end: 12px;
width: 67px;
height: 19px;
}
/* [HiDPI]
* At resolutions above 1dppx, prefer downscaling the 2x Retina graphics
* rather than upscaling the original-size ones (bug 818940).
*/
@media not all and (max-resolution: 1dppx) {
#defaultSnippet1,
#defaultSnippet2,
#rightsSnippet {
background-size: 40px;
}
#defaultSnippet1 {
background-image: url("chrome://browser/content/abouthome/snippet1@2x.png");
}
#defaultSnippet2 {
background-image: url("chrome://browser/content/abouthome/snippet2@2x.png");
}
.launchButton::before {
transform: scale(.5);
transform-origin: 0 0;
}
.launchButton:dir(rtl)::before {
transform: scale(.5) translateX(32px);
}
#downloads::before {
content: url("chrome://browser/content/abouthome/downloads@2x.png");
}
#bookmarks::before {
content: url("chrome://browser/content/abouthome/bookmarks@2x.png");
}
#history::before {
content: url("chrome://browser/content/abouthome/history@2x.png");
}
#addons::before {
content: url("chrome://browser/content/abouthome/addons@2x.png");
}
#sync::before {
content: url("chrome://browser/content/abouthome/sync@2x.png");
}
#settings::before {
content: url("chrome://browser/content/abouthome/settings@2x.png");
}
#restorePreviousSession::before {
content: url("chrome://browser/content/abouthome/restore-large@2x.png");
}
body[narrow] #restorePreviousSession::before {
content: url("chrome://browser/content/abouthome/restore@2x.png");
}
#restorePreviousSession:dir(rtl)::before {
transform: scale(-0.5, 0.5) translateX(24px);
transform-origin: top center;
}
}
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
"use strict";
/* import-globals-from ../contentSearchUI.js */
// The process of adding a new default snippet involves:
// * add a new entity to aboutHome.dtd
// * add a <span/> for it in aboutHome.xhtml
// * add an entry here in the proper ordering (based on spans)
// The <a/> part of the snippet will be linked to the corresponding url.
const DEFAULT_SNIPPETS_URLS = [];
const SNIPPETS_UPDATE_INTERVAL_MS = 14400000; // 4 hours.
// IndexedDB storage constants.
const DATABASE_NAME = "abouthome";
const DATABASE_VERSION = 1;
const DATABASE_STORAGE = "persistent";
const SNIPPETS_OBJECTSTORE_NAME = "snippets";
var searchText;
// This global tracks if the page has been set up before, to prevent double inits
var gInitialized = false;
var gObserver = new MutationObserver(function(mutations) {
for (let mutation of mutations) {
// The addition of the restore session button changes our width:
if (mutation.attributeName == "session") {
fitToWidth();
}
if (mutation.attributeName == "snippetsVersion") {
if (!gInitialized) {
ensureSnippetsMapThen(loadSnippets);
gInitialized = true;
}
return;
}
}
});
window.addEventListener("pageshow", function() {
// Delay search engine setup, cause browser.js::BrowserOnAboutPageLoad runs
// later and may use asynchronous getters.
window.gObserver.observe(document.documentElement, { attributes: true });
window.gObserver.observe(document.getElementById("launcher"), { attributes: true });
fitToWidth();
setupSearch();
window.addEventListener("resize", fitToWidth);
// Ask chrome to update snippets.
var event = new CustomEvent("AboutHomeLoad", {bubbles: true});
document.dispatchEvent(event);
});
window.addEventListener("pagehide", function() {
window.gObserver.disconnect();
window.removeEventListener("resize", fitToWidth);
});
window.addEventListener("keypress", ev => {
if (ev.defaultPrevented) {
return;
}
// don't focus the search-box on keypress if something other than the
// body or document element has focus - don't want to steal input from other elements
// Make an exception for <a> and <button> elements (and input[type=button|submit])
// which don't usefully take keypresses anyway.
// (except space, which is handled below)
if (document.activeElement && document.activeElement != document.body &&
document.activeElement != document.documentElement &&
!["a", "button"].includes(document.activeElement.localName) &&
!document.activeElement.matches("input:-moz-any([type=button],[type=submit])")) {
return;
}
let modifiers = ev.ctrlKey + ev.altKey + ev.metaKey;
// ignore Ctrl/Cmd/Alt, but not Shift
// also ignore Tab, Insert, PageUp, etc., and Space
if (modifiers != 0 || ev.charCode == 0 || ev.charCode == 32)
return;
searchText.focus();
// need to send the first keypress outside the search-box manually to it
searchText.value += ev.key;
});
// This object has the same interface as Map and is used to store and retrieve
// the snippets data. It is lazily initialized by ensureSnippetsMapThen(), so
// be sure its callback returned before trying to use it.
var gSnippetsMap;
var gSnippetsMapCallbacks = [];
/**
* Ensure the snippets map is properly initialized.
*
* @param aCallback
* Invoked once the map has been initialized, gets the map as argument.
* @note Snippets should never directly manage the underlying storage, since
* it may change inadvertently.
*/
function ensureSnippetsMapThen(aCallback) {
if (gSnippetsMap) {
aCallback(gSnippetsMap);
return;
}
// Handle multiple requests during the async initialization.
gSnippetsMapCallbacks.push(aCallback);
if (gSnippetsMapCallbacks.length > 1) {
// We are already updating, the callbacks will be invoked when done.
return;
}
let invokeCallbacks = function() {
if (!gSnippetsMap) {
gSnippetsMap = Object.freeze(new Map());
}
for (let callback of gSnippetsMapCallbacks) {
callback(gSnippetsMap);
}
gSnippetsMapCallbacks.length = 0;
}
let openRequest = indexedDB.open(DATABASE_NAME, {version: DATABASE_VERSION,
storage: DATABASE_STORAGE});
openRequest.onerror = function(event) {
// Try to delete the old database so that we can start this process over
// next time.
indexedDB.deleteDatabase(DATABASE_NAME);
invokeCallbacks();
};
openRequest.onupgradeneeded = function(event) {
let db = event.target.result;
if (!db.objectStoreNames.contains(SNIPPETS_OBJECTSTORE_NAME)) {
db.createObjectStore(SNIPPETS_OBJECTSTORE_NAME);
}
}
openRequest.onsuccess = function(event) {
let db = event.target.result;
db.onerror = function() {
invokeCallbacks();
}
db.onversionchange = function(versionChangeEvent) {
versionChangeEvent.target.close();
invokeCallbacks();
}
let cache = new Map();
let cursorRequest;
try {
cursorRequest = db.transaction(SNIPPETS_OBJECTSTORE_NAME)
.objectStore(SNIPPETS_OBJECTSTORE_NAME).openCursor();
} catch (ex) {
console.error(ex);
invokeCallbacks();
return;
}
cursorRequest.onerror = function() {
invokeCallbacks();
}
cursorRequest.onsuccess = function(cursorRequestEvent) {
let cursor = cursorRequestEvent.target.result;
// Populate the cache from the persistent storage.
if (cursor) {
cache.set(cursor.key, cursor.value);
cursor.continue();
return;
}
// The cache has been filled up, create the snippets map.
gSnippetsMap = Object.freeze({
get: (aKey) => cache.get(aKey),
set(aKey, aValue) {
db.transaction(SNIPPETS_OBJECTSTORE_NAME, "readwrite")
.objectStore(SNIPPETS_OBJECTSTORE_NAME).put(aValue, aKey);
return cache.set(aKey, aValue);
},
has: (aKey) => cache.has(aKey),
delete(aKey) {
db.transaction(SNIPPETS_OBJECTSTORE_NAME, "readwrite")
.objectStore(SNIPPETS_OBJECTSTORE_NAME).delete(aKey);
return cache.delete(aKey);
},
clear() {
db.transaction(SNIPPETS_OBJECTSTORE_NAME, "readwrite")
.objectStore(SNIPPETS_OBJECTSTORE_NAME).clear();
return cache.clear();
},
get size() { return cache.size; },
});
setTimeout(invokeCallbacks, 0);
}
}
}
function onSearchSubmit(aEvent) {
gContentSearchController.search(aEvent);
}
var gContentSearchController;
function setupSearch() {
// Set submit button label for when CSS background are disabled (e.g.
// high contrast mode).
document.getElementById("searchSubmit").value =
document.body.getAttribute("dir") == "ltr" ? "\u25B6" : "\u25C0";
// The "autofocus" attribute doesn't focus the form element
// immediately when the element is first drawn, so the
// attribute is also used for styling when the page first loads.
searchText = document.getElementById("searchText");
searchText.addEventListener("blur", function() {
searchText.removeAttribute("autofocus");
}, {once: true});
if (!gContentSearchController) {
gContentSearchController =
new ContentSearchUIController(searchText, searchText.parentNode,
"abouthome", "homepage");
}
}
/**
* Inform the test harness that we're done loading the page.
*/
function loadCompleted() {
var event = new CustomEvent("AboutHomeLoadSnippetsCompleted", {bubbles: true});
document.dispatchEvent(event);
}
/**
* Update the local snippets from the remote storage, then show them through
* showSnippets.
*/
function loadSnippets() {
if (!gSnippetsMap)
throw new Error("Snippets map has not properly been initialized");
// Allow tests to modify the snippets map before using it.
var event = new CustomEvent("AboutHomeLoadSnippets", {bubbles: true});
document.dispatchEvent(event);
// Check cached snippets version.
let cachedVersion = gSnippetsMap.get("snippets-cached-version") || 0;
let currentVersion = document.documentElement.getAttribute("snippetsVersion");
if (cachedVersion < currentVersion) {
// The cached snippets are old and unsupported, restart from scratch.
gSnippetsMap.clear();
}
// Check last snippets update.
let lastUpdate = gSnippetsMap.get("snippets-last-update");
let updateURL = document.documentElement.getAttribute("snippetsURL");
let shouldUpdate = !lastUpdate ||
Date.now() - lastUpdate > SNIPPETS_UPDATE_INTERVAL_MS;
if (updateURL && shouldUpdate) {
// Try to update from network.
let xhr = new XMLHttpRequest();
xhr.timeout = 5000;
// Even if fetching should fail we don't want to spam the server, thus
// set the last update time regardless its results. Will retry tomorrow.
gSnippetsMap.set("snippets-last-update", Date.now());
xhr.onloadend = function() {
if (xhr.status == 200) {
gSnippetsMap.set("snippets", xhr.responseText);
gSnippetsMap.set("snippets-cached-version", currentVersion);
}
showSnippets();
loadCompleted();
};
try {
xhr.open("GET", updateURL, true);
xhr.send(null);
} catch (ex) {
showSnippets();
loadCompleted();
}
} else {
showSnippets();
loadCompleted();
}
}
/**
* Shows locally cached remote snippets, or default ones when not available.
*
* @note: snippets should never invoke showSnippets(), or they may cause
* a "too much recursion" exception.
*/
var _snippetsShown = false;
function showSnippets() {
let snippetsElt = document.getElementById("snippets");
// Show about:rights notification, if needed.
let showRights = document.documentElement.getAttribute("showKnowYourRights");
if (showRights) {
let rightsElt = document.getElementById("rightsSnippet");
let anchor = rightsElt.getElementsByTagName("a")[0];
anchor.href = "about:rights";
snippetsElt.appendChild(rightsElt);
rightsElt.removeAttribute("hidden");
return;
}
if (!gSnippetsMap)
throw new Error("Snippets map has not properly been initialized");
if (_snippetsShown) {
// There's something wrong with the remote snippets, just in case fall back
// to the default snippets.
showDefaultSnippets();
throw new Error("showSnippets should never be invoked multiple times");
}
_snippetsShown = true;
let snippets = gSnippetsMap.get("snippets");
// If there are remotely fetched snippets, try to to show them.
if (snippets) {
// Injecting snippets can throw if they're invalid XML.
try {
// eslint-disable-next-line no-unsanitized/property
snippetsElt.innerHTML = snippets;
// Scripts injected by innerHTML are inactive, so we have to relocate them
// through DOM manipulation to activate their contents.
Array.forEach(snippetsElt.getElementsByTagName("script"), function(elt) {
let relocatedScript = document.createElement("script");
relocatedScript.type = "text/javascript";
relocatedScript.text = elt.text;
elt.parentNode.replaceChild(relocatedScript, elt);
});
return;
} catch (ex) {
// Bad content, continue to show default snippets.
}
}
showDefaultSnippets();
}
/**
* Clear snippets element contents and show default snippets.
*/
function showDefaultSnippets() {
// Clear eventual contents...
let snippetsElt = document.getElementById("snippets");
snippetsElt.innerHTML = "";
// ...then show default snippets.
let defaultSnippetsElt = document.getElementById("defaultSnippets");
let entries = defaultSnippetsElt.querySelectorAll("span");
// Choose a random snippet. Assume there is always at least one.
let randIndex = Math.floor(Math.random() * entries.length);
let entry = entries[randIndex];
// Inject url in the eventual link.
if (DEFAULT_SNIPPETS_URLS[randIndex]) {
let links = entry.getElementsByTagName("a");
// Default snippets can have only one link, otherwise something is messed
// up in the translation.
if (links.length == 1) {
links[0].href = DEFAULT_SNIPPETS_URLS[randIndex];
}
}
// Move the default snippet to the snippets element.
snippetsElt.appendChild(entry);
}
function fitToWidth() {
if (document.documentElement.scrollWidth > window.innerWidth) {
document.body.setAttribute("narrow", "true");
} else if (document.body.hasAttribute("narrow")) {
document.body.removeAttribute("narrow");
fitToWidth();
}
}
<?xml version="1.0" encoding="UTF-8"?>
<!-- This Source Code Form is subject to the terms of the Mozilla Public
- License, v. 2.0. If a copy of the MPL was not distributed with this
- file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
<!DOCTYPE html [
<!ENTITY % htmlDTD
PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"DTD/xhtml1-strict.dtd">
%htmlDTD;
<!ENTITY % globalDTD SYSTEM "chrome://global/locale/global.dtd">
%globalDTD;
<!ENTITY % aboutHomeDTD SYSTEM "chrome://browser/locale/aboutHome.dtd">
%aboutHomeDTD;
<!ENTITY % browserDTD SYSTEM "chrome://browser/locale/browser.dtd" >
%browserDTD;
]>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>&abouthome.pageTitle;</title>
<link rel="icon" type="image/png" id="favicon"
href="chrome://branding/content/icon32.png"/>
<link rel="stylesheet" type="text/css" media="all"
href="chrome://browser/content/contentSearchUI.css"/>
<link rel="stylesheet" type="text/css" media="all" defer="defer"
href="chrome://browser/content/abouthome/aboutHome.css"/>
<script type="text/javascript"
src="chrome://browser/content/abouthome/aboutHome.js"/>
<script type="text/javascript"
src="chrome://browser/content/contentSearchUI.js"/>
</head>
<body dir="&locale.dir;">
<div class="spacer"/>
<div id="topSection">
<div id="brandLogo"></div>
<div id="searchIconAndTextContainer">
<div id="searchIcon"/>
<input type="text" name="q" value="" id="searchText" maxlength="256"
aria-label="&contentSearchInput.label;" autofocus="autofocus"/>
<input id="searchSubmit" type="button" onclick="onSearchSubmit(event)"
title="&contentSearchSubmit.tooltip;"/>
</div>
</div>
<div class="spacer"/>
<div id="launcher">
<button class="launchButton" id="downloads">&abouthome.downloadsButton.label;</button>
<button class="launchButton" id="bookmarks">&abouthome.bookmarksButton.label;</button>
<button class="launchButton" id="history">&abouthome.historyButton.label;</button>
<button class="launchButton" id="addons">&abouthome.addonsButton.label;</button>
<button class="launchButton" id="sync">&abouthome.syncButton.label;</button>
<button class="launchButton" id="settings">&abouthome.preferencesButtonUnix.label;</button>
<div id="restorePreviousSessionSeparator"/>
<button class="launchButton" id="restorePreviousSession">&historyRestoreLastSession.label;</button>
</div>
</body>
</html>
helpers/DATA/firefox/abouthome/addons.png

1.41 KiB