#!/bin/sh # This script will create a deep snapshot of all Observatory package # dependencies. The output will be in observatory_pub_packages which # then should be committed to third_party/observatory_pub_packages. global PUBSPEC_INPUT := '"pubspec.template'" global PUBSPEC_OUTPUT := '"pubspec.yaml'" global PACKAGES_INPUT := '"packages'" global PACKAGES_OUTPUT := '"observatory_pub_packages'" if test ! -d "../maintainers" { echo "Please run this script from the maintainers directory" exit } if test ! -f $PUBSPEC_INPUT { echo "Cannot find $PUBSPEC_INPUT" exit } # Cleanup leftovers rm -f $PUBSPEC_OUTPUT rm -rf $PACKAGES_INPUT rm -rf $PACKAGES_OUTPUT # Setup for pub get run cp $PUBSPEC_INPUT $PUBSPEC_OUTPUT # Run pub get pub get # Prepare for output mkdir $PACKAGES_OUTPUT global OUTPUT_BASE := $[realpath $PACKAGES_OUTPUT] # Copy necessary files pushd $PACKAGES_INPUT > /dev/null for i in [*] { global ACTUAL_PATH := $[realpath $i] mkdir $OUTPUT_BASE/$i mkdir $OUTPUT_BASE/$i/lib cp $ACTUAL_PATH/../pubspec.yaml $OUTPUT_BASE/$i/pubspec.yaml rsync -Lr $ACTUAL_PATH/* $OUTPUT_BASE/$i/lib } popd > /dev/null echo '***' echo 'Dumping package dependencies:': echo '' echo 'dependency_overrides:' pushd $PACKAGES_OUTPUT > /dev/null for i in [*] { echo -e " $i:\n path: ../../third_party/$PACKAGES_OUTPUT/$i" } popd > /dev/null echo '' echo '***' echo -n 'Now run: rsync -a --delete observatory_pub_packages/ ' echo '~/workspace/dart-third_party/observatory_pub_packages/' echo 'Then: ' echo 'cd ~/workspace/dart-third_party/observatory_pub_packages/' echo "svn status | grep ^? | sed 's/? //' | xargs svn add" echo "svn st | grep ^! | sed 's/! //' | xargs svn rm" echo '***' (CommandList children: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:PUBSPEC_INPUT) op: Equal rhs: {(DQ (pubspec.template))} spids: [15] ) ] spids: [15] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:PUBSPEC_OUTPUT) op: Equal rhs: {(DQ (pubspec.yaml))} spids: [20] ) ] spids: [20] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:PACKAGES_INPUT) op: Equal rhs: {(DQ (packages))} spids: [25] ) ] spids: [25] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:PACKAGES_OUTPUT) op: Equal rhs: {(DQ (observatory_pub_packages))} spids: [30] ) ] spids: [30] ) (If arms: [ (if_arm cond: [ (Sentence child: (C {(Lit_Other "[")} {(KW_Bang "!")} {(-d)} {(DQ (../maintainers))} {(Lit_Other "]")}) terminator: ) ] action: [ (C {(echo)} {(DQ ("Please run this script from the maintainers directory"))}) (C {(exit)}) ] spids: [-1 51] ) ] spids: [-1 63] ) (If arms: [ (if_arm cond: [ (Sentence child: (C {(Lit_Other "[")} {(KW_Bang "!")} {(-f)} {($ VSub_Name "$PUBSPEC_INPUT")} {(Lit_Other "]")} ) terminator: ) ] action: [(C {(echo)} {(DQ ("Cannot find ") ($ VSub_Name "$PUBSPEC_INPUT"))}) (C {(exit)})] spids: [-1 79] ) ] spids: [-1 92] ) (C {(rm)} {(-f)} {($ VSub_Name "$PUBSPEC_OUTPUT")}) (C {(rm)} {(-rf)} {($ VSub_Name "$PACKAGES_INPUT")}) (C {(rm)} {(-rf)} {($ VSub_Name "$PACKAGES_OUTPUT")}) (C {(cp)} {($ VSub_Name "$PUBSPEC_INPUT")} {($ VSub_Name "$PUBSPEC_OUTPUT")}) (C {(pub)} {(get)}) (C {(mkdir)} {($ VSub_Name "$PACKAGES_OUTPUT")}) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:OUTPUT_BASE) op: Equal rhs: { (CommandSubPart command_list: (CommandList children: [(C {(realpath)} {($ VSub_Name "$PACKAGES_OUTPUT")})] ) left_token: spids: [144 148] ) } spids: [143] ) ] spids: [143] ) (SimpleCommand words: [{(pushd)} {($ VSub_Name "$PACKAGES_INPUT")}] redirects: [(Redir op_id:Redir_Great fd:-1 arg_word:{(/dev/null)} spids:[157])] ) (ForEach iter_name: i iter_words: [{(Lit_Other "*")}] do_arg_iter: False body: (DoGroup children: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:ACTUAL_PATH) op: Equal rhs: { (CommandSubPart command_list: (CommandList children:[(C {(realpath)} {($ VSub_Name "$i")})]) left_token: spids: [174 178] ) } spids: [173] ) ] spids: [173] ) (C {(mkdir)} {($ VSub_Name "$OUTPUT_BASE") (/) ($ VSub_Name "$i")}) (C {(mkdir)} {($ VSub_Name "$OUTPUT_BASE") (/) ($ VSub_Name "$i") (/lib)}) (C {(cp)} {($ VSub_Name "$ACTUAL_PATH") (/../pubspec.yaml)} {($ VSub_Name "$OUTPUT_BASE") (/) ($ VSub_Name "$i") (/pubspec.yaml)} ) (C {(rsync)} {(-Lr)} {($ VSub_Name "$ACTUAL_PATH") (/) (Lit_Other "*")} {($ VSub_Name "$OUTPUT_BASE") (/) ($ VSub_Name "$i") (/lib)} ) ] spids: [170 220] ) spids: [166 168] ) (SimpleCommand words: [{(popd)}] redirects: [(Redir op_id:Redir_Great fd:-1 arg_word:{(/dev/null)} spids:[224])] ) (C {(echo)} {(SQ <"***">)}) (C {(echo)} {(SQ <"Dumping package dependencies:">) (Lit_Other ":")}) (C {(echo)} {(SQ )}) (C {(echo)} {(SQ <"dependency_overrides:">)}) (SimpleCommand words: [{(pushd)} {($ VSub_Name "$PACKAGES_OUTPUT")}] redirects: [(Redir op_id:Redir_Great fd:-1 arg_word:{(/dev/null)} spids:[257])] ) (ForEach iter_name: i iter_words: [{(Lit_Other "*")}] do_arg_iter: False body: (DoGroup children: [ (C {(echo)} {(-e)} { (DQ (" ") ($ VSub_Name "$i") (":") (EscapedLiteralPart token:) (" path: ../../third_party/") ($ VSub_Name "$PACKAGES_OUTPUT") (/) ($ VSub_Name "$i") ) } ) ] spids: [270 288] ) spids: [266 268] ) (SimpleCommand words: [{(popd)}] redirects: [(Redir op_id:Redir_Great fd:-1 arg_word:{(/dev/null)} spids:[292])] ) (C {(echo)} {(SQ )}) (C {(echo)} {(SQ <"***">)}) (C {(echo)} {(-n)} {(SQ <"Now run: rsync -a --delete observatory_pub_packages/ ">)}) (C {(echo)} {(SQ <"~/workspace/dart-third_party/observatory_pub_packages/">)}) (C {(echo)} {(SQ <"Then: ">)}) (C {(echo)} {(SQ <"cd ~/workspace/dart-third_party/observatory_pub_packages/">)}) (C {(echo)} {(DQ ("svn status | grep ^? | sed 's/? //' | xargs svn add"))}) (C {(echo)} {(DQ ("svn st | grep ^! | sed 's/! //' | xargs svn rm"))}) (C {(echo)} {(SQ <"***">)}) ] )