-
Notifications
You must be signed in to change notification settings - Fork 363
Bring back --default to allow OBS builds to select an entry point among many #3768
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
8bfaf94
to
d87f24f
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure having this undocumented is a good idea. Having surprise config pickup from a parent could be problematic, we might forget this exists, I sure did already forget --default
still existed as a noop. Besides that I don't have strong objections.
if args.default_config is not None: | ||
if args.directory is not None and not args.default_config.is_absolute(): | ||
context.default_config = args.directory.parent / args.default_config | ||
else: | ||
context.default_config = args.default_config |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since the args.default_config
is None
anyways, this could be shortened into
if args.default_config is not None: | |
if args.directory is not None and not args.default_config.is_absolute(): | |
context.default_config = args.directory.parent / args.default_config | |
else: | |
context.default_config = args.default_config | |
if ( | |
args.default_config is not None: | |
and args.directory is not None | |
and not args.default_config.is_absolute() | |
): | |
context.default_config = args.directory.parent / args.default_config |
(well, it's longer, but slightly less complex)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
With that change, unless args.directory is set, args.default_config is ignored, even if it's an absolute path which would otherwise work
I have no preference, given it's for a specific use case I thought you preferred to have it hidden, but I'll change that |
…ng many When building a mkosi repository called 'particleos', OBS calls mkosi as such: mkosi --directory /usr/src/packages/SOURCES/particleos --default mkosi.conf with mkosi.conf being the source file extracted at source time, ie: defined by the user, among the many files available in the repository. So this can be used to select the entry point, that defines what to build, when a repository provides many build types, profiles, images, etc. Right now --default is a no-op, so make it add the passed conf file as a high priority config file, so that the entry point can have precedence over anything else. The file is placed at: /usr/src/packages/SOURCES/mkosi.conf This cannot be controlled by the user, and it's fixed. Config file parsing requires absolute paths, and aborts otherwise. Because it is called with a filename only, but mkosi executes from the --directory location, special case it and if a non-absolute path is passed, look in the parent of --directory so that the use case of providing an entry point can be enabled.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do I understand it correctly that this "default" file is generated dynamically by OBS?
No, it's extracted from wherever, either the same repo or another |
When building a mkosi repository called 'particleos', OBS calls mkosi as such:
mkosi --directory /usr/src/packages/SOURCES/particleos --default mkosi.conf
with mkosi.conf being the source file extracted at source time, ie: defined by the user, among the many files available in the repository. So this can be used to select the entry point, that defines what to build, when a repository provides many build types, profiles, images, etc.
Right now --default is a no-op, so make it add the passed conf file as a high priority config file, so that the entry point can have precedence over anything else.
The file is placed at:
/usr/src/packages/SOURCES/mkosi.conf
This cannot be controlled by the user, and it's fixed.
Config file parsing requires absolute paths, and aborts otherwise. Because it is called with a filename only, but mkosi executes from the --directory location, special case it and if a non-absolute path is passed, look in the parent of --directory so that the use case of providing an entry point can be enabled.
With this I can add entry points to hidden directories in a repo, or even outside of it, and select them in the
_service
on OBS and build multiple different images from the same git repo and branch, for example the particleos gnome image:https://build.opensuse.org/projects/home:bluca:branches:home:bluca:systemd/packages/particleos/files/_service?expand=1