Resurrect textproc/pootle and update it to 2.5.1.3

There might be some rough edges with getting it running properly, but
time will tell.

Add UID/GID 158 for pootle.

Differential Revision:	https://reviews.freebsd.org/D1234
This commit is contained in:
Rene Ladan 2015-10-02 15:18:48 +00:00
parent e080d6b4dd
commit 4746f4eedc
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=398437
17 changed files with 346 additions and 0 deletions

1
GIDs
View File

@ -95,6 +95,7 @@ trircd:*:154:
xorp:*:155:
monetdb:*:156:
barman:*:157:
pootle:*:158:
nocat:*:159:
sfs:*:171:
agk:*:172:

1
UIDs
View File

@ -101,6 +101,7 @@ rbldns:*:153:153::0:0:rbldnsd pseudo-user:/nonexistent:/usr/sbin/nologin
trircd:*:154:154::0:0:& user:/usr/local/etc/tr-ircd:/usr/sbin/nologin
monetdb:*:156:156::0:0:MonetDB user:/usr/local/monetdb5:/bin/sh
barman:*:157:157::0:0:Barman user:/var/barman:/bin/sh
pootle:*:158:158::0:0:Pootle User:/var/db/pootle:/usr/sbin/nologin
nocat:*:159:159::0:0:NoCat Daemon:/libexec/nocat:/sbin/nologin
sfs:*:171:171::0:0:Self-Certifying File System:/nonexistent:/usr/sbin/nologin
agk:*:172:172::0:0:AquaGateKeeper:/nonexistent:/nonexistent

View File

@ -1182,6 +1182,7 @@
SUBDIR += po4a
SUBDIR += pocketreader
SUBDIR += pod2mdoc
SUBDIR += pootle
SUBDIR += popup
SUBDIR += popup-stacks
SUBDIR += ppower4

75
textproc/pootle/Makefile Normal file
View File

@ -0,0 +1,75 @@
# Created by: Denis Pokataev <catone@cpan.org>
# $FreeBSD$
PORTNAME= pootle
PORTVERSION= 2.5.1.3
CATEGORIES= textproc
MASTER_SITES= CHEESESHOP
DISTNAME= Pootle-${PORTVERSION}
MAINTAINER= rene@FreeBSD.org
COMMENT= User-friendly web portal for simple translation process
LICENSE= GPLv2
LICENSE_FILE= ${WRKSRC}/LICENSE
RUN_DEPENDS= translate-toolkit>=1.11.0:${PORTSDIR}/textproc/translate-toolkit \
${PYTHON_PKGNAMEPREFIX}south>=0.7.6:${PORTSDIR}/databases/py-south\
${PYTHON_PKGNAMEPREFIX}cssmin>=0.1.4:${PORTSDIR}/www/py-cssmin \
${PYTHON_PKGNAMEPREFIX}lxml>=2.1.4:${PORTSDIR}/devel/py-lxml \
${PYTHON_PKGNAMEPREFIX}argparse>=0:${PORTSDIR}/devel/py-argparse \
${PYTHON_PKGNAMEPREFIX}django-taggit>0.10:${PORTSDIR}/www/py-django-taggit \
${PYTHON_PKGNAMEPREFIX}django-assets>=0.8:${PORTSDIR}/www/py-django-assets \
${PYTHON_PKGNAMEPREFIX}south>=0.7.6:${PORTSDIR}/databases/py-south \
${PYTHON_PKGNAMEPREFIX}django-voting>=0.1:${PORTSDIR}/www/py-django-voting \
${PYTHON_PKGNAMEPREFIX}simplejson>=0:${PORTSDIR}/devel/py-simplejson \
${PYTHON_PKGNAMEPREFIX}diff-match-patch>=0:${PORTSDIR}/textproc/py-diff-match-patch
# actually diff-match-patch is a dependency of translate-toolkit,
# but only this port uses it.
USES= gettext python tar:bzip2
USE_PYTHON= autoplist distutils
USERS= pootle
GROUPS= pootle
PLIST_SUB+= POOTLEUSER="${USERS}" \
POOTLEGROUP="${GROUPS}"
USE_RC_SUBR= pootle
SUB_LIST+= PYTHON_CMD="${PYTHON_CMD}"
PORTDOCS= CREDITS INSTALL LICENSE
OPTIONS_DEFINE= LDAP MEMCACHED MYSQL PGSQL
OPTIONS_DEFAULT=MEMCACHED MYSQL
MEMCACHED_DESC= Use memcached to improve performance
MYSQL_USE= MYSQL=yes
LDAP_RUN_DEPENDS= ${PYTHON_PKGNAMEPREFIX}ldap2>0:${PORTSDIR}/devel/py-ldap2
MEMCACHED_LIB_DEPENDS= libmemcached.so:${PORTSDIR}/databases/libmemcached
MEMCACHED_RUN_DEPENDS= ${PYTHON_PKGNAMEPREFIX}memcached>=1.45:${PORTSDIR}/databases/py-memcached
MYSQL_RUN_DEPENDS= ${PYTHON_PKGNAMEPREFIX}MySQLdb>0:${PORTSDIR}/databases/py-MySQLdb
PGSQL_RUN_DEPENDS= ${PYTHON_PKGNAMEPREFIX}psycopg2>0:${PORTSDIR}/databases/py-pyscopg2
SUBVERSION_RUN_DEPENDS= svn:${PORTSDIR}/devel/subversion
pre-configure:
@${REINPLACE_CMD} -e "s/,<0.11.2//g" \
-e "s/,<0.8//g" \
-e "s/==0.1//g" \
-e "s/,<1.5//g" \
${WRKSRC}/requirements/base.txt
post-install:
${MKDIR} ${STAGEDIR}/${DOCSDIR}
.for docs in ${PORTDOCS}
${INSTALL_DATA} ${WRKSRC}/${docs} ${STAGEDIR}/${DOCSDIR}
.endfor
.include <bsd.port.mk>

