79 Commits

Author SHA1 Message Date
Mike McQuaid
9025719968 cleanup: fix reversed prune time. 2015-08-16 17:50:33 +01:00
Mike McQuaid
76316a82cb cleanup: tweak prune code. 2015-08-16 16:57:12 +01:00
Martin Afanasjew
e85e57b217 cleanup: make --force less aggressive
Change behavior for `brew cleanup` as follows:

- If `--force` is supplied, remove only outdated keg-only packages.
- If `--prune=<days>` is supplied, remove both logs and cached downloads
  older than the specified number of days. Use `--prune=all` to remove
  all logs and cached downloads irrespective of age.
- By default, remove logs after 14 days and cached downloads never.

Also centralizes handling of `--prune`, thus removing duplicate logic.

This is motivated by commit 17eee232838d4639b25f863aa342b1dda61b81bc
that made `--force` much more aggressive and made it override whatever
was specified via `--prune`, completely removing all:

- outdated keg-only packages
- cached downloads irrespective of age
- logs irrespective of age

This made it impossible to remove outdated keg-only packages without
also deleting all cached downloads, which is at least inconvenient for
people with limited bandwidth wanting to rebuild packages later.

Closes Homebrew/homebrew#42970.

Signed-off-by: Mike McQuaid <mike@mikemcquaid.com>
2015-08-16 16:47:24 +01:00
Xu Cheng
5414597913 cleanup: avoid duplicated logic
Closes Homebrew/homebrew#42900.

Signed-off-by: Xu Cheng <xucheng@me.com>
2015-08-14 15:52:57 +08:00
Xu Cheng
203cecb463 add Formula.racks
Also exclude symlink when enumerating installed racks.
2015-08-14 15:52:56 +08:00
Mike McQuaid
15c3fb32b2 cleanup: remove SCM directories recursively. 2015-08-13 10:34:45 +01:00
Mike McQuaid
04b350dce5 cleanup: do cleanup even without a Cellar. 2015-08-13 10:31:37 +01:00
Mike McQuaid
e49a043401 cleanup: remove more on --force or --prune.
Remove more logs, use the prune time period and remove version control
checkouts when --force or --prune is used.
2015-08-13 10:22:28 +01:00
BrewTestBot
13d544e11e Core files style updates.
Closes Homebrew/homebrew#42354.

Signed-off-by: Mike McQuaid <mike@mikemcquaid.com>
2015-08-03 13:22:35 +01:00
Xu Cheng
602ea66a0f bottle_resolve_version: return PkgVersion 2015-07-24 15:59:28 +08:00
Xu Cheng
74d99d647d cleanup: rescue TapFormulaAmbiguityError caused by Dependency#to_formula
Closes Homebrew/homebrew#40682.

Signed-off-by: Xu Cheng <xucheng@me.com>
2015-06-15 12:55:47 +08:00
Xu Cheng
036b9f6913 cleanup: use bottle_resolve_version
Closes Homebrew/homebrew#40378.

Signed-off-by: Xu Cheng <xucheng@me.com>
2015-06-07 23:51:15 +08:00
Xu Cheng
82745ff9b6 cleanup: use Formula#full_name 2015-05-29 17:02:22 +08:00
Xu Cheng
dcf0efc9d2 cleanup: load formula from rack and using ARGV.resolved_formulae 2015-05-27 13:53:41 +08:00
Jack Nagel
a5c9c586ff Move can_cleanup? off of the formula instance 2015-04-17 22:58:02 -04:00
Jack Nagel
338a08d8d6 Ask the formula if it can be cleaned up once 2015-04-17 22:58:02 -04:00
Jack Nagel
505d06c176 Simplify cleanup eligibility check 2015-04-17 22:58:02 -04:00
Mike McQuaid
451a07cc4e cleanup: add --prune to delete old cache files. 2015-04-16 17:52:10 -07:00
Jack Nagel
3587dc441e Remove duplication from cleanup methods 2015-04-07 21:14:48 -04:00
Dominyk Tiller
45c9e84c15 cleanup: display file-sizes
Closes Homebrew/homebrew#38404
2015-04-07 18:32:29 +01:00
Jack Nagel
a4ff45e5ee Use pkg_version when comparing against keg versions 2015-04-01 21:15:18 -04:00
Xu Cheng
89325bbb19 cleanup: optimize perfermance
Only remove .DS_Store files from whitelisted directories.

Closes Homebrew/homebrew#37409.

Signed-off-by: Xu Cheng <xucheng@me.com>
2015-03-07 12:03:36 +08:00
Jack Nagel
ba48d8c5b9 Use version attribute directly in cache comparisons
The bug that prompted the two relevant commits has since been addressed.

Squashed commit of the following:

