Merge branch 'master' of https://github.com/iksaif/euscan
Conflicts: TODO euscanwww/djeuscan/processing/scan/scan_portage.py euscanwww/djeuscan/tasks.py euscanwww/djeuscan/templates/euscan/_package_details.html Signed-off-by: volpino <fox91@anche.no>
This commit is contained in:
commit
48c1eadab4
3
TODO
3
TODO
@ -52,6 +52,9 @@ euscan
|
|||||||
euscanwww
|
euscanwww
|
||||||
---------
|
---------
|
||||||
|
|
||||||
|
- Really fix mails
|
||||||
|
- Add an /about/config page that describe the current config (overlays, stuff in make.conf, euscan default settings, etc..)
|
||||||
|
- Create a rss for "scan world" + packages in GET
|
||||||
- Always keep in db all found versions (when using an API only?). But don't display them if older than current packaged version, except maybe in the "upstream_version" column.
|
- Always keep in db all found versions (when using an API only?). But don't display them if older than current packaged version, except maybe in the "upstream_version" column.
|
||||||
|
|
||||||
### packages
|
### packages
|
||||||
|
@ -292,9 +292,9 @@ def main():
|
|||||||
|
|
||||||
from os.path import basename # To get the short name
|
from os.path import basename # To get the short name
|
||||||
|
|
||||||
output.error(
|
output.eerror(
|
||||||
"The short ebuild name '%s' is ambiguous. Please specify" %
|
"The short ebuild name '%s' is ambiguous. Please specify" %
|
||||||
basename(pkgs[0]),
|
basename(pkgs[0]) +
|
||||||
"one of the above fully-qualified ebuild names instead."
|
"one of the above fully-qualified ebuild names instead."
|
||||||
)
|
)
|
||||||
exit_helper(1)
|
exit_helper(1)
|
||||||
|
@ -97,8 +97,12 @@ class PackagesHandler(AnonymousBaseHandler):
|
|||||||
herd = Herd.objects.get(herd=kwargs['herd'])
|
herd = Herd.objects.get(herd=kwargs['herd'])
|
||||||
packages = Package.objects.for_herd(herd, last_versions=True)
|
packages = Package.objects.for_herd(herd, last_versions=True)
|
||||||
data = {'herd': herd}
|
data = {'herd': herd}
|
||||||
elif 'maintainer_id' in kwargs:
|
elif 'maintainer_id' in kwargs or 'maintainer_email' in kwargs:
|
||||||
maintainer = Maintainer.objects.get(id=kwargs['maintainer_id'])
|
if 'maintainer_id' in kwargs:
|
||||||
|
maintainer = Maintainer.objects.get(id=kwargs['maintainer_id'])
|
||||||
|
elif 'maintainer_email' in kwargs:
|
||||||
|
maintainer = Maintainer.objects.get(email=kwargs['maintainer_email'])
|
||||||
|
|
||||||
packages = Package.objects.for_maintainer(
|
packages = Package.objects.for_maintainer(
|
||||||
maintainer,
|
maintainer,
|
||||||
last_versions=True
|
last_versions=True
|
||||||
|
@ -24,6 +24,8 @@ urlpatterns = patterns('djeuscan.api.views',
|
|||||||
|
|
||||||
url(r'^1.0/packages/by-maintainer/(?P<maintainer_id>\d+)\.(?P<emitter_format>.+)$',
|
url(r'^1.0/packages/by-maintainer/(?P<maintainer_id>\d+)\.(?P<emitter_format>.+)$',
|
||||||
packages_handler, name='api.views.packages'),
|
packages_handler, name='api.views.packages'),
|
||||||
|
url(r'^1.0/packages/by-maintainer/(?P<maintainer_email>[^/]+)\.(?P<emitter_format>.+)$',
|
||||||
|
packages_handler, name='api.views.packages'),
|
||||||
url(r'^1.0/packages/by-herd/(?P<herd>[\@\{\}\w+.-]*)\.(?P<emitter_format>.+)?$',
|
url(r'^1.0/packages/by-herd/(?P<herd>[\@\{\}\w+.-]*)\.(?P<emitter_format>.+)?$',
|
||||||
packages_handler, name='api.views.packages'),
|
packages_handler, name='api.views.packages'),
|
||||||
url(r'^1.0/packages/by-category/(?P<category>[\w+][\w+.-]*)\.(?P<emitter_format>.+)?$',
|
url(r'^1.0/packages/by-category/(?P<category>[\w+][\w+.-]*)\.(?P<emitter_format>.+)?$',
|
||||||
|
@ -146,9 +146,16 @@ class PackageFeed(BaseFeed):
|
|||||||
class MaintainerFeed(BaseFeed):
|
class MaintainerFeed(BaseFeed):
|
||||||
feed_type = Atom1Feed
|
feed_type = Atom1Feed
|
||||||
|
|
||||||
def get_object(self, request, maintainer_id):
|
def get_object(self, request, maintainer_id=None, maintainer_email=None):
|
||||||
|
print maintainer_id, maintainer_email
|
||||||
|
if maintainer_id:
|
||||||
|
obj = get_object_or_404(Maintainer, id=maintainer_id)
|
||||||
|
else:
|
||||||
|
obj = get_object_or_404(Maintainer, email=maintainer_email)
|
||||||
|
|
||||||
|
print obj
|
||||||
return {
|
return {
|
||||||
"obj": get_object_or_404(Maintainer, id=maintainer_id),
|
"obj": obj,
|
||||||
"options": request.GET,
|
"options": request.GET,
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -159,8 +166,7 @@ class MaintainerFeed(BaseFeed):
|
|||||||
return "Last changes for %s" % data["obj"]
|
return "Last changes for %s" % data["obj"]
|
||||||
|
|
||||||
def link(self, data):
|
def link(self, data):
|
||||||
return reverse('djeuscan.views.maintainer',
|
return reverse('djeuscan.views.maintainer', args=[data["obj"].email])
|
||||||
kwargs={'maintainer_id': data["obj"].id})
|
|
||||||
|
|
||||||
def _items(self, data):
|
def _items(self, data):
|
||||||
return VersionLog.objects.for_maintainer(data["obj"]), 50
|
return VersionLog.objects.for_maintainer(data["obj"]), 50
|
||||||
|
@ -114,7 +114,6 @@ def update_counters(fast=False, nolog=False, logger=None):
|
|||||||
package.last_version_upstream_id = last_versions_upstream.get(
|
package.last_version_upstream_id = last_versions_upstream.get(
|
||||||
package.id, default
|
package.id, default
|
||||||
)['id']
|
)['id']
|
||||||
|
|
||||||
package.save()
|
package.save()
|
||||||
|
|
||||||
n_packages_gentoo = int(package.n_packaged == package.n_versions)
|
n_packages_gentoo = int(package.n_packaged == package.n_versions)
|
||||||
|
@ -13,7 +13,6 @@ from django.core.management.color import color_style
|
|||||||
from euscan.version import get_version_type
|
from euscan.version import get_version_type
|
||||||
|
|
||||||
from djeuscan.processing import FakeLogger
|
from djeuscan.processing import FakeLogger
|
||||||
from djeuscan.processing.scan.scan_upstream import scan_upstream
|
|
||||||
from djeuscan.models import Package, Version, VersionLog, Category, Overlay
|
from djeuscan.models import Package, Version, VersionLog, Category, Overlay
|
||||||
|
|
||||||
|
|
||||||
@ -30,6 +29,10 @@ class ScanPortage(object):
|
|||||||
|
|
||||||
self._cache = {'packages': {}, 'versions': {}}
|
self._cache = {'packages': {}, 'versions': {}}
|
||||||
self._overlays = None
|
self._overlays = None
|
||||||
|
self._updated_packages = set()
|
||||||
|
|
||||||
|
def updated_packages(self):
|
||||||
|
return list(self._updated_packages)
|
||||||
|
|
||||||
def cache_hash_package(self, category, name):
|
def cache_hash_package(self, category, name):
|
||||||
return '%s/%s' % (category, name)
|
return '%s/%s' % (category, name)
|
||||||
@ -200,13 +203,14 @@ class ScanPortage(object):
|
|||||||
packages_alive.add("%s/%s" % (cat, pkg))
|
packages_alive.add("%s/%s" % (cat, pkg))
|
||||||
new_version = False
|
new_version = False
|
||||||
for cpv, slot, overlay, overlay_path in data['versions']:
|
for cpv, slot, overlay, overlay_path in data['versions']:
|
||||||
new_version = new_version or self.store_version(
|
obj, created = self.store_version(
|
||||||
package, cpv, slot, overlay, overlay_path
|
package, cpv, slot, overlay, overlay_path
|
||||||
)
|
)
|
||||||
|
new_version = created or new_version
|
||||||
|
|
||||||
# If the package has at least one new version scan upstream for it
|
# If the package has at least one new version scan upstream for it
|
||||||
if new_version and self.upstream:
|
if new_version:
|
||||||
scan_upstream([package], self.purge_versions, self.logger)
|
self._updated_packages.add(package)
|
||||||
|
|
||||||
self.purge_old_packages(current_packages, packages_alive)
|
self.purge_old_packages(current_packages, packages_alive)
|
||||||
self.purge_old_versions()
|
self.purge_old_versions()
|
||||||
@ -269,7 +273,7 @@ class ScanPortage(object):
|
|||||||
# nothing to do (note: it can't be an upstream version because
|
# nothing to do (note: it can't be an upstream version because
|
||||||
# overlay can't be empty here)
|
# overlay can't be empty here)
|
||||||
if not created:
|
if not created:
|
||||||
return False
|
return obj, created
|
||||||
|
|
||||||
# New version created
|
# New version created
|
||||||
self.logger.info('+ [v] %s' % (obj))
|
self.logger.info('+ [v] %s' % (obj))
|
||||||
@ -292,7 +296,7 @@ class ScanPortage(object):
|
|||||||
vtype=obj.vtype,
|
vtype=obj.vtype,
|
||||||
)
|
)
|
||||||
|
|
||||||
return True
|
return obj, created
|
||||||
|
|
||||||
def purge_old_packages(self, packages, alive):
|
def purge_old_packages(self, packages, alive):
|
||||||
if not self.purge_packages:
|
if not self.purge_packages:
|
||||||
@ -349,8 +353,7 @@ def scan_portage(packages=None, category=None, no_log=False, upstream=False,
|
|||||||
logger=logger,
|
logger=logger,
|
||||||
no_log=no_log,
|
no_log=no_log,
|
||||||
purge_packages=purge_packages,
|
purge_packages=purge_packages,
|
||||||
purge_versions=purge_versions,
|
purge_versions=purge_versions
|
||||||
upstream=upstream
|
|
||||||
)
|
)
|
||||||
|
|
||||||
logger.info('Scanning portage tree...')
|
logger.info('Scanning portage tree...')
|
||||||
@ -368,8 +371,10 @@ def scan_portage(packages=None, category=None, no_log=False, upstream=False,
|
|||||||
scan_handler.cache_store_version(version)
|
scan_handler.cache_store_version(version)
|
||||||
logger.info('done')
|
logger.info('done')
|
||||||
|
|
||||||
if not packages:
|
if not packages and category:
|
||||||
scan_handler.scan(category=category)
|
scan_handler.scan(category=category)
|
||||||
|
elif not packages:
|
||||||
|
scan_handler.scan()
|
||||||
else:
|
else:
|
||||||
for pkg in packages:
|
for pkg in packages:
|
||||||
if isinstance(pkg, Package):
|
if isinstance(pkg, Package):
|
||||||
@ -394,3 +399,4 @@ def scan_portage(packages=None, category=None, no_log=False, upstream=False,
|
|||||||
logger.info("+ [o] %s", overlay["overlay"])
|
logger.info("+ [o] %s", overlay["overlay"])
|
||||||
|
|
||||||
logger.info('Done.')
|
logger.info('Done.')
|
||||||
|
return scan_handler.updated_packages()
|
||||||
|
@ -9,7 +9,6 @@ from celery.task import task, group
|
|||||||
#import portage
|
#import portage
|
||||||
|
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from django.core.cache import cache
|
|
||||||
from django.template.loader import render_to_string
|
from django.template.loader import render_to_string
|
||||||
from django.core.mail import send_mail
|
from django.core.mail import send_mail
|
||||||
from django.db.models import Q
|
from django.db.models import Q
|
||||||
@ -80,7 +79,6 @@ def update_counters(fast=False):
|
|||||||
"""
|
"""
|
||||||
Updates counters
|
Updates counters
|
||||||
"""
|
"""
|
||||||
|
|
||||||
logger = update_counters.get_logger()
|
logger = update_counters.get_logger()
|
||||||
logger.info("Updating counters (fast=%s)...", fast)
|
logger.info("Updating counters (fast=%s)...", fast)
|
||||||
misc.update_counters(fast=fast)
|
misc.update_counters(fast=fast)
|
||||||
@ -114,7 +112,7 @@ def scan_metadata(packages=[], category=None, populate=False):
|
|||||||
|
|
||||||
|
|
||||||
@task
|
@task
|
||||||
def scan_portage(packages=[], category=None, upstream=True,
|
def scan_portage(packages=None, category=None,
|
||||||
no_log=False, purge_packages=False,
|
no_log=False, purge_packages=False,
|
||||||
purge_versions=False, prefetch=False):
|
purge_versions=False, prefetch=False):
|
||||||
"""
|
"""
|
||||||
@ -131,17 +129,15 @@ def scan_portage(packages=[], category=None, upstream=True,
|
|||||||
else:
|
else:
|
||||||
logger.info("Starting portage scan...")
|
logger.info("Starting portage scan...")
|
||||||
|
|
||||||
scan.scan_portage(
|
return scan.scan_portage(
|
||||||
packages=packages,
|
packages=packages,
|
||||||
category=category,
|
category=category,
|
||||||
upstream=upstream,
|
|
||||||
no_log=no_log,
|
no_log=no_log,
|
||||||
purge_packages=purge_packages,
|
purge_packages=purge_packages,
|
||||||
purge_versions=purge_versions,
|
purge_versions=purge_versions,
|
||||||
prefetch=prefetch,
|
prefetch=prefetch,
|
||||||
logger=logger,
|
logger=logger,
|
||||||
)
|
)
|
||||||
return True
|
|
||||||
|
|
||||||
|
|
||||||
@task
|
@task
|
||||||
@ -181,9 +177,17 @@ def update_portage(packages=None):
|
|||||||
|
|
||||||
# Workaround for celery bug when chaining groups
|
# Workaround for celery bug when chaining groups
|
||||||
update_portage_trees()
|
update_portage_trees()
|
||||||
scan_portage(packages=[], purge_packages=True, purge_versions=True,
|
updated_packages = scan_portage(
|
||||||
prefetch=True)
|
packages=None,
|
||||||
scan_metadata(packages=[], populate=True)
|
purge_packages=True,
|
||||||
|
purge_versions=True,
|
||||||
|
prefetch=True
|
||||||
|
)
|
||||||
|
scan_metadata(packages=None, populate=True)
|
||||||
|
if updated_packages:
|
||||||
|
group_chunks(scan_upstream, updated_packages,
|
||||||
|
settings.TASKS_UPSTREAM_GROUPS,
|
||||||
|
purge_versions=True)()
|
||||||
update_counters(fast=False)
|
update_counters(fast=False)
|
||||||
|
|
||||||
""" Currently broken
|
""" Currently broken
|
||||||
@ -236,20 +240,12 @@ def scan_package_user(package):
|
|||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
||||||
@task
|
@task(rate_limit="1/m")
|
||||||
def consume_refresh_queue(locked=False):
|
def consume_refresh_queue(locked=False):
|
||||||
"""
|
"""
|
||||||
Satisfies user requests for package refreshing, runs every minute
|
Satisfies user requests for package refreshing, runs every minute
|
||||||
"""
|
"""
|
||||||
LOCK_ID = 'lock-consume-refresh-queue'
|
|
||||||
unlock = lambda: cache.delete(LOCK_ID)
|
|
||||||
lock = lambda: cache.add(LOCK_ID, True, 120)
|
|
||||||
|
|
||||||
logger = consume_refresh_queue.get_logger()
|
logger = consume_refresh_queue.get_logger()
|
||||||
|
|
||||||
if not locked and not lock():
|
|
||||||
return
|
|
||||||
|
|
||||||
logger.info('Consuming package refresh request queue...')
|
logger.info('Consuming package refresh request queue...')
|
||||||
|
|
||||||
try:
|
try:
|
||||||
@ -259,16 +255,14 @@ def consume_refresh_queue(locked=False):
|
|||||||
scan_package_user.delay(pkg)
|
scan_package_user.delay(pkg)
|
||||||
logger.info('Selected: %s' % pkg)
|
logger.info('Selected: %s' % pkg)
|
||||||
except IndexError:
|
except IndexError:
|
||||||
pass
|
return
|
||||||
finally:
|
|
||||||
unlock()
|
|
||||||
|
|
||||||
if RefreshPackageQuery.objects.count():
|
if RefreshPackageQuery.objects.count():
|
||||||
logger.info('Restarting myself in 60s')
|
logger.info('Restarting myself in 60s')
|
||||||
lock()
|
|
||||||
consume_refresh_queue.apply_async(
|
consume_refresh_queue.apply_async(
|
||||||
kwargs={'locked': True}, countdown=60
|
kwargs={'locked': True}, countdown=60
|
||||||
)
|
)
|
||||||
|
return True
|
||||||
|
|
||||||
|
|
||||||
@task(max_retries=10, default_retry_delay=10 * 60)
|
@task(max_retries=10, default_retry_delay=10 * 60)
|
||||||
@ -280,6 +274,7 @@ def send_user_email(address, subject, text):
|
|||||||
)
|
)
|
||||||
except Exception, exc:
|
except Exception, exc:
|
||||||
raise send_user_email.retry(exc=exc)
|
raise send_user_email.retry(exc=exc)
|
||||||
|
return True
|
||||||
|
|
||||||
|
|
||||||
@task
|
@task
|
||||||
@ -322,6 +317,7 @@ def process_emails(profiles, only_if_vlogs=False):
|
|||||||
|
|
||||||
profile.last_email = now
|
profile.last_email = now
|
||||||
profile.save(force_update=True)
|
profile.save(force_update=True)
|
||||||
|
return True
|
||||||
|
|
||||||
|
|
||||||
@task
|
@task
|
||||||
@ -336,6 +332,7 @@ def send_update_email():
|
|||||||
settings.TASKS_EMAIL_GROUPS,
|
settings.TASKS_EMAIL_GROUPS,
|
||||||
only_if_vlogs=True
|
only_if_vlogs=True
|
||||||
)()
|
)()
|
||||||
|
return True
|
||||||
|
|
||||||
|
|
||||||
@task
|
@task
|
||||||
@ -345,6 +342,7 @@ def send_weekly_email():
|
|||||||
email_activated=True
|
email_activated=True
|
||||||
)
|
)
|
||||||
group_chunks(process_emails, profiles, settings.TASKS_EMAIL_GROUPS)()
|
group_chunks(process_emails, profiles, settings.TASKS_EMAIL_GROUPS)()
|
||||||
|
return True
|
||||||
|
|
||||||
|
|
||||||
@task
|
@task
|
||||||
@ -354,7 +352,7 @@ def send_monthly_email():
|
|||||||
email_activated=True
|
email_activated=True
|
||||||
)
|
)
|
||||||
group_chunks(process_emails, profiles, settings.TASKS_EMAIL_GROUPS)()
|
group_chunks(process_emails, profiles, settings.TASKS_EMAIL_GROUPS)()
|
||||||
|
return True
|
||||||
|
|
||||||
admin_tasks = [
|
admin_tasks = [
|
||||||
regen_rrds,
|
regen_rrds,
|
||||||
|
@ -18,7 +18,7 @@
|
|||||||
{% for maintainer in maintainers %}
|
{% for maintainer in maintainers %}
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
<a href="{% url "maintainer" maintainer.maintainers__id %}">
|
<a href="{% url "maintainer" maintainer.maintainers__email %}">
|
||||||
{% if maintainer.maintainers__name != maintainer.maintainers__email %}
|
{% if maintainer.maintainers__name != maintainer.maintainers__email %}
|
||||||
{{ maintainer.maintainers__name }} <{{ maintainer.maintainers__email }}>
|
{{ maintainer.maintainers__name }} <{{ maintainer.maintainers__email }}>
|
||||||
{% else %}
|
{% else %}
|
||||||
@ -31,8 +31,8 @@
|
|||||||
|
|
||||||
{% if extras %}
|
{% if extras %}
|
||||||
<td>
|
<td>
|
||||||
<img src="{% url "chart_maintainer" maintainer.maintainers__id 'packages-monthly-small' %}" />
|
<img src="{% url "chart_maintainer" maintainer.maintainers__email 'packages-monthly-small' %}" />
|
||||||
<img src="{% url "chart_maintainer" maintainer.maintainers__id 'versions-monthly-small' %}" />
|
<img src="{% url "chart_maintainer" maintainer.maintainers__email 'versions-monthly-small' %}" />
|
||||||
</td>
|
</td>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
|
@ -33,12 +33,12 @@
|
|||||||
{% for maintainer in package.maintainers.all %}
|
{% for maintainer in package.maintainers.all %}
|
||||||
<p>
|
<p>
|
||||||
{% if maintainer.name != maintainer.email %}
|
{% if maintainer.name != maintainer.email %}
|
||||||
<a href="{% url "maintainer" maintainer.id %}">
|
<a href="{% url "maintainer" maintainer.email %}">
|
||||||
{{ maintainer.name }}
|
{{ maintainer.name }}
|
||||||
</a>
|
</a>
|
||||||
<{{ maintainer.email }}>
|
<{{ maintainer.email }}>
|
||||||
{% else %}
|
{% else %}
|
||||||
<a href="{% url "maintainer" maintainer.id %}">
|
<a href="{% url "maintainer" maintainer.email %}">
|
||||||
{{ maintainer.email }}
|
{{ maintainer.email }}
|
||||||
</a>
|
</a>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
@ -75,7 +75,7 @@
|
|||||||
Hot maintainers:
|
Hot maintainers:
|
||||||
<ul>
|
<ul>
|
||||||
{% for c in maintainers|slice:":3" %}
|
{% for c in maintainers|slice:":3" %}
|
||||||
<li><a href="{% url "maintainer" c.maintainers__id %}">{{ c.maintainers__name }}</a> ({{ c.n_versions|sub:c.n_packaged|sub:c.n_overlay }})</li>
|
<li><a href="{% url "maintainer" c.maintainers__email %}">{{ c.maintainers__name }}</a> ({{ c.n_versions|sub:c.n_packaged|sub:c.n_overlay }})</li>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</ul>
|
</ul>
|
||||||
</li>
|
</li>
|
||||||
|
@ -11,7 +11,7 @@
|
|||||||
{{ block.super }}
|
{{ block.super }}
|
||||||
<li>
|
<li>
|
||||||
<img src="{{ STATIC_URL }}/img/feed.png" alt="feed" />
|
<img src="{{ STATIC_URL }}/img/feed.png" alt="feed" />
|
||||||
<a title="{{ maintainer.name }} Feed" href="{% url "maintainer_feed" maintainer.id %}">
|
<a title="{{ maintainer.name }} Feed" href="{% url "maintainer_feed" maintainer.email %}">
|
||||||
{{ maintainer.name|truncatechars:15 }}
|
{{ maintainer.name|truncatechars:15 }}
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
@ -22,10 +22,10 @@
|
|||||||
Maintainer: {{ maintainer.name }} <{{ maintainer.email }}>
|
Maintainer: {{ maintainer.name }} <{{ maintainer.email }}>
|
||||||
{% if user.is_authenticated %}
|
{% if user.is_authenticated %}
|
||||||
<span class="pull-right">
|
<span class="pull-right">
|
||||||
<button class="btn favourite-button {% if favourited %}hide{% endif %}" data-url="{% url "favourite_maintainer" maintainer.id %}">
|
<button class="btn favourite-button {% if favourited %}hide{% endif %}" data-url="{% url "favourite_maintainer" maintainer.email %}">
|
||||||
<img src="{{ STATIC_URL}}/img/watch-icon.png" alt="Watch" />
|
<img src="{{ STATIC_URL}}/img/watch-icon.png" alt="Watch" />
|
||||||
</button>
|
</button>
|
||||||
<button class="btn unfavourite-button {% if not favourited %}hide{% endif %}" data-url="{% url "unfavourite_maintainer" maintainer.id %}">
|
<button class="btn unfavourite-button {% if not favourited %}hide{% endif %}" data-url="{% url "unfavourite_maintainer" maintainer.email %}">
|
||||||
<img src="{{ STATIC_URL}}/img/unwatch-icon.png" alt="Unwatch" />
|
<img src="{{ STATIC_URL}}/img/unwatch-icon.png" alt="Unwatch" />
|
||||||
</button>
|
</button>
|
||||||
</span>
|
</span>
|
||||||
@ -37,19 +37,19 @@
|
|||||||
<h3>Statistics</h3>
|
<h3>Statistics</h3>
|
||||||
<h4>Current statistics</h4>
|
<h4>Current statistics</h4>
|
||||||
<p>
|
<p>
|
||||||
<img alt="pie versions" src="{% url "chart_maintainer" maintainer.id 'pie-versions' %}" />
|
<img alt="pie versions" src="{% url "chart_maintainer" maintainer.email 'pie-versions' %}" />
|
||||||
<img alt="pie packages" src="{% url "chart_maintainer" maintainer.id 'pie-packages' %}" />
|
<img alt="pie packages" src="{% url "chart_maintainer" maintainer.email 'pie-packages' %}" />
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<h4>All Time</h4>
|
<h4>All Time</h4>
|
||||||
<p>
|
<p>
|
||||||
<img alt="version weekly" src="{% url "chart_maintainer" maintainer.id 'versions-weekly' %}" />
|
<img alt="version weekly" src="{% url "chart_maintainer" maintainer.email 'versions-weekly' %}" />
|
||||||
<img alt="versions monthly" src="{% url "chart_maintainer" maintainer.id 'versions-monthly' %}" />
|
<img alt="versions monthly" src="{% url "chart_maintainer" maintainer.email 'versions-monthly' %}" />
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
<img alt="packages weekly" src="{% url "chart_maintainer" maintainer.id 'packages-weekly' %}" />
|
<img alt="packages weekly" src="{% url "chart_maintainer" maintainer.email 'packages-weekly' %}" />
|
||||||
<img alt="packages monthly" src="{% url "chart_maintainer" maintainer.id 'packages-monthly' %}" />
|
<img alt="packages monthly" src="{% url "chart_maintainer" maintainer.email 'packages-monthly' %}" />
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
@ -77,9 +77,9 @@ $(document).ready(function () {
|
|||||||
<div class="menu rounded notfirst-menu">
|
<div class="menu rounded notfirst-menu">
|
||||||
<dl>
|
<dl>
|
||||||
<dt>Versions</dt>
|
<dt>Versions</dt>
|
||||||
<dd><img alt="versions" src="{% url "chart_maintainer" maintainer.id 'versions-monthly-small' %}" /></dd>
|
<dd><img alt="versions" src="{% url "chart_maintainer" maintainer.email 'versions-monthly-small' %}" /></dd>
|
||||||
<dt>Packages</dt>
|
<dt>Packages</dt>
|
||||||
<dd><img alt="packages" src="{% url "chart_maintainer" maintainer.id 'packages-monthly-small' %}" /></dd>
|
<dd><img alt="packages" src="{% url "chart_maintainer" maintainer.email 'packages-monthly-small' %}" /></dd>
|
||||||
</dl>
|
</dl>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@ -55,16 +55,13 @@ herds_patterns = patterns('djeuscan.views',
|
|||||||
url(r'^$', 'herds', name="herds"),
|
url(r'^$', 'herds', name="herds"),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
prefix = '^((?P<maintainer_id>\d+)|(?P<maintainer_email>[^/]+))'
|
||||||
maintainers_patterns = patterns('djeuscan.views',
|
maintainers_patterns = patterns('djeuscan.views',
|
||||||
url(r'^(?P<maintainer_id>\d+)/(view/)?$', 'maintainer', name="maintainer"),
|
url(prefix + r'/(view/)?$', 'maintainer', name="maintainer"),
|
||||||
url(r'^(?P<maintainer_id>\d+)/feed/$', MaintainerFeed(),
|
url(prefix + r'/feed/$', MaintainerFeed(), name='maintainer_feed'),
|
||||||
name='maintainer_feed'),
|
url(prefix + r'/charts/(?P<chart>[\w\-]+).png$', 'chart_maintainer', name="chart_maintainer"),
|
||||||
url(r'^(?P<maintainer_id>\d+)/charts/(?P<chart>[\w\-]+).png$',
|
url(prefix + r'/favourite/$', 'favourite_maintainer', name="favourite_maintainer"),
|
||||||
'chart_maintainer', name="chart_maintainer"),
|
url(prefix + r'/unfavourite/$', 'unfavourite_maintainer', name="unfavourite_maintainer"),
|
||||||
url(r'^(?P<maintainer_id>\d+)/favourite/$',
|
|
||||||
'favourite_maintainer', name="favourite_maintainer"),
|
|
||||||
url(r'^(?P<maintainer_id>\d+)/unfavourite/$',
|
|
||||||
'unfavourite_maintainer', name="unfavourite_maintainer"),
|
|
||||||
url(r'^$', 'maintainers', name="maintainers"),
|
url(r'^$', 'maintainers', name="maintainers"),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -122,9 +122,15 @@ def maintainers(request):
|
|||||||
return {'maintainers': maintainers, 'last_scan': last_scan}
|
return {'maintainers': maintainers, 'last_scan': last_scan}
|
||||||
|
|
||||||
|
|
||||||
|
def get_maintainer_or_404(id=None, email=None):
|
||||||
|
if id:
|
||||||
|
return get_object_or_404(Maintainer, pk=id)
|
||||||
|
else:
|
||||||
|
return get_object_or_404(Maintainer, email=email)
|
||||||
|
|
||||||
@render_to('euscan/maintainer.html')
|
@render_to('euscan/maintainer.html')
|
||||||
def maintainer(request, maintainer_id):
|
def maintainer(request, maintainer_id=None, maintainer_email=None):
|
||||||
maintainer = get_object_or_404(Maintainer, pk=maintainer_id)
|
maintainer = get_maintainer_or_404(maintainer_id, maintainer_email)
|
||||||
packages = Package.objects.for_maintainer(maintainer, last_versions=True)
|
packages = Package.objects.for_maintainer(maintainer, last_versions=True)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
@ -337,10 +343,10 @@ def chart(request, **kwargs):
|
|||||||
|
|
||||||
chart = kwargs['chart'] if 'chart' in kwargs else None
|
chart = kwargs['chart'] if 'chart' in kwargs else None
|
||||||
|
|
||||||
if 'maintainer_id' in kwargs:
|
if 'maintainer_id' in kwargs or 'maintainer_email' in kwargs:
|
||||||
kwargs['maintainer'] = get_object_or_404(
|
kwargs['maintainer'] = get_maintainer_or_404(
|
||||||
Maintainer,
|
kwargs.get('maintainer_id'),
|
||||||
id=kwargs['maintainer_id']
|
kwargs.get('maintainer_email')
|
||||||
)
|
)
|
||||||
if 'herd' in kwargs:
|
if 'herd' in kwargs:
|
||||||
kwargs['herd'] = get_object_or_404(Herd, herd=kwargs['herd'])
|
kwargs['herd'] = get_object_or_404(Herd, herd=kwargs['herd'])
|
||||||
@ -550,8 +556,8 @@ def unfavourite_herd(request, herd):
|
|||||||
@login_required
|
@login_required
|
||||||
@require_POST
|
@require_POST
|
||||||
@ajax_request
|
@ajax_request
|
||||||
def favourite_maintainer(request, maintainer_id):
|
def favourite_maintainer(request, maintainer_id=None, maintainer_email=None):
|
||||||
obj = get_object_or_404(Maintainer, pk=maintainer_id)
|
obj = get_maintainer_or_404(maintainer_id, maintainer_email)
|
||||||
get_profile(request.user).maintainers.add(obj)
|
get_profile(request.user).maintainers.add(obj)
|
||||||
return {"success": True}
|
return {"success": True}
|
||||||
|
|
||||||
@ -559,8 +565,8 @@ def favourite_maintainer(request, maintainer_id):
|
|||||||
@login_required
|
@login_required
|
||||||
@require_POST
|
@require_POST
|
||||||
@ajax_request
|
@ajax_request
|
||||||
def unfavourite_maintainer(request, maintainer_id):
|
def unfavourite_maintainer(request, maintainer_id=None, maintainer_email=None):
|
||||||
maintainer = get_object_or_404(Maintainer, pk=maintainer_id)
|
obj = get_maintainer_or_404(maintainer_id, maintainer_email)
|
||||||
get_profile(request.user).maintainers.remove(maintainer)
|
get_profile(request.user).maintainers.remove(maintainer)
|
||||||
return {"success": True}
|
return {"success": True}
|
||||||
|
|
||||||
|
6
euscanwww/euscanwww/captcha/__init__.py
Normal file
6
euscanwww/euscanwww/captcha/__init__.py
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
from registration.backends.default import DefaultBackend
|
||||||
|
from forms import RegistrationFormCaptcha
|
||||||
|
|
||||||
|
class CaptchaDefaultBackend(DefaultBackend):
|
||||||
|
def get_form_class(self, request):
|
||||||
|
return RegistrationFormCaptcha
|
5
euscanwww/euscanwww/captcha/forms.py
Normal file
5
euscanwww/euscanwww/captcha/forms.py
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
from captcha.fields import ReCaptchaField
|
||||||
|
from registration.forms import RegistrationForm
|
||||||
|
|
||||||
|
class RegistrationFormCaptcha(RegistrationForm):
|
||||||
|
captcha = ReCaptchaField(attrs={'theme': 'white'})
|
12
euscanwww/euscanwww/captcha/urls.py
Normal file
12
euscanwww/euscanwww/captcha/urls.py
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
from django.conf.urls.defaults import patterns, url
|
||||||
|
|
||||||
|
from registration.views import register
|
||||||
|
|
||||||
|
urlpatterns = patterns('',
|
||||||
|
url(
|
||||||
|
r'^register/$',
|
||||||
|
register,
|
||||||
|
{'backend': 'euscanwww.captcha.CaptchaDefaultBackend'},
|
||||||
|
name='registration_register'
|
||||||
|
),
|
||||||
|
)
|
@ -267,3 +267,4 @@ except ImportError, ex:
|
|||||||
os.environ['ROOT'] = PORTAGE_ROOT
|
os.environ['ROOT'] = PORTAGE_ROOT
|
||||||
os.environ['PORTAGE_CONFIGROOT'] = PORTAGE_CONFIGROOT
|
os.environ['PORTAGE_CONFIGROOT'] = PORTAGE_CONFIGROOT
|
||||||
os.environ['EIX_CACHEFILE'] = EIX_CACHEFILE
|
os.environ['EIX_CACHEFILE'] = EIX_CACHEFILE
|
||||||
|
os.environ['http_proxy'] = '127.0.0.1:8123'
|
||||||
|
@ -8,7 +8,7 @@ urlpatterns = patterns('',
|
|||||||
url(r'^', include('djeuscan.urls')),
|
url(r'^', include('djeuscan.urls')),
|
||||||
|
|
||||||
url(r'^admin/', include(admin.site.urls)),
|
url(r'^admin/', include(admin.site.urls)),
|
||||||
url(r'^accounts/', include('captcha.backends.default.urls')),
|
url(r'^accounts/', include('euscanwww.captcha.urls')),
|
||||||
url(r'^accounts/', include('registration.backends.default.urls')),
|
url(r'^accounts/', include('registration.backends.default.urls')),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -79,11 +79,12 @@ ROBOTS_TXT_BLACKLIST_DOMAINS = [
|
|||||||
'(.*)sourceforge(.*)',
|
'(.*)sourceforge(.*)',
|
||||||
'(.*)github.com',
|
'(.*)github.com',
|
||||||
'(.*)berlios(.*)',
|
'(.*)berlios(.*)',
|
||||||
'(.*)qt.nokia.com(.*)',
|
'(.*)qt\.nokia\.com(.*)',
|
||||||
'(.*)chromium.org(.*)',
|
'(.*)chromium\.org(.*)',
|
||||||
'(.*)nodejs.org(.*)',
|
'(.*)nodejs\.org(.*)',
|
||||||
'(.*)download.mono-project.com(.*)',
|
'(.*)download\.mono-project\.com(.*)',
|
||||||
'(.*)fedorahosted.org(.*)',
|
'(.*)fedorahosted\.org(.*)',
|
||||||
|
'(.*)download\.tuxfamily\.org(.*)',
|
||||||
]
|
]
|
||||||
|
|
||||||
from out import EuscanOutput
|
from out import EuscanOutput
|
||||||
|
@ -16,7 +16,14 @@ berlios_regex = r"mirror://berlios/([^/]+)/([^/]+)"
|
|||||||
|
|
||||||
|
|
||||||
def can_handle(pkg, url=None):
|
def can_handle(pkg, url=None):
|
||||||
return url and re.search(berlios_regex, url)
|
if not url:
|
||||||
|
return False
|
||||||
|
|
||||||
|
cp, ver, rev = portage.pkgsplit(pkg.cpv)
|
||||||
|
if ver not in url:
|
||||||
|
return False
|
||||||
|
|
||||||
|
return re.search(berlios_regex, url)
|
||||||
|
|
||||||
|
|
||||||
def scan_url(pkg, url, options):
|
def scan_url(pkg, url, options):
|
||||||
|
@ -70,6 +70,7 @@ def scan_html(data, url, pattern):
|
|||||||
match.group(0))
|
match.group(0))
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
return results
|
return results
|
||||||
|
|
||||||
|
|
||||||
|
@ -14,8 +14,14 @@ package_name_regex = r"http://(.+).googlecode.com/files/.+"
|
|||||||
|
|
||||||
|
|
||||||
def can_handle(pkg, url=None):
|
def can_handle(pkg, url=None):
|
||||||
return url and re.match(package_name_regex, url)
|
if not url:
|
||||||
|
return False
|
||||||
|
|
||||||
|
cp, ver, rev = portage.pkgsplit(pkg.cpv)
|
||||||
|
if ver not in url:
|
||||||
|
return False
|
||||||
|
|
||||||
|
return re.match(package_name_regex, url)
|
||||||
|
|
||||||
def scan_url(pkg, url, options):
|
def scan_url(pkg, url, options):
|
||||||
output.einfo("Using Google Code handler")
|
output.einfo("Using Google Code handler")
|
||||||
|
@ -12,7 +12,14 @@ PRIORITY = 90
|
|||||||
|
|
||||||
|
|
||||||
def can_handle(pkg, url=None):
|
def can_handle(pkg, url=None):
|
||||||
return url and "mirror://sourceforge/" in url
|
if not url:
|
||||||
|
return False
|
||||||
|
|
||||||
|
cp, ver, rev = portage.pkgsplit(pkg.cpv)
|
||||||
|
if ver not in url:
|
||||||
|
return False
|
||||||
|
|
||||||
|
return "mirror://sourceforge/" in url
|
||||||
|
|
||||||
|
|
||||||
def scan_url(pkg, url, options):
|
def scan_url(pkg, url, options):
|
||||||
|
@ -373,27 +373,28 @@ def tryurl(fileurl, template):
|
|||||||
|
|
||||||
def regex_from_template(template):
|
def regex_from_template(template):
|
||||||
# Escape
|
# Escape
|
||||||
template = re.escape(template)
|
regexp = re.escape(template)
|
||||||
|
|
||||||
# Unescape specific stuff
|
# Unescape specific stuff
|
||||||
template = template.replace('\$\{', '${')
|
regexp = regexp.replace('\$\{', '${')
|
||||||
template = template.replace('\}', '}')
|
regexp = regexp.replace('\}', '}')
|
||||||
template = template.replace('}\.$', '}.$')
|
regexp = regexp.replace('}\.$', '}.$')
|
||||||
|
|
||||||
# Replace ${\d+}
|
# Replace ${\d+}
|
||||||
#template = template.replace('${0}', r'([\d]+?)')
|
#regexp = regexp.replace('${0}', r'([\d]+?)')
|
||||||
template = re.sub(r'(\$\{\d+\}(\.?))+', r'([\w\.]+?)', template)
|
regexp = re.sub(r'(\$\{\d+\}(\.?))+', r'([\w\.]+?)', regexp)
|
||||||
|
|
||||||
#template = re.sub(r'(\$\{\d+\}\.?)+', r'([\w]+?)', template)
|
#regexp = re.sub(r'(\$\{\d+\}\.?)+', r'([\w]+?)', regexp)
|
||||||
#template = re.sub(r'(\$\{\d+\}\.+)+', '(.+?)\.', template)
|
#regexp = re.sub(r'(\$\{\d+\}\.+)+', '(.+?)\.', regexp)
|
||||||
#template = re.sub(r'(\$\{\d+\})+', '(.+?)', template)
|
#regexp = re.sub(r'(\$\{\d+\})+', '(.+?)', regexp)
|
||||||
|
|
||||||
# Full version
|
# Full version
|
||||||
template = template.replace('${PV}', _v)
|
regexp = regexp.replace('${PV}', _v)
|
||||||
|
|
||||||
# End
|
# End
|
||||||
template = template + r'/?$'
|
regexp = regexp + r'/?$'
|
||||||
return template
|
|
||||||
|
return regexp
|
||||||
|
|
||||||
|
|
||||||
def basedir_from_template(template):
|
def basedir_from_template(template):
|
||||||
@ -417,7 +418,7 @@ def generate_scan_paths(url):
|
|||||||
path = prefix + ":/"
|
path = prefix + ":/"
|
||||||
for chunk in chunks:
|
for chunk in chunks:
|
||||||
if '${' in chunk:
|
if '${' in chunk:
|
||||||
steps.append((path, regex_from_template(chunk)))
|
steps.append((path, '^(?:|.*/)' + regex_from_template(chunk)))
|
||||||
path = ""
|
path = ""
|
||||||
else:
|
else:
|
||||||
path += "/"
|
path += "/"
|
||||||
|
Loading…
Reference in New Issue
Block a user