Gentoo Archives: gentoo-commits

From: William Hubbs <williamh@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: www-apps/netbox/, www-apps/netbox/files/
Date: Tue, 30 Apr 2019 21:19:21
Message-Id: 1556659148.389ef2c983b62fdce58731e9cfc7c1a10e835d0d.williamh@gentoo
1 commit: 389ef2c983b62fdce58731e9cfc7c1a10e835d0d
2 Author: William Hubbs <william.hubbs <AT> sony <DOT> com>
3 AuthorDate: Tue Apr 30 21:16:57 2019 +0000
4 Commit: William Hubbs <williamh <AT> gentoo <DOT> org>
5 CommitDate: Tue Apr 30 21:19:08 2019 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=389ef2c9
7
8 www-apps/netbox: 2.5.11 bump
9
10 Copyright: Sony Interactive Entertainment Inc.
11 Package-Manager: Portage-2.3.62, Repoman-2.3.12
12 Signed-off-by: William Hubbs <williamh <AT> gentoo.org>
13
14 www-apps/netbox/Manifest | 1 +
15 www-apps/netbox/files/netbox-2.5.11-no-pip.patch | 27 ++++++
16 www-apps/netbox/files/netbox-rqworker.initd | 2 +
17 www-apps/netbox/files/netbox.initd | 2 +
18 www-apps/netbox/netbox-2.5.11.ebuild | 118 +++++++++++++++++++++++
19 5 files changed, 150 insertions(+)
20
21 diff --git a/www-apps/netbox/Manifest b/www-apps/netbox/Manifest
22 index 1b395a70295..2f26f7d2126 100644
23 --- a/www-apps/netbox/Manifest
24 +++ b/www-apps/netbox/Manifest
25 @@ -1 +1,2 @@
26 DIST netbox-2.5.10.tar.gz 2363340 BLAKE2B 9bc946398ac75b585f2bc6fdb01bfb7545c92ccbb239e9ac0309b66be435134a87cde5fcf876cec4c3354e7aedf5af1d9e1976574689dfb0af34404e9c9f907f SHA512 ed71b0efaffd8bad6e53f7b281d1933234161f031110fa901e1b789a964f000f2ff13897685e79193cbee9294c1f50b8c6edef7d0ef6f829a7357640c8034525
27 +DIST netbox-2.5.11.tar.gz 2364831 BLAKE2B e5117b2d4c3f33b231715a8b192e7954dc0611fcb270937c5c8abda3abc9f9925bd7db2c7306847428b5a24014d0c0b07ee404294b389a708d0dc7963c250691 SHA512 dfd19af01bf096ee7d8790981853d7e94d8926a4f0eeb00a061f805d56486670c058752b9a9fb23882b0b8d33e4a2d62f50a35b56c28eb2782be47e6f4b13b7d
28
29 diff --git a/www-apps/netbox/files/netbox-2.5.11-no-pip.patch b/www-apps/netbox/files/netbox-2.5.11-no-pip.patch
30 new file mode 100644
31 index 00000000000..5d1fa595f4e
32 --- /dev/null
33 +++ b/www-apps/netbox/files/netbox-2.5.11-no-pip.patch
34 @@ -0,0 +1,27 @@
35 +diff --git a/upgrade.sh b/upgrade.sh
36 +index 24e79f5b..248e1cb5 100755
37 +--- a/upgrade.sh
38 ++++ b/upgrade.sh
39 +@@ -8,22 +8,6 @@
40 + PYTHON="python3"
41 + PIP="pip3"
42 +
43 +-# TODO: Remove this in v2.6 as it is no longer needed under Python 3
44 +-# Delete stale bytecode
45 +-COMMAND="find . -name \"*.pyc\" -delete"
46 +-echo "Cleaning up stale Python bytecode ($COMMAND)..."
47 +-eval $COMMAND
48 +-
49 +-# Uninstall any Python packages which are no longer needed
50 +-COMMAND="${PIP} uninstall -r old_requirements.txt -y"
51 +-echo "Removing old Python packages ($COMMAND)..."
52 +-eval $COMMAND
53 +-
54 +-# Install any new Python packages
55 +-COMMAND="${PIP} install -r requirements.txt --upgrade"
56 +-echo "Updating required Python packages ($COMMAND)..."
57 +-eval $COMMAND
58 +-
59 + # Apply any database migrations
60 + COMMAND="${PYTHON} netbox/manage.py migrate"
61 + echo "Applying database migrations ($COMMAND)..."
62
63 diff --git a/www-apps/netbox/files/netbox-rqworker.initd b/www-apps/netbox/files/netbox-rqworker.initd
64 index 2973e471e03..54794f26fb9 100644
65 --- a/www-apps/netbox/files/netbox-rqworker.initd
66 +++ b/www-apps/netbox/files/netbox-rqworker.initd
67 @@ -8,4 +8,6 @@ command=/usr/bin/python3
68 command_args="/opt/netbox/netbox/manage.py rqworker"
69 command_user=netbox:netbox
70 directory=/opt/netbox/netbox
71 +error_log=/var/log/netbox/netbox-rcworker.log
72 +output_log=/var/log/netbox/"${RC_SVCNAME}".log
73 supervisor=supervise-daemon
74
75 diff --git a/www-apps/netbox/files/netbox.initd b/www-apps/netbox/files/netbox.initd
76 index d0457a8372f..74e6c3b717f 100644
77 --- a/www-apps/netbox/files/netbox.initd
78 +++ b/www-apps/netbox/files/netbox.initd
79 @@ -7,4 +7,6 @@ command=/usr/bin/gunicorn
80 command_args="-c /etc/netbox/gunicorn_config.py netbox.wsgi"
81 command_user=netbox:netbox
82 directory=/opt/netbox/netbox
83 +error_log=/var/log/netbox/"${RC_SVCNAME}".log
84 +output_log=/var/log/netbox/"${RC_SVCNAME}".log
85 supervisor=supervise-daemon
86
87 diff --git a/www-apps/netbox/netbox-2.5.11.ebuild b/www-apps/netbox/netbox-2.5.11.ebuild
88 new file mode 100644
89 index 00000000000..02a00a2c553
90 --- /dev/null
91 +++ b/www-apps/netbox/netbox-2.5.11.ebuild
92 @@ -0,0 +1,118 @@
93 +# Copyright 1999-2019 Gentoo Authors
94 +# Distributed under the terms of the GNU General Public License v2
95 +
96 +EAPI=7
97 +PYTHON_COMPAT=( python3_6 )
98 +inherit python-single-r1 user readme.gentoo-r1
99 +
100 +DESCRIPTION="IP address and data center infrastructure management tool"
101 +HOMEPAGE="https://github.com/digitalocean/netbox"
102 +SRC_URI="https://github.com/digitalocean/${PN}/archive/v${PV}.tar.gz -> ${P}.tar.gz"
103 +
104 +LICENSE="Apache-2.0"
105 +SLOT="0"
106 +KEYWORDS="~amd64"
107 +IUSE="ldap webhooks"
108 +
109 +RDEPEND=">=dev-python/django-2.2[${PYTHON_USEDEP}]
110 + >=dev-python/django-cors-headers-2.4.0[${PYTHON_USEDEP}]
111 + >=dev-python/django-debug-toolbar-1.11[${PYTHON_USEDEP}]
112 + >=dev-python/django-filter-2.0.0[${PYTHON_USEDEP}]
113 + >=dev-python/django-mptt-0.9.1[${PYTHON_USEDEP}]
114 + >=dev-python/django-tables2-2.0.3[${PYTHON_USEDEP}]
115 + >=dev-python/django-taggit-0.23.0[${PYTHON_USEDEP}]
116 + >=dev-python/django-taggit-serializer-0.1.7[${PYTHON_USEDEP}]
117 + >=dev-python/django-timezone-field-3.0[${PYTHON_USEDEP}]
118 + >=dev-python/djangorestframework-3.9.0[${PYTHON_USEDEP}]
119 + >=dev-python/drf-yasg-1.14.0[${PYTHON_USEDEP},validation]
120 + >=dev-python/graphviz-0.10.1[${PYTHON_USEDEP}]
121 + >=dev-python/jinja-2.10[${PYTHON_USEDEP}]
122 + >=dev-python/markdown-2.6.11[${PYTHON_USEDEP}]
123 + >=dev-python/netaddr-0.7.19[${PYTHON_USEDEP}]
124 + >=dev-python/pillow-5.3.0[${PYTHON_USEDEP}]
125 + >=dev-python/psycopg-2.7.6.1[${PYTHON_USEDEP}]
126 + >=dev-python/py-gfm-0.1.4[${PYTHON_USEDEP}]
127 + >=dev-python/pycryptodome-3.7.2[${PYTHON_USEDEP}]
128 + www-servers/gunicorn[${PYTHON_USEDEP}]
129 + ldap? ( >=dev-python/django-auth-ldap-1.7[${PYTHON_USEDEP}] )
130 + webhooks? ( dev-python/django-rq )"
131 +DEPEND="${RDEPEND}"
132 +
133 +PATCHES=(
134 + "${FILESDIR}"/${P}-no-pip.patch
135 + )
136 +
137 +DISABLE_AUTOFORMATTING=YES
138 +DOC_CONTENTS="
139 +netbox is installed on your system. However, there are some manual steps
140 +you need to complete from the installation guide [1].
141 +
142 +On Gentoo, the configuration files you need to edit are located in
143 +/etc/netbox, not /opt/netbox as shown in the installation guide.
144 +
145 +If this is a new installation, please follow the installation guide
146 +other than this difference. Also, if you need ldap or webhooks, set the
147 +appropriate use flags when you emerge netbox to install the
148 +dependencies.
149 +
150 +Once that is done, you should be able to add the netbox service to the
151 +default runlevel and start it.
152 +
153 +If you have webhooks turned on, you should also add the netbox-rqworker
154 +service to the default runlevel and start it.
155 +
156 +If this is an upgrade, follow these instructions:
157 +
158 +Stop the netbox service. If the netbox-rqworker service is running,
159 +stop it as well.
160 +
161 +Next, run the upgrade script as described in the upgrading guide[2].
162 +
163 +Next, check for new configuration options and set them as appropriate
164 +for your system.
165 +
166 +Next, start the netbox service.
167 +
168 +Finally, if you are using webhooks, start the netbox-rqworker service.
169 +
170 +[1] https://netbox.readthedocs.io/en/stable/installation/
171 +[2] https://netbox.readthedocs.io/en/stable/installation/upgrading/
172 +"
173 +
174 +pkg_setup() {
175 + enewgroup ${PN}
176 + enewuser ${PN} -1 -1 /var/lib/${PN} ${PN}
177 +}
178 +
179 +src_install() {
180 + dodir /opt
181 + cp -a ../${P} "${ED}"/opt
182 + dosym ${P} /opt/netbox
183 +dosym ../../etc/netbox/gunicorn_config.py /opt/netbox/gunicorn_config.py
184 + dosym ../../../../etc/netbox/configuration.py \
185 + /opt/netbox/netbox/netbox/configuration.py
186 + dodir /etc/netbox
187 + insinto /etc/netbox
188 + newins netbox/netbox/configuration.example.py configuration.py
189 + doins "${FILESDIR}"/gunicorn_config.py
190 + fowners -R netbox:netbox /etc/netbox /opt/${P}
191 + fowners -h netbox:netbox /opt/netbox
192 + fperms o= /etc/netbox/configuration.py /etc/netbox/gunicorn_config.py
193 + newinitd "${FILESDIR}"/${PN}.initd ${PN}
194 + use webhooks &&
195 + newinitd "${FILESDIR}"/${PN}-rqworker.initd ${PN}-rqworker
196 + keepdir /var/log/netbox
197 + fowners -R netbox:netbox /var/log/netbox
198 + readme.gentoo_create_doc
199 +}
200 +
201 +pkg_postinst() {
202 + readme.gentoo_print_elog
203 + local r
204 + for r in $REPLACING_VERSIONS; do
205 + if [[ $r = "2.5.10" ]]; then
206 + ewarn "The home directory of the netbox user is now /var/lib/netbox"
207 + ewarn "Please adjust your system."
208 + fi
209 + done
210 +}