-
-
Notifications
You must be signed in to change notification settings - Fork 49
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add crate configuration values to build hash inputs
- Loading branch information
Showing
8 changed files
with
89 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
with Alire.Errors; | ||
|
||
package body Alire.Crate_Configuration.Hashes is | ||
|
||
procedure Add_From (Config : Global_Config; | ||
Rel : Releases.Release; | ||
Add : access procedure (Kind, Key, Value : String)) | ||
is | ||
begin | ||
-- We could iterate over Config contents, but by relying on the release | ||
-- reported variables we ensure nothing is amiss during hashing. | ||
|
||
for Untyped of Rel.Config_Variables loop | ||
declare | ||
Def : constant Properties.Configurations.Config_Type_Definition := | ||
Properties.Configurations.Config_Type_Definition (Untyped); | ||
Key : constant String := | ||
Crate_Configuration.Key (Rel.Name, Def.Name); | ||
begin | ||
if not Config.Var_Map.Contains (+Key) then | ||
raise Program_Error | ||
with Errors.Set | ||
("Incomplete configuration during hashing, missing value " | ||
& "for: " & Key); | ||
end if; | ||
|
||
if not Def.Valid (Config.Var_Map (+Key).Value) then | ||
raise Program_Error | ||
with Errors.Set ("Invalid config value during hashing: " | ||
& Def.Image); | ||
end if; | ||
|
||
Add (Kind => "config", | ||
Key => Key, | ||
Value => | ||
Properties.Configurations.Image | ||
(Config.Var_Map (+Key).Value)); | ||
end; | ||
end loop; | ||
end Add_From; | ||
|
||
end Alire.Crate_Configuration.Hashes; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
with Alire.Releases; | ||
|
||
package Alire.Crate_Configuration.Hashes is | ||
|
||
procedure Add_From (Config : Global_Config; | ||
Rel : Releases.Release; | ||
Add : access procedure (Kind, Key, Value : String)); | ||
-- Add configuration values of the given crate to the build hash input | ||
|
||
end Alire.Crate_Configuration.Hashes; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,7 +4,7 @@ version = "1.0.0" | |
maintainers = ["[email protected]"] | ||
maintainers-logins = ["mylogin"] | ||
|
||
# Externals and environment used to track build hash generation immutability | ||
# Externals, environment, config used to track build hash generation immutability | ||
|
||
[gpr-externals] | ||
foo = "" | ||
|
@@ -15,6 +15,9 @@ bar = "foo" | |
[environment] | ||
BAZ.set = "foo" | ||
|
||
[configuration.variables] | ||
Var1={type="Boolean", default=true} | ||
|
||
[origin] | ||
url = "file:../../../crates/libhello_1.0.0.tgz" | ||
hashes = ["sha512:99fa3a55540d0655c87605b54af732f76a8a363015f183b06e98aa91e54c0e69397872718c5c16f436dd6de0fba506dc50c66d34a0e5c61fb63cb01fa22f35ac"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters