summaryrefslogtreecommitdiff
path: root/abslibre
diff options
context:
space:
mode:
authorcoadde [Márcio Alexandre Silva Delgado] <coadde@parabola.nu>2015-08-25 16:01:19 -0300
committercoadde [Márcio Alexandre Silva Delgado] <coadde@parabola.nu>2015-08-25 16:01:19 -0300
commita6e67e220e638ee69b63dd9a96af7e608c27531c (patch)
tree3a92c55f30a166fc8aeb1d49dc7d25fbedb2453b /abslibre
parentfbd249636f43493fa97bc8a743cedf6b7502be3a (diff)
add more configuration and update abslibre script
Diffstat (limited to 'abslibre')
-rwxr-xr-xabslibre199
1 files changed, 82 insertions, 117 deletions
diff --git a/abslibre b/abslibre
index 6b21d24..aab71cc 100755
--- a/abslibre
+++ b/abslibre
@@ -2,128 +2,93 @@
set -e
-FTP_BASE=/srv/repo/main
-ABSLIBRE=/srv/abslibre
-ABSGIT=/srv/git/abslibre/abslibre.git
-# Remote
-# ABSGIT=http://projects.parabolagnulinux.org/abslibre.git
-BLACKLIST=/home/repo/blacklist/blacklist.txt
-SYNCARGS='-mrtv --no-motd --delete-after --no-p --no-o --no-g --quiet'
-BLFILE=/tmp/blacklist.txt
-
-# Variables from abs.conf
-ABSROOT="/srv/abs/"
-# DON'T CHANGE. WE NEED IT FOR ABSLIBRE
-SYNCSERVER="rsync.archlinux.org"
-ARCH="i686"
-MIRRORLIST="/etc/pacman.d/mirrorlist"
-REPOS=(core extra community testing community-testing !staging !community-staging)
-
# Steps
-# * Sync abs
+# * Sync bs derivation (abs)
# * Download blacklist.txt
-# * Sync abslibre from abs excluding from blacklist
+# * Sync bs (abslibre) from bs derivation (abs) excluding from blacklist
# * Create repo.abs.tar.gz tarballs
-function sync_abs() {
- for ARCH in any i686 x86_64; do
- rsync ${SYNCARGS} ${SYNCSERVER}::abs/${ARCH}/ ${ABSROOT}/${ARCH} || return $?
- done
-
- # fix some permissions
- find "${ABSROOT}" -type d -print0 | xargs -0 chmod 755
- find "${ABSROOT}" -type f -print0 | xargs -0 chmod 644
-}
-
-function get_blacklist() {
- printf ":: Updating blacklist...\t"
- cat "${BLACKLIST}" | cut -d':' -f1 | sort -u | \
- sed "s/^/**\//" > ${BLFILE} || {
- printf "[FAILED]\n"
- return 1
+. './config'
+
+for 'platform' in "${PLATFORMS[@]}"; do
+
+ platform_name="${platform/\//+}"
+ . "./config_${platform_name,,}"
+
+ function sync_bs_derivation() {
+ for 'ARCH' in 'any' "${ARCHES[@]}"; do
+ rsync "${SYNC_ARGS}" "${SYNC_DERIVATION_SERVER}::${BS_DERIVATION_NAME}/${ARCH}" "${BS_DERIVATION_DIR}/${ARCH}" || return $?
+ done
+
+ # fix some permissions
+ find "${BS_DERIVATION_DIR}" -type d -print0 | xargs -0 chmod 755
+ find "${BS_DERIVATION_DIR}" -type f -print0 | xargs -0 chmod 644
+ }
+
+ function get_blacklist() {
+ printf ":: Updating blacklist...\t"
+ cat "${BLACKLIST_FILE}" | cut -d':' -f1 | sort -u | \
+ sed "s/^/**\//" > "${BLACKLIST_TMP}" || {
+ printf "[FAILED]\n"
+ return 1
+ }
+
+ # Prevent using an empty blacklist
+ [ $(wc -l "${BLACKLIST_TMP}" | cut -d " " -f1) -eq 0 ] && return 1
+
+ printf "[OK]\n"
+ }
+
+ function sync_bs() {
+
+ # Clone BS git repo
+ if [ -d "${BS_GIT_TMP}"/.git ]; then
+ pushd "${BS_GIT_TMP}" >/dev/null 2>&1
+ git pull
+ popd >/dev/null 2>&1
+ else
+ git clone "${BS_GIT}" "${BS_GIT_TMP}"
+ fi
+
+ # Sync from BS_DERIVATION and then sync from BS
+ printf ":: Syncing ${BS_MAIN_NAME}...\t"
+ (rsync "${SYNC_ARGS}" --delete-excluded \
+ --exclude-from="${BLACKLIST_TMP}" \
+ "${BS_DERIVATION_DIR}" \
+ "${BS_MAIN_DIR}" \
+ &&
+ for 'ARCH' in "${ARCHES[@]}"; do rsync -v -mrtq --no-motd --no-p --no-o --no-g --quiet --exclude=.git/ "${BS_GIT_TMP}" "${BS_MAIN_DIR}/${ARCH}/"; done) || {
+ printf "[FAILED]\n"
+ return 1
+ }
+
+ # fix some permissions
+ find "${BS_MAIN_DIR}" -type d -print0 | xargs -0 chmod 755
+ find "${BS_MAIN_DIR}" -type f -print0 | xargs -0 chmod 644
+
+ printf "[OK]\n"
}
- # Prevent using an empty blacklist
- [ $(wc -l ${BLFILE} | cut -d " " -f1) -eq 0 ] && return 1
-
- printf "[OK]\n"
-}
-
-function sync_abs_libre() {
-
- # Clone ABSLibre git repo
- if [ -d /tmp/abslibre/.git ]; then
- pushd /tmp/abslibre >/dev/null 2>&1
- git pull
- popd >/dev/null 2>&1
- else
- git clone "$ABSGIT" /tmp/abslibre
- fi
-
- # Sync from ABS and then sync from ABSLibre
- printf ":: Syncing ABSLibre...\t"
- (rsync ${SYNCARGS} --delete-excluded \
- --exclude-from=${BLFILE} \
- ${ABSROOT} \
- ${ABSLIBRE} \
- &&
- for ARCH in i686 x86_64; do rsync -v -mrtq --no-motd --no-p --no-o --no-g --quiet --exclude=.git/ /tmp/abslibre/ ${ABSLIBRE}/${ARCH}/; done) || {
- printf "[FAILED]\n"
- return 1
+ # Create .abs.tar.gz tarballs
+ create_tarballs() {
+ for 'repo' in "${BS_MAIN_DIR}/${ARCHES[@]}/"*; do
+ baserepo="${repo##*/}"
+ arch="$(basename $(dirname ${repo}))"
+
+ # Remove the old one
+ mkdir -p "${FTP_BASE}/${baserepo}/os/${arch}"
+ rm -fv "${FTP_BASE}/${baserepo}/os/${arch}/${baserepo}.abs.tar.gz"
+ # Create a new one joining arch and any
+ # Remove the first part of the path (it could be $repo but any isn't hit)
+ bsdtar -czf "${FTP_BASE}/${baserepo}/os/${arch}/${baserepo}.abs.tar.gz" \
+ -s ":${BS_MAIN_DIR}/[a-z0-9_]\+/[a-z]\+::" \
+ "${repo}"/* "${BS_MAIN_DIR}/any/${baserepo}"/*
+
+ done
}
- # fix some permissions
- find "${ABSLIBRE}" -type d -print0 | xargs -0 chmod 755
- find "${ABSLIBRE}" -type f -print0 | xargs -0 chmod 644
-
- printf "[OK]\n"
-}
-
-# This part is very hacky and particular to the current setup :P
-sync_pre_mips64el() {
- pushd /home/fauno/Repos/abslibre-pre-mips64el >/dev/null
-
- sudo -u fauno sh -c "
- rsync ${SYNCARGS} \
- --exclude=.git* \
- --exclude=community-staging \
- --exclude=community-testing \
- --exclude=gnome-unstable \
- --exclude=kde-unstable \
- --exclude=multilib \
- --exclude=multilib-testing \
- --exclude=multilib-staging \
- --exclude=staging \
- --exclude=testing \
- ${ABSLIBRE}/x86_64/ \
- /home/fauno/Repos/abslibre-pre-mips64el/ &&
- git add . &&
- git commit -m \"$(date)\" -a
- git push origin master
- git gc
- "
-}
-
-# Create .abs.tar.gz tarballs
-create_tarballs() {
- for repo in ${ABSLIBRE}/{i686,x86_64}/*; do
- baserepo=${repo##*/}
- arch=$(basename $(dirname $repo))
-
- # Remove the old one
- mkdir -p $FTP_BASE/$baserepo/os/$arch/
- rm -fv $FTP_BASE/$baserepo/os/$arch/$baserepo.abs.tar.gz
- # Create a new one joining arch and any
- # Remove the first part of the path (it could be $repo but any isn't hit)
- bsdtar -czf $FTP_BASE/$baserepo/os/$arch/$baserepo.abs.tar.gz \
- -s ":${ABSLIBRE}/[a-z0-9_]\+/[a-z]\+::" \
- $repo/* ${ABSLIBRE}/any/${baserepo}/*
-
- done
-}
-
-sync_abs
-get_blacklist
-sync_abs_libre
-#sync_pre_mips64el
-create_tarballs
+ sync_bs_derivation
+ get_blacklist
+ sync_bs
+ create_tarballs
+done