Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

use makepkg --clean capabilities

  • Loading branch information...
commit 6b039ae8fdc2b0486328d772cf26bec3a75004c2 1 parent 31b8b40
Remy Marquis authored
Showing with 30 additions and 36 deletions.
  1. +5 −5 README.pod
  2. +25 −31 pacaur
10 README.pod
View
@@ -75,11 +75,6 @@ the AUR.
Pacaur will also pass any pacman related options to the pacman binary. This
behavior can be disabled with the I<fallback> variable in the config file.
-=item B<-c, --clean>
-
-Remove I<target> build directory. Pass this option twice to clean the entire
-build directory.
-
=item B<-v, --version>
Display version and exit.
@@ -100,6 +95,11 @@ Display the help message and quit.
Edit I<target> PKGBUILD when downloading or building target. Can also be used
as a standalone command.
+=item B<-c, --clean>
+
+Remove I<target> build files when building target. Can also be used as a
+standalone command. Pass this option twice to clean the entire build directory.
+
=item B<-f, --force>
Overwrite existing files when downloading.
56 pacaur
View
@@ -7,7 +7,6 @@
name="pacaur"
version="3.0.0"
-
#
# Config
#
@@ -258,6 +257,17 @@ MakePkgs() {
info "Package ${colorW}$i${reset} already available in cache"
fi
else
+ # clean
+ makeopts=(${makeopts[@]/--clean/})
+ if [[ $clean = true ]]; then
+ if [[ $cleandevel = true || $count -gt 1 ]]; then
+ makeopts+=("--clean")
+ else
+ unset _darcstrunk _cvsroot _gitroot _svntrunk _bzrtrunk _hgroot
+ . "$buildDir/$i/PKGBUILD"
+ [[ ${_darcstrunk} || ${_cvsroot} || ${_gitroot} || ${_svntrunk} || ${_bzrtrunk} || ${_hgroot} ]] && success "${colorW}$i${reset} cleaning skipped" || makeopts+=("--clean")
+ fi
+ fi
# build
if [[ -e "$buildDir/$i/PKGBUILD" ]]; then
info "Building ${colorW}$i${reset} package..."
@@ -296,32 +306,17 @@ MakePkgs() {
}
CleanUp() {
- if [[ $clean = true ]]; then
- if [[ $count -eq 1 ]]; then
- cd "$buildDir"
- for i in "$@"; do
- # hack for vcs protected files
- chmod -R 755 $i &>/dev/null
- rm -r $i &>/dev/null && success "${colorW}$i${reset} cleaned" || warn "Could not clean ${colorW}$i${reset}"
- done
- else
- # skip if devel package
- if [[ $cleandevel = false && $count -ne 2 ]]; then
- for i in "$@"; do
- cd "$buildDir"
- unset _darcstrunk _cvsroot _gitroot _svntrunk _bzrtrunk _hgroot
- . "$i/PKGBUILD"
- [[ ${_darcstrunk} || ${_cvsroot} || ${_gitroot} || ${_svntrunk} || ${_bzrtrunk} || ${_hgroot} ]] && success "${colorW}$i${reset} cleaning skipped" && continue
- # hack for vcs protected files
- chmod -R 755 $i &>/dev/null
- rm -r $i &>/dev/null && success "${colorW}$i${reset} cleaned" || warn "Could not clean ${colorW}$i${reset}"
- done
- else
- # hack for vcs protected files
- chmod -R 755 $buildDir/* &>/dev/null
- rm -r $buildDir/* &>/dev/null && success "Build directory cleaned" || warn "Build directory already cleaned"
- fi
- fi
+ if [[ $count -eq 1 ]]; then
+ cd "$buildDir"
+ for i in "$@"; do
+ # hack for vcs protected files
+ chmod -R 755 $i &>/dev/null
+ rm -r $i &>/dev/null && success "${colorW}$i${reset} cleaned" || warn "Could not clean ${colorW}$i${reset}"
+ done
+ else
+ # hack for vcs protected files
+ chmod -R 755 $buildDir/* &>/dev/null
+ rm -r $buildDir/* &>/dev/null && success "Build directory cleaned" || warn "Build directory already cleaned"
fi
}
@@ -521,7 +516,6 @@ Core() {
OutofdateChecks ${deps[@]}
Prompt ${deps[@]}
MakePkgs ${deps[@]}
- CleanUp ${deps[@]}
}
ClassifyPkgs() {
@@ -603,12 +597,12 @@ usage() {
echo " -k, --check check for AUR update(s)"
echo " -u, --update update AUR package(s)"
echo " general"
- echo " -c, --clean clean target(s) build files -- pass twice to clean the entire build directory"
echo " -v, --version display version information"
echo " -h, --help display help information"
echo ""
echo "options:"
echo " -e, --edit edit target PKGBUILD -- can be combined with the -d, -m, -y, -u flags"
+ echo " -c, --clean clean target(s) build files -- can be combined with the -m, -y, -u flags"
echo " -f, --force overwrite existing files -- can be combined with the -d flag"
echo " -q, --quiet show less information for query and search"
echo " --devel consider AUR development packages upgrade"
@@ -706,7 +700,7 @@ while [[ $index -ne 1 ]]; do
e) [[ $pacQ ]] && pacopts+=("--explicit") && continue || edit=true;
[[ ! $operation ]] && operation=editpkg;;
c) [[ $pacS ]] && operation=cleancache && ((count++));
- [[ $pac || $pacQ || $pacS ]] && continue || operation=cleanpkg && clean=true && ((count++));;
+ [[ $pac || $pacQ || $pacS ]] && continue || [[ ! $operation ]] && operation=cleanpkg; clean=true && ((count++));;
q) [[ $pacQ || $pacS ]] && pacopts+=("--quiet") || quiet=true;;
# pacman
r) repo='1';;
@@ -736,7 +730,7 @@ pacmanarg=(${pacmanarg[@]/-r/})
[[ ! $editor ]] && [[ ! -f /usr/bin/vi ]] && error "The ${colorW}editor${reset} variable is not set.\nCheck configuration in $configDir/${name}.conf"
[[ ! -f /usr/bin/$pacmanBin ]] && error "The binary ${colorW}$pacmanBin${reset} is not installed.\nCheck configuration in $configDir/${name}.conf"
[[ ! -w "$buildDir" ]] && error "You do not have write permission to build packages in ${colorW}$buildDir${reset}."
-[[ -z "${pkgs[@]}" ]] && [[ $operation = download || $operation = makepkg || $operation = sync || $operation = editpkg ]] && [[ ! $refresh && ! $upgrade ]] && error "no targets specified (use -h for help)"
+[[ -z "${pkgs[@]}" ]] && [[ $operation = download || $operation = makepkg || $operation = sync || $operation = editpkg || ($operation = cleanpkg && $count -eq 1) ]] && [[ ! $refresh && ! $upgrade ]] && error "no targets specified (use -h for help)"
[[ $repo && $aur ]] && error "target not found"
# operations
Please sign in to comment.
Something went wrong with that request. Please try again.