Skip to content

Commit

Permalink
Merge branch 'master' into oilcan-productions-patch-1
Browse files Browse the repository at this point in the history
  • Loading branch information
oilcan-productions authored Aug 27, 2024
2 parents 5f5c47b + b029cb7 commit 3f3e71a
Show file tree
Hide file tree
Showing 28 changed files with 2,957 additions and 1,244 deletions.
56 changes: 52 additions & 4 deletions build/deploy-ftp.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,21 +18,68 @@ echo "login $USER" >> "$NETRC"
echo "password $FTP_SECRET" >> "$NETRC"
chmod 600 "$NETRC"

# create_archive will create a tar ball from the out folder
# try to extract it to see if it is valid
# retry 3 times then fail
create_archive{
MAX_RETRIES=3
RETRY_COUNT=0

while (( RETRY_COUNT < MAX_RETRIES )); do
(cd out; tar czf $EMULATOR.tgz $EMULATOR)

# Verify the tarball
if tar tf $EMULATOR.tgz >/dev/null 2>&1; then
echo "Tarball is valid and can be expanded."
break
else
echo "Tarball is not valid or cannot be expanded. Retrying..."
RETRY_COUNT=$((RETRY_COUNT + 1))
rm -f $EMULATOR.tgz
continue
fi
done

if (( RETRY_COUNT == MAX_RETRIES )); then
echo "Failed to create a valid tarball after $MAX_RETRIES attempts."
return 1
fi
}

# upload_file tries to upload the tar ball to the FTP server, will retry 5 times and then fail
upload_file(){
(cd out; tar czf $EMULATOR.tgz $EMULATOR)
MAX_RETRIES=5
RETRY_COUNT=0

echo "Deploying as $USER at $HOST"
while (( RETRY_COUNT < MAX_RETRIES )); do
echo "Deploying as $USER at $HOST"

ftp "$HOST" <<EOF
# Attempt to upload the file
if ftp "$HOST" <<EOF
passive on
type image
cd $DIR
lcd out
put $EMULATOR.tgz
bye
EOF
then
echo "Upload successful."
break
else
echo "Upload failed. Retrying..."
RETRY_COUNT=$((RETRY_COUNT + 1))
fi
done

if (( RETRY_COUNT == MAX_RETRIES )); then
echo "Failed to upload the file after $MAX_RETRIES attempts."
return 1
fi
}

# test_archive_integrity will download the tarball after successful upload and verify its integrity
# by binary comparing the contents of the source folder and the expanded folder
test_archive_integrity(){
echo "Testing download of $EMULATOR.tgz"
mkdir -p "$TESTDIR"
Expand Down Expand Up @@ -78,8 +125,9 @@ test_archive_integrity(){
fi
}


# main loop
while [ $retry_count -lt $RETRY_LIMIT ]; do
create_archive
upload_file
if test_archive_integrity; then
echo "File integrity verified successfully."
Expand Down
73 changes: 64 additions & 9 deletions build/shrdlu.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -2,25 +2,80 @@ log_progress "ENTERING BUILD SCRIPT: SHRDLU"

respond "*" ":cwd shrdlu\r"

respond "*" ":complr\r"
respond "_" "shrdlu; graphf\r"
respond "_" "\032"
type ":kill\r"
# first, compile all the sources that should be compiled

respond "*" ":complr graphf\r"
respond "Job COMPLR finished" ":kill\r"

respond "*" ":complr macros\r"
respond "Job COMPLR finished" ":kill\r"

respond "*" ":complr proggo\r"
respond "Job COMPLR finished" ":kill\r"

respond "*" ":complr plnr\r"
respond "Job COMPLR finished" ":kill\r"

respond "*" ":complr thtrac\r"
respond "Job COMPLR finished" ":kill\r"

respond "*" ":complr syscom\r"
respond "Job COMPLR finished" ":kill\r"

respond "*" ":complr morpho\r"
respond "Job COMPLR finished" ":kill\r"

respond "*" ":complr show\r"
respond "Job COMPLR finished" ":kill\r"

respond "*" ":complr progmr\r"
respond "Job COMPLR finished" ":kill\r"

respond "*" ":complr ginter\r"
respond "Job COMPLR finished" ":kill\r"

respond "*" ":complr gramar\r"
respond "Job COMPLR finished" ":kill\r"

respond "*" ":complr dictio\r"
respond "Job COMPLR finished" ":kill\r"

respond "*" ":complr smspec\r"
respond "Job COMPLR finished" ":kill\r"

respond "*" ":complr smass\r"
respond "Job COMPLR finished" ":kill\r"

respond "*" ":complr smutil\r"
respond "Job COMPLR finished" ":kill\r"

respond "*" ":complr newans\r"
respond "Job COMPLR finished" ":kill\r"

respond "*" ":complr blockp\r"
respond "Job COMPLR finished" ":kill\r"

respond "*" ":complr blockl\r"
respond "Job COMPLR finished" ":kill\r"

# now load up a compiled version of SHRDLU
respond "*" ":lisp\r"
respond "Alloc?" "n"
respond "*" "(load 'loader)"
respond "T" "(loadshrdlu)"
respond "|CONSTRUCTION COMPLETED|" "(dump-it)"
respond "T" "(load-shrdlu-compiled)"
respond "COMPLETED" "(dump-shrdlu)"

# dump it as SHRDLU;TS SHRDLU
respond "*" ":pdump shrdlu;ts shrdlu\r"
respond "*" ":kill\r"

# load up a compiled version of PLNR
respond "*" ":lisp\r"
respond "Alloc?" "n"
respond "*" "(load 'loader)"
respond "T" "(load 'plnrfi)"
respond "T" "(loadplanner)"
respond "T" "(load-planner-compiled)"
respond "(THERT TOP LEVEL))" "(dump-planner)"

# dump it as SHRDLU;TS PLNR
respond "*" ":pdump shrdlu;ts plnr\r"
respond "*" ":kill\r"

Loading

0 comments on commit 3f3e71a

Please sign in to comment.