-
Notifications
You must be signed in to change notification settings - Fork 83
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
318 changed files
with
52,470 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
# FOSS-TOOLS | ||
|
||
FOSS-Tools Manager | ||
|
||
## Prerequisites | ||
|
||
- [docker](https://docs.docker.com/engine/install/) | ||
- python3 | ||
- python virtualenv | ||
|
||
- `pip3 install virtualenv` | ||
|
||
- Setup the venv: | ||
``` | ||
virtualenv -p python3 venv | ||
source venv/bin/activate | ||
pip3 install -r requirements.txt | ||
``` | ||
## Installation and Running | ||
- Using a recipe csv file | ||
``` | ||
python3 run.py recipe --csv recipe.csv | ||
``` | ||
- Buidling an individual image | ||
``` | ||
python3 run.py build openlane | ||
``` | ||
- Updating an individual image | ||
- Run: | ||
``` | ||
python3 run.py update open_pdks | ||
``` | ||
- You will be prompted with: | ||
``` | ||
A new commit for (open_pdks) is available: | ||
44c13e2256d5907090d6a2a62d9b9f8ddf23758d | ||
Would you like to update? (y/N) | ||
``` | ||
- Running foss-tools: | ||
``` | ||
docker run -it -p 80:80 foss-tools:alpha | ||
``` | ||
## Notes | ||
- Images are under images directory | ||
- Versions in recipe file overwrite the image version | ||
- The images are tagged `<name>:<version>` | ||
- The final image is called `foss-tools:<tag>`, so if you want to run | ||
multiple recipes modify the tag of `foss-tools` | ||
## Todo | ||
- Dependancies handling | ||
- Differentiate between git and non git based packages | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
virtualenv -p python3 venv | ||
source venv/bin/activate | ||
pip3 install -r requirements.txt | ||
python3 run.py recipe --csv recipe.csv | ||
|
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
#!/usr/bin/python3 | ||
|
||
import docker | ||
import time | ||
import logging | ||
|
||
|
||
class DockerBuilder(): | ||
def __init__(self): | ||
self.rm = True | ||
self.client = self.createClient() | ||
self.logger = logging.getLogger("DockerBuilder logger") | ||
self.configLogger() | ||
|
||
def createClient(self): | ||
client = docker.from_env() | ||
return client | ||
|
||
def configLogger(self): | ||
self.logger.setLevel(logging.INFO) | ||
handler = logging.StreamHandler() | ||
formatter = logging.Formatter( | ||
fmt='[%(levelname)s %(asctime)s] %(message)s', datefmt='%d-%b-%y %H:%M:%S' | ||
) | ||
handler.setFormatter(formatter) | ||
self.logger.addHandler(handler) | ||
|
||
def build(self, target): | ||
self.logger.info("Building %s", target.name) | ||
default_tag = target.name + ":" + "latest" | ||
version_tag = target.name + ":" + target.version | ||
build_status = False | ||
try: | ||
response = self.client.api.build( | ||
path=target.path, | ||
rm=self.rm, | ||
tag=version_tag, | ||
buildargs=target.args, | ||
decode=True | ||
) | ||
for line in response: | ||
self.printResponse(line, target.name) | ||
|
||
self.client.api.tag(version_tag, default_tag) | ||
build_status = True | ||
except docker.errors.APIError as e: | ||
self.logger.error(e) | ||
time.sleep(2) | ||
|
||
return build_status | ||
|
||
def printResponse(self, response, name): | ||
if 'stream' in response: | ||
for line in response['stream'].splitlines(): | ||
if (line != ''): | ||
if (line.rstrip() != '\n' and (line.rstrip() != '')): | ||
self.logger.info("[" + name + "] :: " + line.rstrip()) | ||
elif 'error' in response: | ||
raise docker.errors.APIError(response['error']) |
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,101 @@ | ||
#!/usr/bin/python3 | ||
|
||
import os | ||
import json | ||
import git | ||
import json | ||
|
||
|
||
class Image(): | ||
def __init__(self, name, path, args, json_file, meta_data): | ||
self.name = name | ||
self.path = path | ||
self.args = args | ||
self.url = self.args['REPO_URL'] | ||
self.json_file = json_file | ||
self.meta_data = meta_data | ||
self.version = self.args["REPO_COMMIT"] | ||
self.build_status = False | ||
|
||
|
||
@classmethod | ||
def createFromPath(cls, path): | ||
JSON_FILE = "info.json" | ||
json_file = os.path.join(path, JSON_FILE) | ||
|
||
return cls.createFromJSON(json_file) | ||
|
||
@classmethod | ||
def createFromJSON(cls, json_file): | ||
f = open(json_file) | ||
meta_data = json.load(f) | ||
f.close() | ||
|
||
args = meta_data['args'] | ||
name = args['NAME'] | ||
|
||
path = os.path.dirname(os.path.abspath(json_file)) | ||
|
||
return cls( | ||
name=name, | ||
path=path, | ||
args=args, | ||
json_file=json_file, | ||
meta_data=meta_data | ||
) | ||
|
||
|
||
def getLatestVersion(self): | ||
url = self.url | ||
g = git.cmd.Git() | ||
response = g.ls_remote(url, 'HEAD') | ||
latest_version = response.split()[0] | ||
|
||
return latest_version | ||
|
||
|
||
def updatePrompt(self, new_version): | ||
print("A new commit for (%s) is available:\n%s" % (self.name, new_version)) | ||
user_response = input("Would you like to update? (y/N) ").lower() | ||
|
||
if (user_response == 'y'): | ||
response = True | ||
else: | ||
response = False | ||
|
||
return response | ||
|
||
|
||
def update(self, updateFlag=False): | ||
current_version = self.version | ||
new_version = self.getLatestVersion() | ||
|
||
if (new_version != current_version): | ||
if (updateFlag == True): | ||
self.commitVersion(new_version) | ||
else: | ||
response = self.updatePrompt(new_version) | ||
if (response == True): | ||
self.commitVersion(new_version) | ||
print("New version commited!") | ||
else: | ||
print("Latest version for (%s) synced.\n" | ||
"Run install to install it.\n" | ||
"Nothing to be done." % self.name) | ||
|
||
|
||
def commitVersion(self, new_version): | ||
self.version = new_version | ||
|
||
self.meta_data['args']['REPO_COMMIT'] = new_version | ||
|
||
with open(self.json_file, 'w') as f: | ||
f.write(json.dumps(self.meta_data, indent=4)) | ||
|
||
|
||
|
||
def setVersion(self, version): | ||
old_version = self.version | ||
if (old_version != version): | ||
self.commitVersion(version) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
ARG BASE_IMAGE | ||
FROM ${BASE_IMAGE} as builder | ||
|
||
ADD scripts/dependencies.sh dependencies.sh | ||
RUN bash dependencies.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{ | ||
"args" : { | ||
"BASE_IMAGE" : "centos:centos7", | ||
"NAME": "base", | ||
"REPO_COMMIT": "alpha", | ||
"REPO_URL": "n/a" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
#!/bin/bash | ||
|
||
yum install -y https://repo.ius.io/ius-release-el7.rpm | ||
yum install centos-release-scl -y | ||
yum install -y \ | ||
autoconf \ | ||
automake \ | ||
bison \ | ||
boost169-devel \ | ||
boost169-static \ | ||
bzip2 \ | ||
cairo \ | ||
cairo-devel \ | ||
clang \ | ||
csh \ | ||
curl \ | ||
devtoolset-8 \ | ||
devtoolset-8-libatomic-devel \ | ||
flex \ | ||
gawk \ | ||
gcc \ | ||
gdb \ | ||
gettext \ | ||
gettext-devel \ | ||
git \ | ||
glibc-static \ | ||
graphviz \ | ||
help2man \ | ||
libSM \ | ||
libX11-devel \ | ||
libXext \ | ||
libXft \ | ||
libffi \ | ||
libffi-devel \ | ||
libgomp \ | ||
libjpeg \ | ||
libstdc++ \ | ||
libxml2-devel \ | ||
libxslt-devel \ | ||
make \ | ||
mesa-libGLU-devel \ | ||
ncurses-devel \ | ||
ninja-build \ | ||
patch \ | ||
pcre-devel \ | ||
python-devel \ | ||
python36u \ | ||
python36u-devel \ | ||
python36u-libs \ | ||
python36u-pip \ | ||
python36u-tkinter \ | ||
readline-devel \ | ||
rh-python35 \ | ||
strace \ | ||
spdlog-devel \ | ||
swig3 \ | ||
tcl \ | ||
tcl-devel \ | ||
tcllib \ | ||
tclx \ | ||
texinfo \ | ||
tk \ | ||
tk-devel \ | ||
vim-common \ | ||
wget \ | ||
which \ | ||
xdot \ | ||
Xvfb \ | ||
zlib-devel \ | ||
zlib-static | ||
|
||
alternatives --install /usr/bin/python3 python3 /usr/bin/python3.6 60 | ||
|
||
pip3.6 install --no-cache-dir --upgrade pip | ||
pip install --no-cache-dir \ | ||
matplotlib \ | ||
"jinja2<3.0.0" \ | ||
pandas \ | ||
install \ | ||
XlsxWriter |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
ARG BASE_IMAGE | ||
FROM ${BASE_IMAGE} as builder | ||
|
||
ARG REPO_URL | ||
ARG REPO_COMMIT | ||
ARG NAME | ||
|
||
ADD scripts/dependencies.sh dependencies.sh | ||
RUN bash dependencies.sh | ||
|
||
ADD scripts/install.sh install.sh | ||
RUN bash install.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{ | ||
"args" : { | ||
"BASE_IMAGE" : "base", | ||
"NAME": "covered", | ||
"REPO_URL": "https://github.com/Manarabdelaty/verilog-covered", | ||
"REPO_COMMIT": "93bee2e0d89c1beb5943a329109dcf24d59498e6" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
#!/bin/bash | ||
|
||
yum install -y gperf |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
#!/bin/bash | ||
|
||
source scl_source enable devtoolset-8 | ||
|
||
git clone ${REPO_URL} ${NAME} | ||
|
||
cd ${NAME} | ||
git checkout ${REPO_COMMIT} | ||
|
||
./configure --prefix=/foss/tools/${NAME}/${REPO_COMMIT} | ||
make -j$(nproc) | ||
make install | ||
|
Oops, something went wrong.