Skip to content

Commit

Permalink
Merge pull request #70 from MeeGoIntegration/jb41409-packaging-fixes
Browse files Browse the repository at this point in the history
Jb41409 packaging fixes
  • Loading branch information
keto authored Feb 4, 2020
2 parents 063ced0 + 042af7d commit 0fbdd57
Show file tree
Hide file tree
Showing 14 changed files with 202 additions and 239 deletions.
7 changes: 0 additions & 7 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
all: install

install:
python setup.py install --root=$(DESTDIR)

install -D -m 644 conf/apache_webhook.conf $(DESTDIR)/etc/apache2/vhosts.d/webhook.conf

for p in $$(cd src/participants; ls *py | cut -f1 -d.) ; do \
install -D -m 755 src/participants/$$p.py $(DESTDIR)/usr/share/boss-skynet/$$p.py ; \
install -D -m 644 conf/supervisor/$$p.conf $(DESTDIR)/etc/supervisor/conf.d/$$p.conf ; \
Expand All @@ -14,6 +10,3 @@ install:
install -D -m 755 src/service/tar_git $(DESTDIR)/usr/lib/obs/service/tar_git
install -D -m 644 src/service/webhook.service $(DESTDIR)/usr/lib/obs/service/webhook.service
install -D -m 755 src/service/webhook $(DESTDIR)/usr/lib/obs/service/webhook

clean:
python setup.py clean
56 changes: 0 additions & 56 deletions conf/apache_webhook.conf

This file was deleted.

32 changes: 32 additions & 0 deletions example/apache_webhook.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
Define python_path /usr/lib/python2.7/site-packages/webhook_launcher
define media_path /var/www/webhook/site_media/
Define prefix webhook

Listen *:8080

<VirtualHost *:8080>
ServerAdmin [email protected]
ServerName webhook.example.com

# if not specified, the global error log is used
ErrorLog /var/log/apache2/webhook-error.log
CustomLog /var/log/apache2/webhook-access.log combined

WSGIDaemonProcess webhook
WSGIProcessGroup webhook
# Pass Authorisation for use in the API calls
WSGIPassAuthorization On

WSGIScriptAlias / ${python_path}/wsgi.py
<Directory "${python_path}">
<Files wsgi.py>
Require all granted
</Files>
</Directory>

Alias /${prefix}/site_media/ ${media_path}
<Directory "${media_path}">
Require all granted
</Directory>

</VirtualHost>
96 changes: 43 additions & 53 deletions rpm/boss-launcher-webhook.spec
Original file line number Diff line number Diff line change
@@ -1,103 +1,98 @@
%define svdir %{_sysconfdir}/supervisor/conf.d/
%define use_pip 1

Name: boss-launcher-webhook
Version: 0.2.0
Release: 1

Group: Applications/Engineering
License: GPLv2+
URL: http://www.merproject.org
URL: https://github.com/MeeGoIntegration/boss-launcher-webhook
Source: %{name}-%{version}.tar.gz
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-buildroot
BuildRequires: python, python-distribute, python-sphinx, python-boss-skynet, python-ruote-amqp
%if ! 0%{?use_pip}
BuildRequires: python-django
%else
Conflicts: python-django, python-Django
%endif
%if 0%{?fedora}
BuildRequires: MySQL-python
%else
BuildRequires: python-mysql
%endif
Requires: python >= 2.5.0, python-xml, python-boss-skynet, python-flup, python-requests
%if ! 0%{?use_pip}
Requires: python-django, python-djangorestframework python-django-extensions
%endif
%if 0%{?fedora}
Requires: MySQL-python
%else
Requires: python-mysql
%endif
Requires: apache2-mod_wsgi
Requires(post): python-boss-skynet

BuildArch: noarch

BuildRequires: python-setuptools
BuildRequires: python-rpm-macros

Requires(post): boss-standard-workflow-common
Requires(post): python-boss-skynet >= 0.6.6
Requires: python-Django
Requires: python-boss-common >= 0.27.10
Requires: python-djangorestframework
Requires: python-requests
Requires: python-xml
Requires: python2-django-filter

Summary: VCS webhook handler

%description
Webhook handler for gitlab, github and bitbucket that receives data as a POST callback and launches a ruote process

%package -n obs-service-tar-git
Group: Applications/Engineering
Requires: git, obs-source_service
Requires: git
Requires: obs-source_service
Summary: OBS source service to generate sources from git
%description -n obs-service-tar-git
This package provides the service to generate source from git inside an OBS source service

%package -n obs-service-webhook
Group: Applications/Engineering
Requires: obs-source_service, python-argparse, python-requests
Requires: obs-source_service
Requires: python-argparse
Requires: python-requests
Summary: OBS source service to manage webhooks
%description -n obs-service-webhook
This package provides the service to update webhooks from OBS. It ensures that only users who have access to a package can update the webhook for that package.

%package -n boss-participant-trigger_service
Group: Applications/Engineering
Requires: python-boss-skynet >= 0.6.0, boss-standard-workflow-common, python-lxml, python-yaml, python-buildservice >= 0.5.3
Requires(post): boss-standard-workflow-common
Requires(post): python-boss-skynet >= 0.6.6
Requires: osc
Requires: python-boss-common >= 0.27.10
Requires: python-lxml
Requires: python-yaml
Summary: BOSS participant to handle webhooks
%description -n boss-participant-trigger_service
This package provides the participant that handles creating and/or triggering _service files in OBS, in response to webhook triggers

