Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deduce pkgname in damlc migrate from dalf not dar #3000

Merged
merged 1 commit into from
Sep 24, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Deduce pkgname in damlc migrate from dalf not dar
The filename of the dar is not something that you should rely on as
evidenced by the fact that we have a -o option to change it to
something completely different.
  • Loading branch information
cocreature committed Sep 24, 2019
commit b4e2a4b56328f449a26140e48d68b841235cc3a9
2 changes: 1 addition & 1 deletion compiler/damlc/lib/DA/Cli/Damlc.hs
Original file line number Diff line number Diff line change
Expand Up @@ -786,10 +786,10 @@ execMigrate projectOpts opts0 inFile1_ inFile2_ mbDir =
[(pkgName1, pkgId1, lfPkg1), (pkgName2, pkgId2, lfPkg2)] <-
forM [inFile1, inFile2] $ \inFile -> do
bytes <- B.readFile inFile
let pkgName = takeBaseName inFile
let dar = ZipArchive.toArchive $ BSL.fromStrict bytes
-- get the main pkg
dalfManifest <- either fail pure $ readDalfManifest dar
let pkgName = takeBaseName $ mainDalfPath dalfManifest
mainDalfEntry <- getEntry (mainDalfPath dalfManifest) dar
(mainPkgId, mainLfPkg) <- decode $ BSL.toStrict $ ZipArchive.fromEntry mainDalfEntry
pure (pkgName, mainPkgId, mainLfPkg)
Expand Down
11 changes: 7 additions & 4 deletions daml-assistant/integration-tests/src/Main.hs
Original file line number Diff line number Diff line change
Expand Up @@ -326,8 +326,8 @@ packagingTests tmpDir = testGroup "packaging"
let projectB = tmpDir </> "a-2.0"
let projectUpgrade = tmpDir </> "upgrade"
let projectRollback = tmpDir </> "rollback"
let aDar = projectA </> distDir </> "a-1.0.dar"
let bDar = projectB </> distDir </> "a-2.0.dar"
let aDar = projectA </> "projecta.dar"
let bDar = projectB </> "projectb.dar"
let upgradeDar = projectUpgrade </> distDir </> "upgrade-0.0.1.dar"
let rollbackDar= projectRollback </> distDir </> "rollback-0.0.1.dar"
let bWithUpgradesDar = "a-2.0-with-upgrades.dar"
Expand Down Expand Up @@ -356,7 +356,8 @@ packagingTests tmpDir = testGroup "packaging"
, " - daml-prim"
, " - daml-stdlib"
]
withCurrentDirectory projectA $ callCommandQuiet "daml build"
-- We use -o to test that we do not depend on the name of the dar
withCurrentDirectory projectA $ callCommandQuiet $ "daml build -o " <> aDar
assertBool "a-1.0.dar was not created." =<< doesFileExist aDar
step "Creating project a-2.0 ..."
createDirectoryIfMissing True (projectB </> "daml")
Expand All @@ -383,9 +384,11 @@ packagingTests tmpDir = testGroup "packaging"
, " - daml-prim"
, " - daml-stdlib"
]
withCurrentDirectory projectB $ callCommandQuiet "daml build"
-- We use -o to test that we do not depend on the name of the dar
withCurrentDirectory projectB $ callCommandQuiet $ "daml build -o " <> bDar
assertBool "a-2.0.dar was not created." =<< doesFileExist bDar
step "Creating upgrade/rollback project"
-- We use -o to verify that we do not depend on the
callCommandQuiet $ unwords ["daml", "migrate", projectUpgrade, aDar, bDar]
callCommandQuiet $ unwords ["daml", "migrate", projectRollback, bDar, aDar]
step "Build migration project"
Expand Down