parser.add_argument("--distro", nargs="?", default="ipfire3", # XXX for now
help=_("Choose the distribution configuration to use for build"))
+ # Enable/disable repositories
+ parser.add_argument("--disable-repo", nargs="*", metavar="REPO",
+ help=_("Disable a repository"), default=[])
+ parser.add_argument("--enable-repo", nargs="*", metavar="REPO",
+ help=_("Enable a repository"), default=[])
+
# build
build = subparsers.add_parser("build", help=_("Build one or more packages"))
build.add_argument("package", nargs="+",
args = parser.parse_args()
+ # Disable snapshots when repositories are enabled/disabled
+ if "disable_snapshot" in args:
+ args.disable_snapshot = args.disable_snapshot or \
+ (args.enable_repo or args.disable_repo)
+
# Print usage if no action was given
if not "func" in args:
parser.print_usage()
debug=ns.debug,
)
- return pakfire.Pakfire(arch=ns.arch, conf=conf, logger=logger.log)
+ # Create a new Pakfire instance
+ p = pakfire.Pakfire(arch=ns.arch, conf=conf, logger=logger.log)
+
+ # Enable/disable repositories
+ for repo in p.repos:
+ if repo.name in ns.enable_repo:
+ repo.enabled = True
+
+ if repo.name in ns.disable_repo:
+ repo.enabled = False
+
+ return p
def __call__(self):
# Parse command line arguments