summaryrefslogtreecommitdiff
path: root/src/diff-unfree
diff options
context:
space:
mode:
authorNicolás Reynolds <apoyosis@correo.inta.gob.ar>2012-11-30 01:00:18 -0300
committerNicolás Reynolds <apoyosis@correo.inta.gob.ar>2012-11-30 01:00:18 -0300
commitb021874d73c9dded2e05f2095efa5c3a6d23b496 (patch)
treeb2b9a7bd88f0476accd17d23c1ef53c7cc920be7 /src/diff-unfree
parent73b813613aa08646515f4e06c71503b18125cec3 (diff)
parentba312fb72ec0843297978796a20c6ffc1fe3ef6e (diff)
Merge branch 'master' of http://projects.parabolagnulinux.org/libretools
Conflicts: src/aur src/chroot-tools/librechroot src/librerepkg
Diffstat (limited to 'src/diff-unfree')
-rwxr-xr-xsrc/diff-unfree95
1 files changed, 48 insertions, 47 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 "$@"