Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Option to keep old package versions with local repo #668

Merged
merged 8 commits into from
Feb 20, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion completions/bash
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ _paru() {
nouseask savechanges nosavechanges combinedupgrade nocombinedupgrade
batchinstall nobatchinstall provides noprovides devel nodevel develsuffixes
sudoloop nosudoloop bottomup topdown newsonupgrade bat batflags chroot nochroot
sign nosign signdb nosigndb
sign nosign keeprepocache nokeeprepocache signdb nosigndb
localrepo review skipreview' 'b d h q r v a')

show=('news stats' 'w s')
Expand Down
2 changes: 2 additions & 0 deletions completions/fish
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,8 @@ complete -c $progname -n "not $noopt" -l chroot -d 'Build packages in a chroot'
complete -c $progname -n "not $noopt" -l nochroot -d "Don't build packages in a chroot" -f
complete -c $progname -n "not $noopt" -l sign -d 'Sign packages with gpg' -f
complete -c $progname -n "not $noopt" -l nosign -d "Don't sign packages with gpg" -f
complete -c $progname -n "not $noopt" -l keeprepocache -d 'Keep old versions of packages with local repo' -f
complete -c $progname -n "not $noopt" -l nokeeprepocache -d "Don't keep old versions of packages with local repo" -f
complete -c $progname -n "not $noopt" -l signdb -d 'Sign databases with gpg' -f
complete -c $progname -n "not $noopt" -l nosigndb -d "Don't sign databases with gpg" -f
complete -c $progname -n "not $noopt" -l localrepo -d 'Build packages in a local repo' -f
Expand Down
2 changes: 2 additions & 0 deletions completions/zsh
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,8 @@ _pacman_opts_common=(
"--nochroot[Don't build packages in a chroot]"
'--sign[Sign packages with gpg]'
"--nosign[Don't sign packages with gpg]"
'--keeprepocache[Keep old versions of packages with local repo]'
"--nokeeprepocache[Don't keep old versions of packages with local repo]"
'--signdb[Sign databases with gpg]'
"--nosigndb[Don't sign databases with gpg]"
'--localrepo[Build packages in a local repo]'
Expand Down
9 changes: 9 additions & 0 deletions man/paru.8
Original file line number Diff line number Diff line change
Expand Up @@ -591,6 +591,15 @@ Sign packages with gpg. Optionally indicate which key to sign with.
.B \-\-nosign
Don't sign package with gpg.

.TP
.B \-\-keeprepocache
Normally upon AUR packages getting updated the old versions will be removed from the local repo.
This option disables that behavior, keeping the both all versions and only updating the DB.

.TP
.B \-\-nokeeprepocache
Don't keep old packages.

.TP
.B \-\-signdb [= key]
Sign databases with gpg. Optionally indicate which key to sign with.
Expand Down
5 changes: 5 additions & 0 deletions man/paru.conf.5
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,11 @@ Sign packages with gpg. Optionally indicate which key to sign with.
.B SignDb [= key]
Sign databases with gpg. Optionally indicate which key to sign with.

.TP
.B KeepRepoCache
Normally upon AUR packages getting updated the old versions will be removed from the local repo.
This option disables that behavior, keeping the both all versions and only updating the DB.

.TP
.B SkipReview
Skip the review process.
Expand Down
1 change: 1 addition & 0 deletions paru.conf
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ DevelSuffixes = -git -cvs -svn -bzr -darcs -always -hg
#Chroot
#Sign
#SignDb
#KeepRepoCache

#
# Binary OPTIONS
Expand Down
2 changes: 2 additions & 0 deletions src/command_line.rs
Original file line number Diff line number Diff line change
Expand Up @@ -317,6 +317,8 @@ impl Config {
Err(_) => Sign::Yes,
}
}
Arg::Long("nokeeprepocache") => self.keep_repo_cache = false,
Arg::Long("keeprepocache") => self.keep_repo_cache = true,
Arg::Long("signdb") => {
self.sign_db = match value {
Ok(k) => Sign::Key(k.to_string()),
Expand Down
2 changes: 2 additions & 0 deletions src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -391,6 +391,7 @@ pub struct Config {
pub news_on_upgrade: bool,
pub comments: bool,
pub sign: Sign,
pub keep_repo_cache: bool,
pub sign_db: Sign,

pub pre_build_command: Option<String>,
Expand Down Expand Up @@ -870,6 +871,7 @@ impl Config {
None => Sign::Yes,
}
}
"KeepRepoCache" => self.keep_repo_cache = true,
"SignDb" => {
self.sign_db = match value {
Some(v) => Sign::Key(v.to_string()),
Expand Down
7 changes: 6 additions & 1 deletion src/repo.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,12 @@ pub fn add<P: AsRef<Path>, S: AsRef<OsStr>>(
.collect::<Vec<_>>();

let mut cmd = Command::new("repo-add");
cmd.arg("-R").arg(file).args(pkgs);

if !config.keep_repo_cache {
cmd.arg("-R");
}

cmd.arg(file).args(pkgs);

if config.sign_db != Sign::No {
cmd.arg("-s");
Expand Down