summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--config29
-rw-r--r--config.local.gerolde4
-rw-r--r--config.local.sigurd4
-rwxr-xr-xcron-jobs/sourceballs28
-rw-r--r--cron-jobs/sourceballs292
-rw-r--r--db-functions33
-rwxr-xr-xdb-update9
7 files changed, 150 insertions, 49 deletions
diff --git a/config b/config
index 89e3633..89a709e 100644
--- a/config
+++ b/config
@@ -1,34 +1,31 @@
-FTP_BASE="/srv/ftp"
-SVNREPO=''
-PKGREPOS=()
-PKGPOOL=''
-SRCPOOL=''
+FTP_BASE="/home/parabolavnx/parabolagnulinux.org/free"
+ARCH_BASE="/home/parabolavnx/parabolagnulinux.org/repo"
+SVNREPO="/home/parabolavnx/parabolagnulinux.org/abslibre"
+PKGREPOS=('core' 'extra' 'community' 'libre' 'libre-testing' 'social' 'sugar' 'testing')
+PKGPOOL='pool/packages'
+SRCPOOL='sources/packages'
-CLEANUP_DESTDIR="/srv/package-cleanup"
+CLEANUP_DESTDIR="$FTP_BASE/old/packages"
CLEANUP_DRYRUN=false
# Time in days to keep moved packages
CLEANUP_KEEP=30
-SOURCE_CLEANUP_DESTDIR="/srv/source-cleanup"
+SOURCE_CLEANUP_DESTDIR="$FTP_BASE/old/sources"
SOURCE_CLEANUP_DRYRUN=false
# Time in days to keep moved sourcepackages
-SOURCE_CLEANUP_KEEP=14
+SOURCE_CLEANUP_KEEP=30
REQUIRE_SIGNATURE=false
LOCK_DELAY=10
LOCK_TIMEOUT=300
-STAGING="$HOME/staging"
-TMPDIR="/srv/tmp"
-ARCHES=(i686 x86_64)
+STAGING="$FTP_BASE/staging"
+TMPDIR="$HOME/tmp"
+ARCHES=(i686 x86_64 mipsel)
DBEXT=".db.tar.gz"
FILESEXT=".files.tar.gz"
PKGEXT=".pkg.tar.?z"
SRCEXT=".src.tar.gz"
-# Allowed licenses: get sourceballs only for licenses in this array
-ALLOWED_LICENSES=('GPL' 'GPL1' 'GPL2' 'LGPL' 'LGPL1' 'LGPL2' 'LGPL2.1')
-
-# Override default config with config.local
-[ -f "$(dirname ${BASH_SOURCE[0]})/config.local" ] && . "$(dirname ${BASH_SOURCE[0]})/config.local"
+MAKEPKGCONF="$HOME/etc/makepkg.conf"
diff --git a/config.local.gerolde b/config.local.gerolde
deleted file mode 100644
index 4501a93..0000000
--- a/config.local.gerolde
+++ /dev/null
@@ -1,4 +0,0 @@
-PKGREPOS=('core' 'extra' 'testing' 'staging' 'kde-unstable' 'gnome-unstable')
-PKGPOOL='pool/packages'
-SRCPOOL='sources/packages'
-SVNREPO='file:///srv/svn-packages'
diff --git a/config.local.sigurd b/config.local.sigurd
deleted file mode 100644
index d28aa37..0000000
--- a/config.local.sigurd
+++ /dev/null
@@ -1,4 +0,0 @@
-PKGREPOS=('community' 'community-testing' 'community-staging' 'multilib' 'multilib-testing')
-PKGPOOL='pool/community'
-SRCPOOL='sources/community'
-SVNREPO='file:///srv/svn-packages'
diff --git a/cron-jobs/sourceballs b/cron-jobs/sourceballs
index b55de05..5726484 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 "${FTP_BASE}/${repo}/os/${arch}/${repo}${DBEXT}" ]; then
+ if [ ! -f "${ARCH_BASE}/${repo}/os/${arch}/${repo}${DBEXT}" ]; then
continue
fi
- bsdtar -xOf "${FTP_BASE}/${repo}/os/${arch}/${repo}${DBEXT}" \
+ bsdtar -xOf "${ARCH_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 "${FTP_BASE}/${SRCPOOL}" -xtype f -name "*${SRCEXT}" -printf '%f\n' | sort -u > "${WORKDIR}/available-src-pkgs"
+find "${ARCH_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,14 +59,15 @@ for repo in ${PKGREPOS[@]}; do
pkgarch=${pkginfo[2]}
pkglicense=(${pkginfo[@]:3})
- # Should this package be skipped?
+ # Should this packages be skipped?
if grep -Fqx "${pkgbase}" "${dirname}/sourceballs.skip"; then
continue
fi
+ # Commenting out, we'll sourceball everything
# Check if the license or .force file does not enforce creating a source package
- if ! (chk_license ${pkglicense[@]} || grep -Fqx "${pkgbase}" "${dirname}/sourceballs.force"); then
- continue
- fi
+# if ! (chk_license ${pkglicense[@]} || grep -Fqx "${pkgbase}" "${dirname}/sourceballs.force"); then
+# continue
+# fi
# Store the expected file name of the source package
echo "${pkgbase}-${pkgver}${SRCEXT}" >> "${WORKDIR}/expected-src-pkgs"
@@ -79,8 +80,13 @@ for repo in ${PKGREPOS[@]}; do
# Get the sources from svn
mkdir -p "${WORKDIR}/pkgbuilds/${repo}-${pkgarch}"
- svn export -q "${SVNREPO}/${pkgbase}/repos/${repo}-${pkgarch}" \
- "${WORKDIR}/pkgbuilds/${repo}-${pkgarch}/${pkgbase}" >/dev/null 2>&1
+ #svn export -q "${SVNREPO}/${pkgbase}/repos/${repo}-${pkgarch}" \
+ # "${WORKDIR}/pkgbuilds/${repo}-${pkgarch}/${pkgbase}" >/dev/null 2>&1
+
+ # If it's on official repos, nor [libre], nor [libre-testing]
+ cp -r "${SVNREPO}/$repo/${pkgbase}" "${WORKDIR}/pkgbuilds/${repo}-${pkgarch}/" >/dev/null 2>&1 || \
+ cp -r "${SVNREPO}/libre/${pkgbase}" "${WORKDIR}/pkgbuilds/${repo}-${pkgarch}/" >/dev/null 2>&1 || \
+ cp -r "${SVNREPO}/libre-testing/${pkgbase}" "${WORKDIR}/pkgbuilds/${repo}-${pkgarch}/" >/dev/null 2>&1
if [ $? -ge 1 ]; then
failedpkgs[${#failedpkgs[*]}]="${pkgbase}-${pkgver}${SRCEXT}"
continue
@@ -90,7 +96,7 @@ for repo in ${PKGREPOS[@]}; do
pushd "${WORKDIR}/pkgbuilds/${repo}-${pkgarch}/${pkgbase}" >/dev/null
makepkg --nocolor --allsource --ignorearch >/dev/null 2>&1
if [ $? -eq 0 ] && [ -f "${pkgbase}-${pkgver}${SRCEXT}" ]; then
- mv "${pkgbase}-${pkgver}${SRCEXT}" "${FTP_BASE}/${SRCPOOL}"
+ mv "${pkgbase}-${pkgver}${SRCEXT}" "${ARCH_BASE}/${SRCPOOL}"
# Avoid creating the same source package for every arch
echo "${pkgbase}-${pkgver}${SRCEXT}" >> "${WORKDIR}/available-src-pkgs"
newpkgs[${#newpkgs[*]}]="${pkgbase}-${pkgver}${SRCEXT}"
@@ -126,7 +132,7 @@ if [ ${#old_pkgs[@]} -ge 1 ]; then
for old_pkg in ${old_pkgs[@]}; do
msg2 "${old_pkg}"
if ! ${SOURCE_CLEANUP_DRYRUN}; then
- mv "$FTP_BASE/${SRCPOOL}/${old_pkg}" "${SOURCE_CLEANUP_DESTDIR}"
+ mv "$ARCH_BASE/${SRCPOOL}/${old_pkg}" "${SOURCE_CLEANUP_DESTDIR}"
touch "${SOURCE_CLEANUP_DESTDIR}/${old_pkg}"
fi
done
diff --git a/cron-jobs/sourceballs2 b/cron-jobs/sourceballs2
new file mode 100644
index 0000000..b70f417
--- /dev/null
+++ b/cron-jobs/sourceballs2
@@ -0,0 +1,92 @@
+#!/bin/bash
+# Steps
+# Traverse ABSLibre
+# Makepkg --allsource every package
+# Remove the old sourceballs
+
+dirname="$(dirname $(readlink -e $0))"
+. "${dirname}/../db-functions"
+. "${dirname}/../config"
+. "${MAKEPKGCONF}"
+
+pushd "${WORKDIR}" >/dev/null
+
+script_lock
+
+#adjust the nice level to run at a lower priority
+renice +10 -p $$ > /dev/null
+
+# 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"
+
+pushd "${SVNREPO}" >/dev/null
+
+for repo in ${PKGREPOS[@]}; do
+ failedpkgs=()
+
+ pushd $repo >/dev/null
+ find . -maxdepth 1 -type d | while read pkg; do
+ pushd "${SVNREPO}/$repo/$pkg" >/dev/null
+
+ [[ ! -e PKGBUILD ]] && {
+ warning "$repo/$pkg is not a package"
+ continue
+ }
+
+ unset pkgbase pkgname
+ source PKGBUILD
+ pkgbase=${pkgbase:-$pkgname}
+
+ echo "${pkgbase}-${pkgver}-${pkgrel}${SRCEXT}" >> "${WORKDIR}/expected-src-pkgs"
+
+ # Skip already sourceballed
+ [[ -e "${SRCPKGDEST}/${pkgbase}-${pkgver}-${pkgrel}${SRCEXT}" ]] && \
+ continue
+
+ msg2 "$pkgbase-$pkgver-$pkgrel..."
+ makepkg --allsource --ignorearch -c
+
+ [[ $? -ne 0 ]] && {
+ warning "Failed."
+ failedpkgs[${#failedpkgs[*]}]="${pkgbase}-${pkgver}-${pkgrel}${SRCEXT}"
+ }
+
+ done
+ popd >/dev/null
+
+ if [ ${#failedpkgs[@]} -ge 1 ]; then
+ msg "Failed to create source packages for [${repo}]..."
+ for failed_pkg in ${failedpkgs[@]}; do
+ msg2 "${failed_pkg}"
+ done
+ fi
+done
+
+# Cleanup old source packages
+cat "${WORKDIR}/expected-src-pkgs" | sort -u > "${WORKDIR}/expected-src-pkgs.sort"
+cat "${WORKDIR}/available-src-pkgs" | sort -u > "${WORKDIR}/available-src-pkgs.sort"
+old_pkgs=($(comm -23 "${WORKDIR}/available-src-pkgs.sort" "${WORKDIR}/expected-src-pkgs.sort"))
+
+if [ ${#old_pkgs[@]} -ge 1 ]; then
+ msg "Removing old source packages..."
+ ${SOURCE_CLEANUP_DRYRUN} && warning 'dry run mode is active'
+ for old_pkg in ${old_pkgs[@]}; do
+ msg2 "${old_pkg}"
+ if ! ${SOURCE_CLEANUP_DRYRUN}; then
+ mv "$ARCH_BASE/${SRCPOOL}/${old_pkg}" "${SOURCE_CLEANUP_DESTDIR}"
+ touch "${SOURCE_CLEANUP_DESTDIR}/${old_pkg}"
+ fi
+ done
+fi
+
+old_pkgs=($(find ${SOURCE_CLEANUP_DESTDIR} -type f -name "*${SRCEXT}" -mtime +${SOURCE_CLEANUP_KEEP} -printf '%f\n'))
+if [ ${#old_pkgs[@]} -ge 1 ]; then
+ msg "Removing old source packages from the cleanup directory..."
+ for old_pkg in ${old_pkgs[@]}; do
+ msg2 "${old_pkg}"
+ ${SOURCE_CLEANUP_DRYRUN} || rm -f "${SOURCE_CLEANUP_DESTDIR}/${old_pkg}"
+ done
+fi
+
+script_unlock
+
diff --git a/db-functions b/db-functions
index a3e2168..9818cd2 100644
--- a/db-functions
+++ b/db-functions
@@ -1,5 +1,7 @@
#!/bin/bash
+. config
+
# Some PKGBUILDs need CARCH to be set
CARCH="x86_64"
@@ -16,7 +18,7 @@ restore_umask () {
}
# set up general environment
-WORKDIR=$(mktemp -d /tmp/$(basename $0).XXXXXXXXXX)
+WORKDIR=$(mktemp -d ${TMPDIR}/$(basename $0).XXXXXXXXXX)
LOCKS=()
# check if messages are to be printed using color
@@ -87,7 +89,7 @@ get_full_version() {
script_lock() {
local LOCKDIR="$TMPDIR/.scriptlock.$(basename $0)"
if ! mkdir "$LOCKDIR" >/dev/null 2>&1 ; then
- local _owner="$(/usr/bin/stat -c %U $LOCKDIR)"
+ local _owner="$(stat -c %U $LOCKDIR)"
error "Script $(basename $0) is already locked by $_owner."
exit 1
else
@@ -178,7 +180,7 @@ repo_lock () {
_count=0
while [ $_count -le $_trial ] || $_lockblock ; do
if ! mkdir "$LOCKDIR" >/dev/null 2>&1 ; then
- _owner="$(/usr/bin/stat -c %U $LOCKDIR)"
+ _owner="$(stat -c %U $LOCKDIR)"
warning "Repo [${1}] (${2}) is already locked by $_owner. "
msg2 "Retrying in $LOCK_DELAY seconds..."
else
@@ -211,7 +213,7 @@ repo_unlock () { #repo_unlock <repo-name> <arch>
_grep_pkginfo() {
local _ret
- _ret="$(/usr/bin/bsdtar -xOqf "$1" .PKGINFO | /bin/grep -m 1 "^${2} = ")"
+ _ret="$(bsdtar -xOqf "$1" .PKGINFO | /bin/grep -m 1 "^${2} = ")"
echo "${_ret#${2} = }"
}
@@ -375,6 +377,7 @@ check_splitpkgs() {
for pkgfile in ${pkgfiles[@]}; do
issplitpkg "${pkgfile}" || continue
local _pkgbase="$(getpkgbase ${pkgfile})"
+ msg2 "Checking $_pkgbase"
local _pkgname="$(getpkgname ${pkgfile})"
local _pkgarch="$(getpkgarch ${pkgfile})"
mkdir -p "${repo}/${_pkgarch}/${_pkgbase}"
@@ -382,9 +385,15 @@ check_splitpkgs() {
if [ ! -f "${WORKDIR}/pkgbuilds/${repo}-${_pkgarch}/${_pkgbase}" ]; then
mkdir -p "${WORKDIR}/pkgbuilds/${repo}-${_pkgarch}"
- svn export -q "${SVNREPO}/${_pkgbase}/repos/${repo}-${_pkgarch}/PKGBUILD" \
- "${WORKDIR}/pkgbuilds/${repo}-${_pkgarch}/${_pkgbase}" >/dev/null
- [ $? -ge 1 ] && return 1
+
+ cp -r ${SVNREPO}/$repo/$_pkgbase/PKGBUILD "${WORKDIR}/pkgbuilds/${repo}-${_pkgarch}/${_pkgbase}" >/dev/null 2>&1 || \
+ cp -r ${SVNREPO}/libre/$_pkgbase/PKGBUILD "${WORKDIR}/pkgbuilds/${repo}-${_pkgarch}/${_pkgbase}" >/dev/null 2>&1 || \
+ cp -r ${SVNREPO}/libre-testing/$_pkgbase/PKGBUILD "${WORKDIR}/pkgbuilds/${repo}-${_pkgarch}/$_pkgbase">/dev/null 2>&1
+
+ [[ $? -ge 1 ]] && {
+ echo "Failed $_pkgbase-$_pkgver-$_pkgarch"
+ return 1
+ }
fi
local svnnames=($(. "${WORKDIR}/pkgbuilds/${repo}-${_pkgarch}/${_pkgbase}"; echo ${pkgname[@]}))
@@ -473,7 +482,7 @@ set_repo_permission() {
local filesfile="${FTP_BASE}/${repo}/os/${arch}/${repo}${FILESEXT}"
if [ -w "${dbfile}" ]; then
- local group=$(/usr/bin/stat --printf='%G' "$(dirname "${dbfile}")")
+ local group=$(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}"
@@ -490,7 +499,11 @@ arch_repo_add() {
# package files might be relative to repo dir
pushd "${FTP_BASE}/${repo}/os/${arch}" >/dev/null
+<<<<<<< HEAD
+ repo-add -q "${repo}${DBEXT}" ${pkgs[@]} >/dev/null \
+=======
/usr/bin/repo-add -q "${repo}${DBEXT}" ${pkgs[@]} \
+>>>>>>> 1ce0c6368d0908e25f9bd1bb8183b5f29053fac8
|| error "repo-add ${repo}${DBEXT} ${pkgs[@]}"
/usr/bin/repo-add -f -q "${repo}${FILESEXT}" ${pkgs[@]} \
|| error "repo-add -f ${repo}${FILESEXT} ${pkgs[@]}"
@@ -509,7 +522,11 @@ arch_repo_remove() {
error "No database found at '${dbfile}'"
return 1
fi
+<<<<<<< HEAD
+ repo-remove -q "${dbfile}" ${pkgs[@]} >/dev/null \
+=======
/usr/bin/repo-remove -q "${dbfile}" ${pkgs[@]} \
+>>>>>>> 1ce0c6368d0908e25f9bd1bb8183b5f29053fac8
|| error "repo-remove ${dbfile} ${pkgs[@]}"
/usr/bin/repo-remove -q "${filesfile}" ${pkgs[@]} \
|| error "repo-remove ${filesfile} ${pkgs[@]}"
diff --git a/db-update b/db-update
index 4b9c78f..6bd0209 100755
--- a/db-update
+++ b/db-update
@@ -35,12 +35,9 @@ for repo in ${repos[@]}; do
if ! check_pkgfile "${pkg}"; then
die "Package ${repo}/$(basename ${pkg}) is not consistent with its meta data"
fi
- if ! check_pkgsvn "${pkg}" "${repo}"; then
- die "Package ${repo}/$(basename ${pkg}) is not consistent with svn repository"
- fi
- if ! check_pkgrepos "${pkg}"; then
- die "Package ${repo}/$(basename ${pkg}) already exists in another repository"
- fi
+ #if ! check_pkgrepos "${pkg}"; then
+ # die "Package ${repo}/$(basename ${pkg}) already exists in another repository"
+ #fi
done
if ! check_splitpkgs ${repo} ${pkgs[@]}; then
die "Missing split packages for ${repo}"