Skip to content

Commit

Permalink
actions: debootstrap: Add new property parent-suite
Browse files Browse the repository at this point in the history
Allow downstream distros to indicate which suite the bootstrapping should
be done for.

For now, only use this property to gate the debootstrap workaround for
excluding usr-is-merged package to the parent suite which should be
beneficial to downstreams.

Signed-off-by: Christopher Obbard <[email protected]>
  • Loading branch information
obbardc committed Aug 4, 2023
1 parent 1ea5f88 commit 3d2985b
Showing 1 changed file with 13 additions and 6 deletions.
19 changes: 13 additions & 6 deletions actions/debootstrap_action.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,9 @@ Example:
- certificate -- client certificate stored in file to be used for downloading packages from the server.
- private-key -- provide the client's private key in a file separate from the certificate.
- parent-suite -- release code name which this suite is based on. Useful for downstreams which do
not use debian codenames for their suite names (e.g. "stable").
*/
package actions

Expand All @@ -63,6 +66,7 @@ import (

type DebootstrapAction struct {
debos.BaseAction `yaml:",inline"`
ParentSuite string `yaml:"parent-suite"`
Suite string
Mirror string
Variant string
Expand Down Expand Up @@ -110,6 +114,10 @@ func (d *DebootstrapAction) listOptionFiles(context *debos.DebosContext) []strin
}

func (d *DebootstrapAction) Verify(context *debos.DebosContext) error {
if len(d.ParentSuite) == 0 {
d.ParentSuite = d.Suite
}

files := d.listOptionFiles(context)

// Check if all needed files exists
Expand Down Expand Up @@ -158,9 +166,9 @@ func (d *DebootstrapAction) RunSecondStage(context debos.DebosContext) error {
return err
}

// Guess if suite is something before usr-is-merged was introduced
func (d *DebootstrapAction) isLikelyOldSuite() bool {
switch strings.ToLower(d.Suite) {
// Check if suite is something before usr-is-merged was introduced
func shouldExcludeUsrIsMerged(suite string) bool {
switch strings.ToLower(suite) {
case "sid", "unstable":
return false
case "testing":
Expand Down Expand Up @@ -222,9 +230,8 @@ func (d *DebootstrapAction) Run(context *debos.DebosContext) error {
cmdline = append(cmdline, fmt.Sprintf("--variant=%s", d.Variant))
}

// workaround for https://github.com/go-debos/debos/issues/361
if d.isLikelyOldSuite() {
log.Println("excluding usr-is-merged as package is not in suite")
if shouldExcludeUsrIsMerged(d.ParentSuite) {
log.Printf("excluding usr-is-merged as package is not in parent suite %s\n", d.ParentSuite)
cmdline = append(cmdline, "--exclude=usr-is-merged")
}

Expand Down

0 comments on commit 3d2985b

Please sign in to comment.