diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2021-06-10 03:35:17 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2021-06-10 04:33:18 +0000 |
commit | 84ffb2d3a8c538f1140e992fc2cd52dbcae73825 (patch) | |
tree | a645b739b1c060efc9e9017edd35103c5ad389fb /bin | |
parent | Updating. (diff) | |
download | progress-linux-tools-84ffb2d3a8c538f1140e992fc2cd52dbcae73825.tar.xz progress-linux-tools-84ffb2d3a8c538f1140e992fc2cd52dbcae73825.zip |
Updating.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'bin')
-rwxr-xr-x | bin/pbuild.sh | 357 |
1 files changed, 187 insertions, 170 deletions
diff --git a/bin/pbuild.sh b/bin/pbuild.sh index 3e0c5ab..4a3559c 100755 --- a/bin/pbuild.sh +++ b/bin/pbuild.sh @@ -111,7 +111,7 @@ Parameters "${@}" if [ -z "${DISTRIBUTION}" ] || [ -z "${PACKAGE}" ] then - echo "Usage: ${PROGRAM} [-b|--build BUILD] -d|--distribution DISTRIBUTION -p|--package PACKAGE -t|--tag TAG" >&2 + echo "Usage: ${PROGRAM} [-b|--build BUILD] -d|--distribution DISTRIBUTION -p|--package PACKAGE -t|--tag TAG[,TAG,...]" >&2 exit 1 fi @@ -123,6 +123,8 @@ then exit 1 fi +TAGS="$(echo ${TAG} | sed -e 's|,| |g')" + if [ -z "${BUILD}" ] then case "$(dpkg --print-architecture)" in @@ -152,205 +154,220 @@ case "${MODE}" in ;; esac -for BUILD in $(echo ${BUILD} | sed -e 's|,| |g') +for TAG in ${TAGS} HEAD do - echo "################################################################################" - echo "Building ${BUILD} ($(dpkg --print-architecture)) package: ${PACKAGE} ${VERSION}" - echo "################################################################################" + # if no tag is specified, build head. + # if a tag is specified, don't (additionally) build head + if [ "${TAG}" = "HEAD" ] + then + if [ -z "${TAGS}" ] + then + TAG="" + else + continue + fi + fi - case "${BUILD}" in - source) - if [ -n "${TAG}" ] - then - GIT_BRANCH="${TAG}" - git clone --branch ${GIT_BRANCH} "${REPOSITORY}" "${TARGET}" - else - GIT_BRANCH="${BRANCH}" - #git clone --depth 1 --no-single-branch --branch ${GIT_BRANCH} "${REPOSITORY}" "${TARGET}" - git clone --no-single-branch --branch ${GIT_BRANCH} "${REPOSITORY}" "${TARGET}" - fi + for BUILD in $(echo ${BUILD} | sed -e 's|,| |g') + do + echo "################################################################################" + echo "Building ${BUILD} ($(dpkg --print-architecture)) package: ${PACKAGE} ${VERSION}" + echo "################################################################################" - cd "${TARGET}" + case "${BUILD}" in + source) + if [ -n "${TAG}" ] + then + GIT_BRANCH="${TAG}" + git clone --branch ${GIT_BRANCH} "${REPOSITORY}" "${TARGET}" + else + GIT_BRANCH="${BRANCH}" + #git clone --depth 1 --no-single-branch --branch ${GIT_BRANCH} "${REPOSITORY}" "${TARGET}" + git clone --no-single-branch --branch ${GIT_BRANCH} "${REPOSITORY}" "${TARGET}" + fi - VERSION="$(dpkg-parsechangelog | awk '/^Version: / { print $2 }')" + cd "${TARGET}" - SOURCE_VERSION="$(echo ${VERSION} | awk -F: '{ print $2 }')" - SOURCE_VERSION="${SOURCE_VERSION:-${VERSION}}" + VERSION="$(dpkg-parsechangelog | awk '/^Version: / { print $2 }')" - UPSTREAM_VERSION="$(echo ${SOURCE_VERSION} | awk -F- '{ $NF=""; print $0 }' | sed -e 's| |-|g' -e 's|-$||')" + SOURCE_VERSION="$(echo ${VERSION} | awk -F: '{ print $2 }')" + SOURCE_VERSION="${SOURCE_VERSION:-${VERSION}}" - if [ -z "${UPSTREAM_VERSION}" ] && echo "${SOURCE_VERSION}" | grep -qs '+progress[0-9]*' - then - UPSTREAM_VERSION="$(echo ${SOURCE_VERSION} | awk -F\\+progress '{ print $1 }')" - fi + UPSTREAM_VERSION="$(echo ${SOURCE_VERSION} | awk -F- '{ $NF=""; print $0 }' | sed -e 's| |-|g' -e 's|-$||')" - if [ -z "${UPSTREAM_VERSION}" ] && echo "${SOURCE_VERSION}" | grep -qs '+bfh[0-9]*' - then - UPSTREAM_VERSION="$(echo ${SOURCE_VERSION} | awk -F\\+bfh '{ print $1 }')" - fi + if [ -z "${UPSTREAM_VERSION}" ] && echo "${SOURCE_VERSION}" | grep -qs '+progress[0-9]*' + then + UPSTREAM_VERSION="$(echo ${SOURCE_VERSION} | awk -F\\+progress '{ print $1 }')" + fi - rm -rf .git - mv debian ../ - cd "${OLDPWD}" + if [ -z "${UPSTREAM_VERSION}" ] && echo "${SOURCE_VERSION}" | grep -qs '+bfh[0-9]*' + then + UPSTREAM_VERSION="$(echo ${SOURCE_VERSION} | awk -F\\+bfh '{ print $1 }')" + fi - mv "${TARGET}" "${TARGET}-${UPSTREAM_VERSION}" + rm -rf .git + mv debian ../ + cd "${OLDPWD}" - for DISTRIBUTION in engywuck fuchur - do - if [ ! -e "${TARGET}_${UPSTREAM_VERSION}.orig.tar.xz" ] - then - wget ${SERVER}/archive/$(echo ${DISTRIBUTION} | cut -d- -f 1)/${PACKAGE}/orig/${TARGET}_${UPSTREAM_VERSION}.orig.tar.xz || true - if [ ! -e ${TARGET}_${UPSTREAM_VERSION}.orig.tar.xz ] + mv "${TARGET}" "${TARGET}-${UPSTREAM_VERSION}" + + for DISTRIBUTION in engywuck fuchur + do + if [ ! -e "${TARGET}_${UPSTREAM_VERSION}.orig.tar.xz" ] then - wget ${SERVER}/archive/$(echo ${DISTRIBUTION} | cut -d- -f 1)-backports/${PACKAGE}/orig/${TARGET}_${UPSTREAM_VERSION}.orig.tar.xz || true + wget ${SERVER}/archive/$(echo ${DISTRIBUTION} | cut -d- -f 1)/${PACKAGE}/orig/${TARGET}_${UPSTREAM_VERSION}.orig.tar.xz || true if [ ! -e ${TARGET}_${UPSTREAM_VERSION}.orig.tar.xz ] then - wget ${SERVER}/archive/$(echo ${DISTRIBUTION} | cut -d- -f 1)-extras/${PACKAGE}/orig/${TARGET}_${UPSTREAM_VERSION}.orig.tar.xz || true + wget ${SERVER}/archive/$(echo ${DISTRIBUTION} | cut -d- -f 1)-backports/${PACKAGE}/orig/${TARGET}_${UPSTREAM_VERSION}.orig.tar.xz || true if [ ! -e ${TARGET}_${UPSTREAM_VERSION}.orig.tar.xz ] then - wget ${SERVER}/archive/$(echo ${DISTRIBUTION} | cut -d- -f 1)-backports-extras/${PACKAGE}/orig/${TARGET}_${UPSTREAM_VERSION}.orig.tar.xz || true + wget ${SERVER}/archive/$(echo ${DISTRIBUTION} | cut -d- -f 1)-extras/${PACKAGE}/orig/${TARGET}_${UPSTREAM_VERSION}.orig.tar.xz || true + if [ ! -e ${TARGET}_${UPSTREAM_VERSION}.orig.tar.xz ] + then + wget ${SERVER}/archive/$(echo ${DISTRIBUTION} | cut -d- -f 1)-backports-extras/${PACKAGE}/orig/${TARGET}_${UPSTREAM_VERSION}.orig.tar.xz || true + fi fi fi fi + done + + if [ ! -e "${TARGET}_${UPSTREAM_VERSION}.orig.tar.xz" ] + then + echo "Creating ${TARGET}_${UPSTREAM_VERSION}.orig.tar.xz ..." + tar cfJ "${TARGET}_${UPSTREAM_VERSION}.orig.tar.xz" "${TARGET}-${UPSTREAM_VERSION}" + else + echo "Using existing ${TARGET}_${UPSTREAM_VERSION}.orig.tar.xz ..." fi - done - - if [ ! -e "${TARGET}_${UPSTREAM_VERSION}.orig.tar.xz" ] - then - echo "Creating ${TARGET}_${UPSTREAM_VERSION}.orig.tar.xz ..." - tar cfJ "${TARGET}_${UPSTREAM_VERSION}.orig.tar.xz" "${TARGET}-${UPSTREAM_VERSION}" - else - echo "Using existing ${TARGET}_${UPSTREAM_VERSION}.orig.tar.xz ..." - fi - - mv debian "${TARGET}-${UPSTREAM_VERSION}" - dpkg-source -b "${TARGET}-${UPSTREAM_VERSION}" - - rm -rf "${TARGET}-${UPSTREAM_VERSION}" - - # upload - case "${UPLOAD}" in - true) - FILES="$(sed -e '1,/^Files:$/ d' ${TARGET}_${SOURCE_VERSION}*.dsc | grep -v '^\ \ ' | grep '^\ ' | awk '/^ / { print $3 }')" - - for FILE in ${FILES} - do - rsync -aP "${FILE}" apt.progress-linux.org::upload - rm -f "${FILE}" - done - ;; - esac - ;; - binary*) - rm -f /tmp/control - CONTROL="${REPOSITORY}/plain/debian/control" - wget -q ${CONTROL} -O /tmp/control + mv debian "${TARGET}-${UPSTREAM_VERSION}" + dpkg-source -b "${TARGET}-${UPSTREAM_VERSION}" - case "${BUILD}" in - binary-arch) - if ! grep -qs "^Architecture:.* any" /tmp/control && \ - ! grep -qs "^Architecture:.* linux-any" /tmp/control && \ - ! grep -qs "^Architecture:.* $(dpkg --print-architecture)" /tmp/control - then - echo "NO BINARY_ARCH, skipping." - continue - fi - ;; + rm -rf "${TARGET}-${UPSTREAM_VERSION}" - binary-indep) - if ! grep -qs '^Architecture:.*all' /tmp/control - then - echo "NO BINARY_INDEP, skipping." - continue - fi - ;; - esac + # upload + case "${UPLOAD}" in + true) + FILES="$(sed -e '1,/^Files:$/ d' ${TARGET}_${SOURCE_VERSION}*.dsc | grep -v '^\ \ ' | grep '^\ ' | awk '/^ / { print $3 }')" - if [ -n "${TAG}" ] - then - GIT_BRANCH="${TAG}" - git clone --branch ${GIT_BRANCH} "${REPOSITORY}" "${TARGET}" - else - GIT_BRANCH="${BRANCH}" - #git clone --depth 1 --no-single-branch --branch ${GIT_BRANCH} "${REPOSITORY}" "${TARGET}" - git clone --no-single-branch --branch ${GIT_BRANCH} "${REPOSITORY}" "${TARGET}" - fi + for FILE in ${FILES} + do + rsync -aP "${FILE}" apt.progress-linux.org::upload + rm -f "${FILE}" + done + ;; + esac + ;; - cd "${TARGET}" + binary*) + rm -f /tmp/control + CONTROL="${REPOSITORY}/plain/debian/control" + wget -q ${CONTROL} -O /tmp/control - rm -rf .git + case "${BUILD}" in + binary-arch) + if ! grep -qs "^Architecture:.* any" /tmp/control && \ + ! grep -qs "^Architecture:.* linux-any" /tmp/control && \ + ! grep -qs "^Architecture:.* $(dpkg --print-architecture)" /tmp/control + then + echo "NO BINARY_ARCH, skipping." + continue + fi + ;; - VERSION="$(dpkg-parsechangelog | awk '/^Version: / { print $2 }')" + binary-indep) + if ! grep -qs '^Architecture:.*all' /tmp/control + then + echo "NO BINARY_INDEP, skipping." + continue + fi + ;; + esac - SOURCE_VERSION="$(echo ${VERSION} | awk -F: '{ print $2 }')" - SOURCE_VERSION="${SOURCE_VERSION:-${VERSION}}" + if [ -n "${TAG}" ] + then + GIT_BRANCH="${TAG}" + git clone --branch ${GIT_BRANCH} "${REPOSITORY}" "${TARGET}" + else + GIT_BRANCH="${BRANCH}" + #git clone --depth 1 --no-single-branch --branch ${GIT_BRANCH} "${REPOSITORY}" "${TARGET}" + git clone --no-single-branch --branch ${GIT_BRANCH} "${REPOSITORY}" "${TARGET}" + fi - UPSTREAM_VERSION="$(echo ${SOURCE_VERSION} | awk -F- '{ $NF=""; print $0 }' | sed -e 's| |-|g' -e 's|-$||')" + cd "${TARGET}" - SOURCE="${TARGET}-$(echo ${SOURCE_VERSION} | sed -e 's|~|_|g' -e 's|+|.|g')" + rm -rf .git - cd .. - mv "${TARGET}" "${SOURCE}" - cd "${SOURCE}" + VERSION="$(dpkg-parsechangelog | awk '/^Version: / { print $2 }')" - # disable tests - for TARGET in dh_auto_test dh_auto_test-arch dh_auto_test-indep \ - override_dh_auto_test override_dh_auto_test-arch override_dh_auto_test-indep \ - execute_before_dh_auto_test execute_before_dh_auto_test-arch execute_before_dh_auto_test-indep \ - execute_after_dh_auto_test execute_after_dh_auto_test-arch execute_after_dh_auto_test-indep - do - if grep -qs "^${TARGET}:" debian/rules - then - sed -i -e "s|^${TARGET}:|disabled_${TARGET}:|" debian/rules - else - echo "${TARGET}:" >> debian/rules - fi - done - - case "${AUTO}" in - true) - sudo apt build-dep -y . - ;; - esac - - case "${INTERACTIVE}" in - true) - echo "${PROGRAM}: WAITING... " - read waiting - ;; - esac - - case "${BUILD}" in - binary-any) - dpkg-buildpackage -sa -us -uc - ;; - - binary-arch) - dpkg-buildpackage -B -us -uc - ;; - - binary-indep) - dpkg-buildpackage -A -us -uc - ;; - esac - - cd "${OLDPWD}" - - rm -rf "${SOURCE}" - - # upload - case "${UPLOAD}" in - true) - FILES="$(sed -e '1,/^Files:$/ d' ${TARGET}_${SOURCE_VERSION}_*.changes | grep -v '^\ \ ' | grep '^\ ' | awk '/^ / { print $5 }')" - - for FILE in ${FILES} - do - rsync -aP "${FILE}" apt.progress-linux.org::upload - rm -f "${FILE}" - done - ;; - esac - ;; - esac + SOURCE_VERSION="$(echo ${VERSION} | awk -F: '{ print $2 }')" + SOURCE_VERSION="${SOURCE_VERSION:-${VERSION}}" + + UPSTREAM_VERSION="$(echo ${SOURCE_VERSION} | awk -F- '{ $NF=""; print $0 }' | sed -e 's| |-|g' -e 's|-$||')" + + SOURCE="${TARGET}-$(echo ${SOURCE_VERSION} | sed -e 's|~|_|g' -e 's|+|.|g')" + + cd .. + mv "${TARGET}" "${SOURCE}" + cd "${SOURCE}" + + # disable tests + for TARGET in dh_auto_test dh_auto_test-arch dh_auto_test-indep \ + override_dh_auto_test override_dh_auto_test-arch override_dh_auto_test-indep \ + execute_before_dh_auto_test execute_before_dh_auto_test-arch execute_before_dh_auto_test-indep \ + execute_after_dh_auto_test execute_after_dh_auto_test-arch execute_after_dh_auto_test-indep + do + if grep -qs "^${TARGET}:" debian/rules + then + sed -i -e "s|^${TARGET}:|disabled_${TARGET}:|" debian/rules + else + echo "${TARGET}:" >> debian/rules + fi + done + + case "${AUTO}" in + true) + sudo apt build-dep -y . + ;; + esac + + case "${INTERACTIVE}" in + true) + echo "${PROGRAM}: WAITING... " + read waiting + ;; + esac + + case "${BUILD}" in + binary-any) + dpkg-buildpackage -sa -us -uc + ;; + + binary-arch) + dpkg-buildpackage -B -us -uc + ;; + + binary-indep) + dpkg-buildpackage -A -us -uc + ;; + esac + + cd "${OLDPWD}" + + rm -rf "${SOURCE}" + + # upload + case "${UPLOAD}" in + true) + FILES="$(sed -e '1,/^Files:$/ d' ${TARGET}_${SOURCE_VERSION}_*.changes | grep -v '^\ \ ' | grep '^\ ' | awk '/^ / { print $5 }')" + + for FILE in ${FILES} + do + rsync -aP "${FILE}" apt.progress-linux.org::upload + rm -f "${FILE}" + done + ;; + esac + ;; + esac + done done |