From c3aaf6e2a75601051c3b8e13a000a5a756e15351 Mon Sep 17 00:00:00 2001 From: Joe Testa Date: Thu, 12 Mar 2020 21:56:23 -0400 Subject: [PATCH] Added snap package support. --- .gitignore | 11 ++++++++--- {pypi => packages}/MANIFEST.in | 0 pypi/Makefile => packages/Makefile.pypi | 2 +- packages/Makefile.snap | 8 ++++++++ {pypi => packages}/notes.txt | 16 +++++++++++++--- {pypi => packages}/setup.py | 0 packages/snapcraft.yaml | 21 +++++++++++++++++++++ {pypi => packages}/sshaudit/__init__.py | 0 {pypi => packages}/sshaudit/__main__.py | 0 9 files changed, 51 insertions(+), 7 deletions(-) rename {pypi => packages}/MANIFEST.in (100%) rename pypi/Makefile => packages/Makefile.pypi (67%) create mode 100644 packages/Makefile.snap rename {pypi => packages}/notes.txt (78%) rename {pypi => packages}/setup.py (100%) create mode 100644 packages/snapcraft.yaml rename {pypi => packages}/sshaudit/__init__.py (100%) rename {pypi => packages}/sshaudit/__main__.py (100%) diff --git a/.gitignore b/.gitignore index a02d539..da4cbd4 100644 --- a/.gitignore +++ b/.gitignore @@ -8,6 +8,11 @@ venv*/ .coverage* reports/ .scannerwork/ -pypi/sshaudit/LICENSE -pypi/sshaudit/README.md -pypi/sshaudit/sshaudit.py +packages/sshaudit/LICENSE +packages/sshaudit/README.md +packages/sshaudit/sshaudit.py +packages/parts/ +packages/prime/ +packages/snap/ +packages/stage/ +packages/ssh-audit_*.snap diff --git a/pypi/MANIFEST.in b/packages/MANIFEST.in similarity index 100% rename from pypi/MANIFEST.in rename to packages/MANIFEST.in diff --git a/pypi/Makefile b/packages/Makefile.pypi similarity index 67% rename from pypi/Makefile rename to packages/Makefile.pypi index 804b804..c3ce0dc 100644 --- a/pypi/Makefile +++ b/packages/Makefile.pypi @@ -11,4 +11,4 @@ uploadprod: twine upload dist/* clean: - rm -rf build/ dist/ *.egg-info/ sshaudit/sshaudit.py sshaudit/LICENSE sshaudit/README.md + rm -rf parts/ prime/ snap/ stage/ build/ dist/ *.egg-info/ sshaudit/sshaudit.py sshaudit/LICENSE sshaudit/README.md ssh-audit*.snap diff --git a/packages/Makefile.snap b/packages/Makefile.snap new file mode 100644 index 0000000..93608c0 --- /dev/null +++ b/packages/Makefile.snap @@ -0,0 +1,8 @@ +all: + cp ../ssh-audit.py sshaudit/sshaudit.py + cp ../README.md sshaudit/README.md + echo -e "\n\nDid you remember to bump the version number in snapcraft.yaml?\n\n" + snapcraft + +clean: + rm -rf parts/ prime/ snap/ stage/ build/ dist/ *.egg-info/ sshaudit/sshaudit.py sshaudit/LICENSE sshaudit/README.md ssh-audit*.snap diff --git a/pypi/notes.txt b/packages/notes.txt similarity index 78% rename from pypi/notes.txt rename to packages/notes.txt index dd2e855..784bb55 100644 --- a/pypi/notes.txt +++ b/packages/notes.txt @@ -1,3 +1,5 @@ += PyPI = + To create package and upload to test server: # apt install virtualenv @@ -6,8 +8,8 @@ $ cd /tmp/pypi_upload; source bin/activate $ pip3 install twine $ cp -R path/to/ssh-audit . $ cd ssh-audit/pypi -$ make -$ make uploadtest +$ make -f Makefile.pypi +$ make -f Makefile.pypi uploadtest To download from test server and verify: @@ -21,7 +23,7 @@ To upload to production server: $ cd /tmp/pypi_upload; source bin/activate $ cd ssh-audit/pypi -$ make uploadprod +$ make -f Makefile.pypi uploadprod To download from production server and verify: @@ -29,3 +31,11 @@ To download from production server and verify: $ virtualenv -p /usr/bin/python3 /tmp/pypi_prod $ cd /tmp/pypi_prod; source bin/activate $ pip3 install ssh-audit + +---- + += Snap = + +To create the snap package, simply run: + +$ make -f Makefile.snap diff --git a/pypi/setup.py b/packages/setup.py similarity index 100% rename from pypi/setup.py rename to packages/setup.py diff --git a/packages/snapcraft.yaml b/packages/snapcraft.yaml new file mode 100644 index 0000000..4928ec8 --- /dev/null +++ b/packages/snapcraft.yaml @@ -0,0 +1,21 @@ +name: ssh-audit +version: '2.2.0-1' +license: 'MIT' +summary: ssh-audit +description: | + SSH server and client security configuration auditor. Official repository: + +base: core18 +grade: stable +confinement: strict + +apps: + ssh-audit: + command: bin/ssh-audit + plugs: [network,network-bind] + +parts: + ssh-audit: + plugin: python + python-version: python3 + source: . diff --git a/pypi/sshaudit/__init__.py b/packages/sshaudit/__init__.py similarity index 100% rename from pypi/sshaudit/__init__.py rename to packages/sshaudit/__init__.py diff --git a/pypi/sshaudit/__main__.py b/packages/sshaudit/__main__.py similarity index 100% rename from pypi/sshaudit/__main__.py rename to packages/sshaudit/__main__.py