Find file
Fetching contributors…
Cannot retrieve contributors at this time
executable file 186 lines (148 sloc) 4.81 KB
#!/bin/bash
# This is the common script for updating packages and uploading them to mentors.debian.net
#
# It make such actions:
# 1) Update changelog.
# 2) Prepare sources to upload.
# Build the package and check it using lintian (optional)
# 3) Upload sources to mentors.debian.net
if [ -z "${PACKAGE}" ]; then
echo "Error: PACKAGE variable is empty!";
exit 1;
elif [ -z "${NEW_VER}" ]; then
echo "Error: NEW_VER variable is empty!";
exit 1;
fi
case "${A_TYPE}" in
"gz")
export D_ARGS="xzf"
;;
"bz2")
export D_ARGS="xjf"
;;
"xz")
export D_ARGS="xJf"
;;
*)
echo "Tarball type is not defined!"
exit 1
;;
esac
if [ ! -e "${PACKAGE}_${NEW_VER}.orig.tar.${A_TYPE}" ]; then
echo "File ${PACKAGE}_${NEW_VER}.orig.tar.${A_TYPE} is not found.";
exit 0;
fi
if [ -z "${DIR_NAME}" ]; then
export DIR_NAME="${PACKAGE}-${NEW_VER}"
fi
if [ -z "${OLD_DIR_NAME}" ]; then
export OLD_DIR_NAME="${PACKAGE}-${OLD_VER}"
fi
if [ "${1}" = "clean" ]; then
export CLEAN_BUILD="true"
fi
echo "Updating is started."
rm -rf "${DIR_NAME}" "${PACKAGE}_${NEW_VER}-"*
tar "${D_ARGS}" "${PACKAGE}_${NEW_VER}.orig.tar.${A_TYPE}"
rm -rf "${DIR_NAME}/debian"
cp -rf "${PKG_DIR}/${PACKAGE}-debian/debian" "${DIR_NAME}/debian"
if [ -d "${OLD_DIR_NAME}" ] && [ "${SFX}" = "-1" ]; then
diff -urN "${OLD_DIR_NAME}" "${DIR_NAME}" > \
"${TEMP_DIR}/${OLD_VER_FULL}::${NEW_VER_FULL}.diff"
fi
cd "${TEMP_DIR}/${DIR_NAME}"
echo ;
echo "Uscan:"
uscan --report-status
echo ;
if [ "${SFX}" = "-1" ]; then
dch -b --force-distribution --distribution "${MAIN_DIST}" -v "${EPOCH}${NEW_VER_FULL}" \
"${UPDATE_STRING}"
kwrite debian/changelog
nice -n19 debuild -S -sa
else
dch -b --force-distribution --distribution "${MAIN_DIST}" -v "${EPOCH}${NEW_VER_FULL}" \
"Some fixes in package."
kwrite debian/changelog
# debuild -S -sd
nice -n19 debuild -S -sa
fi
if [ "${1}" = "fast" ]; then
echo ;
echo "Fast upload (without tests)."
echo ;
else
echo ;
echo "Now will be tests."
echo ;
if [ "${CLEAN_BUILD}" = "true" ]; then
sudo rm -rf "${TEST_DIR}"/*
else
rm -rf "${TEST_DIR}"/*
fi
mkdir -p "${TEST_DIR}"
cd "${TEST_DIR}" || exit 1
cp -r "${TEMP_DIR}/${DIR_NAME}" "${TEST_DIR}/"
cp -f "${TEMP_DIR}/${PACKAGE}_${NEW_VER}.orig.tar.${A_TYPE}" "${TEST_DIR}/"
cp -f "${TEMP_DIR}/${PACKAGE}_${NEW_VER_FULL}.debian.tar."* "${TEST_DIR}/"
cp -f "${TEMP_DIR}/${PACKAGE}_${NEW_VER_FULL}.dsc" "${TEST_DIR}/"
export BUILD_LOG_FILE="${TEMP_DIR}/${PACKAGE}-${NEW_VER_FULL}.build.log"
export WARNINGS_LOG_FILE="${TEMP_DIR}/${PACKAGE}-${NEW_VER_FULL}.warnings.log"
echo ;
cd "${TEST_DIR}/${DIR_NAME}"
echo "Start building packages..."
if [ "${CLEAN_BUILD}" = "true" ]; then
sudo time nice -n19 pdebuild --pbuilder cowbuilder \
--buildresult "${TEST_DIR}" \
> ${BUILD_LOG_FILE} \
2> ${WARNINGS_LOG_FILE} || exit 1
sudo chown -R "${SUDO_USER}:${SUDO_USER}" "${TEST_DIR}"
else
time nice -n19 dpkg-buildpackage -rfakeroot -uc -us \
> ${BUILD_LOG_FILE} \
2> ${WARNINGS_LOG_FILE} || exit 1
fi
cat ${WARNINGS_LOG_FILE}
echo "Finished building packages."
echo ;
export LINTIAN_LOG_FILE="${TEMP_DIR}/${PACKAGE}-${NEW_VER_FULL}.lintian.log"
cd "${TEST_DIR}"
echo ;
echo "Now running lintian:"
time nice -n19 lintian -ivIE --pedantic ${PACKAGE}_${NEW_VER_FULL}_*.changes > ${LINTIAN_LOG_FILE}
grep "E: " "${LINTIAN_LOG_FILE}"
grep "W: " "${LINTIAN_LOG_FILE}"
grep "I: " "${LINTIAN_LOG_FILE}"
grep "P: " "${LINTIAN_LOG_FILE}"
grep "X: " "${LINTIAN_LOG_FILE}"
echo "Finished running lintian."
echo ;
kwrite ${LINTIAN_LOG_FILE}
cd "${TEMP_DIR}/${DIR_NAME}"
fi
kwrite debian/changelog
cd "${TEMP_DIR}"
cp -fr "${DIR_NAME}/debian" "${PKG_DIR}/${PACKAGE}-debian/"
echo "Update finished successfully"
if [ "${2}" = "new" ]; then
cd "${TEST_DIR}"
debsign "${PACKAGE}_${NEW_VER_FULL}_i386.changes"
echo "Package is targeted into NEW queue, so binary upload is required:"
echo "dput -f ftp-eu ${PACKAGE}_${NEW_VER_FULL}_i386.changes"
else
cd "${TEMP_DIR}"
echo "Sorce-only upload:"
echo "dput -f ftp-eu ${PACKAGE}_${NEW_VER_FULL}_source.changes"
fi
konsole &> /dev/null &
# Local repo
if [ "${1}" != "fast" ]; then
export APT_DIR="${MAIN_DIR}/LocalRepo"
mkdir -p "${APT_DIR}/${PACKAGE}/"
cp -f "${TEST_DIR}"/*.deb "${APT_DIR}/${PACKAGE}/"
cd "${APT_DIR}/" || exit 1
rm -f Packages* InRelease* Release*
apt-ftparchive packages . > Packages
gzip -c Packages > Packages.gz
gpg -abs -o Packages.gpg Packages.gz
fi