2
textproc/pootle/distinfo Normal file
View File

@ -0,0 +1,2 @@
SHA256 (Pootle-2.5.1.3.tar.bz2) = f0303896af702f6bc6cbd7f28fae9478f3f11e804c6f0194c1fb34d2557f4243
SIZE (Pootle-2.5.1.3.tar.bz2) = 6387947

View File

@ -0,0 +1,11 @@
--- pootle/apps/djblets/util/fields.py.orig 2015-06-03 13:30:23 UTC
+++ pootle/apps/djblets/util/fields.py
@@ -30,7 +30,7 @@ from datetime import datetime
from django.conf import settings
from django.core.serializers.json import DjangoJSONEncoder
from django.db import models
-from django.utils import simplejson
+import simplejson
from django.utils.encoding import smart_unicode

View File

@ -0,0 +1,11 @@
--- pootle/apps/pootle_app/views/admin/dashboard.py.orig 2015-06-03 13:30:23 UTC
+++ pootle/apps/pootle_app/views/admin/dashboard.py
@@ -26,7 +26,7 @@ from django.core.cache import cache
from django.http import HttpResponse
from django.shortcuts import render_to_response
from django.template import RequestContext
-from django.utils import simplejson
+import simplejson
from django.utils.translation import ugettext as _
from pootle import depcheck

View File

@ -0,0 +1,11 @@
--- pootle/apps/pootle_misc/forms.py.orig 2015-06-03 13:30:23 UTC
+++ pootle/apps/pootle_misc/forms.py
@@ -79,7 +79,7 @@ def make_search_form(*args, **kwargs):
if sparams_cookie:
import urllib
- from django.utils import simplejson
+ import simplejson
initial_sparams = simplejson.loads(urllib.unquote(sparams_cookie))
if isinstance(initial_sparams, dict):

View File

@ -0,0 +1,12 @@
--- pootle/apps/pootle_misc/util.py.orig 2015-06-03 13:30:23 UTC
+++ pootle/apps/pootle_misc/util.py
@@ -25,7 +25,8 @@ from django.conf import settings
from django.core.cache import cache
from django.core.paginator import Paginator
from django.http import HttpResponseBadRequest
-from django.utils import simplejson, timezone
+from django.utils import timezone
+import simplejson
from django.utils.encoding import force_unicode, iri_to_uri
from django.utils.functional import Promise

