Fix acquiring package cache lock for SourceConfigMap
diff --git a/.github/workflows/ci-pr.yml b/.github/workflows/ci-pr.yml
index 553aacd..34e198a 100644
--- a/.github/workflows/ci-pr.yml
+++ b/.github/workflows/ci-pr.yml
@@ -63,3 +63,29 @@
run: cargo test --no-run ${{ env.FLAGS }}
- name: Test
run: cargo test ${{ env.FLAGS }}
+ run:
+ name: Run cargo-outdated
+ env:
+ FLAGS: --all-features
+ strategy:
+ fail-fast: false
+ matrix:
+ os: [ubuntu-latest, windows-latest, macOS-latest]
+ rust: [stable]
+ runs-on: ${{ matrix.os }}
+ steps:
+ - name: Install rust
+ uses: actions-rs/toolchain@v1
+ with:
+ profile: minimal
+ toolchain: ${{ matrix.rust }}
+ override: true
+ - name: Cache Builds
+ uses: Swatinem/rust-cache@v1
+ - name: Checkout
+ uses: actions/checkout@v2
+ - name: Compile
+ run: cargo build ${{ env.FLAGS }}
+ - name: Test
+ run: cargo run ${{ env.FLAGS }} -- outdated
+
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 88fffec..1ebe58c 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -124,6 +124,18 @@
with:
command: test
args: --target ${{ matrix.target }} --all-features --release
+ - name: Run
+ uses: actions-rs/cargo@v1
+ if: matrix.features == 'none'
+ with:
+ command: run
+ args: --target ${{ matrix.target }} --no-default-features -- outdated
+ - name: Run release
+ uses: actions-rs/cargo@v1
+ if: matrix.features == 'release'
+ with:
+ command: run
+ args: --target ${{ matrix.target }} --all-features --release -- outdated
nightly:
name: Nightly Tests
strategy:
@@ -166,3 +178,15 @@
with:
command: test
args: --all-features --release
+ - name: Run
+ uses: actions-rs/cargo@v1
+ if: matrix.features == 'none'
+ with:
+ command: run
+ args: --target ${{ matrix.target }} --no-default-features -- outdated
+ - name: Run release
+ uses: actions-rs/cargo@v1
+ if: matrix.features == 'release'
+ with:
+ command: run
+ args: --target ${{ matrix.target }} --all-features --release -- outdated
diff --git a/Cargo.lock b/Cargo.lock
index d8d74f0..cf1fc9f 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -148,7 +148,7 @@
[[package]]
name = "cargo-outdated"
-version = "0.9.17"
+version = "0.10.0"
dependencies = [
"anyhow",
"cargo",
diff --git a/src/cargo_ops/temp_project.rs b/src/cargo_ops/temp_project.rs
index c75da52..38acad2 100644
--- a/src/cargo_ops/temp_project.rs
+++ b/src/cargo_ops/temp_project.rs
@@ -371,15 +371,15 @@
let package_id = workspace.find_direct_dependency(name, dependent_package_name)?;
let version = package_id.version();
let source_id = package_id.source_id().with_precise(None);
- let source_config = SourceConfigMap::new(workspace.workspace.config())?;
- let mut source = source_config.load(source_id, &HashSet::new())?;
- if !source_id.is_default_registry() {
- let _lock = self.config.acquire_package_cache_lock()?;
- source.update()?;
- }
- let dependency = Dependency::parse(name, None, source_id)?;
let query_result = {
- let _lock = self.config.acquire_package_cache_lock()?;
+ let ws_config = workspace.workspace.config();
+ let _lock = ws_config.acquire_package_cache_lock()?;
+ let source_config = SourceConfigMap::new(ws_config)?;
+ let mut source = source_config.load(source_id, &HashSet::new())?;
+ if !source_id.is_default_registry() {
+ source.update()?;
+ }
+ let dependency = Dependency::parse(name, None, source_id)?;
let mut query_result = source.query_vec(&dependency)?;
query_result.sort_by(|a, b| b.version().cmp(a.version()));
query_result