commit ecca17ede8324efd1175a42300ace8e1e2df30fa
Author: Jack Nagel <jacknagel@gmail.com>
Date:   Sat Dec 27 16:16:12 2014 -0500

    Revert "Don't use pkg_version when cleaning the cache"

    This reverts commit 4d511b5169d78a5d44bbf6c36c17f0c28014a614.

commit e8935de08f6440ae1874ce523f93b19da6b68df3
Author: Jack Nagel <jacknagel@gmail.com>
Date:   Sat Dec 27 16:16:12 2014 -0500

    Revert "Fix cleanup for head-only formulae"

    This reverts commit 510267ffd314c296c0b0969dd27d130a249f16e2.
2014-12-27 16:16:16 -05:00
Jack Nagel
8c0928ccca Use quiet_system to avoid the shell 2014-12-16 15:27:36 -05:00
Mike McQuaid
b6c2c8cdc8 cleanup: only clean cache if it exists.
Closes Homebrew/homebrew#33297.
2014-10-19 12:28:32 +01:00
Jack Nagel
def6b1eaf7 Use Keg#uninstall to clean up kegs 2014-06-24 09:56:37 -05:00
Jack Nagel
4d9d01893e Move deprecated Formula class methods to compat
These have all been moved to Formulary.
2014-06-22 15:03:17 -05:00
Jack Nagel
10a1952d2c Only "extend self" once on the Homebrew module 2014-06-19 13:10:36 -05:00
Adam Vandenberg
2cb923649c only clean logs if logs exist
Closes Homebrew/homebrew#29355.
2014-05-17 16:59:14 -07:00
Jack Nagel
d6483c963a cleanup: prune old build logs
Closes Homebrew/homebrew#29231.
2014-05-14 14:36:34 -05:00
Jack Nagel
543f2a68e9 Don't send, just call the method directly 2014-03-22 13:16:16 -05:00
Jack Nagel
037acb81c8 Fix cleanup for head-only formulae
Fixes Homebrew/homebrew#27265.
2014-03-06 09:50:44 -06:00
Jack Nagel
bacf5d7137 Don't use pkg_version when cleaning the cache
Fixes Homebrew/homebrew#27245.
2014-03-05 21:45:07 -06:00
Jack Nagel
17032a600c Teach commands to work with revisions 2014-03-05 20:12:51 -06:00
Jack Nagel
c0eb1f10de Don't clean up lockfiles if the directory doesn't exist
Fixes Homebrew/homebrew#20673.
2013-06-21 18:38:39 -05:00
Jack Nagel
3b56cb02ea Clean up lockfiles 2013-06-21 15:42:14 -05:00
Jack Nagel
9a741810c8 cleanup: use String#[] instead of "captures.first rescue nil" 2013-06-06 12:34:47 -05:00
Jack Nagel
277f3d3c30 Stop running "prune" as part of "cleanup"
Rationale: "prune" is slow, does not need to be run as often as
"cleanup", and is potentially destructive to things like empty
directories that Homebrew did not create. Thus we should let users run
`brew prune` only when they wish to, while still being able to use `brew
cleanup`.

Closes Homebrew/homebrew#19863.
2013-05-18 20:22:24 -05:00
Jack Nagel
d3a8cb7803 cleanup: enable prune during dry-run mode
Closes Homebrew/homebrew#19826.
2013-05-15 12:57:02 -05:00
Jack Nagel
f4dcdea64e cleanup: cleanup_all => cleanup_cellar 2013-05-15 12:57:01 -05:00
Jack Nagel
a9fcefda4e cleanup: refactor cleanup_cache 2013-05-15 12:57:01 -05:00
Jack Nagel
5b5bb57865 cleanup: rename variable 2013-05-15 12:57:00 -05:00
Jack Nagel
b26c502f79 cleanup: refactor cleanup_formula 2013-05-15 12:57:00 -05:00
Jack Nagel
87a8f9a6ae cleanup: only map dirs to kegs once 2013-05-15 12:57:00 -05:00
Jack Nagel
daf8c26108 cleanup: use Pathname#rmtree instead of FileUtils 2013-05-15 12:56:59 -05:00
Jack Nagel
b32310c3db cleanup: use subdirs, avoid .directory? checks 2013-05-15 12:56:59 -05:00
Jack Nagel
bf8bf2e1d1 cleanup: remove redundant condition
If f.installed? is true, f.rack.directory? will always be true as well.
2013-05-15 12:56:59 -05:00
Jack Nagel
0c35274bf4 cleanup: rename method for consistency 2013-05-15 12:56:58 -05:00
Jack Nagel
5515d359d5 cleanup: use early return rather than method-spanning conditional 2013-05-15 12:56:58 -05:00
Jack Nagel
8cd331718e cleanup: factor out unqualified cleanup code 2013-05-15 12:56:58 -05:00