|
|
|
@ -54,29 +54,9 @@ function recreate_folder()
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#----------------------------
|
|
|
|
|
# Set module related path variables
|
|
|
|
|
# Parameters:
|
|
|
|
|
# $1 - module name
|
|
|
|
|
function set_module_paths()
|
|
|
|
|
{
|
|
|
|
|
local LOC_MOD_NAME=$1
|
|
|
|
|
if [ "$bool_EXTRADEP_MOD" != "y" ]; then
|
|
|
|
|
# Standard module
|
|
|
|
|
MOD_GIT_PATH="$REPO_TDE_MAIN/$LOC_MOD_NAME"
|
|
|
|
|
MOD_GIT_PKGING_PATH="$REPO_TDE_PACKAGING/$LOC_MOD_NAME/debian"
|
|
|
|
|
else
|
|
|
|
|
# Extra dependency module
|
|
|
|
|
MOD_GIT_PATH="$REPO_DIR/$LOC_MOD_NAME"
|
|
|
|
|
fi
|
|
|
|
|
export MOD_BUILD_PATH="$TDE_BUILD_DIR/$LOC_MOD_NAME"
|
|
|
|
|
MOD_BUILD_PKGING_PATH="$MOD_BUILD_PATH/debian"
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#----------------------------
|
|
|
|
|
# Look for a module in the git repository or in the extra dependency folder.
|
|
|
|
|
# Set the new module name if found.
|
|
|
|
|
# Set the module name and paths if found.
|
|
|
|
|
# Parameters:
|
|
|
|
|
# $1 - module name
|
|
|
|
|
function search_module()
|
|
|
|
@ -85,6 +65,7 @@ function search_module()
|
|
|
|
|
IFS="*"
|
|
|
|
|
local LOC_MOD_NAME=$1
|
|
|
|
|
local LOC_MATCH
|
|
|
|
|
|
|
|
|
|
MODULE_FOUND="n"
|
|
|
|
|
|
|
|
|
|
# Search in GIT repository
|
|
|
|
@ -93,18 +74,23 @@ function search_module()
|
|
|
|
|
# Unique module found in GIT
|
|
|
|
|
MODULE_FOUND="y"
|
|
|
|
|
MOD_NAME=$LOC_MATCH
|
|
|
|
|
set_module_paths $MOD_NAME
|
|
|
|
|
MOD_GIT_PATH="$REPO_TDE_MAIN/$MOD_NAME"
|
|
|
|
|
MOD_GIT_PKGING_PATH="$REPO_TDE_PACKAGING/$MOD_NAME/debian"
|
|
|
|
|
MOD_BUILD_PATH="$TDE_BUILD_DIR/$MOD_NAME"
|
|
|
|
|
else
|
|
|
|
|
# Search in extra dependency folder
|
|
|
|
|
LOC_MATCH=`ls "$REPO_EXTRA_DEPENDENCIES" | grep "^$LOC_MOD_NAME$"`
|
|
|
|
|
LOC_BASENAME=`echo "$LOC_MOD_NAME" | sed -r "s|^${CFG_EXTRA_DEPS_DIR}/(debian/)?||"`
|
|
|
|
|
LOC_MATCH=`ls "$REPO_EXTRA_DEPENDENCIES/debian" | grep "^$LOC_BASENAME"`
|
|
|
|
|
if [ "$LOC_MATCH" != "" -a "`echo $LOC_MATCH | wc -l`" = "1" ]; then
|
|
|
|
|
# Unique module found in extra dependency folder
|
|
|
|
|
MODULE_FOUND="y"
|
|
|
|
|
bool_EXTRADEP_MOD="y"
|
|
|
|
|
MOD_NAME="$CFG_EXTRA_DEPS_DIR/$LOC_MATCH"
|
|
|
|
|
set_module_paths $MOD_NAME
|
|
|
|
|
MOD_GIT_PATH="$REPO_EXTRA_DEPENDENCIES/debian/$LOC_BASENAME"
|
|
|
|
|
MOD_BUILD_PATH="$TDE_BUILD_DIR/$CFG_EXTRA_DEPS_DIR/$LOC_BASENAME"
|
|
|
|
|
fi
|
|
|
|
|
fi
|
|
|
|
|
MOD_BUILD_PKGING_PATH="$MOD_BUILD_PATH/debian"
|
|
|
|
|
IFS=$OLDIFS
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -204,18 +190,16 @@ if [[ $MOD_NAME =~ ^$CFG_EXTRA_DEPS_DIR/ ]]; then
|
|
|
|
|
bool_EXTRADEP_MOD="y"
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
set_module_paths $MOD_NAME
|
|
|
|
|
if [ "$bool_BUILD_FROM_GIT" = "y" ]; then
|
|
|
|
|
echo -e "${CYellow}> Building from GIT repo${CNone}"
|
|
|
|
|
# source files
|
|
|
|
|
if [ ! -d "$MOD_GIT_PATH" ]; then
|
|
|
|
|
MODULE_FOUND="n"
|
|
|
|
|
# Make sure the module exists
|
|
|
|
|
search_module $MOD_NAME
|
|
|
|
|
if [ "$MODULE_FOUND" != "y" -o ! -d "$MOD_GIT_PATH" ]; then
|
|
|
|
|
if [ "$MODULE_FOUND" != "y" ]; then
|
|
|
|
|
echo "Module \"$MOD_NAME\" not found in GIT"
|
|
|
|
|
do_exit 5
|
|
|
|
|
fi
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
if [ "$bool_BUILD_FROM_GIT" = "y" ]; then
|
|
|
|
|
echo -e "${CYellow}> Building from GIT repo${CNone}"
|
|
|
|
|
# source files
|
|
|
|
|
bool_COPY_MOD_SRC="y"
|
|
|
|
|
|
|
|
|
|
# packaging scripts
|
|
|
|
@ -229,19 +213,9 @@ else
|
|
|
|
|
echo -e "${CYellow}> Building from BUILD folder${CNone}"
|
|
|
|
|
# source files
|
|
|
|
|
bool_COPY_MOD_SRC="n"
|
|
|
|
|
if [ ! -d "$MOD_BUILD_PATH" ]; then
|
|
|
|
|
if [ ! -d "$MOD_GIT_PATH" ]; then
|
|
|
|
|
MODULE_FOUND="n"
|
|
|
|
|
search_module $MOD_NAME
|
|
|
|
|
if [ "$MODULE_FOUND" != "y" -o ! -d "$MOD_GIT_PATH" ]; then
|
|
|
|
|
echo "Module \"$MOD_NAME\" not found neither in BUILD nor in GIT"
|
|
|
|
|
do_exit 7
|
|
|
|
|
fi
|
|
|
|
|
fi
|
|
|
|
|
if [ ! -d "$MOD_BUILD_PATH" ]; then
|
|
|
|
|
bool_COPY_MOD_SRC="y"
|
|
|
|
|
fi
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
# packaging scripts
|
|
|
|
|
bool_COPY_PKGING_FILES="n"
|
|
|
|
@ -283,19 +257,20 @@ if [ "$bool_COPY_MOD_SRC" = "y" ]; then
|
|
|
|
|
echo "Revision: $MOD_BRANCH-$COMMIT_HASH" >> "$MOD_BUILD_PATH/.tdescminfo"
|
|
|
|
|
git log -1 --pretty=format:"DateTime: %cd%n" --date=format:"%m/%d/%Y %H:%M" >> "$MOD_BUILD_PATH/.tdescminfo"
|
|
|
|
|
else
|
|
|
|
|
# Extra dependency module
|
|
|
|
|
if [ `find "$MOD_GIT_PATH" -name '*.dsc' | wc -l` == 1 ]; then
|
|
|
|
|
if [ -d "$MOD_BUILD_PATH" ]; then
|
|
|
|
|
$SUDO_CMD rm -R "$MOD_BUILD_PATH"
|
|
|
|
|
fi
|
|
|
|
|
eval dpkg-source --no-copy --no-check -x `find "$MOD_GIT_PATH" -name '*.dsc'` \
|
|
|
|
|
\"$MOD_BUILD_PATH\" $OPT_SHOW_LOGS/dev/null
|
|
|
|
|
# Extra dependency module: copy and apply patches
|
|
|
|
|
# -- move to the correct folder
|
|
|
|
|
cd "$MOD_GIT_PATH"
|
|
|
|
|
if [ `ls -d */ | wc -l` == 1 ]; then
|
|
|
|
|
cd `ls -d */`
|
|
|
|
|
cp -R "." "$MOD_BUILD_PATH"
|
|
|
|
|
cd $MOD_BUILD_PATH
|
|
|
|
|
QUILT_PATCHES="debian/patches" quilt push -a >/dev/null
|
|
|
|
|
# Make sure patches are not reapplied in future local builds. This could stop pdebuild from working.
|
|
|
|
|
if [ -f "$MOD_BUILD_PATH/debian/patches/series" ]; then
|
|
|
|
|
cp /dev/null "$MOD_BUILD_PATH/debian/patches/series"
|
|
|
|
|
fi
|
|
|
|
|
else
|
|
|
|
|
echo "There must be one and only one .dsc file in \"$MOD_GIT_PATH\""
|
|
|
|
|
echo "There must be one and only one module folder in \"$MOD_GIT_PATH\""
|
|
|
|
|
do_exit 9
|
|
|
|
|
fi
|
|
|
|
|
fi
|
|
|
|
@ -379,17 +354,19 @@ if [ -x "$HOOK_DIR/$MOD_NAME/pre_build.sh" ]; then
|
|
|
|
|
fi
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#----------------------------
|
|
|
|
|
# Switch to 3.0(quilt) format
|
|
|
|
|
#----------------------------
|
|
|
|
|
# create orig tarball
|
|
|
|
|
cd "$MOD_BUILD_PATH"
|
|
|
|
|
|
|
|
|
|
MOD_BASENAME=`head -n 1 "$MOD_BUILD_PKGING_PATH/changelog" | sed -r "s/^([^ ]+).*/\1/"`
|
|
|
|
|
MOD_MAJOR_VER=`head -n 1 "$MOD_BUILD_PKGING_PATH/changelog" | sed -r "s/^[^ ]+ \(([^:]+:)?.*/\1/"`
|
|
|
|
|
MOD_UP_VER=`head -n 1 "$MOD_BUILD_PKGING_PATH/changelog" | sed -r "s/^[^ ]+ \(([^:]+:)?(.*+)-.*/\2/"`
|
|
|
|
|
MOD_DEB_VER=`head -n 1 "$MOD_BUILD_PKGING_PATH/changelog" | sed -r "s/^[^ ]+ \(.*+-([^\)]+).*/\1/"`
|
|
|
|
|
|
|
|
|
|
REPO_DATE=`dpkg-parsechangelog -l "$MOD_BUILD_PATH/debian/changelog" | sed -n -e 's|^Date: ||p'`
|
|
|
|
|
REPO_DATE=`dpkg-parsechangelog -l "$MOD_BUILD_PKGING_PATH/changelog" | sed -n -e 's|^Date: ||p'`
|
|
|
|
|
tar cJf "../${MOD_BASENAME}_${MOD_UP_VER}.orig.tar.xz" --exclude="debian" --exclude=".git*" \
|
|
|
|
|
--mtime "$REPO_DATE" --pax-option=exthdr.name=%d/PaxHeaders/%f,delete=atime,delete=ctime .
|
|
|
|
|
touch -d "$REPO_DATE" "../${MOD_BASENAME}_${MOD_UP_VER}.orig.tar.xz"
|
|
|
|
|