~jdstrand/ufw/trunk

« back to all changes in this revision

Viewing changes to Makefile

  • Committer: Jamie Strandboge
  • Date: 2016-12-26 19:43:56 UTC
  • mto: This revision was merged to the branch mainline in revision 968.
  • Revision ID: jamie@ubuntu.com-20161226194356-271jrb9db9jd0vl2
update to use snapcraft wholly:
- add snapcraft.yaml with make plugin
- adjust Makefile to take SNAP=yes arg for 'all' and 'install'
- remove snappy-packaging/
- add snap-files/bin/*

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
SRCS     = src/ufw $(wildcard src/*.py)
2
2
POTFILES = locales/po/ufw.pot
3
3
TMPDIR   = ./tmp
4
 
SNAPDIR  = ./snap
 
4
SNAPDIR  = ./snap-build
5
5
EXCLUDES = --exclude='.bzr*' --exclude='*~' --exclude='*.swp' --exclude='*.pyc' --exclude='debian' --exclude='ubuntu'
6
6
VERSION  = $(shell egrep '^ufw_version' ./setup.py | cut -d "'" -f 2)
7
7
SRCVER   = ufw-$(VERSION)
17
17
 
18
18
all:
19
19
        # Use setup.py to install. See README for details
 
20
ifneq ($(SNAP),yes)
20
21
        exit 1
 
22
endif
 
23
        mkdir $(SNAPDIR)
 
24
        python3 ./setup.py install --root=$(SNAPDIR) --install-layout=deb
 
25
        chmod 644 $(SNAPDIR)/etc/ufw/*.rules $(SNAPDIR)/etc/ufw/*.init $(SNAPDIR)/usr/share/ufw/iptables/*.rules
 
26
        sed -i 's/IPT_MODULES=.*/IPT_MODULES=""/g' $(SNAPDIR)/etc/default/ufw
 
27
        sed -i 's/IPT_SYSCTL=\(.*\)/IPT_SYSCTL="$$SNAP_DATA\1"/g' $(SNAPDIR)/etc/default/ufw
 
28
        sed -i 's,net/ipv4/tcp_sack=,#net/ipv4/tcp_sack=,g'  $(SNAPDIR)/etc/ufw/sysctl.conf
 
29
        chmod -R g-w $(SNAPDIR)
 
30
        mkdir $(SNAPDIR)/docs
 
31
        for manfile in `ls doc/*.8` ; do \
 
32
                page=$$(basename $$manfile); \
 
33
                manout=$(SNAPDIR)/docs/$$(basename -s .8 $$page); \
 
34
                echo "Creating $$page ... "; \
 
35
                LANG='C' MANWIDTH=80 man --warnings -E ascii doc/$$page | col -b > "$$manout"; \
 
36
        done; \
 
37
        for manfile in iptables ip6tables iptables-restore ip6tables-restore ; do \
 
38
                manout=$(SNAPDIR)/docs/$$(basename -s .8 $$manfile); \
 
39
                echo "Creating $$manfile ... "; \
 
40
                LANG='C' MANWIDTH=80 man --warnings -E ascii $$manfile | col -b > "$$manout"; \
 
41
        done; \
 
42
        rm -f $(SNAPDIR)/usr/lib/python3/dist-packages/ufw/__pycache__/*
 
43
        rmdir $(SNAPDIR)/usr/lib/python3/dist-packages/ufw/__pycache__/
21
44
 
22
 
install: all
 
45
install:
 
46
        # Use setup.py to install. See README for details
 
47
ifneq ($(SNAP),yes)
 
48
        exit 1
 
49
endif
 
50
        cp -a $(SNAPDIR)/* $(DESTDIR)
 
51
        #ln -sf /var/snap/ufw/current/usr/lib/python3/dist-packages/ufw/__pycache__ ./snappy-packaging/prime/usr/lib/python3/dist-packages/ufw/__pycache__
 
52
        ln -sf /var/snap/ufw/current/usr/lib/python3/dist-packages/ufw/__pycache__ $(DESTDIR)/usr/lib/python3/dist-packages/ufw/__pycache__
23
53
 
24
54
translations: $(POTFILES)
25
55
$(POTFILES): $(SRCS)
70
100
        rm -rf ./tests/testarea ./tests/unit/tmp
71
101
        rm -rf $(TMPDIR)
72
102
        rm -rf $(SNAPDIR)
 
103
        rm -rf ./parts ./stage ./prime
73
104
        rm -rf ./snappy-packaging/files/* ./snappy-packaging/parts ./snappy-packaging/prime ./snappy-packaging/stage
74
105
        rm -f ./snappy-packaging/*.snap
75
106
        rm -f ./locales/mo/*.mo
98
129
        bzr export --format dir $(TARSRC)
99
130
        tar -zcv -C $(TARBALLS) $(EXCLUDES) -f $(TARDST) $(SRCVER)
100
131
        rm -rf $(TARSRC)
101
 
 
102
 
 
103
 
snap: clean
104
 
        mkdir $(SNAPDIR)
105
 
        python3 ./setup.py install --root=$(SNAPDIR) --install-layout=deb
106
 
        chmod 644 $(SNAPDIR)/etc/ufw/*.rules $(SNAPDIR)/etc/ufw/*.init $(SNAPDIR)/usr/share/ufw/iptables/*.rules
107
 
        sed -i 's/IPT_MODULES=.*/IPT_MODULES=""/g' $(SNAPDIR)/etc/default/ufw
108
 
        sed -i 's/IPT_SYSCTL=\(.*\)/IPT_SYSCTL="$$SNAP_DATA\1"/g' $(SNAPDIR)/etc/default/ufw
109
 
        sed -i 's,net/ipv4/tcp_sack=,#net/ipv4/tcp_sack=,g'  $(SNAPDIR)/etc/ufw/sysctl.conf
110
 
        chmod -R g-w $(SNAPDIR)
111
 
        mkdir $(SNAPDIR)/docs
112
 
        for manfile in `ls doc/*.8` ; do \
113
 
                page=$$(basename $$manfile); \
114
 
                manout=$(SNAPDIR)/docs/$$(basename -s .8 $$page); \
115
 
                echo "Creating $$page ... "; \
116
 
                LANG='C' MANWIDTH=80 man --warnings -E ascii doc/$$page | col -b > "$$manout"; \
117
 
        done; \
118
 
        for manfile in iptables ip6tables iptables-restore ip6tables-restore ; do \
119
 
                manout=$(SNAPDIR)/docs/$$(basename -s .8 $$manfile); \
120
 
                echo "Creating $$manfile ... "; \
121
 
                LANG='C' MANWIDTH=80 man --warnings -E ascii $$manfile | col -b > "$$manout"; \
122
 
        done; \
123
 
        rm -f $(SNAPDIR)/usr/lib/python3/dist-packages/ufw/__pycache__/*
124
 
        rmdir $(SNAPDIR)/usr/lib/python3/dist-packages/ufw/__pycache__/
125
 
        cp -a $(SNAPDIR)/* ./snappy-packaging/files
126
 
        cp -a ./snappy-packaging/bin ./snappy-packaging/files
127
 
        cd ./snappy-packaging && snapcraft
128
 
        ln -sf /var/snap/ufw/current/usr/lib/python3/dist-packages/ufw/__pycache__ ./snappy-packaging/prime/usr/lib/python3/dist-packages/ufw/__pycache__
129
 
        rm -f ./snappy-packaging/*.snap
130
 
        snapcraft snap ././snappy-packaging/prime