Merge pull request #679 from lrusak/cleanup

cleanup: clean build scripts to make more reproducible builds
This commit is contained in:
Christian Hewitt 2016-08-30 07:53:07 +04:00 committed by GitHub
commit 681d2ae59d
4 changed files with 13 additions and 105 deletions

View File

@ -60,11 +60,7 @@ setup_toolchain() {
}
kernel_path() {
if [ -e $HOME/.libreelec/projects/$PROJECT/packages/linux/package.mk ]; then
. $HOME/.libreelec/projects/$PROJECT/packages/linux/package.mk
elif [ -e $HOME/.libreelec/packages/linux/package.mk ]; then
. $HOME/.libreelec/packages/linux/package.mk
elif [ -e $ROOT/projects/$PROJECT/packages/linux/package.mk ]; then
if [ -e $ROOT/projects/$PROJECT/packages/linux/package.mk ]; then
. $ROOT/projects/$PROJECT/packages/linux/package.mk
else
. $ROOT/packages/linux/package.mk
@ -74,11 +70,7 @@ kernel_path() {
}
kernel_version() {
if [ -e $HOME/.libreelec/projects/$PROJECT/packages/linux/package.mk ]; then
. $HOME/.libreelec/projects/$PROJECT/packages/linux/package.mk
elif [ -e $HOME/.libreelec/packages/linux/package.mk ]; then
. $HOME/.libreelec/packages/linux/package.mk
elif [ -e $ROOT/projects/$PROJECT/packages/linux/package.mk ]; then
if [ -e $ROOT/projects/$PROJECT/packages/linux/package.mk ]; then
. $ROOT/projects/$PROJECT/packages/linux/package.mk
else
. $ROOT/packages/linux/package.mk
@ -95,23 +87,13 @@ get_module_dir() {
# get package's build dir
get_build_dir() {
if [ ! -z $1 ] ; then
local _PKG_DIR=$(find $HOME/.libreelec/projects/$PROJECT/packages -name $1 2>/dev/null)
local _PKG_DIR=$(find $ROOT/projects/$PROJECT/packages -name $1 2>/dev/null)
if [ -d "$_PKG_DIR" -a -f $_PKG_DIR/package.mk ] ; then
. $_PKG_DIR/package.mk
else
local _PKG_DIR=$(find $HOME/.libreelec/packages -name $1 2>/dev/null)
local _PKG_DIR=$(find $ROOT/packages -name $1 2>/dev/null)
if [ -d "$_PKG_DIR" -a -f $_PKG_DIR/package.mk ] ; then
. $_PKG_DIR/package.mk
else
local _PKG_DIR=$(find $ROOT/projects/$PROJECT/packages -name $1 2>/dev/null)
if [ -d "$_PKG_DIR" -a -f $_PKG_DIR/package.mk ] ; then
. $_PKG_DIR/package.mk
else
local _PKG_DIR=$(find $ROOT/packages -name $1 2>/dev/null)
if [ -d "$_PKG_DIR" -a -f $_PKG_DIR/package.mk ] ; then
. $_PKG_DIR/package.mk
fi
fi
fi
fi
@ -290,7 +272,7 @@ dashes="==========================="
exit 1
fi
if [ ! -f $PROJECT_DIR/$PROJECT/linux/linux.$TARGET_ARCH.conf -a ! -f $HOME/.libreelec/projects/$PROJECT/linux/linux.$TARGET_ARCH.conf ] &&
if [ ! -f $PROJECT_DIR/$PROJECT/linux/linux.$TARGET_ARCH.conf ] &&
! ls $PROJECT_DIR/$PROJECT/linux/*/linux.$TARGET_ARCH.conf &>/dev/null; then
check_arch="$check_arch\n $dashes$dashes$dashes"
check_arch="$check_arch\n ERROR: Architecture not found, use a valid Architecture"
@ -298,7 +280,7 @@ dashes="==========================="
check_arch="$check_arch\n $dashes$dashes$dashes"
check_arch="$check_arch\n\n Valid Architectures for your project: $PROJECT"
for arch in $PROJECT_DIR/$PROJECT/linux/*.conf $HOME/.libreelec/projects/$PROJECT/linux/*.conf $PROJECT_DIR/$PROJECT/linux/*/linux.$TARGET_ARCH.conf; do
for arch in $PROJECT_DIR/$PROJECT/linux/*.conf $PROJECT_DIR/$PROJECT/linux/*/linux.$TARGET_ARCH.conf; do
check_arch="$check_arch\n - $(basename $arch | cut -f2 -d".")"
done
echo -e $check_arch

View File

@ -79,40 +79,6 @@ SED="sed -i"
_FOUND=0
PKG_DIR=""
# check project folder for a package in home dir
for DIR in $(find $HOME/.libreelec/projects/$PROJECT/packages -type d -name $_PKG_ROOT_NAME 2>/dev/null); do
if [ -r "$DIR/package.mk" ]; then
# found first, set $PKG_DIR
PKG_DIR="$DIR"
# keep track of dirs with package.mk for detecting multiple folders
_ALL_DIRS="${_ALL_DIRS}${DIR}\\n"
_FOUND=$((_FOUND+1))
if [ $_FOUND -gt 1 ]; then
# _FOUND more ? fail
echo "Error - multiple package folders:"
echo -e "$_ALL_DIRS"
exit 1
fi
fi
done
# check for a package in home dir if not found already
for DIR in $(find $HOME/.libreelec/packages -type d -name $_PKG_ROOT_NAME 2>/dev/null); do
if [ -r "$DIR/package.mk" ]; then
# found first, set $PKG_DIR
PKG_DIR="$DIR"
# keep track of dirs with package.mk for detecting multiple folders
_ALL_DIRS="${_ALL_DIRS}${DIR}\\n"
_FOUND=$((_FOUND+1))
if [ $_FOUND -gt 1 ]; then
# _FOUND more ? fail
echo "Error - multiple package folders:"
echo -e "$_ALL_DIRS"
exit 1
fi
fi
done
# check project folder for a package if not found already
for DIR in $(find $ROOT/projects/$PROJECT/packages -type d -name $_PKG_ROOT_NAME 2>/dev/null); do
if [ -r "$DIR/package.mk" ]; then

View File

@ -203,28 +203,6 @@ if [ -d "$PROJECT_DIR/$PROJECT/filesystem" ]; then
done
fi
# copy vendor related files to filesystem
if [ -d "$HOME/.libreelec/filesystem" ]; then
cp -PR $HOME/.libreelec/filesystem/* $INSTALL
# install project specific systemd services
for service in $HOME/.libreelec/filesystem/usr/lib/systemd/system/*.service ; do
if [ -f "$service" ] ; then
enable_service $(basename $service)
fi
done
fi
# copy vendor project related files to filesystem
if [ -d "$HOME/.libreelec/projects/$PROJECT/filesystem" ]; then
cp -PR $HOME/.libreelec/projects/$PROJECT/filesystem/* $INSTALL
# install project specific systemd services
for service in $HOME/.libreelec/projects/$PROJECT/filesystem/usr/lib/systemd/system/*.service ; do
if [ -f "$service" ] ; then
enable_service $(basename $service)
fi
done
fi
# run depmod
MODVER=$(basename $(ls -d $INSTALL/lib/modules/*))
find $INSTALL/lib/modules/$MODVER/ -name *.ko | \
@ -274,20 +252,12 @@ if [ "$1" = "release" -o "$1" = "mkimage" -o "$1" = "amlpkg" -o "$1" = "noobs" ]
# create release dir
mkdir -p $RELEASE_DIR
# remove n previous created release image
rm -rf $TARGET_IMG/$IMAGE_NAME.img.gz
if [ -n "$BOOTLOADER" ]; then
BOOTLOADER_DIR=""
if [ -z "$BOOTLOADER_DIR" -a -d $HOME/.openelec/projects/$PROJECT/packages ]; then
BOOTLOADER_DIR=`find $HOME/.openelec/projects/$PROJECT/packages -type d -name $BOOTLOADER 2>/dev/null`
fi
if [ -z "$BOOTLOADER_DIR" -a -d $HOME/.openelec/packages ]; then
BOOTLOADER_DIR=`find $HOME/.openelec/packages -type d -name $BOOTLOADER 2>/dev/null`
fi
if [ -z "$BOOTLOADER_DIR" -a -d $PROJECT_DIR/$PROJECT/packages ]; then
BOOTLOADER_DIR=`find $PROJECT_DIR/$PROJECT/packages -type d -name $BOOTLOADER 2>/dev/null`
fi
@ -300,11 +270,7 @@ if [ "$1" = "release" -o "$1" = "mkimage" -o "$1" = "amlpkg" -o "$1" = "noobs" ]
cp -R $BOOTLOADER_DIR/files/* $RELEASE_DIR
fi
if [ -f $HOME/.openelec/projects/$PROJECT/bootloader/release ]; then
. $HOME/.openelec/projects/$PROJECT/bootloader/release
elif [ -f $HOME/.openelec/bootloader/release ]; then
. $HOME/.openelec/bootloader/release
elif [ -f $PROJECT_DIR/$PROJECT/bootloader/release ]; then
if [ -f $PROJECT_DIR/$PROJECT/bootloader/release ]; then
. $PROJECT_DIR/$PROJECT/bootloader/release
elif [ -f "$BOOTLOADER_DIR"/release ]; then
. $BOOTLOADER_DIR/release
@ -434,11 +400,11 @@ if [ "$1" = "release" -o "$1" = "mkimage" -o "$1" = "amlpkg" -o "$1" = "noobs" ]
# create the auto-install package
echo "Creating Amlogic ZIP auto-install package"
pushd sign > /dev/null
echo --update_package=/sdcard/$IMAGE_NAME-update.zip > factory_update_param.aml
echo --update_package=/sdcard/$IMAGE_NAME-update.zip > factory_update_param.aml
if [ -f "$INSTALL_SRC_DIR/files/recovery.img" ]; then
cp $INSTALL_SRC_DIR/files/recovery.img .
fi
if [ -f $INSTALL_SRC_DIR/files/aml_autoscript ]; then
cp $INSTALL_SRC_DIR/files/aml_autoscript .
fi
@ -449,10 +415,10 @@ if [ "$1" = "release" -o "$1" = "mkimage" -o "$1" = "amlpkg" -o "$1" = "noobs" ]
fi
zip -q $TARGET_IMG/$IMAGE_NAME.zip *
popd > /dev/null
popd > /dev/null
elif [ "$1" = "noobs" ]; then
RELEASE_DIR="$TARGET_IMG/${IMAGE_NAME}-$1"

View File

@ -121,9 +121,7 @@ for i in $PKG_DIR/patches/$PKG_NAME-*.patch \
$PKG_DIR/patches/$PKG_VERSION/*.patch \
$PKG_DIR/patches/$PKG_VERSION/$PATCH_ARCH/*.patch \
$PROJECT_DIR/$PROJECT/patches/$PKG_NAME/*.patch \
$PROJECT_DIR/$PROJECT/patches/$PKG_NAME/$PKG_VERSION/*.patch \
$HOME/.openelec/patches/$PKG_NAME/*.patch \
$HOME/.openelec/projects/$PROJECT/patches/$PKG_NAME/*.patch; do
$PROJECT_DIR/$PROJECT/patches/$PKG_NAME/$PKG_VERSION/*.patch; do
if [ $(dirname $i) = "$PKG_DIR/patches" ]; then
PATCH_DESC="(common)"
@ -135,10 +133,6 @@ for i in $PKG_DIR/patches/$PKG_NAME-*.patch \
PATCH_DESC="(project)"
elif [ $(dirname $i) = "$PROJECT_DIR/$PROJECT/patches/$PKG_NAME/$PKG_VERSION" ]; then
PATCH_DESC="(project - $PKG_VERSION)"
elif [ $(dirname $i) = "$HOME/.openelec/patches/$PKG_NAME" ]; then
PATCH_DESC="(vendor)"
elif [ $(dirname $i) = "$HOME/.openelec/projects/$PROJECT/patches/$PKG_NAME" ]; then
PATCH_DESC="(vendor - $PROJECT)"
fi
if [ -f "$i" ]; then