Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(475)

Side by Side Diff: build/android/pylib/efficient_android_directory_copy.sh

Issue 2392643003: Removes files from //build that we don't need (Closed)
Patch Set: Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « build/android/pylib/device_signal.py ('k') | build/android/pylib/flag_changer.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 #!/system/bin/sh
2
3 # Copyright 2014 The Chromium Authors. All rights reserved.
4 # Use of this source code is governed by a BSD-style license that can be
5 # found in the LICENSE file.
6
7 # Android shell script to make the destination directory identical with the
8 # source directory, without doing unnecessary copies. This assumes that the
9 # the destination directory was originally a copy of the source directory, and
10 # has since been modified.
11
12 source=$1
13 dest=$2
14 echo copying $source to $dest
15
16 delete_extra() {
17 # Don't delete symbolic links, since doing so deletes the vital lib link.
18 if [ ! -L "$1" ]
19 then
20 if [ ! -e "$source/$1" ]
21 then
22 echo rm -rf "$dest/$1"
23 rm -rf "$dest/$1"
24 elif [ -d "$1" ]
25 then
26 for f in "$1"/*
27 do
28 delete_extra "$f"
29 done
30 fi
31 fi
32 }
33
34 copy_if_older() {
35 if [ -d "$1" ] && [ -e "$dest/$1" ]
36 then
37 if [ ! -e "$dest/$1" ]
38 then
39 echo cp -a "$1" "$dest/$1"
40 cp -a "$1" "$dest/$1"
41 else
42 for f in "$1"/*
43 do
44 copy_if_older "$f"
45 done
46 fi
47 elif [ ! -e "$dest/$1" ] || [ "$1" -ot "$dest/$1" ] || [ "$1" -nt "$dest/$1" ]
48 then
49 # dates are different, so either the destination of the source has changed.
50 echo cp -a "$1" "$dest/$1"
51 cp -a "$1" "$dest/$1"
52 fi
53 }
54
55 if [ -e "$dest" ]
56 then
57 echo cd "$dest"
58 cd "$dest"
59 for f in ./*
60 do
61 if [ -e "$f" ]
62 then
63 delete_extra "$f"
64 fi
65 done
66 else
67 echo mkdir "$dest"
68 mkdir "$dest"
69 fi
70 echo cd "$source"
71 cd "$source"
72 for f in ./*
73 do
74 if [ -e "$f" ]
75 then
76 copy_if_older "$f"
77 fi
78 done
OLDNEW
« no previous file with comments | « build/android/pylib/device_signal.py ('k') | build/android/pylib/flag_changer.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698