%package -n boss-participant-create_project
Group: Applications/Engineering
Requires: python-boss-skynet >= 0.6.0, python-boss-common, boss-standard-workflow-common, python-lxml, boss-launcher-webhook, python-buildservice >= 0.5.3
Requires(post): boss-standard-workflow-common
Requires(post): python-boss-skynet >= 0.6.6
Requires: boss-launcher-webhook
Requires: osc
Requires: python-boss-common >= 0.27.10
Requires: python-lxml
Summary: BOSS participant to handle webhooks
%description -n boss-participant-create_project
This package provides the participant that handles creating project files in OBS, in response to webhook triggers

%package -n boss-participant-get_src_state
Group: Applications/Engineering
Requires: python-boss-skynet >= 0.6.0, python-boss-common, boss-standard-workflow-common, python-lxml, boss-launcher-webhook, python-buildservice >= 0.5.3
Requires(post): boss-standard-workflow-common
Requires(post): python-boss-skynet >= 0.6.6
Requires: python-boss-common >= 0.27.10
Summary: BOSS participant to handle webhooks
%description -n boss-participant-get_src_state
This package provides the participant that checks that there is src is ready to build in OBS projects. Usually this means the service has succeeded.

%package -n boss-participant-auto_promote
Group: Applications/Engineering
Requires: python-boss-skynet >= 0.6.0, python-boss-common, boss-standard-workflow-common, python-lxml, boss-launcher-webhook, python-buildservice >= 0.5.3
Requires(post): boss-standard-workflow-common
Requires(post): python-boss-skynet >= 0.6.6
Requires: boss-launcher-webhook
Requires: python-boss-common >= 0.27.10
Summary: BOSS participant to handle webhooks
%description -n boss-participant-auto_promote
This package provides the participant that handles promotion of gated projects, in response to webhook triggers

%define python python%{?__python_ver}
%define __python /usr/bin/%{python}
%if ! (0%{?fedora} > 12 || 0%{?rhel} > 5)
%{!?python_sitelib: %global python_sitelib %(%{__python} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())")}
%{!?python_sitearch: %global python_sitearch %(%{__python} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib(1))")}
%endif

%prep
%setup -q %{name}-%{version}

%build
%python2_build

%install
rm -rf %{buildroot}
%python2_install
make PREFIX=%{_prefix} DESTDIR=%{buildroot} install

%clean
rm -rf %{buildroot}

%post
if [ $1 -ge 1 ]; then
Expand Down Expand Up @@ -138,14 +133,9 @@ fi

%files
%defattr(-,root,root,-)
%dir %{_sysconfdir}/skynet
%dir %{_sysconfdir}/apache2
%dir %{_sysconfdir}/apache2/vhosts.d
%dir %{_sysconfdir}/supervisor
%dir %{svdir}
%dir %{_datadir}/boss-skynet
%doc example/apache_webhook.conf
%doc README
%config(noreplace) %{_sysconfdir}/skynet/webhook.conf
%config(noreplace) %{_sysconfdir}/apache2/vhosts.d/webhook.conf
%config(noreplace) %{svdir}/delete_webhook.conf
%config(noreplace) %{svdir}/handle_webhook.conf
%config(noreplace) %{svdir}/relay_webhook.conf
Expand Down
76 changes: 37 additions & 39 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,57 +2,55 @@
# Copyright (C) 2013 Jolla Ltd.
# Contact: Islam Amer <[email protected]>
# All rights reserved.
#
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.

import os, sys
from distutils.core import setup

from setuptools import find_packages

static_files=[('/etc/skynet', ['src/webhook_launcher/webhook.conf']),
('/usr/share/webhook_launcher/processes',
['src/webhook_launcher/processes/VCSCOMMIT_NOTIFY',
'src/webhook_launcher/processes/VCSCOMMIT_BUILD',
'src/webhook_launcher/processes/VCSCOMMIT_QUEUE',
]
)
]
from setuptools import setup

setup(
name = "webhook_launcher",
version = "0.2.0",
url = '',
license = 'GPLv2',
description = "webhook launcher",
author = 'Islam Amer <[email protected]>',
packages = ['webhook_launcher',
'webhook_launcher.app',
'webhook_launcher.app.templatetags',
'webhook_launcher.app.migrations',
'webhook_launcher.app.management',
'webhook_launcher.app.management.commands',
],
package_dir = {'':'src'},
package_data = { 'webhook_launcher.app' : ['templates/admin/*.html',
'templates/app/*.html',
'static/images/*.png',
'static/*.gif',
'static/*.css',
'static/*.js',
]
},
data_files = static_files,
name="webhook_launcher",
version="0.2.0",
url='',
license='GPLv2',
description="webhook launcher",
author='Islam Amer <[email protected]>',
packages=[
'webhook_launcher',
'webhook_launcher.app',
'webhook_launcher.app.templatetags',
'webhook_launcher.app.migrations',
'webhook_launcher.app.management',
'webhook_launcher.app.management.commands',
],
package_dir={'': 'src'},
package_data={
'webhook_launcher.app': [
'templates/admin/*.html',
'templates/app/*.html',
'static/images/*.png',
'static/*.gif',
'static/*.css',
'static/*.js',
]
},
data_files=[
('/etc/skynet', ['src/webhook_launcher/webhook.conf']),
('/usr/share/webhook_launcher/processes', [
'src/webhook_launcher/processes/VCSCOMMIT_NOTIFY',
'src/webhook_launcher/processes/VCSCOMMIT_BUILD',
'src/webhook_launcher/processes/VCSCOMMIT_QUEUE',
]),
],
)
1 change: 1 addition & 0 deletions src/manage.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ def main(launch_mock):
os.environ.setdefault(
"DJANGO_SETTINGS_MODULE", "webhook_launcher.settings"
)
os.environ.setdefault("WEBHOOK_DEVEL", "1")
try:
from django.core.management import execute_from_command_line
except ImportError:
Expand Down
Loading

0 comments on commit 0fbdd57

Please sign in to comment.