From db3fb428599c9c8fe105dcf4ba8d1c914c54cc26 Mon Sep 17 00:00:00 2001 From: Laurent Bercot Date: Thu, 15 Oct 2026 08:19:48 +0000 Subject: More work on format-upgrade inclusion: real meta-information storage If a db format upgrade is necessary, we need to compile the snapshot with the new s6-rc-compile. There's data we need to pass to it that isn't stored (options passed when committing the original set), so we store it in the db itself (patching s6-rc-compile). We modify the s6-rc-compile wrappers to pass all this metadata. Next, we will compile the snapshot. --- src/repo/s6rc_repo_compile.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'src/repo/s6rc_repo_compile.c') diff --git a/src/repo/s6rc_repo_compile.c b/src/repo/s6rc_repo_compile.c index f89a65a..fc7d8ea 100644 --- a/src/repo/s6rc_repo_compile.c +++ b/src/repo/s6rc_repo_compile.c @@ -16,12 +16,13 @@ #include #include -int s6rc_repo_compile (char const *repo, char const *set, char const *const *rxs, uint8_t nrxs, char *oldc, unsigned int verbosity, char const *fdhuser, char const *catchall) +int s6rc_repo_compile (char const *repo, char const *set, char const *const *rxs, uint8_t nrxs, char *oldc, unsigned int verbosity, char const *fdhuser, char const *catchall, char const *defbundle) { size_t repolen = strlen(repo) ; size_t setlen = strlen(set) ; size_t totrxlen = 0 ; int needprefix = strcmp(set, ".ref") ; + int needsnapshot = needprefix && memcmp(set, ".snapshot.", 10) ; char snap[setlen + 44] ; char newc[repolen + setlen + 45] ; memcpy(newc, repo, repolen) ; @@ -38,7 +39,7 @@ int s6rc_repo_compile (char const *repo, char const *set, char const *const *rxs pid_t pid ; size_t m = 0 ; int wstat ; - char const *argv[11 + nrxs] ; + char const *argv[13 + nrxs] ; char fmtv[UINT_FMT] ; char src[nrxs * (repolen + 10 + (needprefix ? setlen + 1 : 0)) + totrxlen] ; char *w = src ; @@ -57,6 +58,11 @@ int s6rc_repo_compile (char const *repo, char const *set, char const *const *rxs argv[m++] = "-L" ; argv[m++] = catchall ; } + if (defbundle) + { + argv[m++] = "-D" ; + argv[m++] = defbundle ; + } argv[m++] = "--" ; argv[m++] = newc ; for (uint8_t i = 0 ; i < nrxs ; i++) @@ -96,7 +102,7 @@ int s6rc_repo_compile (char const *repo, char const *set, char const *const *rxs } } - if (needprefix) + if (needsnapshot) { int e ; memcpy(snap, ".snapshot", 9) ; @@ -124,7 +130,7 @@ int s6rc_repo_compile (char const *repo, char const *set, char const *const *rxs { int e = errno ; rm_rf(newc) ; - if (needprefix) s6rc_repo_setdelete(repo, snap) ; + if (needsnapshot) s6rc_repo_setdelete(repo, snap) ; errno = e ; strerr_warnfu4sys("atomically symlink ", newc + repolen + 10, " to ", fn) ; return -1 ; -- cgit v1.3.1