diff options
author | Rafael G. Martins <rafael@rafaelmartins.eng.br> | 2010-08-02 19:48:49 -0300 |
---|---|---|
committer | Rafael G. Martins <rafael@rafaelmartins.eng.br> | 2010-08-02 19:48:49 -0300 |
commit | 903f913f736d1c7652f51ebcb94e0696f506065d (patch) | |
tree | 3d601724cf6cf9084063153cf826d406cb37c45f | |
parent | removed old tinderbox stuff (diff) | |
download | g-octave-903f913f736d1c7652f51ebcb94e0696f506065d.tar.gz g-octave-903f913f736d1c7652f51ebcb94e0696f506065d.tar.bz2 g-octave-903f913f736d1c7652f51ebcb94e0696f506065d.zip |
added support to metadata.xml
-rw-r--r-- | g_octave/ebuild.py | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/g_octave/ebuild.py b/g_octave/ebuild.py index 41d3a30..442eee3 100644 --- a/g_octave/ebuild.py +++ b/g_octave/ebuild.py @@ -24,6 +24,7 @@ from .description_tree import * from .exception import EbuildException from .compat import open +import getpass import os import portage import re @@ -116,6 +117,7 @@ class Ebuild: ebuild_path = os.path.join(self._config.overlay, 'g-octave', self.pkgname) ebuild_file = os.path.join(ebuild_path, '%s-%s.ebuild' % (self.pkgname, self.version)) + metadata_file = os.path.join(ebuild_path, 'metadata.xml') if not os.path.exists(ebuild_path): os.makedirs(ebuild_path, 0o755) @@ -144,6 +146,20 @@ RDEPEND="${DEPEND} \t%(rdepend)s" """ + metadata = """\ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd"> +<pkgmetadata> +\t<herd>no-herd</herd> +\t<maintainer> +\t\t<email>%(username)s@%(hostname)s</email> +\t</maintainer> +\t<longdescription lang="en"> +\t\tThe files on this directory was created by g-octave. +\t</longdescription> +</pkgmetadata> +""" + description = len(self.__desc.description) > 70 and \ self.__desc.description[:70]+'...' or self.__desc.description @@ -192,6 +208,17 @@ RDEPEND="${DEPEND} with open(ebuild_file, 'w') as fp: fp.write(ebuild % vars) + if not os.path.exists(metadata_file): + try: + hostname = os.uname()[1] + except: + hostname = 'localhost' + with open(metadata_file, 'w') as fp: + fp.write(metadata % { + 'username': getpass.getuser(), + 'hostname': hostname, + }) + if manifest: proc = self.__pkg_manager.create_manifest(ebuild_file) |