-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Match-id-31a2cf5de79e2257afa7f0702b4667c98ae79f1e
- Loading branch information
BianTanggui
committed
Jun 4, 2020
1 parent
df9e237
commit 771c1dc
Showing
5 changed files
with
158 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,119 @@ | ||
#!/bin/bash | ||
|
||
ROOT=$(cd `dirname $0`; pwd)/.. | ||
|
||
OPENSRC=${ROOT}/opensource | ||
OUTPUT=${ROOT}/output | ||
BUILD=${ROOT}/build | ||
|
||
CLIDIR=${ROOT}/cli | ||
CLISRCNAME="main.c" | ||
|
||
INSTALLHELPERDIR=${ROOT}/install | ||
INSTALLHELPERSRCNAME="main.c" | ||
|
||
HOOKDIR=${ROOT}/hook | ||
HOOKSRCNAME="main.go" | ||
|
||
RUNTIMEDIR=${ROOT}/runtime | ||
RUNTIMESRCNAME="main.go" | ||
|
||
DEBPACK=${ROOT}/debpack | ||
BINDIR=${DEBPACK}/usr/local/bin | ||
DEBDIR=${DEBPACK}/DEBIAN | ||
|
||
RPMPACK=${ROOT}/rpmpack | ||
RPMSOURCESDIR=${RPMPACK}/SOURCES | ||
RPMSPECDIR=${RPMPACK}/SPECS | ||
|
||
|
||
CLISRCPATH=`find ${CLIDIR} -name "${CLISRCNAME}"` | ||
CLISRCDIR=${CLISRCPATH%/${CLISRCNAME}} | ||
INSTALLHELPERSRCPATH=`find ${INSTALLHELPERDIR} -name "${INSTALLHELPERSRCNAME}"` | ||
INSTALLHELPERSRCDIR=${INSTALLHELPERSRCPATH%/${INSTALLHELPERSRCNAME}} | ||
HOOKSRCPATH=`find ${HOOKDIR} -name "${HOOKSRCNAME}"` | ||
HOOKSRCDIR=${HOOKSRCPATH%/${HOOKSRCNAME}} | ||
RUNTIMESRCPATH=`find ${RUNTIMEDIR} -name "${RUNTIMESRCNAME}"` | ||
RUNTIMESRCDIR=${RUNTIMESRCPATH%/${RUNTIMESRCNAME}} | ||
|
||
funcbuild(){ | ||
echo "make cli" | ||
[ -d "${CLISRCDIR}/build" ]&&rm -rf ${CLISRCDIR}/build | ||
mkdir ${CLISRCDIR}/build&&cd ${CLISRCDIR}/build | ||
cmake ../ | ||
make clean | ||
make | ||
|
||
echo "make runtime" | ||
[ -d "${INSTALLHELPERSRCDIR}/build" ]&&rm -rf ${INSTALLHELPERSRCDIR}/build | ||
mkdir ${INSTALLHELPERSRCDIR}/build&&cd ${INSTALLHELPERSRCDIR}/build | ||
cmake ../ | ||
make clean | ||
make | ||
|
||
[ -d "${HOOKSRCDIR}/build" ]&&rm -rf ${HOOKSRCDIR}/build | ||
mkdir ${HOOKSRCDIR}/build&&cd ${HOOKSRCDIR}/build | ||
go build ../${HOOKSRCNAME} | ||
mv main ascend-docker-hook | ||
|
||
[ -d "${RUNTIMESRCDIR}/build" ]&&rm -rf ${RUNTIMESRCDIR}/build | ||
mkdir ${RUNTIMESRCDIR}/build&&cd ${RUNTIMESRCDIR}/build | ||
go build ../${RUNTIMESRCNAME} | ||
mv main ascend-docker-runtime | ||
} | ||
|
||
funcmakedeb(){ | ||
cd ${BUILD} | ||
mkdir -pv {${DEBDIR},${BINDIR}} | ||
/bin/cp -f {${RUNTIMESRCDIR},${HOOKSRCDIR},${INSTALLHELPERSRCDIR},${CLISRCDIR}}/build/ascend-docker* ${BINDIR} | ||
CONPATH=`find ${INSTALLHELPERDIR} -name "control"` | ||
INSTPATH=`find ${INSTALLHELPERDIR} -name "postinst"` | ||
/bin/cp -f ${CONPATH} ${INSTPATH} ${DEBDIR} | ||
echo ${INSTPATH} | ||
chmod 555 ${DEBDIR}/postinst | ||
dpkg-deb -b ${DEBPACK} ascenddockertool_1.0.0_i386.deb | ||
DEBS=`find ${BUILD} -name "*.deb"` | ||
/bin/cp ${DEBS} ${OUTPUT} | ||
} | ||
|
||
funcmakerpm(){ | ||
mkdir -pv ${RPMPACK}/{BUILD,BUILDROOT,RPMS,SOURCES,SPECS,SRPMS} | ||
/bin/cp -f {${RUNTIMESRCDIR},${HOOKSRCDIR},${INSTALLHELPERSRCDIR},${CLISRCDIR}}/build/ascend-docker* ${RPMSOURCESDIR} | ||
SPECPATH=`find ${INSTALLHELPERDIR} -name "*.spec"` | ||
dos2unix ${SPECPATH} | ||
/bin/cp -f ${SPECPATH} ${RPMSPECDIR} | ||
rpmbuild --define "_topdir ${RPMPACK}" | ||
rpmbuild --showrc | grep topdir | ||
echo ${RPMPACK} | ||
echo "%_topdir ${RPMPACK}" > ~/.rpmmacros | ||
rpmbuild -bb ${RPMPACK}/SPECS/ascend-docker-plgugin.spec | ||
RPMS=`find ${RPMPACK} -name "*.rpm"` | ||
/bin/cp ${RPMS} ${OUTPUT} | ||
} | ||
|
||
funcmakeclean(){ | ||
[ -d "${RPMPACK}" ]&&rm -rf ${RPMPACK} | ||
[ -d "${DEBPACK}" ]&&rm -rf ${DEBPACK} | ||
} | ||
|
||
funcmakepull(){ | ||
cd ${OPENSRC} | ||
wget -O cJSON.tar.gz https://github.com/DaveGamble/cJSON/archive/v1.7.13.tar.gz --no-check-certificate | ||
} | ||
|
||
funcmakeunzip(){ | ||
cd ${OPENSRC} | ||
tar -xzvf cJSON.tar.gz | ||
CJSONS=`find . -name "cJSON.*"` | ||
CJSONSLIB=`find ${INSTALLHELPERDIR} -name cjson -type d` | ||
/bin/cp -f ${CJSONS} ${CJSONSLIB} | ||
} | ||
|
||
funcmakeclean | ||
if [ $1 == "pull" ]; then | ||
funcmakepull | ||
fi | ||
funcmakeunzip | ||
funcbuild | ||
funcmakerpm | ||
funcmakedeb |
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,36 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<project> | ||
<artifact> | ||
<versionType>Component</versionType> | ||
<repoType>Generic</repoType> | ||
<id> | ||
<offering>Atlas Platform</offering> | ||
<componentName> ascend-docker-plugin</componentName> | ||
<componentVersion>1.0.0</componentVersion> | ||
</id> | ||
<isClear>N</isClear> | ||
<copies> | ||
<copy> | ||
<source>output/</source> | ||
<dest /> | ||
</copy> | ||
</copies> | ||
</artifact> | ||
<dependencies> | ||
<!-- 3rd-party --> | ||
<dependency> | ||
<versionType>3rd-party</versionType> | ||
<repoType>Generic</repoType> | ||
<id> | ||
<artifactName>cJSON-1.7.13.tar.gz</artifactName> | ||
<pdmCode>05834SXQ</pdmCode> | ||
</id> | ||
<copies> | ||
<copy> | ||
<source>/*</source> | ||
<dest>opensource</dest> | ||
</copy> | ||
</copies> | ||
</dependency> | ||
</dependencies> | ||
</project> |
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
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 @@ | ||
put 3rd-party dependency here |
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 @@ | ||
locate the output files |