import fnmatch
import signal
import subprocess
+import argparse
import xml.etree.ElementTree as ET
from collections import defaultdict
from gitbuildsys.errors import UrlError, GbsError
from gitbuildsys.log import LOGGER as log
-from gbp.rpm.git import GitRepositoryError
+from gbp.rpm.git import RpmGitRepository, GitRepositoryError
from gbp.errors import GbpError
return filter_valid_repo(repos)
+class SearchConfAction(argparse.Action):
+ """
+ Action for gitdir position argument to find project special
+ gbs.conf
+ """
+ def __call__(self, parser, namespace, value, option_string=None):
+ from gitbuildsys.conf import configmgr
+
+ workdir = value
+ try:
+ repo = RpmGitRepository(value)
+ workdir = repo.path
+ except GitRepositoryError, err:
+ pass
+
+ prj_conf = os.path.join(workdir, '.gbs.conf')
+ if os.path.exists(prj_conf) and workdir != os.getcwd():
+ configmgr.add_conf(prj_conf)
+ setattr(namespace, self.dest, value)
def git_status_checker(git, opts):
"""
from gitbuildsys.parsing import subparser, GbsHelpFormatter, basename_type
from gitbuildsys import log
from gitbuildsys import cmd_build
+from gitbuildsys.utils import SearchConfAction
@subparser
parser.add_argument('gitdir', nargs='?', type=os.path.abspath,
default=os.getcwd(),
+ action=SearchConfAction,
help='path to git repository')
parser.add_argument('-o', '--outdir', help='output directory')
parser.add_argument('gitdir', nargs='?', type=os.path.abspath,
default=os.getcwd(),
+ action=SearchConfAction,
help='git repository path, which can contain multiple '
'packages, in this case, all packages will be built in '
'dependency order')
parser.add_argument('gitdir', nargs='?', type=os.path.abspath,
default=os.getcwd(),
+ action=SearchConfAction,
help='path to git repository')
parser.add_argument('-T', '--target-obsprj',
parser.add_argument('gitdir', nargs='?', type=os.path.abspath,
default=os.getcwd(),
+ action=SearchConfAction,
help='path to git repository')
parser.add_argument('--spec', type=basename_type,
parser.add_argument('gitdir', nargs='?', type=os.path.abspath,
default=os.getcwd(),
+ action=SearchConfAction,
help='path to git repository')
parser.add_argument('--tag', help='create tag using specified tag name. '