aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGalen Guyer <galen@galenguyer.com>2023-01-14 00:00:07 -0500
committerGalen Guyer <galen@galenguyer.com>2023-01-14 00:00:07 -0500
commitb8334a92350b4e20004cc9cd97f3ddfcc8d1dfe0 (patch)
tree0d9afbc6408a39c6c04fd6784d4e58d48ffc5ee9
parentb3f6218cb39c4b906e25a7da0ec8c106274dd1d2 (diff)
get packagelist from makepkg
-rw-r--r--Cargo.lock7
-rw-r--r--Cargo.toml1
-rw-r--r--src/bin/alpm-test.rs14
-rw-r--r--src/bin/build-pkg.rs23
-rw-r--r--src/bin/create-chroot.rs2
-rw-r--r--src/bin/create-repo.rs14
-rw-r--r--src/lib.rs2
7 files changed, 51 insertions, 12 deletions
diff --git a/Cargo.lock b/Cargo.lock
index 105cb3c..8c29107 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -563,6 +563,7 @@ dependencies = [
"reqwest",
"serde",
"serde_json",
+ "srcinfo",
"tokio",
]
@@ -753,6 +754,12 @@ dependencies = [
]
[[package]]
+name = "srcinfo"
+version = "1.1.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "ceaee0d48949e3aa5365945de3e467e797b30b4f8636c2e580121a293fd77519"
+
+[[package]]
name = "syn"
version = "1.0.107"
source = "registry+https://github.com/rust-lang/crates.io-index"
diff --git a/Cargo.toml b/Cargo.toml
index 80afed7..44b98cc 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -14,4 +14,5 @@ dirs = "4.0.0"
reqwest = { version = "0.11.13", features = ["json", "gzip"] }
serde = { version = "1.0.152", features = ["derive"] }
serde_json = "1.0.91"
+srcinfo = "1.1.0"
tokio = { version = "1.24.1", features = ["macros", "rt-multi-thread"] }
diff --git a/src/bin/alpm-test.rs b/src/bin/alpm-test.rs
index 3e701c8..a2868ff 100644
--- a/src/bin/alpm-test.rs
+++ b/src/bin/alpm-test.rs
@@ -5,13 +5,19 @@ fn main() {
handle
.register_syncdb_mut("core", SigLevel::USE_DEFAULT)
- .unwrap().add_server("https://mirror.pkgbuild.com/core/os/x86_64").unwrap();
+ .unwrap()
+ .add_server("https://mirror.pkgbuild.com/core/os/x86_64")
+ .unwrap();
handle
.register_syncdb_mut("extra", SigLevel::USE_DEFAULT)
- .unwrap().add_server("https://mirror.pkgbuild.com/extra/os/x86_64").unwrap();
+ .unwrap()
+ .add_server("https://mirror.pkgbuild.com/extra/os/x86_64")
+ .unwrap();
handle
.register_syncdb_mut("community", SigLevel::USE_DEFAULT)
- .unwrap().add_server("https://mirror.pkgbuild.com/community/os/x86_64").unwrap();
+ .unwrap()
+ .add_server("https://mirror.pkgbuild.com/community/os/x86_64")
+ .unwrap();
handle.syncdbs_mut().update(true).unwrap();
@@ -57,4 +63,4 @@ fn main() {
// find a package matching a dep
let pkg = handle.syncdbs().find_satisfier("libgtk-3.so").unwrap();
println!("{} {}", pkg.name(), pkg.desc().unwrap_or("None"));
-} \ No newline at end of file
+}
diff --git a/src/bin/build-pkg.rs b/src/bin/build-pkg.rs
index 23bd5d7..de8f7b2 100644
--- a/src/bin/build-pkg.rs
+++ b/src/bin/build-pkg.rs
@@ -61,13 +61,32 @@ async fn main() {
package_name
))
.arg("-l")
- .arg(package_name)
+ .arg(&package_name)
.arg("-r")
.arg(chroot_dir)
.arg("--")
.args(["--skippgpcheck", "--syncdeps"]);
dbg!(&command);
- print_status(command.spawn());
+ // print_status(command.spawn());
+
+ let mut command = Command::new("makepkg");
+ command
+ .current_dir(format!(
+ "{}/pkgbuild/{}",
+ dirs::cache_dir().unwrap().to_str().unwrap(),
+ &package_name
+ ))
+ .arg("--packagelist");
+ dbg!(&command);
+ let output = command.output().expect("Failed to execute command");
+ let package_list = String::from_utf8(output.stdout)
+ .unwrap()
+ .trim()
+ .to_string()
+ .split_whitespace()
+ .map(|s| String::from(s))
+ .collect::<Vec<String>>();
+ println!("{:?}", package_list);
}
fn print_status(output: Result<Child, std::io::Error>) {
diff --git a/src/bin/create-chroot.rs b/src/bin/create-chroot.rs
index 185a629..abbf982 100644
--- a/src/bin/create-chroot.rs
+++ b/src/bin/create-chroot.rs
@@ -11,7 +11,6 @@ fn main() {
dbg!(&command);
print_status(command.spawn());
-
let mut command = Command::new("chown");
command
.arg(format!(
@@ -23,7 +22,6 @@ fn main() {
dbg!(&command);
print_status(command.spawn());
-
let mut command = Command::new("mkarchroot");
command
.arg("-C")
diff --git a/src/bin/create-repo.rs b/src/bin/create-repo.rs
index 4aef40c..68514cd 100644
--- a/src/bin/create-repo.rs
+++ b/src/bin/create-repo.rs
@@ -12,7 +12,9 @@ fn main() {
}
command.arg(format!(
"{}/{}.db.tar.zst",
- std::env::var("PKGBUILD_REPO_ROOT").expect("PKGBUILD_REPO_ROOT not set").trim_end_matches('/'),
+ std::env::var("PKGBUILD_REPO_ROOT")
+ .expect("PKGBUILD_REPO_ROOT not set")
+ .trim_end_matches('/'),
std::env::var("PKGBUILD_REPO_NAME").expect("PKGBUILD_REPO_NAME not set"),
));
@@ -21,8 +23,14 @@ fn main() {
match output {
Ok(output) => {
println!("STATUS: {}", output.status);
- println!("===== STDOUT =====\n{}", String::from_utf8_lossy(&output.stdout));
- println!("===== STDERR =====\n{}", String::from_utf8_lossy(&output.stderr));
+ println!(
+ "===== STDOUT =====\n{}",
+ String::from_utf8_lossy(&output.stdout)
+ );
+ println!(
+ "===== STDERR =====\n{}",
+ String::from_utf8_lossy(&output.stderr)
+ );
}
Err(e) => {
println!("ERROR: {}", e);
diff --git a/src/lib.rs b/src/lib.rs
index bc7f28f..82e4775 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -107,4 +107,4 @@ fn resolve_dep(dep: &str, alpm: &Alpm, aur: &Vec<PackageMeta>) -> Dependency {
}
}
}
-} \ No newline at end of file
+}