From f65c477e42f46a3e22b5fbc5da790f9561483770 Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Tue, 31 Dec 2013 14:50:37 -0500 Subject: clean up --- TODO | 2 +- config.orig | 54 --------------------------------- cron-jobs/ftpdir-cleanup | 7 +++++ cron-jobs/sourceballs | 8 ++--- db-functions | 19 +++++------- db-update | 9 +++--- git-pbs | 44 --------------------------- libremessages | 77 ------------------------------------------------ 8 files changed, 23 insertions(+), 197 deletions(-) delete mode 100644 config.orig delete mode 100755 git-pbs delete mode 100755 libremessages diff --git a/TODO b/TODO index 3219b1c..9dd4b52 100644 --- a/TODO +++ b/TODO @@ -7,4 +7,4 @@ * Fix db-move - - Make it use abslibre \ No newline at end of file + - Make it use abslibre diff --git a/config.orig b/config.orig deleted file mode 100644 index a32f82f..0000000 --- a/config.orig +++ /dev/null @@ -1,54 +0,0 @@ -#!/bin/bash -<<<<<<< HEAD -FTP_BASE="/srv/http/repo/public" -ARCH_BASE="/srv/http/repo/public" -SVNREPO="/srv/http/repo/abslibre" -======= -FTP_BASE="/srv/http/repo/public/temprepo" -ARCH_BASE="/srv/http/repo/public/temprepo" -SVNREPO="/var/abs" ->>>>>>> 801ea2c927ace5ee892209dd8e3c1044e1b3842e - -# Repos from Arch -ARCHREPOS=('core' 'testing') #'extra' 'community' 'testing' 'multilib') -# Official Parabola repos -OURREPOS=('libre' 'libre-testing') -# User repos -USERREPOS=('~fauno' '~smv' '~xihh' '~mtjm' '~brendan') -# Community project repos -PROJREPOS=('social' 'elementary' 'kernels' 'radio' 'security' 'sugar') -PKGREPOS=(${ARCHREPOS[@]} ${OURREPOS[@]} ${USERREPOS[@]} ${PROJREPOS[@]}) -PKGPOOL='pool/packages' -SRCPOOL='sources/packages' - -CLEANUP_DESTDIR="$FTP_BASE/old/packages" -CLEANUP_DRYRUN=true -# Time in days to keep moved packages -CLEANUP_KEEP=30 - -SOURCE_CLEANUP_DESTDIR="$FTP_BASE/old/sources" -SOURCE_CLEANUP_DRYRUN=true -# Time in days to keep moved sourcepackages -SOURCE_CLEANUP_KEEP=30 - -REQUIRE_SIGNATURE=true - -LOCK_DELAY=10 -LOCK_TIMEOUT=300 - -STAGING="$FTP_BASE/staging" -TMPDIR="/tmp" -ARCHARCHES=(i686 x86_64) -OURARCHES=(mips64el) -ARCHES=(${ARCHARCHES[@]} ${OURARCHES[@]}) -DBEXT=".db.tar.gz" -FILESEXT=".files.tar.gz" -PKGEXT=".pkg.tar.?z" -SRCEXT=".src.tar.gz" - -<<<<<<< HEAD -MAKEPKGCONF="~/.makepkg.conf" -======= -MAKEPKGCONF="/etc/makepkg.conf" ->>>>>>> 801ea2c927ace5ee892209dd8e3c1044e1b3842e -BLACKLIST_FILE="$HOME/blacklist/blacklist.txt" diff --git a/cron-jobs/ftpdir-cleanup b/cron-jobs/ftpdir-cleanup index a2823d4..e42a1a8 100755 --- a/cron-jobs/ftpdir-cleanup +++ b/cron-jobs/ftpdir-cleanup @@ -22,6 +22,13 @@ clean_pkg() { fi } +script_lock + +for repo in ${PKGREPOS[@]}; do + for arch in ${ARCHES[@]}; do + repo_lock ${repo} ${arch} || exit 1 + done +done ${CLEANUP_DRYRUN} && warning 'dry run mode is active' diff --git a/cron-jobs/sourceballs b/cron-jobs/sourceballs index 91bc3d6..1542499 100755 --- a/cron-jobs/sourceballs +++ b/cron-jobs/sourceballs @@ -21,10 +21,10 @@ renice +10 -p $$ > /dev/null for repo in ${PKGREPOS[@]}; do for arch in ${ARCHES[@]}; do # Repo does not exist; skip it - if [ ! -f "${ARCH_BASE}/${repo}/os/${arch}/${repo}${DBEXT}" ]; then + if [ ! -f "${FTP_BASE}/${repo}/os/${arch}/${repo}${DBEXT}" ]; then continue fi - bsdtar -xOf "${ARCH_BASE}/${repo}/os/${arch}/${repo}${DBEXT}" \ + bsdtar -xOf "${FTP_BASE}/${repo}/os/${arch}/${repo}${DBEXT}" \ | awk '/^%NAME%/ { getline b }; /^%BASE%/ { getline b }; /^%VERSION%/ { getline v }; @@ -46,7 +46,7 @@ for repo in ${PKGREPOS[@]}; do done # Create a list of all available source package file names -find "${ARCH_BASE}/${SRCPOOL}" -xtype f -name "*${SRCEXT}" -printf '%f\n' | sort -u > "${WORKDIR}/available-src-pkgs" +find "${FTP_BASE}/${SRCPOOL}" -xtype f -name "*${SRCEXT}" -printf '%f\n' | sort -u > "${WORKDIR}/available-src-pkgs" # Check for all packages if we need to build a source package for repo in ${PKGREPOS[@]}; do @@ -59,7 +59,7 @@ for repo in ${PKGREPOS[@]}; do pkgarch=${pkginfo[2]} pkglicense=(${pkginfo[@]:3}) - # Should this packages be skipped? + # Should this package be skipped? if grep -Fqx "${pkgbase}" "${dirname}/sourceballs.skip"; then continue fi diff --git a/db-functions b/db-functions index 072f43d..0b59a53 100644 --- a/db-functions +++ b/db-functions @@ -135,7 +135,7 @@ repo_lock () { _count=0 while [ $_count -le $_trial ] || $_lockblock ; do if ! mkdir "$LOCKDIR" >/dev/null 2>&1 ; then - _owner="$(stat -c %U $LOCKDIR)" + _owner="$(/usr/bin/stat -c %U $LOCKDIR)" warning "Repo [${1}] (${2}) is already locked by $_owner. " msg2 "Retrying in $LOCK_DELAY seconds..." else @@ -250,9 +250,6 @@ getpkgfile() { } getpkgfiles() { -# Ignore anything that doesn't glob to PKGEXT - shopt -s nullglob - local f if [ ! -z "$(echo ${@%\.*} | sed "s/ /\n/g" | sort | uniq -D)" ]; then error 'Duplicate packages found!' @@ -270,8 +267,6 @@ getpkgfiles() { done echo ${@} - - shopt -u nullglob } check_pkgfile() { @@ -330,7 +325,7 @@ check_splitpkgs() { for pkgfile in ${pkgfiles[@]}; do issplitpkg "${pkgfile}" || continue local _pkgbase="$(getpkgbase ${pkgfile})" - msg2 "Checking $_pkgbase" + msg2 "Checking %s" "$_pkgbase" local _pkgname="$(getpkgname ${pkgfile})" local _pkgarch="$(getpkgarch ${pkgfile})" mkdir -p "${repo}/${_pkgarch}/${_pkgbase}" @@ -411,7 +406,7 @@ set_repo_permission() { local filesfile="${FTP_BASE}/${repo}/os/${arch}/${repo}${FILESEXT}" if [ -w "${dbfile}" ]; then - local group=$(stat --printf='%G' "$(dirname "${dbfile}")") + local group=$(/usr/bin/stat --printf='%G' "$(dirname "${dbfile}")") chgrp $group "${dbfile}" || error "Could not change group of ${dbfile} to $group" chgrp $group "${filesfile}" || error "Could not change group of ${filesfile} to $group" chmod g+w "${dbfile}" || error "Could not set write permission for group $group to ${dbfile}" @@ -428,9 +423,9 @@ arch_repo_add() { # package files might be relative to repo dir pushd "${FTP_BASE}/${repo}/os/${arch}" >/dev/null - repo-add -q "${repo}${DBEXT}" ${pkgs[@]} >/dev/null \ + /usr/bin/repo-add -q "${repo}${DBEXT}" ${pkgs[@]} >/dev/null \ || error "repo-add ${repo}${DBEXT} ${pkgs[@]}" - repo-add -f -q "${repo}${FILESEXT}" ${pkgs[@]} \ + /usr/bin/repo-add -f -q "${repo}${FILESEXT}" ${pkgs[@]} \ || error "repo-add -f ${repo}${FILESEXT} ${pkgs[@]}" popd >/dev/null set_repo_permission "${repo}" "${arch}" @@ -449,9 +444,9 @@ arch_repo_remove() { error "No database found at '${dbfile}'" return 1 fi - repo-remove -q "${dbfile}" ${pkgs[@]} >/dev/null \ + /usr/bin/repo-remove -q "${dbfile}" ${pkgs[@]} >/dev/null \ || error "repo-remove ${dbfile} ${pkgs[@]}" - repo-remove -q "${filesfile}" ${pkgs[@]} \ + /usr/bin/repo-remove -q "${filesfile}" ${pkgs[@]} \ || error "repo-remove ${filesfile} ${pkgs[@]}" set_repo_permission "${repo}" "${arch}" diff --git a/db-update b/db-update index 74d3f45..ca18ca3 100755 --- a/db-update +++ b/db-update @@ -52,10 +52,9 @@ for repo in ${repos[@]}; do die "Package ${repo}/${pkg##*/} already exists in another repository" fi done - # This is fucking obnoxious -# if ! check_splitpkgs ${repo} ${pkgs[@]}; then -# die "Missing split packages for ${repo}" -# fi + if ! check_splitpkgs ${repo} ${pkgs[@]}; then + die "Missing split packages for ${repo}" + fi else die "Could not read ${STAGING}" fi @@ -82,7 +81,7 @@ for repo in ${repos[@]}; do if [ -f "$FTP_BASE/${PKGPOOL}/${pkgfile}.sig" ]; then ln -s "../../../${PKGPOOL}/${pkgfile}.sig" "$FTP_BASE/$repo/os/${pkgarch}" fi - add_pkgs[${#add_pkgs[*]}]=${pkgfile} + add_pkgs[${#add_pkgs[*]}]=${pkgfile} done if [ ${#add_pkgs[@]} -ge 1 ]; then arch_repo_add "${repo}" "${pkgarch}" ${add_pkgs[@]} diff --git a/git-pbs b/git-pbs deleted file mode 100755 index b815863..0000000 --- a/git-pbs +++ /dev/null @@ -1,44 +0,0 @@ -#!/bin/bash - -_pkg=$1 - -mkdir -p $_pkg -pushd $_pkg - - -if [ ! -d .git ]; then -# Start a git repo for the package -# Add the remote origin -# Pull the package branch onto an unmodified branch - git init - git remote add arch git://projects.archlinux.org/svntogit/packages.git - -# Export the repository - touch .git/git-daemon-export-ok - -# Pass the -b flag to checkout to create the branches - extra="-b" -fi - -git checkout ${extra} upstream -git pull arch packages/$_pkg - -# Move PKGBUILD and files to the basedir -# Remove everything else from the repo -git checkout ${extra} master - -# This produces a lot of merging conflicts -git merge upstream - -# This apparently solves them -git mv trunk/* . -git rm -rf repos - -# Remove the actual files -rm -rf trunk repos - -# Commit everything -git commit -a -m "Converted to PBS" - -# Return to the repo -popd >/dev/null diff --git a/libremessages b/libremessages deleted file mode 100755 index 9fbbc2b..0000000 --- a/libremessages +++ /dev/null @@ -1,77 +0,0 @@ -# Copyright (c) 2006-2010 Pacman Development Team -# Copyright (c) 2002-2006 by Judd Vinet -# Copyright (c) 2005 by Aurelien Foret -# Copyright (c) 2006 by Miklos Vajna -# Copyright (c) 2005 by Christian Hamar -# Copyright (c) 2006 by Alex Smith -# Copyright (c) 2006 by Andras Voroskoi -# Copyright (c) 2011 by Joshua Haase -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 3 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program. If not, see . - -# gettext initialization -export TEXTDOMAIN='libretools' -export TEXTDOMAINDIR='/usr/share/locale' - -# check if messages are to be printed using color -unset ALL_OFF BOLD BLUE GREEN RED YELLOW - -if tput setaf 0 &>/dev/null; then - ALL_OFF="$(tput sgr0)" - BOLD="$(tput bold)" - BLUE="${BOLD}$(tput setaf 4)" - GREEN="${BOLD}$(tput setaf 2)" - RED="${BOLD}$(tput setaf 1)" - YELLOW="${BOLD}$(tput setaf 3)" - PURPLE="${ALL_OFF}$(tput setaf 5)" -else - ALL_OFF="\033[1;0m" - BOLD="\033[1;1m" - BLUE="${BOLD}\033[1;34m" - GREEN="${BOLD}\033[1;32m" - RED="${BOLD}\033[1;31m" - YELLOW="${BOLD}\033[1;33m" - PURPLE="${BOLD}\033[1;30;40m" -fi - -stdnull() { - local action=$1; - eval "${action} >/dev/null 2>&1" -} - -plain() { - local mesg=$1; shift - printf "${BOLD} ${mesg}${ALL_OFF}\n" "$@" >&2 -} - -msg() { - local mesg=$1; shift - printf "${GREEN}==>${ALL_OFF}${BOLD} ${mesg}${ALL_OFF}\n" "$@" >&2 -} - -msg2() { - local mesg=$1; shift - printf "${BLUE} ->${ALL_OFF}${BOLD} ${mesg}${ALL_OFF}\n" "$@" >&2 -} - -warning() { - local mesg=$1; shift - printf "${YELLOW}==> $(gettext "WARNING:")${ALL_OFF}${BOLD} ${mesg}${ALL_OFF}\n" "$@" >&2 -} - -error() { - local mesg=$1; shift - printf "${RED}==> $(gettext "ERROR:")${ALL_OFF}${BOLD} ${mesg}${ALL_OFF}\n" "$@" >&2 -} - -- cgit v1.2.3-2-g168b