runc icon indicating copy to clipboard operation
runc copied to clipboard

make systemd and its dependencies optional via 'no_systemd' build tag (2nd take)

Open metux opened this issue 2 years ago • 9 comments

Hello folks,

this is my second take for making systemd stuff build-time optional. (obsoletes #2987)

It's been quite a while since the last time, and lots of things changed.

These patches first factors out systemd specific stuff in easily digestable steps, bevor adding the actual build flag. Several functions are dummies on no_systemd flag (that shouldn't be actually called) for sake of simpler code flow.

metux avatar Aug 02 '23 15:08 metux

No idea how to fix the lint error - running gofumpt didn't seem to be sufficient.

Maybe the problem is the vendor dir, which isn't at all gofumpt'ed.

metux avatar Aug 02 '23 17:08 metux

Overall LGTM, just a few minor issues:

  • I would rename *nosystemd.go files to *no_systemd.go or *systemd_stub.go for readability;
  • files that end with _linux.go should still end with _linux.go even when you rename/split those;
  • change the error messages to be less confusing and refer to systemd.

No idea how to fix the lint error - running gofumpt didn't seem to be sufficient.

The gofumpt errors in validate / lint are there because you're using old-style +build tags in the new code. Please see commit d8da00355e305f0564a9de6854bf5df1aa4b73d9 for more info on that (and if your gofumpt doesn't show/change anything, you need to update it).

kolyshkin avatar Aug 02 '23 23:08 kolyshkin

  • files that end with _linux.go should still end with _linux.go even when you rename/split those;

I was talking about utils_linux.go file. The (better, I guess) alternative to the above is to drop the _linux part of the file name and use //go:build linux annotation instead (which I think you already do).

kolyshkin avatar Aug 02 '23 23:08 kolyshkin

@opencontainers/runc-maintainers PTAL

kolyshkin avatar Aug 11 '23 19:08 kolyshkin

@metux Please use git rebase main to catch up with the latest change.

lifubang avatar Aug 17 '23 00:08 lifubang

@metux Please use git rebase main to catch up with the latest change.

done

metux avatar Aug 18 '23 11:08 metux

@metux needs a rebase. Guess we can merge it right after.

kolyshkin avatar Oct 19 '23 03:10 kolyshkin

@metux Are you still working on this PR? Please rebase, I think we can merge this one, and in the future release we can also provide a binary without systemd.

lifubang avatar Dec 27 '23 10:12 lifubang

If @metux can no longer work on this, perhaps I can carry this one.

kolyshkin avatar Jan 09 '24 06:01 kolyshkin