mirror of
https://github.com/YunoHost/vinaigrette.git
synced 2024-09-03 20:06:11 +02:00
Clean architecture
This commit is contained in:
parent
6b0e32f88e
commit
34f056559b
17 changed files with 28 additions and 176 deletions
4
.gitignore
vendored
4
.gitignore
vendored
|
@ -1,2 +1,2 @@
|
||||||
pbuilder/images/*
|
images/*
|
||||||
keys/*
|
config/keys/*
|
||||||
|
|
|
@ -9,7 +9,7 @@ CODENAME=
|
||||||
DISTRIBUTION=
|
DISTRIBUTION=
|
||||||
|
|
||||||
# Global and environment variables
|
# Global and environment variables
|
||||||
source /home/vinaigrette/config
|
source /home/vinaigrette/config/config
|
||||||
export DEBSIGN_KEYID
|
export DEBSIGN_KEYID
|
||||||
export DEBFULLNAME
|
export DEBFULLNAME
|
||||||
export DEBEMAIL
|
export DEBEMAIL
|
||||||
|
|
|
@ -21,7 +21,7 @@ DEFAULT_ARCH="amd64"
|
||||||
# Folders...
|
# Folders...
|
||||||
|
|
||||||
HOME_VINAIGRETTE="/home/vinaigrette"
|
HOME_VINAIGRETTE="/home/vinaigrette"
|
||||||
GIT_REPOS="$HOME_VINAIGRETTE/repos/"
|
GIT_REPOS="$HOME_VINAIGRETTE/gitrepos/"
|
||||||
BUILD_DEB="$HOME_VINAIGRETTE/build_deb"
|
BUILD_DEB="$HOME_VINAIGRETTE/build_deb"
|
||||||
|
|
||||||
PBUILDER_HOME="$HOME_VINAIGRETTE/pbuilder/"
|
PBUILDER_HOME="$HOME_VINAIGRETTE/pbuilder/"
|
151
daily_build
151
daily_build
|
@ -1,151 +0,0 @@
|
||||||
#!/bin/bash
|
|
||||||
|
|
||||||
# Global and environment variables
|
|
||||||
source /home/vinaigrette/config
|
|
||||||
export DEBSIGN_KEYID
|
|
||||||
export DEBFULLNAME
|
|
||||||
export DEBEMAIL
|
|
||||||
|
|
||||||
# Default options values
|
|
||||||
## Either building source in a chroot env or not
|
|
||||||
BUILD_SRC_LOCALLY=false
|
|
||||||
## Either force package build if there is no update or not
|
|
||||||
FORCE=false
|
|
||||||
## Final version of the package
|
|
||||||
VERSION="$(date +%Y.%m.%d)+$(date +%H%M)"
|
|
||||||
## Repository branch to checkout
|
|
||||||
BRANCH=unstable
|
|
||||||
|
|
||||||
# Global and environment variables
|
|
||||||
DISTRIBUTION="unstable"
|
|
||||||
CODENAME="jessie"
|
|
||||||
|
|
||||||
|
|
||||||
usage()
|
|
||||||
{
|
|
||||||
cat << EOF
|
|
||||||
Usage: `basename $0` [options]
|
|
||||||
|
|
||||||
OPTIONS:
|
|
||||||
-p PACKAGE Package name to build
|
|
||||||
-v VERSION Package version to set (default: $VERSION)
|
|
||||||
-b BRANCH Branch to use (default: $BRANCH)
|
|
||||||
-f Force package building
|
|
||||||
-l Build sources locally
|
|
||||||
-h Print this help
|
|
||||||
EOF
|
|
||||||
exit
|
|
||||||
}
|
|
||||||
|
|
||||||
# Parse options
|
|
||||||
while getopts ":fhlb:v:p:" option; do
|
|
||||||
case $option in
|
|
||||||
f)
|
|
||||||
FORCE=true
|
|
||||||
;;
|
|
||||||
l)
|
|
||||||
BUILD_SRC_LOCALLY=true
|
|
||||||
;;
|
|
||||||
v)
|
|
||||||
VERSION=$OPTARG
|
|
||||||
;;
|
|
||||||
b)
|
|
||||||
BRANCH=$OPTARG
|
|
||||||
;;
|
|
||||||
p)
|
|
||||||
REQUIRED_PACKAGE=$OPTARG
|
|
||||||
;;
|
|
||||||
h)
|
|
||||||
usage
|
|
||||||
;;
|
|
||||||
:)
|
|
||||||
echo "Option -$OPTARG requires an argument"
|
|
||||||
exit 1
|
|
||||||
;;
|
|
||||||
\?)
|
|
||||||
echo "-$OPTARG: invalid option"
|
|
||||||
exit 1
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
done
|
|
||||||
|
|
||||||
cd $DAILY_PACKAGES
|
|
||||||
|
|
||||||
# Find packages to build
|
|
||||||
if [ -n "$REQUIRED_PACKAGE" ]; then
|
|
||||||
NEW_PACKAGES=$REQUIRED_PACKAGE
|
|
||||||
else
|
|
||||||
NEW_PACKAGES=$(find . -maxdepth 1 -mindepth 1 -type d | cut -d '/' -f2 | grep -v SSOwat | sort)
|
|
||||||
if [ ! -n "$NEW_PACKAGES" ]; then
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
PKG_TO_BUILD=0
|
|
||||||
|
|
||||||
for package in $NEW_PACKAGES; do
|
|
||||||
cd $DAILY_PACKAGES/$package
|
|
||||||
|
|
||||||
echo "---------------------------------------------"
|
|
||||||
echo "Selected package: ${package}"
|
|
||||||
|
|
||||||
# Fetch and update package from origin
|
|
||||||
echo "Looking for changes from git..."
|
|
||||||
git fetch origin
|
|
||||||
git checkout $BRANCH
|
|
||||||
if ! $FORCE && [ -z "$(git log $BRANCH..origin/$BRANCH)" ]; then
|
|
||||||
echo "Local sources already up-to-date"
|
|
||||||
continue
|
|
||||||
fi
|
|
||||||
git pull origin $BRANCH
|
|
||||||
|
|
||||||
echo "Updating changelog to version ${VERSION}"
|
|
||||||
rm -f debian/changelog.dch
|
|
||||||
cp debian/changelog debian/changelog.old
|
|
||||||
dch --package $package -v "${VERSION}" -D ${DISTRIBUTION} --force-distribution "Daily build." -b > /dev/null 2>&1
|
|
||||||
|
|
||||||
changes_file=${DAILY_PACKAGES}/${package}_${VERSION}_source.changes
|
|
||||||
|
|
||||||
echo "Building source package of ${package}_${VERSION}..."
|
|
||||||
if $BUILD_SRC_LOCALLY; then
|
|
||||||
debuild -S -sa > /dev/null
|
|
||||||
else
|
|
||||||
sudo pbuilder execute --bindmounts ${DAILY_PACKAGES} --basetgz /var/cache/pbuilder/images/amd64/${CODENAME}.tgz -- /usr/local/bin/pbuilder/build-sources ${DAILY_PACKAGES}/${package}
|
|
||||||
fi
|
|
||||||
if [ $? -ne 0 ] || [ ! -f ${changes_file} ]; then
|
|
||||||
echo "An error occured while building source package ${package}"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo "Adding ${package}_${VERSION} to ${CODENAME}/${DISTRIBUTION}..."
|
|
||||||
# /usr/local/bin/repo/move-to-incoming "../${package}_${VERSION}_source.changes"
|
|
||||||
/usr/local/bin/repo/include-changes $CODENAME $DISTRIBUTION $changes_file
|
|
||||||
RET=$?
|
|
||||||
|
|
||||||
# Do not save in changelog
|
|
||||||
cp debian/changelog.old debian/changelog
|
|
||||||
rm debian/changelog.old
|
|
||||||
|
|
||||||
if [ $RET -ne 0 ]; then
|
|
||||||
echo "An error occured while building source package ${package}"
|
|
||||||
else
|
|
||||||
PKG_TO_BUILD+=1
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
|
|
||||||
if [ $PKG_TO_BUILD -eq 0 ]; then
|
|
||||||
echo "Nothing to build"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
#echo "Process incoming in repository..."
|
|
||||||
#sudo reprepro -C $DISTRIBUTION -V -b $REPO_DIR processincoming yunohost
|
|
||||||
#if [ $? -ne 0 ]; then
|
|
||||||
# echo "An error occured while processing incoming"
|
|
||||||
# exit 1
|
|
||||||
#fi
|
|
||||||
|
|
||||||
#echo "Update packages local database..."
|
|
||||||
#sudo apt-get update > /dev/null 1>&1
|
|
||||||
|
|
||||||
echo "Build will start soon. See http://rebuild.yunohost.org"
|
|
29
init.sh
Normal file → Executable file
29
init.sh
Normal file → Executable file
|
@ -1,12 +1,15 @@
|
||||||
|
|
||||||
apt-get install nginx pbuilder reprepro rebuildd gawk -y
|
apt-get install nginx pbuilder reprepro rebuildd gawk -y
|
||||||
|
|
||||||
cd /home/vinaigrette/
|
VINAIGRETTE_HOME="/home/vinaigrette"
|
||||||
source config
|
|
||||||
gpg --import keys/$DEBSIGN_KEYID.key
|
|
||||||
gpg --import keys/$DEBSIGN_KEYID.pub
|
|
||||||
|
|
||||||
cd repos/
|
cd $VINAIGRETTE_HOME
|
||||||
|
source config/config
|
||||||
|
|
||||||
|
gpg --import config/keys/$DEBSIGN_KEYID.key
|
||||||
|
gpg --import config/keys/$DEBSIGN_KEYID.pub
|
||||||
|
|
||||||
|
cd gitrepos/
|
||||||
git clone https://github.com/yunohost/yunohost
|
git clone https://github.com/yunohost/yunohost
|
||||||
git clone https://github.com/yunohost/yunohost-admin
|
git clone https://github.com/yunohost/yunohost-admin
|
||||||
git clone https://github.com/yunohost/ssowat
|
git clone https://github.com/yunohost/ssowat
|
||||||
|
@ -14,20 +17,20 @@ git clone https://github.com/yunohost/moulinette
|
||||||
|
|
||||||
mkdir -p /var/www/repo/debian/conf/
|
mkdir -p /var/www/repo/debian/conf/
|
||||||
|
|
||||||
cd /home/vinaigrette/
|
cd $VINAIGRETTE_HOME/
|
||||||
cp distributions /var/www/repo/debian/conf/
|
cp config/distributions /var/www/repo/debian/conf/
|
||||||
|
|
||||||
cp /home/vinaigrette/rebuildd/rebuildd.conf /etc/rebuildd/rebuilddrc
|
cp $VINAIGRETTE_HOME/rebuildd/rebuildd.conf /etc/rebuildd/rebuilddrc
|
||||||
|
|
||||||
cat keys/$DEBSIGN_KEYID.pub | apt-key add
|
cat $VINAIGRETTE_HOME/config/keys/$DEBSIGN_KEYID.pub | apt-key add
|
||||||
cat /home/vinaigrette/sources.list >> /etc/apt/sources.list
|
cat $VINAIGRETTE_HOME/config/sources.list >> /etc/apt/sources.list
|
||||||
|
|
||||||
ln -s /home/vinaigrette/pbuilder/images /var/cache/pbuilder/images
|
ln -s $VINAIGRETTE_HOME/pbuilder/images /var/cache/pbuilder/images
|
||||||
ln -s /var/cache/pbuilder/result /home/vinaigrette/pbuilder/result
|
ln -s /var/cache/pbuilder/result $VINAIGRETTE_HOME/pbuilder/result
|
||||||
|
|
||||||
|
|
||||||
echo "127.0.0.1 $REPO_URL" >> /etc/hosts
|
echo "127.0.0.1 $REPO_URL" >> /etc/hosts
|
||||||
cp /home/vinaigrette/nginx/repo.conf /etc/nginx/sites-enabled/repo.conf
|
cp $VINAIGRETTE_HOME/conf/nginx.conf /etc/nginx/sites-enabled/repo.conf
|
||||||
service nginx reload
|
service nginx reload
|
||||||
|
|
||||||
rebuildd init
|
rebuildd init
|
||||||
|
|
|
@ -5,7 +5,7 @@ package=$2
|
||||||
version=$3
|
version=$3
|
||||||
arch=$4
|
arch=$4
|
||||||
|
|
||||||
source /home/vinaigrette/config
|
source /home/vinaigrette/config/config
|
||||||
source /home/vinaigrette/package_helpers.sh
|
source /home/vinaigrette/package_helpers.sh
|
||||||
|
|
||||||
# Build only binary-only limited to architecture dependent packages
|
# Build only binary-only limited to architecture dependent packages
|
||||||
|
@ -34,12 +34,12 @@ echo "Starting building..."
|
||||||
# Format needed pbuilder arguments
|
# Format needed pbuilder arguments
|
||||||
DEBBUILDOPTS="$DEBBUILDOPTS -j$JOBS"
|
DEBBUILDOPTS="$DEBBUILDOPTS -j$JOBS"
|
||||||
DSC_FILE="${package}_${version}.dsc"
|
DSC_FILE="${package}_${version}.dsc"
|
||||||
BASE_TGZ="/var/cache/pbuilder/images/${arch}/${codename}.tgz"
|
BASE_TGZ="${PBUILDER_IMAGES}/${arch}/${codename}.tgz"
|
||||||
EXTRA_OPTS=()
|
EXTRA_OPTS=()
|
||||||
|
|
||||||
# Use specific conf for nodejs builds
|
# Use specific conf for nodejs builds
|
||||||
if [[ $package =~ ^yunohost-admin$ ]]; then
|
if [[ $package =~ ^yunohost-admin$ ]]; then
|
||||||
base_tgz="/var/cache/pbuilder/images/${arch}/${codename}-nodejs.tgz"
|
base_tgz="${PBUILDER_IMAGES}/${arch}/${codename}-nodejs.tgz"
|
||||||
if [[ -f ${base_tgz} ]]; then
|
if [[ -f ${base_tgz} ]]; then
|
||||||
echo "+ using nodejs environment..."
|
echo "+ using nodejs environment..."
|
||||||
BASE_TGZ=${base_tgz}
|
BASE_TGZ=${base_tgz}
|
||||||
|
|
|
@ -6,7 +6,7 @@ version=$3
|
||||||
arch=$4
|
arch=$4
|
||||||
job=$5
|
job=$5
|
||||||
|
|
||||||
source /home/vinaigrette/config
|
source /home/vinaigrette/config/config
|
||||||
source /home/vinaigrette/package_helpers.sh
|
source /home/vinaigrette/package_helpers.sh
|
||||||
XMPP_BOT_KEY=$(cat /home/vinaigrette/keys/xmppbotkey)
|
XMPP_BOT_KEY=$(cat /home/vinaigrette/keys/xmppbotkey)
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,7 @@ codename=$1
|
||||||
distribution=$2
|
distribution=$2
|
||||||
changes_file=$3
|
changes_file=$3
|
||||||
|
|
||||||
source /home/vinaigrette/config
|
source /home/vinaigrette/config/config
|
||||||
source /home/vinaigrette/package_helpers.sh
|
source /home/vinaigrette/package_helpers.sh
|
||||||
|
|
||||||
sudo reprepro -C $distribution -V -b $REPO_DIR include $codename $changes_file
|
sudo reprepro -C $distribution -V -b $REPO_DIR include $codename $changes_file
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
changes_file=$1
|
changes_file=$1
|
||||||
|
|
||||||
source /home/vinaigrette/config
|
source /home/vinaigrette/config/config
|
||||||
source /home/vinaigrette/package_helpers.sh
|
source /home/vinaigrette/package_helpers.sh
|
||||||
|
|
||||||
INCOMING_DIR=${REPO_DIR}/incoming
|
INCOMING_DIR=${REPO_DIR}/incoming
|
||||||
|
|
|
@ -6,7 +6,7 @@ package=$3
|
||||||
version=$4
|
version=$4
|
||||||
changes_file=$5
|
changes_file=$5
|
||||||
|
|
||||||
source /home/vinaigrette/config
|
source /home/vinaigrette/config/config
|
||||||
source /home/vinaigrette/package_helpers.sh
|
source /home/vinaigrette/package_helpers.sh
|
||||||
|
|
||||||
# Only care about packages being added
|
# Only care about packages being added
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
source /home/vinaigrette/config
|
source /home/vinaigrette/config/config
|
||||||
|
|
||||||
# ##### #
|
# ##### #
|
||||||
# Usage #
|
# Usage #
|
||||||
|
|
Loading…
Reference in a new issue