owntone: trying partial librar scan PR branch #2

Merged
ben merged 2 commits from b/builds:main into main 2023-06-23 14:55:52 +00:00
7 changed files with 104 additions and 32 deletions

View File

@ -3,17 +3,41 @@
set -e set -e
usage() { usage() {
echo "$0 <project>" echo "$0 <project> [--docker-push]"
exit 1 exit 1
} }
if [ "$1" = "" ]; then if [[ "$1" = "" ]]; then
usage usage
else else
PROJECT=$1 PROJECT=$1
PROJECT_PIPELINE=./${PROJECT}/.pipeline PROJECT_PIPELINE=./${PROJECT}/.pipeline
shift shift
if [[ "$1" == "--docker-push" && -f "${PROJECT_PIPELINE}/docker-push.sh" ]]; then
DOCKER_PUSH="true"
else
DOCKER_PUSH="false"
fi fi
fi
if [[ -f "${PROJECT_PIPELINE}/build.sh" && "${PROJECT}" == "owntone" ]]; then
(
set -e
cd ./$PROJECT
. .pipeline/build.sh
echo "[build.sh] executed '${PROJECT_PIPELINE}/build.sh' and exited with '$?'"
echo
if [[ "${DOCKER_PUSH}" == "true" ]]; then
. .pipeline/docker-push.sh
echo "[build.sh] executed '${PROJECT_PIPELINE}/docker-push.sh' and exited with '$?'"
echo
fi
)
exit 0
fi
for f in ${PROJECT_PIPELINE}/*.env; do for f in ${PROJECT_PIPELINE}/*.env; do
echo "sourcing: $f" echo "sourcing: $f"
@ -22,12 +46,12 @@ for f in ${PROJECT_PIPELINE}/*.env; do
done done
echo && echo echo && echo
if [ "${DOCKER_REPO}" = "" ]; then if [[ "${DOCKER_REPO}" = "" ]]; then
# default if not explicitly set in project # default if not explicitly set in project
DOCKER_REPO="git.sudo.is/ben" DOCKER_REPO="git.sudo.is/ben"
fi fi
if [ -f "${PROJECT_PIPELINE}/init-git.sh" ]; then if [[ -f "${PROJECT_PIPELINE}/init-git.sh" ]]; then
echo "running 'init-git.sh' for ${PROJECT}" echo "running 'init-git.sh' for ${PROJECT}"
( (
set -e set -e
@ -42,24 +66,24 @@ echo && echo
echo "cleaning up ${PROJECT}/dist" echo "cleaning up ${PROJECT}/dist"
mkdir -pv ./${PROJECT}/dist mkdir -pv ./${PROJECT}/dist
if [ -d ./${PROJECT}/dist/target ]; then if [[ -d ./${PROJECT}/dist/target ]]; then
echo "removing directory '${PROJECT}/dist/target'" echo "removing directory '${PROJECT}/dist/target'"
rm -r ${PROJECT}/dist/target rm -r ${PROJECT}/dist/target
fi fi
if [ -f "./${PROJECT}/dist/*.tar.gz" ]; then if [[ -f "./${PROJECT}/dist/*.tar.gz" ]]; then
rm -v ./${PROJECT}/dist/*.tar.gz rm -v ./${PROJECT}/dist/*.tar.gz
fi fi
if [ -f "./${PROJECT}/dist/*.tar.gz2" ]; then if [[ -f "./${PROJECT}/dist/*.tar.gz2" ]]; then
rm -v ./${PROJECT}/dist/*.tar.gz2 rm -v ./${PROJECT}/dist/*.tar.gz2
fi fi
if [ -f "./${PROJECT}/dist/*.deb" ]; then if [[ -f "./${PROJECT}/dist/*.deb" ]]; then
rm -v ./${PROJECT}/dist/*.deb rm -v ./${PROJECT}/dist/*.deb
fi fi
echo && echo echo && echo
BUILD_ARGS_FILE="${PROJECT_PIPELINE}/docker-build-args" BUILD_ARGS_FILE="${PROJECT_PIPELINE}/docker-build-args"
if [ -f "$BUILD_ARGS_FILE" ]; then if [[ -f "$BUILD_ARGS_FILE" ]]; then
echo "found docker-build-args file" echo "found docker-build-args file"
cat $BUILD_ARGS_FILE cat $BUILD_ARGS_FILE

View File

@ -12,8 +12,8 @@ fi
. ./.pipeline/init-git.sh . ./.pipeline/init-git.sh
mkdir -pv ./dist/ mkdir -pv ./dist/
rm -rv ./dist/dark-reader || true
rm -rv ./dist/target || true rm -rv ./dist/target || true
rm -v ./dist/*.tar.gz || true rm -v ./dist/*.tar.gz || true
rm -v ./dist/*.deb || true rm -v ./dist/*.deb || true
@ -26,23 +26,36 @@ rm -v ./dist/*.deb || true
# create the .patch file with (dont include the huge css file): # create the .patch file with (dont include the huge css file):
# git diff --patch > ../dark-reader-css.patch # git diff --patch > ../dark-reader-css.patch
# chdir into the git tree to apply the patch # # chdir into the git tree to apply the patch
( # (
# copy into the git tree and apply the patch # # copy into the git tree and apply the patch
cd owntone-server/ # cd owntone-server/
git apply ../dark-reader-css.patch # git apply ../dark-reader-css.patch
) # )
# then copy the css file # # then copy the css file
cp dark-reader.css owntone-server/htdocs/assets # cp dark-reader.css owntone-server/htdocs/assets
git --no-pager diff --color=always # git --no-pager diff --color=always
cp ../ # cp ../
docker build --pull --build-arg "VITE_OWNTONE_URL=$VITE_OWNTONE_URL" --target builder -t owntone:latest-builder . docker build --pull --build-arg "VITE_OWNTONE_URL=$VITE_OWNTONE_URL" --target builder -t owntone:latest-builder .
docker run -u $(id -u) --name owntone-build --rm -it -v $(pwd)/dist/:/mnt/dist/ owntone:latest-builder cp -r /usr/local/src/dist/. /mnt/dist/ docker run -u $(id -u) --name owntone-build --rm -it -v $(pwd)/dist/:/mnt/dist/ owntone:latest-builder cp -r /usr/local/src/dist/. /mnt/dist/
docker build --pull --build-arg "VITE_OWNTONE_URL=$VITE_OWNTONE_URL" -t ${DOCKER_REPO}/owntone:latest . docker build --pull --build-arg "VITE_OWNTONE_URL=$VITE_OWNTONE_URL" -t ${DOCKER_REPO}/owntone:${OWNTONE_DOCKER_TAG} .
echo "$VITE_OWNTONE_URL" if [[ -d "./dist/dark-reader/" && -f "./dist/dark-reader/index.html" ]]; then
echo
echo
(
set -x
diff --color=always ./dist/dark-reader/index.html ./dist/dark-reader/index.html.orig
) || true
echo
echo
fi
echo "VITE_OWNTONE_URL=\"${VITE_OWNTONE_URL}\""
echo "[owntone/.pipeline/build.sh] done"
echo "----------------------------"

View File

@ -4,5 +4,4 @@ set -e
source ./.pipeline/owntone.env source ./.pipeline/owntone.env
docker push ${DOCKER_REPO}/owntone:latest docker push ${DOCKER_REPO}/owntone:${OWNTONE_DOCKER_TAG}

View File

@ -1,22 +1,24 @@
#!/bin/bash #!/bin/bash
if [ -d "./${OWNTONE_SRC_REPO_NAME}/.git" ]; then if [[ -d "./${OWNTONE_SRC_REPO_NAME}/.git" ]]; then
echo "clone of the ${OWNTONE_SRC_REPO_NAME} repo exists, updating branch '${OWNTONE_SRC_REPO_BRANCH}'." echo "clone of the ${OWNTONE_SRC_REPO_NAME} repo exists, updating branch '${OWNTONE_SRC_REPO_BRANCH}'."
( (
cd ${OWNTONE_SRC_REPO_NAME}/ cd ${OWNTONE_SRC_REPO_NAME}/
git checkout ${OWNTONE_SRC_REPO_BRANCH}
git checkout . git checkout .
git clean -fd git clean -fd
git remote rm origin git remote rm origin
git remote add origin ${OWNTONE_SRC_REPO_ORIGIN} git remote add origin ${OWNTONE_SRC_REPO_ORIGIN}
git pull origin ${OWNTONE_SRC_REPO_BRANCH} git pull origin ${OWNTONE_SRC_REPO_BRANCH}
git checkout ${OWNTONE_SRC_REPO_BRANCH} git checkout ${OWNTONE_SRC_REPO_BRANCH}
) )
else else
echo "clone of the ${OWNTONE_SRC_REPO_NAME} does not exist, cloning ${OWNTONE_SRC_REPO_ORIGIN}" echo "clone of the ${OWNTONE_SRC_REPO_NAME} does not exist, cloning ${OWNTONE_SRC_REPO_ORIGIN}"
git clone ${OWNTONE_SRC_REPO_ORIGIN} git clone ${OWNTONE_SRC_REPO_ORIGIN}
fi fi
if [ -d "./${OWNTONE_APT_REPO_NAME}/.git" ]; then if [[ -d "./${OWNTONE_APT_REPO_NAME}/.git" ]]; then
echo "clone of the ${OWNTONE_APT_REPO_NAME} repo exists, updating branch '${OWNTONE_APT_REPO_BRANCH}'." echo "clone of the ${OWNTONE_APT_REPO_NAME} repo exists, updating branch '${OWNTONE_APT_REPO_BRANCH}'."
( (
cd ${OWNTONE_APT_REPO_NAME}/ cd ${OWNTONE_APT_REPO_NAME}/
@ -33,3 +35,24 @@ else
fi fi
echo "pulling and rebasing the branch for the partial filescans PR: https://github.com/owntone/owntone-server/pull/1179"
(
set -e
cd ${OWNTONE_SRC_REPO_NAME}/
git checkout ${OWNTONE_SRC_REPO_BRANCH}
# cleanup and return to the main branch
git branch -D file-scan-dir-path || true
git remote rm whatdoineed2d || true
# add the repo with the PR branch
git remote add whatdoineed2d https://github.com/whatdoineed2do/forked-daapd
git fetch whatdoineed2d
#git rebase file-scan-dir-path
# check out the PR branch and rebase the main branch onto it (works now at least)
git checkout file-scan-dir-path
git rebase ${OWNTONE_SRC_REPO_BRANCH}
)

View File

@ -7,3 +7,5 @@ export OWNTONE_APT_REPO_NAME="owntone-apt"
export OWNTONE_APT_REPO_BRANCH="master" export OWNTONE_APT_REPO_BRANCH="master"
export DOCKER_REPO=git.sudo.is/ben export DOCKER_REPO=git.sudo.is/ben
export OWNTONE_DOCKER_TAG="file-scan-dir-path"

View File

@ -1,18 +1,31 @@
#!/bin/bash #!/bin/bash
set -e set -e
set -x
# copy dark-reader.css file from dark-reader (firefox extension), and # copy dark-reader.css file from dark-reader (firefox extension), and
# the modified index.html. both were placed in # the modified index.html. both were placed in
# /usr/local/src/dark-reader during the 'docker build`, and copy them # /usr/local/src/dark-reader during the 'docker build`, and copy them
# inside of the owntone build before we package it up # inside of the owntone build before we package it up
# save the diff of the index.html file in the dist/dark-reader dir for later inspection
mkdir -p ${DISTDIR}dark-reader/
ls -l ${DISTDIR}dark-reader/
# touch ${DISTDIR}dark-reader/diff-index-html.txt
# diff /usr/local/src/dark-reader/index.html ${DISTDIR}target/usr/share/owntone/htdocs/index.html >> ${DISTDIR}dark-reader/
# and save both the dark-reader findex.html file as it is included int he build, and the original index.html
cp ${DISTDIR}target/usr/share/owntone/htdocs/index.html ${DISTDIR}dark-reader/index.html.orig
cp /usr/local/src/dark-reader/index.html ${DISTDIR}dark-reader/
# copy the files into the build
cp -v /usr/local/src/dark-reader/dark-reader-full.css ${DISTDIR}/target/usr/share/owntone/htdocs/assets/dark-reader-full.css cp -v /usr/local/src/dark-reader/dark-reader-full.css ${DISTDIR}/target/usr/share/owntone/htdocs/assets/dark-reader-full.css
cp -v /usr/local/src/dark-reader/index.html ${DISTDIR}/target/usr/share/owntone/htdocs/index.html cp -v /usr/local/src/dark-reader/index.html ${DISTDIR}/target/usr/share/owntone/htdocs/index.html
echo "cat index.html" # save ls output of the htdocs/assets dir
ls -l ${DISTDIR}/target/usr/share/owntone/htdocs/assets/ > ${DISTDIR}/dark-reader/ls-htdocs-assets.txt
cat ${DISTDIR}/target/usr/share/owntone/htdocs/index.html ls -l ${DISTDIR}/target/usr/share/owntone/htdocs/assets/dark-reader-full.css > ${DISTDIR}/dark-reader/ls-htdocs-assets-dark-reader-full.css.txt
tar -C ${DISTDIR}/target/ -czf ${DISTDIR}/owntone.tar.gz ${DISTDIR}/target/ tar -C ${DISTDIR}/target/ -czf ${DISTDIR}/owntone.tar.gz ${DISTDIR}/target/

View File

@ -18,9 +18,7 @@
<title>OwnTone</title> <title>OwnTone</title>
<script type="module" crossorigin src="/assets/index.js"></script> <script type="module" crossorigin src="/assets/index.js"></script>
<link rel="stylesheet" href="/assets/index.css"> <link rel="stylesheet" href="/assets/index.css">
<!--
<link rel="stylesheet" href="/assets/dark-reader-full.css"> <link rel="stylesheet" href="/assets/dark-reader-full.css">
-->
</head> </head>
<body> <body>
<div id="app"></div> <div id="app"></div>