return execute_return_value(r);
}
-static PyObject* Pakfire_shell(PakfireObject* self) {
- int r = pakfire_shell(self->pakfire);
+static PyObject* Pakfire_shell(PakfireObject* self, PyObject* args, PyObject* kwargs) {
+ char* kwlist[] = {
+ "install",
+ NULL,
+ };
+ char** packages = NULL;
+
+ // Parse everything
+ if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|O&", kwlist, convert_packages, &packages))
+ return NULL;
+
+ int r = pakfire_shell(self->pakfire, (const char**)packages);
return execute_return_value(r);
}
{
"shell",
(PyCFunction)Pakfire_shell,
- METH_NOARGS,
+ METH_VARARGS|METH_KEYWORDS,
NULL,
},
{
return r;
}
-PAKFIRE_EXPORT int pakfire_shell(struct pakfire* pakfire) {
+PAKFIRE_EXPORT int pakfire_shell(struct pakfire* pakfire, const char** packages) {
int r;
// Setup build environment
if (r)
return r;
+ // Install any additional packages
+ if (packages) {
+ r = pakfire_install(pakfire, 0, packages, NULL, 0, NULL, NULL, NULL);
+ if (r)
+ return r;
+ }
+
// Export local repository if running in interactive mode
r = pakfire_build_enable_repos(pakfire);
if (r)
int pakfire_build(struct pakfire* pakfire, const char* path, const char* target,
const char* id, int flags, pakfire_execute_logging_callback logging_callback, void* data);
-int pakfire_shell(struct pakfire* pakfire);
+int pakfire_shell(struct pakfire* pakfire, const char** packages);
int pakfire_build_clean(struct pakfire* pakfire, int flags);
#endif /* PAKFIRE_BUILD_H */
# shell
shell = subparsers.add_parser("shell", help=_("Go into a build shell"))
+ shell.add_argument("--install", nargs="*",
+ help=_("Install additional packages"),
+ )
shell.set_defaults(func=self._shell)
args = parser.parse_args()
p = self.pakfire(ns)
try:
- p.shell()
+ p.shell(install=ns.install)
# Exit program with the shell's exit code
except pakfire.errors.CommandExecutionError as e: