def cleanup(self, options): if self._pristine_orig and self._linked and not options.symlink_orig: os.unlink(self._pristine_orig) if self._tmpdir: cleanup_tmp_tree(self._tmpdir)
def main(argv): ret = 0 tmpdir = None pristine_orig = None linked = False repo = None (options, args) = parse_args(argv) if not options: return ExitCodes.parse_error try: try: repo = ImportOrigDebianGitRepository('.') except GitRepositoryError: raise GbpError("%s is not a git repository" % (os.path.abspath('.'))) is_empty = repo.is_empty() if not repo.has_branch(options.upstream_branch) and not is_empty: raise GbpError(no_upstream_branch_msg % options.upstream_branch) (clean, out) = repo.is_clean() if not clean and not is_empty: gbp.log.err( "Repository has uncommitted changes, commit these first: ") raise GbpError(out) # Download the main tarball if options.download: source = download_orig(args[0]) else: source = find_source(options.uscan, args) if not source: return ExitCodes.failed # The main tarball (sourcepackage, version) = detect_name_and_version(repo, source, options) # Additional tarballs we expect to exist component_tarballs = get_component_tarballs(sourcepackage, version, source.path, options.components) tag = repo.version_to_tag(options.upstream_tag, version) if repo.has_tag(tag): raise GbpError("Upstream tag '%s' already exists" % tag) if repo.bare: set_bare_repo_options(options) source, tmpdir = unpack_tarballs(sourcepackage, source, version, component_tarballs, options) (pristine_orig, linked) = prepare_pristine_tar(source.path, sourcepackage, version) # Don't mess up our repo with git metadata from an upstream tarball try: if os.path.isdir(os.path.join(source.unpacked, '.git/')): raise GbpError( "The orig tarball contains .git metadata - giving up.") except OSError: pass try: import_branch = options.upstream_branch filter_msg = ["", " (filtering out %s)" % options.filters ][len(options.filters) > 0] gbp.log.info("Importing '%s' to branch '%s'%s..." % (source.path, import_branch, filter_msg)) gbp.log.info("Source package is %s" % sourcepackage) gbp.log.info("Upstream version is %s" % version) msg = upstream_import_commit_msg(options, version) commit = repo.commit_dir( source.unpacked, msg=msg, branch=import_branch, other_parents=repo.vcs_tag_parent(options.vcs_tag, version), create_missing_branch=is_empty, ) if options.pristine_tar: if pristine_orig: repo.rrr_branch('pristine-tar') repo.create_pristinetar_commits(import_branch, pristine_orig, component_tarballs) else: gbp.log.warn("'%s' not an archive, skipping pristine-tar" % source.path) repo.create_tag(name=tag, msg="Upstream version %s" % version, commit=commit, sign=options.sign_tags, keyid=options.keyid) if is_empty: repo.create_branch(branch=options.debian_branch, rev=commit) repo.force_head(options.debian_branch, hard=True) elif options.merge: repo.rrr_branch(options.debian_branch) debian_branch_merge(repo, tag, version, options) postimport_hook(repo, tag, version, options) # Update working copy and index if we've possibly updated the # checked out branch current_branch = repo.get_branch() if current_branch in [ options.upstream_branch, repo.pristine_tar_branch ]: repo.force_head(current_branch, hard=True) except (gbpc.CommandExecFailed, GitRepositoryError) as err: msg = str(err) or 'Unknown error, please report a bug' raise GbpError("Import of %s failed: %s" % (source.path, msg)) except GbpError as err: if str(err): gbp.log.err(err) ret = 1 if repo and repo.has_rollbacks() and options.rollback: gbp.log.err("Error detected, Will roll back changes.") try: repo.rollback() # Make sure the very last line as an error message gbp.log.err("Rolled back changes after import error.") except Exception as e: gbp.log.err("%s" % e) gbp.log.err("Clean up manually and please report a bug: %s" % repo.rollback_errors) if pristine_orig and linked and not options.symlink_orig: os.unlink(pristine_orig) if tmpdir: cleanup_tmp_tree(tmpdir) if not ret: gbp.log.info("Successfully imported version %s of %s" % (version, source.path)) return ret
def main(argv): ret = 0 tmpdir = '' pristine_orig = None linked = False (options, args) = parse_args(argv) if not options: return 1 try: source = find_source(options.uscan, args) if not source: return ret try: repo = DebianGitRepository('.') except GitRepositoryError: raise GbpError("%s is not a git repository" % (os.path.abspath('.'))) # an empty repo has now branches: initial_branch = repo.get_branch() is_empty = False if initial_branch else True if not repo.has_branch(options.upstream_branch) and not is_empty: raise GbpError(no_upstream_branch_msg % options.upstream_branch) (sourcepackage, version) = detect_name_and_version(repo, source, options) (clean, out) = repo.is_clean() if not clean and not is_empty: gbp.log.err("Repository has uncommitted changes, commit these first: ") raise GbpError(out) if repo.bare: set_bare_repo_options(options) if not source.is_dir(): tmpdir = tempfile.mkdtemp(dir='../') source.unpack(tmpdir, options.filters) gbp.log.debug("Unpacked '%s' to '%s'" % (source.path, source.unpacked)) if source.needs_repack(options): gbp.log.debug("Filter pristine-tar: repacking '%s' from '%s'" % (source.path, source.unpacked)) (source, tmpdir) = repack_source(source, sourcepackage, version, tmpdir, options.filters) (pristine_orig, linked) = prepare_pristine_tar(source.path, sourcepackage, version) # Don't mess up our repo with git metadata from an upstream tarball try: if os.path.isdir(os.path.join(source.unpacked, '.git/')): raise GbpError("The orig tarball contains .git metadata - giving up.") except OSError: pass try: upstream_branch = [ options.upstream_branch, 'master' ][is_empty] filter_msg = ["", " (filtering out %s)" % options.filters][len(options.filters) > 0] gbp.log.info("Importing '%s' to branch '%s'%s..." % (source.path, upstream_branch, filter_msg)) gbp.log.info("Source package is %s" % sourcepackage) gbp.log.info("Upstream version is %s" % version) import_branch = [ options.upstream_branch, None ][is_empty] msg = upstream_import_commit_msg(options, version) if options.vcs_tag: parents = [repo.rev_parse("%s^{}" % options.vcs_tag)] else: parents = None commit = repo.commit_dir(source.unpacked, msg=msg, branch=import_branch, other_parents=parents, ) if options.pristine_tar: if pristine_orig: repo.pristine_tar.commit(pristine_orig, upstream_branch) else: gbp.log.warn("'%s' not an archive, skipping pristine-tar" % source.path) tag = repo.version_to_tag(options.upstream_tag, version) repo.create_tag(name=tag, msg="Upstream version %s" % version, commit=commit, sign=options.sign_tags, keyid=options.keyid) if is_empty: repo.create_branch(options.upstream_branch, rev=commit) repo.force_head(options.upstream_branch, hard=True) elif options.merge: gbp.log.info("Merging to '%s'" % options.debian_branch) repo.set_branch(options.debian_branch) try: repo.merge(tag) except GitRepositoryError: raise GbpError("Merge failed, please resolve.") if options.postimport: epoch = '' if os.access('debian/changelog', os.R_OK): # No need to check the changelog file from the # repository, since we're certain that we're on # the debian-branch cp = ChangeLog(filename='debian/changelog') if cp.has_epoch(): epoch = '%s:' % cp.epoch info = { 'version': "%s%s-1" % (epoch, version) } env = { 'GBP_BRANCH': options.debian_branch } gbpc.Command(options.postimport % info, extra_env=env, shell=True)() # Update working copy and index if we've possibly updated the # checked out branch current_branch = repo.get_branch() if current_branch in [ options.upstream_branch, repo.pristine_tar_branch]: repo.force_head(current_branch, hard=True) except (gbpc.CommandExecFailed, GitRepositoryError) as err: msg = err.__str__() if len(err.__str__()) else '' raise GbpError("Import of %s failed: %s" % (source.path, msg)) except GbpError as err: if len(err.__str__()): gbp.log.err(err) ret = 1 if pristine_orig and linked and not options.symlink_orig: os.unlink(pristine_orig) if tmpdir: cleanup_tmp_tree(tmpdir) if not ret: gbp.log.info("Successfully imported version %s of %s" % (version, source.path)) return ret
env = {'GBP_BRANCH': options.packaging_branch} gbpc.Command(options.postimport % info, extra_env=env, shell=True)() # Update working copy and index if we've possibly updated the # checked out branch current_branch = repo.get_branch() if (current_branch == options.upstream_branch or current_branch == repo.pristine_tar_branch): repo.force_head(current_branch, hard=True) except (GitRepositoryError, gbpc.CommandExecFailed): raise GbpError, "Import of %s failed" % source.path except GbpError, err: if len(err.__str__()): gbp.log.err(err) ret = 1 if tmpdir: cleanup_tmp_tree(tmpdir) if not ret: gbp.log.info("Successfully imported version %s of %s" % (version, source.path)) return ret if __name__ == "__main__": sys.exit(main(sys.argv)) # vim:et:ts=4:sw=4:et:sts=4:ai:set list listchars=tab\:»·,trail\:·:
def main(argv): ret = 0 tmpdir = None pristine_orig = None linked = False repo = None (options, args) = parse_args(argv) if not options: return ExitCodes.parse_error try: try: repo = RollbackDebianGitRepository('.') except GitRepositoryError: raise GbpError("%s is not a git repository" % (os.path.abspath('.'))) is_empty = repo.is_empty() if not repo.has_branch(options.upstream_branch) and not is_empty: raise GbpError(no_upstream_branch_msg % options.upstream_branch) (clean, out) = repo.is_clean() if not clean and not is_empty: gbp.log.err("Repository has uncommitted changes, commit these first: ") raise GbpError(out) # Download the main tarball if options.download: upstream = download_orig(args[0]) else: upstream = find_upstream(options.uscan, args, options.version) if not upstream: return ExitCodes.uscan_up_to_date # The main tarball (name, version) = detect_name_and_version(repo, upstream, options) # Additional tarballs we expect to exist component_tarballs = get_component_tarballs(name, version, upstream.path, options.components) tag = repo.version_to_tag(options.upstream_tag, version) if repo.has_tag(tag): raise GbpError("Upstream tag '%s' already exists" % tag) if repo.bare: set_bare_repo_options(options) upstream, tmpdir = unpack_tarballs(name, upstream, version, component_tarballs, options) try: postunpack_hook(repo, tmpdir, options) except gbpc.CommandExecFailed: raise GbpError() # The hook already printed an error message (pristine_orig, linked) = prepare_pristine_tar(upstream.path, name, version) # Don't mess up our repo with git metadata from an upstream tarball try: if os.path.isdir(os.path.join(upstream.unpacked, '.git/')): raise GbpError("The orig tarball contains .git metadata - giving up.") except OSError: pass try: import_branch = options.upstream_branch filter_msg = ["", " (filtering out %s)" % options.filters][len(options.filters) > 0] gbp.log.info("Importing '%s' to branch '%s'%s..." % (upstream.path, import_branch, filter_msg)) gbp.log.info("Source package is %s" % name) gbp.log.info("Upstream version is %s" % version) msg = upstream_import_commit_msg(options, version) commit = repo.commit_dir(upstream.unpacked, msg=msg, branch=import_branch, other_parents=repo.vcs_tag_parent(options.vcs_tag, version), create_missing_branch=is_empty, ) if options.pristine_tar: if pristine_orig: repo.rrr_branch('pristine-tar') repo.create_pristine_tar_commits(import_branch, pristine_orig, component_tarballs) else: gbp.log.warn("'%s' not an archive, skipping pristine-tar" % upstream.path) repo.create_tag(name=tag, msg="Upstream version %s" % version, commit=commit, sign=options.sign_tags, keyid=options.keyid) if is_empty: repo.create_branch(branch=options.debian_branch, rev=commit) repo.force_head(options.debian_branch, hard=True) # In an empty repo avoid master branch defaulted to by # git and check out debian branch instead. if not repo.bare: cur = repo.branch if cur != options.debian_branch: repo.set_branch(options.debian_branch) repo.delete_branch(cur) elif options.merge: repo.rrr_branch(options.debian_branch) debian_branch_merge(repo, tag, version, options) # Update working copy and index if we've possibly updated the # checked out branch current_branch = repo.get_branch() if current_branch in [options.upstream_branch, repo.pristine_tar_branch]: repo.force_head(current_branch, hard=True) postimport_hook(repo, tag, version, options) except (gbpc.CommandExecFailed, GitRepositoryError) as err: msg = str(err) or 'Unknown error, please report a bug' raise GbpError("Import of %s failed: %s" % (upstream.path, msg)) except KeyboardInterrupt: raise GbpError("Import of %s failed: aborted by user" % (upstream.path)) except GbpError as err: if str(err): gbp.log.err(err) ret = 1 rollback(repo, options) if pristine_orig and linked and not options.symlink_orig: os.unlink(pristine_orig) if tmpdir: cleanup_tmp_tree(tmpdir) if not ret: gbp.log.info("Successfully imported version %s of %s" % (version, upstream.path)) return ret
def main(argv): ret = 0 tmpdir = '' pristine_orig = None linked = False repo = None (options, args) = parse_args(argv) if not options: return ExitCodes.parse_error try: try: repo = ImportOrigDebianGitRepository('.') except GitRepositoryError: raise GbpError("%s is not a git repository" % (os.path.abspath('.'))) is_empty = repo.is_empty() if not repo.has_branch(options.upstream_branch) and not is_empty: raise GbpError(no_upstream_branch_msg % options.upstream_branch) (clean, out) = repo.is_clean() if not clean and not is_empty: gbp.log.err("Repository has uncommitted changes, commit these first: ") raise GbpError(out) # Download the main tarball if options.download: source = download_orig(args[0]) else: source = find_source(options.uscan, args) if not source: return ExitCodes.failed # The main tarball (sourcepackage, version) = detect_name_and_version(repo, source, options) # Additionl tarballs we expect to exist component_tarballs = get_component_tarballs(sourcepackage, version, source.path, options.components) tag = repo.version_to_tag(options.upstream_tag, version) if repo.has_tag(tag): raise GbpError("Upstream tag '%s' already exists" % tag) if repo.bare: set_bare_repo_options(options) if not source.is_dir(): # Unpack main tarball tmpdir = tempfile.mkdtemp(dir='../') source.unpack(tmpdir, options.filters) gbp.log.debug("Unpacked '%s' to '%s'" % (source.path, source.unpacked)) if orig_needs_repack(source, options): gbp.log.debug("Filter pristine-tar: repacking '%s' from '%s'" % (source.path, source.unpacked)) (source, tmpdir) = repack_source(source, sourcepackage, version, tmpdir, options.filters) if not source.is_dir(): # Unpack component tarballs for (component, tarball) in component_tarballs: unpack_component_tarball(source.unpacked, component, tarball, options.filters) (pristine_orig, linked) = prepare_pristine_tar(source.path, sourcepackage, version) # Don't mess up our repo with git metadata from an upstream tarball try: if os.path.isdir(os.path.join(source.unpacked, '.git/')): raise GbpError("The orig tarball contains .git metadata - giving up.") except OSError: pass try: import_branch = options.upstream_branch filter_msg = ["", " (filtering out %s)" % options.filters][len(options.filters) > 0] gbp.log.info("Importing '%s' to branch '%s'%s..." % (source.path, import_branch, filter_msg)) gbp.log.info("Source package is %s" % sourcepackage) gbp.log.info("Upstream version is %s" % version) msg = upstream_import_commit_msg(options, version) commit = repo.commit_dir(source.unpacked, msg=msg, branch=import_branch, other_parents=repo.vcs_tag_parent(options.vcs_tag, version), create_missing_branch=is_empty, ) if options.pristine_tar: if pristine_orig: repo.rrr_branch('pristine-tar') repo.create_pristinetar_commits(import_branch, pristine_orig, component_tarballs) else: gbp.log.warn("'%s' not an archive, skipping pristine-tar" % source.path) repo.create_tag(name=tag, msg="Upstream version %s" % version, commit=commit, sign=options.sign_tags, keyid=options.keyid) if is_empty: repo.create_branch(branch=options.debian_branch, rev=commit) repo.force_head(options.debian_branch, hard=True) elif options.merge: repo.rrr_branch(options.debian_branch) debian_branch_merge(repo, tag, version, options) # Update working copy and index if we've possibly updated the # checked out branch current_branch = repo.get_branch() if current_branch in [options.upstream_branch, repo.pristine_tar_branch]: repo.force_head(current_branch, hard=True) except (gbpc.CommandExecFailed, GitRepositoryError) as err: msg = str(err) or 'Unknown error, please report a bug' raise GbpError("Import of %s failed: %s" % (source.path, msg)) except GbpError as err: if str(err): gbp.log.err(err) ret = 1 if repo and repo.has_rollbacks() and options.rollback: gbp.log.err("Error detected, Will roll back changes.") try: repo.rollback() # Make sure the very last line as an error message gbp.log.err("Rolled back changes after import error.") except Exception as e: gbp.log.err("%s" % e) gbp.log.err("Clean up manually and please report a bug: %s" % repo.rollback_errors) if pristine_orig and linked and not options.symlink_orig: os.unlink(pristine_orig) if tmpdir: cleanup_tmp_tree(tmpdir) if not ret: gbp.log.info("Successfully imported version %s of %s" % (version, source.path)) return ret
def main(argv): ret = 0 tmpdir = None pristine_orig = None linked = False repo = None (options, args) = parse_args(argv) if not options: return ExitCodes.parse_error try: try: repo = RollbackDebianGitRepository('.') except GitRepositoryError: raise GbpError("%s is not a git repository" % (os.path.abspath('.'))) is_empty = repo.is_empty() if not repo.has_branch(options.upstream_branch) and not is_empty: raise GbpError(no_upstream_branch_msg % options.upstream_branch) (clean, out) = repo.is_clean() if not clean and not is_empty: gbp.log.err("Repository has uncommitted changes, commit these first: ") raise GbpError(out) # Download the main tarball if options.download: sources = [download_orig(args[0])] else: sources = [find_upstream(options.uscan, args, options.version)] if not sources[0]: return ExitCodes.uscan_up_to_date # The main tarball (name, version) = detect_name_and_version(repo, sources[0], options) # Additional tarballs we expect to exist sources += get_component_tarballs(name, version, sources[0].path, options.components) tag = repo.version_to_tag(options.upstream_tag, version) if repo.has_tag(tag): raise GbpError("Upstream tag '%s' already exists" % tag) if repo.bare: set_bare_repo_options(options) sources, tmpdir = unpack_tarballs(repo, name, sources, version, options) if options.verbose: for source in sources: gbp.log.info(source) (pristine_orig, linked) = prepare_pristine_tar(sources[0].path, name, version) # Don't mess up our repo with git metadata from an upstream tarball try: if os.path.isdir(os.path.join(sources[0].unpacked, '.git/')): raise GbpError("The orig tarball contains .git metadata - giving up.") except OSError: pass try: import_branch = options.upstream_branch filter_msg = ["", " (filtering out %s)" % options.filters][len(options.filters) > 0] gbp.log.info("Importing '%s' to branch '%s'%s..." % (sources[0].path, import_branch, filter_msg)) gbp.log.info("Source package is %s" % name) gbp.log.info("Upstream version is %s" % version) msg = upstream_import_commit_msg(options, version) commit = repo.commit_dir(sources[0].unpacked, msg=msg, branch=import_branch, other_parents=repo.vcs_tag_parent(options.vcs_tag, version), create_missing_branch=is_empty, ) if options.pristine_tar: if pristine_orig: repo.rrr_branch('pristine-tar') for source in sources: # Enforce signature file exists with --upstream-signatures=on if options.upstream_signatures.is_on() and not source.signaturefile: raise GbpError("%s does not have a signature file" % source.path) elif options.upstream_signatures.is_off(): source.signaturefile = None # For all practical purposes we're interested in pristine_orig's path if pristine_orig != sources[0].path: sources[0]._path = pristine_orig repo.create_pristine_tar_commits(import_branch, sources) else: gbp.log.warn("'%s' not an archive, skipping pristine-tar" % sources[0].path) repo.create_tag(name=tag, msg="Upstream version %s" % version, commit=commit, sign=options.sign_tags, keyid=options.keyid) if is_empty: repo.create_branch(branch=options.debian_branch, rev=commit) repo.force_head(options.debian_branch, hard=True) # In an empty repo avoid master branch defaulted to by # git and check out debian branch instead. if not repo.bare: cur = repo.branch if cur != options.debian_branch: repo.set_branch(options.debian_branch) repo.delete_branch(cur) elif options.merge: repo.rrr_branch(options.debian_branch) debian_branch_merge(repo, tag, version, options) # Update working copy and index if we've possibly updated the # checked out branch current_branch = repo.get_branch() if current_branch in [options.upstream_branch, repo.pristine_tar_branch]: repo.force_head(current_branch, hard=True) postimport_hook(repo, tag, version, options) except (gbpc.CommandExecFailed, GitRepositoryError) as err: msg = str(err) or 'Unknown error, please report a bug' raise GbpError("Import of %s failed: %s" % (sources[0].path, msg)) except KeyboardInterrupt: raise GbpError("Import of %s failed: aborted by user" % (sources[0].path)) except GbpError as err: if str(err): gbp.log.err(err) ret = 1 rollback(repo, options) if pristine_orig and linked and not options.symlink_orig: os.unlink(pristine_orig) if tmpdir: cleanup_tmp_tree(tmpdir) if not ret: gbp.log.info("Successfully imported version %s of %s" % (version, sources[0].path)) return ret
def main(argv): ret = 0 tmpdir = "" pristine_orig = None linked = False (options, args) = parse_args(argv) if not options: return 1 try: try: repo = DebianGitRepository(".") except GitRepositoryError: raise GbpError("%s is not a git repository" % (os.path.abspath("."))) # an empty repo has now branches: initial_branch = repo.get_branch() is_empty = False if initial_branch else True if not repo.has_branch(options.upstream_branch) and not is_empty: raise GbpError(no_upstream_branch_msg % options.upstream_branch) (clean, out) = repo.is_clean() if not clean and not is_empty: gbp.log.err("Repository has uncommitted changes, commit these first: ") raise GbpError(out) # Download the source if options.download: source = download_orig(args[0]) else: source = find_source(options.uscan, args) if not source: return ret (sourcepackage, version) = detect_name_and_version(repo, source, options) tag = repo.version_to_tag(options.upstream_tag, version) if repo.has_tag(tag): raise GbpError("Upstream tag '%s' already exists" % tag) if repo.bare: set_bare_repo_options(options) if not source.is_dir(): tmpdir = tempfile.mkdtemp(dir="../") source.unpack(tmpdir, options.filters) gbp.log.debug("Unpacked '%s' to '%s'" % (source.path, source.unpacked)) if orig_needs_repack(source, options): gbp.log.debug("Filter pristine-tar: repacking '%s' from '%s'" % (source.path, source.unpacked)) (source, tmpdir) = repack_source(source, sourcepackage, version, tmpdir, options.filters) (pristine_orig, linked) = prepare_pristine_tar(source.path, sourcepackage, version) # Don't mess up our repo with git metadata from an upstream tarball try: if os.path.isdir(os.path.join(source.unpacked, ".git/")): raise GbpError("The orig tarball contains .git metadata - giving up.") except OSError: pass try: upstream_branch = [options.upstream_branch, "master"][is_empty] filter_msg = ["", " (filtering out %s)" % options.filters][len(options.filters) > 0] gbp.log.info("Importing '%s' to branch '%s'%s..." % (source.path, upstream_branch, filter_msg)) gbp.log.info("Source package is %s" % sourcepackage) gbp.log.info("Upstream version is %s" % version) import_branch = [options.upstream_branch, None][is_empty] msg = upstream_import_commit_msg(options, version) if options.vcs_tag: parents = [repo.rev_parse("%s^{}" % repo.version_to_tag(options.vcs_tag, version))] else: parents = None commit = repo.commit_dir(source.unpacked, msg=msg, branch=import_branch, other_parents=parents) if options.pristine_tar: if pristine_orig: repo.pristine_tar.commit(pristine_orig, upstream_branch) else: gbp.log.warn("'%s' not an archive, skipping pristine-tar" % source.path) repo.create_tag( name=tag, msg="Upstream version %s" % version, commit=commit, sign=options.sign_tags, keyid=options.keyid, ) if is_empty: repo.create_branch(options.upstream_branch, rev=commit) repo.force_head(options.upstream_branch, hard=True) if options.debian_branch != "master": repo.rename_branch("master", options.debian_branch) elif options.merge: debian_branch_merge(repo, tag, version, options) # Update working copy and index if we've possibly updated the # checked out branch current_branch = repo.get_branch() if current_branch in [options.upstream_branch, repo.pristine_tar_branch]: repo.force_head(current_branch, hard=True) except (gbpc.CommandExecFailed, GitRepositoryError) as err: msg = str(err) or "Unknown error, please report a bug" raise GbpError("Import of %s failed: %s" % (source.path, msg)) except GbpError as err: if str(err): gbp.log.err(err) ret = 1 if pristine_orig and linked and not options.symlink_orig: os.unlink(pristine_orig) if tmpdir: cleanup_tmp_tree(tmpdir) if not ret: gbp.log.info("Successfully imported version %s of %s" % (version, source.path)) return ret