Bring back --default to allow OBS builds to select an entry point among many#3768
Bring back --default to allow OBS builds to select an entry point among many#3768bluca wants to merge 1 commit intosystemd:mainfrom
Conversation
8bfaf94 to
d87f24f
Compare
behrmann
left a comment
There was a problem hiding this comment.
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.
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.
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.
septatrix
left a comment
There was a problem hiding this comment.
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 |
|
This all looks extremely ugly to me. Why don't we just special case OBS by looking for /usr/src/packages/SOURCES/mkosi.conf explicitly and parsing it if it exists? In this case I prefer a small OBS specific hack that doesn't leak into the interface rather than adding more ugly interfaces just to deal with OBS's shortcomings. |
|
That would be fine by me, but as discussed it requires another workaround, opened a new PR since it's a different approach from this: #3790 |
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
_serviceon 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