From e9bc885c355babf7851de31db8e1920dde752993 Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Wed, 7 Nov 2012 00:17:08 -0500 Subject: organize the files --- src/aur | 123 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 123 insertions(+) create mode 100755 src/aur (limited to 'src/aur') diff --git a/src/aur b/src/aur new file mode 100755 index 0000000..24d4317 --- /dev/null +++ b/src/aur @@ -0,0 +1,123 @@ +#!/bin/bash +# Copyright 2010 Nicolás Reynolds, Joshua Ismael + +# ---------- GNU General Public License 3 ---------- + +# 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 . + +source /etc/libretools.conf +source /etc/abs.conf + +function usage { + echo "Usage: $0 pkgname-from-aur1 [pkgname-from-aur2 ...]" + echo + echo "This script will download packages from aur to the current dir" + echo "and check their license for nonfree issues." +} + +while getopts 'h' arg; do + case $arg in + h) usage; exit 0 ;; + *) usage; exit 1 ;; + esac +done + +missing_deps=() +for _pkg in ${@}; do + +# Remove the version + _pkg="${_pkg%%[<>=]*}" + + if [ -f "${_pkg}/PKGBUILD" ]; then + warning "${_pkg} already existed." + +# Check if we want to diff + if [ -z "${DIFFTOOL}" ]; then + continue + else +# Store our copy of the PKGBUILD dir + _diff="${PWD}/${_pkg}" + stdnull "pushd $(mktemp -d /tmp/${_pkg}.XXXX)" + msg2 "Downloading PKGBUILD into ${PWD} for diff" + fi + fi + + msg "Downloading $_pkg..." + wget -O - -q https://aur.archlinux.org/packages/$(echo $_pkg | sed "s/^../&\/&/")/$_pkg.tar.gz | \ + tar xzf - >/dev/null 2>&1 + + if [ $? -ne 0 ]; then + error "Couldn't get $_pkg" + continue + fi + + stdnull "pushd $_pkg" + + if [ ! -z "$_diff" ]; then + msg2 "Diffing files" +# Diff all files with our difftool + for file in *; do + ${DIFFTOOL} ${_diff}/${file} ${file} + done + +# Go back to our copy to continue working + stdnull "pushd ${_diff}" + fi + + source PKGBUILD + + if ! pkgbuild-check-nonfree; then + if [ $? -eq 15 ]; then + warning "This PKGBUILD links to known unfree packages" + fi + fi + + msg2 "Checking license..." + free=0 + for _license in ${license[@]}; do + if [ ! -d /usr/share/licenses/common/$_license ]; then + warning "License $_license is not a common license" + free=1 + fi + done + + if [ $free -eq 1 ]; then + plain "Please check that the license is included in the package and + *specially* that it respects your freedom." + fi + + for _dep in ${depends[@]} ${makedepends[@]}; do + _dep=${_dep/[<>=]*/} + if ! is_built $_dep; then + if ! find ${ABSROOT} -maxdepth 2 -type d -name "$_dep" | egrep "*" >/dev/null ; then + msg2 "$_dep will be get from AUR" + missing_deps+=($_dep) + fi + else + msg2 "$_dep is on repos" + fi + done + + stdnull popd + +done + +[[ ${#missing_deps[*]} -gt 0 ]] && { + msg2 "Retrieving missing deps: ${missing_deps[@]}" + $0 ${missing_deps[@]} +} + +exit 0 -- cgit v1.2.3-54-g00ecf From a07049cd10c57d0df4497e389dd5b08631a10049 Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Tue, 13 Nov 2012 00:47:49 -0500 Subject: aur: use bash builtins instead of sed --- src/aur | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/aur') diff --git a/src/aur b/src/aur index 24d4317..f90a776 100755 --- a/src/aur +++ b/src/aur @@ -56,7 +56,7 @@ for _pkg in ${@}; do fi msg "Downloading $_pkg..." - wget -O - -q https://aur.archlinux.org/packages/$(echo $_pkg | sed "s/^../&\/&/")/$_pkg.tar.gz | \ + wget -O - -q https://aur.archlinux.org/packages/${_pkg:0:2}/${_pkg}/$_pkg.tar.gz | \ tar xzf - >/dev/null 2>&1 if [ $? -ne 0 ]; then -- cgit v1.2.3-54-g00ecf From 4e5d7c05ada2181ce0aa3bed0ba734f4e1ae70cb Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Wed, 28 Nov 2012 15:23:43 -0500 Subject: clean up aur --- src/aur | 214 +++++++++++++++++++++++++++++++++------------------------------- 1 file changed, 112 insertions(+), 102 deletions(-) (limited to 'src/aur') diff --git a/src/aur b/src/aur index f90a776..12efb81 100755 --- a/src/aur +++ b/src/aur @@ -2,122 +2,132 @@ # Copyright 2010 Nicolás Reynolds, Joshua Ismael # ---------- GNU General Public License 3 ---------- - + # 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 . -source /etc/libretools.conf -source /etc/abs.conf +. /etc/libretools.conf +. /etc/abs.conf + +cmd=${0##*/} -function usage { - echo "Usage: $0 pkgname-from-aur1 [pkgname-from-aur2 ...]" - echo - echo "This script will download packages from aur to the current dir" - echo "and check their license for nonfree issues." +usage() { + echo "Usage: $cmd pkgname-from-aur1 [pkgname-from-aur2 ...]" + echo + echo "This script will download packages from aur to the current dir" + echo "and check their license for nonfree issues." } -while getopts 'h' arg; do - case $arg in - h) usage; exit 0 ;; - *) usage; exit 1 ;; - esac -done - -missing_deps=() -for _pkg in ${@}; do - -# Remove the version - _pkg="${_pkg%%[<>=]*}" - - if [ -f "${_pkg}/PKGBUILD" ]; then - warning "${_pkg} already existed." - -# Check if we want to diff - if [ -z "${DIFFTOOL}" ]; then - continue - else -# Store our copy of the PKGBUILD dir - _diff="${PWD}/${_pkg}" - stdnull "pushd $(mktemp -d /tmp/${_pkg}.XXXX)" - msg2 "Downloading PKGBUILD into ${PWD} for diff" - fi - fi - - msg "Downloading $_pkg..." - wget -O - -q https://aur.archlinux.org/packages/${_pkg:0:2}/${_pkg}/$_pkg.tar.gz | \ - tar xzf - >/dev/null 2>&1 - - if [ $? -ne 0 ]; then - error "Couldn't get $_pkg" - continue - fi - - stdnull "pushd $_pkg" - - if [ ! -z "$_diff" ]; then - msg2 "Diffing files" -# Diff all files with our difftool - for file in *; do - ${DIFFTOOL} ${_diff}/${file} ${file} - done - -# Go back to our copy to continue working - stdnull "pushd ${_diff}" - fi - - source PKGBUILD - - if ! pkgbuild-check-nonfree; then - if [ $? -eq 15 ]; then - warning "This PKGBUILD links to known unfree packages" - fi - fi - - msg2 "Checking license..." - free=0 - for _license in ${license[@]}; do - if [ ! -d /usr/share/licenses/common/$_license ]; then - warning "License $_license is not a common license" - free=1 - fi - done - - if [ $free -eq 1 ]; then - plain "Please check that the license is included in the package and - *specially* that it respects your freedom." - fi - - for _dep in ${depends[@]} ${makedepends[@]}; do - _dep=${_dep/[<>=]*/} - if ! is_built $_dep; then - if ! find ${ABSROOT} -maxdepth 2 -type d -name "$_dep" | egrep "*" >/dev/null ; then - msg2 "$_dep will be get from AUR" - missing_deps+=($_dep) - fi - else - msg2 "$_dep is on repos" - fi - done - - stdnull popd - -done - -[[ ${#missing_deps[*]} -gt 0 ]] && { - msg2 "Retrieving missing deps: ${missing_deps[@]}" - $0 ${missing_deps[@]} +main() { + while getopts 'h' arg; do + case $arg in + h) usage; exit 0;; + *) usage; exit 1;; + esac + done + + local missing_deps=() + for _pkg in "$@"; do + + # Remove the version + _pkg="${_pkg%%[<>=]*}" + + if [[ -f "${_pkg}/PKGBUILD" ]]; then + warning "${_pkg} already existed." + + # Check if we want to diff + if [[ -z "${DIFFTOOL}" ]]; then + continue + else + # Store our copy of the PKGBUILD dir + _diff="${PWD}/${_pkg}" + stdnull "pushd $(mktemp --tmpdir -d ${_pkg}.XXXX)" + msg2 "Downloading PKGBUILD into ${PWD} for diff" + fi + fi + + msg "Downloading $_pkg..." + local url=https://aur.archlinux.org/packages/${_pkg:0:2}/${_pkg}/$_pkg.tar.gz + wget -O - -q "$url" | tar xzf - >/dev/null 2>&1 + + if [[ $? -ne 0 ]]; then + error "Couldn't get $_pkg" + continue + fi + + stdnull "pushd $_pkg" + + if [[ ! -z "$_diff" ]]; then + msg2 "Diffing files" + # Diff all files with our difftool + for file in *; do + "${DIFFTOOL}" "${_diff}/${file}" "${file}" + done + + # Go back to our copy to continue working + stdnull "pushd ${_diff}" + fi + + . PKGBUILD + + ################################################################ + + if ! pkgbuild-check-nonfree; then + if [[ $? = 15 ]]; then + warning "This PKGBUILD links to known unfree packages" + fi + fi + + ################################################################ + + msg2 "Checking license..." + local free=0 + for _license in ${license[@]}; do + if [[ ! -d /usr/share/licenses/common/$_license ]]; then + warning "License $_license is not a common license" + free=1 + fi + done + + if [[ $free -eq 1 ]]; then + plain "Please check that the license is included in the package and *specially* that it respects your freedom." + fi + + ################################################################ + + for _dep in "${depends[@]}" "${makedepends[@]}"; do + _dep=${_dep/[<>=]*/} + if ! is_built $_dep; then + if ! find ${ABSROOT} -maxdepth 2 -type d -name "$_dep" | egrep "*" >/dev/null ; then + msg2 "$_dep will be get from AUR" + missing_deps+=($_dep) + fi + else + msg2 "$_dep is on repos" + fi + done + + stdnull popd + done + + [[ ${#missing_deps[*]} -gt 0 ]] && { + msg2 "Retrieving missing deps: ${missing_deps[@]}" + $0 ${missing_deps[@]} + } + + exit 0 } -exit 0 +main "$@" -- cgit v1.2.3-54-g00ecf