@@ -40,19 +40,20 @@ class ProgressCb:
40
40
41
41
42
42
def drain (progress : Progress , response , prog_cb : ProgressCb , dst : str ):
43
- p = Popen (["tar" , "-xj" ], cwd = dst , stdin = PIPE )
43
+ #p = Popen(["tar", "-xj"], cwd=dst, stdin=PIPE)
44
+
44
45
for chunk in response .iter_content (chunk_size = 1024 * 1024 ):
45
46
if chunk :
46
- p .stdin .write (chunk )
47
+ #p.stdin.write(chunk)
48
+ status (f"Read { len (chunk )} bytes" )
47
49
prog_cb (len (chunk ))
48
- p .stdin .close ()
49
- p .wait ()
50
+ # p.stdin.close()
51
+ # p.wait()
50
52
progress .tick ()
51
53
52
54
53
55
def _download_extract (progress : Progress , tarurls : List [str ], dst : str ):
54
56
status (f"Downloading: { tarurls } -> { dst } ostree_repo" )
55
-
56
57
total_length = 0
57
58
responses = []
58
59
for u in tarurls :
@@ -177,42 +178,42 @@ def main(creds_zip_file: str, deltas: List[Delta], factory: str, tok_secret_name
177
178
if len (downloads ) > 0 :
178
179
_download_extract (prog , downloads , "./" )
179
180
180
- if len (pulls ) > 0 :
181
- status (f"Pulling: { pulls } -> ./ostree_repo" )
182
- for commit in pulls :
183
- pull_ostree_commit (factory , commit , "./ostree_repo" , tok_secret_name , ostree_url )
184
-
185
- delta_stats = generate_deltas (prog , deltas , "./ostree_repo" )
186
-
187
- # update summary and generate a new type of delta indexes
188
- cmd ("ostree" , "summary" , "-u" , "--repo=./ostree_repo" )
189
-
190
- # TODO: remove the following code that determines and prints a type of delta indexes been generated
191
- # once we completely switch to the new indexes types. https://foundriesio.atlassian.net/browse/FFTK-1122
192
- if os .path .isdir ("./ostree_repo/delta-indexes" ):
193
- with open ("./ostree_repo/config" , "r" ) as f :
194
- config = f .readlines ()
195
- for e in config :
196
- if e == "indexed-deltas=true\n " :
197
- status ("New type of delta indexes are generated and enabled in the repo config" )
198
- break
199
- else :
200
- status ("Old type of delta indexes are generated (in-summary type)" )
201
-
202
- rmtree ("./ostree_repo/objects" ) # We just need to sync deltas
203
- os .remove ("./ostree_repo/summary" ) # summary is generated by the ostree server
204
- cmd ("fiopush" , "-summary" , "-repo=./ostree_repo" , "-creds" , creds_zip_file )
205
- prog .tick ()
206
-
207
- for to_sha , s in delta_stats .items ():
208
- with open (os .path .join (out_dir , f"{ to_sha } .json" ), "wb" ) as f :
209
- f .write (s ["canonical-json" ])
210
- prog .tick ()
211
-
212
- upload_delta_stats (prog , factory , delta_stats , tok_secret_name )
213
-
214
- add_delta_stat_refs_to_targets (creds_zip_file , delta_stats )
215
- prog .tick ()
181
+ # if len(pulls) > 0:
182
+ # status(f"Pulling: {pulls} -> ./ostree_repo")
183
+ # for commit in pulls:
184
+ # pull_ostree_commit(factory, commit, "./ostree_repo", tok_secret_name, ostree_url)
185
+ #
186
+ # delta_stats = generate_deltas(prog, deltas, "./ostree_repo")
187
+ #
188
+ # # update summary and generate a new type of delta indexes
189
+ # cmd("ostree", "summary", "-u", "--repo=./ostree_repo")
190
+ #
191
+ # # TODO: remove the following code that determines and prints a type of delta indexes been generated
192
+ # # once we completely switch to the new indexes types. https://foundriesio.atlassian.net/browse/FFTK-1122
193
+ # if os.path.isdir("./ostree_repo/delta-indexes"):
194
+ # with open("./ostree_repo/config", "r") as f:
195
+ # config = f.readlines()
196
+ # for e in config:
197
+ # if e == "indexed-deltas=true\n":
198
+ # status("New type of delta indexes are generated and enabled in the repo config")
199
+ # break
200
+ # else:
201
+ # status("Old type of delta indexes are generated (in-summary type)")
202
+ #
203
+ # rmtree("./ostree_repo/objects") # We just need to sync deltas
204
+ # os.remove("./ostree_repo/summary") # summary is generated by the ostree server
205
+ # cmd("fiopush", "-summary", "-repo=./ostree_repo", "-creds", creds_zip_file)
206
+ # prog.tick()
207
+ #
208
+ # for to_sha, s in delta_stats.items():
209
+ # with open(os.path.join(out_dir, f"{to_sha}.json"), "wb") as f:
210
+ # f.write(s["canonical-json"])
211
+ # prog.tick()
212
+ #
213
+ # upload_delta_stats(prog, factory, delta_stats, tok_secret_name)
214
+ #
215
+ # add_delta_stat_refs_to_targets(creds_zip_file, delta_stats)
216
+ # prog.tick()
216
217
217
218
218
219
if __name__ == "__main__" :
0 commit comments