From d70b7b6056f4ab851c2c6cb7b438576feabe3935 Mon Sep 17 00:00:00 2001 From: Marios Titas Date: Fri, 21 Aug 2015 00:59:04 +0100 Subject: [PATCH] Adjust postsync scripts to work correctly in repo.postsync.d --- etc/portage/repo.postsync.d/sync_gentoo_dtd | 20 ++++++----- etc/portage/repo.postsync.d/sync_gentoo_glsa | 20 ++++++----- .../repo.postsync.d/sync_gentoo_herds_xml | 12 ++++--- etc/portage/repo.postsync.d/sync_gentoo_news | 36 ++++++++++--------- 4 files changed, 52 insertions(+), 36 deletions(-) diff --git a/etc/portage/repo.postsync.d/sync_gentoo_dtd b/etc/portage/repo.postsync.d/sync_gentoo_dtd index c9f9def..b3f4b46 100755 --- a/etc/portage/repo.postsync.d/sync_gentoo_dtd +++ b/etc/portage/repo.postsync.d/sync_gentoo_dtd @@ -1,14 +1,18 @@ #!/bin/bash -source /etc/portage/check-portdir.sh source /etc/init.d/functions.sh source /etc/portage/util-functions.sh -DTDDIR="${PORTDIR}"/metadata/dtd -ebegin "Updating DTDs" -if [[ -e ${DTDDIR} ]]; then - git -C "${DTDDIR}" pull -q --ff -else - git clone -q https://anongit.gentoo.org/git/data/dtd.git "${DTDDIR}" +repository_name=${1} +repository_path=${3} + +if [ "${repository_name}" == "gentoo" ]; then + DTDDIR="${repository_path}"/metadata/dtd + ebegin "Updating DTDs" + if [[ -e ${DTDDIR} ]]; then + git -C "${DTDDIR}" pull -q --ff + else + git clone -q https://anongit.gentoo.org/git/data/dtd.git "${DTDDIR}" + fi + eend "$?" fi -eend "$?" diff --git a/etc/portage/repo.postsync.d/sync_gentoo_glsa b/etc/portage/repo.postsync.d/sync_gentoo_glsa index d463fcb..2d1cfc9 100755 --- a/etc/portage/repo.postsync.d/sync_gentoo_glsa +++ b/etc/portage/repo.postsync.d/sync_gentoo_glsa @@ -1,14 +1,18 @@ #!/bin/bash -source /etc/portage/check-portdir.sh source /etc/init.d/functions.sh source /etc/portage/util-functions.sh -GLSADIR="${PORTDIR}"/metadata/glsa -ebegin "Updating GLSAs" -if [[ -e ${GLSADIR} ]]; then - git -C "${GLSADIR}" pull -q --ff -else - git clone -q https://anongit.gentoo.org/git/data/glsa.git "${GLSADIR}" +repository_name=${1} +repository_path=${3} + +if [ "${repository_name}" == "gentoo" ]; then + GLSADIR="${repository_path}"/metadata/glsa + ebegin "Updating GLSAs" + if [[ -e ${GLSADIR} ]]; then + git -C "${GLSADIR}" pull -q --ff + else + git clone -q https://anongit.gentoo.org/git/data/glsa.git "${GLSADIR}" + fi + eend "$?" fi -eend "$?" diff --git a/etc/portage/repo.postsync.d/sync_gentoo_herds_xml b/etc/portage/repo.postsync.d/sync_gentoo_herds_xml index a19888e..06a3fc8 100755 --- a/etc/portage/repo.postsync.d/sync_gentoo_herds_xml +++ b/etc/portage/repo.postsync.d/sync_gentoo_herds_xml @@ -1,9 +1,13 @@ #!/bin/bash -source /etc/portage/check-portdir.sh source /etc/init.d/functions.sh source /etc/portage/util-functions.sh -ebegin "Updating herds.xml" -wget -q -O "${PORTDIR}"/metadata/herds.xml https://api.gentoo.org/packages/herds.xml -eend $? +repository_name=${1} +repository_path=${3} + +if [ "${repository_name}" == "gentoo" ]; then + ebegin "Updating herds.xml" + wget -q -O "${repository_path}"/metadata/herds.xml https://api.gentoo.org/packages/herds.xml + eend $? +fi diff --git a/etc/portage/repo.postsync.d/sync_gentoo_news b/etc/portage/repo.postsync.d/sync_gentoo_news index 4466bcb..a3eef5d 100755 --- a/etc/portage/repo.postsync.d/sync_gentoo_news +++ b/etc/portage/repo.postsync.d/sync_gentoo_news @@ -1,22 +1,26 @@ #!/bin/bash -source /etc/portage/check-portdir.sh source /etc/init.d/functions.sh source /etc/portage/util-functions.sh -NEWSDIR="${PORTDIR}"/metadata/news -ebegin "Updating news items" -if [[ -e ${NEWSDIR} ]]; then - git -C "${NEWSDIR}" pull -q --ff -else - git clone -q https://anongit.gentoo.org/git/proj/gentoo-news.git "${NEWSDIR}" +repository_name=${1} +repository_path=${3} + +if [ "${repository_name}" == "gentoo" ]; then + NEWSDIR="${repository_path}"/metadata/news + ebegin "Updating news items" + if [[ -e ${NEWSDIR} ]]; then + git -C "${NEWSDIR}" pull -q --ff + else + git clone -q https://anongit.gentoo.org/git/proj/gentoo-news.git "${NEWSDIR}" + fi + eend_die $? + + ebegin "Cleaning news git repo" + git -C "${NEWSDIR}" clean -fdxq + eend_die $? + + ebegin "Copying news to base directory" + cp -a "${NEWSDIR}"/*/* "${NEWSDIR}" + eend $? fi -eend_die $? - -ebegin "Cleaning news git repo" -git -C "${NEWSDIR}" clean -fdxq -eend_die $? - -ebegin "Copying news to base directory" -cp -a "${NEWSDIR}"/*/* "${NEWSDIR}" -eend $?