Loading tools/clean-staging 0 → 100755 +37 −0 Original line number Diff line number Diff line #!/usr/bin/env python import os import json from subprocess import Popen, PIPE, check_call from installsystems.printer import arrow def get_image_list(repo): p = Popen(['is', '--no-color', '--quiet', '--repo-search', '', 'list', '-j', '%s/*' % repo], stdout=PIPE) stdout, stderr = p.communicate() if p.returncode != 0: exit('Unable to get %s list' % repo) img = json.loads(stdout) d = {} for k,v in img.items(): d[v['md5']] = k return d arrow('Getting staging images list') staging_imgs=get_image_list('staging') arrow('Getting stable images list') stable_imgs=get_image_list('stable') arrow('Getting testing images list') testing_imgs=get_image_list('testing') official=set(stable_imgs) | set(testing_imgs) to_remove=set(staging_imgs) & official arrow('Removing staging images in stable or testing') for md5 in to_remove: name=staging_imgs[md5] arrow('%s (%s)' % (name, md5), 1) check_call(['is', 'del', '-f', name]) # vim:set ts=2 sw=2 ft=python noet: tools/clean-testing 0 → 100755 +34 −0 Original line number Diff line number Diff line #!/usr/bin/env python import os import json from subprocess import Popen, PIPE, check_call from installsystems.printer import arrow def get_image_list(repo): p = Popen(['is', '--no-color', '-q', 'list', '-j', '%s/*' % repo], stdout=PIPE) stdout, stderr = p.communicate() if p.returncode != 0: exit('Unable to get %s list' % repo) img = json.loads(stdout) d = {} for k,v in img.items(): d[v['md5']] = k return d arrow('Getting stable images list') stable_imgs=get_image_list('stable') arrow('Getting testing images list') testing_imgs=get_image_list('testing') official=set(stable_imgs) to_remove=set(testing_imgs) & official arrow('Removing testing images in stable') for md5 in to_remove: name=testing_imgs[md5] arrow('%s (%s)' % (name, md5), 1) check_call(['is', 'del', '-f', name]) # vim:set ts=2 sw=2 ft=python noet: tools/new-image 0 → 100755 +40 −0 Original line number Diff line number Diff line #!/bin/bash # A seblu script usage() { echo "usage: ${0##*/} image_name" >&2 exit 1 } image_path='/root/images' image_name="$1" cd "$image_path" # check image already exists [[ -d "$image_name" ]] && echo "Image $image_name already exists" >&2 && exit 2 # create image is new "$image_name" cd "$image_name" # customize description sed -ri "s/\s*name\s*=.*/name = $image_name/" description sed -ri "s/\s*version\s*=.*/version = 0/" description # create git git init # add gitignore cat > .gitignore << EOF *.isimage *.isdata payload EOF git add .gitignore git add description changelog git ci -m 'Initial commit' # vim:set ts=2 sw=2 ft=sh et: tools/staging 0 → 100755 +29 −0 Original line number Diff line number Diff line #!/bin/bash usage() { echo "usage: $0 [build_options]" >&2 } repo=$(basename $0) (( $# > 0 )) && build_options=("$@") || build_options=('-f') [[ ! -r description ]] && echo 'Invalid source image' >&2 && usage && exit 2 imgname=$(sed -rn 's/^[[:space:]]*name[[:space:]]*=[[:space:]]*([^[:space:]]+)[[:space:]]*/\1/p' description) imgver=$(sed -rn 's/^[[:space:]]*version[[:space:]]*=[[:space:]]*([^[:space:]]+)[[:space:]]*/\1/p' description) echo "Building image $imgname v$imgver and pushing it on repo $repo" # build new version is build "${build_options[@]}" || exit 1 # is v5 doesn't return != 0 if ctrl+c is pressed, we check manually [[ -f "$imgname-$imgver.isimage" ]] || exit 1 # delete old version is del -fp "$repo/$imgname:$imgver" # add new version is add "$repo" "$imgname-$imgver.isimage" # vim:set ts=2 sw=2 ft=sh noet: Loading
tools/clean-staging 0 → 100755 +37 −0 Original line number Diff line number Diff line #!/usr/bin/env python import os import json from subprocess import Popen, PIPE, check_call from installsystems.printer import arrow def get_image_list(repo): p = Popen(['is', '--no-color', '--quiet', '--repo-search', '', 'list', '-j', '%s/*' % repo], stdout=PIPE) stdout, stderr = p.communicate() if p.returncode != 0: exit('Unable to get %s list' % repo) img = json.loads(stdout) d = {} for k,v in img.items(): d[v['md5']] = k return d arrow('Getting staging images list') staging_imgs=get_image_list('staging') arrow('Getting stable images list') stable_imgs=get_image_list('stable') arrow('Getting testing images list') testing_imgs=get_image_list('testing') official=set(stable_imgs) | set(testing_imgs) to_remove=set(staging_imgs) & official arrow('Removing staging images in stable or testing') for md5 in to_remove: name=staging_imgs[md5] arrow('%s (%s)' % (name, md5), 1) check_call(['is', 'del', '-f', name]) # vim:set ts=2 sw=2 ft=python noet:
tools/clean-testing 0 → 100755 +34 −0 Original line number Diff line number Diff line #!/usr/bin/env python import os import json from subprocess import Popen, PIPE, check_call from installsystems.printer import arrow def get_image_list(repo): p = Popen(['is', '--no-color', '-q', 'list', '-j', '%s/*' % repo], stdout=PIPE) stdout, stderr = p.communicate() if p.returncode != 0: exit('Unable to get %s list' % repo) img = json.loads(stdout) d = {} for k,v in img.items(): d[v['md5']] = k return d arrow('Getting stable images list') stable_imgs=get_image_list('stable') arrow('Getting testing images list') testing_imgs=get_image_list('testing') official=set(stable_imgs) to_remove=set(testing_imgs) & official arrow('Removing testing images in stable') for md5 in to_remove: name=testing_imgs[md5] arrow('%s (%s)' % (name, md5), 1) check_call(['is', 'del', '-f', name]) # vim:set ts=2 sw=2 ft=python noet:
tools/new-image 0 → 100755 +40 −0 Original line number Diff line number Diff line #!/bin/bash # A seblu script usage() { echo "usage: ${0##*/} image_name" >&2 exit 1 } image_path='/root/images' image_name="$1" cd "$image_path" # check image already exists [[ -d "$image_name" ]] && echo "Image $image_name already exists" >&2 && exit 2 # create image is new "$image_name" cd "$image_name" # customize description sed -ri "s/\s*name\s*=.*/name = $image_name/" description sed -ri "s/\s*version\s*=.*/version = 0/" description # create git git init # add gitignore cat > .gitignore << EOF *.isimage *.isdata payload EOF git add .gitignore git add description changelog git ci -m 'Initial commit' # vim:set ts=2 sw=2 ft=sh et:
tools/staging 0 → 100755 +29 −0 Original line number Diff line number Diff line #!/bin/bash usage() { echo "usage: $0 [build_options]" >&2 } repo=$(basename $0) (( $# > 0 )) && build_options=("$@") || build_options=('-f') [[ ! -r description ]] && echo 'Invalid source image' >&2 && usage && exit 2 imgname=$(sed -rn 's/^[[:space:]]*name[[:space:]]*=[[:space:]]*([^[:space:]]+)[[:space:]]*/\1/p' description) imgver=$(sed -rn 's/^[[:space:]]*version[[:space:]]*=[[:space:]]*([^[:space:]]+)[[:space:]]*/\1/p' description) echo "Building image $imgname v$imgver and pushing it on repo $repo" # build new version is build "${build_options[@]}" || exit 1 # is v5 doesn't return != 0 if ctrl+c is pressed, we check manually [[ -f "$imgname-$imgver.isimage" ]] || exit 1 # delete old version is del -fp "$repo/$imgname:$imgver" # add new version is add "$repo" "$imgname-$imgver.isimage" # vim:set ts=2 sw=2 ft=sh noet: