Skip to content

Commit

Permalink
sync: make --clean optional
Browse files Browse the repository at this point in the history
This allows e.g. to use `aur build -f --margs '--repackage'` after running
`aur-sync` on a larger package where only dependency information has changed.

To account for increased space usage, add `git clean -d` to the `aur-gc`
example to also removed untracked directories in AUR source repositories.
  • Loading branch information
AladW committed Feb 18, 2024
1 parent 329dd8d commit b9b003d
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 11 deletions.
22 changes: 13 additions & 9 deletions lib/aur-sync
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ PS4='+(${BASH_SOURCE}:${LINENO}): ${FUNCNAME[0]:+${FUNCNAME[0]}(): }'
unset -v CDPATH

# default arguments
build_args=(--clean --syncdeps) build_repo_args=()
build_args=(--syncdeps) build_repo_args=()
depends_args=() view_args=() filter_args=() fetch_args=() graph_args=()

# default options
Expand Down Expand Up @@ -109,15 +109,15 @@ if (( UID == 0 )) && [[ ! -v AUR_ASROOT ]]; then
fi

# option parsing
opt_short='d:D:k:U:AcfLnorRSTuv'
opt_short='d:D:k:U:ACcfLnorRSTuv'
opt_long=('bind:' 'bind-rw:' 'database:' 'directory:' 'ignore:' 'root:'
'makepkg-conf:' 'pacman-conf:' 'chroot' 'continue' 'force'
'ignore-arch' 'log' 'no-confirm' 'no-ver' 'no-graph' 'no-sync' 'no-ver-argv'
'no-view' 'no-provides' 'no-build' 'rmdeps' 'sign' 'temp' 'upgrades'
'pkgver' 'rebuild' 'rebuild-tree' 'rebuild-all' 'ignore-file:'
'remove' 'provides-from:' 'new' 'prevent-downgrade' 'verify'
'makepkg-args:' 'format:' 'no-check' 'keep-going:' 'user:'
'rebase' 'reset' 'ff' 'exclude:' 'columns' 'prefix' 'save:')
'makepkg-conf:' 'pacman-conf:' 'chroot' 'continue' 'force' 'ignore-arch'
'log' 'no-confirm' 'no-ver' 'no-graph' 'no-sync' 'no-ver-argv' 'no-view'
'no-provides' 'no-build' 'rmdeps' 'sign' 'temp' 'upgrades' 'pkgver'
'rebuild' 'rebuild-tree' 'rebuild-all' 'ignore-file:' 'remove'
'provides-from:' 'new' 'prevent-downgrade' 'verify' 'makepkg-args:'
'format:' 'no-check' 'keep-going:' 'user:' 'rebase' 'reset' 'ff' 'exclude:'
'columns' 'prefix' 'save:' 'clean' 'cleanbuild')
opt_hidden=('dump-options' 'allan' 'ignorearch' 'ignorefile:' 'noconfirm'
'nover' 'nograph' 'nosync' 'nover-argv' 'noview' 'noprovides' 'nobuild'
'rebuildall' 'rebuildtree' 'rm-deps' 'gpg-sign' 'margs:' 'nocheck'
Expand Down Expand Up @@ -207,6 +207,10 @@ while true; do
build_args+=(--chroot) ;;
-f|--force)
build_args+=(--force) ;;
-C|--clean)
build_args+=(--clean) ;;
--cleanbuild)
build_args+=(--cleanbuild) ;;
--makepkg-args|--margs)
shift; build_args+=(--margs "$1") ;;
--makepkg-conf)
Expand Down
2 changes: 2 additions & 0 deletions makepkg/aurutils.changelog
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
* `aur-sync`
+ document `aur-view` options
+ detect local repositories with `--chroot` configuration (#1135)
+ add `--clean` / `-C`, `--cleanbuild`
- default build command changed to `aur build --syncdeps`

* `perl`
+ add `Depends.pm`
Expand Down
12 changes: 11 additions & 1 deletion man1/aur-sync.1
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ for all repositories.
.
.SS Build options
The default build command is
.BR "aur-build \-\-clean \-\-syncdeps" .
.BR "aur-build \-\-syncdeps" .
Specifying
.BR aur\-build (1)
options such as
Expand Down Expand Up @@ -257,6 +257,16 @@ Do not wait for user input when installing or removing build dependencies.
Print target packages and their paths instead of building them.
.
.TP
.BR \-C ", " \-\-clean
Clean up leftover work files and directoreis after a successful build.
.RB ( "aur build \-C" )
.
.TP
.BR \-\-cleanbuild
Remove the source directory before building the package.
.RB ( "aur build \-\-cleanbuild" )
.
.TP
.BR \-\-pkgver
Run
.B "makepkg \-od \-\-noprepare"
Expand Down
2 changes: 1 addition & 1 deletion man1/aur.1
Original file line number Diff line number Diff line change
Expand Up @@ -389,7 +389,7 @@ in $PATH, for example
AURDEST=${AURDEST:\-$XDG_CACHE_HOME/aurutils/sync}
# Assumes build files were retrieved through git(1)
find "$AURDEST" \-name .git \-execdir git clean \-xf \e;
find "$AURDEST" \-name .git \-execdir git clean \-xdf \e;
# Print directories which do not contain a PKGBUILD file
for d in "$AURDEST"/*; do
Expand Down

0 comments on commit b9b003d

Please sign in to comment.