# code_download **Repository Path**: wolongju/code_download ## Basic Information - **Project Name**: code_download - **Description**: 一键下载openharmony代码 - **Primary Language**: Shell - **License**: Apache-2.0 - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 9 - **Created**: 2024-03-21 - **Last Updated**: 2024-03-21 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # code_download ## 一、脚本介绍 ### 1.1 概述 本仓脚本用于项目中下载`ohos`分支代码使用,省去下载代码时找对应分支的命令麻烦 ### 1.2 路径配置 因每个人当第一次使用该脚本下载代码的时候会提示设置代码下载的路径,然后会将该路径保存在本地的`.config`文件中,后面再次下载则不再提示 - 不输入直接回车,则默认保存在`~/OpenHarmony`里面 - 输入设置`.`,则表示保存在脚本所在的目录下面 - 其他路径可自行设置,但必须为**绝对路径** 运行效果如下: ```shell first download code, please set code download path, default is ~/OpenHarmony . # 这里输入想存放的路径 ``` ### 1.3 分支介绍 脚本运行后如下所示,后续添加其他版本可能有增加,以实际效果为准 ```shell ****************************************** * Welcome to download OpenHarmony Code * * Please Choice OpenHarmony SDK: * * OpenHarmony Version * * OpenHarmony master prese 1.1 * * OpenHarmony-3.2-beta2 press 1.2 * * OpenHarmony-v3.2-Release press 1.3 * * OpenHarmony-v3.2.1-Release press 1.4 * * OpenHarmony-v3.2.2-Release press 1.5 * * OpenHarmony clang-master press 1.6 * * OpenHarmony clang-12.0.1 press 1.7 * * Qemu Version * * qemu-riscv64 press 2.1 * * Thead Version * * thead-master press 3.1 * * thead-3.2-beta2 press 3.2 * * thead-3.2-merge press 3.3 * * thead-3.2-release press 3.4 * * thead-v3.2.2-release press 3.5 * * thead-tablet press 3.6 * * thead-cartablet press 3.7 * * thead-cloud press 3.8 * * Riscv Adapt Version * * riscv-weekly0905 press 4.1 * ****************************************** ``` - **`OpenHarmony Version`表示下载的`ohos`官方的对应分支** - `OpenHarmony master`:表示`OpenHarmony`官方`master`分支源代码 - `OpenHarmony-3.2-beta2`:表示`OpenHarmony`官方`OpenHarmony-3.2-beta2`分支源代码 - `OpenHarmony-v3.2-Release`:表示`OpenHarmony`官方`OpenHarmony-v3.2-Release`的tag源代码 - `OpenHarmony-v3.2.1-Release`:表示`OpenHarmony`官方`OpenHarmony-v3.2.1-Release`的tag源代码 - `OpenHarmony-v3.2.2-Release`:表示`OpenHarmony`官方`OpenHarmony-v3.2.2-Release`的tag源代码 - `OpenHarmony clang-master`:表示`OpenHarmony`官方`clang`工具链`master`分支源代码 - `OpenHarmony clang-12.0.1`:表示`OpenHarmony`官方`clang-12.0.1`工具链源代码 - **`Qemu Version`表示下载的`qemu`项目的对应分支** - `qemu-riscv`:表示项目开发的代码分支 - **`Thead Version`表示下载的`thead`项目的对应分支** - `thead-master`:表示基于`OpenHarmony`的`master`分支适配的th1520代码,暂时不能用 - `thead-3.2-beta2`:表示基于`OpenHarmony`的`OpenHarmony-3.2-beta2`分支适配的th1520代码 - `thead-3.2-merge `:已经废弃,无用 - `thead-3.2-release`:表示基于`OpenHarmony`的`OpenHarmony-3.2-Release`分支适配的th1520代码 - `thead-v3.2.2-release`:表示基于`OpenHarmony`的`OpenHarmony-v3.2.2-Release`的tag适配的th1520代码 - `thead-tablet`:基于`OpenHarmony`的`OpenHarmony-v3.2.2-Release`的tag适配的th1520的平板项目代码 - `thead-cartablet`:基于`OpenHarmony`的`OpenHarmony-v3.2.2-Release`的tag适配的th1520的车载平板项目代码 - `thead-cloud`:基于`OpenHarmony`的`OpenHarmony-v3.2.2-Release`的tag适配的th1520的云桌面项目代码 ![icon-note.gif](./img/icon/icon-note.gif) **说明:**` thead`的代码在内网中,除项目内人员,其他人员无权下载 - **`Riscv Adapt Version`表示`riscv`架构上`OpenHarmony`对应分支** - `riscv-weekly0905`:表示`OpenHarmony`的`weekly0905`分支适配的代码 ### 1.4 下载介绍 脚本会在1.2 配置的路径下创建对应的代码版本路径,如果对应的代码版本路径已经存在则会生成一个带`_tmp`后缀的路径,如果该路径仍然存在,则会提示让手动输入路径名字(仅仅是目录的名字而不是完整的路径),如果仍然存在,则程序直接退出,具体的路径在脚本运行下载代码结束后的`log`中有说明,同样脚本所要执行的下载命令`log`中也会显示打印出来,如下所示: ```shell ================================================================================================ you have been download riscv64-qemu OpenHarmony-3.2-Beta2 code url : https://isrc.iscas.ac.cn/gitlab/riscv/polyosmobile/ohos_qemu/manifest.git branch : OpenHarmony-3.2-Beta2 xml_name : code_path : /home/wen_fei/OpenHarmony1/ohos_qemu_riscv64 init cmd: repo init -u https://isrc.iscas.ac.cn/gitlab/riscv/polyosmobile/ohos_qemu/manifest.git -b OpenHarmony-3.2-Beta2 -m ohos_qemu.xml --no-repo-verify sync cmd: repo sync -c lfs cmd: repo forall -c 'git lfs pull' set_br cmd: repo start OpenHarmony-3.2-Beta2 --all ================================================================================================ ``` ![icon-note.gif](./img/icon/icon-note.gif) **说明:** 重复路径操作方法 ```shell you have already exist following path: /home/wen_fei/OpenHarmony/thead-3.2-beta2 /home/wen_fei/OpenHarmony/thead-3.2-beta2_tmp please input the path name you want to download code if you want to delete the /home/wen_fei/OpenHarmony/thead-3.2-beta2_tmp directly and then download it again, please press Enter. test # 直接输入要存放代码的路径名 ================================================================================================ you have been download thead-3.2-beta2 OpenHarmony-3.2-Beta2 code url : https://10.20.72.61/gitlab.com/ohos/manifest.git branch : OpenHarmony-3.2-Beta2 xml_name : code_path : /home/wen_fei/OpenHarmony/test init cmd: repo init -u https://10.20.72.61/gitlab.com/ohos/manifest.git -b OpenHarmony-3.2-Beta2 -m thead_develop.xml --no-repo-verify sync cmd: repo sync -c lfs cmd: repo forall -c 'git lfs pull' set_br cmd: repo start OpenHarmony-3.2-Beta2 --all ================================================================================================ download code success ^_^ ``` ## 二、脚本使用 ```shell git clone https://gitee.com/personal-summary/code_download.git cd code_download ./code_download.sh # 输入所需下载的分支,例如:3.2表示要下载Thead 3.2beta2分支 ```