from __future__ import absolute_import
from __future__ import print_function
import os, re
+import signal
+import glob
import logging
import urllib
import urlparse
import bb.persist_data, bb.utils
import bb.checksum
from bb import data
+import bb.process
+import subprocess
__version__ = "2"
_checksum_cache = bb.checksum.FileChecksumCache()
open(ud.donestamp, 'w').close()
def subprocess_setup():
- import signal
# Python installs a SIGPIPE handler by default. This is usually not what
# non-Python subprocesses expect.
# SIGPIPE errors are known issues with gzip/bash
Optionally remove the files/directories listed in cleanup upon failure
"""
- import bb.process
- import subprocess
-
# Need to export PATH as binary could be in metadata paths
# rather than host provided
# Also include some other variables.
try:
checksum = _checksum_cache.get_checksum(f)
except OSError as e:
- import traceback
bb.warn("Unable to get checksum for %s SRC_URI entry %s: %s" % (pn, os.path.basename(f), e))
return None
return checksum
checksum = None
if '*' in pth:
# Handle globs
- import glob
for f in glob.glob(pth):
checksum = checksum_file(f)
if checksum:
raise NoMethodError(url)
def unpack(self, urldata, rootdir, data):
- import subprocess
iterate = False
file = urldata.localpath
import bb.msg
import multiprocessing
import fcntl
+import subprocess
+import glob
+import traceback
+import errno
from commands import getstatusoutput
from contextlib import contextmanager
def _print_exception(t, value, tb, realfile, text, context):
error = []
try:
- import traceback
exception = traceback.format_exception_only(t, value)
error.append('Error executing a python function in %s:\n' % realfile)
if not path:
return
if recurse:
- import subprocess, glob
# shutil.rmtree(name) would be ideal but its too slow
subprocess.call(['rm', '-rf'] + glob.glob(path))
return
- import os, errno, glob
for name in glob.glob(path):
try:
os.unlink(name)