Skip to content

Commit

Permalink
uninstall git-lfs
Browse files Browse the repository at this point in the history
  • Loading branch information
shzhxh committed Aug 15, 2022
1 parent dea9b80 commit bf6a7b9
Show file tree
Hide file tree
Showing 8 changed files with 55 additions and 40 deletions.
1 change: 0 additions & 1 deletion .gitattributes

This file was deleted.

4 changes: 2 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -116,8 +116,8 @@ jobs:
steps:
- uses: actions/checkout@v3

- name: Pull prebuilt images
run: git lfs pull -I prebuilt/zircon/x64/libc.so,prebuilt/zircon/x64/libfdio.so,prebuilt/zircon/x64/libunwind.so,prebuilt/zircon/x64/libzircon.so,prebuilt/zircon/x64/Scrt1.o
- name: Install prebuilt images
run: make setup

- uses: actions-rs/toolchain@v1
with:
Expand Down
26 changes: 18 additions & 8 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,11 +63,16 @@ jobs:
toolchain: ${{ env.rust_toolchain }}
components: rust-src, llvm-tools-preview

- name: Cache prebuilt
id: cache-prebuilt
uses: actions/cache@v3
with:
path: ignored/origin/archs/x86_64/prebuilt.tar.xz
key: zircon-prebuilt

- name: Pull prebuilt images
run: |
git lfs pull -I prebuilt/zircon/x64/core-tests.zbi
git lfs pull -I prebuilt/zircon/x64/libzircon-libos.so
git lfs pull -I prebuilt/zircon/x64/userboot-libos.so
if: steps.cache-prebuilt.outputs.cache-hit != 'true'
run: make setup

- name: Install python dependencies
run: pip3 install -r tests/requirements.txt
Expand All @@ -94,11 +99,16 @@ jobs:
toolchain: ${{ env.rust_toolchain }}
components: rust-src, llvm-tools-preview

- name: Cache prebuilt
id: cache-prebuilt
uses: actions/cache@v3
with:
path: ignored/origin/archs/x86_64/prebuilt.tar.xz
key: zircon-prebuilt

- name: Pull prebuilt images
run: |
git lfs pull -I prebuilt/zircon/x64/core-tests.zbi
git lfs pull -I prebuilt/zircon/x64/libzircon.so
git lfs pull -I prebuilt/zircon/x64/userboot.so
if: steps.cache-prebuilt.outputs.cache-hit != 'true'
run: make setup

- name: Cache QEMU
id: cache-qemu
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
Ubuntu22.04 不能正确编译 x86_64 的 libc 测试。
若不需要烧写到物理硬件,使用 WSL2 或其他虚拟机的操作与真机并无不同之处。

在开始之前,确保你的计算机上安装了 git、git lfs 和 rustup。要在虚拟环境开发或测试,需要 QEMU。
在开始之前,确保你的计算机上安装了 git 和 rustup。要在虚拟环境开发或测试,需要 QEMU。

2. 克隆项目

Expand Down Expand Up @@ -90,7 +90,7 @@ cargo dump

- **initialize**

初始化项目。转换 git lfs 并更新子项目。
初始化项目。安装zircon模式所需的二进制文件,并更新子项目。

```bash
cargo initialize
Expand Down
7 changes: 4 additions & 3 deletions docs/README_EN.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# zCore
# zCore

[![CI](https://github.com/rcore-os/zCore/actions/workflows/build.yml/badge.svg?branch=master)](https://github.com/rcore-os/zCore/actions)
[![Docs](https://img.shields.io/badge/docs-pages-green)](https://rcore-os.github.io/zCore/)
Expand All @@ -12,6 +12,7 @@ An OS kernel based on zircon, provides Linux compatible mode.

- [中文自述文档](../README.md)
- [legacy README](README_LEGACY.md)

> you may want to check the legacy for setting up docker, running graphical applications, etc. But many of these scripts are deprecated
## Table of contents
Expand Down Expand Up @@ -39,7 +40,7 @@ Developers and users may set up the project by following the steps below:
The libc tests for x86_64 cannot compile on Ubuntu22.04.
If you do not need to flash to physical hardware, using WSL2 or other virtual machines does not operate any differently from the real machine.

Make sure you have git, git lfs, and rustup installed on your computer before you start. Qemu is required to develop or test in a virtual environment.
Make sure you have git and rustup installed on your computer before you start. Qemu is required to develop or test in a virtual environment.

2. clone the repo

Expand Down Expand Up @@ -88,7 +89,7 @@ cargo dump

- **initialize**

Initializes the project. Git lfs install and pull. Submodules will be updated.
Initializes the project. Install binary files needed by zircon mode. Submodules will be updated.

```bash
cargo initialize
Expand Down
8 changes: 3 additions & 5 deletions docs/README_LEGACY.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# zCore
# zCore

