euscanwww: Displaying unstable versions in package view

Signed-off-by: volpino <fox91@anche.no>
This commit is contained in:
volpino 2012-07-17 13:18:44 +02:00
parent a85f7e71c1
commit be146163f6
26 changed files with 259 additions and 31 deletions

View File

@ -0,0 +1,201 @@
# -*- coding: utf-8 -*-
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding field 'VersionLog.vtype'
db.add_column('djeuscan_versionlog', 'vtype',
self.gf('django.db.models.fields.CharField')(default='', max_length=128, blank=True),
keep_default=False)
def backwards(self, orm):
# Deleting field 'VersionLog.vtype'
db.delete_column('djeuscan_versionlog', 'vtype')
models = {
'auth.group': {
'Meta': {'object_name': 'Group'},
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '80'}),
'permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'})
},
'auth.permission': {
'Meta': {'ordering': "('content_type__app_label', 'content_type__model', 'codename')", 'unique_together': "(('content_type', 'codename'),)", 'object_name': 'Permission'},
'codename': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['contenttypes.ContentType']"}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'name': ('django.db.models.fields.CharField', [], {'max_length': '50'})
},
'auth.user': {
'Meta': {'object_name': 'User'},
'date_joined': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
'email': ('django.db.models.fields.EmailField', [], {'max_length': '75', 'blank': 'True'}),
'first_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}),
'groups': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Group']", 'symmetrical': 'False', 'blank': 'True'}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'is_active': ('django.db.models.fields.BooleanField', [], {'default': 'True'}),
'is_staff': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
'is_superuser': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
'last_login': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
'last_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}),
'password': ('django.db.models.fields.CharField', [], {'max_length': '128'}),
'user_permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}),
'username': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '30'})
},
'contenttypes.contenttype': {
'Meta': {'ordering': "('name',)", 'unique_together': "(('app_label', 'model'),)", 'object_name': 'ContentType', 'db_table': "'django_content_type'"},
'app_label': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'model': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
'name': ('django.db.models.fields.CharField', [], {'max_length': '100'})
},
'djeuscan.categoryassociation': {
'Meta': {'unique_together': "(['user', 'category'],)", 'object_name': 'CategoryAssociation'},
'category': ('django.db.models.fields.CharField', [], {'max_length': '128'}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'user': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['auth.User']"})
},
'djeuscan.categorylog': {
'Meta': {'object_name': 'CategoryLog', '_ormbases': ['djeuscan.Log']},
'category': ('django.db.models.fields.CharField', [], {'max_length': '128'}),
'log_ptr': ('django.db.models.fields.related.OneToOneField', [], {'to': "orm['djeuscan.Log']", 'unique': 'True', 'primary_key': 'True'})
},
'djeuscan.euscanresult': {
'Meta': {'object_name': 'EuscanResult'},
'datetime': ('django.db.models.fields.DateTimeField', [], {}),
'ebuild': ('django.db.models.fields.CharField', [], {'max_length': '256', 'blank': 'True'}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'package': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['djeuscan.Package']"}),
'result': ('django.db.models.fields.TextField', [], {'blank': 'True'}),
'scan_time': ('django.db.models.fields.FloatField', [], {'null': 'True', 'blank': 'True'})
},
'djeuscan.herd': {
'Meta': {'object_name': 'Herd'},
'email': ('django.db.models.fields.CharField', [], {'max_length': '128', 'null': 'True', 'blank': 'True'}),
'herd': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '128'}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'})
},
'djeuscan.herdassociation': {
'Meta': {'unique_together': "(['user', 'herd'],)", 'object_name': 'HerdAssociation'},
'herd': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['djeuscan.Herd']"}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'user': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['auth.User']"})
},
'djeuscan.herdlog': {
'Meta': {'object_name': 'HerdLog', '_ormbases': ['djeuscan.Log']},
'herd': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['djeuscan.Herd']"}),
'log_ptr': ('django.db.models.fields.related.OneToOneField', [], {'to': "orm['djeuscan.Log']", 'unique': 'True', 'primary_key': 'True'})
},
'djeuscan.log': {
'Meta': {'object_name': 'Log'},
'datetime': ('django.db.models.fields.DateTimeField', [], {}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'n_packages_gentoo': ('django.db.models.fields.IntegerField', [], {'default': '0'}),
'n_packages_outdated': ('django.db.models.fields.IntegerField', [], {'default': '0'}),
'n_packages_overlay': ('django.db.models.fields.IntegerField', [], {'default': '0'}),
'n_versions_gentoo': ('django.db.models.fields.IntegerField', [], {'default': '0'}),
'n_versions_overlay': ('django.db.models.fields.IntegerField', [], {'default': '0'}),
'n_versions_upstream': ('django.db.models.fields.IntegerField', [], {'default': '0'})
},
'djeuscan.maintainer': {
'Meta': {'object_name': 'Maintainer'},
'email': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '128'}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'name': ('django.db.models.fields.CharField', [], {'max_length': '128'})
},
'djeuscan.maintainerassociation': {
'Meta': {'unique_together': "(['user', 'maintainer'],)", 'object_name': 'MaintainerAssociation'},
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'maintainer': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['djeuscan.Maintainer']"}),
'user': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['auth.User']"})
},
'djeuscan.maintainerlog': {
'Meta': {'object_name': 'MaintainerLog', '_ormbases': ['djeuscan.Log']},
'log_ptr': ('django.db.models.fields.related.OneToOneField', [], {'to': "orm['djeuscan.Log']", 'unique': 'True', 'primary_key': 'True'}),
'maintainer': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['djeuscan.Maintainer']"})
},
'djeuscan.overlayassociation': {
'Meta': {'unique_together': "(['user', 'overlay'],)", 'object_name': 'OverlayAssociation'},
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'overlay': ('django.db.models.fields.CharField', [], {'max_length': '128'}),
'user': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['auth.User']"})
},
'djeuscan.package': {
'Meta': {'unique_together': "(['category', 'name'],)", 'object_name': 'Package'},
'category': ('django.db.models.fields.CharField', [], {'max_length': '128'}),
'description': ('django.db.models.fields.TextField', [], {'blank': 'True'}),
'herds': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['djeuscan.Herd']", 'symmetrical': 'False', 'blank': 'True'}),
'homepage': ('django.db.models.fields.TextField', [], {'blank': 'True'}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'last_version_gentoo': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'last_version_gentoo'", 'null': 'True', 'on_delete': 'models.SET_NULL', 'to': "orm['djeuscan.Version']"}),
'last_version_overlay': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'last_version_overlay'", 'null': 'True', 'on_delete': 'models.SET_NULL', 'to': "orm['djeuscan.Version']"}),
'last_version_upstream': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'last_version_upstream'", 'null': 'True', 'on_delete': 'models.SET_NULL', 'to': "orm['djeuscan.Version']"}),
'maintainers': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['djeuscan.Maintainer']", 'symmetrical': 'False', 'blank': 'True'}),
'n_overlay': ('django.db.models.fields.IntegerField', [], {'default': '0'}),
'n_packaged': ('django.db.models.fields.IntegerField', [], {'default': '0'}),
'n_versions': ('django.db.models.fields.IntegerField', [], {'default': '0'}),
'name': ('django.db.models.fields.CharField', [], {'max_length': '128'})
},
'djeuscan.packageassociation': {
'Meta': {'unique_together': "(['user', 'package'],)", 'object_name': 'PackageAssociation'},
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'package': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['djeuscan.Package']"}),
'user': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['auth.User']"})
},
'djeuscan.problemreport': {
'Meta': {'object_name': 'ProblemReport'},
'datetime': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'message': ('django.db.models.fields.TextField', [], {}),
'package': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['djeuscan.Package']"}),
'subject': ('django.db.models.fields.CharField', [], {'max_length': '128'}),
'version': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['djeuscan.Version']", 'null': 'True', 'blank': 'True'})
},
'djeuscan.refreshpackagequery': {
'Meta': {'object_name': 'RefreshPackageQuery'},
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'package': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['djeuscan.Package']"}),
'priority': ('django.db.models.fields.IntegerField', [], {'default': '0'})
},
'djeuscan.version': {
'Meta': {'unique_together': "(['package', 'slot', 'revision', 'version', 'overlay'],)", 'object_name': 'Version'},
'alive': ('django.db.models.fields.BooleanField', [], {'default': 'True', 'db_index': 'True'}),
'confidence': ('django.db.models.fields.IntegerField', [], {'default': '0'}),
'ebuild_path': ('django.db.models.fields.CharField', [], {'max_length': '256', 'blank': 'True'}),
'handler': ('django.db.models.fields.CharField', [], {'max_length': '128', 'blank': 'True'}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'metadata_path': ('django.db.models.fields.CharField', [], {'max_length': '256', 'blank': 'True'}),
'overlay': ('django.db.models.fields.CharField', [], {'default': "'gentoo'", 'max_length': '128', 'db_index': 'True', 'blank': 'True'}),
'package': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['djeuscan.Package']"}),
'packaged': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
'revision': ('django.db.models.fields.CharField', [], {'max_length': '128'}),
'slot': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '128', 'blank': 'True'}),
'urls': ('django.db.models.fields.TextField', [], {'blank': 'True'}),
'version': ('django.db.models.fields.CharField', [], {'max_length': '128'}),
'vtype': ('django.db.models.fields.CharField', [], {'max_length': '128', 'blank': 'True'})
},
'djeuscan.versionlog': {
'Meta': {'object_name': 'VersionLog'},
'action': ('django.db.models.fields.IntegerField', [], {}),
'datetime': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'overlay': ('django.db.models.fields.CharField', [], {'default': "'gentoo'", 'max_length': '128', 'blank': 'True'}),
'package': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['djeuscan.Package']"}),
'packaged': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
'revision': ('django.db.models.fields.CharField', [], {'max_length': '128'}),
'slot': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '128', 'blank': 'True'}),
'version': ('django.db.models.fields.CharField', [], {'max_length': '128'}),
'vtype': ('django.db.models.fields.CharField', [], {'max_length': '128', 'blank': 'True'})
},
'djeuscan.worldlog': {
'Meta': {'object_name': 'WorldLog', '_ormbases': ['djeuscan.Log']},
'log_ptr': ('django.db.models.fields.related.OneToOneField', [], {'to': "orm['djeuscan.Log']", 'unique': 'True', 'primary_key': 'True'})
}
}
complete_apps = ['djeuscan']

