Merge branch 'worktree-faces-scrfd-mbf' into master
Build and test / Desktop (Linux) (push) Successful in 1h22m16s
Build and test / Layer separation (push) Successful in 41s
Traceability / Requirement traces (push) Successful in 30s
🐳 Android image / Build and push (push) Successful in 8s
Build and test / android-image (push) Successful in 8s
Build and test / Android (aarch64) (push) Failing after 33m45s
Build and test / Desktop (Linux) (push) Successful in 1h22m16s
Build and test / Layer separation (push) Successful in 41s
Traceability / Requirement traces (push) Successful in 30s
🐳 Android image / Build and push (push) Successful in 8s
Build and test / android-image (push) Successful in 8s
Build and test / Android (aarch64) (push) Failing after 33m45s
This commit is contained in:
@@ -222,22 +222,16 @@ impl Default for PlatformSecretStore {
|
|||||||
#[cfg(target_os = "android")]
|
#[cfg(target_os = "android")]
|
||||||
impl SecretStore for PlatformSecretStore {
|
impl SecretStore for PlatformSecretStore {
|
||||||
fn store(&self, secret_ref: &SecretRef, secret: &str) -> Result<(), SecretError> {
|
fn store(&self, secret_ref: &SecretRef, secret: &str) -> Result<(), SecretError> {
|
||||||
use keyring_core::api::CredentialApi;
|
|
||||||
|
|
||||||
self.entry(secret_ref)?
|
self.entry(secret_ref)?
|
||||||
.set_password(secret)
|
.set_password(secret)
|
||||||
.map_err(map_err)
|
.map_err(map_err)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn retrieve(&self, secret_ref: &SecretRef) -> Result<String, SecretError> {
|
fn retrieve(&self, secret_ref: &SecretRef) -> Result<String, SecretError> {
|
||||||
use keyring_core::api::CredentialApi;
|
|
||||||
|
|
||||||
self.entry(secret_ref)?.get_password().map_err(map_err)
|
self.entry(secret_ref)?.get_password().map_err(map_err)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn delete(&self, secret_ref: &SecretRef) -> Result<(), SecretError> {
|
fn delete(&self, secret_ref: &SecretRef) -> Result<(), SecretError> {
|
||||||
use keyring_core::api::CredentialApi;
|
|
||||||
|
|
||||||
match self.entry(secret_ref)?.delete_credential() {
|
match self.entry(secret_ref)?.delete_credential() {
|
||||||
Ok(()) => Ok(()),
|
Ok(()) => Ok(()),
|
||||||
// Logout must be idempotent, as on Linux.
|
// Logout must be idempotent, as on Linux.
|
||||||
|
|||||||
@@ -27,7 +27,10 @@
|
|||||||
//! directory is reported alongside and weighted more heavily than the flag:
|
//! directory is reported alongside and weighted more heavily than the flag:
|
||||||
//! a volume with `DCIM` on it is a camera card whatever sysfs believes.
|
//! a volume with `DCIM` on it is a camera card whatever sysfs believes.
|
||||||
|
|
||||||
use std::path::{Path, PathBuf};
|
use std::path::PathBuf;
|
||||||
|
// Only the mount-table reader below borrows a path; `Volume` owns one.
|
||||||
|
#[cfg(target_os = "linux")]
|
||||||
|
use std::path::Path;
|
||||||
|
|
||||||
/// Somewhere a card might be.
|
/// Somewhere a card might be.
|
||||||
#[derive(Debug, Clone, PartialEq, Eq)]
|
#[derive(Debug, Clone, PartialEq, Eq)]
|
||||||
@@ -136,6 +139,7 @@ fn platform_volumes() -> Vec<Volume> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// One line of the mount table.
|
/// One line of the mount table.
|
||||||
|
#[cfg(target_os = "linux")]
|
||||||
#[derive(Debug, Clone, PartialEq, Eq)]
|
#[derive(Debug, Clone, PartialEq, Eq)]
|
||||||
struct Mount {
|
struct Mount {
|
||||||
device: String,
|
device: String,
|
||||||
@@ -147,6 +151,7 @@ struct Mount {
|
|||||||
///
|
///
|
||||||
/// Split out from the reading so it can be tested against real tables without
|
/// Split out from the reading so it can be tested against real tables without
|
||||||
/// a card plugged in — which is the only way this file is testable at all.
|
/// a card plugged in — which is the only way this file is testable at all.
|
||||||
|
#[cfg(target_os = "linux")]
|
||||||
fn parse_mounts(table: &str) -> Vec<Mount> {
|
fn parse_mounts(table: &str) -> Vec<Mount> {
|
||||||
table
|
table
|
||||||
.lines()
|
.lines()
|
||||||
@@ -169,6 +174,7 @@ fn parse_mounts(table: &str) -> Vec<Mount> {
|
|||||||
/// A card is very often labelled with a space in it — `EOS DIGITAL` is what
|
/// A card is very often labelled with a space in it — `EOS DIGITAL` is what
|
||||||
/// Canon writes — and mounted at `/run/media/duncan/EOS\040DIGITAL`. Without
|
/// Canon writes — and mounted at `/run/media/duncan/EOS\040DIGITAL`. Without
|
||||||
/// this the path does not exist and the card is invisible.
|
/// this the path does not exist and the card is invisible.
|
||||||
|
#[cfg(target_os = "linux")]
|
||||||
fn unescape(field: &str) -> String {
|
fn unescape(field: &str) -> String {
|
||||||
let mut out = String::with_capacity(field.len());
|
let mut out = String::with_capacity(field.len());
|
||||||
let bytes = field.as_bytes();
|
let bytes = field.as_bytes();
|
||||||
@@ -192,6 +198,7 @@ fn unescape(field: &str) -> String {
|
|||||||
///
|
///
|
||||||
/// Excludes the pseudo-filesystems, which is most of the table, and anything
|
/// Excludes the pseudo-filesystems, which is most of the table, and anything
|
||||||
/// not backed by a block device. A card reader always is.
|
/// not backed by a block device. A card reader always is.
|
||||||
|
#[cfg(target_os = "linux")]
|
||||||
fn is_candidate(m: &Mount) -> bool {
|
fn is_candidate(m: &Mount) -> bool {
|
||||||
const FILESYSTEMS: &[&str] = &[
|
const FILESYSTEMS: &[&str] = &[
|
||||||
// What cameras format cards as, in practice: FAT32 below 32 GB,
|
// What cameras format cards as, in practice: FAT32 below 32 GB,
|
||||||
@@ -204,6 +211,7 @@ fn is_candidate(m: &Mount) -> bool {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Whether the desktop automounted this, which means it already decided.
|
/// Whether the desktop automounted this, which means it already decided.
|
||||||
|
#[cfg(target_os = "linux")]
|
||||||
fn under_media_dir(mount_point: &Path) -> bool {
|
fn under_media_dir(mount_point: &Path) -> bool {
|
||||||
let s = mount_point.to_string_lossy();
|
let s = mount_point.to_string_lossy();
|
||||||
s.starts_with("/run/media/") || s.starts_with("/media/") || s.starts_with("/mnt/media/")
|
s.starts_with("/run/media/") || s.starts_with("/media/") || s.starts_with("/mnt/media/")
|
||||||
@@ -217,6 +225,7 @@ fn under_media_dir(mount_point: &Path) -> bool {
|
|||||||
/// lose only the `pN` suffix — strip naively and `mmcblk0p1` becomes
|
/// lose only the `pN` suffix — strip naively and `mmcblk0p1` becomes
|
||||||
/// `mmcblk`, which does not exist, and every SD card in an internal reader
|
/// `mmcblk`, which does not exist, and every SD card in an internal reader
|
||||||
/// reports itself fixed.
|
/// reports itself fixed.
|
||||||
|
#[cfg(target_os = "linux")]
|
||||||
fn device_is_removable(device: &str) -> Option<bool> {
|
fn device_is_removable(device: &str) -> Option<bool> {
|
||||||
let name = device.strip_prefix("/dev/")?;
|
let name = device.strip_prefix("/dev/")?;
|
||||||
let disk = whole_disk(name);
|
let disk = whole_disk(name);
|
||||||
@@ -225,6 +234,7 @@ fn device_is_removable(device: &str) -> Option<bool> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// The whole-disk name a partition belongs to.
|
/// The whole-disk name a partition belongs to.
|
||||||
|
#[cfg(target_os = "linux")]
|
||||||
fn whole_disk(partition: &str) -> String {
|
fn whole_disk(partition: &str) -> String {
|
||||||
// `mmcblk0p1` -> `mmcblk0`, `nvme0n1p3` -> `nvme0n1`: these spell the
|
// `mmcblk0p1` -> `mmcblk0`, `nvme0n1p3` -> `nvme0n1`: these spell the
|
||||||
// partition with a `p`, and the disk name legitimately ends in a digit.
|
// partition with a `p`, and the disk name legitimately ends in a digit.
|
||||||
@@ -243,6 +253,7 @@ fn whole_disk(partition: &str) -> String {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// What to call a volume in a list.
|
/// What to call a volume in a list.
|
||||||
|
#[cfg(target_os = "linux")]
|
||||||
fn label_for(mount_point: &Path) -> String {
|
fn label_for(mount_point: &Path) -> String {
|
||||||
mount_point
|
mount_point
|
||||||
.file_name()
|
.file_name()
|
||||||
@@ -250,7 +261,9 @@ fn label_for(mount_point: &Path) -> String {
|
|||||||
.unwrap_or_else(|| mount_point.to_string_lossy().to_string())
|
.unwrap_or_else(|| mount_point.to_string_lossy().to_string())
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(test)]
|
// Reading `/proc/mounts` and naming block devices is what these test, so
|
||||||
|
// they are as Linux-bound as the code above.
|
||||||
|
#[cfg(all(test, target_os = "linux"))]
|
||||||
mod tests {
|
mod tests {
|
||||||
use super::*;
|
use super::*;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user