Commit 9ecb8270 authored by intrigeri's avatar intrigeri
Browse files

Import current persistence-setup.git's and perl5lib.git's...

Import current persistence-setup.git's and perl5lib.git's feature/14594-asp-gui branches; accordingly add new package dependencies.

Respectively at commit 85fe743ec9818bb77bb35dc133c019c955d02148
and f10204fa5035ebae6a2e682ede3518c7e3dd245c.
parent 3ba1893b
......@@ -40,6 +40,10 @@ Package: intel-microcode
Pin: release o=Debian,n=stretch-backports
Pin-Priority: 999
Package: libfunction-parameters-perl
Pin: release o=Debian,n=stretch-backports
Pin-Priority: 999
Package: linux-compiler-* linux-headers-* linux-image-* linux-kbuild-* linux-source-*
Pin: release o=Debian,n=sid
Pin-Priority: 999
......
......@@ -433,7 +433,9 @@ python3-sh
# XXX: remove once tails-perl5lib and tails-persistence-setup have
# their respective feature/14594-asp-gui branch merged.
libclass-xsaccessor-perl
libfunction-parameters-perl
libmoox-options-perl
libtype-tiny-xs-perl
libtypes-path-tiny-perl
libuuid-tiny-perl
......
Tails/ Tails.pm
diff --git a/usr/share/perl5/Tails.pm b/usr/share/perl5/Tails.pm
index 2d48039..ed03d12 100644
index 33077e2..0ac90e8 100644
--- a/usr/share/perl5/Tails.pm
+++ b/usr/share/perl5/Tails.pm
@@ -11,11 +11,12 @@ Version
......@@ -17,10 +18,10 @@ index 2d48039..ed03d12 100644
1;
diff --git a/usr/share/perl5/Tails/Constants.pm b/usr/share/perl5/Tails/Constants.pm
index 915601d..6063439 100644
index 915601d..f2a326f 100644
--- a/usr/share/perl5/Tails/Constants.pm
+++ b/usr/share/perl5/Tails/Constants.pm
@@ -1,17 +1,24 @@
@@ -1,17 +1,23 @@
package Tails::Constants;
-use Moose;
-use MooseX::Has::Sugar::Saccharin;
......@@ -33,31 +34,30 @@ index 915601d..6063439 100644
use autodie qw(:all);
-use Method::Signatures::Simple;
+use Function::Parameters;
-has 'system_partition_label' => lazy_build ro Str;
-method _build_system_partition_label { 'Tails' }
+use Moo;
+use MooX::late;
+use namespace::clean;
-has 'system_partition_label' => lazy_build ro Str;
-method _build_system_partition_label { 'Tails' }
-no Moose;
+has 'system_partition_label' => (
+ lazy_build => 1,
+ is => 'ro',
+ isa => 'Str',
+);
-no Moose;
+sub _build_system_partition_label {
+ my $self = shift;
+ 'Tails'
+}
+
+method _build_system_partition_label () { 'Tails' }
+
+no Moo;
1; # End of Tails::Constants
diff --git a/usr/share/perl5/Tails/Role/DisplayError/Gtk3.pm b/usr/share/perl5/Tails/Role/DisplayError/Gtk3.pm
index dfa6976..5261e62 100644
index dfa6976..fea73c5 100644
--- a/usr/share/perl5/Tails/Role/DisplayError/Gtk3.pm
+++ b/usr/share/perl5/Tails/Role/DisplayError/Gtk3.pm
@@ -1,13 +1,15 @@
@@ -1,22 +1,22 @@
package Tails::Role::DisplayError::Gtk3;
-use Moose::Role;
......@@ -68,15 +68,30 @@ index dfa6976..5261e62 100644
use autodie qw(:all);
-
use Carp::Assert::More;
+use Function::Parameters;
+use Types::Standard qw(InstanceOf Str);
-sub display_error {
- my $self = shift;
- my $main_window = shift;
- my $title = shift;
- my $mesg = shift;
- assert_isa($main_window, 'Gtk3::Window');
- assert_defined($title);
- assert_defined($mesg);
+use Moo::Role;
+use MooX::late;
+use namespace::clean;
+
sub display_error {
my $self = shift;
my $main_window = shift;
@@ -28,5 +30,5 @@ sub display_error {
+method display_error (
+ (InstanceOf['Gtk3::Window']) $main_window,
+ Str $title,
+ Str $mesg
+) {
say STDERR "$title: $mesg";
my $dialog = Gtk3::MessageDialog->new(
@@ -28,5 +28,5 @@ sub display_error {
$dialog->run;
}
......@@ -84,10 +99,10 @@ index dfa6976..5261e62 100644
+no Moo::Role;
1; # End of Tails::Role::DisplayError::Gtk3
diff --git a/usr/share/perl5/Tails/Role/HasCodeset.pm b/usr/share/perl5/Tails/Role/HasCodeset.pm
index 08ed86c..14869be 100644
index 08ed86c..1a05107 100644
--- a/usr/share/perl5/Tails/Role/HasCodeset.pm
+++ b/usr/share/perl5/Tails/Role/HasCodeset.pm
@@ -5,15 +5,19 @@ Tails::Role::HasCodeset - role to get the codeset being used
@@ -5,22 +5,27 @@ Tails::Role::HasCodeset - role to get the codeset being used
=cut
package Tails::Role::HasCodeset;
......@@ -99,6 +114,7 @@ index 08ed86c..14869be 100644
use warnings FATAL => 'all';
use autodie qw(:all);
+use Function::Parameters;
use Try::Tiny;
+use Moo::Role; # Moo::Role exports all methods declared after it's "use"'d
......@@ -109,7 +125,15 @@ index 08ed86c..14869be 100644
has 'codeset' => (
isa => 'Str',
is => 'ro',
@@ -32,5 +36,5 @@ sub _build_codeset {
lazy_build => 1,
);
-sub _build_codeset {
+method _build_codeset () {
my $codeset;
try {
require I18N::Langinfo;
@@ -32,5 +37,5 @@ sub _build_codeset {
$codeset;
}
......@@ -117,10 +141,10 @@ index 08ed86c..14869be 100644
+no Moo::Role;
1; # End of Tails::Role::HasCodeset
diff --git a/usr/share/perl5/Tails/Role/HasDBus/System.pm b/usr/share/perl5/Tails/Role/HasDBus/System.pm
index 34aefce..9e99d79 100644
index 34aefce..185c249 100644
--- a/usr/share/perl5/Tails/Role/HasDBus/System.pm
+++ b/usr/share/perl5/Tails/Role/HasDBus/System.pm
@@ -5,18 +5,20 @@ Tails::HasDBus::System - role providing a connection to the system DBus
@@ -5,18 +5,21 @@ Tails::HasDBus::System - role providing a connection to the system DBus
=cut
package Tails::Role::HasDBus::System;
......@@ -134,6 +158,7 @@ index 34aefce..9e99d79 100644
-use Carp::Assert;
use Carp::Assert::More;
+use Function::Parameters;
use Net::DBus qw(:typing);
use Net::DBus::GLib;
......@@ -144,7 +169,14 @@ index 34aefce..9e99d79 100644
has 'dbus' => (
isa => 'Net::DBus',
is => 'ro',
@@ -30,5 +32,5 @@ sub _build_dbus {
@@ -24,11 +27,11 @@ has 'dbus' => (
builder => '_build_dbus',
);
-sub _build_dbus {
+method _build_dbus () {
my $dbus = Net::DBus::GLib->system;
assert_defined($dbus);
return $dbus;
}
......@@ -152,10 +184,10 @@ index 34aefce..9e99d79 100644
+no Moo::Role;
1; # End of Tails::HasDBus::System
diff --git a/usr/share/perl5/Tails/Role/HasEncoding.pm b/usr/share/perl5/Tails/Role/HasEncoding.pm
index fdc7ba7..1cba08c 100644
index fdc7ba7..25150e1 100644
--- a/usr/share/perl5/Tails/Role/HasEncoding.pm
+++ b/usr/share/perl5/Tails/Role/HasEncoding.pm
@@ -4,32 +4,34 @@ Tails::Role::HasEncoding - role to provide an Encode::Encoding objet for the cod
@@ -4,40 +4,42 @@ Tails::Role::HasEncoding - role to provide an Encode::Encoding objet for the cod
=head1 SYNOPSIS
......@@ -186,14 +218,15 @@ index fdc7ba7..1cba08c 100644
-with 'Tails::Role::HasCodeset';
use Encode qw{find_encoding};
-use Moose::Util::TypeConstraints;
-class_type('Encode::Encoding');
-class_type('Encode::XS');
+use Function::Parameters;
+
+use Moo::Role; # Moo::Role exports all methods declared after it's "use"'d
+use MooX::late;
+
+with 'Tails::Role::HasCodeset';
+
-class_type('Encode::Encoding');
-class_type('Encode::XS');
+use namespace::clean;
has 'encoding' => (
......@@ -202,7 +235,10 @@ index fdc7ba7..1cba08c 100644
is => 'ro',
lazy_build => 1,
);
@@ -39,5 +41,5 @@ sub _build_encoding {
-sub _build_encoding {
- my $self = shift;
+method _build_encoding () {
find_encoding($self->codeset);
}
......@@ -210,10 +246,10 @@ index fdc7ba7..1cba08c 100644
+no Moo::Role;
1; # End of Tails::Role::HasEncoding
diff --git a/usr/share/perl5/Tails/RunningSystem.pm b/usr/share/perl5/Tails/RunningSystem.pm
index 5a6ca52..f215500 100644
index 5a6ca52..dfc676c 100644
--- a/usr/share/perl5/Tails/RunningSystem.pm
+++ b/usr/share/perl5/Tails/RunningSystem.pm
@@ -6,123 +6,185 @@ Tails::RunningSystem - class that represents the running Tails system
@@ -6,123 +6,157 @@ Tails::RunningSystem - class that represents the running Tails system
package Tails::RunningSystem;
......@@ -236,12 +272,14 @@ index 5a6ca52..f215500 100644
use Carp::Assert::More;
use Data::Dumper;
-use Path::Class;
+use Function::Parameters;
+use Path::Tiny;
use Sys::Statistics::Linux::MemStats;
use Tails::Constants;
use Tails::UDisks;
use Try::Tiny;
+use Types::Path::Tiny qw{Dir};
+use Types::Standard qw(Str);
use Locale::gettext;
use POSIX;
......@@ -403,93 +441,135 @@ index 5a6ca52..f215500 100644
-method _build_udisks { Tails::UDisks->new(); }
-
-method _build_build_target {
+sub _build_upgrade_description_url_schema_version {
+ my $self = shift;
+ 1
+}
+sub _build_dev_dir {
+ my $self = shift;
+ '/dev'
+}
+sub _build_os_release_file {
+ my $self = shift;
+ '/etc/os-release'
+}
+sub _build_proc_dir {
+ my $self = shift;
+ '/proc'
+}
+sub _build_run_dir {
+ my $self = shift;
+ '/var/run'
+}
+sub _build_product_name {
+ my $self = shift;
+ $self->os_release_get('TAILS_PRODUCT_NAME')
+}
+sub _build_product_version {
+ my $self = shift;
+ $self->os_release_get('TAILS_VERSION_ID')
+}
+sub _build_baseurl {
+ my $self = shift;
+ 'https://tails.boum.org'
+}
+sub _build_udisks {
+ my $self = shift;
+ Tails::UDisks->new();
+}
+method _build_upgrade_description_url_schema_version () { 1 }
+method _build_dev_dir () { '/dev' }
+method _build_os_release_file () { '/etc/os-release' }
+method _build_proc_dir () { '/proc' }
+method _build_run_dir () { '/var/run' }
+method _build_product_name () { $self->os_release_get('TAILS_PRODUCT_NAME') }
+method _build_product_version () { $self->os_release_get('TAILS_VERSION_ID') }
+method _build_baseurl () { 'https://tails.boum.org' }
+method _build_udisks () { Tails::UDisks->new(); }
+
+sub _build_build_target {
+ my $self = shift;
+method _build_build_target () {
my $arch = `dpkg --print-architecture`; chomp $arch; return $arch;
}
-method _build_channel {
+sub _build_channel {
+ my $self = shift;
+method _build_channel () {
my $channel;
try { $channel = $self->os_release_get('TAILS_CHANNEL') };
defined $channel ? $channel : 'stable';
}
-method _build_upgrade_description_file_url {
+sub _build_upgrade_description_file_url {
+ my $self = shift;
+method _build_upgrade_description_file_url () {
sprintf(
"%s/upgrade/v%d/%s/%s/%s/%s/upgrades.yml",
$self->baseurl,
@@ -134,17 +196,19 @@ method _build_upgrade_description_file_url {
@@ -134,24 +168,23 @@ method _build_upgrade_description_file_url {
);
}
-method _build_upgrade_description_sig_url {
+sub _build_upgrade_description_sig_url {
+ my $self = shift;
+method _build_upgrade_description_sig_url () {
$self->upgrade_description_file_url . '.pgp';
}
-method _build_constants {
+sub _build_constants {
+ my $self = shift;
+method _build_constants () {
Tails::Constants->new();
}
sub _build_liveos_mountpoint {
my $self = shift;
-sub _build_liveos_mountpoint {
- my $self = shift;
- dir('/lib/live/mount/medium');
+method _build_liveos_mountpoint () {
+ path('/lib/live/mount/medium');
}
sub _build_boot_block_device {
@@ -251,11 +315,13 @@ http://www.freedesktop.org/software/systemd/man/os-release.html
-sub _build_boot_block_device {
- my $self = shift;
-
+method _build_boot_block_device () {
my $device;
try {
+ say STDERR $self->liveos_mountpoint;
+ say STDERR ref($self->liveos_mountpoint);
$device = $self->underlying_block_device($self->liveos_mountpoint);
} catch {
$self->display_error(
@@ -160,7 +193,6 @@ sub _build_boot_block_device {
$self->encoding->decode(gettext(
q{The device Tails is running from cannot be found. Maybe you used the `toram' option?},
)),
- '',
);
};
@@ -179,9 +211,7 @@ sub _build_boot_block_device {
return $boot_block_device;
}
-sub _build_boot_drive {
- my $self = shift;
-
+method _build_boot_drive () {
my $drive;
try {
$drive = $self->underlying_drive($self->liveos_mountpoint);
@@ -200,40 +230,30 @@ sub _build_boot_drive {
return $drive;
}
-sub _build_boot_device_file {
- my $self = shift;
-
+method _build_boot_device_file () {
return $self->bytes_array_to_string($self->get_block_device_property(
$self->boot_block_device, 'PreferredDevice'
));
}
-sub _build_system_partition {
- my $self = shift;
-
+method _build_system_partition () {
$self->udisks->device_partition_with_label(
$self->boot_block_device,
$self->system_partition_label
);
}
-sub _build_system_partition_file {
- my $self = shift;
-
+method _build_system_partition_file () {
return $self->bytes_array_to_string($self->get_block_device_property(
$self->system_partition, 'PreferredDevice'
));
}
-sub _build_boot_drive_vendor {
- my $self = shift;
-
+method _build_boot_drive_vendor () {
$self->get_drive_property($self->boot_drive, 'Vendor');
}
-sub _build_boot_drive_model {
- my $self = shift;
-
+method _build_boot_drive_model () {
$self->get_drive_property($self->boot_drive, 'Model');
}
@@ -251,11 +271,11 @@ http://www.freedesktop.org/software/systemd/man/os-release.html
Throws an exception if not found.
=cut
-method os_release_get ($key) {
+sub os_release_get {
+ my $self = shift;
+ my $key = shift;
+method os_release_get (Str $key) {
assert(-e $self->os_release_file);
assert_like($key, qr{[_A-Z]+});
......@@ -498,21 +578,8 @@ index 5a6ca52..f215500 100644
while (<$fh>) {
chomp;
@@ -270,16 +336,18 @@ method os_release_get ($key) {
));
}
-method started_from_device_installed_with_tails_installer () {
+sub started_from_device_installed_with_tails_installer {
+ my $self = shift;
return $self->override_started_from_device_installed_with_tails_installer
if $self->has_override_started_from_device_installed_with_tails_installer;
$self->device_installed_with_tails_installer($self->boot_block_device);
}
-method started_from_writable_device () {
+sub started_from_writable_device {
+ my $self = shift;
@@ -279,7 +299,7 @@ method started_from_device_installed_with_tails_installer () {
method started_from_writable_device () {
assert(-d $self->dev_dir);
- -e file($self->dev_dir, 'bilibop');
......@@ -520,13 +587,9 @@ index 5a6ca52..f215500 100644
}
=head2 free_memory
@@ -287,14 +355,15 @@ method started_from_writable_device () {
Returns MemFree + Buffers + Cached, in bytes.
@@ -289,12 +309,12 @@ Returns MemFree + Buffers + Cached, in bytes.
=cut
-method free_memory () {
+sub free_memory {
+ my $self = shift;
method free_memory () {
assert(-d $self->proc_dir);
- assert(-e file($self->proc_dir, 'meminfo'));
+ assert(-e path($self->proc_dir, 'meminfo'));
......@@ -540,10 +603,10 @@ index 5a6ca52..f215500 100644
+no Moo;
1;
diff --git a/usr/share/perl5/Tails/UDisks.pm b/usr/share/perl5/Tails/UDisks.pm
index 7216782..c0ae00b 100644
index 7216782..5b84650 100644
--- a/usr/share/perl5/Tails/UDisks.pm
+++ b/usr/share/perl5/Tails/UDisks.pm
@@ -5,10 +5,9 @@ Tails::UDisks - role providing a connection to UDisks via DBus
@@ -5,20 +5,21 @@ Tails::UDisks - role providing a connection to UDisks via DBus
=cut
package Tails::UDisks;
......@@ -555,15 +618,20 @@ index 7216782..c0ae00b 100644
use warnings FATAL => 'all';
use autodie qw(:all);
@@ -17,7 +16,6 @@ use File::stat;
use Carp::Assert::More;
use File::stat;
+use Function::Parameters;
use IPC::System::Simple qw{capturex};
use Syntax::Keyword::Junction qw{any};
use List::Util qw{first};
-use Method::Signatures::Simple;
use Tails::Constants;
+use Types::Standard qw{ArrayRef Defined Str};
+use Types::Path::Tiny qw{Path};
use Unix::Mknod qw(:all);
@@ -26,24 +24,30 @@ use POSIX;
use Locale::gettext;
@@ -26,58 +27,58 @@ use POSIX;
setlocale(LC_MESSAGES, "");
textdomain("tails-perl-lib");
......@@ -596,30 +664,31 @@ index 7216782..c0ae00b 100644
is => 'ro',
lazy_build => 1, # Let's decide the right initialization order in BUILD
- isa => 'Net::DBus::RemoteObject';
-
-sub BUILD {
- my $self = shift;
+ isa => 'Net::DBus::RemoteObject',
+);
sub BUILD {
my $self = shift;
@@ -54,26 +58,34 @@ sub BUILD {
+method BUILD (@args) {
# Force initialization in correct order
assert_defined($self->dbus);
assert_defined($self->udisks_service);
assert_defined($self->udisks_object);
}
-method _build_constants {
+sub _build_constants {
+ my $self = shift;
+method _build_constants () {
Tails::Constants->new();
}
-method _build_udisks_service {
+sub _build_udisks_service {
+ my $self = shift;
+method _build_udisks_service () {
$self->dbus->get_service("org.freedesktop.UDisks2");
}
-method _build_udisks_object {
+sub _build_udisks_object {
+ my $self = shift;
+method _build_udisks_object () {
$self->udisks_service->get_object(
"/org/freedesktop/UDisks2",
"org.freedesktop.DBus.ObjectManager"
......@@ -627,180 +696,156 @@ index 7216782..c0ae00b 100644
}
-method debug {
+sub debug {
+ my $self = shift;
+method debug (@args) {
say STDERR @_ if $ENV{DEBUG};
}
-method get_udisks_property ($type, $object, $property) {
+sub get_udisks_property {
+ my $self = shift;
+ my $type = shift;
+ my $object = shift;
+ my $property = shift;
assert_defined($type);
assert_defined($object);
assert_defined($property);
@@ -85,27 +97,44 @@ method get_udisks_property ($type, $object, $property) {
- assert_defined($type);
- assert_defined($object);
- assert_defined($property);
-
+method get_udisks_property (Str $type, Defined $object, Str $property) {
$self->debug("Entering get_udisks_property: $type, $object, $property");
$self->udisks_service
->get_object($object)
@@ -85,29 +86,27 @@ method get_udisks_property ($type, $object, $property) {
->Get("org.freedesktop.UDisks2.$type", $property);
}
-method get_block_device_property ($device, $property) {
+sub get_block_device_property {
+ my $self = shift;
+ my $device = shift;
+ my $property = shift;
+method get_block_device_property (Defined $device, Str $property) {
$self->get_udisks_property('Block', $device, $property);
}
-method get_drive_property ($drive, $property) {
+sub get_drive_property {
+ my $self = shift;
+ my $drive = shift;
+ my $property = shift;
+method get_drive_property (Defined $drive, Str $property) {
$self->get_udisks_property('Drive', $drive, $property);
}
-method get_partition_table_property ($device, $property) {
+sub get_partition_table_property {
+ my $self = shift;
+ my $device = shift;
+ my $property = shift;
+method get_partition_table_property (Defined $device, Str $property) {
$self->get_udisks_property('PartitionTable', $device, $property);
}
-method get_partition_property ($device, $property) {
+sub get_partition_property {
+ my $self = shift;
+ my $device = shift;
+ my $property = shift;
+method get_partition_property (Defined $device, Str $property) {
$self->get_udisks_property('Partition', $device, $property);
}
-method get_filesystem_property ($device, $property) {
+sub get_filesystem_property {