View File

@ -165,6 +165,8 @@ class VersionLog(models.Model):
validators=[validate_name], blank=True) validators=[validate_name], blank=True)
action = models.IntegerField(choices=VERSION_ACTIONS) action = models.IntegerField(choices=VERSION_ACTIONS)
vtype = models.CharField(max_length=128, blank=True)
objects = VersionLogManager() objects = VersionLogManager()
def __unicode__(self): def __unicode__(self):

View File

@ -266,16 +266,15 @@ class ScanPortage(object):
package.n_versions += 1 package.n_versions += 1
package.save() package.save()
if self.no_log: if not self.no_log:
return
VersionLog.objects.create( VersionLog.objects.create(
package=obj.package, package=obj.package,
action=VersionLog.VERSION_ADDED, action=VersionLog.VERSION_ADDED,
slot=obj.slot, slot=obj.slot,
revision=obj.revision, revision=obj.revision,
version=obj.version, version=obj.version,
overlay=obj.overlay overlay=obj.overlay,
vtype=obj.vtype,
) )
def purge_old_packages(self, packages, alive): def purge_old_packages(self, packages, alive):

View File

@ -1,5 +1,5 @@
{% load url from future %} {% load url from future %}
{% load euscan %} {% load euscan_tags %}
<table id="table" class="display"> <table id="table" class="display">
<thead> <thead>

