Skip to content

Commit

Permalink
More info when running the recipe
Browse files Browse the repository at this point in the history
  • Loading branch information
Alvaro Saurin committed Mar 25, 2013
1 parent 3c1e25e commit 6c4d9db
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 11 deletions.
18 changes: 11 additions & 7 deletions as/recipe/frozenpkg/frozen.py
Expand Up @@ -62,7 +62,7 @@ def _create_venv(self, root_dir):
root_dir,
]

logger.debug('Launching "%s"' % (" ".join(virtualenv)))
logger.info('Creating virtualenv by launching "%s".' % (" ".join(virtualenv)))
job = subprocess.Popen(virtualenv,
stdout = subprocess.PIPE,
stderr = subprocess.STDOUT)
Expand Down Expand Up @@ -94,6 +94,7 @@ def _copy_eggs (self, root_dir):
[self.buildout['buildout']['develop-eggs-directory'], self.buildout['buildout']['eggs-directory']]
)

logger.info('Installing eggs in virtualenv.')
for dist in ws:
if any([re.match(pattern, dist.location) for pattern in SKIP_EGGS]):
## skip the eggs in SKIP_EGGS
Expand Down Expand Up @@ -134,6 +135,7 @@ def _copy_outputs(self, root_dir):
Copies the outputs from parts
:param root_dir: the root directory where to copy things
"""
logger.info('Copying outputs.')
buildout_dir = self.buildout['buildout']['directory']
for part in self.buildout['buildout']['parts'].split():
try:
Expand All @@ -142,7 +144,7 @@ def _copy_outputs(self, root_dir):
rel_dir = os.path.relpath(output, buildout_dir)
dest_dir = os.path.join(root_dir, os.path.dirname(rel_dir))

logger.debug('Copying %s -> %s' % (rel_dir, dest_dir))
logger.debug('... "%s" -> "%s"' % (rel_dir, dest_dir))
if not os.path.exists(dest_dir):
os.makedirs(dest_dir)
shutil.copy2(output, dest_dir)
Expand All @@ -169,6 +171,7 @@ def _copy_extra_files (self, root_dir, install_prefix):
for r in self.options.get('extra-copies', self.name).split('\n')
if r.strip()]

logger.info('Copying extras.')
for copy_line in extra_copies:
try:
src, dest = [b.strip() for b in copy_line.split("->")]
Expand All @@ -181,21 +184,21 @@ def _copy_extra_files (self, root_dir, install_prefix):

full_path_dest = os.path.normpath(os.path.join(buildroot, dest))
for src_el in glob.glob(src):
logger.debug('Copying %s' % src_el)
logger.debug('... copying "%s".' % src_el)
try:
if os.path.isdir(src_el):
shutil.copytree(src_el, full_path_dest)
else:
# maybe the destination is a directory: then we have to
# create it at the target too...
if dest.endswith('/') and not os.path.exists(full_path_dest):
logger.debug('... creating %s directory' % dest)
logger.debug('... creating "%s" directory.' % dest)
os.makedirs(full_path_dest)

shutil.copy(src_el, full_path_dest)

except Exception, e:
logger.debug('ERROR: when copying %s to %s' % (src_el, full_path_dest))
logger.debug('ERROR: when copying "%s" to "%s"' % (src_el, full_path_dest))

return pythonpath

Expand All @@ -211,7 +214,7 @@ def _prepare_venv(self, root_dir):
root_dir,
]

logger.debug('Launching "%s"' % (" ".join(virtualenv)))
logger.info('Making virtualenv relocatable with "%s".' % (" ".join(virtualenv)))
job = subprocess.Popen(virtualenv,
stdout = subprocess.PIPE,
stderr = subprocess.STDOUT)
Expand All @@ -222,14 +225,15 @@ def _prepare_venv(self, root_dir):
sys.exit(1)

local_dir = os.path.join(root_dir, "local")
logger.debug('Removing"%s"' % local_dir)
logger.debug('Removing "%s".' % local_dir)
shutil.rmtree(local_dir)


def _create_tar (self, root_dir, filename, compress = False):
"""
Create a tar file from the virtualenv
"""
logger.info('Creating tar file.')
import tarfile
with tarfile.open(filename, 'w' if not compress else 'w:gz', dereference = True) as t:
for name in glob.glob(os.path.join(root_dir, '*')):
Expand Down
5 changes: 2 additions & 3 deletions as/recipe/frozenpkg/frozenrpm.py
Expand Up @@ -173,7 +173,6 @@ def install (self):
tar_filename = os.path.join(top_rpmbuild_dir, "SOURCES", pkg_name + ".tar")
tar_filename = self._create_tar(buildroot_topdir, tar_filename)


# launch rpmbuild
command = [
"rpmbuild",
Expand All @@ -183,12 +182,12 @@ def install (self):
"-ta", tar_filename,
]

logger.debug('Launching "%s"' % ' '.join(command))
logger.info('Launching "%s".' % ' '.join(command))
job = subprocess.Popen(command, stdout = subprocess.PIPE, stderr = subprocess.STDOUT)
stdout, _ = job.communicate()

if job.returncode != 0:
logger.critical('could not build the RPM')
logger.critical('could not build the RPM.')
print stdout
return []

Expand Down
2 changes: 1 addition & 1 deletion setup.py
Expand Up @@ -4,7 +4,7 @@
import os


__VERSION__ = '0.2.17'
__VERSION__ = '0.2.18'


#def read(*rnames):
Expand Down

0 comments on commit 6c4d9db

Please sign in to comment.