From 5a3f501158fabde4c564c42d7a6d4903aaf040eb Mon Sep 17 00:00:00 2001 From: Brian Stinson Date: Jul 05 2014 09:57:54 +0000 Subject: If outdir is not checked into git when sources() is called, create the appropriate directory (RESOLVES: 0007297) This commit also moves a comment that was checked in on the wrong line --- diff --git a/src/centpkg/__init__.py b/src/centpkg/__init__.py index c1a58aa..72d5e9d 100644 --- a/src/centpkg/__init__.py +++ b/src/centpkg/__init__.py @@ -113,8 +113,20 @@ class Commands(pyrpkg.Commands): csum, file = archive.strip().split(None, 1) except ValueError: raise pyrpkg.rpkgError('Malformed sources file.') - # See if we already have a valid copy downloaded + + # If a directory is specified in the metadata file, append it to + # outdir + if os.path.dirname(file): + outdir = os.path.join(self.path, os.path.dirname(file)) + file = os.path.basename(file) + + # Create the output directory if it's not checked into git + if not os.path.exists(outdir): + self.log.info("Creating OUTDIR: {0}".format(outdir)) + os.makedirs(outdir) + outfile = os.path.join(outdir, file) + # See if we already have a valid copy downloaded if os.path.exists(outfile): if self._verify_file(outfile, csum, self.lookasidehash): continue