X-Git-Url: https://git.arvados.org/arvados-dev.git/blobdiff_plain/8814265f140fdeef870639835b7aa42c4aefacd5..71cedf98449e4ed73b92fab0e45c2cf9620e6049:/jenkins/testing_to_stable_publish_packages.sh diff --git a/jenkins/testing_to_stable_publish_packages.sh b/jenkins/testing_to_stable_publish_packages.sh index 678256f..dcc8f41 100755 --- a/jenkins/testing_to_stable_publish_packages.sh +++ b/jenkins/testing_to_stable_publish_packages.sh @@ -8,7 +8,6 @@ # --packages list of packages, comma separated, to move from dev_repo_dir to prod_repo_dir # --distros list of distros, comma separated, to which to publish packages -APT_REPO_BASE_DIR="/var/lib/freight" RPM_REPO_BASE_DIR="/var/www/rpm.arvados.org" ### MAIN #################################################################### @@ -32,8 +31,8 @@ done # Make sure the variables are set or provide an example of how to use them if [ -z "${packages}" ]; then echo "You must provide a comma-separated list of packages to publish, ie." - echo "* Debian: --packages=arvados-ws_0.1.20170906144951.22418ed6e-1_amd64.deb,keep-exercise_*,*170906144951*" - echo "* Centos: --packages=arvados-ws_0.1.20170906144951.22418ed6e-1.x86_64.rpm,keep-exercise_0.1.20170906144951.22418ed6e-1.x86_64.rpm,crunch-dispatch-local_0.1.20170906144951.22418ed6e-1.x86_64.rpm" + echo "* Debian: --packages=arvados-ws:0.1.20170906144951.22418ed6e-1,keep-exercise:1.2.3-1" + echo "* Centos: --packages=arvados-ws:0.1.20170906144951.22418ed6e-1,keep-exercise:1.2.3-1" exit 254 fi if [ -z "${distros}" ]; then @@ -44,10 +43,11 @@ if [ -z "${distros}" ]; then fi DIST_LIST=$(echo ${distros} | sed s/,/' '/g |tr '[:upper:]' '[:lower:]') -PACKAGES=$(echo ${packages} | sed s/,/' '/g) +CENTOS_PACKAGES=$(echo ${packages} | sed 's/\([a-z-]*\):[[:blank:]]*\([0-9.-]*\)/\1*\2*/g; s/,/ /g;') +DEBIAN_PACKAGES=$(echo ${packages} | sed 's/\([a-z-]*\):[[:blank:]]*\([0-9.-]*\)/\1 (= \2)/g;') if ( echo ${DIST_LIST} |grep -q centos ); then - for DISTNAME in ${DIST_LIST}; do + for DISTNAME in ${DIST_LIST}; do case ${DISTNAME} in 'centos7') DIST_DIR_TEST='7/testing/x86_64' @@ -61,7 +61,7 @@ if ( echo ${DIST_LIST} |grep -q centos ); then cd ${RPM_REPO_BASE_DIR} mkdir -p ${RPM_REPO_BASE_DIR}/CentOS/${DIST_DIR_PROD} echo "Copying packages ..." - for P in ${PACKAGES}; do + for P in ${CENTOS_PACKAGES}; do cp ${RPM_REPO_BASE_DIR}/CentOS/${DIST_DIR_TEST}/${P} ${RPM_REPO_BASE_DIR}/CentOS/${DIST_DIR_PROD}/ if [ $? -ne 0 ]; then FAILED_PACKAGES="${FAILED_PACKAGES} ${P}" @@ -73,29 +73,32 @@ if ( echo ${DIST_LIST} |grep -q centos ); then else for DISTNAME in ${DIST_LIST}; do ADDED=() - cd ${APT_REPO_BASE_DIR} - mkdir -p ${APT_REPO_BASE_DIR}/apt/${DISTNAME} echo "Copying packages ..." - for P in ${PACKAGES}; do - cp ${APT_REPO_BASE_DIR}/apt/${DISTNAME}-testing/${P} ${APT_REPO_BASE_DIR}/apt/${DISTNAME}/ + OLDIFS=$IFS + IFS=$',' + for P in ${DEBIAN_PACKAGES}; do + aptly repo search ${DISTNAME}-testing "${P}" if [ $? -ne 0 ]; then - FAILED_PACKAGES="${FAILED_PACKAGES} ${P}" + echo "ERROR: unable to find a match for '${P}' in ${DISTNAME}-testing" + FAILED_PACKAGES="${FAILED_PACKAGES} ${DISTNAME}-testing:${P}" else - TMP=`ls -C1 ${APT_REPO_BASE_DIR}/apt/${DISTNAME}-testing/${P}` - ADDED+=( "${TMP[@]}" ) + aptly repo copy ${DISTNAME}-testing ${DISTNAME} "${P}" + if [ $? -ne 0 ]; then + echo "ERROR: unable to copy '${P}' from ${DISTNAME}-testing to ${DISTNAME}" + FAILED_PACKAGES="${FAILED_PACKAGES} ${DISTNAME}-testing:${P}" + fi fi done - for P in "${ADDED[@]}"; do - freight add apt/${DISTNAME}/$(basename ${P}) apt/${DISTNAME} - done - echo "Recreating repo apt/${DISTNAME} ..." - freight cache apt/${DISTNAME} + IFS=$OLDIFS + echo "Publishing ${DISTNAME} repository..." + aptly publish update ${DISTNAME} filesystem:${DISTNAME}: done fi if [ "${FAILED_PACKAGES}" != "" ]; then echo "PACKAGES THAT FAILED TO PUBLISH" echo "${FAILED_PACKAGES}" + exit 252 else echo "All packages published correctly" fi