IF YOU WOULD LIKE TO GET AN ACCOUNT, please write an email to s dot adaszewski at gmail dot com. User accounts are meant only to report issues and/or generate pull requests. This is a purpose-specific Git hosting for ADARED projects. Thank you for your understanding!
瀏覽代碼

Add reusing of existing steps.

tags/0.92
父節點
當前提交
174ecdfb6d
共有 3 個檔案被更改,包括 26 行新增1 行删除
  1. +3
    -1
      Fockerfile
  2. +5
    -0
      image.py
  3. +18
    -0
      zfs.py

+ 3
- 1
Fockerfile 查看文件

@@ -1,6 +1,8 @@
base: freebsd-12.1
base: freebsd-latest
steps:
- run: |
pkg -y install -y python3 && \
pkg -y install -y py37-pip
- run: |
pkg install -y py37-yaml

+ 5
- 0
image.py 查看文件

@@ -38,6 +38,11 @@ def build(spec):
for st in steps:
st = create_step(st)
st_sha256 = st.hash(base_sha256)
if zfs_exists_snapshot_sha256(st_sha256):
base = zfs_snapshot_by_sha256(st_sha256)
base_sha256 = st_sha256
print('Reusing:', base)
continue
for pre in range(7, 64):
name = root + '/' + st_sha256[:pre]
if not zfs_exists(name):


+ 18
- 0
zfs.py 查看文件

@@ -54,6 +54,24 @@ def zfs_mountpoint(name):
return lst[0][0]
def zfs_exists_snapshot_sha256(sha256):
lst = zfs_parse_output(['zfs', 'list', '-o', 'focker:sha256', '-t', 'snap'])
lst = list(filter(lambda a: a[0] == sha256, lst))
if len(lst) == 0:
return False
return True
def zfs_snapshot_by_sha256(sha256):
lst = zfs_parse_output(['zfs', 'list', '-o', 'focker:sha256,name', '-t', 'snap', '-H'])
lst = list(filter(lambda a: a[0] == sha256, lst))
if len(lst) == 0:
raise ValueError('Snapshot with given sha256 does not exist: ' + sha256)
if len(lst) > 1:
raise ValueError('Ambiguous snapshot sha256: ' + sha256)
return lst[0][1]
def zfs_init():
poolname = zfs_parse_output(['zfs', 'list', '-H', '/'])
if len(poolname) == 0:


Loading…
取消
儲存