public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
From: "Georgy Yakovlev" <gyakovlev@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] proj/cargo-ebuild:master commit in: /, src/
Date: Thu, 26 Aug 2021 07:51:41 +0000 (UTC)	[thread overview]
Message-ID: <1629963632.4b0b01717cd58331181101a7d94cdba88a912237.gyakovlev@gentoo> (raw)

commit:     4b0b01717cd58331181101a7d94cdba88a912237
Author:     Leonardo Neumann <leonardo <AT> neumann <DOT> dev <DOT> br>
AuthorDate: Sat Aug 14 20:03:22 2021 +0000
Commit:     Georgy Yakovlev <gyakovlev <AT> gentoo <DOT> org>
CommitDate: Thu Aug 26 07:40:32 2021 +0000
URL:        https://gitweb.gentoo.org/proj/cargo-ebuild.git/commit/?id=4b0b0171

Remove cargo-lock dependency

Closes: https://github.com/gentoo/cargo-ebuild/pull/7
Signed-off-by: Leonardo Neumann <leonardo <AT> neumann.dev.br>
Signed-off-by: Georgy Yakovlev <gyakovlev <AT> gentoo.org>

 Cargo.lock |  4 ++--
 src/lib.rs | 46 +++++-----------------------------------------
 2 files changed, 7 insertions(+), 43 deletions(-)

diff --git a/Cargo.lock b/Cargo.lock
index e7a9187..431eb9d 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -349,9 +349,9 @@ checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646"
 
 [[package]]
 name = "libc"
-version = "0.2.100"
+version = "0.2.101"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "a1fa8cddc8fbbee11227ef194b5317ed014b8acbf15139bd716a18ad3fe99ec5"
+checksum = "3cb00336871be5ed2c8ed44b60ae9959dc5b9f08539422ed43f09e34ecaeba21"
 
 [[package]]
 name = "log"

diff --git a/src/lib.rs b/src/lib.rs
index db9d54b..29fd0c2 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -12,40 +12,15 @@ mod license;
 mod metadata;
 
 use anyhow::{format_err, Context, Result};
-use cargo_lock::Lockfile;
 use cargo_metadata::CargoOpt;
 use cargo_metadata::MetadataCommand;
 use std::collections::BTreeSet;
 use std::fs::OpenOptions;
 use std::path::{Path, PathBuf};
-use std::process::Command;
 
 use license::{normalize_license, split_spdx_license};
 use metadata::EbuildConfig;
 
-fn generate_lockfile(manifest_path: Option<PathBuf>) -> Result<()> {
-    let cargo = std::env::var("CARGO")
-        .map(PathBuf::from)
-        .unwrap_or_else(|_| PathBuf::from("cargo"));
-
-    let mut lock_cmd = Command::new(cargo);
-    lock_cmd.arg("generate-lockfile");
-
-    if let Some(path) = manifest_path.as_ref() {
-        lock_cmd.arg("--manifest-path");
-        lock_cmd.arg(path.as_os_str());
-    }
-
-    let lock_output = lock_cmd.output()?;
-
-    if !lock_output.status.success() {
-        let stderr = String::from_utf8_lossy(&lock_output.stderr);
-        return Err(format_err!("unable to generate lockfile:\n{}", stderr));
-    }
-
-    Ok(())
-}
-
 pub fn gen_ebuild_data(manifest_path: Option<PathBuf>) -> Result<EbuildConfig> {
     let mut cmd = MetadataCommand::new();
 
@@ -97,29 +72,18 @@ pub fn gen_ebuild_data(manifest_path: Option<PathBuf>) -> Result<EbuildConfig> {
         if pkg.license_file.is_some() {
             println!("WARNING: {} uses a license-file, not handled", pkg.name);
         }
-    }
 
-    let root_pkg = root_pkg
-        .ok_or_else(|| format_err!("unable to determine package to generate ebuild for"))?;
-
-    let lockfile_path = metadata.workspace_root.join("Cargo.lock");
-
-    // Generate lockfile if it doesn't exists
-    if std::fs::metadata(&lockfile_path).is_err() {
-        generate_lockfile(manifest_path)?;
-    }
-
-    // Check for packages that must be fetched from default registry
-    let lockfile = Lockfile::load(lockfile_path)?;
-
-    for pkg in lockfile.packages {
         if let Some(src) = pkg.source {
-            if src.is_default_registry() {
+            // Check if the crate is available at crates.io
+            if src.is_crates_io() {
                 crates.push(format!("\t{}-{}\n", pkg.name, pkg.version));
             }
         }
     }
 
+    let root_pkg = root_pkg
+        .ok_or_else(|| format_err!("unable to determine package to generate ebuild for"))?;
+
     Ok(EbuildConfig::from_package(root_pkg, crates, licenses))
 }
 


             reply	other threads:[~2021-08-26  7:51 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-26  7:51 Georgy Yakovlev [this message]
  -- strict thread matches above, loose matches on Subject: below --
2021-10-07 16:23 [gentoo-commits] proj/cargo-ebuild:master commit in: /, src/ Georgy Yakovlev
2021-08-26  7:51 Georgy Yakovlev
2021-08-25 15:35 Georgy Yakovlev

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1629963632.4b0b01717cd58331181101a7d94cdba88a912237.gyakovlev@gentoo \
    --to=gyakovlev@gentoo.org \
    --cc=gentoo-commits@lists.gentoo.org \
    --cc=gentoo-dev@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox