Skip to content

Commit

Permalink
Rename custom to pkgbuild
Browse files Browse the repository at this point in the history
  • Loading branch information
Morganamilo committed Oct 14, 2023
1 parent 70d7cdb commit 7b197dd
Show file tree
Hide file tree
Showing 14 changed files with 111 additions and 122 deletions.
1 change: 0 additions & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,6 @@ default = ["git", "generate"]
#alpm = { path = "../alpm.rs/alpm" }
alpm = { git = "https://github.com/archlinux/alpm.rs", rev = "101b05" }
alpm-utils = { git = "https://github.com/archlinux/alpm.rs", rev = "101b05" }
#aur-depends = { path = "../aur-depends" }
aur-depends = { git = "https://github.com/Morganamilo/aur-depends", rev = "c36167" }
aur-depends = { path = "../aur-depends" }
#aur-depends = { git = "https://github.com/Morganamilo/aur-depends", rev = "c36167" }
#aur-fetch = { path = "../aur-fetch" }
4 changes: 4 additions & 0 deletions src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -775,6 +775,10 @@ impl Config {
self.mode = Mode::all();
}

if !self.mode.pkgbuild() {
self.pkgbuild_repos.repos.clear();
}

self.need_root = self.need_root();

if let LocalRepos::Repo(repos) = &self.repos {
Expand Down
2 changes: 1 addition & 1 deletion src/devel.rs
Original file line number Diff line number Diff line change
Expand Up @@ -498,7 +498,7 @@ pub async fn fetch_devel_info(
for base in bases {
let srcinfo = match base {
Base::Aur(_) => srcinfos.get(base.package_base()),
Base::Custom(c) => Some(c.srcinfo.as_ref()),
Base::Pkgbuild(c) => Some(c.srcinfo.as_ref()),
};

let srcinfo = match srcinfo {
Expand Down
16 changes: 8 additions & 8 deletions src/fmt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ fn to_install(config: &Config, actions: &Actions, devel: &HashSet<String>) -> To
for base in &mut build {
match base {
Base::Aur(base) => base.pkgs.retain(|p| !p.make),
Base::Custom(base) => base.pkgs.retain(|p| !p.make),
Base::Pkgbuild(base) => base.pkgs.retain(|p| !p.make),
}
}
build.retain(|b| b.package_count() != 0);
Expand All @@ -209,7 +209,7 @@ fn to_install(config: &Config, actions: &Actions, devel: &HashSet<String>) -> To
for base in &mut make_build {
match base {
Base::Aur(base) => base.pkgs.retain(|p| p.make),
Base::Custom(base) => base.pkgs.retain(|p| p.make),
Base::Pkgbuild(base) => base.pkgs.retain(|p| p.make),
}
}
make_build.retain(|b| b.package_count() != 0);
Expand Down Expand Up @@ -248,7 +248,7 @@ pub fn print_install(config: &Config, actions: &Actions, devel: &HashSet<String>
}

if !to.aur.is_empty() {
let aur = if actions.iter_custom_pkgs().next().is_some() {
let aur = if actions.iter_pkgbuilds().next().is_some() {
"Pkgbuilds"
} else {
"Aur"
Expand All @@ -260,7 +260,7 @@ pub fn print_install(config: &Config, actions: &Actions, devel: &HashSet<String>
}

if !to.make_aur.is_empty() {
let aur = if actions.iter_custom_pkgs().next().is_some() {
let aur = if actions.iter_pkgbuilds().next().is_some() {
tr!("Pkgbuilds Make")
} else {
tr!("Aur Make")
Expand Down Expand Up @@ -311,7 +311,7 @@ pub fn print_install_verbose(config: &Config, actions: &Actions, devel: &HashSet
let package = tr!("Repo ({})", actions.install.len());
let aur = match (
actions.iter_aur_pkgs().count(),
actions.iter_custom_pkgs().count(),
actions.iter_pkgbuilds().count(),
) {
(a, 0) => tr!("Aur ({})", a),
(a, c) => tr!("Pkgbuilds ({})", a + c),
Expand Down Expand Up @@ -359,7 +359,7 @@ pub fn print_install_verbose(config: &Config, actions: &Actions, devel: &HashSet
.iter()
.map(|pkg| repo(config, &pkg.pkg.name).len() + 1 + pkg.pkg.name.len())
.max(),
Base::Custom(base) => base
Base::Pkgbuild(base) => base
.pkgs
.iter()
.map(|pkg| base.repo.len() + 1 + pkg.pkg.pkgname.len())
Expand All @@ -379,7 +379,7 @@ pub fn print_install_verbose(config: &Config, actions: &Actions, devel: &HashSet
.filter_map(|pkg| old_ver(config, &pkg.pkg.name))
.map(|v| v.as_str())
.max(),
Base::Custom(base) => base
Base::Pkgbuild(base) => base
.pkgs
.iter()
.filter_map(|pkg| old_ver(config, &pkg.pkg.pkgname))
Expand Down Expand Up @@ -491,7 +491,7 @@ pub fn print_install_verbose(config: &Config, actions: &Actions, devel: &HashSet
);
}
}
Base::Custom(base) => {
Base::Pkgbuild(base) => {
for pkg in &base.pkgs {
let ver = base.srcinfo.version();
let ver = if devel.contains(&pkg.pkg.pkgname) {
Expand Down
2 changes: 1 addition & 1 deletion src/info.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ use anyhow::Error;

use globset::GlobSet;
use raur::ArcPackage as Package;
use srcinfo::{ArchVec};
use srcinfo::ArchVec;
use term_size::dimensions_stdout;
use tr::tr;
use unicode_width::UnicodeWidthStr;
Expand Down
36 changes: 19 additions & 17 deletions src/install.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ use crate::devel::{fetch_devel_info, load_devel_info, save_devel_info, DevelInfo
use crate::download::{self, Bases};
use crate::fmt::{print_indent, print_install, print_install_verbose};
use crate::keys::check_pgp_keys;
use crate::pkgbuild::{PkgbuildRepo};
use crate::pkgbuild::PkgbuildRepo;
use crate::resolver::{flags, resolver};
use crate::upgrade::{get_upgrades, Upgrades};
use crate::util::{ask, repo_aur_pkgs, split_repo_aur_targets};
Expand Down Expand Up @@ -87,7 +87,7 @@ pub async fn build_pkgbuilds(config: &mut Config, dirs: Vec<PathBuf>) -> Result<
let repo = PkgbuildRepo::from_pkgbuilds(config, &dirs)?;

let targets = repo
.pkgs(None.unwrap())
.pkgs(config)
.iter()
.flat_map(|s| s.srcinfo.names())
.map(|name| format!("./{}", name))
Expand Down Expand Up @@ -231,7 +231,7 @@ impl Installer {
}
}
}
Base::Custom(base) => {
Base::Pkgbuild(base) => {
for pkg in &base.pkgs {
if pkg.target && self.install_targets {
targets.push(pkg.pkg.pkgname.as_str())
Expand Down Expand Up @@ -461,7 +461,7 @@ impl Installer {
}
base.pkgs.extend(debug);
}
Base::Custom(base) => {
Base::Pkgbuild(base) => {
let mut debug = Vec::new();
for pkg in &base.pkgs {
if pkg.make {
Expand All @@ -487,7 +487,7 @@ impl Installer {
if !Path::new(path).exists() {
match base {
Base::Aur(base) => base.pkgs.retain(|p| p.pkg.name != *pkg),
Base::Custom(base) => base.pkgs.retain(|p| p.pkg.pkgname != *pkg),
Base::Pkgbuild(base) => base.pkgs.retain(|p| p.pkg.pkgname != *pkg),
}
} else {
printtr!("adding {} to the install list", pkg);
Expand Down Expand Up @@ -599,7 +599,7 @@ impl Installer {
.filter(|a| !a.make)
.map(|a| a.pkg.name.as_str())
.collect(),
Base::Custom(c) => c
Base::Pkgbuild(c) => c
.pkgs
.iter()
.filter(|c| !c.make)
Expand Down Expand Up @@ -672,7 +672,7 @@ impl Installer {
) -> Result<()> {
let dir = match base {
Base::Aur(_) => config.build_dir.join(base.package_base()),
Base::Custom(c) => config
Base::Pkgbuild(c) => config
.pkgbuild_repos
.repo(&c.repo)
.unwrap()
Expand Down Expand Up @@ -721,7 +721,7 @@ impl Installer {
})
}
}
Base::Custom(c) => {
Base::Pkgbuild(c) => {
for pkg in &c.pkgs {
missing.retain(|mis| {
let provides = ArchVec::supported(&pkg.pkg.provides, arch).map(Depend::new);
Expand Down Expand Up @@ -772,7 +772,7 @@ impl Installer {
)?
}
}
Base::Custom(b) => {
Base::Pkgbuild(b) => {
for pkg in &b.pkgs {
if pkg.target && !self.install_targets {
continue;
Expand Down Expand Up @@ -927,7 +927,9 @@ impl Installer {
let flags = flags(config);
let c = config.color;

let mut resolver = resolver(config, &config.alpm, &config.raur, &mut cache, flags);
let repos = config.pkgbuild_repos.clone();
let repos = repos.aur_depends_repo(config);
let mut resolver = resolver(config, &config.alpm, &config.raur, &mut cache, repos, flags);

if config.args.has_arg("u", "sysupgrade") {
// TODO?
Expand All @@ -949,7 +951,7 @@ impl Installer {
repo: Some(config.aur_namespace()),
pkg: p,
}));
targets.extend(self.upgrades.custom_keep.iter().map(|p| Targ {
targets.extend(self.upgrades.pkgbuild_keep.iter().map(|p| Targ {
repo: Some(&p.0),
pkg: &p.1,
}));
Expand Down Expand Up @@ -1097,12 +1099,12 @@ impl Installer {
let dir = config.fetch.clone_dir.join(base.package_base());
pre_build_command(config, &dir, base.package_base(), &base.version())?;
}
Base::Custom(c) => {
Base::Pkgbuild(c) => {
let dir = &config
.pkgbuild_repos
.repo(&c.repo)
.unwrap()
.base(config, &c.package_base().to_string())
.base(config, c.package_base())
.unwrap()
.path;
pre_build_command(config, dir, c.package_base(), &c.version())?;
Expand All @@ -1117,7 +1119,7 @@ impl Installer {
.filter(|b| b.build())
.filter_map(|b| match b {
Base::Aur(pkg) => Some(pkg.package_base()),
Base::Custom(_) => None,
Base::Pkgbuild(_) => None,
})
.collect::<Vec<_>>();
review(config, &config.fetch, &pkgs)?;
Expand Down Expand Up @@ -1199,7 +1201,7 @@ impl Installer {
);
self.remove_make.extend(
actions
.iter_custom_pkgs()
.iter_pkgbuilds()
.filter(|p| p.1.make)
.map(|p| p.1.pkg.pkgname.clone()),
);
Expand Down Expand Up @@ -1838,7 +1840,7 @@ fn deps_not_satisfied<'a>(config: &'a Config, base: &'a Base) -> Result<Vec<&'a
}
}
}
Base::Custom(base) => {
Base::Pkgbuild(base) => {
check_deps_local(
&alpm,
&mut missing,
Expand Down Expand Up @@ -1916,7 +1918,7 @@ fn deps_not_satisfied_by_repo<'a>(config: &'a Config, base: &'a Base) -> Result<
}
}
}
Base::Custom(base) => {
Base::Pkgbuild(base) => {
check_deps_sync(
&alpm,
&mut missing,
Expand Down
2 changes: 1 addition & 1 deletion src/keys.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ pub fn check_pgp_keys(
let pkg = base.package_base();
srcinfos.get(pkg).unwrap()
}
Base::Custom(base) => base.srcinfo.as_ref(),
Base::Pkgbuild(base) => base.srcinfo.as_ref(),
};
for key in &srcinfo.base.valid_pgp_keys {
if !seen.insert(key) {
Expand Down
20 changes: 6 additions & 14 deletions src/order.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use crate::config::Config;
use crate::resolver::flags;
use anyhow::Result;
use aur_depends::{Actions, Conflict, Package, Repo, Resolver};
use aur_depends::{Actions, Conflict, Package, Resolver};
use log::debug;
use std::collections::HashSet;

Expand All @@ -11,19 +11,11 @@ pub async fn order(config: &mut Config) -> Result<i32> {

let quiet = config.quiet;

//TODO avoid dup
let repos = config
.pkgbuild_repos
.repos
.iter()
.map(|r| Repo {
name: r.name.clone(),
pkgs: r.pkgs(config).iter().map(|p| p.srcinfo.clone()).collect(),
})
.collect::<Vec<_>>();

let repos = config.pkgbuild_repos.clone();
let repos = repos.aur_depends_repo(config);
config.alpm.take_raw_question_cb();
let resolver = Resolver::new(&config.alpm, &mut cache, &config.raur, flags).repos(&repos);
let resolver =
Resolver::new(&config.alpm, &mut cache, &config.raur, flags).pkgbuild_repos(repos);
let mut actions = resolver.resolve_targets(&config.targets).await?;
debug!("{:#?}", actions);

Expand Down Expand Up @@ -69,7 +61,7 @@ fn print_build(config: &Config, actions: &mut Actions, quiet: bool) {
}
}
}
aur_depends::Base::Custom(c) => {
aur_depends::Base::Pkgbuild(c) => {
for pkg in &c.pkgs {
if quiet {
println!("{}", pkg.pkg.pkgname);
Expand Down
Loading

0 comments on commit 7b197dd

Please sign in to comment.