1 ##############################################################################
2 # Copyright (c) 2015,2016 Ericsson AB, Enea AB and others.
3 # stefan.k.berg@ericsson.com
4 # jonas.bjurel@ericsson.com
5 # Alexandru.Avadanii@enea.com
6 # All rights reserved. This program and the accompanying materials
7 # are made available under the terms of the Apache License, Version 2.0
8 # which accompanies this distribution, and is available at
9 # http://www.apache.org/licenses/LICENSE-2.0
10 ##############################################################################
15 include ../../config.mk
19 export MIRROR_UBUNTU_OPNFV_PATH:=$(TOP)/nailgun/mirrors/ubuntu
25 sudo apt-get install -y createrepo git libxml2-dev libxslt1-dev \
27 rm -Rf nailgun packetary opnfv_config && mkdir opnfv_config
28 # We will analyze fuel-web's fixture files for package lists
29 ln -sf ${F_SUBMOD_DIR}/fuel-web fuel-web
30 # Same for fuel-agent's bootstrap package list
31 ln -sf ${F_SUBMOD_DIR}/fuel-agent fuel-agent
32 git clone --quiet $(PACKETARY_REPO)
33 if [ -n $(PACKETARY_COMMIT) ]; then \
34 git -C packetary checkout $(PACKETARY_COMMIT); \
36 sudo pip install -U -r ./packetary/requirements.txt
37 sudo pip install -U ./packetary
38 # Handle config and mirror build in one place
39 ./opnfv_mirror_ubuntu.py
40 # Store artifact in cache straight away if caching is enabled
41 # (no .cacheid will be present unless this is a cached build)
42 test -f .cacheid && $(MAKE) -f Makefile put-cache || exit 0
46 @rm -rf ../release/opnfv/nailgun nailgun packetary fuel-web opnfv_config
50 @rm -Rf ../release/opnfv/nailgun
51 @mkdir -p ../release/opnfv
52 @cp -Rp nailgun ../release/opnfv/nailgun
54 ############################################################################
55 # Cache operations - only used when building through ci/build.sh
56 ############################################################################
58 # Create a unique hash to be used for getting and putting cache, based on:
59 # - Year and week (causing the cache to be rebuilt weekly)
60 # - The contents of this Makefile + all sh,mk,py,yaml files in CWD
61 # - repo packages fingerprint
64 date +"Repocache %G%V" > .cachedata
65 sha1sum Makefile *.{sh,mk,py,yaml} >> .cachedata
66 $(CACHETOOL) packages >> .cachedata
67 echo -n $(UBUNTU_ARCH) | sha1sum | awk {'print $$1'} >> .cachedata
68 cat .cachedata | $(CACHETOOL) getid > .cacheid
70 # Clean local data related to caching - called prior to ordinary build
73 rm -f .cachedata .cacheid
75 # Try to download cache - called prior to ordinary build
78 @if $(CACHETOOL) check $(shell cat .cacheid); then \
79 $(CACHETOOL) get $(shell cat .cacheid) | tar xf -;\
81 echo "No cache item found for $(shell cat .cacheid)" ;\
85 # Store cache if not already stored - called after ordinary build
88 @tar cf - nailgun | $(CACHETOOL) put $(shell cat .cacheid)