[pacman-contrib] [GIT] branch master updated (e9930ec -> 8effb41)
This is an automated email from the git hooks/post-receive script. demize pushed a change to branch master in repository pacman-contrib. from e9930ec checkupdates: Make sure spaces in DBPath are handled new 95ba86e Migrate pacsearch new d4fd3f1 src/Makefile.am: Add lib dependencies to targets new 93f372d configure.ac: add missing SIZECMD new 8effb41 paccache: Exit when privilege escalation fails The 4 revisions listed above as "new" are entirely new to this repository and will be described in separate emails. The revisions listed as "add" were already present in the repository and have only been added to this reference. Graph of new commits: * 8effb41 (HEAD -> master) paccache: Exit when privilege escalation fails * 93f372d configure.ac: add missing SIZECMD * d4fd3f1 src/Makefile.am: Add lib dependencies to targets * 95ba86e Migrate pacsearch Detailed log of new commits: commit 8effb4140d7b39e4196c14d54834c632833daa00 Author: Johannes Löthberg <johannes@kyriasis.com> Date: Wed Oct 12 11:57:55 2016 +0200 paccache: Exit when privilege escalation fails Pipelines run in subshells, so we need to set errexit for privilege escalation failing to exit the script properly. Fixes FS#44850. Signed-off-by: Johannes Löthberg <johannes@kyriasis.com> commit 93f372d08b669c188bf46c2c1bd5d8f5aa1d28ff Author: Johannes Löthberg <johannes@kyriasis.com> Date: Wed Oct 12 11:57:45 2016 +0200 configure.ac: add missing SIZECMD Signed-off-by: Johannes Löthberg <johannes@kyriasis.com> commit d4fd3f1a2691597972cd5c6fb73db91391deade9 Author: Johannes Löthberg <johannes@kyriasis.com> Date: Wed Oct 12 11:24:35 2016 +0200 src/Makefile.am: Add lib dependencies to targets Signed-off-by: Johannes Löthberg <johannes@kyriasis.com> commit 95ba86e3f8dfeabc8729488081797f85313adcdd Author: Johannes Löthberg <johannes@kyriasis.com> Date: Wed Oct 12 11:21:24 2016 +0200 Migrate pacsearch Signed-off-by: Johannes Löthberg <johannes@kyriasis.com> Summary of changes: configure.ac | 3 ++ src/Makefile.am | 29 +++++++----- src/paccache.sh.in | 3 ++ src/pacsearch.pl.in | 125 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 149 insertions(+), 11 deletions(-) create mode 100644 src/pacsearch.pl.in -- To stop receiving notification emails like this one, please contact the administrator of this repository.
This is an automated email from the git hooks/post-receive script. demize pushed a commit to branch master in repository pacman-contrib. View the commit online: https://git.archlinux.org/pacman-contrib.git/commit/?id=95ba86e3f8dfeabc8729... commit 95ba86e3f8dfeabc8729488081797f85313adcdd Author: Johannes Löthberg <johannes@kyriasis.com> AuthorDate: Wed Oct 12 11:21:24 2016 +0200 Migrate pacsearch Signed-off-by: Johannes Löthberg <johannes@kyriasis.com> --- src/Makefile.am | 23 ++++++---- src/pacsearch.pl.in | 125 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 140 insertions(+), 8 deletions(-) diff --git a/src/Makefile.am b/src/Makefile.am index 6c08885..1849d7a 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -26,9 +26,12 @@ BASHSCRIPTS = \ rankmirrors \ updpkgsums +PERLSCRIPTS = \ + pacsearch + OURSCRIPTS = \ $(BASHSCRIPTS) \ - $(OTHERSCRIPTS) + $(PERLSCRIPTS) EXTRA_DIST = \ checkupdates.sh.in \ @@ -38,7 +41,9 @@ EXTRA_DIST = \ paclog-pkglist.sh.in \ pacscripts.sh.in \ rankmirrors.sh.in \ - updpkgsums.sh.in + updpkgsums.sh.in \ + \ + pacsearch.pl.in # Files that should be removed, but which Automake does not know. MOSTLYCLEANFILES = $(OURSCRIPTS) *.tmp @@ -58,18 +63,18 @@ edit = sed \ -e 's|@SCRIPTNAME[@]|$@|g' \ -e '1s|!/bin/bash|!$(BASH_SHELL)|g' -$(OTHERSCRIPTS): Makefile - $(AM_V_at)$(RM) $@ $@.tmp - $(AM_V_GEN)$(edit) $(srcdir)/$@.in >$@.tmp - $(AM_V_at)chmod +x,a-w $@.tmp - $(AM_V_at)mv $@.tmp $@ - $(BASHSCRIPTS): Makefile $(AM_V_at)$(RM) $@ $(AM_V_GEN)test -f $(srcdir)/$@.sh.in && m4 -P -I $(srcdir) $(srcdir)/$@.sh.in | $(edit) >$@ $(AM_V_at)chmod +x,a-w $@ @$(BASH_SHELL) -O extglob -n $@ +$(PERLSCRIPTS): Makefile + $(AM_V_at)$(RM) $@ $@.tmp + $(AM_V_GEN)$(edit) $(srcdir)/$@.pl.in >$@.tmp + $(AM_V_at)chmod +x,a-w $@.tmp + $(AM_V_at)mv $@.tmp $@ + $(OURFILES): Makefile $(AM_V_at)$(RM) $@ $@.tmp $(AM_V_GEN)$(edit) $(srcdir)/$@.in >$@.tmp @@ -87,4 +92,6 @@ pacscripts: $(srcdir)/pacscripts.sh.in rankmirrors: $(srcdir)/rankmirrors.sh.in updpkgsums: $(srcdir)/updpkgsums.sh.in +pacsearch: $(srcdir)/pacsearch.pl.in + # vim:set noet: diff --git a/src/pacsearch.pl.in b/src/pacsearch.pl.in new file mode 100644 index 0000000..a89328d --- /dev/null +++ b/src/pacsearch.pl.in @@ -0,0 +1,125 @@ +#!/usr/bin/perl +# pacsearch - Perform a pacman search using both the local and the sync databases +# +# Copyright (C) 2008-2014 Dan McGee <dan@archlinux.org> +# +# Based off original shell script version: +# Copyright (C) 2006-2007 Dan McGee <dan@archlinux.org> +# +# 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 the Free Software Foundation; either version 2 +# of the License, or (at your option) any later version. +# +# This program 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 this program. If not, see <http://www.gnu.org/licenses/>. + +use strict; +use warnings; +use Term::ANSIColor; + +my $myname = 'pacsearch'; +my $myver = '@PACKAGE_VERSION@'; + +sub usage { + print "$myname (pacman) v$myver\n\n"; + print "Perform a pacman search using both the local and the sync databases.\n\n"; + print "Usage: $myname [-n] <pattern>\n\n"; + print "Options:\n"; + print " -n, --nocolor: turn off coloring\n\n"; + print "Example: $myname ^gnome\n"; +} + +sub version { + printf "%s %s\n", $myname, $myver; + print "Copyright (C) 2008-2014 Dan McGee <dan\@archlinux.org>\n\n"; + print "Based off original shell script version:\n"; + print "Copyright (C) 2006-2007 Dan McGee <dan\@archlinux.org>\n"; +} + +if ($#ARGV lt 0 || $ARGV[0] eq "--help" || $ARGV[0] eq "-h") { + usage; + if ($#ARGV lt 0) { + exit 1; + } + exit 0; +} + +if ($ARGV[0] eq "--version" || $ARGV[0] eq "-V") { + version; + exit 0; +} + +# define formatting variables +my($BLUE, $CYAN, $GREEN, $MAGENTA, $RED, $YELLOW, $BOLD, $RESET); +if ($ARGV[0] eq "--nocolor" || $ARGV[0] eq "-n") { + shift; + $BLUE = ""; + $CYAN = ""; + $GREEN = ""; + $MAGENTA = ""; + $RED = ""; + $YELLOW = ""; + $BOLD = ""; + $RESET = ""; +} else { + $BLUE = color('blue'); + $CYAN = color('cyan'); + $GREEN = color('green'); + $MAGENTA = color('magenta'); + $RED = color('red'); + $YELLOW = color('yellow'); + $BOLD = color('bold'); + $RESET = color('reset'); +} + +# localization +my $LC_INSTALLED = `gettext pacman installed`; + +# Print a "repo/pkgname pkgver (groups) [installed]" line. +# We stick to pacman colors. +sub print_pkg { + my @v = @_; + print "$RESET$BOLD"; + if ( "$v[0]" eq "local" ) { + print "$RED"; + } else { + print "$MAGENTA"; + } + print "$v[0]/$RESET$BOLD$v[1] $GREEN$v[2]$BLUE$v[3]$CYAN$v[4]$RESET\n"; + print "$v[5]"; +} + +sub list_pkg { + my $db = shift; + open (my $out, '-|', 'pacman', $db, '--', @ARGV) or exit 1; + my @pkglist = (); + while ( readline($out) ) { + # We grab the following fields: repo, name, ver, group, installed, and + # desc. We grab leading space for 'group' and 'installed' so that we do + # not need to test if non-empty when printing. + my @pkgfields = /^(.*?)\/(.*?) (.*?)( \(.*?\))?( \[.*\])?$/s; + my $desc = readline($out); + # since 'group' and 'installed' are optional, we should fill it in if + # necessary + $pkgfields[3] = "" if not defined $pkgfields[3]; + $pkgfields[4] = "" if not defined $pkgfields[4]; + $pkgfields[5] = $desc; + push (@pkglist, \@pkgfields); + } + close ($out); + return @pkglist; +} + +my @sync = list_pkg('-Ss', @ARGV); +my %allpkgs = map {$_->[1] . $_->[2] => 1} @sync; +my @query = grep { not $allpkgs{$_->[1] . $_->[2]}} list_pkg('-Qs', @ARGV); +$_->[4] = " [$LC_INSTALLED]" foreach @query; +print_pkg (@{$_}) foreach (@sync, @query); + +#vim: set noet: -- To stop receiving notification emails like this one, please contact the administrator of this repository.
This is an automated email from the git hooks/post-receive script. demize pushed a commit to branch master in repository pacman-contrib. View the commit online: https://git.archlinux.org/pacman-contrib.git/commit/?id=d4fd3f1a2691597972cd... commit d4fd3f1a2691597972cd5c6fb73db91391deade9 Author: Johannes Löthberg <johannes@kyriasis.com> AuthorDate: Wed Oct 12 11:24:35 2016 +0200 src/Makefile.am: Add lib dependencies to targets Signed-off-by: Johannes Löthberg <johannes@kyriasis.com> --- src/Makefile.am | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Makefile.am b/src/Makefile.am index 1849d7a..f03ed64 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -83,9 +83,9 @@ $(OURFILES): Makefile all-am: $(OURSCRIPTS) -checkupdates: $(srcdir)/checkupdates.sh.in -paccache: $(srcdir)/paccache.sh.in -pacdiff: $(srcdir)/pacdiff.sh.in +checkupdates: $(srcdir)/checkupdates.sh.in $(top_srcdir)/lib/output_format.sh $(top_srcdir)/lib/term_colors.sh +paccache: $(srcdir)/paccache.sh.in $(top_srcdir)/lib/output_format.sh $(top_srcdir)/lib/parseopts.sh $(top_srcdir)/lib/size_to_human.sh $(top_srcdir)/lib/term_colors.sh +pacdiff: $(srcdir)/pacdiff.sh.in $(top_srcdir)/lib/output_format.sh $(top_srcdir)/lib/term_colors.sh paclist: $(srcdir)/paclist.sh.in paclog-pkglist: $(srcdir)/paclog-pkglist.sh.in pacscripts: $(srcdir)/pacscripts.sh.in -- To stop receiving notification emails like this one, please contact the administrator of this repository.
This is an automated email from the git hooks/post-receive script. demize pushed a commit to branch master in repository pacman-contrib. View the commit online: https://git.archlinux.org/pacman-contrib.git/commit/?id=93f372d08b669c188bf4... commit 93f372d08b669c188bf46c2c1bd5d8f5aa1d28ff Author: Johannes Löthberg <johannes@kyriasis.com> AuthorDate: Wed Oct 12 11:57:45 2016 +0200 configure.ac: add missing SIZECMD Signed-off-by: Johannes Löthberg <johannes@kyriasis.com> --- configure.ac | 3 +++ 1 file changed, 3 insertions(+) diff --git a/configure.ac b/configure.ac index 586dac1..789223d 100644 --- a/configure.ac +++ b/configure.ac @@ -54,6 +54,9 @@ AM_CONDITIONAL(USE_GIT_VERSION, test "x$usegitver" = "xyes") AC_SUBST(vim_dir, [$vim_dir]) +SIZECMD="stat -c %s" +AC_SUBST(SIZECMD) + AC_CONFIG_FILES([ Makefile src/Makefile -- To stop receiving notification emails like this one, please contact the administrator of this repository.
This is an automated email from the git hooks/post-receive script. demize pushed a commit to branch master in repository pacman-contrib. View the commit online: https://git.archlinux.org/pacman-contrib.git/commit/?id=8effb4140d7b39e4196c... commit 8effb4140d7b39e4196c14d54834c632833daa00 Author: Johannes Löthberg <johannes@kyriasis.com> AuthorDate: Wed Oct 12 11:57:55 2016 +0200 paccache: Exit when privilege escalation fails Pipelines run in subshells, so we need to set errexit for privilege escalation failing to exit the script properly. Fixes FS#44850. Signed-off-by: Johannes Löthberg <johannes@kyriasis.com> --- src/paccache.sh.in | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/paccache.sh.in b/src/paccache.sh.in index a7f9d62..e34f684 100644 --- a/src/paccache.sh.in +++ b/src/paccache.sh.in @@ -353,6 +353,9 @@ unset candtemp # do this before we destroy anything totalsaved=$(@SIZECMD@ "${candidates[@]}" | awk '{ sum += $1 } END { print sum }') +# Exit immediately if a pipeline returns non-zero. +set -o errexit + # crush. kill. destroy. (( verbose )) && cmdopts+=(-v) if (( delete )); then -- To stop receiving notification emails like this one, please contact the administrator of this repository.
participants (1)
-
demize@archlinux.org