aboutsummaryrefslogtreecommitdiffstats
path: root/src/repo/s6rc_repo_compile.c
diff options
context:
space:
mode:
authorLaurent Bercot <ska-skaware@skarnet.org>2026-10-15 08:19:48 +0000
committerLaurent Bercot <ska-skaware@skarnet.org>2026-10-15 08:19:48 +0000
commitdb3fb428599c9c8fe105dcf4ba8d1c914c54cc26 (patch)
treef83ab9920c39916777a35e5034a4cb9f43614da8 /src/repo/s6rc_repo_compile.c
parent91a0655557e707977f583b2142bda898ee599fd8 (diff)
downloads6-rc-db3fb428599c9c8fe105dcf4ba8d1c914c54cc26.tar.gz
More work on format-upgrade inclusion: real meta-information storageHEADmain
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.
Diffstat (limited to 'src/repo/s6rc_repo_compile.c')
-rw-r--r--src/repo/s6rc_repo_compile.c14
1 files changed, 10 insertions, 4 deletions
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 <s6-rc/config.h>
#include <s6-rc/repo.h>
-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 ;