Verify the argument to -k is a non-negative integer. Leading zeros
are simply stripped.
'declare -i keep' allowed the argument to -k to be any arithmetic
evaluation expression. The simple assignment 'keep=$OPTARG' triggers
arithmetic evaluation implicitly, which can either consume a huge amount
of resources with input such as '2**2**32' or immediately produce an error
on invalid input. Instead, we simply 'declare -- keep' and avoid all that.
Signed-off-by: lolilolicon <lolilolicon@gmail.com>
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
This is superfluous as the ensuing for loop will exit immediately on the
same condition avoided by the if.
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
makepkg --source is a often used go make source package like for AUR.
Have a -S shortcut will save the world.
Signed-off-by: Sebastien Luttringer <seblu@seblu.net>
Signed-off-by: Dan McGee <dan@archlinux.org>
These are equivalent. Use the autoconf macro for consistency.
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
Remove -k option excepting query operations and add --recursive for sync
and upgrade operations.
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
* change error verbiage when run as root
* delete sigs along with packages
* fix bug in diskspace calculations
* merge END block in pkgfilter
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
paccache is a robust and flexible package cache cleaner with a variety
of options. Much credit goes to DJ Mills and Pat Brisbin for ideas
behind this script.
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
[Dan: add .gitignore entry]
Signed-off-by: Dan McGee <dan@archlinux.org>
Avoid some pain in awk's limited handling of command line arguments by
wrapping this in a Bash script. We also default to
@localstatedir@/log/pacman.log when no args are specified, meaning that
-h or --help is required to get the help message.
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
converts a pacman log file to a list of installed packages, which should
match the output of `pacman -Q'.
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
We nuke it from the completion file as well along with its longopt.
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
The original concept for this script was a bash implementation, but
turned out to be unreasonable at the time due to the efficiencies of the
database format. Since those have been resolved, we can rewrite this in
bash as a much simpler script.
All the action happens in a single line, but we add extend this a
little, binding to gettext to keep our pacman translations intact.
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
vim recognises what type of shell script it's dealing with by looking at
the shebang. If detection fails it falls back to sh which doesn't
support some bash features. Adding a normal, possibly broken, shebang
which gets fixed by the Makefile allows vim to detect bash syntax.
Signed-off-by: Florian Pritz <bluewind@xinu.at>
Signed-off-by: Dan McGee <dan@archlinux.org>
Support for this script was removed in makepkg by commit b4e1365. Delta
creation support has been provided by scripts/pkgdelta.
Signed-off-by: Dave Reisner <d@falconindy.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
This was totally screwed under a 'make distcheck' invocation. Bring it
inline with what we have (and what works!) in scripts/Makefile.am. This
was broken/introduced in commit 05f0a28932.
Signed-off-by: Dan McGee <dan@archlinux.org>
Before any non-matching line would trigger some perl warnings about
undefined variables. If a line doesn't match, just show it to the user
unprocessed; this is seen with warning and error messages pacman not so
helpfully emits on stdout rather than stderr.
Signed-off-by: Dan McGee <dan@archlinux.org>
We didn't have the proper dependencies specified for our scripts after
the move to *.in extensions, so a change to a file didn't trigger a
rebuild. Also remove old stuff from .gitignore.
Signed-off-by: Dan McGee <dan@archlinux.org>
Instead, go the same route we have always taken with version-release in
libalpm and treat it all as one piece of information. Makepkg is the only
script that knows about epoch as a distinct value; from there on out we will
parse out the components as necessary.
This makes the code a lot simpler as far as epoch handling goes. The
downside here is that we are tossing some compatibility to the wind;
packages using force will have to be rebuilt with an incremented epoch to
keep their special status.
Signed-off-by: Dan McGee <dan@archlinux.org>
Add the "buildflags" option, which is useful in its negative form
for disabling CFLAGS, CXXFLAGS and LDFLAGS when building a package.
This is useful when determining of one of these flags is causing
an issue with a package.
Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
Populate $cur and $prev with the new bash-completion 1.2 function,
_get_comp_words_by_ref.
_get_cword and _get_pword have been deprecated.
Signed-off-by: Carlos Diaz <839273@gmail.com>
BASH is defined when you are actually using bash during configure, which
sucks because it ends up being '/bin/sh', messing up all of our scripts.
Change the name of the variable we use in configure, and also ensure we get
a full path to the executable by using AC_PATH_PROGS rather than
AC_CHECK_PROGS. Finally, change the variable name everywhere we use it.
Signed-off-by: Dan McGee <dan@archlinux.org>
* Add a .gitignore file
* Use the same 'GEN' output we have in the scripts/ Makefile when doing our
edits on the .in files
* Remove PKGBUILD.vim and vimprojects from our edit list, they have no need
to be in the list
Signed-off-by: Dan McGee <dan@archlinux.org>
This applies to contrib/ files, our scripts, and the documentation.
Dan: fix 'make clean' in contrib/ directory.
Signed-off-by: Nezmer <git@nezmer.info>
Signed-off-by: Dan McGee <dan@archlinux.org>
This is needed If we want to use sysconfdir,localstatedir and other variables.
Signed-off-by: Nezmer <git@nezmer.info>
Signed-off-by: Dan McGee <dan@archlinux.org>
This is not a bash builtin, so can potentially cause portability issues.
Additionally, the use of it is completely unnecessary as it can all be done
within bash (and done faster).
$ time pactree xfwm4 >/dev/null (old version)
real 0m3.245s
$ time ./contrib/pactree xfwm4 >/dev/null (new version)
real 0m3.042s
Signed-off-by: Dan McGee <dan@archlinux.org>
Currently bacman always compresses with gzip now matter what PKGEXT is
set to. Rework the entire package creation process to be similar to
that in makepkg. This also make the explicit assumption that PKGEXT is
defined in makepkg.conf.
Thanks to Nelson Chan <khcha.n.el@gmail.com> for the original patch to
fix the incorrect package compression.
Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
Avoids letting the shell evaluate ! as something else (e.g. an alias).
Signed-off-by: Dave Reisner <d@falconindy.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
To avoid errors with bash 3.2, compopt will be skipped if it's not a
shell builtin.
compopt is needed to not append slashes to package names that
coincide with directories in PWD.
This is currently not possible to fix in bash versions that do not support
compopt, so these users will have to bear that regression.
Signed-off-by: Andres P <aepd87@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
Now that we have the '[installed]' text, update pacsearch to look for it and
highlight it instead of the former '***' prefix.
Signed-off-by: Dan McGee <dan@archlinux.org>
* Undeclared local vars with common enough names to warrant breakage
* Performance issues with _pacman trying to replicate /usr/bin/pacman
with find and other slow tools.
* Performance issues with expanding an array (with sometimes hundreds of
items) over three times.
* Expanding said array to remove already completed entries had the side
effect of braking filenames with spaces and or \n.
* add -D --database options and --print
* fix dirs showing up when they shouldn't in completions
* completions regarding database entries shouldn't trigger filename
completion.
This is now down to 106 lines. The original one (master) is 365 lines
long, yet this one retains all functionality.
The work is documented in FS#16630.
Signed-off-by: Andres P <stderr@mail.com>
Signed-off-by: Xavier Chantry <chantry.xavier@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
Of course, we still have only md5 and sha1 hardcoded here but I resisted the
urge to copy paste for the rest of our supported checksums in hope that
someone knows how to do it a better way.
Signed-off-by: Dan McGee <dan@archlinux.org>
Updated list with :
echo $(pacman -Ql licenses | grep "/usr/share/licenses/common/.*/$" | cut
-d'/' -f6 )
Maybe PKGBUILD.vim could do this at runtime ?
Dan: you forgot the symlinks; readded FDL, GPL, LGPL.
Signed-off-by: Xavier Chantry <chantry.xavier@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
And a new --print-format option to configure the output.
This implements FS#14208
Example usage :
pacman -Sp --print-format "%r/%n-%v : %l [%s]" kdelibs
extra/kdelibs-4.3.2-4 : ftp://mir2.archlinuxfr.org/archlinux/extra/os/i686/kdelibs-4.3.2-4-i686.pkg.tar.gz [0,00]
Signed-off-by: Xavier Chantry <shiningxc@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
The location of the used utilities may and does differ between various
distributions and therefore absolute paths do not work well. Since the
main purpose of its introduction was to avoid side-effects caused by
aliases, it is sufficient to disable possible aliases temporarily by
preceding the commands with a backslash.
Signed-off-by: Cedric Staniewski <cedric@gmx.ca>
Signed-off-by: Dan McGee <dan@archlinux.org>
Currently, a changelog is added to a package if a specific file with a
hardcoded name exists in the PKGBUILD's directory. This approach is not
pretty and also inconsistent with the handling of install files, but it
works.
With the introduction of split PKGBUILDs, however, a drawback in this
old behavior has arisen: you only have the possibility to include one
specific changelog file in either every package defined in the PKGBUILD
or in none.
The use of an additional variable, `changelog`, works around this issue
and makes it possible to include a changelog in only some of the
packages, and besides, each package of the PKGBUILD can have its own
changelog file.
Signed-off-by: Cedric Staniewski <cedric@gmx.ca>
Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
This implements FS#13877. Add a new option "-Qk" which checks if all of the
files for a given package (or packages) are really on the system (i.e. not
accidentally deleted). This can be combined with filters and other display
options. It also respects both the --quiet and --verbose flags to give
varying levels of output.
Based on the original patch by Charly Coste <changaco@laposte.net>, thanks
for your work!
Signed-off-by: Dan McGee <dan@archlinux.org>
Prints the install script from a given package file or from a package
in the pacman repo.
Original-work-by: Giulio "giulivo" Fidente <giulivo.navigante@gmail.com>
Improvements-by: Xavier Chantry <shiningxc@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
I initially only wanted to add a -l/--locate option to use locate instead of
find, which should have been easy.
Then I thought I would try to support filename with whitespace while I was
at it, and this was a bit more complex. The safest ways seem to be the
following ones : http://mywiki.wooledge.org/BashFAQ/020
Then I received a lot of suggestions on #bash about how to improve the
script, which I tried to address.
Signed-off-by: Xavier Chantry <shiningxc@gmail.com>
[Dan: fix grouping of find arguments]
Signed-off-by: Dan McGee <dan@archlinux.org>
The option parsing was catching any "-d" in an argument so packages
with this in their name did not work.
Also removed commented code line that appears to be inserted during
testing.
Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
Something such as "pacsearch foo|bar" would cause problems due to the
quoting being dropped. Adding quotes solves the problem.
Signed-off-by: Dan McGee <dan@archlinux.org>
Pactree is a dependency tree viewer for installed packages.
It features both textual and graphic (through graphviz) output.
Script by: Carlo Bersani <carlocci@gmail.com>
[Allan: removed whitespace errors]
Signed-off-by: Allan McRae <allan@archlinux.org>
[Dan: killed some unnecessary lines, moved license header]
Signed-off-by: Dan McGee <dan@archlinux.org>
test -e tries to resolve the link before testing, so if the link is copied
before the actual file, the script exited. This fixes the issue.
[Dan: also add some improved quoting in the script]
Signed-off-by: Carlo Bersani <carlocci@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
Original work by Carlo "carlocci" Bersani with additions by
Xavier Chantry and Allan McRae
This script rebuilds an already installed package using metadata
stored into the pacman database and system files. Replaces the
outdated re-pacman script
Signed-off-by: Allan McRae <mcrae_allan@hotmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
The paclist script provides a simple method for monitoring which packages
are installed from a given repo. This is particularly useful when using a
testing or unstable repository.
Thanks to Allan McRae for the idea and an initial bash script. As suggested
by Dan, I tried to rewrite in perl, and this resulted in much better
performance. Then Dan further cleaned up the script.
Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
[Dan: add to Makefile & README, minor script cleanups]
Signed-off-by: Dan McGee <dan@archlinux.org>
This rewrite in perl blows the socks off the old shell script version for
large searches:
$ time ./pacsearch.perl ^.*$ >/dev/null
real 0m0.836s
user 0m0.593s
sys 0m0.217s
$ time pacsearch.sh ^.*$ >/dev/null
real 1m53.818s
user 1m16.818s
sys 0m33.694s
Functionality and output is identical to the old version with the exception
of the old version's missing EOL after all the output. It should be a lot
easier to add new things like the --color flag that has been a TODO at the
top of the script for a long time.
Signed-off-by: Dan McGee <dan@archlinux.org>
From 41cc28f560bf9843d81ce5fb62b884b6325d06a0 Mon Sep 17 00:00:00 2001
From: Allan McRae <mcrae_allan@hotmail.com>
Date: Sun, 6 Apr 2008 22:18:06 +1000
Subject: [PATCH] Quote filenames in find expression in pacdiff
Small patch to allow pacdiff to run in /etc. See FS#10090.
Signed-off-by: Allan McRae <mcrae_allan@hotmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
Also fix a broken contrib/ Makefile, found with make distcheck. I also let
the little translation linebreak update slip in here as it was small enough
not to be a big deal, and this should just prevent it from happening again
later anyway.
Signed-off-by: Dan McGee <dan@archlinux.org>
in PKGBUILD.proto, we have the following line
md5sums=() #generate with 'makepkg -g'
if we add a md5sum inside quotes, or even just the quotes :
md5sums=('') #generate with 'makepkg -g'
the highlighting will be totally messed up.
Adding the keepend keyword fixes this.
Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
All other steps in tidy_install function were already controlled by an
option in makepkg.conf, so this patch adds an option for the man page
compression step too.
This will allow to keep man pages uncompressed, which is required for some
special meta man page, like the zshall one (see FS#4580).
Ref: http://www.archlinux.org/pipermail/pacman-dev/2008-March/011472.html
Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
If we had :
arch=(fake)
The fake string would be highlighted because it's invalid.
But if we had :
arch=('fake')
it didn't work.
Fix this for both arch and license arrays.
Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
There is no need to put the list of files in there, which will get outdated
sooner or later. It's possible to generate the filelist in the plugin itself
using \r.
Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
[Dan: add scripts/ directory]
Signed-off-by: Dan McGee <dan@archlinux.org>
* Add optdepends keyword
* license, backup and arch keywords should be arrays
* Remove the little hack to color conflicts/provides/replaces keyword even
without =(). These should be arrays too.
Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
With --unneeded option 'pacman -R' doesn't stop in case of dependency error;
it removes the needed-dependency targets from the target-list instead. See
also: http://archlinux.org/pipermail/pacman-dev/2007-October/009653.html .
The patch also adds a new causingpkg field to pmdepmissing_t which indicates
the to-be-removed package which would cause a dependency break. This is
needed, because miss->depend.name may be a provision. miss->causingpkg will
be useful in -R dependency error messages too.
[Xavier: renamed inducer to causingpkg, removed the _alpm_pkgname_pkg_cmp
helper function as requested by Aaron. This might be added by a further
commit. Other small cleanups, updated manpage and bash completion.]
Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
The force option should only be specified in the PKGBUILD with
options=(force). This information should be handled like any other meta
info, and there is no need to have a special repo-add option for it.
Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
[Dan: fix up a few more references in contrib/ scripts, etc]
Signed-off-by: Dan McGee <dan@archlinux.org>
Move these two scripts into contrib/, and start the process of de-automaking
them by removing the @sysconfdir@ references and the gettext initialization.
The removal of all gettext will soon follow.
Signed-off-by: Dan McGee <dan@archlinux.org>
This is the symmetric of --asdeps, install packages explicitly.
Documentation and completion files were updated accordingly.
Added sync301.py and upgrade032.py pactest files to test this.
I also made a little modification in ALLDEPS handling too.
Signed-off-by: Nagy Gabor <ngaba@bibl.u-szeged.hu>
Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
-Qg was handled twice.
--ignore completed on all installed packages instead of all
packages.
--ignoregroup had a special handling that seems unnecessary. It
wasn't done for --ignore, and it apparently works fine without anyway.
Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
It turns out the orphan name was misleading. Real orphans are packages
installed as dependency no longer required by any others (-Qtd).
The -t option only shows package not required by any others, so --unrequired
describes it better.
Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
Move the prototypes out of contrib/ and into the top level directory, and
install them to what is usually /usr/share/pacman/ on a package install.
Signed-off-by: Dan McGee <dan@archlinux.org>
This is something pacman can do on its own straight from the archive, and we
will reduce the chance of problems occurring becuase of inproper FILELIST
generation as we have had in the past with special characters in filenames.
Once we remove it from makepkg. we can remove any usage of it from all of
our other tools, including pacman, pactest, and contrib/ utilities.
Note that removing it from pacman uncovered a few other bugs anyway, so this
was probably a good move.
Signed-off-by: Dan McGee <dan@archlinux.org>
The new pattern is as follows:
. /path/to/scriptlet
post_upgrade X Y
This requires less frameworking in the install scripts (the three lines that
shift and eval a function are nasty)
Signed-off-by: Aaron Griffin <aaronmgriffin@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
Update the GPL boilerplate to direct people to the GNU website for a copy of
the license, as well as bump all of Judd's copyrights to 2007.
Signed-off-by: Dan McGee <dan@archlinux.org>
Update zsh completion file to version 0.5-2 from AUR and add the new
options in pacman 3.1.
Signed-off-by: Nathan Jones <nathanj@insightbb.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
During a pacman operation such as a group install, pacman can ask several
questions such as "local version is up to date. Upgrade anyway?". They are
usually all answered either by yes or by no:
* yes when you want to reinstall all the targets.
* no when you only want to install the missing ones (either because you are
installing a group, or because you are copying a pacman -S line from wiki or
whatever).
So instead of asking this question for each target, it is now now configured
with a flag. Yes will be the default -S behavior, No will be achieved with
the --needed flag.
Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
This operation made sense in the days before sync DBs existed, but it no
longer has the same usefulness it once did.
Signed-off-by: Dan McGee <dan@archlinux.org>
Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
Signed-off-by: Nagy Gabor <ngaba@bibl.u-szeged.hu>
Signed-off-by: Aaron Griffin <aaronmgriffin@gmail.com>
I wonder how many tools / scripts deal directly with the sync databases under /var/lib/pacman/ ,
I doubt these are the only ones.
Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
There's no need for a second hashing algorithm. MD5 serves the purpose
of verifying that a package file hasn't been corrupted during download.
Signed-off-by: Andrew Fyfe <andrew@neptune-one.net>
Signed-off-by: Dan McGee <dan@archlinux.org>
.gitignore works recursively, so we don't need Makefile and Makefile.in
in all of the subdirectory .gitignore files.
Signed-off-by: Dan McGee <dan@archlinux.org>
Remove versioncmp.c by moving all functions to locations that make sense.
Move replacement functions (for building without glibc) into util.c where
they belong, and do proper checks for them instead of using __sun__, etc.
Signed-off-by: Dan McGee <dan@archlinux.org>
* Add vim modeline to Makefile.am and configure.ac
* Fix white space in Makefile.am and configure.ac
* Add contrib/wget-xdelta.sh to EXTRA_DIST in Makefile.am
Signed-off-by: Andrew Fyfe <andrew@neptune-one.net>
Signed-off-by: Dan McGee <dan@archlinux.org>
* Move all .cvsignore files to .gitignore for switch in VCS. In addition,
delete ones that were unnecessary because they only contained Makefile
and Makefile.am.
Signed-off-by: Dan McGee <dan@archlinux.org>