Exemplo n.º 1
0
    def _download_and_unpack(self, buildscript):
        localfile = self._local_tarball
        if not os.path.exists(self.config.tarballdir):
            try:
                os.makedirs(self.config.tarballdir)
            except OSError:
                raise FatalError(
                    _('tarball dir (%s) can not be created') %
                    self.config.tarballdir)
        try:
            self._check_tarball()
        except BuildStateError:
            # don't have the tarball, try downloading it and check again
            self._download_tarball(buildscript, localfile)
            self._check_tarball()

        # now to unpack it
        try:
            unpack_archive(buildscript, localfile, self.checkoutroot,
                           self.checkoutdir)
        except CommandError:
            raise FatalError(_('failed to unpack %s') % localfile)

        if not os.path.exists(self.srcdir):
            raise BuildStateError(
                _('could not unpack tarball (expected %s dir)') %
                os.path.basename(self.srcdir))

        if self.patches:
            self._do_patches(buildscript)
Exemplo n.º 2
0
    def _download_and_unpack(self, buildscript):
        localfile = self._local_tarball
        if not os.path.exists(self.config.tarballdir):
            try:
                os.makedirs(self.config.tarballdir)
            except OSError:
                raise FatalError(
                        _('tarball dir (%s) can not be created') % self.config.tarballdir)
        try:
            self._check_tarball()
        except BuildStateError:
            # don't have the tarball, try downloading it and check again
            res = self._download_tarball(buildscript, localfile)
            self._check_tarball()

        # now to unpack it
        try:
            unpack_archive(buildscript, localfile, self.checkoutroot, self.checkoutdir)
        except CommandError:
            raise FatalError(_('failed to unpack %s') % localfile)

        if not os.path.exists(self.srcdir):
            raise BuildStateError(_('could not unpack tarball (expected %s dir)'
                        ) % os.path.basename(self.srcdir))

        if self.patches:
            self._do_patches(buildscript)
Exemplo n.º 3
0
    def _download_and_unpack(self, buildscript):
        localfile = self._local_tarball
        if not os.path.exists(self.config.tarballdir):
            try:
                os.makedirs(self.config.tarballdir)
            except OSError:
                raise FatalError(
                    _('tarball dir (%s) can not be created') %
                    self.config.tarballdir)
        if not os.access(self.config.tarballdir, os.R_OK | os.W_OK | os.X_OK):
            raise FatalError(
                _('tarball dir (%s) must be writable') %
                self.config.tarballdir)
        try:
            self._check_tarball()
        except BuildStateError:
            # don't have the tarball, try downloading it and check again
            if has_command('wget'):
                res = buildscript.execute(
                    ['wget', '--continue', self.module, '-O', localfile],
                    extra_env={
                        'LD_LIBRARY_PATH':
                        os.environ.get('UNMANGLED_LD_LIBRARY_PATH'),
                        'PATH':
                        os.environ.get('UNMANGLED_PATH')
                    })
            elif has_command('curl'):
                res = buildscript.execute(
                    [
                        'curl', '--continue-at', '-', '-L', self.module, '-o',
                        localfile
                    ],
                    extra_env={
                        'LD_LIBRARY_PATH':
                        os.environ.get('UNMANGLED_LD_LIBRARY_PATH'),
                        'PATH':
                        os.environ.get('UNMANGLED_PATH')
                    })
            else:
                raise FatalError(_("unable to find wget or curl"))

            self._check_tarball()

        # now to unpack it
        try:
            unpack_archive(buildscript, localfile, self.checkoutroot,
                           self.checkoutdir)
        except CommandError:
            raise FatalError(_('failed to unpack %s') % localfile)

        if not os.path.exists(self.srcdir):
            raise BuildStateError(
                _('could not unpack tarball (expected %s dir)') %
                os.path.basename(self.srcdir))

        if self.patches:
            self._do_patches(buildscript)
Exemplo n.º 4
0
    def _download_and_unpack(self, buildscript):
        localfile = self._local_tarball
        if not os.path.exists(self.config.tarballdir):
            try:
                os.makedirs(self.config.tarballdir)
            except OSError:
                raise FatalError(
                        _('tarball dir (%s) can not be created') % self.config.tarballdir)
        if not os.access(self.config.tarballdir, os.R_OK|os.W_OK|os.X_OK):
            raise FatalError(_('tarball dir (%s) must be writable') % self.config.tarballdir)
        try:
            self._check_tarball()
        except BuildStateError:
            # don't have the tarball, try downloading it and check again
            if has_command('wget'):
                res = buildscript.execute(
                        ['wget', '--continue', self.module, '-O', localfile],
                        extra_env={
                          'LD_LIBRARY_PATH': os.environ.get('UNMANGLED_LD_LIBRARY_PATH'),
                          'PATH': os.environ.get('UNMANGLED_PATH')})
            elif has_command('curl'):
                res = buildscript.execute(
                        ['curl', '--continue-at', '-', '-L', self.module, '-o', localfile],
                        extra_env={
                          'LD_LIBRARY_PATH': os.environ.get('UNMANGLED_LD_LIBRARY_PATH'),
                          'PATH': os.environ.get('UNMANGLED_PATH')})
            else:
                raise FatalError(_("unable to find wget or curl"))

            self._check_tarball()

        # now to unpack it.
        unpack_dir = self.checkoutroot;
        if not os.path.exists(unpack_dir):
            os.makedirs(unpack_dir)

        # now to unpack it
        try:
            unpack_archive(buildscript, localfile, unpack_dir, self.checkoutdir)
        except CommandError:
            raise FatalError(_('failed to unpack %s') % localfile)

        if self.expect_standard_tarball and not os.path.exists(self.srcdir):
            raise BuildStateError(_('could not unpack tarball (expected %s dir)'
                        ) % os.path.basename(self.srcdir))

        if self.patches:
            self._do_patches(buildscript)