Skip to content

Commit

Permalink
fix github CI, chdman in ubuntu 24.04 is too old
Browse files Browse the repository at this point in the history
  • Loading branch information
alucryd committed Jan 7, 2025
1 parent 0146961 commit 49827d8
Show file tree
Hide file tree
Showing 21 changed files with 126 additions and 14 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/continuous_integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
- name: Checkout repository
uses: actions/checkout@v3
- name: Install dependencies
run: sudo apt-get install bchunk liblz4-1 libuv1 libzopfli1 mame-tools wit yarn
run: sudo apt-get install bchunk dolphin-emu liblz4-1 libuv1 libzopfli1 mame-tools wit yarn
- name: Run sccache-cache
uses: mozilla-actions/[email protected]
- name: Install rust toolchain
Expand Down
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
# 0.20.2

- Add a new `wanted` game state in the web UI, replaces `incomplete` which now means games with some (but not all) its ROMs
- Fix a regression when importing multi-track CHDs which contain tracks identical to other games
- Fix parsing archives containing files with `=` symbols in their names

# 0.20.1

- Fix an import issue with Progetto MAME DATs
Expand Down
7 changes: 7 additions & 0 deletions src/check_roms/test_multiple_tracks_chd.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,19 @@ use super::super::database::*;
use super::super::import_dats;
use super::super::import_roms;
use super::*;
use std::cmp::Ordering;
use std::path::{Path, PathBuf};
use tempfile::{NamedTempFile, TempDir};
use tokio::fs;

#[tokio::test]
async fn test() {
if let Ok(version) = chdman::get_version().await {
if version.as_str().cmp(chdman::MIN_SPLITBIN_VERSION) == Ordering::Less {
return;
}
}

// given
let _guard = MUTEX.lock().await;

Expand Down
6 changes: 6 additions & 0 deletions src/convert_roms/test_multiple_tracks_chd_to_chd.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,12 @@ use tokio::fs;

#[tokio::test]
async fn test() {
if let Ok(version) = chdman::get_version().await {
if version.as_str().cmp(chdman::MIN_SPLITBIN_VERSION) == Ordering::Less {
return;
}
}

// given
let _guard = MUTEX.lock().await;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,12 @@ use tokio::fs;

#[tokio::test]
async fn test() {
if let Ok(version) = chdman::get_version().await {
if version.as_str().cmp(chdman::MIN_SPLITBIN_VERSION) == Ordering::Less {
return;
}
}

// given
let _guard = MUTEX.lock().await;

Expand Down
6 changes: 6 additions & 0 deletions src/convert_roms/test_multiple_tracks_chd_to_cue_bin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,12 @@ use tokio::fs;

#[tokio::test]
async fn test() {
if let Ok(version) = chdman::get_version().await {
if version.as_str().cmp(chdman::MIN_SPLITBIN_VERSION) == Ordering::Less {
return;
}
}

// given
let _guard = MUTEX.lock().await;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,12 @@ use tokio::fs;

#[tokio::test]
async fn test() {
if let Ok(version) = chdman::get_version().await {
if version.as_str().cmp(chdman::MIN_SPLITBIN_VERSION) == Ordering::Less {
return;
}
}

// given
let _guard = MUTEX.lock().await;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,12 @@ use tokio::fs;

#[tokio::test]
async fn test() {
if let Ok(version) = chdman::get_version().await {
if version.as_str().cmp(chdman::MIN_SPLITBIN_VERSION) == Ordering::Less {
return;
}
}

// given
let _guard = MUTEX.lock().await;

Expand Down
8 changes: 7 additions & 1 deletion src/convert_roms/test_multiple_tracks_cue_bin_to_chd.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,13 @@ use tempfile::{NamedTempFile, TempDir};
use tokio::fs;

#[tokio::test]
async fn test_cue_bin_to_chd() {
async fn test() {
if let Ok(version) = chdman::get_version().await {
if version.as_str().cmp(chdman::MIN_SPLITBIN_VERSION) == Ordering::Less {
return;
}
}

// given
let _guard = MUTEX.lock().await;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,12 @@ use tokio::fs;

#[tokio::test]
async fn test() {
if let Ok(version) = chdman::get_version().await {
if version.as_str().cmp(chdman::MIN_SPLITBIN_VERSION) == Ordering::Less {
return;
}
}

// given
let _guard = MUTEX.lock().await;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,12 @@ use tokio::fs;

#[tokio::test]
async fn test() {
if let Ok(version) = chdman::get_version().await {
if version.as_str().cmp(chdman::MIN_SPLITBIN_VERSION) == Ordering::Less {
return;
}
}

// given
let _guard = MUTEX.lock().await;

Expand Down
6 changes: 6 additions & 0 deletions src/export_roms/test_multiple_tracks_chd_to_cue_bin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,12 @@ use tokio::fs;

#[tokio::test]
async fn test() {
if let Ok(version) = chdman::get_version().await {
if version.as_str().cmp(chdman::MIN_SPLITBIN_VERSION) == Ordering::Less {
return;
}
}

// given
let _guard = MUTEX.lock().await;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,12 @@ use tokio::fs;

#[tokio::test]
async fn test() {
if let Ok(version) = chdman::get_version().await {
if version.as_str().cmp(chdman::MIN_SPLITBIN_VERSION) == Ordering::Less {
return;
}
}

// given
let _guard = MUTEX.lock().await;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,12 @@ use tokio::fs;

#[tokio::test]
async fn test() {
if let Ok(version) = chdman::get_version().await {
if version.as_str().cmp(chdman::MIN_SPLITBIN_VERSION) == Ordering::Less {
return;
}
}

// given
let _guard = MUTEX.lock().await;

Expand Down
8 changes: 7 additions & 1 deletion src/export_roms/test_multiple_tracks_cue_bin_to_chd.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,13 @@ use tempfile::{NamedTempFile, TempDir};
use tokio::fs;

#[tokio::test]
async fn test_cue_bin_to_chd() {
async fn test() {
if let Ok(version) = chdman::get_version().await {
if version.as_str().cmp(chdman::MIN_SPLITBIN_VERSION) == Ordering::Less {
return;
}
}

// given
let _guard = MUTEX.lock().await;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,12 @@ use tokio::fs;

#[tokio::test]
async fn test() {
if let Ok(version) = chdman::get_version().await {
if version.as_str().cmp(chdman::MIN_SPLITBIN_VERSION) == Ordering::Less {
return;
}
}

// given
let _guard = MUTEX.lock().await;

Expand Down
8 changes: 8 additions & 0 deletions src/import_dats/test_dat_updated_orphan_chd.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,19 @@
use super::super::chdman;
use super::super::database::*;
use super::*;
use std::cmp::Ordering;
use std::path::PathBuf;
use tempfile::{NamedTempFile, TempDir};
use tokio::fs;

#[tokio::test]
async fn test() {
if let Ok(version) = chdman::get_version().await {
if version.as_str().cmp(chdman::MIN_SPLITBIN_VERSION) == Ordering::Less {
return;
}
}

// given
let _guard = MUTEX.lock().await;

Expand Down
8 changes: 8 additions & 0 deletions src/import_dats/test_dat_updated_orphan_chd_mismatch.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,19 @@
use super::super::chdman;
use super::super::database::*;
use super::*;
use std::cmp::Ordering;
use std::path::PathBuf;
use tempfile::{NamedTempFile, TempDir};
use tokio::fs;

#[tokio::test]
async fn test() {
if let Ok(version) = chdman::get_version().await {
if version.as_str().cmp(chdman::MIN_SPLITBIN_VERSION) == Ordering::Less {
return;
}
}

// given
let _guard = MUTEX.lock().await;

Expand Down
3 changes: 1 addition & 2 deletions src/import_roms.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
use crate::chdman::{AsChd, ChdType};

use super::chdman;
use super::chdman::{AsChd, ChdType};
use super::common::*;
use super::config::*;
use super::ctrtool;
Expand Down
2 changes: 1 addition & 1 deletion src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ async fn main() -> SimpleResult<()> {
if matches.subcommand().is_some() {
dotenv().ok();

let mut builder = Builder::from_env("OXYROMON_LOG");
let mut builder = Builder::from_env("OXYROMON_LOG_LEVEL");
if matches.subcommand_name().unwrap() != "server" {
// log to stdout for interactive commands because indicatif uses stderr
builder.target(Target::Stdout);
Expand Down
22 changes: 14 additions & 8 deletions src/sevenzip.rs
Original file line number Diff line number Diff line change
Expand Up @@ -196,15 +196,18 @@ impl ToCommon for ArchiveRomfile {

progress_bar.println(format!("Extracting \"{}\"", &self.path));

let output = Command::new(get_executable_path(SEVENZIP_EXECUTABLES)?)
let mut command = Command::new(get_executable_path(SEVENZIP_EXECUTABLES)?);
command
.arg("x")
.arg("-aoa")
.arg("--")
.arg(&self.romfile.path)
.arg(&self.path)
.current_dir(directory.as_ref())
.output()
.await
.expect("Failed to extract archive");
.current_dir(directory.as_ref());

log::debug!("{:?}", command);

let output = command.output().await.expect("Failed to extract archive");

if !output.status.success() {
bail!(String::from_utf8(output.stderr).unwrap().as_str())
Expand Down Expand Up @@ -349,6 +352,9 @@ impl AsArchive for CommonRomfile {
if let Some(rom) = rom {
command.arg(&rom.name);
}

log::debug!("{:?}", command);

let output = command.output().await.expect("Failed to parse archive");

if !output.status.success() {
Expand All @@ -360,17 +366,17 @@ impl AsArchive for CommonRomfile {
.lines()
.filter(|&line| line.starts_with("Path ="))
.skip(1) // the first line is the archive itself
.map(|line| line.split('=').last().unwrap().trim().to_string()) // keep only the rhs
.map(|line| line.to_string().split_off(7)) // keep only the rhs
.collect();
let sizes: Vec<u64> = stdout
.lines()
.filter(|&line| line.starts_with("Size ="))
.map(|line| line.split('=').last().unwrap().trim().parse().unwrap()) // keep only the rhs
.map(|line| line.to_string().split_off(7).parse().unwrap()) // keep only the rhs
.collect();
let crcs: Vec<String> = stdout
.lines()
.filter(|&line| line.starts_with("CRC ="))
.map(|line| line.split('=').last().unwrap().trim().to_lowercase()) // keep only the rhs
.map(|line| line.to_string().split_off(6).to_lowercase()) // keep only the rhs
.collect();

progress_bar.set_message("");
Expand Down

0 comments on commit 49827d8

Please sign in to comment.