Compare commits

..
1 Commits
Author SHA1 Message Date
sisungo 797459750f feat (lib): add source_git
Signed-off-by: sisungo <[email protected]>
2026-06-10 03:06:21 +08:00
3 changed files with 22 additions and 22 deletions
+4
View File
@@ -59,3 +59,7 @@ def block_hook(hook: str):
def source_url(url: str):
sources.source_url(url)
def source_git(url: str, branch: str | None = None):
sources.source_git(url, branch)
+18
View File
@@ -1,4 +1,5 @@
import os
import subprocess
import sys
import tarfile
import urllib.parse
@@ -109,3 +110,20 @@ def source_url(url: str):
tar.extractall(extract_dir)
with open("./target/sources.tag", "wt+") as file:
file.write(sources_dir)
def _git_repo_name(url: str) -> str:
return url.split("/")[-1].replace(".git", "")
def source_git(url: str, branch: str | None = None):
source_path = os.getcwd() + "/target/" + _git_repo_name(url)
if os.path.exists("./target/sources.tag"):
return
cmdline = ["git", "clone", "--depth=1"]
if branch:
cmdline += ["-b", branch]
cmdline += [url, source_path]
subprocess.run(cmdline, check=True)
with open("./target/sources.tag", "wt+") as file:
file.write(source_path)
-22
View File
@@ -1,22 +0,0 @@
import os
from lib.make import *
version("1.59.2")
source_git("https://github.com/mirabilos/mksh-cvs2git.git", "mksh-R59c")
def build():
os.system("sh ./Build.sh")
on_build(build)
def pack_mksh(composer):
composer.makedir("bin")
composer.addfile("mksh", "bin/mksh")
package("mksh")
on_pack(pack_mksh)