#!/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 . . libremessages cmd=${0##*/} usage() { echo "Usage: $cmd [-h] pkgname-from-aur1 [pkgname-from-aur2 ...]" echo echo "This script will download packages from AUR to the current" echo "directory and check their license for nonfree issues. This does" echo "not mean that they are free; they may be incorrectly labeled, or" echo "have other freedom issues. It's a tool to help Parabola" echo "packagers, not to help users install things directly from AUR." } main() { while getopts 'h' arg; do case $arg in h) usage; return 0;; *) usage >&2; return 1;; esac done if [[ $# -lt 1 ]]; then usage >&2 return 1 fi . $(librelib conf.sh) load_files libretools check_vars libretools DIFFTOOL load_files abs check_vars abs ABSROOT local missing_deps=() for _pkg in "$@"; do # Remove the version _pkg="${_pkg%%[<>=]*}" if [[ -f "${_pkg}/PKGBUILD" ]]; then warning "${_pkg} already existed." # Store our copy of the PKGBUILD dir _diff="${PWD}/${_pkg}" pushd $(mktemp --tmpdir -d ${_pkg}.XXXX) &>/dev/null msg2 "Downloading PKGBUILD into ${PWD} for diff" fi msg "Downloading $_pkg..." local url=https://aur.archlinux.org/packages/${_pkg:0:2}/${_pkg}/$_pkg.tar.gz if ! wget -O - -q "$url" | tar xzf - >&2; then error "Couldn't get $_pkg" continue fi pushd $_pkg &>/dev/null 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 pushd "${_diff}" &>/dev/null 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 popd &>/dev/null done if [[ ${#missing_deps[*]} -gt 0 ]]; then msg2 "Retrieving missing deps: %s" "${missing_deps[*]}" "$0" "${missing_deps[@]}" fi } main "$@"