aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJauhien Piatlicki (jauhien) <piatlicki@gmail.com>2013-07-09 01:50:07 +0200
committerJauhien Piatlicki (jauhien) <piatlicki@gmail.com>2013-07-09 01:50:07 +0200
commite652256da64a26f3a2417b2ba95b813e8fd610f8 (patch)
tree07f4c895f5bf2d3dad68d9640812f0aadb0a039a
parentebuild generation for ELPA backend added, different fixes in ebuild generator (diff)
downloadg-sorcery-e652256da64a26f3a2417b2ba95b813e8fd610f8.tar.gz
g-sorcery-e652256da64a26f3a2417b2ba95b813e8fd610f8.tar.bz2
g-sorcery-e652256da64a26f3a2417b2ba95b813e8fd610f8.zip
g_elpa: all stuff necessary for ebuild generation
-rw-r--r--g_elpa/data/ebuild_with_digest.tmpl22
-rw-r--r--g_elpa/data/ebuild_without_digest.tmpl8
-rw-r--r--g_elpa/data/g-elpa.eclass13
-rw-r--r--g_elpa/elpa_db.py6
-rw-r--r--tests/test_elpa_ebuild.py41
-rw-r--r--tests/test_elpa_metadata.py47
6 files changed, 121 insertions, 16 deletions
diff --git a/g_elpa/data/ebuild_with_digest.tmpl b/g_elpa/data/ebuild_with_digest.tmpl
new file mode 100644
index 0000000..5575a3b
--- /dev/null
+++ b/g_elpa/data/ebuild_with_digest.tmpl
@@ -0,0 +1,22 @@
+# automatically generated by g-elpa
+# please do not edit this file
+
+EAPI=5
+
+REPO_URI="$repo_uri"
+PKG_TYPE="$source_type"
+REALNAME="$realname"
+
+inherit g-elpa
+
+DESCRIPTION="$description"
+HOMEPAGE="$homepage"
+SRC_URI="$${REPO_URI}$${REALNAME}-$${PV}.$${SUFFIX}"
+LICENSE="GPL-2"
+
+SLOT="0"
+KEYWORDS="~amd64 ~x86"
+IUSE=""
+
+DEPEND="#n#depend#"
+RDEPEND="#n#rdepend#"
diff --git a/g_elpa/data/ebuild_without_digest.tmpl b/g_elpa/data/ebuild_without_digest.tmpl
index 985c406..6c0a895 100644
--- a/g_elpa/data/ebuild_without_digest.tmpl
+++ b/g_elpa/data/ebuild_without_digest.tmpl
@@ -3,6 +3,10 @@
EAPI=5
+REPO_URI="$repo_uri"
+PKG_TYPE="$source_type"
+REALNAME="$realname"
+
inherit g-elpa
DESCRIPTION="$description"
@@ -14,9 +18,5 @@ SLOT="0"
KEYWORDS="~amd64 ~x86"
IUSE=""
-REPO_URI="$repo_uri"
-PKG_TYPE="$source_type"
-REALNAME="$realname"
-
DEPEND="#n#depend#"
RDEPEND="#n#rdepend#"
diff --git a/g_elpa/data/g-elpa.eclass b/g_elpa/data/g-elpa.eclass
index de52313..1b66340 100644
--- a/g_elpa/data/g-elpa.eclass
+++ b/g_elpa/data/g-elpa.eclass
@@ -35,17 +35,18 @@ GELPA_FETCH_CMD="wget"
inherit elisp
if [ x${DIGEST_SOURCES} = x]; then
+ EXPORT_FUNCTIONS src_{unpack,compile,install}
+else
EXPORT_FUNCTIONS src_{compile,install}
+fi
+
+if [[ ${PKG_TYPE} != "single" ]]; then
+ SUFFIX="${PKG_TYPE}"
else
- EXPORT_FUNCTIONS src_{unpack,compile,install}
+ SUFFIX="el"
fi
g-elpa_fetch() {
- if [[ ${PKG_TYPE} != "single" ]]; then
- SUFFIX="${PKG_TYPE}"
- else
- SUFFIX="el"
- fi
addwrite "${GELPA_STORE_DIR}"
pushd "${GELPA_STORE_DIR}" >/dev/null || die "can't chdir to ${GELPA_STORE_DIR}"
local SOURCEFILE=${REALNAME}-${PV}.${SUFFIX}
diff --git a/g_elpa/elpa_db.py b/g_elpa/elpa_db.py
index d5dcc2d..93a628f 100644
--- a/g_elpa/elpa_db.py
+++ b/g_elpa/elpa_db.py
@@ -71,7 +71,11 @@ class ElpaDB(PackageDB):
'rdepend' : depend,
'homepage' : self.repo_uri,
'repo_uri' : self.repo_uri,
- 'realname' : realname
+ 'realname' : realname,
+ #metadata entries
+ 'maintainer' : [{'email' : 'piatlicki@gmail.com',
+ 'name' : 'Jauhien Piatlicki'}],
+ 'longdescription' : description
}
self.add_package(pkg, properties)
diff --git a/tests/test_elpa_ebuild.py b/tests/test_elpa_ebuild.py
index 2c7cdf5..1895340 100644
--- a/tests/test_elpa_ebuild.py
+++ b/tests/test_elpa_ebuild.py
@@ -23,7 +23,7 @@ from tests.test_elpa_db import fill_database, packages
class TestElpaEbuildGenerator(BaseTest):
- def test_generate(self):
+ def test_generate_without_digest(self):
edb = elpa_db.ElpaDB(os.path.join(self.tempdir.name, 'db'),
repo_uri = 'http://127.0.0.1:8080')
fill_database(edb, packages, self.tempdir.name)
@@ -32,27 +32,58 @@ class TestElpaEbuildGenerator(BaseTest):
self.assertEqual(src,
['# automatically generated by g-elpa',
'# please do not edit this file', '',
- 'EAPI=5', '', 'inherit g-elpa', '',
+ 'EAPI=5', '', 'REPO_URI="http://127.0.0.1:8080"',
+ 'PKG_TYPE="tar"', 'REALNAME="ack"', '', 'inherit g-elpa', '',
'DESCRIPTION="Interface to ack-like source code search tools"',
'HOMEPAGE="http://127.0.0.1:8080"', 'SRC_URI=""',
'LICENSE="GPL-2"', '', 'SLOT="0"', 'KEYWORDS="~amd64 ~x86"',
- 'IUSE=""', '', 'REPO_URI="http://127.0.0.1:8080"',
- 'PKG_TYPE="tar"', 'REALNAME="ack"', '', 'DEPEND=""', 'RDEPEND=""'])
+ 'IUSE=""', '', 'DEPEND=""', 'RDEPEND=""'])
src = ebuild_generator.generate(package_db.Package('app-emacs', 'dict-tree', '0.12.8'))
self.assertEqual(src,
['# automatically generated by g-elpa',
'# please do not edit this file', '', 'EAPI=5', '',
+ 'REPO_URI="http://127.0.0.1:8080"', 'PKG_TYPE="tar"',
+ 'REALNAME="dict-tree"', '',
'inherit g-elpa', '', 'DESCRIPTION="Dictionary data structure"',
'HOMEPAGE="http://127.0.0.1:8080"', 'SRC_URI=""',
'LICENSE="GPL-2"', '', 'SLOT="0"',
'KEYWORDS="~amd64 ~x86"', 'IUSE=""', '',
+ 'DEPEND="app-emacs/trie-0.2.5\napp-emacs/tNFA-0.1.1\napp-emacs/heap-0.3"',
+ 'RDEPEND="app-emacs/trie-0.2.5\napp-emacs/tNFA-0.1.1\napp-emacs/heap-0.3"'])
+
+ def test_generate_with_digest(self):
+ edb = elpa_db.ElpaDB(os.path.join(self.tempdir.name, 'db'),
+ repo_uri = 'http://127.0.0.1:8080')
+ fill_database(edb, packages, self.tempdir.name)
+ ebuild_generator = ebuild.ElpaEbuildWithDigestGenerator(edb)
+ src = ebuild_generator.generate(package_db.Package('app-emacs', 'ack', '1.2'))
+ self.assertEqual(src,
+ ['# automatically generated by g-elpa',
+ '# please do not edit this file', '',
+ 'EAPI=5', '', 'REPO_URI="http://127.0.0.1:8080"',
+ 'PKG_TYPE="tar"', 'REALNAME="ack"', '', 'inherit g-elpa', '',
+ 'DESCRIPTION="Interface to ack-like source code search tools"',
+ 'HOMEPAGE="http://127.0.0.1:8080"',
+ 'SRC_URI="${REPO_URI}${REALNAME}-${PV}.${SUFFIX}"',
+ 'LICENSE="GPL-2"', '', 'SLOT="0"', 'KEYWORDS="~amd64 ~x86"',
+ 'IUSE=""', '', 'DEPEND=""', 'RDEPEND=""'])
+ src = ebuild_generator.generate(package_db.Package('app-emacs', 'dict-tree', '0.12.8'))
+ self.assertEqual(src,
+ ['# automatically generated by g-elpa',
+ '# please do not edit this file', '', 'EAPI=5', '',
'REPO_URI="http://127.0.0.1:8080"', 'PKG_TYPE="tar"',
'REALNAME="dict-tree"', '',
+ 'inherit g-elpa', '', 'DESCRIPTION="Dictionary data structure"',
+ 'HOMEPAGE="http://127.0.0.1:8080"',
+ 'SRC_URI="${REPO_URI}${REALNAME}-${PV}.${SUFFIX}"',
+ 'LICENSE="GPL-2"', '', 'SLOT="0"',
+ 'KEYWORDS="~amd64 ~x86"', 'IUSE=""', '',
'DEPEND="app-emacs/trie-0.2.5\napp-emacs/tNFA-0.1.1\napp-emacs/heap-0.3"',
'RDEPEND="app-emacs/trie-0.2.5\napp-emacs/tNFA-0.1.1\napp-emacs/heap-0.3"'])
def suite():
suite = unittest.TestSuite()
- suite.addTest(TestElpaEbuildGenerator('test_generate'))
+ suite.addTest(TestElpaEbuildGenerator('test_generate_without_digest'))
+ suite.addTest(TestElpaEbuildGenerator('test_generate_with_digest'))
return suite
diff --git a/tests/test_elpa_metadata.py b/tests/test_elpa_metadata.py
new file mode 100644
index 0000000..8144999
--- /dev/null
+++ b/tests/test_elpa_metadata.py
@@ -0,0 +1,47 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+
+"""
+ test_elpa_metadata.py
+ ~~~~~~~~~~~~~~~~~~~~~
+
+ ELPA metadata generator test suite
+
+ :copyright: (c) 2013 by Jauhien Piatlicki
+ :license: GPL-2, see LICENSE for more details.
+"""
+
+import os, unittest
+
+from g_sorcery import package_db, metadata
+
+from g_elpa import elpa_db
+
+from tests.base import BaseTest
+
+from tests.test_elpa_db import fill_database, packages
+
+class TestElpaEbuildGenerator(BaseTest):
+
+ def test_generate(self):
+ edb = elpa_db.ElpaDB(os.path.join(self.tempdir.name, 'db'),
+ repo_uri = 'http://127.0.0.1:8080')
+ fill_database(edb, packages, self.tempdir.name)
+ metadata_generator = metadata.MetadataGenerator(edb)
+ mdxml = metadata_generator.generate(package_db.Package('app-emacs', 'ack', '1.2'))
+ self.assertEqual(mdxml,
+ ['<?xml version="1.0" encoding="utf-8"?>',
+ '<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">',
+ '<pkgmetadata>',
+ '\t<maintainer>',
+ '\t\t<email>piatlicki@gmail.com</email>',
+ '\t\t<name>Jauhien Piatlicki</name>',
+ '\t</maintainer>',
+ '\t<longdescription>Interface to ack-like source code search tools</longdescription>',
+ '</pkgmetadata>'])
+
+
+def suite():
+ suite = unittest.TestSuite()
+ suite.addTest(TestElpaEbuildGenerator('test_generate'))
+ return suite