373f315a1094747cc62aa1ff31d09ae55476bec1
10 while read fop fspec fperm
; do
11 local fop
=`echo "$fop" | tr -d ' \t\n'`
12 if [ "$fop" = "+" ]; then
13 if [ ! -e "${src_dir}${fspec}" ]; then
14 echo "File not found '${src_dir}${fspec}'"
17 dpath
=`dirname "$fspec"`
18 if [ -z "$fperm" ]; then
19 dperm
=`stat -c "%a" ${src_dir}${dpath}`
21 mkdir
-p -m$dperm ${dst_dir}${dpath}
22 echo "copying: '$fspec'"
23 cp -fpR ${src_dir}${fspec} ${dst_dir}${dpath}/
24 if [ -n "$fperm" ]; then
25 chmod -R $fperm ${dst_dir}${fspec}
27 elif [ "$fop" = "-" ]; then
28 echo "removing: '$fspec'"
29 rm -fR ${dst_dir}${fspec}
30 elif [ "$fop" = "=" ]; then
31 echo "setting permissions: '$fperm' on '$fspec'"
32 chmod -R $fperm ${dst_dir}${fspec}
44 process_filespec
"$src_dir" "$dst_dir" "$filespec" ||
{
45 echo "process filespec error-ed"
49 if [ "$mode" == "sources" ] ; then
50 # Copy only python source files
51 find $dst_dir -not -type d
-not -name "*\.py" |
xargs rm -f
53 # Delete empty folders (if the case)
54 if [ -d "$dst_dir/usr" ] ; then
55 find $dst_dir/usr
-type d |
xargs rmdir --ignore-fail-on-non-empty
56 rmdir --ignore-fail-on-non-empty $dst_dir/usr
61 # XXX [So that you won't goof as I did]
62 # Note: Yes, I tried to use the -O & -OO flags here.
63 # However the generated byte-codes were not portable.
64 # So, we just stuck to un-optimized byte-codes,
65 # which is still way better/faster than running
66 # Python sources all the time.
67 $python -m compileall
-b -d '/' $dst_dir ||
{
68 echo "python -m compileall err-ed"
72 # Delete source files and pyc [ un-optimized bytecode files ]
73 # We may want to make this optimization thing configurable later, but not sure atm
74 find $dst_dir -type f
-name "*\.py" |
xargs rm -f
76 # Delete empty folders (if the case)
77 if [ -d "$dst_dir/usr" ] ; then
78 find $dst_dir/usr
-type d |
xargs rmdir --ignore-fail-on-non-empty
79 rmdir --ignore-fail-on-non-empty $dst_dir/usr