View File

@ -0,0 +1,58 @@
--- pootle/apps/pootle_store/models.py.orig 2015-06-03 13:30:23 UTC
+++ pootle/apps/pootle_store/models.py
@@ -32,9 +32,8 @@ from django.conf import settings
from django.core.exceptions import ObjectDoesNotExist
from django.core.files.storage import FileSystemStorage
from django.core.urlresolvers import reverse
-from django.db import models, DatabaseError, IntegrityError
+from django.db import models, transaction, DatabaseError, IntegrityError
from django.db.models.signals import post_delete, post_save, pre_delete
-from django.db.transaction import commit_on_success
from django.utils import timezone, tzinfo
from django.utils.translation import ugettext_lazy as _
@@ -1102,7 +1101,7 @@ class Store(models.Model, base.Translati
return False
- @commit_on_success
+ @transaction.atomic
def parse(self, store=None):
self.clean_stale_lock()
@@ -1154,7 +1153,7 @@ class Store(models.Model, base.Translati
if obsolete_unit:
obsolete_unit.delete()
- @commit_on_success
+ @transaction.atomic
def update(self, update_structure=False, update_translation=False,
store=None, fuzzy=False, only_newer=False, modified_since=0):
"""Update DB with units from file.
@@ -1320,7 +1319,7 @@ class Store(models.Model, base.Translati
# new qualitychecks, let's flush cache
deletefromcache(self, ["getcompletestats"])
- @commit_on_success
+ @transaction.atomic
def update_qualitychecks(self):
logging.debug(u"Updating quality checks for %s", self.pootle_path)
for unit in self.units.iterator():
@@ -1583,7 +1582,7 @@ class Store(models.Model, base.Translati
"""Returns a single unit based on the item number."""
return self.units[item]
- @commit_on_success
+ @transaction.atomic
def mergefile(self, newfile, profile, allownewstrings, suggestions,
notranslate, obsoletemissing):
"""Merges :param:`newfile` with the current store.
@@ -1778,7 +1777,7 @@ class Store(models.Model, base.Translati
self.pending = pending_name
self.save()
- @commit_on_success
+ @transaction.atomic
def import_pending(self):
"""import suggestions from legacy .pending files, into database"""
self.init_pending()

View File

@ -0,0 +1,12 @@
--- pootle/apps/pootle_store/views.py.orig 2015-06-03 13:30:23 UTC
+++ pootle/apps/pootle_store/views.py
@@ -35,7 +35,8 @@ from django.shortcuts import get_object_
from django.template import loader, RequestContext
from django.utils.translation import to_locale, ugettext as _
from django.utils.translation.trans_real import parse_accept_lang_header
-from django.utils import simplejson, timezone
+from django.utils import timezone
+import simplejson
from django.utils.encoding import iri_to_uri
from django.views.decorators.cache import never_cache
from django.views.decorators.http import require_POST

View File

@ -0,0 +1,20 @@
--- pootle/apps/pootle_terminology/views.py.orig 2015-06-03 13:30:23 UTC
+++ pootle/apps/pootle_terminology/views.py
@@ -19,7 +19,7 @@
# Pootle; if not, see <http://www.gnu.org/licenses/>.
from django.conf import settings
-from django.db.transaction import commit_on_success
+from django.db import transaction
from django.shortcuts import render_to_response
from django.template import RequestContext
from django.utils.translation import ugettext as _
@@ -63,7 +63,7 @@ def get_terminology_filename(translation
return 'pootle-terminology.' + translation_project.project.localfiletype
-@commit_on_success
+@transaction.atomic
@get_path_obj
@permission_required('administrate')
def extract(request, translation_project):

View File

@ -0,0 +1,36 @@
--- pootle/apps/registration/models.py.orig 2015-06-03 13:30:23 UTC
+++ pootle/apps/registration/models.py
@@ -1,4 +1,5 @@
import datetime
+import hashlib
import random
import re
@@ -8,7 +9,6 @@ from django.contrib.sites.models import
from django.db import models
from django.db import transaction
from django.template.loader import render_to_string
-from django.utils.hashcompat import sha_constructor
from django.utils.translation import ugettext_lazy as _
@@ -146,7 +146,7 @@ class RegistrationManager(models.Manager
msg.send()
user_registered.send(sender=self.model, user=new_user)
return new_user
- create_inactive_user = transaction.commit_on_success(create_inactive_user)
+ create_inactive_user = transaction.atomic(create_inactive_user)
def create_profile(self, user):
"""
@@ -158,8 +158,8 @@ class RegistrationManager(models.Manager
username and a random salt.
"""
- salt = sha_constructor(str(random.random())).hexdigest()[:5]
- activation_key = sha_constructor(salt+user.email).hexdigest()
+ salt = hashlib.sha1(str(random.random())).hexdigest()[:5]
+ activation_key = hashlib.sha1(salt+user.email).hexdigest()
return self.create(user=user,
activation_key=activation_key)

View File

@ -0,0 +1,11 @@
--- pootle/middleware/captcha.py.orig 2015-06-03 13:30:24 UTC
+++ pootle/middleware/captcha.py
@@ -29,7 +29,7 @@ from django.conf import settings
from django.http import HttpResponse
from django.shortcuts import render_to_response
from django.template import loader, RequestContext
-from django.utils import simplejson
+import simplejson
from django.utils.translation import ugettext as _

View File

@ -0,0 +1,11 @@
--- pootle/middleware/errorpages.py.orig 2015-06-03 13:30:24 UTC
+++ pootle/middleware/errorpages.py
@@ -28,7 +28,7 @@ from django.http import (Http404, HttpRe
HttpResponseServerError)
from django.template import RequestContext
from django.template.loader import render_to_string
-from django.utils import simplejson
+import simplejson
from django.utils.encoding import force_unicode
from django.utils.translation import ugettext as _

View File

@ -0,0 +1,65 @@
#!/bin/sh
#
# $FreeBSD$
#
# PROVIDE: pootle
# REQUIRE: DAEMON
# KEYWORD: shutdown
#
# Add the following lines to /etc/rc.conf to run pootle:
#
# pootle_enable (bool): Set it to "YES" to enable pootle.
# Default is "NO".
# pootle_flags (flags): Set extra flags here. More options in pootle(1)
# Default is empty "".
# pootle_logdir (path): Path to pootle log directory.
# Default is /var/log/pootle
# Empty is log to /dev/null.
# pootle_user (user): Set user to run pootle.
# Default is "%%POOTLEUSER%%".
#
. /etc/rc.subr
name=pootle
rcvar=pootle_enable
load_rc_config $name
: ${pootle_enable:=NO}
: ${pootle_user="%%POOTLEUSER%%"}
: ${pootle_group="%%POOTLEGROUP%%"}
: ${pootle_logdir=/var/log/pootle}
pidfile="%%POOTLERUNDIR%%/pootle.pid"
command_interpreter="%%PYTHON_CMD%%"
required_files="%%PREFIX%%/etc/pootle/localsettings.py"
command="%%PREFIX%%/bin/PootleServer"
start_command=pootle_start_cmd
start_precmd=pootle_start_precmd
pootle_start_cmd()
{
[ -z "${rc_quiet}" ] && echo "Starting ${name}."
/usr/sbin/daemon -p ${pidfile} -u ${pootle_user} ${command} ${pootle_flags} \
>>${pootle_stdout} 2>>${pootle_stderr}
}
pootle_start_precmd()
{
for i in db log run ; do
install -d -o ${pootle_user} -g ${pootle_group} -m 770 /var/${i}/pootle
done
if [ -n "${pootle_logdir}" ] ; then
pootle_stdout="${pootle_logdir}/access.log"
pootle_stderr="${pootle_logdir}/error.log"
else
pootle_stdout="/dev/null"
pootle_stderr="/dev/null"
fi
}
run_rc_command "$1"

View File

@ -0,0 +1,8 @@
Pootle is a user-friendly web portal that makes
the translation process so much simpler.
It allows online translation, work assignment,
gives statistics and allows easy volunteer contribution.
You can run Pootle as an Internet server like
these projects or run your own copy on an Intranet.
WWW: http://translate.sourceforge.net/wiki/pootle/index