diff options
Diffstat (limited to 'pkg')
-rw-r--r-- | pkg/rpm/Makefile | 6 | ||||
-rw-r--r-- | pkg/rpm/Makefile.go | 2 | ||||
-rw-r--r-- | pkg/rpm/Makefile.perl | 2 | ||||
-rw-r--r-- | pkg/rpm/Makefile.php | 2 | ||||
-rw-r--r-- | pkg/rpm/Makefile.python | 2 | ||||
-rw-r--r-- | pkg/rpm/Makefile.python27 | 2 | ||||
-rw-r--r-- | pkg/rpm/Makefile.python34 | 2 | ||||
-rw-r--r-- | pkg/rpm/Makefile.python35 | 2 | ||||
-rw-r--r-- | pkg/rpm/Makefile.python36 | 2 | ||||
-rw-r--r-- | pkg/rpm/Makefile.python37 | 57 | ||||
-rw-r--r-- | pkg/rpm/Makefile.ruby | 2 | ||||
-rw-r--r-- | pkg/rpm/rpmbuild/SOURCES/unit.example-python37-config | 17 | ||||
-rw-r--r-- | pkg/rpm/rpmbuild/SOURCES/unit.logrotate | 10 | ||||
-rw-r--r-- | pkg/rpm/rpmbuild/SOURCES/unit.service | 20 | ||||
-rw-r--r-- | pkg/rpm/rpmbuild/SOURCES/unit.sysconf | 2 | ||||
-rw-r--r-- | pkg/rpm/unit.module.spec.in | 11 | ||||
-rw-r--r-- | pkg/rpm/unit.spec.in | 49 |
17 files changed, 165 insertions, 25 deletions
diff --git a/pkg/rpm/Makefile b/pkg/rpm/Makefile index ef7f3361..d817b434 100644 --- a/pkg/rpm/Makefile +++ b/pkg/rpm/Makefile @@ -89,7 +89,11 @@ endif ifeq ($(OSVER), fedora) include Makefile.php include Makefile.python27 +ifeq ($(shell test `rpm --eval '0%{?fedora} -ge 29'`; echo $$?),0) +include Makefile.python37 +else include Makefile.python36 +endif include Makefile.go include Makefile.perl include Makefile.ruby @@ -98,7 +102,7 @@ endif CONFIGURE_ARGS=\ --prefix=/usr \ --state=%{_sharedstatedir}/unit \ - --control="unix:/var/run/control.unit.sock" \ + --control="unix:/var/run/unit/control.sock" \ --pid=/var/run/unit.pid \ --log=/var/log/unit.log \ --tests \ diff --git a/pkg/rpm/Makefile.go b/pkg/rpm/Makefile.go index f031c7ba..09dffd21 100644 --- a/pkg/rpm/Makefile.go +++ b/pkg/rpm/Makefile.go @@ -64,7 +64,7 @@ To check the sample app, run these commands: GOPATH=%{gopath} go build -o /tmp/go-app /usr/share/doc/unit-go/examples/go-app/let-my-people.go sudo service unit start cd /usr/share/doc/%{name}/examples - sudo curl -X PUT --data-binary @unit.config --unix-socket /var/run/control.unit.sock http://localhost/config + sudo curl -X PUT --data-binary @unit.config --unix-socket /var/run/unit/control.sock http://localhost/config curl http://localhost:8500/ Online documentation is available at https://unit.nginx.org diff --git a/pkg/rpm/Makefile.perl b/pkg/rpm/Makefile.perl index 84c15260..f59b7353 100644 --- a/pkg/rpm/Makefile.perl +++ b/pkg/rpm/Makefile.perl @@ -51,7 +51,7 @@ To check out the sample app, run these commands: sudo service unit start cd /usr/share/doc/%{name}/examples - sudo curl -X PUT --data-binary @unit.config --unix-socket /var/run/control.unit.sock http://localhost/config + sudo curl -X PUT --data-binary @unit.config --unix-socket /var/run/unit/control.sock http://localhost/config curl http://localhost:8600/ Online documentation is available at https://unit.nginx.org diff --git a/pkg/rpm/Makefile.php b/pkg/rpm/Makefile.php index eedcce4e..8f39efc0 100644 --- a/pkg/rpm/Makefile.php +++ b/pkg/rpm/Makefile.php @@ -46,7 +46,7 @@ To check out the sample app, run these commands: sudo service unit start cd /usr/share/doc/%{name}/examples - sudo curl -X PUT --data-binary @unit.config --unix-socket /var/run/control.unit.sock http://localhost/config + sudo curl -X PUT --data-binary @unit.config --unix-socket /var/run/unit/control.sock http://localhost/config curl http://localhost:8300/ Online documentation is available at https://unit.nginx.org diff --git a/pkg/rpm/Makefile.python b/pkg/rpm/Makefile.python index bb408bb5..334d62c1 100644 --- a/pkg/rpm/Makefile.python +++ b/pkg/rpm/Makefile.python @@ -46,7 +46,7 @@ To check the sample app, run these commands: sudo service unit start cd /usr/share/doc/%{name}/examples - sudo curl -X PUT --data-binary @unit.config --unix-socket /var/run/control.unit.sock http://localhost/config + sudo curl -X PUT --data-binary @unit.config --unix-socket /var/run/unit/control.sock http://localhost/config curl http://localhost:8400/ Online documentation is available at https://unit.nginx.org diff --git a/pkg/rpm/Makefile.python27 b/pkg/rpm/Makefile.python27 index c6a2ec65..005eff17 100644 --- a/pkg/rpm/Makefile.python27 +++ b/pkg/rpm/Makefile.python27 @@ -48,7 +48,7 @@ To check the sample app, run these commands: sudo service unit start cd /usr/share/doc/%{name}/examples - sudo curl -X PUT --data-binary @unit.config --unix-socket /var/run/control.unit.sock http://localhost/config + sudo curl -X PUT --data-binary @unit.config --unix-socket /var/run/unit/control.sock http://localhost/config curl http://localhost:8400/ Online documentation is available at https://unit.nginx.org diff --git a/pkg/rpm/Makefile.python34 b/pkg/rpm/Makefile.python34 index 1dc10f9c..83c0bdb6 100644 --- a/pkg/rpm/Makefile.python34 +++ b/pkg/rpm/Makefile.python34 @@ -46,7 +46,7 @@ To check the sample app, run these commands: sudo service unit start cd /usr/share/doc/%{name}/examples - sudo curl -X PUT --data-binary @unit.config --unix-socket /var/run/control.unit.sock http://localhost/config + sudo curl -X PUT --data-binary @unit.config --unix-socket /var/run/unit/control.sock http://localhost/config curl http://localhost:8400/ Online documentation is available at https://unit.nginx.org diff --git a/pkg/rpm/Makefile.python35 b/pkg/rpm/Makefile.python35 index 3e4e0a2e..6f866771 100644 --- a/pkg/rpm/Makefile.python35 +++ b/pkg/rpm/Makefile.python35 @@ -41,7 +41,7 @@ To check the sample app, run these commands: sudo service unit start cd /usr/share/doc/%{name}/examples - sudo curl -X PUT --data-binary @unit.config --unix-socket /var/run/control.unit.sock http://localhost/config + sudo curl -X PUT --data-binary @unit.config --unix-socket /var/run/unit/control.sock http://localhost/config curl http://localhost:8400/ Online documentation is available at https://unit.nginx.org diff --git a/pkg/rpm/Makefile.python36 b/pkg/rpm/Makefile.python36 index d674d8fe..25e33968 100644 --- a/pkg/rpm/Makefile.python36 +++ b/pkg/rpm/Makefile.python36 @@ -46,7 +46,7 @@ To check the sample app, run these commands: sudo service unit start cd /usr/share/doc/%{name}/examples - sudo curl -X PUT --data-binary @unit.config --unix-socket /var/run/control.unit.sock http://localhost/config + sudo curl -X PUT --data-binary @unit.config --unix-socket /var/run/unit/control.sock http://localhost/config curl http://localhost:8400/ Online documentation is available at https://unit.nginx.org diff --git a/pkg/rpm/Makefile.python37 b/pkg/rpm/Makefile.python37 new file mode 100644 index 00000000..ed9462b8 --- /dev/null +++ b/pkg/rpm/Makefile.python37 @@ -0,0 +1,57 @@ +MODULES+= python37 +MODULE_SUFFIX_python37= python3.7 + +MODULE_SUMMARY_python37= Python 3.7 module for NGINX Unit + +MODULE_VERSION_python37= $(VERSION) +MODULE_RELEASE_python37= 1 + +MODULE_CONFARGS_python37= python --config=python3.7-config +MODULE_MAKEARGS_python37= python3.7 +MODULE_INSTARGS_python37= python3.7-install + +MODULE_SOURCES_python37= unit.example-python-app \ + unit.example-python37-config + +ifneq (,$(findstring $(OSVER),opensuse-tumbleweed sles fedora)) +BUILD_DEPENDS_python37= python3-devel +else +BUILD_DEPENDS_python37= python37-devel +endif + +BUILD_DEPENDS+= $(BUILD_DEPENDS_python37) + +define MODULE_PREINSTALL_python37 +%{__mkdir} -p %{buildroot}%{_datadir}/doc/unit-python37/examples/python-app +%{__install} -m 644 -p %{SOURCE100} \ + %{buildroot}%{_datadir}/doc/unit-python37/examples/python-app/wsgi.py +%{__install} -m 644 -p %{SOURCE101} \ + %{buildroot}%{_datadir}/doc/unit-python37/examples/unit.config +endef +export MODULE_PREINSTALL_python37 + +define MODULE_FILES_python37 +%{_libdir}/unit/modules/* +%{_libdir}/unit/debug-modules/* +endef +export MODULE_FILES_python37 + +define MODULE_POST_python37 +cat <<BANNER +---------------------------------------------------------------------- + +The $(MODULE_SUMMARY_python37) has been installed. + +To check the sample app, run these commands: + + sudo service unit start + cd /usr/share/doc/%{name}/examples + sudo curl -X PUT --data-binary @unit.config --unix-socket /var/run/unit/control.sock http://localhost/config + curl http://localhost:8400/ + +Online documentation is available at https://unit.nginx.org + +---------------------------------------------------------------------- +BANNER +endef +export MODULE_POST_python37 diff --git a/pkg/rpm/Makefile.ruby b/pkg/rpm/Makefile.ruby index 92416338..51c2949d 100644 --- a/pkg/rpm/Makefile.ruby +++ b/pkg/rpm/Makefile.ruby @@ -55,7 +55,7 @@ To check the sample app, run these commands: sudo service unit start cd /usr/share/doc/%{name}/examples - sudo curl -X PUT --data-binary @unit.config --unix-socket /var/run/control.unit.sock http://localhost/config + sudo curl -X PUT --data-binary @unit.config --unix-socket /var/run/unit/control.sock http://localhost/config curl http://localhost:8700/ Online documentation is available at https://unit.nginx.org diff --git a/pkg/rpm/rpmbuild/SOURCES/unit.example-python37-config b/pkg/rpm/rpmbuild/SOURCES/unit.example-python37-config new file mode 100644 index 00000000..ada7ae5b --- /dev/null +++ b/pkg/rpm/rpmbuild/SOURCES/unit.example-python37-config @@ -0,0 +1,17 @@ +{ + "applications": { + "example_python": { + "type": "python 3.7", + "user": "nobody", + "processes": 2, + "path": "/usr/share/doc/unit-python37/examples/python-app", + "module": "wsgi" + } + }, + + "listeners": { + "*:8400": { + "application": "example_python" + } + } +} diff --git a/pkg/rpm/rpmbuild/SOURCES/unit.logrotate b/pkg/rpm/rpmbuild/SOURCES/unit.logrotate new file mode 100644 index 00000000..8fb00199 --- /dev/null +++ b/pkg/rpm/rpmbuild/SOURCES/unit.logrotate @@ -0,0 +1,10 @@ +/var/log/unit/*.log { + missingok + nocreate + notifempty + postrotate + if [ -f /var/run/unit/unit.pid ]; then + /bin/kill -SIGUSR1 `cat /var/run/unit/unit.pid` + fi + endscript +} diff --git a/pkg/rpm/rpmbuild/SOURCES/unit.service b/pkg/rpm/rpmbuild/SOURCES/unit.service index 4aaf70cd..f888685f 100644 --- a/pkg/rpm/rpmbuild/SOURCES/unit.service +++ b/pkg/rpm/rpmbuild/SOURCES/unit.service @@ -1,14 +1,26 @@ +# Modifying this file in-place is not recommended, because changes +# will be overwritten during package upgrades. To customize the +# behaviour, run "systemctl edit unit" to create an override unit. + +# For example, to change options given to the unitd binary at startup, +# create an override unit (as is done by systemctl edit) and enter +# the following: + +# [Service] +# Environment="UNITD_OPTIONS=--log /var/log/unit/unit.log --pid /run/unit/unit.pid" + [Unit] Description=NGINX Unit Wants=network-online.target After=network-online.target [Service] -Type=forking -PIDFile=/run/unit.pid -EnvironmentFile=-/etc/sysconfig/unit -ExecStart=/usr/sbin/unitd $UNITD_OPTIONS +Type=simple +Environment="UNITD_OPTIONS=--log /var/log/unit/unit.log --pid /run/unit/unit.pid" +ExecStart=/usr/sbin/unitd $UNITD_OPTIONS --no-daemon ExecReload= +RuntimeDirectory=unit +RuntimeDirectoryMode=0755 [Install] WantedBy=multi-user.target diff --git a/pkg/rpm/rpmbuild/SOURCES/unit.sysconf b/pkg/rpm/rpmbuild/SOURCES/unit.sysconf index 0b28558f..9146bdac 100644 --- a/pkg/rpm/rpmbuild/SOURCES/unit.sysconf +++ b/pkg/rpm/rpmbuild/SOURCES/unit.sysconf @@ -1 +1 @@ -UNITD_OPTIONS="--log /var/log/unit.log --pid /run/unit.pid" +UNITD_OPTIONS="--log /var/log/unit/unit.log --pid /var/run/unit/unit.pid" diff --git a/pkg/rpm/unit.module.spec.in b/pkg/rpm/unit.module.spec.in index 03d4addb..8b8a3433 100644 --- a/pkg/rpm/unit.module.spec.in +++ b/pkg/rpm/unit.module.spec.in @@ -44,6 +44,10 @@ This package contains %%SUMMARY%%. %debug_package %endif +%if 0%{?fedora} +%define _debugsource_template %{nil} +%endif + %prep %setup -qcTn %{name}-%{unit_version} tar --strip-components=1 -zxf %{SOURCE0} @@ -78,6 +82,13 @@ DESTDIR=%{buildroot} make %%MODULE_INSTARGS%% DESTDIR=%{buildroot} make %%MODULE_INSTARGS%% %check +%{__rm} -rf %{buildroot}/usr/src +cd %{bdir} +grep -v 'usr/src' debugfiles.list > debugfiles.list.new && mv debugfiles.list.new debugfiles.list +cat /dev/null > debugsources.list +%if 0%{?suse_version} >= 1500 +cat /dev/null > debugsourcefiles.list +%endif %clean %{__rm} -rf %{buildroot} diff --git a/pkg/rpm/unit.spec.in b/pkg/rpm/unit.spec.in index 1ef02881..05ee79af 100644 --- a/pkg/rpm/unit.spec.in +++ b/pkg/rpm/unit.spec.in @@ -1,25 +1,31 @@ # distribution specific definitions -%define use_systemd (0%{?rhel} && 0%{?rhel} >= 7) || (0%{?suse_version} >= 1315) +%define use_systemd (0%{?rhel} >= 7 || 0%{?fedora} >= 19 || 0%{?suse_version} >= 1315) %define bdir %{_builddir}/%{name}-%{version} %define dotests 0 %if ( 0%{?rhel} == 5 || 0%{?rhel} == 6 ) Requires: initscripts >= 8.36 -BuildRequires: openssl-devel %endif -%if 0%{?rhel} == 7 -Requires: systemd -BuildRequires: systemd-units +%if %{use_systemd} +BuildRequires: systemd +Requires(post): systemd +Requires(preun): systemd +Requires(postun): systemd +%endif + +%if 0%{?rhel}%{?fedora} +BuildRequires: gcc BuildRequires: openssl-devel +%endif + +%if 0%{?rhel} %if 0%{?amzn} == 0 -%define dist .el7 +%define dist .el%{?rhel} %endif %endif %if 0%{?suse_version} >= 1315 -BuildRequires: systemd -Requires: systemd BuildRequires: libopenssl-devel %endif @@ -45,6 +51,7 @@ Source1: unit.service Source2: unit.init Source3: unit.sysconf Source4: unit.example.config +Source5: unit.logrotate BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) @@ -60,6 +67,10 @@ dynamically via an API. %debug_package %endif +%if 0%{?fedora} +%define _debugsource_template %{nil} +%endif + %package devel Summary: NGINX Unit (development files) Version: %%VERSION%% @@ -103,9 +114,16 @@ DESTDIR=%{buildroot} make unitd-install libunit-install %{__mkdir} -p %{buildroot}%{_libdir}/unit/modules %{__mkdir} -p %{buildroot}%{_libdir}/unit/debug-modules %{__mkdir} -p %{buildroot}%{_sharedstatedir}/unit +%{__mkdir} -p %{buildroot}%{_localstatedir}/log/unit +%{__mkdir} -p %{buildroot}%{_localstatedir}/run/unit +%if ! %{use_systemd} %{__mkdir} -p %{buildroot}%{_sysconfdir}/sysconfig %{__install} -m 644 -p %{SOURCE3} \ - %{buildroot}%{_sysconfdir}/sysconfig/unit + %{buildroot}%{_sysconfdir}/sysconfig/unitd +%endif +%{__mkdir} -p %{buildroot}%{_sysconfdir}/logrotate.d +%{__install} -m 644 -p %{SOURCE5} \ + %{buildroot}%{_sysconfdir}/logrotate.d/unit %{__mkdir} -p %{buildroot}%{_sysconfdir}/unit %{__mkdir} -p %{buildroot}%{_datadir}/doc/unit/examples %{__install} -m 644 -p %{SOURCE4} \ @@ -133,6 +151,13 @@ export QA_SKIP_BUILD_ROOT %if %{dotests} cd %{bdir} && make tests && ./build/tests %endif +%{__rm} -rf %{buildroot}/usr/src +cd %{bdir} +grep -v 'usr/src' debugfiles.list > debugfiles.list.new && mv debugfiles.list.new debugfiles.list +cat /dev/null > debugsources.list +%if 0%{?suse_version} >= 1500 +cat /dev/null > debugsourcefiles.list +%endif %clean %{__rm} -rf %{buildroot} @@ -185,11 +210,13 @@ fi %defattr(-,root,root,-) %attr(0755,root,root) %{_sbindir}/unitd %attr(0755,root,root) %{_sbindir}/unitd-debug -%config(noreplace) %{_sysconfdir}/sysconfig/unit %dir %{_sysconfdir}/unit %if %{use_systemd} %{_unitdir}/unit.service +%dir %attr(0755,root,root) %ghost %{_localstatedir}/run/unit %else +%config(noreplace) %{_sysconfdir}/sysconfig/unitd +%dir %attr(0755,root,root) %{_localstatedir}/run/unit %{_initrddir}/unit %endif %dir %{_datadir}/doc/unit @@ -197,6 +224,8 @@ fi %dir %{_libdir}/unit/modules %dir %{_libdir}/unit/debug-modules %dir %{_sharedstatedir}/unit +%dir %attr(0700,root,root) %{_localstatedir}/log/unit +%config(noreplace) %{_sysconfdir}/logrotate.d/%{name} %files devel %{_libdir}/libunit.a |