-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* created add_repo TODO verify provided link * created add_repo TODO verify provided link * rewrote add_repo to use bson * merged main * updated gitignore * added pkg-config * built add_repo * fmt and ignore * updated podman cargo target dir * switched ensure_path to a function * fmt
- Loading branch information
1 parent
0f9e021
commit 036b1b5
Showing
8 changed files
with
103 additions
and
50 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 1,15 @@ | ||
FROM archlinux:latest | ||
|
||
ENV RUSTC_WRAPPER=/root/.cargo/bin/sccache | ||
ENV CARGO_INCREMENTAL=0 | ||
ENV CARGO_TARGET_DIR=/paxy/podman-target | ||
|
||
# Install Rust | ||
RUN pacman -Sy --noconfirm rustup cargo | ||
# Toolchain setup | ||
RUN rustup self upgrade-data | ||
RUN /usr/bin/rustup self upgrade-data | ||
RUN rustup default nightly-2024-03-17 | ||
# Project dependencies | ||
RUN pacman -S --noconfirm gdk-pixbuf2 pango gtk4 pkg-config | ||
# Extras | ||
RUN pacman -S --noconfirm sccache |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 1,55 @@ | ||
use std::fs::{write, File}; | ||
|
||
use bson::{doc, Document}; | ||
use git2::Repository; | ||
use log::{info, warn}; | ||
|
||
use crate::{actions::ensure_path, home}; | ||
|
||
#[allow(unused)] | ||
fn add_repo(repo: &str, name: &str) { | ||
let mut file = home!(); | ||
file.push(".paxy"); | ||
ensure_path(None); | ||
file.push("repos.bson"); | ||
let mut doc = if !file.is_file() { | ||
warn!("file not found. Creating"); | ||
let doc = doc! {"paxy-official": "https://github.com/Pax-Hub/paxy-pkg-repository.git"}; | ||
let mut buf = vec![]; | ||
doc.to_writer(&mut buf) | ||
.unwrap(); | ||
write(file.clone(), buf).unwrap(); | ||
doc | ||
} else { | ||
info!("Reading from pre-exisiting file"); | ||
Document::from_reader(File::open(file.clone()).unwrap()).unwrap() | ||
}; | ||
doc.insert(name, repo); | ||
let mut buf = vec![]; | ||
doc.to_writer(&mut buf) | ||
.unwrap(); | ||
write(file.clone(), buf).unwrap(); | ||
file.pop(); | ||
file.push("repos"); | ||
file.push(name); | ||
ensure_path(Some(&file)); | ||
Repository::clone(repo, file).unwrap(); | ||
} | ||
|
||
#[cfg(test)] | ||
mod tests { | ||
use super::*; | ||
|
||
#[test] | ||
fn add_repo_norm_test() { | ||
add_repo("https://github.com/Pax-Hub/paxy-pkg-repository.git", "paxy"); | ||
let mut file = home!(); | ||
file.push(".paxy"); | ||
file.push("repos.bson"); | ||
let doc = Document::from_reader(File::open(file.clone()).unwrap()).unwrap(); | ||
assert_eq!( | ||
doc, | ||
doc! {"paxy-official": "https://github.com/Pax-Hub/paxy-pkg-repository.git", "paxy": "https://github.com/Pax-Hub/paxy-pkg-repository.git"} | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 1 @@ | ||
|
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -36,4 36,3 @@ use snafu::Snafu; | |
|
||
// endregion: RE-EXPORTS | ||
mod config; | ||
mod manifest; |