尝试添加北航盘上传(未测试)#56
Draft
Operacon wants to merge 3 commits intoBUAA-SE-Compiling:masterfrom
Operacon:master
Draft
Conversation
Member
|
可以考虑添加新的下载方式,但是我认为这个 PR 提出的设计有几个问题:
有人来维护 Rurikawa 我很高兴,但是添加提交方式这么大的事情感觉还是先在 Issue 区讨论出一个确定的方案来再实现比较好。 |
Member
|
哦,差点忘了。为了保证评测任务的可重复性,git branch 在服务端就会被解析成提交时当前 branch 最新的提交,所以发到 judger 上的 revision 已经是准确的 git commit ID 而不是 branch name 了。因此在任何时候 |
lynzrand
requested changes
Oct 6, 2021
| )]); | ||
| do_command!(dir, ["unzip", "code.zip"]); | ||
| } | ||
| Ok(()) |
| if &options.revision == "bhpan" { | ||
| let bytes = &options.repo.as_bytes(); | ||
|
|
||
| // cut 'https://bhpan.buaa.edu.cn/link/' |
|
|
||
| tokio::fs::create_dir_all(dir).await?; | ||
|
|
||
| if &options.revision == "bhpan" { |
Member
There was a problem hiding this comment.
options.revision 由于评论区提到的原因永远不可能是 bhpan,所以这个分支永远不会执行到
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
修改
judger/src/fs/net.rs,将原通过 git 获取代码的函数增加一个 if,如果 branch 名为bhpan,那么将 repo 地址视为通过北航盘分享的zip文件的链接,通过 curl 下载,并解压到当前 job 工作目录。例如,被分享的文件链接为,
https://bhpan.buaa.edu.cn/link/114E514或者https://bhpan.buaa.edu.cn/#/link/114E514,首先通过截取字符串获得源文件真实的 id ,即fid = "114E514"。随后调用已有的do_command!(),打开 sh,并传入一个被压缩成一句的指令该指令成功执行后会将被分享的文件下载为
code.zip。随后继续调用do_command!()通过unzip将其解压到工作目录,函数返回,达到了和通过 git 获取代码同样的效果。