diff --git a/bin/is b/bin/is index 3c51d26b00f57bc0bd5849b4c1b0f80801d3f58a..5e95d0cf71fa0a63698db4c3f7b337347e96c877 100755 --- a/bin/is +++ b/bin/is @@ -23,13 +23,19 @@ def load_repositories(args): ''' Load repository on arg line ''' - # load repo configs repos = [] - for r_config in args.repo_config: - repos += RepoConfigFile(r_config).repos - # filtering on repository name if present - if args.repo_filter is not None: - repos = filter(lambda x: x.name == args.repo_filter, repos) + # load repo configs + if args.repo_path is not None: + # from command line + repos = [ RepositoryConfig(None, path=args.repo_path) ] + else: + # from config + repos += RepoConfigFile(args.repo_config).repos + # filtering on repository name if present + if args.repo_filter is not None: + repos = filter(lambda x: x.name == args.repo_filter, repos) + # print selected repositories + debug("Loaded repositories: %s" % [ x.name for x in repos ]) return repos def c_init_image(args): @@ -173,13 +179,12 @@ ex_group.add_argument('-q', "--quiet", action="store_true", # common options p_main.add_argument("-c", "--config", default="installsystems", help="config file path") +p_main.add_argument("-R", "--repo-config", default="repository", + help="repository config file path") p_main.add_argument("-f", "--repo-filter", default=None, help="select repository by name in config files") -p_main.add_argument("-r", "--repo-path", action="append", default=[], +p_main.add_argument("-r", "--repo-path", default=None, help="repository path") -p_main.add_argument("-R", "--repo-config", action="append", - default=["repository"], - help="repository config (can be specified more than one time)") p_main.add_argument("-t", "--timeout", dest="timeout", type=int, default=None, help="download timeout") # create a subparsers for each command diff --git a/installsystems/config.py b/installsystems/config.py index 81431e5ac86f55ba8eff34be762857237fa6f04c..4e55e5e8a6f2a5dbc6e388337fc484db3284b081 100644 --- a/installsystems/config.py +++ b/installsystems/config.py @@ -64,7 +64,7 @@ class MainConfigFile(ConfigFile): if self.path is None: debug("No main config file to load") return - debug("Loading config file: %s" % self.path) + debug("Loading main config file: %s" % self.path) try: cp = RawConfigParser() cp.read(self.path) @@ -72,7 +72,7 @@ class MainConfigFile(ConfigFile): if cp.has_section(self.prefix): self._config = dict(cp.items(self.prefix)) except Exception as e: - raise Exception("Unable load file %s: %s" % (self.path, e)) + raise Exception("Unable load main config file %s: %s" % (self.path, e)) def merge(self, namespace): ''' @@ -141,7 +141,7 @@ class RepoConfigFile(ConfigFile): if self.path is None: return # loading config file if exists - debug("Loading config file: %s" % self.path) + debug("Loading repository config file: %s" % self.path) try: cp = RawConfigParser() cp.read(self.path) @@ -153,7 +153,7 @@ class RepoConfigFile(ConfigFile): # get all options in repo self._repos.append(RepositoryConfig(rep, **dict(cp.items(rep)))) except Exception as e: - raise Exception("Unable load file %s: %s" % (self.path, e)) + raise Exception("Unable to load repository file %s: %s" % (self.path, e)) @property def repos(self): diff --git a/installsystems/repository.py b/installsystems/repository.py index 0eaf5fb7c0c278a0aadd0e9fd6ee7cf45c1bcf71..1322e8fba32c8e0caa03f79be6fc4f1d97a17557 100644 --- a/installsystems/repository.py +++ b/installsystems/repository.py @@ -417,7 +417,6 @@ class RepositoryManager(object): if not os.path.exists(filedest): open(filedest, "wb") # get remote last value - print config.lastpath rlast = int(istools.uopen(config.lastpath).read().strip()) # get local last value llast = int(os.stat(filedest).st_mtime)