зеркало из https://github.com/mozilla/FlightDeck.git
Merge branch 'fix_500_in_xpi_copy'
This commit is contained in:
Коммит
5b059e52c4
|
@ -531,6 +531,8 @@ class PackageRevision(BaseModel):
|
|||
'contributors': self.get_contributors_list(),
|
||||
'lib': self.get_lib_dir()
|
||||
}
|
||||
if self.package.is_library() and settings.WORKAROUND_SDK_MAIN:
|
||||
manifest['main'] = "%s/%s" % (manifest['lib'], manifest['main'])
|
||||
|
||||
return manifest
|
||||
|
||||
|
@ -1301,7 +1303,8 @@ class PackageRevision(BaseModel):
|
|||
# XPI: Copy files from NFS to local temp dir
|
||||
xpi_utils.sdk_copy(sdk_source, sdk_dir)
|
||||
t1 = (time.time() - tstart) * 1000
|
||||
log.debug("[xpi:%s] SDK copied (time %dms)" % (hashtag, t1))
|
||||
log.debug("[xpi:%s] SDK %s copied from %s (time %dms)" % (
|
||||
hashtag, self.sdk.version, sdk_source, t1))
|
||||
|
||||
|
||||
packages_dir = os.path.join(sdk_dir, 'packages')
|
||||
|
|
|
@ -7,7 +7,7 @@ import tempfile
|
|||
import time
|
||||
|
||||
from mock import Mock
|
||||
from nose.tools import eq_
|
||||
#from nose.tools import eq_
|
||||
from utils.test import TestCase
|
||||
|
||||
from django.contrib.auth.models import User
|
||||
|
@ -50,6 +50,9 @@ class XPIBuildTest(TestCase):
|
|||
settings.ROOT, 'apps/xpi/tests/sample_addons/')
|
||||
self.target_basename = os.path.join(
|
||||
settings.XPI_TARGETDIR, self.hashtag)
|
||||
self.backup_get_source_dir = SDK.get_source_dir
|
||||
SDK.get_source_dir = Mock(return_value=os.path.join(
|
||||
settings.ROOT, 'lib', settings.TEST_SDK))
|
||||
|
||||
def tearDown(self):
|
||||
self.deleteCore()
|
||||
|
@ -61,6 +64,7 @@ class XPIBuildTest(TestCase):
|
|||
os.remove('%s.xpi' % self.target_basename)
|
||||
if os.path.exists('%s.json' % self.target_basename):
|
||||
os.remove('%s.json' % self.target_basename)
|
||||
SDK.get_source_dir = self.backup_get_source_dir
|
||||
|
||||
def makeSDKDir(self):
|
||||
os.mkdir('%s/packages' % self.SDKDIR)
|
||||
|
|
|
@ -95,6 +95,11 @@ def build(sdk_dir, package_dir, filename, hashtag, tstart=None, options=None):
|
|||
hashtag, str(err), cfx))
|
||||
shutil.rmtree(sdk_dir)
|
||||
raise
|
||||
if (settings.WORKAROUND_STDERR and
|
||||
not os.path.exists(os.path.join(package_dir, '%s.xpi' % filename))):
|
||||
badresponse = response[0]
|
||||
response = ['', '']
|
||||
response[1] = badresponse
|
||||
if response[1]:
|
||||
info_write(info_targetpath, 'error', response[1], hashtag)
|
||||
log.critical("[xpi:%s] Failed to build xpi." % hashtag)
|
||||
|
@ -107,7 +112,16 @@ def build(sdk_dir, package_dir, filename, hashtag, tstart=None, options=None):
|
|||
xpi_path = os.path.join(package_dir, "%s.xpi" % filename)
|
||||
xpi_targetfilename = "%s.xpi" % hashtag
|
||||
xpi_targetpath = os.path.join(settings.XPI_TARGETDIR, xpi_targetfilename)
|
||||
shutil.copy(xpi_path, xpi_targetpath)
|
||||
try:
|
||||
shutil.copy(xpi_path, xpi_targetpath)
|
||||
except IOError, err:
|
||||
info_write(info_targetpath, 'error',
|
||||
'XPI file can not be copied.',
|
||||
hashtag)
|
||||
log.critical("[xpi:%s] Failed to copy xpi.\n%s" % (hashtag, str(err)))
|
||||
shutil.rmtree(sdk_dir)
|
||||
return response
|
||||
|
||||
shutil.rmtree(sdk_dir)
|
||||
|
||||
ret = [xpi_targetfilename]
|
||||
|
|
|
@ -126,6 +126,10 @@ ATTACHMENT_MAX_FILESIZE = 2 * 1024 * 1024 # 2MB
|
|||
|
||||
PYTHON_EXEC = 'python'
|
||||
|
||||
|
||||
WORKAROUND_SDK_MAIN = True
|
||||
WORKAROUND_STDERR = True
|
||||
|
||||
# amo defaults
|
||||
XPI_AMO_PREFIX = "ftp://ftp.mozilla.org/pub/mozilla.org/addons/"
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче