summaryrefslogtreecommitdiff
path: root/src/abslibre-tools
diff options
context:
space:
mode:
Diffstat (limited to 'src/abslibre-tools')
-rwxr-xr-xsrc/abslibre-tools/createworkdir20
-rwxr-xr-xsrc/abslibre-tools/diff-unfree14
-rwxr-xr-xsrc/abslibre-tools/libreaddiff10
-rwxr-xr-xsrc/abslibre-tools/librerelease77
-rwxr-xr-xsrc/abslibre-tools/librestage52
5 files changed, 109 insertions, 64 deletions
diff --git a/src/abslibre-tools/createworkdir b/src/abslibre-tools/createworkdir
index 4421ae2..8e5ebcd 100755
--- a/src/abslibre-tools/createworkdir
+++ b/src/abslibre-tools/createworkdir
@@ -1,28 +1,30 @@
#!/usr/bin/env bash
-set -euE
# CreateWorkDir
# Creates a dir structure for working with Parabola packages
-# Copyright 2010 Nicolás Reynolds
-# Copyright 2013 Luke Shumaker
-
-# ---------- GNU General Public License 3 ----------
-
+# Copyright (C) 2010-2011 Nicolás Reynolds <fauno@parabola.nu>
+# Copyright (C) 2011 Joshua Ismael Haase Hernández (xihh) <hahj87@gmail.com>
+# Copyright (C) 2013 Luke Shumaker <lukeshu@sbcglobal.net>
+#
+# License: GNU GPLv3+
+#
# This file is part of Parabola.
-
+#
# Parabola 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.
-
+#
# Parabola 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 Parabola. If not, see <http://www.gnu.org/licenses/>.
+set -euE
+
. libremessages
. $(librelib conf.sh)
load_files libretools
diff --git a/src/abslibre-tools/diff-unfree b/src/abslibre-tools/diff-unfree
index 1ef0649..fc32e77 100755
--- a/src/abslibre-tools/diff-unfree
+++ b/src/abslibre-tools/diff-unfree
@@ -1,22 +1,24 @@
#!/usr/bin/env bash
# This script will help you diff a *-libre PKGBUILD against the unfree one
# to check for updates.
-# Copyright 2010 Nicolás Reynolds
-
-# ---------- GNU General Public License 3 ----------
+# Copyright (C) 2010-2011 Nicolás Reynolds <fauno@parabola.nu>
+# Copyright (C) 2011 Joshua Ismael Haase Hernández (xihh) <hahj87@gmail.com>
+#
+# License: GNU GPLv3+
+#
# This file is part of Parabola.
-
+#
# Parabola 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.
-
+#
# Parabola 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 Parabola. If not, see <http://www.gnu.org/licenses/>.
diff --git a/src/abslibre-tools/libreaddiff b/src/abslibre-tools/libreaddiff
index ebd749d..3f8f8f4 100755
--- a/src/abslibre-tools/libreaddiff
+++ b/src/abslibre-tools/libreaddiff
@@ -1,7 +1,10 @@
#!/usr/bin/env bash
-set -e
# -*- coding: utf-8 -*-
-# Copyright (C) 2011, 2012 Michał Masłowski <mtjm@mtjm.eu>
+
+# Copyright (C) 2011-2012 Michał Masłowski <mtjm@mtjm.eu>
+# Copyright (C) 2012 Daniel Molina (lluvia)
+#
+# License: GNU GPLv3+
#
# 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
@@ -16,6 +19,9 @@ set -e
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
+set -e
+
+. libremessages
. $(librelib conf.sh)
load_files libretools
check_vars libretools WORKDIR
diff --git a/src/abslibre-tools/librerelease b/src/abslibre-tools/librerelease
index b77b6ec..03a57e0 100755
--- a/src/abslibre-tools/librerelease
+++ b/src/abslibre-tools/librerelease
@@ -2,23 +2,21 @@
# Librerelease
# Uploads packages into [staging]
-# Copyright 2010 Nicolás Reynolds
-# Copyright 2013 Luke Shumaker
+# Copyright (C) 2010-2012 Joshua Ismael Haase Hernández (xihh) <hahj87@gmail.com>
+# Copyright (C) 2010-2013 Nicolás Reynolds <fauno@parabola.nu>
+# Copyright (C) 2013 Michał Masłowski <mtjm@mtjm.eu>
+# Copyright (C) 2013-2014 Luke Shumaker <lukeshu@sbcglobal.net>
+#
# For just the create_signature() function:
-# Copyright (c) 2006-2013 Pacman Development Team <pacman-dev@archlinux.org>
-# Copyright (c) 2002-2006 by Judd Vinet <jvinet@zeroflux.org>
-# Copyright (c) 2005 by Aurelien Foret <orelien@chez.com>
-# Copyright (c) 2006 by Miklos Vajna <vmiklos@frugalware.org>
-# Copyright (c) 2005 by Christian Hamar <krics@linuxforum.hu>
-# Copyright (c) 2006 by Alex Smith <alex@alex-smith.me.uk>
-# Copyright (c) 2006 by Andras Voroskoi <voroskoi@frugalware.org>
-# Copyright (c) 2006-2013 Pacman Development Team <pacman-dev@archlinux.org>
-# Copyright (c) 2002-2006 by Judd Vinet <jvinet@zeroflux.org>
-# Copyright (c) 2005 by Aurelien Foret <orelien@chez.com>
-# Copyright (c) 2006 by Miklos Vajna <vmiklos@frugalware.org>
-# Copyright (c) 2005 by Christian Hamar <krics@linuxforum.hu>
-# Copyright (c) 2006 by Alex Smith <alex@alex-smith.me.uk>
-# Copyright (c) 2006 by Andras Voroskoi <voroskoi@frugalware.org>
+# Copyright (C) 2006-2013 Pacman Development Team <pacman-dev@archlinux.org>
+# Copyright (C) 2002-2006 Judd Vinet <jvinet@zeroflux.org>
+# Copyright (C) 2005 Aurelien Foret <orelien@chez.com>
+# Copyright (C) 2006 Miklos Vajna <vmiklos@frugalware.org>
+# Copyright (C) 2005 Christian Hamar <krics@linuxforum.hu>
+# Copyright (C) 2006 Alex Smith <alex@alex-smith.me.uk>
+# Copyright (C) 2006 Andras Voroskoi <voroskoi@frugalware.org>
+#
+# License: GNU GPLv3+
#
# This file is part of Parabola.
#
@@ -35,6 +33,9 @@
# You should have received a copy of the GNU General Public License
# along with Parabola. If not, see <http://www.gnu.org/licenses/>.
+# create_signature() is taken from pacman:makepkg, which is GPLv2+,
+# so we take the '+' to combine it with our GPLv3+.
+
. libremessages
. $(librelib conf.sh)
@@ -54,7 +55,8 @@ readonly rsync_flags=(
# Functions ####################################################################
list0_files() {
- find -L "${WORKDIR}/staging" -type f -print0 | xargs -0 realpath -z --relative-to="${WORKDIR}/staging"
+ find -L "${WORKDIR}/staging" -type f \
+ -exec realpath -z --relative-to="${WORKDIR}/staging" {} +
}
# This function is taken almost verbatim from makepkg
@@ -84,30 +86,23 @@ sign_packages() {
warning "It's better to have \`%s\` running to sign packages in batches" 'gpg-agent --daemon'
fi
- for package in $(find "${WORKDIR}/staging/" -type f -iname '*.pkg.tar.?z'); do
- if [[ -f "${package}.sig" ]]; then
- msg2 "Package signature found, verifying..."
+ for file in $(find "${WORKDIR}/staging/" -type f -not -iname '*.sig'); do
+ if [[ -f "${file}.sig" ]]; then
+ msg2 "File signature found, verifying..."
# Verify that the signature is correct, else remove for re-signing
- if ! gpg --quiet --verify "${package}.sig" >/dev/null 2>&1; then
+ if ! gpg --quiet --verify "${file}.sig" >/dev/null 2>&1; then
error "Failed! Re-signing..."
- rm -f "${package}.sig"
+ rm -f "${file}.sig"
fi
fi
- if ! [[ -f "${package}.sig" ]]; then
- create_signature "$package" || return 2
+ if ! [[ -f "${file}.sig" ]]; then
+ create_signature "$file" || return 2
fi
done
}
-# Remove everything that's not a package or a signature
-clean_non_packages() {
- find $WORKDIR/staging/ -type f \
- \! -iname "*.pkg.tar.?z" -a \! -iname "*.pkg.tar.?z.sig" \
- -delete
-}
-
# Clean everything if not on dry-run mode
clean_files() {
local file_list=$1
@@ -118,7 +113,9 @@ clean_files() {
fi
msg "Removing files from local staging directory"
- cd "${WORKDIR}/staging" && xargs -0 -a "$file_list" "${rmcmd[@]}"
+ cd "${WORKDIR}/staging" && xargs -0r -a "$file_list" "${rmcmd[@]}"
+ cd "${WORKDIR}/staging" && find . -mindepth 1 -type d -empty \
+ -exec rmdir -p {} + 2>/dev/null
}
################################################################################
@@ -153,12 +150,12 @@ main() {
u) upload_only=true ;;
n) dryrun="--dry-run" ;;
h) mode=usage ;;
- *) usage >/dev/stderr; return 1 ;;
+ *) usage >&2; return 1 ;;
esac
done
shift $(($OPTIND - 1))
if [[ $# != 0 ]]; then
- usage >/dev/stderr
+ usage >&2
return 1
fi
@@ -181,10 +178,11 @@ main() {
# The different modes (sans 'usage') ###########################################
pretty_print_packages() {
- find "$WORKDIR/staging/" -mindepth 1 -type d -not -empty -printf '%f\n' | sort |
- while read -r repo; do
- msg2 "$repo"
- find -L "${WORKDIR}/staging/${repo}" -type f -printf "%f\n" | sort
+ find "$WORKDIR/staging/" -mindepth 1 -maxdepth 1 -type d -not -empty | sort |
+ while read -r path; do
+ msg2 "${path##*/}"
+ cd "$path"
+ find -L . -type f | sed 's|^\./| |' | sort
done
}
@@ -211,7 +209,6 @@ release_packages() {
lock 10 "${WORKDIR}/staging.lock" \
'Waiting for an exclusive lock on the staging directory'
- clean_non_packages
sign_packages || return 1
# Make the permissions of the packages 644 otherwise the user will get access
@@ -228,7 +225,7 @@ release_packages() {
msg "%s to upload" "$(cd "${WORKDIR}/staging" && du -hc --files0-from="$file_list" | sed -n '$s/\t.*//p')"
msg "Uploading packages..."
- xargs -0 -a "$file_list" dirname -z | ssh ${REPODEST%%:*} "$(printf 'mkdir -p -- %q && cd %q && xargs -0 mkdir -pv --' "${REPODEST#*:}" "${REPODEST#*:}")"
+ xargs -0r -a "$file_list" dirname -z | ssh ${REPODEST%%:*} "$(printf 'mkdir -p -- %q && cd %q && xargs -0r mkdir -pv --' "${REPODEST#*:}" "${REPODEST#*:}")"
if ! rsync ${dryrun} "${rsync_flags[@]}" \
-0 --files-from="$file_list" \
${WORKDIR}/staging \
diff --git a/src/abslibre-tools/librestage b/src/abslibre-tools/librestage
index 6bbe80e..1e208c9 100755
--- a/src/abslibre-tools/librestage
+++ b/src/abslibre-tools/librestage
@@ -2,8 +2,11 @@
# LibreStage
# Prepares packages for upload
-# Copyright 2010-2011 Nicolás Reynolds
-# Copyright 2013 Luke Shumaker
+# Copyright (C) 2010-2012 Nicolás Reynolds <fauno@parabola.nu>
+# Copyright (C) 2011 Joshua Ismael Haase Hernández (xihh) <hahj87@gmail.com>
+# Copyright (C) 2013-2014 Luke Shumaker <lukeshu@sbcglobal.net>
+#
+# License: GNU GPLv3+
#
# This file is part of Parabola.
#
@@ -42,12 +45,12 @@ main() {
while getopts 'h' arg; do
case $arg in
h) usage; return 0;;
- *) usage >/dev/stderr; return 1;;
+ *) usage >&2; return 1;;
esac
done
repos=("$@")
if [[ ${#repos[@]} -eq 0 ]]; then
- usage >>/dev/stderr
+ usage >&2
return 1;
fi
@@ -59,7 +62,8 @@ main() {
# Load configuration
load_files libretools
check_vars libretools WORKDIR ARCHES || return 1
- load_files makepkg # for PKGDEST, which is optional
+ load_files makepkg # for PKGDEST and SRCDEST, which are optional
+ load_files librefetch # for MIRRORS, which is optional
# Load the PKGBUILD
load_PKGBUILD
@@ -79,7 +83,7 @@ main() {
pkgpath="$(readlink -f "$pkgpath")"
fi
- msg 'Found %s' "${pkgfile}"
+ msg 'Found package: %s' "${pkgfile}"
canonical="" # is empty for the first iteration, set after that
for repo in "${repos[@]}"; do
@@ -101,10 +105,44 @@ main() {
done
done
+ for netfile in "${source[@]}"; do
+ for mirror in "${MIRRORS[@]}"; do
+ srcurl=${netfile#*::}
+ if [[ "$srcurl" == "$mirror"* ]]; then
+ if [[ $netfile = *::* ]]; then
+ srcname=${netfile%%::*}
+ else
+ srcname=${netfile##*/}
+ fi
+
+ srcpath=''
+ for path in "./$srcname" "${SRCDEST:-.}/$srcname"; do
+ if [[ -f "$path" ]]; then
+ srcpath="$path"
+ break
+ fi
+ done
+ if [[ -n "$srcpath" ]]; then
+ msg "Found generated source file: %s" "$srcname"
+ dest="${WORKDIR}/staging/other/${srcurl##"$mirror"}"
+ mkdir -p -- "${dest%/*}"
+ if cp "$srcpath" "$dest"; then
+ msg2 "%s staged on [%s]" "$srcname" other
+ staged=true
+ else
+ error "Can't put %s on [%s]" "$srcname" other
+ return 1
+ fi
+ fi
+ break
+ fi
+ done
+ done
+
if $staged ; then
return 0
else
- error "No package was staged"
+ error "Nothing was staged"
return 1
fi
}