|
5 | 5 | [vmlinux.krn.build :as build])) |
6 | 6 |
|
7 | 7 | (defrecord VmLinuxArtifact [artifact-name]) |
8 | | -(defrecord ArtifactMeta [arch version binary sha256-sum]) |
| 8 | +(defrecord ArtifactMeta [name arch version binary sha256-sum]) |
9 | 9 |
|
10 | 10 | (def ^:private stage-dir "out") |
11 | 11 |
|
12 | | -(defn- artifact-name |
13 | | - [{:keys [arch version binary-path]}] |
14 | | - (str (fs/file-name binary-path) "-" (name arch) "-" version)) |
| 12 | +(defn- artifact-name [{:keys [name]}] (str "vmlinux-" name)) |
15 | 13 |
|
16 | 14 | (defn prepare-artifact |
17 | | - [{:keys [arch version binary-path sha256-sum], :as vmlinux-build}] |
18 | | - (let [name (artifact-name vmlinux-build) |
19 | | - dir (str stage-dir "/" name) |
| 15 | + [{:keys [name arch version binary-path sha256-sum], :as vmlinux-build}] |
| 16 | + (let [art-name (artifact-name vmlinux-build) |
| 17 | + dir (str stage-dir "/" art-name) |
20 | 18 | binary (fs/file-name binary-path)] |
21 | 19 | (fs/create-dirs dir) |
22 | 20 | (fs/copy binary-path (str dir "/" binary) {:replace-existing true}) |
23 | | - (spit (str dir "/meta.edn") (pr-str (into {} (->ArtifactMeta arch version binary sha256-sum)))) |
24 | | - (->VmLinuxArtifact name))) |
| 21 | + (spit (str dir "/meta.edn") |
| 22 | + (pr-str (into {} (->ArtifactMeta name arch version binary sha256-sum)))) |
| 23 | + (->VmLinuxArtifact art-name))) |
25 | 24 |
|
26 | 25 | (defn load-artifact |
27 | 26 | [dir] |
28 | 27 | (let [am (map->ArtifactMeta (edn/read-string (slurp (str dir "/meta.edn"))))] |
29 | | - (build/map->VmLinuxBuild {:arch (:arch am), |
| 28 | + (build/map->VmLinuxBuild {:name (:name am), |
| 29 | + :arch (:arch am), |
30 | 30 | :version (:version am), |
31 | 31 | :binary-path (str dir "/" (:binary am)), |
32 | 32 | :sha256-sum (:sha256-sum am)}))) |
0 commit comments