Home | History | Annotate | Download | only in snapcraft
      1 #
      2 # Copyright (C) 2016 Canonical
      3 #
      4 # This program is free software; you can redistribute it and/or
      5 # modify it under the terms of the GNU General Public License
      6 # as published by the Free Software Foundation; either version 2
      7 # of the License, or (at your option) any later version.
      8 #
      9 # This program is distributed in the hope that it will be useful,
     10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
     11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     12 # GNU General Public License for more details.
     13 #
     14 # You should have received a copy of the GNU General Public License
     15 # along with this program; if not, write to the Free Software
     16 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
     17 #
     18 
     19 #
     20 # Simple makefile to mangle version info in the yaml file
     21 #
     22 VERSION=$(shell git tag | tail -1 | cut -c2-)
     23 COMMITS=$(shell git log --oneline | wc -l)
     24 SHA=$(shell git log -1 --oneline | cut -d' ' -f1)
     25 DATE=$(shell date +'%Y%m%d')
     26 V=$(VERSION)-$(DATE)-$(COMMITS)-$(SHA)
     27 
     28 all: set_version
     29 	snapcraft
     30 
     31 set_version:
     32 	cat snapcraft.yaml | sed 's/version: .*/version: $(V)/' > snapcraft-tmp.yaml
     33 	mv snapcraft-tmp.yaml snapcraft.yaml
     34 
     35 install:
     36 	#
     37 	# Install latest snap
     38 	#
     39 	sudo snap install --devmode bcc_*.snap
     40 
     41 	#
     42 	# Connect up interfaces
     43 	#
     44 	sudo snap connect bcc:mount-observe
     45 	sudo snap connect bcc:system-observe
     46 	sudo snap connect bcc:system-trace
     47 
     48 remove:
     49 	sudo snap remove bcc
     50 
     51 clean:
     52 	snapcraft clean
     53 	rm -rf setup *.snap snapcraft
     54