#!/bin/bash # # Usage: # ./local.sh set -o nounset set -o pipefail set -o errexit proc publish-spec { test/publish.sh spec chubot chubot.org andy-home } proc git-merge-to-master { var do_push = $(1:-T) # pass F to disable var branch = $[git rev-parse --abbrev-ref HEAD] if test $do_push = T { git checkout master && git merge $branch && git push && git checkout $branch } else { git checkout master && git merge $branch && git checkout $branch } } proc spec-out-of-vm { time cp -r --dereference _tmp/spec ~/vm-shared } proc make-release-dirs { ssh chubot@chubot.org 'mkdir -p oilshell.org/downloadsetconst global FOO = "bar"' } readonly OIL_VERSION = $[head -n 1 oil-version.txt] # Hm, trailing slash matters # TODO: This should be an HTML redirect, not a symlink? proc make-symlinks { ssh chubot@chubot.org \ "ln -s -f --no-target-directory -v release/$OIL_VERSION/doc oilshell.org/doc" } proc publish-doc { scripts/release.sh publish-doc chubot chubot.org } proc publish-release { scripts/release.sh publish-release chubot chubot.org } @Argv (CommandList children: [ (C {(set)} {(-o)} {(nounset)}) (C {(set)} {(-o)} {(pipefail)}) (C {(set)} {(-o)} {(errexit)}) (FuncDef name: publish-spec body: (BraceGroup children: [(C {(test/publish.sh)} {(spec)} {(chubot)} {(chubot.org)} {(andy-home)})] spids: [36] ) spids: [32 35] ) (FuncDef name: git-merge-to-master body: (BraceGroup children: [ (Assignment keyword: Assign_Local pairs: [ (assign_pair lhs: (LhsName name:do_push) op: Equal rhs: { (BracedVarSub token: suffix_op: (StringUnary op_id:VTest_ColonHyphen arg_word:{(T)}) spids: [62 66] ) } spids: [61] ) ] spids: [59] ) (Assignment keyword: Assign_Local pairs: [ (assign_pair lhs: (LhsName name:branch) op: Equal rhs: { (CommandSubPart command_list: (CommandList children: [(C {(git)} {(rev-parse)} {(--abbrev-ref)} {(HEAD)})] ) left_token: spids: [76 84] ) } spids: [75] ) ] spids: [73] ) (If arms: [ (if_arm cond: [ (Sentence child: (C {(test)} {(DQ ($ VSub_Name "$do_push"))} {(Lit_Other "=")} {(T)}) terminator: ) ] action: [ (AndOr children: [ (C {(git)} {(checkout)} {(master)}) (AndOr children: [ (C {(git)} {(merge)} {($ VSub_Name "$branch")}) (AndOr children: [ (C {(git)} {(push)}) (C {(git)} {(checkout)} {($ VSub_Name "$branch")}) ] op_id: Op_DAmp ) ] op_id: Op_DAmp ) ] op_id: Op_DAmp ) ] spids: [-1 101] ) ] else_action: [ (AndOr children: [ (C {(git)} {(checkout)} {(master)}) (AndOr children: [ (C {(git)} {(merge)} {($ VSub_Name "$branch")}) (C {(git)} {(checkout)} {($ VSub_Name "$branch")}) ] op_id: Op_DAmp ) ] op_id: Op_DAmp ) ] spids: [136 164] ) ] spids: [56] ) spids: [52 55] ) (FuncDef name: spec-out-of-vm body: (BraceGroup children: [ (TimeBlock pipeline: (C {(cp)} {(-r)} {(--dereference)} {(_tmp/spec)} {(TildeSubPart prefix:"") (/vm-shared)}) ) ] spids: [173] ) spids: [169 172] ) (FuncDef name: make-release-dirs body: (BraceGroup children: [ (C {(ssh)} {(chubot) (Lit_Other "@") (chubot.org)} {(SQ <"mkdir -p oilshell.org/download">)}) ] spids: [196] ) spids: [192 195] ) (Assignment keyword: Assign_Readonly pairs: [ (assign_pair lhs: (LhsName name:OIL_VERSION) op: Equal rhs: { (CommandSubPart command_list: (CommandList children:[(C {(head)} {(-n)} {(1)} {(oil-version.txt)})]) left_token: spids: [215 223] ) } spids: [214] ) ] spids: [212] ) (FuncDef name: make-symlinks body: (BraceGroup children: [ (C {(ssh)} {(chubot) (Lit_Other "@") (chubot.org)} { (DQ ("ln -s -f --no-target-directory -v release/") ($ VSub_Name "$OIL_VERSION") ("/doc oilshell.org/doc") ) } ) ] spids: [236] ) spids: [232 235] ) (FuncDef name: publish-doc body: (BraceGroup children: [(C {(scripts/release.sh)} {(publish-doc)} {(chubot)} {(chubot.org)})] spids: [260] ) spids: [256 259] ) (FuncDef name: publish-release body: (BraceGroup children: [(C {(scripts/release.sh)} {(publish-release)} {(chubot)} {(chubot.org)})] spids: [278] ) spids: [274 277] ) (C {(DQ ($ VSub_At "$@"))}) ] )