diff options
author | Dan McGee <dan@archlinux.org> | 2011-02-07 20:45:05 +0100 |
---|---|---|
committer | Dan McGee <dan@archlinux.org> | 2011-02-15 20:51:11 +0100 |
commit | 4444f25d5cd9a9e1cb310a2d9c0b6b1ec1f55789 (patch) | |
tree | 8d1cff4d938f317cb1d09a872ce6fba91b7a3124 /devel/management/commands | |
parent | 30756f13efccef1e3b2cdbf9ac9855abc77b065c (diff) | |
download | archweb-4444f25d5cd9a9e1cb310a2d9c0b6b1ec1f55789.tar.gz archweb-4444f25d5cd9a9e1cb310a2d9c0b6b1ec1f55789.tar.xz |
Move license to a related model
This allows us to store multiple licenses per package in a more elegant
fashion, and will later allow us to search and filter on this information.
Signed-off-by: Dan McGee <dan@archlinux.org>
Diffstat (limited to 'devel/management/commands')
-rw-r--r-- | devel/management/commands/reporead.py | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/devel/management/commands/reporead.py b/devel/management/commands/reporead.py index bdd0882..9b99e0f 100644 --- a/devel/management/commands/reporead.py +++ b/devel/management/commands/reporead.py @@ -79,14 +79,13 @@ class Pkg(object): """An interim 'container' object for holding Arch package data.""" bare = ( 'name', 'base', 'arch', 'desc', 'filename', 'md5sum', 'url', 'builddate', 'packager' ) - squash = ( 'license', ) number = ( 'csize', 'isize' ) def __init__(self, repo): self.repo = repo self.ver = None self.rel = None - for k in self.bare + self.squash + self.number: + for k in self.bare + self.number: setattr(self, k, None) def populate(self, values): @@ -94,8 +93,6 @@ class Pkg(object): # ensure we stay under our DB character limit if k in self.bare: setattr(self, k, v[0][:254]) - elif k in self.squash: - setattr(self, k, u', '.join(v)[:254]) elif k in self.number: setattr(self, k, long(v[0])) elif k == 'force': @@ -166,7 +163,6 @@ def populate_pkg(dbpkg, repopkg, force=False, timestamp=None): dbpkg.pkgver = repopkg.ver dbpkg.pkgrel = repopkg.rel dbpkg.pkgdesc = repopkg.desc - dbpkg.license = repopkg.license dbpkg.url = repopkg.url dbpkg.filename = repopkg.filename dbpkg.compressed_size = repopkg.csize @@ -208,6 +204,11 @@ def populate_pkg(dbpkg, repopkg, force=False, timestamp=None): for y in repopkg.groups: dbpkg.groups.create(name=y) + dbpkg.licenses.all().delete() + if 'license' in repopkg.__dict__: + for y in repopkg.license: + dbpkg.licenses.create(name=y) + def populate_files(dbpkg, repopkg, force=False): if not force: |