From 903f913f736d1c7652f51ebcb94e0696f506065d Mon Sep 17 00:00:00 2001 From: "Rafael G. Martins" Date: Mon, 2 Aug 2010 19:48:49 -0300 Subject: added support to metadata.xml --- g_octave/ebuild.py | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) 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) @@ -142,6 +144,20 @@ IUSE="" DEPEND="%(depend)s" RDEPEND="${DEPEND} \t%(rdepend)s" +""" + + metadata = """\ + + + +\tno-herd +\t +\t\t%(username)s@%(hostname)s +\t +\t +\t\tThe files on this directory was created by g-octave. +\t + """ description = len(self.__desc.description) > 70 and \ @@ -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) -- cgit v1.2.3-65-gdbad