--- /dev/null
+PACKAGE = createrepo
+VERSION = 0.1
+SHELL = /bin/sh
+top_srcdir = .
+srcdir = .
+prefix = /usr
+exec_prefix = ${prefix}
+
+bindir = ${exec_prefix}/bin
+sbindir = ${exec_prefix}/sbin
+libexecdir = ${exec_prefix}/libexec
+datadir = ${prefix}/share
+sysconfdir = ${prefix}/etc
+sharedstatedir = ${prefix}/com
+localstatedir = ${prefix}/var
+libdir = ${exec_prefix}/lib
+infodir = ${prefix}/info
+docdir =
+includedir = ${prefix}/include
+oldincludedir = /usr/include
+mandir = ${prefix}/man
+
+pkgdatadir = $(datadir)/$(PACKAGE)
+pkglibdir = $(libdir)/$(PACKAGE)
+pkgincludedir = $(includedir)/$(PACKAGE)
+top_builddir =
+
+# all dirs
+DIRS = $(DESTDIR)$(bindir) $(DESTDIR)/etc $(DESTDIR)$(pkgdatadir)
+
+
+# INSTALL scripts
+INSTALL = install -p --verbose
+INSTALL_BIN = $(INSTALL) -m 755
+INSTALL_DIR = $(INSTALL) -m 755 -d
+INSTALL_DATA = $(INSTALL) -m 644
+INSTALL_MODULES = $(INSTALL) -m 755 -D
+RM = rm -f
+
+SUBDIRS = bin
+
+MODULES = $(srcdir)/genpkgmetadata.py \
+ $(srcdir)/dumpMetadata.py
+
+.SUFFIXES: .py .pyc
+.py.pyc:
+ python -c "import py_compile; py_compile.compile($*.py)"
+
+
+all: $(MODULES)
+ for subdir in $(SUBDIRS) ; do \
+ $(MAKE) -C $$subdir ; \
+ done
+
+check:
+ pychecker $(MODULES) || exit 0
+
+install: all installdirs
+ $(INSTALL_MODULES) $(srcdir)/$(MODULES) $(DESTDIR)$(pkgdatadir)
+ for subdir in $(SUBDIRS) ; do \
+ $(MAKE) -C $$subdir install ; \
+ done
+
+installdirs:
+ for dir in $(DIRS) ; do \
+ $(INSTALL_DIR) $$dir ; \
+ done
+
+
+uninstall:
+ for module in $(MODULES) ; do \
+ $(RM) $(pkgdatadir)/$$module ; \
+ done
+ for subdir in $(SUBDIRS) ; do \
+ $(MAKE) -C $$subdir uninstall ; \
+ done
+
+clean:
+ $(RM) *.pyc *.pyo
+ for subdir in $(SUBDIRS) ; do \
+ $(MAKE) -C $$subdir clean ; \
+ done
+
+distclean: clean
+ $(RM) -r .libs
+ $(RM) core
+ $(RM) *~
+ for subdir in $(SUBDIRS) ; do \
+ $(MAKE) -C $$subdir distclean ; \
+ done
+
+mostlyclean:
+ $(MAKE) clean
+
+
+maintainer-clean:
+ $(MAKE) distclean
+ $(RM) $(srcdir)/configure
+
+
+dist:
+ olddir=`pwd`; \
+ distdir=$(PACKAGE)-$(VERSION); \
+ $(RM) -r .disttmp; \
+ $(INSTALL_DIR) .disttmp; \
+ $(INSTALL_DIR) .disttmp/$$distdir; \
+ $(MAKE) distfiles
+ distdir=$(PACKAGE)-$(VERSION); \
+ cd .disttmp; \
+ tar -cvz > ../$$distdir.tar.gz $$distdir; \
+ cd $$olddir
+ $(RM) -r .disttmp
+
+daily:
+ olddir=`pwd`; \
+ distdir=$(PACKAGE); \
+ $(RM) -r .disttmp; \
+ $(INSTALL_DIR) .disttmp; \
+ $(INSTALL_DIR) .disttmp/$$distdir; \
+ $(MAKE) dailyfiles
+ day=`/bin/date +%Y%m%d`; \
+ distdir=$(PACKAGE); \
+ tarname=$$distdir-$$day ;\
+ cd .disttmp; \
+ perl -pi -e "s/\#DATE\#/$$day/g" $$distdir/$(PACKAGE)-daily.spec; \
+ echo $$day; \
+ tar -cvz > ../$$tarname.tar.gz $$distdir; \
+ cd $$olddir
+ $(RM) -rf .disttmp
+
+dailyfiles:
+ distdir=$(PACKAGE); \
+ cp \
+ $(srcdir)/*.py \
+ $(srcdir)/Makefile \
+ $(srcdir)/$(PACKAGE).spec
+ $(top_srcdir)/.disttmp/$$distdir
+ for subdir in $(SUBDIRS) ; do \
+ $(MAKE) -C $$subdir dailyfiles ; \
+ done
+
+distfiles:
+ distdir=$(PACKAGE)-$(VERSION); \
+ cp \
+ $(srcdir)/*.py \
+ $(srcdir)/Makefile \
+ $(srcdir)/$(PACKAGE).spec \
+ $(top_srcdir)/.disttmp/$$distdir
+ for subdir in $(SUBDIRS) ; do \
+ $(MAKE) -C $$subdir distfiles ; \
+ done
+
+archive: dist
+
+.PHONY: todo
+todo:
+ @echo ---------------===========================================
+ @grep -n TODO\\\|FIXME `find . -type f` | grep -v grep
+ @echo ---------------===========================================
+.PHONY: all install install-strip uninstall clean distclean mostlyclean maintainer-clean info dvi dist distfiles check installcheck installdirs daily dailyfiles
--- /dev/null
+PACKAGE = createrepo
+VERSION = 0.1
+SHELL = /bin/sh
+top_srcdir = ..
+srcdir = ../bin
+prefix = /usr
+exec_prefix = ${prefix}
+
+bindir = ${exec_prefix}/bin
+sbindir = ${exec_prefix}/sbin
+libexecdir = ${exec_prefix}/libexec
+datadir = ${prefix}/share
+sysconfdir = ${prefix}/etc
+sharedstatedir = ${prefix}/com
+localstatedir = ${prefix}/var
+libdir = ${exec_prefix}/lib
+infodir = ${prefix}/info
+docdir =
+includedir = ${prefix}/include
+oldincludedir = /usr/include
+mandir = ${prefix}/man
+
+pkgdatadir = $(datadir)/$(PACKAGE)
+pkglibdir = $(libdir)/$(PACKAGE)
+pkgincludedir = $(includedir)/$(PACKAGE)
+top_builddir = ../
+
+# all dirs
+DIRS = $(DESTDIR)$(bindir) $(DESTDIR)/etc $(DESTDIR)$(pkgdatadir)
+
+
+# INSTALL scripts
+INSTALL = install -p --verbose
+INSTALL_BIN = $(INSTALL) -m 755
+INSTALL_DIR = $(INSTALL) -m 755 -d
+INSTALL_DATA = $(INSTALL) -m 644
+INSTALL_MODULES = $(INSTALL) -m 755 -D
+RM = rm -f
+
+
+all: $(srcdir)/createrepo
+
+
+install: all installdirs
+ $(INSTALL_BIN) $(srcdir)/createrepo $(DESTDIR)$(bindir)/createrepo
+
+
+uninstall:
+ $(RM) $(bindir)/createrepo
+
+
+
+clean:
+
+
+distclean:
+ $(RM) -rf .libs
+ $(RM) -f core
+ $(RM) -f *~
+
+
+mostlyclean:
+ $(MAKE) clean
+
+
+maintainer-clean:
+ $(MAKE) distclean
+
+
+distfiles:
+ distdir=$(PACKAGE)-$(VERSION); \
+ mkdir $(top_srcdir)/.disttmp/$$distdir/bin;\
+ cp \
+ $(srcdir)/createrepo \
+ $(srcdir)/Makefile \
+ $(top_srcdir)/.disttmp/$$distdir/bin
+
+dailyfiles:
+ distdir=$(PACKAGE); \
+ mkdir $(top_srcdir)/.disttmp/$$distdir/bin;\
+ cp \
+ $(srcdir)/createrepo \
+ $(srcdir)/Makefile \
+ $(top_srcdir)/.disttmp/$$distdir/bin
+
+installdirs:
+ $(MAKE) -C $(top_srcdir) installdirs
+
+
+.PHONY: all install install-strip uninstall clean distclean mostlyclean maintainer-clean info dvi dist distfiles check installcheck installdirs dailyfiles
+
+
+
-#!/usr/bin/python -tt
+#!/usr/bin/python -t
# primary functions and glue for generating the repository metadata
#
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
# Copyright 2003 Duke University
-$Id$
+
+# $Id$
+
+
import os
import sys
import getopt
def errorprint(stuff):
print >> sys.stderr, stuff
+def _(args):
+ """Stub function for translation"""
+ return args
+
def usage():
- print """
+ print _("""
%s [options] directory-of-packages
Options:
-h, --help = show this help
-V, --version = output version
- """ % os.path.basename(sys.argv[0])
+ """) % os.path.basename(sys.argv[0])
sys.exit(1)
try:
dir_list = os.listdir(path)
except OSError, e:
- errorprint('Error accessing directory %s, %s' % (path, e))
+ errorprint(_('Error accessing directory %s, %s') % (path, e))
sys.exit(1)
for d in dir_list:
'baseurl=', 'groupfile=',
'checksum=', 'version'])
except getopt.error, e:
- errorprint('Options Error: %s.' % e)
+ errorprint(_('Options Error: %s.') % e)
usage()
try:
cmds['quiet'] = 1
elif arg in ['-u', '--baseurl']:
if cmds['baseurl'] is not None:
- errorprint('Error: Only one baseurl allowed.')
+ errorprint(_('Error: Only one baseurl allowed.'))
usage()
else:
cmds['baseurl'] = a
elif arg in ['-g', '--groupfile']:
if cmds['groupfile'] is not None:
- errorprint('Error: Only one groupfile allowed.')
+ errorprint(_('Error: Only one groupfile allowed.'))
usage()
else:
cmds['groupfile'] = a
cmds['excludes'].append(a)
elif arg in ['-s', '--checksum']:
if a not in ['md5', 'sha']:
- errorprint('Error: checksums are: md5 or sha.')
+ errorprint(_('Error: checksums are: md5 or sha.'))
usage()
else:
cmds['sumtype'] = a
except ValueError, e:
- errorprint('Options Error: %s' % e)
+ errorprint(_('Options Error: %s') % e)
usage()
if len(argsleft) != 1:
- errorprint('Error: Only one directory allowed per run.')
+ errorprint(_('Error: Only one directory allowed per run.'))
usage()
else:
directory = argsleft[0]
try:
dumpMetadata.generateXML(basedoc, baseroot, mdobj, cmds['sumtype'])
except dumpMetadata.MDError, e:
- errorprint('\nan error occurred creating primary metadata - hmm %s' % e)
+ errorprint(_('\nAn error occurred creating primary metadata: %s') % e)
continue
try:
dumpMetadata.fileListXML(filesdoc, filesroot, mdobj)
except dumpMetadata.MDError, e:
- errorprint('\nan error occurred creating filelists- hmm %s' % e)
+ errorprint(_('\nAn error occurred creating filelists: %s') % e)
continue
try:
dumpMetadata.otherXML(otherdoc, otherroot, mdobj)
except dumpMetadata.MDError, e:
- errorprint('\nan error occurred - hmm %s' % e)
+ errorprint(_('\nAn error occurred: %s') % e)
continue
if not cmds['quiet']:
print ''
# save them up to the tmp locations:
basedoc.setDocCompressMode(9)
if not cmds['quiet']:
- print 'Saving Primary metadata'
+ print _('Saving Primary metadata')
basedoc.saveFormatFileEnc('.primary.xml.gz', 'UTF-8', 1)
filesdoc.setDocCompressMode(9)
if not cmds['quiet']:
- print 'Saving file lists metadata'
+ print _('Saving file lists metadata')
filesdoc.saveFormatFileEnc('.filelists.xml.gz', 'UTF-8', 1)
otherdoc.setDocCompressMode(9)
if not cmds['quiet']:
- print 'Saving other metadata'
+ print _('Saving other metadata')
otherdoc.saveFormatFileEnc('.other.xml.gz', 'UTF-8', 1)
# move them to their final locations
try:
os.rename(tmp, dest)
except OSError, e:
- errorprint('Error finishing file %s: %s' % (dest, e))
- errorprint('Exiting.')
+ errorprint(_('Error finishing file %s: %s') % (dest, e))
+ errorprint(_('Exiting.'))
os.unlink(tmp)
sys.exit(1)
try:
dumpMetadata.repoXML(reporoot, cmds)
except dumpMetadata.MDError, e:
- errorprint('Error generating repo xml file: %s' % e)
+ errorprint(_('Error generating repo xml file: %s') % e)
sys.exit(1)
try:
repodoc.saveFormatFileEnc('.repomd.xml.gz', 'UTF-8', 1)
except:
- errorprint('Error saving temp file for rep xml')
+ errorprint(_('Error saving temp file for rep xml'))
sys.exit(1)
try:
os.rename('.repomd.xml.gz', cmds['repomdfile'])
except OSError, e:
- errorprint('Error finishing file %s: %s' % (cmds['repomdfile'], e))
- errorprint('Exiting.')
+ errorprint(_('Error finishing file %s: %s') % (cmds['repomdfile'], e))
+ errorprint(_('Exiting.'))
os.unlink('.repomd.xml.gz')
sys.exit(1)
else:
curdir = os.getcwd()
# start the sanity/stupidity checks
if not os.path.exists(directory):
- errorprint('Directory must exist')
+ errorprint(_('Directory must exist'))
usage()
if not os.path.isdir(directory):
- errorprint('Directory of packages must be a directory.')
+ errorprint(_('Directory of packages must be a directory.'))
usage()
if not os.access(directory, os.W_OK):
- errorprint('Directory must be writable.')
+ errorprint(_('Directory must be writable.'))
usage()
# check out the group file if specified
if cmds['groupfile'] is not None:
grpfile = os.path.join(directory, cmds['groupfile'])
if not os.access(grpfile, os.R_OK):
- errorprint('groupfile %s must exist and be readable' % grpfile)
+ errorprint(_('Groupfile %s must exist and be readable') % grpfile)
usage()
# make sure we can write to where we want to write to:
for file in ['primaryfile', 'filelistsfile', 'otherfile', 'repomdfile']:
dirpath = os.path.dirname(filepath)
if os.path.exists(filepath):
if not os.access(filepath, os.W_OK):
- errorprint('error in must be able to write to metadata files:\n -> %s' % filepath)
+ errorprint(_('error in must be able to write to metadata files:\n -> %s') % filepath)
usage()
else:
if not os.access(dirpath, os.W_OK):
- errorprint('must be able to write to path for metadata files:\n -> %s' % dirpath)
+ errorprint(_('must be able to write to path for metadata files:\n -> %s') % dirpath)
usage()
# change to the basedir to work from w/i the path - for relative url paths