Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

eda-ai: add create-package script #74

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion doc/solver_description/sparrow2mergesat.tex
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
\begin{document}

% paper title
\title{\textsc{SparrowToMergeSAT} 2018}
\title{\textsc{SparrowToMergeSAT} 2019}

% author names and affiliations
% use a multiple column layout for up to three different
Expand Down
69 changes: 69 additions & 0 deletions tools/eda-ai/create-package.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
#!/bin/bash
#

# locate the script to be able to call related scripts
SCRIPT=$(readlink -e "$0")
SCRIPTDIR=$(dirname "$SCRIPT")

declare -r START_DIR="$PWD"

# fail on error
set -e

# get work directory
trap '[ -d "$WORKDIR" ] && rm -rf "$WORKDIR"' EXIT
WORKDIR=$(mktemp -d)

# create code dir
CODE_DIR="$WORKDIR"/code
mkdir -p "$CODE_DIR"

# copy full content into code directory
git clone "$SCRIPTDIR"/../.. "$CODE_DIR"/mergesat

# get dependencies, if not there already: Caution: this can drop state
pushd "$CODE_DIR"/mergesat
git submodule update --init --recursive
git clean -xfd || true
git submodule foreach --recursive git clean -xfd || true
popd

# create required links in root directory
pushd "$WORKDIR"
ln -s code/mergesat/license.txt license.txt
ln -s code/mergesat/README readme.txt
cp -r "$SCRIPTDIR"/build.sh .
popd

# log git version
pushd "$SCRIPTDIR"
echo "Package git version:" > "$WORKDIR"/VERSION
git describe || git show -s --pretty=oneline >> "$WORKDIR"/VERSION
GIT_VERSION="$(git describe 6> /dev/null || true)"
[ -n "$GIT_VERSION" ] && GIT_VERSION="-$GIT_VERSION"
[ -z "$GIT_VERSION" ] && GIT_VERSION="-unknown"
echo "Submodules:" >> "$WORKDIR"/VERSION
git submodule status >> "$WORKDIR"/VERSION
echo "Git remotes:" >> "$WORKDIR"/VERSION
git remote -v | grep origin || true >> "$WORKDIR"/VERSION
popd

declare -r ZIP_NAME="mergesat${GIT_VERSION}.zip"

# remove git history, as it will be large, and other files
pushd "$CODE_DIR"
rm -rf mergesat/.git
rm -f "$ZIP_NAME"
rm -rf binary/*
rm -rf doc/description
popd

# zip to overall package
pushd "$WORKDIR"
zip -r -y -9 "$ZIP_NAME" *

# copy archive back to workdir
cp "$ZIP_NAME" "$START_DIR"

# leave work directory
popd