From c24d2425eb583347722076fe40e76247962e2914 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Manuel=20H=C3=BCsers?= Date: Tue, 2 Jun 2020 04:33:17 +0200 Subject: [PATCH] Move to virtualenv environment Refactored and reformatted entire PKGBUILD Added support for ARM Fix several build errors with patches to the Makefile Fix package using wrong license (The project is using MPL 2.0) --- .SRCINFO | 39 ++++++------ PKGBUILD | 98 ++++++++++++++++++++++------- mozilla-firefox-sync-server.install | 10 ++- 3 files changed, 101 insertions(+), 46 deletions(-) diff --git a/.SRCINFO b/.SRCINFO index 403e325..44f298f 100644 --- a/.SRCINFO +++ b/.SRCINFO @@ -1,30 +1,31 @@ -# Generated by mksrcinfo v8 -# Fri Jun 8 07:29:36 UTC 2018 pkgbase = mozilla-firefox-sync-server pkgdesc = Mozilla Sync Server for built-in Firefox Sync pkgver = 1.8.0 - pkgrel = 1 + pkgrel = 2 url = http://docs.services.mozilla.com/howtos/run-sync-1.5.html install = mozilla-firefox-sync-server.install - arch = any - license = GPL + arch = i686 + arch = x86_64 + arch = arm + arch = armv6h + arch = armv7h + arch = aarch64 + license = MPL2 depends = python2 - depends = python2-pyramid - depends = python2-mozsvc - depends = python2-konfig - depends = python2-configparser - depends = python2-tokenserver - depends = python2-simplejson - depends = python2-paste-deploy - depends = python2-syncstorage - depends = python2-pyramid-hawkauth - depends = python2-tokenlib - depends = python2-sqlalchemy + depends = python2-virtualenv optdepends = uwsgi-plugin-python2: Serve the webapp using uwsgi optdepends = mozilla-firefox-account-server: Run your own firefox account server - backup = etc/webapps/mozilla-firefox-sync-server/syncserver.ini - source = mozilla-firefox-sync-server-1.8.0.tar.gz::https://github.com/mozilla-services/syncserver/archive/1.8.0.tar.gz - sha512sums = 73f7e32e900fac5e8385b2b7b521aed964ec85879283733daf84a8afe194e1775b654074ae19e7bf574a2e41a01a821104a10f4c4794eecacffb7a903814e093 + options = !debug + backup = opt/mozilla-firefox-sync-server/syncserver.ini + source = https://github.com/mozilla-services/syncserver/archive/1.8.0.tar.gz + source = ffsync.service + source = ffsync.tmpfiles + sha256sums = 728206bcffec7a305e97e7cd4d465b3fa56f39f8e1fd55d98e49a866016d61e0 + sha256sums = 8664ad8361d6751aad47e86900270d2efd8b65d520248cd1c164432baba42212 + sha256sums = 462bfdccc672339a03622dbe0a76a2df1b4293de8b240e82fe127a6befaa1a89 + sha384sums = 077129ce69d86cfe683401cb04f2678cdb9eae861f77fb052e97fc4f55d9780b5199259911c7a0d0adaa386e3aad0996 + sha384sums = a7384b5b55b2377ee4445e45bfd0545435c2a6a19730ff4219340e3c6e8a3b51fcb46e4215093df860f9fa99a0b471ab + sha384sums = 236b285f7e390d31cd13a0ac78c524acfbc8a7325d7b0b114b39f69a5963535d5f1f73bdef575728b2f6e81860c4ea16 pkgname = mozilla-firefox-sync-server diff --git a/PKGBUILD b/PKGBUILD index df2693b..acd1b90 100644 --- a/PKGBUILD +++ b/PKGBUILD @@ -1,37 +1,87 @@ -# Maintainer: Jonas Heinrich +# Maintainer: Manuel Hüsers # Contributor: Jonas Heinrich # Contributor: Timothée Ravier pkgname=mozilla-firefox-sync-server pkgver=1.8.0 -pkgrel=1 -pkgdesc="Mozilla Sync Server for built-in Firefox Sync" -arch=('any') +pkgrel=2 +pkgdesc='Mozilla Sync Server for built-in Firefox Sync' +arch=('i686' 'x86_64' 'arm' 'armv6h' 'armv7h' 'aarch64') url='http://docs.services.mozilla.com/howtos/run-sync-1.5.html' -license=('GPL') -depends=('python2' 'python2-pyramid' 'python2-mozsvc' 'python2-konfig' 'python2-configparser' 'python2-tokenserver' - 'python2-simplejson' 'python2-paste-deploy' 'python2-syncstorage' 'python2-pyramid-hawkauth' 'python2-tokenlib' 'python2-sqlalchemy') -source=("${pkgname}-${pkgver}.tar.gz::https://github.com/mozilla-services/syncserver/archive/${pkgver}.tar.gz") -sha512sums=('73f7e32e900fac5e8385b2b7b521aed964ec85879283733daf84a8afe194e1775b654074ae19e7bf574a2e41a01a821104a10f4c4794eecacffb7a903814e093') -backup=('etc/webapps/mozilla-firefox-sync-server/syncserver.ini') -install='mozilla-firefox-sync-server.install' +license=('MPL2') +depends=('python2' 'python2-virtualenv') +options=(!debug) +install="${pkgname}.install" +source=("https://github.com/mozilla-services/syncserver/archive/${pkgver}.tar.gz" + 'ffsync.service' + 'ffsync.tmpfiles') +sha256sums=('728206bcffec7a305e97e7cd4d465b3fa56f39f8e1fd55d98e49a866016d61e0' + '8664ad8361d6751aad47e86900270d2efd8b65d520248cd1c164432baba42212' + '462bfdccc672339a03622dbe0a76a2df1b4293de8b240e82fe127a6befaa1a89') +sha384sums=('077129ce69d86cfe683401cb04f2678cdb9eae861f77fb052e97fc4f55d9780b5199259911c7a0d0adaa386e3aad0996' + 'a7384b5b55b2377ee4445e45bfd0545435c2a6a19730ff4219340e3c6e8a3b51fcb46e4215093df860f9fa99a0b471ab' + '236b285f7e390d31cd13a0ac78c524acfbc8a7325d7b0b114b39f69a5963535d5f1f73bdef575728b2f6e81860c4ea16') +backup=('opt/mozilla-firefox-sync-server/syncserver.ini') optdepends=('uwsgi-plugin-python2: Serve the webapp using uwsgi' - 'mozilla-firefox-account-server: Run your own firefox account server') + 'mozilla-firefox-account-server: Run your own firefox account server') prepare() { - cd "syncserver-${pkgver}" - sed -i 's/tmp\/syncserver.db/var\/lib\/mozilla-firefox-sync-server\/syncserver.db/' syncserver.ini - sed -i 's/^\#sqluri/sqluri/' syncserver.ini + cd "syncserver-${pkgver}" + + # Change default sqlite database location + sed -i "s|/tmp/syncserver.db|/var/lib/ffsync/sync_storage.db|g" syncserver.ini + sed -i "s|^\#sqluri|sqluri|" syncserver.ini + + # Remove obsolete parameter + sed -i "s| --no-site-packages||g" Makefile + + # Remove incompatible setuptools + sed -i "s| distribute||g" Makefile + + # Fix wrong python version being used for virtualenv + sed -i "s|virtualenv|\$(SYSTEMPYTHON) -m virtualenv|g" Makefile +} + +build() { + cd "syncserver-${pkgver}" + make build + + # MySQL support (should already be included) + #local/bin/pip install PyMySQL + + # PostgreSQL support + #local/bin/pip install psycopg2 + + # There is no install target in the Makefile, so let's do some cleaning + rm -rf .git .gitignore Dockerfile Makefile MANIFEST.in README.rst setup.py \ + local/bin/pep8 local/bin/build* local/bin/easy_install* local/bin/pip* \ + local/COMPLETE + + # Remove compiled python files as they may cause issues + find . -name '*.pyc' -delete + + # Manually fix install path + find . -type f -exec sed -i "s|${srcdir}/syncserver-${pkgver}|/opt/${pkgname}|g" {} \; +} + +check() { + cd "syncserver-${pkgver}" + + #make test } package() { - cd "syncserver-${pkgver}" - python2 setup.py install --root "${pkgdir}" - install -dm 755 "${pkgdir}/usr/share/webapps/mozilla-firefox-sync-server" "${pkgdir}/etc/webapps/mozilla-firefox-sync-server" \ - "${pkgdir}/var/lib/mozilla-firefox-sync-server" - cp syncserver.wsgi "${pkgdir}/usr/share/webapps/mozilla-firefox-sync-server/" - cp syncserver.ini "${pkgdir}/etc/webapps/mozilla-firefox-sync-server/" - ln -s /etc/webapps/mozilla-firefox-sync-server/syncserver.ini "${pkgdir}/usr/share/webapps/mozilla-firefox-sync-server/" -} + cd "syncserver-${pkgver}" -# vim: ft=sh syn=sh ts=2 sw=2 et: + # There is no install target in the Makefile, installing manually + install -dm 755 "${pkgdir}"/opt/${pkgname} "${pkgdir}"/var/lib/ffsync + cp -a * "${pkgdir}"/opt/${pkgname} + + # Manually fix permissions + cd "${pkgdir}"/opt/${pkgname} + find . -exec chmod go-w {} \; + find . -type f -exec chmod a+r {} \; + + install -Dm 644 "${srcdir}"/ffsync.service "${pkgdir}"/usr/lib/systemd/system/ffsync.service + install -Dm 644 "${srcdir}"/ffsync.tmpfiles "${pkgdir}"/usr/lib/tmpfiles.d/ffsync.conf +} diff --git a/mozilla-firefox-sync-server.install b/mozilla-firefox-sync-server.install index 2b78fee..03e415d 100644 --- a/mozilla-firefox-sync-server.install +++ b/mozilla-firefox-sync-server.install @@ -1,12 +1,16 @@ post_install() { getent group ffsync &>/dev/null || groupadd -r ffsync >/dev/null getent passwd ffsync &>/dev/null || useradd -r -s /usr/bin/false \ - -g ffsync -G ffsync,http -d /var/lib/mozilla-firefox-sync-server ffsync >/dev/null - chown -R ffsync:ffsync /var/lib/mozilla-firefox-sync-server /etc/webapps/mozilla-firefox-sync-server + -g ffsync -G ffsync,http -d /var/lib/ffsync ffsync >/dev/null + + chown -R ffsync:ffsync /var/lib/ffsync + systemd-tmpfiles --create ffsync.conf } post_update() { - chown -R ffsync:ffsync /var/lib/mozilla-firefox-sync-server /etc/webapps/mozilla-firefox-sync-server + chown -R ffsync:ffsync /var/lib/ffsync + chown -R ffsync:http /run/ffsync + echo ">> Documentation: https://wiki.archlinux.org/index.php/Mozilla_Firefox_Sync_Server" }