View File

@ -1,5 +1,5 @@
{% load url from future %} {% load url from future %}
{% load euscan %} {% load euscan_tags %}
<table id="table" class="display"> <table id="table" class="display">
<thead> <thead>

View File

@ -1,5 +1,5 @@
{% load url from future %} {% load url from future %}
{% load euscan %} {% load euscan_tags %}
<table id="table" class="display"> <table id="table" class="display">
<thead> <thead>

View File

@ -1,4 +1,4 @@
{% load euscan %} {% load euscan_tags %}
{% load mul %} {% load mul %}
{% load sub %} {% load sub %}
{% load div %} {% load div %}

View File

@ -1,4 +1,4 @@
{% load euscan %} {% load euscan_tags %}
{% load sub %} {% load sub %}
{% load div %} {% load div %}
{% load mul %} {% load mul %}

View File

@ -1,6 +1,6 @@
{% extends "euscan/_datatable.html" %} {% extends "euscan/_datatable.html" %}
{% load url from future %} {% load url from future %}
{% load euscan %} {% load euscan_tags %}
{% block title %} {% block title %}
{{ block.super }} - Watched categories {{ block.super }} - Watched categories

View File

@ -1,6 +1,6 @@
{% extends "euscan/_datatable.html" %} {% extends "euscan/_datatable.html" %}
{% load url from future %} {% load url from future %}
{% load euscan %} {% load euscan_tags %}
{% block title %} {% block title %}
{{ block.super }} - Watched herds {{ block.super }} - Watched herds

