Commit graph

10 commits

Author SHA1 Message Date
Cole Faust
407d214b0d Convert findleaves.py to python 3
Kati special-cases findleaves.py to an internal
C++ implementation, so I don't think this python
script is even used. Update it anyways, and
test by manually running findleaves.py.

Bug: 203436762
Test: ./build/make/tools/findleaves.py --mindepth=2 --dir=build/make/target Android.mk
Change-Id: If27cc37d8f673388c0e31b9491e792b98ca59da4
2022-10-24 17:57:39 -07:00
Paul Keith
8368d23d47 findleaves: Fix typo for --dir argument
Change-Id: I9b78c304d27dd652ef49f72fa6ad9260e4ce605b
2018-08-16 02:30:45 +02:00
Colin Cross
7829ebfebd findleaves.py: prevent recursion into symlink loops
Keep a set of all visited inodes, and prevent recursing into a symlink
to an already visited inode.

Test: m -j
Test: compare `build/tools/findleaves.py --prune=.repo --prune=.git --mindepth=2 --dir=. Android.mk` before and after
Change-Id: Ied14c40d3066ef9f8e8a2b1535f56f7bbbbd0ab6
2016-11-03 14:29:40 -07:00
Colin Cross
9808645cd9 Add --dir option to findleaves.py
findleaves.py needs to be able to search multiple directories for
multiple filenames (Android.bp and Android.mk).  Add support for a new
--dir= option to specify one or more directories to search, and then
treat any remaining options as filenames.  If no directories are
specified, fall back to treating only the last option as a filename and
the rest as directories.

Change-Id: Ie879facd49192c6b4fafae070ad00eb21b1faa32
2016-05-27 16:05:10 -07:00
Conley Owens
d8a3285797 Follow symlinks in findleaves
If we replace the project directories with symlinks to the actual
directories, everything should build fine.  Unfortunately, without
this fix, it does not.

Change-Id: Id19fef9696d0f599a7b3a14b6a8fc10ae857f9c7
2012-08-24 16:24:45 -07:00
Ishida, Haruyasu
58e52b434b Sort the results of findleaves again.
Commit d36e945 changed findleaves.py to sort the output files so that
the order is deterministic and won't cause spurious build errors when
files happen to be listed (and hence read) in different order on
e.g. add/remove the makefiles.

This correction broke after commit 4820a94 because the conversion to
a set with set() in order to remove duplicates came after sort() and
potentially altered the order of the elements.

This commit fixes makes sure findleaves.py is guaranteed to return
a sorted filename list without duplicates.

Change-Id: Ifd96d04d45641fe43d4cc4739f78a2d4d25cc212
2011-08-19 08:14:53 +02:00
Andrew Stadler
fbe107a8b3 joeo here -- pesky findleaves.sh wasn't pruning directories. 2009-08-11 15:05:59 -07:00
Joe Onorato
4820a945a5 dedup findleaves output 2009-08-07 11:19:50 -07:00
Joe Onorato
d36e945e1a Sort the results of findleaves.
Hopefully this will fix the seemingly random build breakages.
2009-08-06 16:05:02 -07:00
Joe Onorato
dc1a728fb8 Rewrite findleaves.sh in python
This cuts the make startup time by about 30 seconds.  Python is faster
than bash in this case, and also we can now supply multiple directories
to prune, and skip the .repo directory, which is, uh, big.

This is from my mac laptop:

$ time build/tools/findleaves.sh --prune="./out" . Android.mk > /dev/null

real    0m29.186s
user    0m0.550s
sys 0m5.897s

$ time build/tools/findleaves.py --prune="./out" . Android.mk > /dev/null

real    0m4.701s
user    0m0.645s
sys 0m1.294s

$ time build/tools/findleaves.py --prune="./out" --prune="./.repo" . Android.mk > /dev/null
real    0m0.176s
user    0m0.094s
sys 0m0.080s
2009-08-06 12:09:21 -07:00