diff --git a/completions/bash b/completions/bash index e38dea85..63462937 100644 --- a/completions/bash +++ b/completions/bash @@ -73,7 +73,7 @@ _paru() { asp gpg gpgflags fm fmflags pager completioninterval sortby searchby limit upgrademenu removemake noremovemake cleanafter nocleanafter rebuild rebuildall norebuild rebuildtree redownload noredownload redownloadall pgpfetch nopgpfetch useask - nouseask savechanges nosavechanges failfast nofailfast combinedupgrade + nouseask savechanges nosavechanges failfast nofailfast keepsrc nokeepsrc combinedupgrade nocombinedupgrade batchinstall nobatchinstall provides noprovides devel nodevel develsuffixes sudoloop nosudoloop bottomup topdown newsonupgrade bat batflags chroot nochroot sign nosign keeprepocache nokeeprepocache signdb nosigndb diff --git a/completions/fish b/completions/fish index 123aecd0..853c295a 100644 --- a/completions/fish +++ b/completions/fish @@ -224,6 +224,8 @@ complete -c $progname -n "not $noopt" -l savechanges -d 'Commit changes to pkgbu complete -c $progname -n "not $noopt" -l nosavechanges -d "Don't commit changes to pkgbuilds made during review" -f complete -c $progname -n "not $noopt" -l failfast -d 'Exit as soon as any AUR packages fail to build' -f complete -c $progname -n "not $noopt" -l nofailfast -d "Don't Exit as soon as any AUR packages fail to build" -f +complete -c $progname -n "not $noopt" -l keepsrc -d "Keep src/ and pkg/ directories after building packages" -f +complete -c $progname -n "not $noopt" -l nokeepsrc -d "Don't keep src/ and pkg/ directories after building packages" -f complete -c $progname -n "not $noopt" -l combinedupgrade -d 'Refresh then perform the repo and AUR upgrade together' -f complete -c $progname -n "not $noopt" -l nocombinedupgrade -d 'Perform the repo upgrade and AUR upgrade separately' -f complete -c $progname -n "not $noopt" -l batchinstall -d 'Build multiple AUR packages then install them together' -f diff --git a/completions/zsh b/completions/zsh index 4c856aa9..d9fdbc5f 100644 --- a/completions/zsh +++ b/completions/zsh @@ -87,6 +87,8 @@ _pacman_opts_common=( "--nosavechanges[Don't commit changes to pkgbuilds made during review]" "--failfast[Exit as soon as any AUR packages fail to build]" "--nofailfast[Don't exit as soon as any AUR packages fail to build]" + "--keepsrc[Keep src/ and pkg/ directories after building packages]" + "--nokeepsrc[Don't keep src/ and pkg/ directories after building packages]" '--combinedupgrade[Refresh then perform the repo and AUR upgrade together]' '--nocombinedupgrade[Perform the repo upgrade and AUR upgrade separately]' '--mflags[Pass arguments to makepkg]:mflags' diff --git a/man/paru.8 b/man/paru.8 index 475aa593..9a091aac 100644 --- a/man/paru.8 +++ b/man/paru.8 @@ -527,6 +527,14 @@ By default Paru will continue and try to build other AUR packages. .B \-\-nofailfast Don't exit as soon as any AUR packages fail to build. +.TP +.B \-\-keepsrc +Keep src/ and pkg/ directories after building packages. + +.TP +.B \-\-nokeepsrc +Don't keep src/ and pkg/ directories after building packages. + .TP .B \-\-combinedupgrade During sysupgrade, paru will first perform a refresh, then show diff --git a/man/paru.conf.5 b/man/paru.conf.5 index 23655703..8b4eb0e7 100644 --- a/man/paru.conf.5 +++ b/man/paru.conf.5 @@ -124,6 +124,10 @@ Exit as soon as any AUR packages fail to build. By default Paru will continue and try to build other AUR packages. +.TP +.B KeepSrc +Keep src/ and pkg/ directories after building packages. + .TP .B Redownload [= all] Always download PKGBUILDs of targets even when a copy is available in cache. If diff --git a/src/config.rs b/src/config.rs index 93e16d21..578201e2 100644 --- a/src/config.rs +++ b/src/config.rs @@ -393,6 +393,7 @@ pub struct Config { pub ssh: bool, pub keep_repo_cache: bool, pub fail_fast: bool, + pub keep_src: bool, pub sign: Sign, pub sign_db: Sign, @@ -890,6 +891,7 @@ impl Config { } "KeepRepoCache" => self.keep_repo_cache = true, "FailFast" => self.fail_fast = true, + "KeepSrc" => self.keep_src = true, "SignDb" => { self.sign_db = match value { Some(v) => Sign::Key(v.to_string()), diff --git a/src/install.rs b/src/install.rs index 3089cf78..f9d1a19f 100644 --- a/src/install.rs +++ b/src/install.rs @@ -220,16 +220,24 @@ pub async fn build_pkgbuild(config: &mut Config) -> Result { if config.chroot { chroot - .build(&dir, &["-cu"], &["-ofA"]) + .build(&dir, &["-u"], &["-ofA"]) .context(tr!("failed to download sources"))?; } else { // download sources - exec::makepkg(config, &dir, &["--verifysource", "-ACcf"])? + let mut args = vec!["--verifysource", "-Af"]; + if !config.keep_src { + args.push("-Cc"); + } + exec::makepkg(config, &dir, &args)? .success() .context(tr!("failed to download sources"))?; // pkgver bump - exec::makepkg(config, &dir, &["-ofCA"])? + let mut args = vec!["-ofA"]; + if !config.keep_src { + args.push("-C"); + } + exec::makepkg(config, &dir, &args)? .success() .context(tr!("failed to build"))?; } @@ -249,13 +257,13 @@ pub async fn build_pkgbuild(config: &mut Config) -> Result { ) .context(tr!("failed to build"))?; } else { - exec::makepkg( - config, - &dir, - &["-cfeA", "--noconfirm", "--noprepare", "--holdver"], - )? - .success() - .context(tr!("failed to build"))?; + let mut args = vec!["-feA", "--noconfirm", "--noprepare", "--holdver"]; + if !config.keep_src { + args.push("-c"); + } + exec::makepkg(config, &dir, &args)? + .success() + .context(tr!("failed to build"))?; } } else { println!( @@ -1453,16 +1461,24 @@ fn build_install_pkgbuild<'a>( if config.chroot { chroot - .build(&dir, &["-cu"], &["-ofA"]) + .build(&dir, &["-u"], &["-ofA"]) .with_context(|| tr!("failed to download sources for '{}'", base))?; } else { // download sources - exec::makepkg(config, &dir, &["--verifysource", "-ACcf"])? + let mut args = vec!["--verifysource", "-Af"]; + if !config.keep_src { + args.push("-Cc"); + } + exec::makepkg(config, &dir, &args)? .success() .with_context(|| tr!("failed to download sources for '{}'", base))?; // pkgver bump - exec::makepkg(config, &dir, &["-ofCA"])? + let mut args = vec!["-ofA"]; + if !config.keep_src { + args.push("-C"); + } + exec::makepkg(config, &dir, &args)? .success() .with_context(|| tr!("failed to build '{}'", base))?; } @@ -1505,13 +1521,13 @@ fn build_install_pkgbuild<'a>( ) .with_context(|| tr!("failed to build '{}'", base))?; } else { - exec::makepkg( - config, - &dir, - &["-cfeA", "--noconfirm", "--noprepare", "--holdver"], - )? - .success() - .with_context(|| tr!("failed to build '{}'", base))?; + let mut args = vec!["-feA", "--noconfirm", "--noprepare", "--holdver"]; + if !config.keep_src { + args.push("-c"); + } + exec::makepkg(config, &dir, &args)? + .success() + .with_context(|| tr!("failed to build '{}'", base))?; } } else { println!(