diff options
author | 2014-05-10 03:15:53 +0200 | |
---|---|---|
committer | 2014-05-10 03:15:53 +0200 | |
commit | 5e3998bed044a5a1b6802aa4f51caeea5837f18b (patch) | |
tree | 793600cad698a470c45f001e02da3e4597f0b3dd | |
parent | prepare to split gs-elpa to another package (diff) | |
download | g-sorcery-5e3998bed044a5a1b6802aa4f51caeea5837f18b.tar.gz g-sorcery-5e3998bed044a5a1b6802aa4f51caeea5837f18b.tar.bz2 g-sorcery-5e3998bed044a5a1b6802aa4f51caeea5837f18b.zip |
gs-elpa moved to another repo
-rw-r--r-- | docs/gs-elpa.8 | 165 | ||||
-rw-r--r-- | docs/gs-elpa.8.rst | 144 | ||||
-rw-r--r-- | gs-elpa-overlays.xml | 34 | ||||
-rw-r--r-- | gs-elpa.json | 54 | ||||
-rw-r--r-- | gs_elpa/__init__.py | 2 | ||||
-rw-r--r-- | gs_elpa/backend.py | 37 | ||||
-rw-r--r-- | gs_elpa/data/gs-elpa.eclass | 63 | ||||
-rw-r--r-- | gs_elpa/ebuild.py | 65 | ||||
-rw-r--r-- | gs_elpa/elpa_db.py | 130 |
9 files changed, 0 insertions, 694 deletions
diff --git a/docs/gs-elpa.8 b/docs/gs-elpa.8 deleted file mode 100644 index cd71794..0000000 --- a/docs/gs-elpa.8 +++ /dev/null @@ -1,165 +0,0 @@ -.\" Man page generated from reStructuredText. -. -.TH GS-ELPA 8 "2013-08-04" "0.1" "g-sorcery" -.SH NAME -gs-elpa \- manage overlays for ELPA repositories -. -.nr rst2man-indent-level 0 -. -.de1 rstReportMargin -\\$1 \\n[an-margin] -level \\n[rst2man-indent-level] -level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] -- -\\n[rst2man-indent0] -\\n[rst2man-indent1] -\\n[rst2man-indent2] -.. -.de1 INDENT -.\" .rstReportMargin pre: -. RS \\$1 -. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] -. nr rst2man-indent-level +1 -.\" .rstReportMargin post: -.. -.de UNINDENT -. RE -.\" indent \\n[an-margin] -.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] -.nr rst2man-indent-level -1 -.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] -.in \\n[rst2man-indent\\n[rst2man-indent-level]]u -.. -.SH SYNOPSIS -.sp -\fBgs\-elpa\fP \fB\-o\fP \fIOVERLAY\fP [\fB\-r\fP \fIREPO\fP] \fBsync\fP -.sp -\fBgs\-elpa\fP \fB\-o\fP \fIOVERLAY\fP [\fB\-r\fP \fIREPO\fP] \fBlist\fP -.sp -\fBgs\-elpa\fP \fB\-o\fP \fIOVERLAY\fP [\fB\-r\fP \fIREPO\fP] \fBgenerate\fP \fIPACKAGE\fP -.sp -\fBgs\-elpa\fP \fB\-o\fP \fIOVERLAY\fP [\fB\-r\fP \fIREPO\fP] \fBinstall\fP \fIPACKAGE\fP -.sp -\fBgs\-elpa\fP \fB\-o\fP \fIOVERLAY\fP [\fB\-r\fP \fIREPO\fP] \fBgenerate\-tree\fP [\fB\-d\fP] -.SH DESCRIPTION -.sp -\fBgs\-elpa\fP is an ebuild generator for ELPA repositories \-\- repositories with -elisp packages for emacs. -.sp -There are two ways of using \fBgs\-elpa\fP: -.INDENT 0.0 -.INDENT 3.5 -.INDENT 0.0 -.IP \(bu 2 -use it with \fBlayman\fP -.sp -In this case all you need to do is install \fBlayman\-9999\fP and \fBg\-sorcery\fP. -Then you should just run \fIlayman \-L\fP as -root and find an overlay you want. Type of overlay will be -displayed as \fIg\-sorcery\fP. Then you add this overlay as -usual. It\(aqs all you need to do and it\(aqs the recommended way of -using \fBgs\-elpa\fP. -.IP \(bu 2 -use it as stand\-alone tool -.sp -In this case you should create an overlay (see \fBportage\fP documentation), sync it and populate -it with one or more ebuilds. Then ebuilds could be installed by emerge or by \fBgs\-elpa\fP tool. -.UNINDENT -.UNINDENT -.UNINDENT -.SH OPTIONS -.INDENT 0.0 -.TP -.B \fB\-\-overlay\fP \fIOVERLAY\fP, \fB\-o\fP \fIOVERLAY\fP -Overlay directory. This option is mandatory if there is no -\fBdefault_overlay\fP entry in a backend config. -.TP -.B \fB\-\-repository\fP \fIREPO\fP, \fB\-r\fP \fIREPO\fP -Repository name. Can be one of \fBgnu\-elpa\fP, \fBmarmalade\fP, \fBmelpa\fP. -.UNINDENT -.SH COMMANDS -.INDENT 0.0 -.TP -.B \fBsync\fP -Synchronize a repository database. -.TP -.B \fBlist\fP -List packages available in a repository. -.TP -.B \fBgenerate\fP -Generate a given ebuild and all its dependencies. -.TP -.B \fBinstall\fP -Generate and install an ebuild using your package mangler. -.TP -.B \fBgenerate\-tree\fP -Generate entire overlay structure. Without option \fB\-d\fP after -this command sources are not fetched during generation and there -are no entries for them in Manifest files. -.UNINDENT -.SH FILES -.INDENT 0.0 -.TP -.B \fB/etc/g\-sorcery/gs\-elpa.json\fP -Backend config. -.TP -.B \fB/etc/layman/overlays/gs\-elpa\-overlays.xml\fP -List of available repositories. -.UNINDENT -.SH EXAMPLES -.INDENT 0.0 -.TP -.B Using gs\-elpa with layman -Execute -.sp -\fBlayman \-L\fP -.sp -Find there an overlay you need (there are -3 gs\-elpa overlays currently: gnu\-elpa, marmalade and melpa). -Add, e.g. -.sp -\fBlayman \-a gnu\-elpa \-a marmalade\fP -.sp -Emerge any package from it, e.g. -.sp -\fBemerge \-va clojure\-mode\fP -.TP -.B Generating user ebuilds in user overlay -Create new user overlay. Run -.sp -\fBgs\-elpa \-o\fP \fIOVERLAY_DIRECTORY\fP \fB\-r gnu\-elpa\fP \fBsync\fP -.sp -List packages: -.sp -\fBgs\-elpa \-o\fP \fIOVERLAY_DIRECTORY\fP \fB\-r gnu\-elpa\fP \fBlist\fP -.sp -Install any package you want: -.sp -\fBgs\-elpa \-o\fP \fIOVERLAY_DIRECTORY\fP \fB\-r gnu\-elpa\fP \fBinstall\fP \fIPACKAGE\fP -.sp -Repositories you can use are gnu\-elpa, marmalade and melpa. You can use them -all in one overlay. Note, that if you call \fBgenerate\-tree\fP command your overlay -will be wiped and overlay tree for a given repository will be generated. Be careful! -.UNINDENT -.SH NOTES -.INDENT 0.0 -.IP 1. 3 -At the moment the only package mangler \fBgs\-elpa\fP supports is \fBportage\fP. -.UNINDENT -.SH BUGS -.sp -Some packages in \fBmarmalade\fP and \fBmelpa\fP depend on packages from gnu\-elpa. \fBinstall\fP and \fBgenerate\fP -commands will fail on them as dependencies between overlays are not supported currently. So the -recommended way of using gs\-elpa is using it with layman. Even doing so you should always add -gnu\-elpa repository: \fBlayman \-a gnu\-elpa\fP. -.SH SEE ALSO -.sp -\fBgs\-pypi\fP(8), \fBgs\-ctan\fP(8), \fBg\-sorcery.cfg\fP(8), \fBportage\fP(5), \fBemerge\fP(1), \fBlayman\fP(8) -.SH AUTHOR -Written by Jauhien Piatlicki <piatlicki@gmail.com>. GSoC idea -and mentorship by Rafael Martins. Lots of help and improvements -by Brian Dolbec. -.SH COPYRIGHT -Copyright (c) 2013 Jauhien Piatlicki, License: GPL-2 -.\" Generated by docutils manpage writer. -. diff --git a/docs/gs-elpa.8.rst b/docs/gs-elpa.8.rst deleted file mode 100644 index 008c30e..0000000 --- a/docs/gs-elpa.8.rst +++ /dev/null @@ -1,144 +0,0 @@ -======= -gs-elpa -======= - -------------------------------------- -manage overlays for ELPA repositories -------------------------------------- - -:Author: Written by Jauhien Piatlicki <piatlicki@gmail.com>. GSoC idea - and mentorship by Rafael Martins. Lots of help and improvements - by Brian Dolbec. -:Date: 2013-08-04 -:Copyright: Copyright (c) 2013 Jauhien Piatlicki, License: GPL-2 -:Version: 0.1 -:Manual section: 8 -:Manual group: g-sorcery - - -SYNOPSIS -======== - -**gs-elpa** **-o** *OVERLAY* [**-r** *REPO*] **sync** - -**gs-elpa** **-o** *OVERLAY* [**-r** *REPO*] **list** - -**gs-elpa** **-o** *OVERLAY* [**-r** *REPO*] **generate** *PACKAGE* - -**gs-elpa** **-o** *OVERLAY* [**-r** *REPO*] **install** *PACKAGE* - -**gs-elpa** **-o** *OVERLAY* [**-r** *REPO*] **generate-tree** [**-d**] - -DESCRIPTION -=========== - -**gs-elpa** is an ebuild generator for ELPA repositories -- repositories with -elisp packages for emacs. - -There are two ways of using **gs-elpa**: - - * use it with **layman** - - In this case all you need to do is install **layman-9999** and **g-sorcery**. - Then you should just run `layman -L` as - root and find an overlay you want. Type of overlay will be - displayed as *g-sorcery*. Then you add this overlay as - usual. It's all you need to do and it's the recommended way of - using **gs-elpa**. - - * use it as stand-alone tool - - In this case you should create an overlay (see **portage** documentation), sync it and populate - it with one or more ebuilds. Then ebuilds could be installed by emerge or by **gs-elpa** tool. - - -OPTIONS -======= - -**--overlay** *OVERLAY*, **-o** *OVERLAY* - Overlay directory. This option is mandatory if there is no - **default_overlay** entry in a backend config. - -**--repository** *REPO*, **-r** *REPO* - Repository name. Can be one of **gnu-elpa**, **marmalade**, **melpa**. - -COMMANDS -======== - -**sync** - Synchronize a repository database. - -**list** - List packages available in a repository. - -**generate** - Generate a given ebuild and all its dependencies. - -**install** - Generate and install an ebuild using your package mangler. - -**generate-tree** - Generate entire overlay structure. Without option **-d** after - this command sources are not fetched during generation and there - are no entries for them in Manifest files. - -FILES -===== -**/etc/g-sorcery/gs-elpa.json** - Backend config. - -**/etc/layman/overlays/gs-elpa-overlays.xml** - List of available repositories. - -EXAMPLES -======== - -Using gs-elpa with layman - Execute - - **layman -L** - - Find there an overlay you need (there are - 3 gs-elpa overlays currently: gnu-elpa, marmalade and melpa). - Add, e.g. - - **layman -a gnu-elpa -a marmalade** - - Emerge any package from it, e.g. - - **emerge -va clojure-mode** - -Generating user ebuilds in user overlay - Create new user overlay. Run - - **gs-elpa -o** *OVERLAY_DIRECTORY* **-r gnu-elpa** **sync** - - List packages: - - **gs-elpa -o** *OVERLAY_DIRECTORY* **-r gnu-elpa** **list** - - Install any package you want: - - **gs-elpa -o** *OVERLAY_DIRECTORY* **-r gnu-elpa** **install** *PACKAGE* - - Repositories you can use are gnu-elpa, marmalade and melpa. You can use them - all in one overlay. Note, that if you call **generate-tree** command your overlay - will be wiped and overlay tree for a given repository will be generated. Be careful! - -NOTES -===== - -1. At the moment the only package mangler **gs-elpa** supports is **portage**. - -BUGS -==== - -Some packages in **marmalade** and **melpa** depend on packages from gnu-elpa. **install** and **generate** -commands will fail on them as dependencies between overlays are not supported currently. So the -recommended way of using gs-elpa is using it with layman. Even doing so you should always add -gnu-elpa repository: **layman -a gnu-elpa**. - -SEE ALSO -======== - -**gs-pypi**\(8), **gs-ctan**\(8), **g-sorcery.cfg**\(8), **portage**\(5), **emerge**\(1), **layman**\(8) diff --git a/gs-elpa-overlays.xml b/gs-elpa-overlays.xml deleted file mode 100644 index b3dd883..0000000 --- a/gs-elpa-overlays.xml +++ /dev/null @@ -1,34 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!DOCTYPE repositories SYSTEM "/dtd/repositories.dtd"> -<repositories xmlns="" version="1.0"> -<repo quality="experimental" status="unofficial"> - <name>gnu-elpa</name> - <description>packages for emacs</description> - <homepage>http://elpa.gnu.org/</homepage> - <owner> - <email>piatlicki@gmail.com</email> - <name>Jauhien Piatlicki</name> - </owner> - <source type="g-sorcery">gs-elpa gnu-elpa</source> -</repo> -<repo quality="experimental" status="unofficial"> - <name>marmalade</name> - <description>packages for emacs</description> - <homepage>http://marmalade-repo.org/</homepage> - <owner> - <email>piatlicki@gmail.com</email> - <name>Jauhien Piatlicki</name> - </owner> - <source type="g-sorcery">gs-elpa marmalade</source> -</repo> -<repo quality="experimental" status="unofficial"> - <name>melpa</name> - <description>packages for emacs</description> - <homepage>http://melpa.milkbox.net</homepage> - <owner> - <email>piatlicki@gmail.com</email> - <name>Jauhien Piatlicki</name> - </owner> - <source type="g-sorcery">gs-elpa melpa</source> -</repo> -</repositories> diff --git a/gs-elpa.json b/gs-elpa.json deleted file mode 100644 index a4accde..0000000 --- a/gs-elpa.json +++ /dev/null @@ -1,54 +0,0 @@ -{ - "backend": "gs-elpa", - "package": "gs_elpa", - "repositories": { - "gnu-elpa": { - "repo_uri": "http://elpa.gnu.org/packages/" - }, - "marmalade": { - "repo_uri": "http://marmalade-repo.org/packages/", - "masters": ["gentoo", "gnu-elpa"] - }, - "melpa": { - "repo_uri": "http://melpa.milkbox.net/packages/", - "masters": ["gentoo", "gnu-elpa"] - } - }, - "common_config": { - "exclude": [ - "actionscript-mode", "alt-font-menu", "analog", "anything", - "apache-mode", "apel", "auctex", "autoconf-mode", - "bbdb", "binclock", "blogmax", "bm", "bongo", "boxquote", "browse-kill-ring", - "bubblet", "calfw", "cedet", "chess", "circe", "cldoc", "cmail", "color-browser", - "color-moccur", "color-theme", "company-mode", "cperl-mode", - "crontab-mode", "crypt++", "csharp-mode", "css-mode", "csv-mode", - "ddskk", "delicious", "develock", "df-mode", "dictionary", "dircolors", - "dired-sort-menu", "distel", "doctest-mode", "doxymacs", "dropdown-list", - "ebuild-mode", "ecb", "edb", "edit-list", "elib", "elscreen", - "emacs-common-gentoo", "emacs-daemon", "emacs-jabber", - "emacs-wm", "emacs-wget", "emacs-wiki", "emacs-wiki-blog", - "emhacks", "emms", "eperiodic", "erc", "erobot", "eselect-mode", "ess", - "evil", "fff", "filladapt", "flashcard", "flim", "folding", "gnuserv", - "gnuserv-programs", "google-c-style", "graphviz-dot-mode", - "grep-edit", "h4x0r", "haskell-mode", "highline", "howm", "htmlize", - "http-emacs", "httpd", "icicles", "identica-mode", "igrep", "imaxima", "inform-mode", - "initsplit", "jam-mode", "jasmin", "javascript", "jde", "keywiz", "limit", - "lookup", "lua-mode", "lyskom-elisp-client", "magit", "mailcrypt", "mairix", "markdown-mode", - "matlab", "mcomplete", "mell", "mew", "mic-paren", "mldonkey", "mmm-mode", - "moccur-edit", "mode-compile", "mpg123-el", "mu-cite", "muse", "nagios-mode", "navi2ch", - "nxml-docbook5-schemas", "nxml-gentoo-schemas", "nxml-libvirt-schemas", "nxml-mode", - "nxml-svg-schemas", "ocaml-mode", "org-mode", - "outline-magic", "paredit", "parenface1.1", "php-mode", - "planner", "po-mode", "po.foo", "po.elscreen", - "popwin", "pov-mode", "prime-el", "prom-wl", "proofgeneral", "protbuf", - "psgml", "pymacs", "python-mode", "quack", "quilt-el", "qwerty", "redo", "regress", "remember", - "rfcview", "riece", "rnc-mode", "rpm-spec-mode", "ruby-mode", "rudel", "sawfish", "scala-mode", - "scheme-complete", "scss-mode", "semi", "session", "setnu", "slime", "sml-mode", "sokoban", "ssh", - "stripes", "sumibi", "tdtd", "teco", "template", "tempo-snippets", "thinks", "thumbs", "tnt", - "tuareg-mode", "twittering-mode", "typing", "u-vm-color", "uboat", "undo-tree", "uptimes", - "vhdl-mode", "view-process", "vm", "volume", "w3mnav", "wanderlust", "whine", "wikipedia-mode", "xclip", - "xrdb-mode", "xslide", "yaml-mode", "yasnippet", "yatex", "yc", "zenburn", "yyzenirc" - ], - "external": {"emacs": "virtual/emacs", "cl-lib": "virtual/emacs"} - } -} diff --git a/gs_elpa/__init__.py b/gs_elpa/__init__.py deleted file mode 100644 index cf529d7..0000000 --- a/gs_elpa/__init__.py +++ /dev/null @@ -1,2 +0,0 @@ -#!/usr/bin/env python - diff --git a/gs_elpa/backend.py b/gs_elpa/backend.py deleted file mode 100644 index 259fab6..0000000 --- a/gs_elpa/backend.py +++ /dev/null @@ -1,37 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- - -""" - backend.py - ~~~~~~~~~~ - - ELPA backend - - :copyright: (c) 2013 by Jauhien Piatlicki - :license: GPL-2, see LICENSE for more details. -""" - -import os - -from g_sorcery.backend import Backend -from g_sorcery.metadata import MetadataGenerator -from g_sorcery.eclass import EclassGenerator -from g_sorcery.fileutils import get_pkgpath - -from .elpa_db import ElpaDBGenerator -from .ebuild import ElpaEbuildWithDigestGenerator, \ - ElpaEbuildWithoutDigestGenerator - - -class ElpaEclassGenerator(EclassGenerator): - """ - Implementation of eclass generator. Only specifies a data directory. - """ - def __init__(self): - super(ElpaEclassGenerator, self).__init__(os.path.join(get_pkgpath(__file__), 'data')) - - -#Backend instance to be loaded by g_sorcery -instance = Backend(ElpaDBGenerator, - ElpaEbuildWithDigestGenerator, ElpaEbuildWithoutDigestGenerator, - ElpaEclassGenerator, MetadataGenerator) diff --git a/gs_elpa/data/gs-elpa.eclass b/gs_elpa/data/gs-elpa.eclass deleted file mode 100644 index c4c85c6..0000000 --- a/gs_elpa/data/gs-elpa.eclass +++ /dev/null @@ -1,63 +0,0 @@ -# Copyright 1999-2013 Gentoo Foundation -# Distributed under the terms of the GNU General Public License v2 -# $Header: $ -# automatically generated by gs-elpa -# please do not edit this file -# -# Original Author: Jauhien Piatlicki <piatlicki@gmail.com> -# Purpose: support installation of elisp packages for emacs -# from overlays generated by gs-elpa -# -# Bugs to piatlicki@gmail.com -# -# @ECLASS: gs-elpa.eclass -# -# @ECLASS-VARIABLE: REPO_URI -# @DESCRIPTION: address of a repository of elisp packages -# -# @ECLASS-VARIABLE: SOURCE_TYPE -# @DESCRIPTION: type of a package (single or tar) -# -# @ECLASS-VARIABLE: DIGEST_SOURCES -# @DESCRIPTION: whether manifest for sources exists -# -# @ECLASS-VARIABLE: REALNAME -# @DESCRIPTION: real name of a package in the repository -# - -inherit elisp g-sorcery - -EXPORT_FUNCTIONS src_{unpack,compile,install} - -if [[ ${SOURCE_TYPE} != "single" ]]; then - SUFFIX="${SOURCE_TYPE}" -else - SUFFIX="el" -fi - -SOURCEFILE=${REALNAME}-${PV}.${SUFFIX} - -gs-elpa_src_unpack() { - g-sorcery_src_unpack - if [[ ${SOURCE_TYPE} = "single" ]]; then - mkdir ${P} || die - mv ./${SOURCEFILE} ./${P}/${REALNAME}.${SUFFIX} || die - fi -} - -gs-elpa_src_compile() { - rm -f ${PN}-pkg.el || die - elisp-make-autoload-file || die - elisp_src_compile || die -} - -gs-elpa_src_install() { - local sitefile="50${PN}-gentoo.el" - cat <<EOF >> ${sitefile} || die -(add-to-list 'load-path "@SITELISP@") -(load "${PN}-autoloads" nil t) -EOF - elisp-site-file-install ${sitefile} || die - rm -f ${sitefile} || die - elisp_src_install || die -} diff --git a/gs_elpa/ebuild.py b/gs_elpa/ebuild.py deleted file mode 100644 index d1d63f2..0000000 --- a/gs_elpa/ebuild.py +++ /dev/null @@ -1,65 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- - -""" - ebuild.py - ~~~~~~~~~~~~~ - - ebuild generation - - :copyright: (c) 2013 by Jauhien Piatlicki - :license: GPL-2, see LICENSE for more details. -""" - -import collections - -from g_sorcery.ebuild import DefaultEbuildGenerator - -Layout = collections.namedtuple("Layout", - ["vars_before_inherit", "inherit", - "vars_after_description", "vars_after_keywords"]) - - -class ElpaEbuildWithDigestGenerator(DefaultEbuildGenerator): - """ - Implementation of ebuild generator with sources digesting. - """ - def __init__(self, package_db): - - vars_before_inherit = \ - ["repo_uri", "source_type", "realname", {"name" : "digest_sources", "value" : "yes"}] - - inherit = ["g-sorcery", "gs-elpa"] - - vars_after_description = \ - ["homepage", {"name" : "src_uri", "value" : "${REPO_URI}${REALNAME}-${PV}.${SUFFIX}"}] - - vars_after_keywords = \ - ["depend", "rdepend"] - - layout = Layout(vars_before_inherit, - inherit, vars_after_description, vars_after_keywords) - - super(ElpaEbuildWithDigestGenerator, self).__init__(package_db, layout) - -class ElpaEbuildWithoutDigestGenerator(DefaultEbuildGenerator): - """ - Implementation of ebuild generator without sources digesting. - """ - def __init__(self, package_db): - - vars_before_inherit = \ - ["repo_uri", "source_type", "realname"] - - inherit = ["g-sorcery", "gs-elpa"] - - vars_after_description = \ - ["homepage"] - - vars_after_keywords = \ - ["depend", "rdepend"] - - layout = Layout(vars_before_inherit, inherit, - vars_after_description, vars_after_keywords) - - super(ElpaEbuildWithoutDigestGenerator, self).__init__(package_db, layout) diff --git a/gs_elpa/elpa_db.py b/gs_elpa/elpa_db.py deleted file mode 100644 index 8f8cd6d..0000000 --- a/gs_elpa/elpa_db.py +++ /dev/null @@ -1,130 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- - -""" - elpa_db.py - ~~~~~~~~~~ - - ELPA package database - - :copyright: (c) 2013 by Jauhien Piatlicki - :license: GPL-2, see LICENSE for more details. -""" - -import sexpdata - -from g_sorcery.compatibility import py2k - -if py2k: - from urlparse import urljoin -else: - from urllib.parse import urljoin - -from g_sorcery.g_collections import Dependency, Package, serializable_elist -from g_sorcery.package_db import DBGenerator -from g_sorcery.exceptions import SyncError - -class ElpaDBGenerator(DBGenerator): - """ - Implementation of database generator for ELPA backend. - """ - def get_download_uries(self, common_config, config): - """ - Download database file from REPO_URI/archive-contents - and parse it with sexpdata. - - Args: - common_config: Backend config. - config: Repository config. - - Returns: - List with one URI entry. - """ - ac_uri = urljoin(config["repo_uri"], 'archive-contents') - return [{"uri" : ac_uri, "parser" : sexpdata.load}] - - def process_data(self, pkg_db, data, common_config, config): - """ - Process downloaded and parsed data and generate tree. - - Args: - pkg_db: Package database. - data: Dictionary with data, keys are file names. - common_config; Backend config. - config: Repository config. - """ - archive_contents = data['archive-contents'] - repo_uri = config["repo_uri"] - - if sexpdata.car(archive_contents) != 1: - raise SyncError('sync failed: ' \ - + repo_uri + ' bad archive contents format') - - pkg_db.add_category('app-emacs') - - PKG_INFO = 2 - PKG_NAME = 0 - - INFO_VERSION = 0 - INFO_DEPENDENCIES = 1 - INFO_DESCRIPTION = 2 - INFO_SRC_TYPE = 3 - - DEP_NAME = 0 - #DEP_VERSION = 1 #we do not use it at the moment - - for entry in sexpdata.cdr(archive_contents): - desc = entry[PKG_INFO].value() - realname = entry[PKG_NAME].value() - - if self.in_config([common_config, config], "exclude", realname): - continue - - pkg = Package("app-emacs", realname, - '.'.join(map(str, desc[INFO_VERSION]))) - source_type = desc[INFO_SRC_TYPE].value() - - allowed_ords = set(range(ord('a'), ord('z'))) \ - | set(range(ord('A'), ord('Z'))) | \ - set(range(ord('0'), ord('9'))) | set(list(map(ord, - ['+', '_', '-', ' ', '.', '(', ')', '[', ']', '{', '}', ',']))) - description = "".join([x for x in desc[INFO_DESCRIPTION] if ord(x) in allowed_ords]) - - deps = desc[INFO_DEPENDENCIES] - dependencies = serializable_elist(separator="\n\t") - for dep in deps: - dep = self.convert_dependency([common_config, config], - dep[DEP_NAME].value(), external = False) - if dep: - dependencies.append(dep) - - properties = {'source_type' : source_type, - 'description' : description, - 'dependencies' : dependencies, - 'depend' : dependencies, - 'rdepend' : dependencies, - 'homepage' : repo_uri, - 'repo_uri' : repo_uri, - 'realname' : realname, - #eclass entry - 'eclasses' : ['g-sorcery', 'gs-elpa'], - #metadata entries - 'maintainer' : [{'email' : 'piatlicki@gmail.com', - 'name' : 'Jauhien Piatlicki'}], - 'longdescription' : description - } - pkg_db.add_package(pkg, properties) - - def convert_internal_dependency(self, configs, dependency): - """ - At the moment we have only internal dependencies, each of them - is just a package name. - - Args: - configs: Backend and repo configs. - dependency: Package name. - - Returns: - Dependency instance with category="app-emacs", package="dependency". - """ - return Dependency("app-emacs", dependency) |