diff options
author | 2013-07-22 02:56:10 +0200 | |
---|---|---|
committer | 2013-07-22 02:56:10 +0200 | |
commit | baf577b1ec834520a14e87c1f1eff6b8b2d42f45 (patch) | |
tree | 3a5b2b3550e027df8cb1cf5bcdc5baa00782e027 | |
parent | install CTAN backend (diff) | |
download | gs-elpa-baf577b1ec834520a14e87c1f1eff6b8b2d42f45.tar.gz gs-elpa-baf577b1ec834520a14e87c1f1eff6b8b2d42f45.tar.bz2 gs-elpa-baf577b1ec834520a14e87c1f1eff6b8b2d42f45.zip |
PackadeDB splitted into PackageDB and DBGenerator, more than one repository for overlay allowed
-rw-r--r-- | g_elpa/backend.py | 6 | ||||
-rw-r--r-- | g_elpa/elpa_db.py | 26 | ||||
-rw-r--r-- | layman-git-g-sorcery.patch | 2 |
3 files changed, 15 insertions, 19 deletions
diff --git a/g_elpa/backend.py b/g_elpa/backend.py index b77ed2e..cad82c9 100644 --- a/g_elpa/backend.py +++ b/g_elpa/backend.py @@ -18,7 +18,7 @@ from g_sorcery.metadata import MetadataGenerator from g_sorcery.eclass import EclassGenerator from g_sorcery.fileutils import get_pkgpath -from .elpa_db import ElpaDB +from .elpa_db import ElpaDBGenerator from .ebuild import ElpaEbuildWithDigestGenerator, ElpaEbuildWithoutDigestGenerator @@ -27,6 +27,6 @@ class ElpaEclassGenerator(EclassGenerator): super(ElpaEclassGenerator, self).__init__(os.path.join(get_pkgpath(__file__), 'data')) -instance = Backend(ElpaDB, +instance = Backend(ElpaDBGenerator, ElpaEbuildWithDigestGenerator, ElpaEbuildWithoutDigestGenerator, - ElpaEclassGenerator, MetadataGenerator, sync_db=False) + ElpaEclassGenerator, MetadataGenerator) diff --git a/g_elpa/elpa_db.py b/g_elpa/elpa_db.py index 7628502..0196b89 100644 --- a/g_elpa/elpa_db.py +++ b/g_elpa/elpa_db.py @@ -23,26 +23,22 @@ else: from urllib.parse import urljoin from g_sorcery.g_collections import Dependency, Package, serializable_elist -from g_sorcery.package_db import PackageDB -from g_sorcery.fileutils import load_remote_file +from g_sorcery.package_db import DBGenerator from g_sorcery.exceptions import SyncError -class ElpaDB(PackageDB): - def __init__(self, directory, config = None, common_config = None): - super(ElpaDB, self).__init__(directory, config, common_config) - - def get_download_uries(self): - ac_uri = urljoin(self.repo_uri, 'archive-contents') +class ElpaDBGenerator(DBGenerator): + def get_download_uries(self, common_config, config): + ac_uri = urljoin(config["repo_uri"], 'archive-contents') return [{"uri" : ac_uri, "parser" : sexpdata.load}] - def process_data(self, data): - + def process_data(self, pkg_db, data, common_config, config): archive_contents = data['archive-contents'] + repo_uri = config["repo_uri"] if sexpdata.car(archive_contents) != 1: - raise SyncError('sync failed: ' + self.repo_uri + ' bad archive contents format') + raise SyncError('sync failed: ' + repo_uri + ' bad archive contents format') - self.add_category('app-emacs') + pkg_db.add_category('app-emacs') PKG_INFO = 2 PKG_NAME = 0 @@ -79,8 +75,8 @@ class ElpaDB(PackageDB): 'dependencies' : dependencies, 'depend' : depend, 'rdepend' : depend, - 'homepage' : self.repo_uri, - 'repo_uri' : self.repo_uri, + 'homepage' : repo_uri, + 'repo_uri' : repo_uri, 'realname' : realname, #eclass entry 'eclasses' : ['g-elpa'], @@ -89,7 +85,7 @@ class ElpaDB(PackageDB): 'name' : 'Jauhien Piatlicki'}], 'longdescription' : description } - self.add_package(pkg, properties) + pkg_db.add_package(pkg, properties) def _s_get_package(self, name, version): diff --git a/layman-git-g-sorcery.patch b/layman-git-g-sorcery.patch index 1b93043..523bfd5 100644 --- a/layman-git-g-sorcery.patch +++ b/layman-git-g-sorcery.patch @@ -131,7 +131,7 @@ index 0000000..6e0b200 + + target = path([base, self.parent.name]) + -+ args = [self.backend, '-o', target, 'sync', '-r', self.repository] ++ args = [self.backend, '-o', target, '-r', self.repository, 'sync'] + returncode = self.run_command(self.command(), args, cwd=target) + if returncode: + return returncode |