View File

@ -1,6 +1,6 @@
{% extends "euscan/_datatable.html" %} {% extends "euscan/_datatable.html" %}
{% load url from future %} {% load url from future %}
{% load euscan %} {% load euscan_tags %}
{% block title %} {% block title %}
{{ block.super }} - Watched maintainers {{ block.super }} - Watched maintainers

View File

@ -1,6 +1,6 @@
{% extends "euscan/_datatable.html" %} {% extends "euscan/_datatable.html" %}
{% load euscan %} {% load euscan_tags %}
{% load url from future %} {% load url from future %}
{% block title %} {% block title %}

View File

@ -1,7 +1,7 @@
{% extends "euscan/_datatable.html" %} {% extends "euscan/_datatable.html" %}
{% load url from future %} {% load url from future %}
{% load euscan %} {% load euscan_tags %}
{% block title %} {% block title %}
{{ block.super }} - Watched packages {{ block.super }} - Watched packages

View File

@ -1,6 +1,6 @@
{% extends "euscan/_datatable.html" %} {% extends "euscan/_datatable.html" %}
{% load euscan %} {% load euscan_tags %}
{% load url from future %} {% load url from future %}
{% block title %} {% block title %}

View File

@ -1,6 +1,6 @@
{% extends "euscan/_datatable.html" %} {% extends "euscan/_datatable.html" %}
{% load euscan %} {% load euscan_tags %}
{% load url from future %} {% load url from future %}
{% block title %} {% block title %}

View File

@ -1,6 +1,6 @@
{% extends "euscan/_datatable.html" %} {% extends "euscan/_datatable.html" %}
{% load euscan %} {% load euscan_tags %}
{% load url from future %} {% load url from future %}
{% block title %} {% block title %}

View File

@ -1,6 +1,6 @@
{% extends "euscan/_datatable.html" %} {% extends "euscan/_datatable.html" %}
{% load euscan %} {% load euscan_tags %}
{% load url from future %} {% load url from future %}
{% block title %} {% block title %}

View File

@ -1,6 +1,6 @@
{% extends "euscan/_datatable.html" %} {% extends "euscan/_datatable.html" %}
{% load euscan %} {% load euscan_tags %}
{% load url from future %} {% load url from future %}
{% block title %} {% block title %}

View File

@ -1,6 +1,6 @@
{% extends "euscan/_datatable.html" %} {% extends "euscan/_datatable.html" %}
{% load euscan %} {% load euscan_tags %}
{% load url from future %} {% load url from future %}
{% block title %} {% block title %}

View File

@ -1,7 +1,7 @@
{% extends "euscan/_datatable.html" %} {% extends "euscan/_datatable.html" %}
{% load url from future %} {% load url from future %}
{% load euscan %} {% load euscan_tags %}
{% block title %} {% block title %}
{{ block.super }} - Overlay: {{ overlay }} {{ block.super }} - Overlay: {{ overlay }}

