[Rpm-metadata] createrepo/__init__.py createrepo/yumbased.py

Seth Vidal skvidal at linux.duke.edu
Mon Jan 14 16:47:52 UTC 2008


 createrepo/__init__.py |   34 ++++++++++++++++++++++++++++++++--
 createrepo/yumbased.py |   15 +++++++++++++++
 2 files changed, 47 insertions(+), 2 deletions(-)

New commits:
commit b2513c8c888314463a52599023f076a7d2cb8ea2
Author: Seth Vidal <skvidal at fedoraproject.org>
Date:   Mon Jan 14 11:45:02 2008 -0500

    - add copyright statements and licenses to top of files
    - start function to remove all the directory mauling in genpkgmetadata
    - fixmes

diff --git a/createrepo/__init__.py b/createrepo/__init__.py
index a26a596..f57e06b 100644
--- a/createrepo/__init__.py
+++ b/createrepo/__init__.py
@@ -1,3 +1,18 @@
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU Library General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+# Copyright 2007  Red Hat, Inc - written by seth vidal skvidal at fedoraproject.org
+
 import exceptions
 import os
 import sys
@@ -27,6 +42,7 @@ from utils import _gzipOpen, bzipFile
 __version__ = '0.9.1'
 
 
+
 class MDError(exceptions.Exception):
     def __init__(self, value=None):
         exceptions.Exception.__init__(self)
@@ -65,7 +81,8 @@ class MetaDataConfig(object):
         self.finaldir = 'repodata'
         self.olddir = '.olddata'
         self.mdtimestamp = 0
-
+        self.directory = None
+        self.directories = []
 
 class SimpleMDCallBack(object):
     def errorlog(self, thing):
@@ -79,6 +96,9 @@ class SimpleMDCallBack(object):
         sys.stdout.write("\r%d/%d - %s" % (current, total, item))
         sys.stdout.flush()
             
+#FIXME = make it so you pass in a dir to doPkgMetadata() and it
+# parses out basedir and directory for relative dir from there
+# it creates the .repodata directory in the output location, etc
         
 class MetaDataGenerator:
     def __init__(self, config_obj=None, callback=None):
@@ -95,7 +115,17 @@ class MetaDataGenerator:
         self.pkgcount = 0
         self.files = []
 
-    # module
+    def _setup_and_check_repo_dir(self, direc):
+        if os.path.isabs(direc):
+            self.conf.basedir = os.path.dirname(direc)
+            self.conf.directory = os.path.basename(direc)
+        else:
+            self.conf.basedir = os.path.realpath(self.conf.basedir)
+
+        if not self.conf.opts.outputdir:
+            self.conf.outputdir = os.path.join(self.conf.basedir, direc)
+
+
     def _os_path_walk(self, top, func, arg):
         """Directory tree walk with callback function.
          copy of os.path.walk, fixes the link/stating problem
diff --git a/createrepo/yumbased.py b/createrepo/yumbased.py
index db29f94..b1a638d 100644
--- a/createrepo/yumbased.py
+++ b/createrepo/yumbased.py
@@ -1,4 +1,19 @@
 #!/usr/bin/python -tt
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU Library General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+# Copyright 2007  Red Hat, Inc - written by seth vidal skvidal at fedoraproject.org
+
 
 import os
 import sys



More information about the Rpm-metadata mailing list