Better support for http proxies
Better support for http proxies

Setting the environment variable http_proxy makes it possible to use a (local)
proxy server to cache most requests and thus decreases image build times while
at the same time increases stability in case an upstream server is not
available.

This patch prevents yum mirror selection if a proxy is defined in the
environment variable, increasing the cache hit rate to more than 98% for rpms
and their dependencies.

curl, pip and gem also use the http_proxy env variable, thus all requests except
https will use the proxy too. However, ruby gems uses https by default, thus the
overall cache hit rate for a complete image build is nearly 90%.

The easiest way to run a cache is to simply install squid on the build VM and
make the following two changes to /etc/squid/squid.conf to use a 2GB local cache
directory for all files up to 100 MB in size:

 maximum_object_size 100 MB
 cache_dir ufs /var/spool/squid 2000 16 256

Set the environment variables afterwards:

 export http_proxy=http://127.0.0.1:3128
 export https_proxy=http://127.0.0.1:3128

Now simply start ./run_functional-tests.sh to make use of it. You can check some
cache stats with the following command:

 curl http://127.0.0.1:3128/squid-internal-mgr/info

You can see cache hits and misses also in /var/log/squid/access.log (prefixed
with either TCP_HIT or TCP_MISS).

Change-Id: I9c67258cbe1510d76a171f8dfdf29ef284f1be95

enovance/software-factory,enovance/software-factory,enovance/software-factory,enovance/software-factory,enovance/software-factory