diff options
author | Guido Günther <agx@sigxcpu.org> | 2009-08-23 15:28:07 +0200 |
---|---|---|
committer | Guido Günther <agx@sigxcpu.org> | 2009-08-23 17:28:50 +0200 |
commit | dcbe091422807d7bd0aede336ab1d12dd65384e5 (patch) | |
tree | 26862d26bd650cb01cc0c91d5220446b6221fe01 | |
parent | 6cbbddf18e2a93c1518faec20ee3f18f64159b05 (diff) | |
download | git-buildpackage-dcbe091422807d7bd0aede336ab1d12dd65384e5.tar.gz git-buildpackage-dcbe091422807d7bd0aede336ab1d12dd65384e5.tar.bz2 git-buildpackage-dcbe091422807d7bd0aede336ab1d12dd65384e5.zip |
use option groups
-rwxr-xr-x | git-import-dsc | 47 | ||||
-rwxr-xr-x | git-import-orig | 64 |
2 files changed, 81 insertions, 30 deletions
diff --git a/git-import-dsc b/git-import-dsc index db372ac7..bb664814 100755 --- a/git-import-dsc +++ b/git-import-dsc @@ -25,9 +25,11 @@ import glob import pipes from email.Utils import parseaddr import gbp.command_wrappers as gbpc -from gbp.deb import debian_version_chars, parse_changelog, unpack_orig, parse_dsc, DscFile, tar_toplevel -from gbp.git import build_tag, create_repo, GitRepository, GitRepositoryError, rfc822_date_to_git -from gbp.config import GbpOptionParser +from gbp.deb import (debian_version_chars, parse_changelog, unpack_orig, + parse_dsc, DscFile, tar_toplevel) +from gbp.git import (build_tag, create_repo, GitRepository, + GitRepositoryError, rfc822_date_to_git) +from gbp.config import GbpOptionParser, GbpOptionGroup from gbp.errors import GbpError @@ -94,18 +96,39 @@ def main(argv): parser = GbpOptionParser(command=os.path.basename(argv[0]), prefix='', usage='%prog [options] /path/to/package.dsc') + import_group = GbpOptionGroup(parser, "import options", + "pristine-tar and filtering") + tag_group = GbpOptionGroup(parser, "tag options", + "options related to git tag creation") + branch_group = GbpOptionGroup(parser, "version and branch naming options", + "version number and branch layout options") + + for group in [import_group, branch_group, tag_group ]: + parser.add_option_group(group) + parser.add_option("-v", "--verbose", action="store_true", dest="verbose", default=False, help="verbose command execution") - parser.add_config_file_option(option_name="debian-branch", dest="debian_branch") - parser.add_config_file_option(option_name="upstream-branch", dest="upstream_branch") - parser.add_option("--no-merge", dest='merge', action="store_false", default=True, + branch_group.add_config_file_option(option_name="debian-branch", + dest="debian_branch") + branch_group.add_config_file_option(option_name="upstream-branch", + dest="upstream_branch") + branch_group.add_option("--no-merge", dest='merge', action="store_false", + default=True, help="after import dont do any merging to another branch") - parser.add_boolean_config_file_option(option_name="sign-tags", dest="sign_tags") - parser.add_config_file_option(option_name="keyid", dest="keyid") - parser.add_config_file_option(option_name="debian-tag", dest="debian_tag") - parser.add_config_file_option(option_name="upstream-tag", dest="upstream_tag") - parser.add_config_file_option(option_name="filter", dest="filters", action="append") - parser.add_boolean_config_file_option(option_name="pristine-tar", dest="pristine_tar") + + tag_group.add_boolean_config_file_option(option_name="sign-tags", + dest="sign_tags") + tag_group.add_config_file_option(option_name="keyid", + dest="keyid") + tag_group.add_config_file_option(option_name="debian-tag", + dest="debian_tag") + tag_group.add_config_file_option(option_name="upstream-tag", + dest="upstream_tag") + + import_group.add_config_file_option(option_name="filter", + dest="filters", action="append") + import_group.add_boolean_config_file_option(option_name="pristine-tar", + dest="pristine_tar") (options, args) = parser.parse_args(argv[1:]) if options.verbose: diff --git a/git-import-orig b/git-import-orig index 32f7e53e..fff88386 100755 --- a/git-import-orig +++ b/git-import-orig @@ -27,9 +27,11 @@ import subprocess import tarfile import time import gbp.command_wrappers as gbpc -from gbp.deb import parse_changelog, unpack_orig, repack_orig, NoChangelogError, has_epoch, tar_toplevel, guess_upstream_version +from gbp.deb import (parse_changelog, unpack_orig, repack_orig, + NoChangelogError, has_epoch, tar_toplevel, + guess_upstream_version) from gbp.git import (GitRepositoryError, GitRepository, build_tag) -from gbp.config import GbpOptionParser +from gbp.config import GbpOptionParser, GbpOptionGroup from gbp.errors import (GbpError, GbpNothingImported) class FastImport(object): @@ -209,26 +211,52 @@ def main(argv): pristine_orig = None parser = GbpOptionParser(command=os.path.basename(argv[0]), prefix='', - usage='%prog [-u version] /path/to/upstream-version.tar.gz') + usage='%prog [-u version] /path/to/upstream-version.tar.gz') - parser.add_option("-u", "--upstream-version", dest="version", + cl_group = GbpOptionGroup(parser, "changelog mangling", + "options for mangling the changelog after the import") + import_group = GbpOptionGroup(parser, "import options", + "pristine-tar and filtering") + tag_group = GbpOptionGroup(parser, "tag options", + "options related to git tag creation") + branch_group = GbpOptionGroup(parser, "version and branch naming options", + "version number and branch layout options") + + for group in [import_group, branch_group, cl_group, tag_group ]: + parser.add_option_group(group) + + cl_group.add_config_file_option(option_name="no-dch", dest='no_dch', + help="don't call dch after the import", action="store_true") + + branch_group.add_option("-u", "--upstream-version", dest="version", help="Upstream Version") + branch_group.add_config_file_option(option_name="debian-branch", + dest="debian_branch") + branch_group.add_config_file_option(option_name="upstream-branch", + dest="upstream_branch") + branch_group.add_option("--no-merge", dest='merge', action="store_false", + default=True, + help="after import dont do any merging to another branch") + + tag_group.add_boolean_config_file_option(option_name="sign-tags", + dest="sign_tags") + tag_group.add_config_file_option(option_name="keyid", + dest="keyid") + tag_group.add_config_file_option(option_name="upstream-tag", + dest="upstream_tag") + + import_group.add_option("--fast-import", action="store_true", + dest="fast_import", default=False, + help="use 'git fastimport' (experimental)") + import_group.add_config_file_option(option_name="filter", + dest="filters", action="append") + import_group.add_boolean_config_file_option(option_name="pristine-tar", + dest="pristine_tar") + import_group.add_boolean_config_file_option(option_name="filter-pristine-tar", + dest="filter_pristine_tar") + parser.add_option("-v", "--verbose", action="store_true", dest="verbose", default=False, help="verbose command execution") - parser.add_option("--fast-import", action="store_true", dest="fast_import", default=False, - help="use 'git fastimport' (experimental)") - parser.add_config_file_option(option_name="debian-branch", dest="debian_branch") - parser.add_config_file_option(option_name="upstream-branch", dest="upstream_branch") - parser.add_option("--no-merge", dest='merge', action="store_false", default=True, - help="after import dont do any merging to another branch") - parser.add_config_file_option(option_name="no-dch", dest='no_dch', - help="don't call dch after the import", action="store_true") - parser.add_boolean_config_file_option(option_name="sign-tags", dest="sign_tags") - parser.add_config_file_option(option_name="keyid", dest="keyid") - parser.add_config_file_option(option_name="upstream-tag", dest="upstream_tag") - parser.add_config_file_option(option_name="filter", dest="filters", action="append") - parser.add_boolean_config_file_option(option_name="pristine-tar", dest="pristine_tar") - parser.add_boolean_config_file_option(option_name="filter-pristine-tar", dest="filter_pristine_tar") (options, args) = parser.parse_args(argv[1:]) if options.verbose: |