def commit(local_repo_path, major, minor, aux, commit_msg): ret = None pre_status = 0 if not os.path.exists(local_repo_path + os.sep + ".git"): print "NOT a git repository!!" sys.exit(1) # pull from remote repository pull(local_repo_path) update_version_header(local_repo_path, major, minor, aux) CMD = ['git', 'add', '.'] ret = ops.execCmd(CMD, local_repo_path, False, None) pre_status = ret[2] if pre_status > 0: print 'add failed' sys.exit(1) CMD = ['git', 'commit', '-m', commit_msg] ret = ops.execCmd(CMD, local_repo_path, False, None) pre_status = ret[2] if pre_status > 0: print 'commit failed' sys.exit(1) CMD = ['git', 'push'] ret = ops.execCmd(CMD, local_repo_path, False, None) pre_status = ret[2] if pre_status > 0: sys.exit(1)
def get(workspace, url): CMD = ['go'] res = ops.execCmd(CMD, workspace, False, None) CMD = ['go', 'get', url] res = ops.execCmd(CMD, workspace, False, None) print res if res[2] > 0: sys.exit(1) return res
def MAIN_BUILD(args): set_global(args) #iopc.make_squashfs_xz(output_platform_dir, output_dir, squashfs_name) CMD = [ 'python', daosfs_script, output_platform_dir, ops.path_join(output_dir, squashfs_name) ] ops.execCmd(CMD, output_dir, False) return False
def MAIN_BUILD(args): set_global(args) if install_platform_dao == True: for ini in dao_files: dao_file = ops.path_join(output_platform_dir, ini + ".ini") dao_bin = ops.path_join(output_platform_dir, ini + ".bin") CMD = ['python', dao_script, dao_file, dao_bin] print CMD ops.execCmd(CMD, output_dir, False) return False
def MAIN_EXTRACT(args): set_global(args) CMD = [] if do_debootstrap.lower() != "Y".lower(): ops.unTarXzSUDO(base_rootfs_tarball, output_dir) else: if arch == "armhf": # hard flot output_path = ops.pkg_mkdir(output_dir, "debian_jessie_armhf") download_url = 'http://ftp.debian.org/debian/' CMD = [ "sudo", "qemu-debootstrap", "--arch=armhf", "jessie", output_path, download_url ] elif arch == "armel": # soft flot output_path = ops.pkg_mkdir(output_dir, "debian_jessie_armel") download_url = 'http://ftp.debian.org/debian/' #CMD=["qemu-debootstrap", "--arch=" + arch, "jessie", output_path, download_url] CMD = [ "sudo", "qemu-debootstrap", "--arch=armel", "jessie", "--variant=minbase", output_path, download_url ] elif arch == "x86_64": output_path = ops.pkg_mkdir(output_dir, "debian_jessie_x86_64") download_url = 'http://ftp.debian.org/debian/' CMD = [ "sudo", "qemu-debootstrap", "--arch=amd64", "jessie", "--variant=minbase", output_path, download_url ] print CMD res = ops.execCmd(CMD, output_path, False, None) return True
def pull(local_repo_path): CMD = ['git', 'pull'] res = ['', '', 1] if os.path.exists(local_repo_path + os.sep + ".git"): res = ops.execCmd(CMD, local_repo_path, False, None) else: print "NOT a git repository!!" return res
def latest_commit_hash(local_repo_path): CMD = ['git', 'log', '--pretty=format:%H', '-1'] res = ['', '', 1] if os.path.exists(local_repo_path + os.sep + ".git"): res = ops.execCmd(CMD, local_repo_path, False) else: print "NOT a git repository!!" commit_hash = res[0] return commit_hash
def status(local_repo_path): CMD = ['git', 'status', '-v'] ret = ['', '', 1] #print "-Status-------------------" if os.path.exists(local_repo_path + os.sep + ".git"): ret = ops.execCmd(CMD, local_repo_path, False) else: return None print "NOT a git repository!!" #print "--------------------------" return ret
def MAIN_BUILD(args): set_global(args) ops.copyto(ops.path_join(pkg_path, mkinitramfs), iopc.getOutputRootDir()) CMD = [ ops.path_join(iopc.getOutputRootDir(), mkinitramfs), ops.path_join(iopc.getOutputRootDir(), "rootfs"), initramfs_file ] res = ops.execCmd(CMD, iopc.getOutputRootDir(), False, None) print res return False
def MAIN_EXTRACT(args): set_global(args) CMD = [ops.path_join(pkg_path, go_pkgs_dep_script)] res = ops.execCmd(CMD, GOPATH, False, None) #if res[2] != 0: # print res # print res[1] # sys.exit(1) ops.copyto(ops.path_join(pkg_path, "src"), GOPATH) ops.copyto(ops.path_join(pkg_path, "Makefile"), GOPATH) ops.copyto(ops.path_join(pkg_path, "main.go"), GOPATH) return True
def get_version_from_log(local_repo_path): major = 1 minor = 0 aux = 0 CMD = ['git', 'log', '--pretty=format:%B', '-1'] res = ['', '', 1] if os.path.exists(local_repo_path + os.sep + ".git"): res = ops.execCmd(CMD, local_repo_path, False) commit_msg = res[0] commit_msg_list = commit_msg.split('\n') for msg in commit_msg_list: msg = msg.strip() if msg.startswith('MAJOR_NUM'): major = int(msg.split('=')[1]) if msg.startswith('MINOR_NUM'): minor = int(msg.split('=')[1]) if msg.startswith('AUX_NUM'): aux = int(msg.split('=')[1]) return [major, minor, aux]
def clone(remote_repo_path, packages_dir): CMD = ['git', 'clone', remote_repo_path] res = ops.execCmd(CMD, packages_dir, False, None) return res
def MAIN_EXTRACT(args): set_global(args) ops.mkdir(output_rootfs_dir) CMD = ['python2.7', storage_generator, ops.path_join(output_rootfs_dir, 'hda.img')] ops.execCmd(CMD, pkg_path, False) CMD = ['python2.7', storage_generator, ops.path_join(output_rootfs_dir, 'vda.img')] ops.execCmd(CMD, pkg_path, False) CMD = ['python2.7', storage_generator, ops.path_join(output_rootfs_dir, 'vdb.img')] ops.execCmd(CMD, pkg_path, False) CMD = ['python2.7', storage_generator, ops.path_join(output_rootfs_dir, 'vdc.img')] ops.execCmd(CMD, pkg_path, False) CMD = ['python2.7', storage_generator, ops.path_join(output_rootfs_dir, 'vdd.img')] ops.execCmd(CMD, pkg_path, False) CMD = ['python2.7', storage_generator, ops.path_join(output_rootfs_dir, 'vde.img')] ops.execCmd(CMD, pkg_path, False) return True