[![CI](https://github.com/rcore-os/zCore/workflows/CI/badge.svg?branch=master)](https://github.com/rcore-os/zCore/actions)
[![Docs](https://img.shields.io/badge/docs-alpha-blue)](https://rcore-os.github.io/zCore/)
Expand Down Expand Up @@ -26,7 +26,6 @@ Environments:

- [Rust toolchain](http://rustup.rs)
- [QEMU](https://www.qemu.org)
- [Git LFS](https://git-lfs.github.com)

### Developing environment info

Expand All @@ -39,8 +38,7 @@ Clone repo and pull prebuilt fuchsia images:
```sh
git clone https://github.com/rcore-os/zCore --recursive
cd zCore
git lfs install
git lfs pull
make setup
```

For users in China, there's a mirror you can try:
Expand Down Expand Up @@ -118,7 +116,7 @@ Use docker container as standand develop environment, please refer to [tootls/do
```sh
# See template in zircon-user
cd zircon-user && make zbi MODE=release

# Run your programs in zCore
cd zCore && make run MODE=release USER=1 [LOG=warn] [GRAPHIC=on] [ACCEL=1]
```
Expand Down
6 changes: 5 additions & 1 deletion xtask/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
# 更新公告
# 更新公告

最新的更新将出现在最上方。

## 20220815(shzhxh)

- 彻底移除git-lfs的功能。

## 20220720 (YdrMaster)

- 反汇编文件默认输出位置修改为 target 目录下,这样可以被 cargo clean 删除;
Expand Down
39 changes: 21 additions & 18 deletions xtask/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -84,9 +84,9 @@ enum Commands {
// --------------------------------------------------------
/// 初始化项目。Initializes the project.
///
/// 转换 git lfs,更新子项目
/// 安装zircon模式所需的二进制,并更新子项目
///
/// Git lfs install and pull. Submodules will be updated.
/// Install binaries needed by zircon mode, and Submodules will be updated.
///
/// ## Example
///
Expand Down Expand Up @@ -299,7 +299,7 @@ fn main() {
#[cfg(not(target_arch = "riscv64"))]
Dump => dump::dump_config(),
Initialize => {
make_git_lfs();
install_zircon_prebuilt();
git_submodule_update(true);
}
UpdateAll => update_all(),
Expand Down Expand Up @@ -332,27 +332,30 @@ fn main() {
}
}

/// 初始化 LFS。
fn make_git_lfs() {
use command_ext::{CommandExt, Git};
if !Git::lfs()
.arg("version")
.as_mut()
.output()
.map_or(false, |out| out.stdout.starts_with(b"git-lfs/"))
{
panic!("Cannot find git lfs, see https://git-lfs.github.com/ for help.");
}
Git::lfs().arg("install").invoke();
Git::lfs().arg("pull").invoke();
}

/// 更新子项目。
fn git_submodule_update(init: bool) {
use command_ext::{CommandExt, Git};
Git::submodule_update(init).invoke();
}

/// 下载并安装zircon模式所需的测例和库
fn install_zircon_prebuilt() {
use command_ext::{dir, CommandExt, Tar};
use commands::wget;
const URL: &str =
"https://github.com/rcore-os/zCore/releases/download/prebuilt-2208/prebuilt.tar.xz";
let tar = Arch::X86_64.origin().join("prebuilt.tar.xz");
wget(URL, &tar);
// 解压到目标路径
let dir = PROJECT_DIR.join("prebuilt");
let target = TARGET.join("zircon");
dir::rm(&dir).unwrap();
dir::rm(&target).unwrap();
fs::create_dir(&target).unwrap();
Tar::xf(&tar, Some(&target)).invoke();
dircpy::copy_dir(target.join("prebuilt"), dir).unwrap();
}

/// 更新工具链和依赖。
fn update_all() {
use command_ext::{Cargo, CommandExt, Ext};
Expand Down

0 comments on commit bf6a7b9

Please sign in to comment.