Merge lp:~maxb/udd/keep-temp into lp:udd

Proposed by Max Bowsher
Status: Merged
Merged at revision: 365
Proposed branch: lp:~maxb/udd/keep-temp
Merge into: lp:udd
Diff against target: 62 lines (+12/-5)
1 file modified
import_package.py (+12/-5)
To merge this branch: bzr merge lp:~maxb/udd/keep-temp
Reviewer Review Type Date Requested Status
James Westby Approve
Review via email: mp+37409@code.launchpad.net

Description of the change

When learning about the function of the UDD import or debugging an import failure, it can be helpful for it to not delete its temporary working area when done. This branch adds a new option --keep-temp for this purpose.

To post a comment you must log in.
Revision history for this message
James Westby (james-w) wrote :

Looks good.

I would recommend --no-push too, but it's clear that
--no-push isn't sufficient.

Thanks,

James

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'import_package.py'
--- import_package.py 2010-10-03 01:42:50 +0000
+++ import_package.py 2010-10-03 17:36:43 +0000
@@ -46,6 +46,9 @@
46parser.add_option("--no-existing", dest="no_existing", action="store_true")46parser.add_option("--no-existing", dest="no_existing", action="store_true")
47parser.add_option("--extra-debian", dest="extra_debian")47parser.add_option("--extra-debian", dest="extra_debian")
48parser.add_option("--verbose", dest="verbose", action="store_true")48parser.add_option("--verbose", dest="verbose", action="store_true")
49parser.add_option("--keep-temp", dest="keep_temp", action="store_true",
50 help="Do not delete the temporary directory at "
51 "BASE_DIR/updates/PACKAGE_NAME when done")
49parser.add_option("-D", dest="debug_flags", action="append", default=[],52parser.add_option("-D", dest="debug_flags", action="append", default=[],
50 help="Set debug flags, see 'bzr help debug-flags'")53 help="Set debug flags, see 'bzr help debug-flags'")
51parser.add_option("--lp-cache", dest="lp_cache", default=None,54parser.add_option("--lp-cache", dest="lp_cache", default=None,
@@ -901,7 +904,8 @@
901 return filtered_versions904 return filtered_versions
902905
903906
904def main(package, push=True, check=False, extra_debian=None, no_existing=False):907def main(package, push=True, check=False, extra_debian=None, no_existing=False,
908 keep_temp=False):
905 if not os.path.exists(icommon.logs_dir):909 if not os.path.exists(icommon.logs_dir):
906 os.makedirs(icommon.logs_dir)910 os.makedirs(icommon.logs_dir)
907 log_name = os.path.join(icommon.logs_dir, package)911 log_name = os.path.join(icommon.logs_dir, package)
@@ -962,7 +966,8 @@
962 icommon.possibly_generate_ubuntu_merges(lp, temp_dir, package,966 icommon.possibly_generate_ubuntu_merges(lp, temp_dir, package,
963 bstore, possible_transports=possible_transports)967 bstore, possible_transports=possible_transports)
964 print "Nothing new"968 print "Nothing new"
965 shutil.rmtree(temp_dir)969 if not keep_temp:
970 shutil.rmtree(temp_dir)
966 return 0971 return 0
967 # First grab all the branches locally972 # First grab all the branches locally
968 create_update_branches(package, versions, temp_dir, bstore,973 create_update_branches(package, versions, temp_dir, bstore,
@@ -977,7 +982,7 @@
977 import_package(temp_dir, importp, revid_db, bstore, possible_transports=possible_transports)982 import_package(temp_dir, importp, revid_db, bstore, possible_transports=possible_transports)
978 revid_db.commit_outstanding()983 revid_db.commit_outstanding()
979 except:984 except:
980 if push:985 if push and not keep_temp:
981 shutil.rmtree(temp_dir)986 shutil.rmtree(temp_dir)
982 raise987 raise
983 if check:988 if check:
@@ -990,7 +995,8 @@
990 possible_transports=possible_transports)995 possible_transports=possible_transports)
991 icommon.generate_ubuntu_merges(lp, temp_dir, package, bstore,996 icommon.generate_ubuntu_merges(lp, temp_dir, package, bstore,
992 possible_transports=possible_transports)997 possible_transports=possible_transports)
993 shutil.rmtree(temp_dir)998 if not keep_temp:
999 shutil.rmtree(temp_dir)
994 revid_db.commit()1000 revid_db.commit()
995 mutter("Imported %s" % str(versions))1001 mutter("Imported %s" % str(versions))
996 print "Imported %s" % str(versions)1002 print "Imported %s" % str(versions)
@@ -1044,7 +1050,8 @@
1044 try:1050 try:
1045 sys.exit(main(args[0], push=not options.no_push,1051 sys.exit(main(args[0], push=not options.no_push,
1046 extra_debian=options.extra_debian, check=options.check,1052 extra_debian=options.extra_debian, check=options.check,
1047 no_existing=options.no_existing))1053 no_existing=options.no_existing,
1054 keep_temp=options.keep_temp))
1048 except HTTPError, e:1055 except HTTPError, e:
1049 print e.content.decode("utf-8", "replace")1056 print e.content.decode("utf-8", "replace")
1050 raise1057 raise

Subscribers

People subscribed via source and target branches