View File

@ -1,6 +1,6 @@
{% extends "euscan/_datatable.html" %} {% extends "euscan/_datatable.html" %}
{% load euscan %} {% load euscan_tags %}
{% load url from future %} {% load url from future %}
{% block title %} {% block title %}

View File

@ -1,6 +1,7 @@
{% extends "euscan/_datatable.html" %} {% extends "euscan/_datatable.html" %}
{% load sub %} {% load sub %}
{% load euscan_tags %}
{% load url from future %} {% load url from future %}
{% block meta %} {% block meta %}
@ -98,6 +99,11 @@
{% else %} {% else %}
<img src="{{ STATIC_URL }}img/overlay-icon.png" alt="overlays" title="In Overlays" /> <img src="{{ STATIC_URL }}img/overlay-icon.png" alt="overlays" title="In Overlays" />
{% endif %} {% endif %}
{% if version.vtype and not version.vtype|is_stable %}
<img src="{{ STATIC_URL }}img/unstable-icon.png" alt="unstable" title="{{ version.vtype }}" />
{% endif %}
{{ version.version }}-{{ version.revision }} :{{ version.slot }} [{{ version.overlay }}] {{ version.version }}-{{ version.revision }} :{{ version.slot }} [{{ version.overlay }}]
</li> </li>
{% endfor %} {% endfor %}
@ -111,6 +117,11 @@
{% for version in upstream %} {% for version in upstream %}
<li> <li>
<img src="{{ STATIC_URL }}img/upstream-icon.png" alt="upstream" title="Upstream" /> <img src="{{ STATIC_URL }}img/upstream-icon.png" alt="upstream" title="Upstream" />
{% if version.vtype and not version.vtype|is_stable %}
<img src="{{ STATIC_URL }}img/unstable-icon.png" alt="unstable" title="{{ version.vtype }}" />
{% endif %}
{{ version.version }} - {{ version.urls }} {{ version.version }} - {{ version.urls }}
</li> </li>
{% endfor %} {% endfor %}
@ -134,6 +145,10 @@
<img src="{{ STATIC_URL }}img/upstream-icon.png" alt="upstream" title="Upstream" /> <img src="{{ STATIC_URL }}img/upstream-icon.png" alt="upstream" title="Upstream" />
{% endif %} {% endif %}
{% if version.vtype and not version.vtype|is_stable %}
<img src="{{ STATIC_URL }}img/unstable-icon.png" alt="unstable" title="{{ version.vtype }}" />
{% endif %}
{{ version }} - {{ version.datetime }} {{ version }} - {{ version.datetime }}
</li> </li>

View File

@ -1,6 +1,6 @@
{% extends "euscan/_datatable.html" %} {% extends "euscan/_datatable.html" %}
{% load euscan %} {% load euscan_tags %}
{% block title %} {% block title %}
{{ block.super }} - World Scan {{ block.super }} - World Scan

View File

@ -1,6 +1,8 @@
from django import template from django import template
from django.conf import settings from django.conf import settings
from euscan import helpers
register = template.Library() register = template.Library()
@ -55,3 +57,8 @@ def overlays_table(overlays):
"overlays": overlays, "overlays": overlays,
"STATIC_URL": settings.STATIC_URL, "STATIC_URL": settings.STATIC_URL,
} }
@register.filter
def is_stable(version_type):
return helpers.is_version_type_stable(version_type)

Binary file not shown.

After

Width:  |  Height:  |  Size: 605 B

View File

@ -35,7 +35,11 @@ _v = r'((\d+)((\.\d+)*)([a-zA-Z]*?)(' + _v_end + '*))'
def is_version_stable(version): def is_version_stable(version):
return get_version_type(version) not in ("alpha", "beta", "pre", "rc") return is_version_type_stable(get_version_type(version))
def is_version_type_stable(version_type):
return version_type not in ("alpha", "beta", "pre", "rc")
def get_version_type(version): def get_version_type(version):