Skip to content

Commit 410df7c

Browse files
authored
Merge pull request #402 from oasisprotocol/kostko/fix/rofl-build-version
2 parents 7d40669 + 508cdb8 commit 410df7c

File tree

2 files changed

+12
-10
lines changed

2 files changed

+12
-10
lines changed

cmd/rofl/build/build.go

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ import (
1313
coreCommon "github.com/oasisprotocol/oasis-core/go/common"
1414
"github.com/oasisprotocol/oasis-core/go/common/cbor"
1515
"github.com/oasisprotocol/oasis-core/go/common/sgx"
16-
"github.com/oasisprotocol/oasis-core/go/common/version"
1716
"github.com/oasisprotocol/oasis-core/go/runtime/bundle"
1817
"github.com/oasisprotocol/oasis-sdk/client-sdk/go/client"
1918
"github.com/oasisprotocol/oasis-sdk/client-sdk/go/connection"
@@ -86,11 +85,6 @@ var (
8685
ID: npa.ParaTime.Namespace(),
8786
},
8887
}
89-
bnd.Manifest.Version, err = version.FromString(manifest.Version)
90-
if err != nil {
91-
fmt.Printf("unsupported package version format: %s\n", err)
92-
return
93-
}
9488

9589
// Setup some build environment variables.
9690
os.Setenv("ROFL_MANIFEST", manifest.SourceFileName())

cmd/rofl/build/tdx.go

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import (
88

99
"github.com/spf13/cobra"
1010

11+
"github.com/oasisprotocol/oasis-core/go/common/version"
1112
"github.com/oasisprotocol/oasis-core/go/runtime/bundle"
1213
"github.com/oasisprotocol/oasis-core/go/runtime/bundle/component"
1314

@@ -211,6 +212,12 @@ func tdxBundleComponent(
211212
},
212213
}
213214

215+
var err error
216+
comp.Version, err = version.FromString(manifest.Version)
217+
if err != nil {
218+
return fmt.Errorf("unsupported package version format: %w", err)
219+
}
220+
214221
storageKind := buildRofl.StorageKindNone
215222
if manifest.Resources.Storage != nil {
216223
storageKind = manifest.Resources.Storage.Kind
@@ -232,7 +239,7 @@ func tdxBundleComponent(
232239

233240
// Add some sparse padding to allow for growth of the root partition during upgrades.
234241
// Note that this will not actually take any space so it could be arbitrarily large.
235-
if err := padWithEmptySpace(stage2.fn, 2*1024*1024*1024); err != nil {
242+
if err = padWithEmptySpace(stage2.fn, 2*1024*1024*1024); err != nil {
236243
return err
237244
}
238245

@@ -245,7 +252,8 @@ func tdxBundleComponent(
245252
// Allocate some space after regular stage2.
246253
const sectorSize = 512
247254
storageSize := manifest.Resources.Storage.Size * 1024 * 1024
248-
storageOffset, err := appendEmptySpace(stage2.fn, storageSize, sectorSize)
255+
var storageOffset uint64
256+
storageOffset, err = appendEmptySpace(stage2.fn, storageSize, sectorSize)
249257
if err != nil {
250258
return err
251259
}
@@ -260,7 +268,7 @@ func tdxBundleComponent(
260268
}
261269

262270
// Use qcow2 image format to support sparse files.
263-
if err := convertToQcow2(stage2.fn); err != nil {
271+
if err = convertToQcow2(stage2.fn); err != nil {
264272
return fmt.Errorf("failed to convert to qcow2 image: %w", err)
265273
}
266274
comp.TDX.Stage2Format = "qcow2"
@@ -270,7 +278,7 @@ func tdxBundleComponent(
270278

271279
bnd.Manifest.Components = append(bnd.Manifest.Components, &comp)
272280

273-
if err := bnd.Manifest.Validate(); err != nil {
281+
if err = bnd.Manifest.Validate(); err != nil {
274282
return fmt.Errorf("failed to validate manifest: %w", err)
275283
}
276284

0 commit comments

Comments
 (0)