summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rwxr-xr-xsrc/diff-unfree95
-rwxr-xr-xsrc/is_unfree5
-rwxr-xr-xsrc/librediff60
-rwxr-xr-xsrc/librerepkg73
4 files changed, 110 insertions, 123 deletions
diff --git a/src/diff-unfree b/src/diff-unfree
index a0a8d63..24ada67 100755
--- a/src/diff-unfree
+++ b/src/diff-unfree
@@ -20,66 +20,67 @@
# You should have received a copy of the GNU General Public License
# along with Parabola. If not, see <http://www.gnu.org/licenses/>.
-source /etc/libretools.conf
-custom_config=$XDG_CONFIG_HOME/libretools/libretools.conf
-
-[[ "$1" == "--help" ]] && {
- msg "Diff-Unfree helps you diff build scripts from ABSLibre against
- (Unfree) ABS. Package name and repo will we guessed if you don't
- specify them."
- msg2 "Usage: $0 [community|packages] [unfree-package] [repo]"
- exit 0
-}
+. /etc/libretools.conf
+
+cmd=${0##*/}
-[[ ! -r PKGBUILD ]] && {
- error "This is not a build dir."
- exit 1
+usage() {
+ echo "Usage: $cmd [community|packages] [unfree-package] [repo]"
+ echo "Usage: $cmd --help"
+ echo "Helps you diff build scripts from ABSLibre against (Unfree) ABS."
+ echo ""
+ echo "Package name and repo will we guessed if you don't specify them."
}
-package_guess=$(basename $PWD)
+main() {
+ if [[ "$1" == "--help" ]]; then
+ usage
+ exit 0
+ fi
-repo=${1:-$(basename $(dirname $PWD))}
-package=${2:-${package_guess/-libre}}
-trunk=${3:-trunk}
+ local package_guess=${PWD##*/}
+ local repo=${1:-$(basename ${PWD%/*})}
+ local package=${2:-${package_guess%-libre}}
+ local trunk=${3:-trunk}
-tmp_dir=$(mktemp -d /tmp/${package}.XXXXXX)
+ svnrepo="packages"
+ case $repo in
+ community*) svnrepo="community";;
+ multilib*) svnrepo="community";;
+ *) :;;
+ esac
-svnrepo="packages"
-case $repo in
- community*)
- svnrepo="community"
- ;;
- multilib*)
- svnrepo="community"
- ;;
- *)
- ;;
-esac
+ if [[ ! -r PKGBUILD ]]; then
+ error "This is not a build dir."
+ exit 1
+ fi
-unfree_dir="${tmp_dir}/${svnrepo}/${package}/${trunk}"
-[[ ! -d "${tmp_dir}" ]] && {
- error "Can't create temp dir"
- exit 1
-}
+ tmp_dir="$(mktemp --tmpdir -d ${package}.XXXXXX)"
+ if [[ ! -d "${tmp_dir}" ]]; then
+ error "Can't create temp dir"
+ exit 1
+ fi
+ unfree_dir="${tmp_dir}/${svnrepo}/${package}/${trunk}"
-stdnull 'pushd "${tmp_dir}"'
+ stdnull 'pushd "${tmp_dir}"'
-msg "Getting diff from $repo/$package..."
+ msg "Getting diff from $repo/$package..."
-stdnull 'svn checkout --depth=empty svn://svn.archlinux.org/$svnrepo'
+ stdnull 'svn checkout --depth=empty svn://svn.archlinux.org/$svnrepo'
-cd ${svnrepo}
-svn update ${package}
+ cd ${svnrepo}
+ svn update ${package}
-# Back to start dir
-stdnull popd
+ # Back to start dir
+ stdnull popd
-msg "Diffing files"
+ msg "Diffing files"
-for _file in ${unfree_dir}/*; do
- msg2 "$(basename "${_file}")"
- ${DIFFTOOL} "$PWD/$(basename "${_file}")" "${_file}"
-done
+ for _file in ${unfree_dir}/*; do
+ msg2 "$(basename "${_file}")"
+ ${DIFFTOOL} "$PWD/$(basename "${_file}")" "${_file}"
+ done
+}
-exit $?
+main "$@"
diff --git a/src/is_unfree b/src/is_unfree
index f32c193..c2a37c9 100755
--- a/src/is_unfree
+++ b/src/is_unfree
@@ -1,11 +1,8 @@
#!/bin/bash
# Checks if a package is on blacklist
-# fail immediately on error
-set -E
+. /etc/libretools.conf
blacklist="$XDG_CONFIG_HOME/libretools/blacklist.txt"
-
egrep -q "^${1}:" "${blacklist}"
-
exit $?
diff --git a/src/librediff b/src/librediff
index 1f39eb9..6dbe41b 100755
--- a/src/librediff
+++ b/src/librediff
@@ -20,46 +20,38 @@
# You should have received a copy of the GNU General Public License
# along with Parabola. If not, see <http://www.gnu.org/licenses/>.
-usage() {
- echo "Usage: $0 <pkgname> [<pkgname2> ...]"
- echo "Requirements:"
- echo "* Have a <pkgname>/ directory with nonfree build scripts inside"
- echo "* Have a <pkgname>-libre/ directory with libre build scripts inside"
-}
+. /etc/libretools.conf
-# Load custom config or system-wide config
-custom_config=$XDG_CONFIG_HOME/libretools/libretools.conf
-if [ -e $custom_config ]; then
- source $custom_config
-else
- source /etc/libretools.conf
-fi
+cmd=${0##*/}
-# Print usage if no package has been given
-[[ -z "$@" ]] && {
- usage
- exit 1
+usage() {
+ echo "Usage: $cmd <pkgname> [<pkgname2> ...]"
+ echo "Requirements:"
+ echo " * Have a <pkgname>/ directory with nonfree build scripts inside"
+ echo " * Have a <pkgname>-libre/ directory with libre build scripts inside"
}
+main() {
+ local packages=("$@")
+ if [[ ${packages[#]} = 0 ]]; then
+ usage
+ exit 1
+ fi
-for package in $@; do
-# Continue on errors
- [[ ! -d ./${package} || ! -d ./${package}-libre ]] && {
- error "no matching ${package} and ${package}-libre found"
- continue
- }
-
- [[ ! -f ./${package}/PKGBUILD || ! -f ./${package}-libre/PKGBUILD ]] && {
- error "no matching PKGBUILDs found for ${package}-libre"
- continue
- }
+ for package in "${packages[@]}"; do
+ if [[ ! -f ./${package}/PKGBUILD || ! -f ./${package}-libre/PKGBUILD ]]
+ then
+ error "Build scripts not found for ${package}(-libre)"
+ else
- source ./${package}-libre/PKGBUILD
- [[ -z ${pkgbase} ]] && pkgbase=${pkgname}
+ . ./${package}-libre/PKGBUILD
+ [[ -z ${pkgbase} ]] && pkgbase=${pkgname}
-# Generate a diff file, no -r since we don't want to patch src/ nor pkg/
- diff -auN ${package} ${package}-libre > $PATCHDIR/${pkgbase}-${pkgver}-${pkgrel}.patch
+ # Generate a diff file, no -r since we don't want to patch src/ nor pkg/
+ diff -auN ${package} ${package}-libre > $PATCHDIR/${pkgbase}-${pkgver}-${pkgrel}.patch
+ done
-done
+ exit 0
+}
-exit 0
+main "$@"
diff --git a/src/librerepkg b/src/librerepkg
index d506003..85c58d9 100755
--- a/src/librerepkg
+++ b/src/librerepkg
@@ -18,55 +18,52 @@
# You should have received a copy of the GNU General Public License
# along with Parabola. If not, see <http://www.gnu.org/licenses/>.
-source /etc/libretools.conf
-custom_config=$XDG_CONFIG_HOME/libretools/libretools.conf
-if [ -x $custom_config ]; then
- source $custom_config;
- unset $custom_config
-fi
-
-[[ ! -r rePKGBUILD ]] && {
- error "This build does not contains a rePKGBUILD."
- exit 1
-}
+. /etc/libretools.conf
+. /etc/makepkg.conf
+. /etc/abs.conf
-source /etc/makepkg.conf
-source /etc/abs.conf
-source rePKGBUILD
+cmd=${0##*/}
usage() {
- echo "cd to a dir with a rePKGBUILD and other file info and run"
- echo "$0 [makepkg flags]"
- echo
- echo "This script will repackage an arch package without compiling"
+ echo "cd to a dir with a rePKGBUILD and other file info and run"
+ echo "$cmd [makepkg flags]"
+ echo ""
+ echo "This script will repackage an arch package without compiling"
}
-while getopts 'h' arg; do
- case $arg in
- h) usage; exit 0 ;;
- esac
-done
-
-makepkgflags=$@
+main() {
+ while getopts 'h' arg; do
+ case $arg in
+ h) usage; exit 0 ;;
+ esac
+ done
+ makepkgflags=("$@")
-tempdir=$(mktemp -d /tmp/$(basename $PWD).XXXXX)
+ if [[ ! -r rePKGBUILD ]]; then
+ error "This build does not contains a rePKGBUILD."
+ exit 1
+ fi
+ . rePKGBUILD
-msg "Copying files"
-cp ./* ${tempdir}/
+ tempdir="$(mktemp --tmpdir -d ${PWD##*/}.XXXXX)"
-for _arch in ${arch[@]}; do
+ msg "Copying files"
+ cp ./* "${tempdir}/"
- msg "Repackaging: $pkgname $pkgver-$pkgrel ($(date -u))"
+ for _arch in "${arch[@]}"; do
+ msg "Repackaging: $pkgname $pkgver-$pkgrel ($(date -u))"
+ stdnull pushd "${tempdir}"
- stdnull pushd ${tempdir}
+ msg2 "Updating md5sums"
+ makepkg -gp rePKGBUILD >> rePKGBUILD
- msg2 "Updating md5sums"
- makepkg -gp rePKGBUILD >> rePKGBUILD
+ echo "export CARCH=${_arch}" >> rePKGBUILD
- echo "export CARCH=${_arch}" >> rePKGBUILD
+ msg "Repackaging using makepkg"
+ makepkg -Lcdp rePKGBUILD "${makepkgflags[@]}"
- msg "Repackaging using makepkg"
- makepkg -Lcdp rePKGBUILD ${makepkgflags}
+ stdnull popd "${tempdir}"
+ done
+}
- stdnull popd ${tempdir}
-done
+main "$@"