This commit is contained in:
Nathan 2022-01-13 21:21:04 -06:00
parent 1a438ea922
commit fbb7cd6c25
53 changed files with 0 additions and 5506 deletions

View File

@ -1,11 +0,0 @@
Maintainers
-----------
* Johannes Löthberg <johannes@kyriasis.com>
* Daniel M. Capella <polyzen@archlinux.org>
Contributors
------------
Use `git shortlog -s` for a list of contributors.

View File

@ -1,124 +0,0 @@
# Changelog
All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
## [Unreleased]
### Added
- pacman-syncdb: systemd service and timer for `pacman -Fy`
- Rename `pacman -Fy` units to pacman-filesdb-refresh from pacman-syncdb and simplify descriptions
### Changed
### Fixed
## [1.4.0] - 2020-07-28
### Added
- pactree: Add --debug (2d13a236)
- pactree: Add --gpgdir, set the gpg directory (a4e69cac)
- pactree: introduce the --optional flag (FS#61336) (b6d08b40)
### Changed
- doc: make timestamps in man pages reproducible (e2a5e43b)
- paccache.service.in: Reword description to more clearly specify what it does (269a2cdc)
### Fixed
- pactree: Improve command line validation (FS#64589) (e77e13b0)
- pactree: Fix redundant arrows in Graphviz output (c7be8631)
- doc: Fix pacdiff option descriptions (cf683ca0)
- vim: Add missing highlight links for b2sums (a1e7a764)
- paccache: Support cleaning many thousands of candidates (547a66d5)
## [1.3.0] - 2019-12-25
### Added
- Add document describing the release procedures. (21449e3)
- vim: Add Unlicense as valid license. (f835547)
### Changed
- checkupdates: Use $UID instead of $USER in the tempdir path. (a8b342e)
- checkupdates, paccache, and pacdiff were ported to libmakepkg. (431e564)
### Fixed
- checkupdates: Exit with 2 if there are no updates available. (3da550e)
- rankmirrors: Fix parsing of -m argument. (d026415)
- updpkgsums: Use makepkg's checksum algorithm type specification, fixing support for b2sums. (c8ef727)
- vim: Recognize validpgpkeys variable. (e6950d3)
## [1.2.0] - 2019-10-06
### Added
- checkupdates: Add option for downloading updates. (ab69666)
- docs: Add manpages for checkupdates, pacdiff, pacsort, updpkgsums. (d25a8b2, 35eef6b, ef63784, b258c31)
- paccache: Add --age-atime and --age-mtime arguments. (45c1916)
- vim: Add indent file. (020b533)
- vim: Add b2sums to PKGBUILD syntax file. (fc21909)
- Vim: Add Boost and MPL2 as valid licenses. (b5cb1ce)
### Changed
- paclist: Allow listing packages from multiple repos at once. (58bfa06)
- paclist: Also list packages where the installed version differ from the repo version. (4849211)
- vim: Remove version check for Vim older than 6.0 from PKGBUILD syntax file. (b4ae0e5)
- checkupdates, paccache, pacdiff: Don't use colors on a dumb terminal. (c57d275)
### Fixed
- pacccache: Fix parsing of --move argument. (9ebae18)
- pacdiff: Don't assume the DBPath has a trailing slash. (0c260d3)
- pacsort: Support all compression formats supported by `makepkg`. (aa22e5c)
- vim: Add `unknown` license special case to PKGBUILD syntax file. (6193d12)
## [1.1.0] - 2018-08-05
### Added
- paccache: Add manpage.
- rankmirrors: Add --max-time flag to specify the timeout used.
### Changed
- pacscripts: Don't log to pacman.log when files are downloaded to the cache.
- pacscripts: Find package file path using pacman instead of doing it manually ourselves.
- pactree: Use full dependency string when finding dependencies, since if we don't use the version requirement part of the string, we will sometimes return the wrong results.
- vim/ftplugin/PKGBUILD: Set vim 'commentstring' option
- vim/syntax/PKGBUILD: Add sha224sums support.
### Fixed
- pacsort: Fix short version option.
## [1.0.0] - 2018-05-28
### Added
- `--version` option to pactree.
- Import pacsort utility.
- systemd service and timer for paccache.
### Changed
- Make pacscripts use `-v` as the short flag for version output instead of `-V`, in accordance with its documentation.
### Fixed
- checkupdates now reports failures to update the databases.
- Add `-v` to pacsort help output.
## 0.0.1 - 2016-10-17
### Added
- Imported the following utilities:
- checkupdates
- paccache
- pacdiff
- paclist
- paclog-pkglist
- pacscripts
- pacsearch
- pactree
- rankmirrors
- updpkgsums
- Added vim highlighting for PKGBUILDs.
[Unreleased]: https://gitlab.archlinux.org/pacman/pacman-contrib/-/compare/v1.4.0...master
[1.0.0]: https://gitlab.archlinux.org/pacman/pacman-contrib/-/compare/v0.0.1...v1.0.0
[1.1.0]: https://gitlab.archlinux.org/pacman/pacman-contrib/-/compare/v1.0.0...v1.1.0
[1.2.0]: https://gitlab.archlinux.org/pacman/pacman-contrib/-/compare/v1.0.1...v1.2.0
[1.3.0]: https://gitlab.archlinux.org/pacman/pacman-contrib/-/compare/v1.0.2...v1.3.0
[1.4.0]: https://gitlab.archlinux.org/pacman/pacman-contrib/-/compare/v1.0.3...v1.4.0

View File

@ -1,339 +0,0 @@
GNU GENERAL PUBLIC LICENSE
Version 2, June 1991
Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The licenses for most software are designed to take away your
freedom to share and change it. By contrast, the GNU General Public
License is intended to guarantee your freedom to share and change free
software--to make sure the software is free for all its users. This
General Public License applies to most of the Free Software
Foundation's software and to any other program whose authors commit to
using it. (Some other Free Software Foundation software is covered by
the GNU Lesser General Public License instead.) You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
this service if you wish), that you receive source code or can get it
if you want it, that you can change the software or use pieces of it
in new free programs; and that you know you can do these things.
To protect your rights, we need to make restrictions that forbid
anyone to deny you these rights or to ask you to surrender the rights.
These restrictions translate to certain responsibilities for you if you
distribute copies of the software, or if you modify it.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must give the recipients all the rights that
you have. You must make sure that they, too, receive or can get the
source code. And you must show them these terms so they know their
rights.
We protect your rights with two steps: (1) copyright the software, and
(2) offer you this license which gives you legal permission to copy,
distribute and/or modify the software.
Also, for each author's protection and ours, we want to make certain
that everyone understands that there is no warranty for this free
software. If the software is modified by someone else and passed on, we
want its recipients to know that what they have is not the original, so
that any problems introduced by others will not reflect on the original
authors' reputations.
Finally, any free program is threatened constantly by software
patents. We wish to avoid the danger that redistributors of a free
program will individually obtain patent licenses, in effect making the
program proprietary. To prevent this, we have made it clear that any
patent must be licensed for everyone's free use or not licensed at all.
The precise terms and conditions for copying, distribution and
modification follow.
GNU GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License applies to any program or other work which contains
a notice placed by the copyright holder saying it may be distributed
under the terms of this General Public License. The "Program", below,
refers to any such program or work, and a "work based on the Program"
means either the Program or any derivative work under copyright law:
that is to say, a work containing the Program or a portion of it,
either verbatim or with modifications and/or translated into another
language. (Hereinafter, translation is included without limitation in
the term "modification".) Each licensee is addressed as "you".
Activities other than copying, distribution and modification are not
covered by this License; they are outside its scope. The act of
running the Program is not restricted, and the output from the Program
is covered only if its contents constitute a work based on the
Program (independent of having been made by running the Program).
Whether that is true depends on what the Program does.
1. You may copy and distribute verbatim copies of the Program's
source code as you receive it, in any medium, provided that you
conspicuously and appropriately publish on each copy an appropriate
copyright notice and disclaimer of warranty; keep intact all the
notices that refer to this License and to the absence of any warranty;
and give any other recipients of the Program a copy of this License
along with the Program.
You may charge a fee for the physical act of transferring a copy, and
you may at your option offer warranty protection in exchange for a fee.
2. You may modify your copy or copies of the Program or any portion
of it, thus forming a work based on the Program, and copy and
distribute such modifications or work under the terms of Section 1
above, provided that you also meet all of these conditions:
a) You must cause the modified files to carry prominent notices
stating that you changed the files and the date of any change.
b) You must cause any work that you distribute or publish, that in
whole or in part contains or is derived from the Program or any
part thereof, to be licensed as a whole at no charge to all third
parties under the terms of this License.
c) If the modified program normally reads commands interactively
when run, you must cause it, when started running for such
interactive use in the most ordinary way, to print or display an
announcement including an appropriate copyright notice and a
notice that there is no warranty (or else, saying that you provide
a warranty) and that users may redistribute the program under
these conditions, and telling the user how to view a copy of this
License. (Exception: if the Program itself is interactive but
does not normally print such an announcement, your work based on
the Program is not required to print an announcement.)
These requirements apply to the modified work as a whole. If
identifiable sections of that work are not derived from the Program,
and can be reasonably considered independent and separate works in
themselves, then this License, and its terms, do not apply to those
sections when you distribute them as separate works. But when you
distribute the same sections as part of a whole which is a work based
on the Program, the distribution of the whole must be on the terms of
this License, whose permissions for other licensees extend to the
entire whole, and thus to each and every part regardless of who wrote it.
Thus, it is not the intent of this section to claim rights or contest
your rights to work written entirely by you; rather, the intent is to
exercise the right to control the distribution of derivative or
collective works based on the Program.
In addition, mere aggregation of another work not based on the Program
with the Program (or with a work based on the Program) on a volume of
a storage or distribution medium does not bring the other work under
the scope of this License.
3. You may copy and distribute the Program (or a work based on it,
under Section 2) in object code or executable form under the terms of
Sections 1 and 2 above provided that you also do one of the following:
a) Accompany it with the complete corresponding machine-readable
source code, which must be distributed under the terms of Sections
1 and 2 above on a medium customarily used for software interchange; or,
b) Accompany it with a written offer, valid for at least three
years, to give any third party, for a charge no more than your
cost of physically performing source distribution, a complete
machine-readable copy of the corresponding source code, to be
distributed under the terms of Sections 1 and 2 above on a medium
customarily used for software interchange; or,
c) Accompany it with the information you received as to the offer
to distribute corresponding source code. (This alternative is
allowed only for noncommercial distribution and only if you
received the program in object code or executable form with such
an offer, in accord with Subsection b above.)
The source code for a work means the preferred form of the work for
making modifications to it. For an executable work, complete source
code means all the source code for all modules it contains, plus any
associated interface definition files, plus the scripts used to
control compilation and installation of the executable. However, as a
special exception, the source code distributed need not include
anything that is normally distributed (in either source or binary
form) with the major components (compiler, kernel, and so on) of the
operating system on which the executable runs, unless that component
itself accompanies the executable.
If distribution of executable or object code is made by offering
access to copy from a designated place, then offering equivalent
access to copy the source code from the same place counts as
distribution of the source code, even though third parties are not
compelled to copy the source along with the object code.
4. You may not copy, modify, sublicense, or distribute the Program
except as expressly provided under this License. Any attempt
otherwise to copy, modify, sublicense or distribute the Program is
void, and will automatically terminate your rights under this License.
However, parties who have received copies, or rights, from you under
this License will not have their licenses terminated so long as such
parties remain in full compliance.
5. You are not required to accept this License, since you have not
signed it. However, nothing else grants you permission to modify or
distribute the Program or its derivative works. These actions are
prohibited by law if you do not accept this License. Therefore, by
modifying or distributing the Program (or any work based on the
Program), you indicate your acceptance of this License to do so, and
all its terms and conditions for copying, distributing or modifying
the Program or works based on it.
6. Each time you redistribute the Program (or any work based on the
Program), the recipient automatically receives a license from the
original licensor to copy, distribute or modify the Program subject to
these terms and conditions. You may not impose any further
restrictions on the recipients' exercise of the rights granted herein.
You are not responsible for enforcing compliance by third parties to
this License.
7. If, as a consequence of a court judgment or allegation of patent
infringement or for any other reason (not limited to patent issues),
conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot
distribute so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you
may not distribute the Program at all. For example, if a patent
license would not permit royalty-free redistribution of the Program by
all those who receive copies directly or indirectly through you, then
the only way you could satisfy both it and this License would be to
refrain entirely from distribution of the Program.
If any portion of this section is held invalid or unenforceable under
any particular circumstance, the balance of the section is intended to
apply and the section as a whole is intended to apply in other
circumstances.
It is not the purpose of this section to induce you to infringe any
patents or other property right claims or to contest validity of any
such claims; this section has the sole purpose of protecting the
integrity of the free software distribution system, which is
implemented by public license practices. Many people have made
generous contributions to the wide range of software distributed
through that system in reliance on consistent application of that
system; it is up to the author/donor to decide if he or she is willing
to distribute software through any other system and a licensee cannot
impose that choice.
This section is intended to make thoroughly clear what is believed to
be a consequence of the rest of this License.
8. If the distribution and/or use of the Program is restricted in
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Program under this License
may add an explicit geographical distribution limitation excluding
those countries, so that distribution is permitted only in or among
countries not thus excluded. In such case, this License incorporates
the limitation as if written in the body of this License.
9. The Free Software Foundation may publish revised and/or new versions
of the General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the Program
specifies a version number of this License which applies to it and "any
later version", you have the option of following the terms and conditions
either of that version or of any later version published by the Free
Software Foundation. If the Program does not specify a version number of
this License, you may choose any version ever published by the Free Software
Foundation.
10. If you wish to incorporate parts of the Program into other free
programs whose distribution conditions are different, write to the author
to ask for permission. For software which is copyrighted by the Free
Software Foundation, write to the Free Software Foundation; we sometimes
make exceptions for this. Our decision will be guided by the two goals
of preserving the free status of all derivatives of our free software and
of promoting the sharing and reuse of software generally.
NO WARRANTY
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
REPAIR OR CORRECTION.
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGES.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
convey the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
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, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
Also add information on how to contact you by electronic and paper mail.
If the program is interactive, make it output a short notice like this
when it starts in an interactive mode:
Gnomovision version 69, Copyright (C) year name of author
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, the commands you use may
be called something other than `show w' and `show c'; they could even be
mouse-clicks or menu items--whatever suits your program.
You should also get your employer (if you work as a programmer) or your
school, if any, to sign a "copyright disclaimer" for the program, if
necessary. Here is a sample; alter the names:
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
`Gnomovision' (which makes passes at compilers) written by James Hacker.
<signature of Ty Coon>, 1 April 1989
Ty Coon, President of Vice
This General Public License does not permit incorporating your program into
proprietary programs. If your program is a subroutine library, you may
consider it more useful to permit linking proprietary applications with the
library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License.

View File

@ -1,20 +0,0 @@
SUBDIRS = src lib test
if WANT_DOC
SUBDIRS += doc
endif
DIST_SUBDIRS = $(SUBDIRS)
DISTCHECK_CONFIGURE_FLAGS = --prefix=/usr --sysconfdir=/etc --localstatedir=/var --enable-doc --disable-git-version
EXTRA_DIST = README.md AUTHORS.md
TESTS = \
test/pacsorttest.sh
TEST_SUITE_LOG = test/test-suite.log
AM_TESTS_ENVIRONMENT = \
PMTEST_BIN_DIR=$(top_builddir)/src/; export PMTEST_BIN_DIR;
LOG_DRIVER = env AM_TAP_AWK='$(AWK)' $(SHELL) \
$(top_srcdir)/build-aux/tap-driver.sh

View File

@ -1,47 +0,0 @@
pacman-contrib
==============
This repository contains contributed scripts to pacman.
*Note*: This used to be part of pacman.git, but was moved out to make pacman maintenance easier.
How to build:
-------------
./autogen.sh
./configure --prefix=/usr \
--sysconfdir=/etc \
--localstatedir=/var
make
make check
make install DESTDIR="$pkgdir"
Scripts available in this repository:
-------------------------------------
* checkupdates - print a list of pending updates without touching the system
sync databases (for safety on rolling release distributions).
* paccache - a flexible package cache cleaning utility that allows greater
control over which packages are removed.
* pacdiff - a simple pacnew/pacsave updater for /etc/.
* paclist - list all packages installed from a given repository. Useful for seeing
which packages you may have installed from the testing repository,
for instance.
* paclog-pkglist - lists currently installs packages based pacman's log.
* pacscripts - tries to print out the {pre,post}\_{install,remove,upgrade}
scripts of a given package.
* pacsearch - a colorized search combining both -Ss and -Qs output. Installed
packages are easily identified with a `[installed]`, and
local-only packages are also listed.
* rankmirrors - ranks pacman mirrors by their connection and opening speed.
* updpkgsums - performs an in-place update of the checksums in a PKGBUILD.

View File

@ -1,3 +0,0 @@
#!/bin/bash -x
autoreconf -i

View File

@ -1,200 +0,0 @@
AC_INIT([pacman-contrib], [1.4.0], [pacman-contrib@lists.archlinux.org])
AC_CONFIG_MACRO_DIR([m4])
AC_CONFIG_AUX_DIR([build-aux])
AC_REQUIRE_AUX_FILE([tap-driver.sh])
AM_INIT_AUTOMAKE([-Wall foreign])
# Help line for root directory
AC_ARG_WITH(root-dir,
AS_HELP_STRING([--with-root-dir=PATH], [set the location of the root operating directory]),
[ROOTDIR=$withval], [ROOTDIR=/])
# Help line for vim runtime directory
AC_ARG_WITH(vim-dir,
[AS_HELP_STRING([--with-vim-dir=PATH], [set the location of the vim runtime file directory])],
[vim_dir=$withval], [vim_dir=$datadir/vim/vimfiles])
# Help line for documentation
AC_ARG_ENABLE(doc,
AS_HELP_STRING([--disable-doc], [prevent make from looking at doc/ dir]),
[wantdoc=$enableval], [wantdoc=yes])
# Help line for debug
AC_ARG_ENABLE(debug,
AS_HELP_STRING([--enable-debug], [enable debugging support]),
[debug=$enableval], [debug=no])
# Help line for compiler warning flags
AC_ARG_ENABLE(warningflags,
AS_HELP_STRING([--enable-warningflags], [enable extra compiler warning flags]),
[warningflags=$enableval], [warningflags=no])
# Help line for using git version in pacman version string
AC_ARG_ENABLE(git-version,
AS_HELP_STRING([--enable-git-version],
[enable use of git version in version string if available]),
[wantgitver=$enableval], [wantgitver=no])
# Checks for programs.
AC_PROG_CC
AC_PROG_CC_C99
AC_PATH_PROGS([BASH_SHELL], [bash bash4], [false])
AS_IF([test "x$BASH_SHELL" = "xfalse"],
AC_MSG_WARN([*** bash >= 4.1.0 is required for pacman scripts]),
[bash_version_major=`$BASH_SHELL -c 'echo "${BASH_VERSINFO[[0]]}"'`
bash_version_minor=`$BASH_SHELL -c 'echo "${BASH_VERSINFO[[1]]}"'`
ok=yes
if test "$bash_version_major" -lt 4; then
ok=no
fi
if test "$bash_version_major" -eq 4 && test "$bash_version_minor" -lt 1; then
ok=no
fi
if test "$ok" = "no"; then
AC_MSG_ERROR([*** bash >= 4.1.0 is required for pacman scripts])
fi
unset bash_version_major bash_version_minor ok])
# Check for libarchive
PKG_CHECK_MODULES(LIBARCHIVE, [libarchive >= 2.8.0], ,
AC_MSG_ERROR([*** libarchive >= 2.8.0 is needed to build pacman-contrib!]))
# Check for libalpm
PKG_CHECK_MODULES(LIBALPM, [libalpm], ,
AC_MSG_ERROR([*** libalpm is needed to build pacman-contrib!]))
PKG_CHECK_VAR(LIBMAKEPKGDIR, [libmakepkg], [libmakepkgdir], ,
AC_MSG_ERROR([*** libmakepkg is needed to build pacman-contrib!]))
AC_SUBST(LIBMAKEPKGDIR)
# Enable or disable use of git version in version string
AC_MSG_CHECKING(whether to use git version if available)
if test "x$wantgitver" = "xyes" ; then
AC_CHECK_PROGS([GIT], [git])
AC_CHECK_FILE([.git/], hasgitdir=yes)
usegitver=$ac_cv_file__git_
if test $GIT -a "x$hasgitdir" = "xyes"; then
AC_DEFINE([USE_GIT_VERSION], , [Use GIT version in version string])
fi
else
AC_MSG_RESULT([no, disabled by configure])
usegitver=no
fi
AM_CONDITIONAL(USE_GIT_VERSION, test "x$usegitver" = "xyes")
# Set root directory
AC_SUBST(ROOTDIR)
AC_DEFINE_UNQUOTED([ROOTDIR], "$ROOTDIR", [The location of the root operating directory])
# Set vim directory
AC_SUBST(vim_dir)
AC_DEFINE_UNQUOTED([vim_dir], "$vim_dir", [The location of the vim runtime file directory])
SIZECMD="stat -c %s"
AC_SUBST(SIZECMD)
# Check for documentation support and status
AC_CHECK_PROGS([ASCIIDOC], [asciidoc])
AC_MSG_CHECKING([for building documentation])
if test "x$wantdoc" = "xyes" ; then
if test $ASCIIDOC ; then
AC_MSG_RESULT([yes, enabled by configure])
else
asciidoc="(warning : asciidoc not installed)"
AC_MSG_RESULT([yes $asciidoc])
fi
wantdoc=yes
else
AC_MSG_RESULT([no, disabled by configure])
wantdoc=no
fi
AM_CONDITIONAL(WANT_DOC, test "x$wantdoc" = "xyes")
# Enable or disable debug code
if test "x$debug" = "xyes" ; then
AC_MSG_RESULT(yes)
GCC_STACK_PROTECT_LIB
GCC_STACK_PROTECT_CC
GCC_FORTIFY_SOURCE_CC
WARNING_CFLAGS="-g -Wall -Werror"
else
AC_MSG_RESULT(no)
WARNING_CFLAGS="-Wall"
fi
# Enable or disable compiler warning flags
AC_MSG_CHECKING(for excessive compiler warning flags)
if test "x$warningflags" = "xyes" ; then
AC_MSG_RESULT(yes)
CFLAGS_ADD([-Wcast-align], [WARNING_CFLAGS])
CFLAGS_ADD([-Wclobbered], [WARNING_CFLAGS])
CFLAGS_ADD([-Wempty-body], [WARNING_CFLAGS])
CFLAGS_ADD([-Wfloat-equal], [WARNING_CFLAGS])
CFLAGS_ADD([-Wformat-nonliteral], [WARNING_CFLAGS])
CFLAGS_ADD([-Wformat-security], [WARNING_CFLAGS])
CFLAGS_ADD([-Wignored-qualifiers], [WARNING_CFLAGS])
CFLAGS_ADD([-Winit-self], [WARNING_CFLAGS])
CFLAGS_ADD([-Wlogical-op], [WARNING_CFLAGS])
CFLAGS_ADD([-Wmissing-declarations], [WARNING_CFLAGS])
CFLAGS_ADD([-Wmissing-field-initializers], [WARNING_CFLAGS])
CFLAGS_ADD([-Wmissing-parameter-type], [WARNING_CFLAGS])
CFLAGS_ADD([-Wmissing-prototypes], [WARNING_CFLAGS])
CFLAGS_ADD([-Wold-style-declaration], [WARNING_CFLAGS])
CFLAGS_ADD([-Woverride-init], [WARNING_CFLAGS])
CFLAGS_ADD([-Wpointer-arith], [WARNING_CFLAGS])
CFLAGS_ADD([-Wredundant-decls], [WARNING_CFLAGS])
CFLAGS_ADD([-Wshadow], [WARNING_CFLAGS])
CFLAGS_ADD([-Wsign-compare], [WARNING_CFLAGS])
CFLAGS_ADD([-Wstrict-aliasing], [WARNING_CFLAGS])
CFLAGS_ADD([-Wstrict-overflow=5], [WARNING_CFLAGS])
CFLAGS_ADD([-Wstrict-prototypes], [WARNING_CFLAGS])
CFLAGS_ADD([-Wtype-limits], [WARNING_CFLAGS])
CFLAGS_ADD([-Wuninitialized], [WARNING_CFLAGS])
CFLAGS_ADD([-Wunused-but-set-parameter], [WARNING_CFLAGS])
CFLAGS_ADD([-Wunused-parameter], [WARNING_CFLAGS])
CFLAGS_ADD([-Wwrite-strings], [WARNING_CFLAGS])
else
AC_MSG_RESULT(no)
fi
AC_CONFIG_FILES([
lib/Makefile
src/Makefile
doc/Makefile
test/Makefile
Makefile
])
AC_OUTPUT
echo "
${PACKAGE_NAME}:
Build information:
prefix : ${prefix}
sysconfdir : $(eval echo ${sysconfdir})
conf file : $(eval echo ${sysconfdir})/pacman.conf
localstatedir : $(eval echo ${localstatedir})
database dir : $(eval echo ${localstatedir})/lib/pacman/
cache dir : $(eval echo ${localstatedir})/cache/pacman/pkg/
libmakepkg dir : $(eval echo ${LIBMAKEPKGDIR})
compiler : ${CC}
compiler flags : ${WARNING_CFLAGS} ${CFLAGS}
linker flags : ${LDFLAGS} ${LIBALPM_LIBS} ${LIBARCHIVE_LIBS}
Filesize command : ${SIZECMD}
using git version : ${usegitver}
Directory and file information:
root working directory : ${ROOTDIR}
Compilation options:
Run make in doc/ dir : ${wantdoc} ${asciidoc}
debug support : ${debug}
extra warning flags : ${warningflags}
use git version : ${wantgitver}
"
# vim:set noet:

View File

@ -1,5 +0,0 @@
pacman-contrib (1.4.0-1) UNRELEASED; urgency=medium
* Initial release
-- unknown <ndowens@artixlinux.org> Fri, 14 Jan 2022 01:29:59 +0000

View File

@ -1,16 +0,0 @@
Source: pacman-contrib
Section: misc
Priority: optional
Maintainer: unknown <ndowens@artixlinux.org>
Build-Depends: debhelper-compat (= 13), pkg-config, arch-pacman,
libarchive-dev, libcrypto++-dev, libssl-dev,
libcurl-dev, asciidoc-base
Standards-Version: 4.6.0
#Vcs-Browser: https://salsa.debian.org/debian/pacman-contrib
#Vcs-Git: https://salsa.debian.org/debian/pacman-contrib.git
Rules-Requires-Root: no
Package: pacman-contrib
Architecture: any
Depends: ${shlibs:Depends}, ${misc:Depends}
Description: pacman related extras

View File

@ -1,26 +0,0 @@
Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
Upstream-Name: pacman-contrib
Files: *
License: GPL-2.0+
Files: debian/*
Copyright: 2022 unknown <ndowens@artixlinux.org>
License: GPL-2.0+
License: GPL-2.0+
This package 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 package 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 <https://www.gnu.org/licenses/>
.
On Debian systems, the complete text of the GNU General
Public License version 2 can be found in "/usr/share/common-licenses/GPL-2".

View File

@ -1,33 +0,0 @@
#!/usr/bin/make -f
# See debhelper(7) (uncomment to enable)
# output every command that modifies files on the build system.
#export DH_VERBOSE = 1
# see FEATURE AREAS in dpkg-buildflags(1)
#export DEB_BUILD_MAINT_OPTIONS = hardening=+all
# see ENVIRONMENT in dpkg-buildflags(1)
# package maintainers to append CFLAGS
#export DEB_CFLAGS_MAINT_APPEND = -Wall -pedantic
# package maintainers to append LDFLAGS
#export DEB_LDFLAGS_MAINT_APPEND = -Wl,--as-needed
%:
dh $@
override_dh_auto_configure:
./autogen.sh
dh_auto_configure
./configure \
--prefix=/usr \
--libdir=/usr/lib
# dh_make generated override targets
# This is example for Cmake (See https://bugs.debian.org/641051 )
#override_dh_auto_configure:
# dh_auto_configure -- \
# -DCMAKE_LIBRARY_PATH=$(DEB_HOST_MULTIARCH)

View File

@ -1,3 +0,0 @@
*.8
*.html
website.tar.gz

View File

@ -1,119 +0,0 @@
# We have to do some funny stuff here with the manpages. In order to ensure
# a dist tarball doesn't get put out there without manpages, we keep those
# files listed in EXTRA_DIST no matter what. However, we only add them to
# man_MANS if --enable-asciidoc and/or --enable-doxygen are used.
ASCIIDOC_MANS = \
checkupdates.8 \
paccache.8 \
pacdiff.8 \
pacsort.8 \
pactree.8 \
updpkgsums.8
HTML_MANPAGES = \
checkupdates.8.html \
paccache.8.html \
pacdiff.8.html \
pacsort.8.html \
pactree.8.html \
updpkgsums.8.html
HTML_OTHER = \
release-procedure.html \
submitting-patches.html
HTML_DOCS = \
$(HTML_MANPAGES) \
$(HTML_OTHER)
EXTRA_DIST = \
asciidoc.conf \
asciidoc-override.css \
checkupdates.8.txt \
paccache.8.txt \
pacdiff.8.txt \
pacsort.8.txt \
pactree.8.txt \
updpkgsums.8.txt \
footer.txt \
$(ASCIIDOC_MANS)
# Files that should be removed, but which Automake does not know.
MOSTLYCLEANFILES = *.xml $(ASCIIDOC_MANS) $(HTML_DOCS) website.tar.gz
# Ensure manpages are fresh when building a dist tarball
dist-hook:
$(MAKE) $(AM_MAKEFLAGS) clean
$(MAKE) $(AM_MAKEFLAGS) all
if USE_GIT_VERSION
GIT_VERSION := $(shell sh -c 'git describe --long --abbrev=4 --dirty | sed s/^v//')
REAL_PACKAGE_VERSION = $(GIT_VERSION)
else
REAL_PACKAGE_VERSION = $(PACKAGE_VERSION)
endif
man_MANS =
dist_man_MANS = $(ASCIIDOC_MANS)
html: $(HTML_DOCS)
website: website.tar.gz
.PHONY: html website
website.tar.gz: html
$(AM_V_GEN)bsdtar czf $@ $(HTML_DOCS) \
asciidoc-override.css \
-C /etc/asciidoc/stylesheets/ \
asciidoc.css \
-C /etc/asciidoc/javascripts/ \
asciidoc.js \
-C /etc/asciidoc/ \
images
pkgdatadir = ${datadir}/${PACKAGE}
ASCIIDOC_OPTS = \
-f $(srcdir)/asciidoc.conf \
-a pacman_contrib_version="$(REAL_PACKAGE_VERSION)" \
-a pkgdatadir=$(pkgdatadir) \
-a localstatedir=$(localstatedir) \
-a sysconfdir=$(sysconfdir)
A2X_OPTS = \
--no-xmllint \
-d manpage \
-f manpage \
--xsltproc-opts='-param man.endnotes.list.enabled 0 -param man.endnotes.are.numbered 0'
# These rules are due to the includes and files of the asciidoc text
$(ASCIIDOC_MANS): asciidoc.conf footer.txt Makefile.am
$(AM_V_GEN)a2x $(A2X_OPTS) --asciidoc-opts="$(ASCIIDOC_OPTS) --out-file=./$@.xml" $(srcdir)/$@.txt
%.html: %.txt
$(AM_V_GEN)asciidoc $(ASCIIDOC_OPTS) -o - $*.txt | \
sed -e 's/\r$$//' > $@
HACKING.html: ../HACKING
$(AM_V_GEN)asciidoc $(ASCIIDOC_OPTS) -o - ../HACKING | \
sed -e 's/\r$$//' > $@
# Customizations for certain HTML docs
$(HTML_MANPAGES): asciidoc.conf footer.txt Makefile.am
$(HTML_OTHER): asciidoc.conf Makefile.am
%.html: ASCIIDOC_OPTS += -a linkcss -a toc -a icons -a max-width=960px -a stylesheet=asciidoc-override.css
%.8.html: ASCIIDOC_OPTS += -d manpage
%.5.html: ASCIIDOC_OPTS += -d manpage
%.3.html: ASCIIDOC_OPTS += -d manpage
# Dependency rules
checkupdates.8 checkupdates.8.html: checkupdates.8.txt
paccache.8 paccache.8.html: paccache.8.txt
pacdiff.8 pacdiff.8.html: pacdiff.8.txt
pactree.8 pactree.8.html: pactree.8.txt
pacsort.8 pacsort.8.html: pacsort.8.txt
updpkgsums.8 updpkgsums.8.html: updpkgsums.8.txt
# vim:set noet:

View File

@ -1,7 +0,0 @@
table th, table td {
padding: 0.2em 1em;
}
table td p.table {
margin: 0;
}

View File

@ -1,72 +0,0 @@
## linkman: macro
# Inspired by/borrowed from the GIT source tree at Documentation/asciidoc.conf
#
# Usage: linkman:command[manpage-section]
#
# Note, {0} is the manpage section, while {target} is the command.
#
# Show man link as: <command>(<section>); if section is defined, else just show
# the command.
[macros]
(?su)[\\]?(?P<name>linkman):(?P<target>\S*?)\[(?P<attrlist>.*?)\]=
[attributes]
asterisk=&#42;
plus=&#43;
caret=&#94;
startsb=&#91;
endsb=&#93;
backslash=&#92;
tilde=&#126;
apostrophe=&#39;
backtick=&#96;
litdd=&#45;&#45;
ifdef::backend-docbook[]
[linkman-inlinemacro]
{0%{target}}
{0#<citerefentry>}
{0#<refentrytitle>{target}</refentrytitle><manvolnum>{0}</manvolnum>}
{0#</citerefentry>}
endif::backend-docbook[]
ifdef::backend-docbook[]
ifndef::docbook-xsl-172[]
# "unbreak" docbook-xsl v1.68 for manpages. v1.69 works with or without this.
# v1.72 breaks with this because it replaces dots not in roff requests.
[listingblock]
<example><title>{title}</title>
<literallayout>
|
</literallayout>
{title#}</example>
endif::docbook-xsl-172[]
endif::backend-docbook[]
ifdef::doctype-manpage[]
ifdef::backend-docbook[]
[header]
template::[header-declarations]
<refentry>
<refentryinfo>
<date>{localdate}</date>
</refentryinfo>
<refmeta>
<refentrytitle>{mantitle}</refentrytitle>
<manvolnum>{manvolnum}</manvolnum>
<refmiscinfo class="source">Pacman-contrib</refmiscinfo>
<refmiscinfo class="version">{pacman_contrib_version}</refmiscinfo>
<refmiscinfo class="manual">Pacman-contrib Manual</refmiscinfo>
</refmeta>
<refnamediv>
<refname>{manname}</refname>
<refpurpose>{manpurpose}</refpurpose>
</refnamediv>
endif::backend-docbook[]
endif::doctype-manpage[]
ifdef::backend-xhtml11[]
[linkman-inlinemacro]
<a href="{target}.{0}.html">{target}{0?({0})}</a>
endif::backend-xhtml11[]

View File

@ -1,60 +0,0 @@
/////
vim:set ts=4 sw=4 syntax=asciidoc noet spell spelllang=en_us:
/////
checkupdates(8)
=============
Name
----
checkupdates - safely print a list of pending updates
Synopsis
--------
'checkupdates' [options]
Description
-----------
Checks for pending updates using a separate Pacman database located in
*`TMPDIR`* if *`CHECKUPDATES_DB`* is not set and outputs a list of updates with the
old and new version.
Options
-------
*-d, \--download*::
Download any pending updates to the pacman cache.
*-h, \--help*::
Display syntax and command line options.
Environment
-----------
*CHECKUPDATES_DB*::
Override the default update db location.
*TMPDIR*::
Overrides the default '/tmp' temporary directory.
Errors
------
On exit, checkupdates will return one of the following error codes.
0::
Normal exit condition.
1::
Unknown cause of failure.
2::
No updates are available.
See Also
--------
linkman:pacman[8], linkman:pacman.conf[5]
include::footer.txt[]

View File

@ -1,21 +0,0 @@
/////
vim:set ts=4 sw=4 syntax=asciidoc noet spell spelllang=en_us:
/////
Bugs
----
Bugs? You must be kidding; there are no bugs in this software. But if we
happen to be wrong, send us an email with as much detail as possible to
mailto:pacman-contrib@lists.archlinux.org[].
Authors
-------
Current maintainers:
* Johannes Löthberg <johannes@kyriasis.com>
* Daniel M. Capella <polyzen@archlinux.org>
For additional contributors, use `git shortlog -s` on the pacman-contrib.git
repository.

View File

@ -1,90 +0,0 @@
/////
vim:set ts=4 sw=4 syntax=asciidoc noet spell spelllang=en_us:
/////
paccache(8)
=========
Name
----
paccache - flexible pacman cache cleaning utility
Synopsis
--------
'paccache' <operation> [options] [targets...]
Description
-----------
Paccache removes old packages from the pacman cache directory.
By default the last three versions of a package are kept.
Operations
----------
*-d, \--dryrun*::
Perform a dry run, only finding candidate packages.
*-m, \--move <dir>*::
Move candidate packages from the cache directory to 'dir'.
*-r, \--remove*::
Remove candidate packages from the cache directory.
Options
-------
*-a, \--arch <arch>*::
Scan for packages for a specific architecture. Default is to scan for
all architectures.
*\--min-atime <age>*::
*\--min-mtime <age>*::
Only consider packages for removal with atime respectively mtime older than
specified. The age can be given as '10d', '1m', '1y', '1y1m' etc.
*-c, \--cachedir <dir>*::
Specify a different cache directory. This option can be used more than once.
Default is to use the cache directory configured in 'pacman.conf'.
*-f, \--force*::
Apply force to 'mv' and 'rm' operations.
*-h, \--help*::
Display syntax and command line options.
*-i, \--ignore <pkgs>*::
Specify packages to ignore, comma-separated. Alternatively "-" can be used
to read the package names from stdin, newline-delimited.
*-k, \--keep <num>*::
Specify how many versions of each package are kept in the cache directory,
default is 3.
*\--nocolor*::
Remove color from the output.
*-q, \--quiet*::
Minimize the output.
*-u, \--uninstalled*::
Target uninstalled packages.
*-v, \--verbose*::
Increase verbosity, can be specified up to 3 times.
*-z, \--null*::
Use null delimiters for candidate names (only with -v and -vv).
Systemd Timer
-------------
The package cache can be cleaned periodically using the systemd timer 'paccache.timer'.
If the timer is enabled the cache will be cleaned weekly with paccache's default options.
See Also
--------
linkman:pacman[8], linkman:pacman.conf[5], linkman:systemctl[1]
include::footer.txt[]

View File

@ -1,63 +0,0 @@
/////
vim:set ts=4 sw=4 syntax=asciidoc noet spell spelllang=en_us:
/////
pacdiff(8)
==========
Name
----
pacdiff - pacorig, pacnew and pacsave maintenance utility
Synopsis
--------
'pacdiff' [options]
Description
-----------
pacdiff is a script which looks for pacorig, pacnew and pacsave files from the
backup entries found in the local Pacman db. For every found file the option is
given to view, merge, skip, diff, remove or overwrite the found pacorig, pacnew
or pacsave file.
Environment
-----------
*DIFFPROG*::
Override the default 'vim -d' merge program.
*DIFFSEARCHPATH*::
Override the default search path '/etc', only when using find.
*MERGEPROG*::
Override the default 'diff3 -m' 3-way merge program. One possible
alternative is 'git merge-file -p'.
Options
-------
*-l, \--locate*::
Scan using locate.
*-f, \--find*::
Scan using find.
*-p, \--pacmandb*::
Scan active config files from Pacman database. (default)
*-o, \--output*::
Print files instead of merging them.
*\--nocolor*::
Remove colors from output.
*-c, \--cachedir <dir>*::
Scan 'dir' instead as the pacman cache for 3-way merge base candidates.
*-s, \--sudo*::
Use sudo to merge/remove files.
See Also
--------
linkman:pacman[8], linkman:pacman.conf[5]
include::footer.txt[]

View File

@ -1,55 +0,0 @@
/////
vim:set ts=4 sw=4 syntax=asciidoc noet spell spelllang=en_us:
/////
pacsort(8)
=========
Name
----
pacsort - sort utility implementing alpm_pkg_vercmp
Synopsis
--------
'pacsort' [options] [files...]
Description
-----------
'pacsort' concatenates the given files, sorts them, and writes them to standard
output. Default order is oldest to newest.
Standard input is read when no files are given.
By default the lines are treated as lists of plain version strings.
Options
-------
*-f, \--files*::
If the input lists are in the format '\*-\*.pkg.tar*', sort lines by pkgname and pkgver.
*-h, \--help*::
Display syntax and command line options.
*-k, \--key <index>*::
Sort the input starting on the specified column.
*-r, \--reverse*::
Sort in reverse order.
*-t, \--separator <sep>*::
Field separator. Default separator is space.
*-v, \--version*::
Display the version.
*-z, \--null*::
Lines end with null bytes rather than newlines.
See Also
--------
linkman:pacman[8], linkman:vercmp[8]
include::footer.txt[]

View File

@ -1,82 +0,0 @@
/////
vim:set ts=4 sw=4 syntax=asciidoc noet spell spelllang=en_us:
/////
pactree(8)
=========
Name
----
pactree - package dependency tree viewer
Synopsis
--------
'pactree' [options] package
Description
-----------
Pactree produces a dependency tree for a package.
By default, a tree-like output is generated, but with the '\--graph' option, a Graphviz
description is generated.
Options
-------
*-a, \--ascii*::
Use ASCII characters for tree formatting. By default, pactree will use Unicode
line drawing characters if it is able to detect that the locale supports them.
*-b, \--dbpath*::
Specify an alternative database location.
*-c, \--color*::
Colorize output.
*-d, \--depth <num>*::
Limits the number of levels of dependency to show. A zero means
show the named package only, one shows the packages that are directly
required.
*-g, \--graph*::
Generate a Graphviz description. If this option is given, the '\--color' and
'\--linear' options are ignored.
*-h, \--help*::
Output syntax and command-line options.
*-l, \--linear*::
Prints package names at the start of each line, one per line.
*-r, \--reverse*::
Show packages that depend on the named package.
*-s, \--sync*::
Read package data from sync databases instead of local database.
*-u, \--unique*::
List dependent packages once. Implies '\--linear'.
*-o, \--optional[=DEPTH]*::
Additionally prints optional dependencies up to a certain depth, default 1
for immediate optional dependencies. When used in conjunction with '-r' it
shows which packages it is optional for. In Graphviz mode, produce dotted
lines. Negative values mean infinite depth.
*\--config <file>*::
Specify an alternate pacman configuration file.
*\--debug*::
Print log messages produced by libalpm.
*\--gpgdir <dir>*::
Specify an alternate GnuPG directory for verifying database signatures
(default is /etc/pacman.d/gnupg).
See Also
--------
linkman:pacman[8], linkman:pacman.conf[5], linkman:makepkg[8]
include::footer.txt[]

View File

@ -1,43 +0,0 @@
Release Procedure
=================
Preparations
------------
--
Before tagging the release, ensure that:
* `CHANGES.md` has been updated with all changes that will go into the new release.
--
Procedure
---------
--
Assuming `$VERSION` is the version number in `X.Y.Z` format and `$REMOTE` is the Git remote for the `pacman-contrib` repository on `gitlab.archlinux.org`:
* Update the version in `configure.ac`.
* In `CHANGES.md`:
- Rename the `Unreleased` section to `[$VERSION] - YYYY-MM-DD`.
- Populate new `Unreleased` section.
- Add the Git log URL for the new tag to the bottom of the file.
- Bump the version in the `Unreleased` Git log URL.
* `git commit -sm "Release v$VERSION"`
* `git tag -s v$VERSION -m v$VERSION`
* {blank}
+
----
git notes --ref=refs/notes/signatures/tar add -C "$(
git archive --format tar --prefix "pacman-contrib-$VERSION/" v$VERSION |
gpg --output - --armor --detach-sign |
git hash-object -w --stdin
)" v$VERSION
----
* `git push $REMOTE master $VERSION refs/notes/signatures/tar`
--
/////
vim:set ts=4 sw=4 syntax=asciidoc noet spell spelllang=en_us:
/////

View File

@ -1,104 +0,0 @@
Submitting Patches
==================
This document is here mainly to make the job of those who review patches easier
and is more of a guideline rather than a strict set of rules. However, please
try to follow them as much as you can.
Getting the most recent source
------------------------------
Patches need to be submitted in Git format and are best if they are against the
latest version of the code. There are several helpful tutorials for getting
started with Git if you have not worked with it before.
* https://git-scm.com/book
* https://www.kernel.org/pub/software/scm/git/docs/gittutorial.html
The pacman-contrib code can be fetched using the following command:
git clone git://projects.archlinux.org/pacman-contrib.git
Creating your patch
-------------------
--
* Use `git commit -s` for creating a commit of your changes.
The -s allows you to credit yourself by adding a "Signed Off By" line to
indicate who has "signed" the patch - who has approved it.
Signed-off-by: Aaron Griffin <aaron@archlinux.org>
Please use your real name and email address. Feel free to "scramble" the
address if you're afraid of spam.
* Describe your patch.
It helps if you describe the overview and goals of the patch in the git commit
log. This allows others to see what you intended so as to compare it to what
was actually done, and allows better feedback.
* Use `git format-patch` to create patches.
Your commit message will be shown above the patch by default when you will use
`git format-patch`, including the signoff line. Sets of multiple patches that
need extra explanation beyond the commit messages may include additional notes
in a cover letter. Individual patches may include additional notes between the
"---" following the commit message and the beginning of the diff.
--
Submitting your patch
---------------------
--
* Send the patch to the https://lists.archlinux.org/listinfo/pacman-contrib[pacman-contrib] mailing list
The mailing list is the primary queue for review and acceptance. Here you
will get feedback, and let the reviewers know the details of your patch.
* No MIME, no links, no compression, no attachments. Just plain text.
Patches should be contained in the actual body of the email. There are many
reasons for this. First, it makes them easier to read with any mail reader,
it allows easier review "at a glance", and most importantly, it allows people
to comment on exact lines of the patch in reply emails.
`git send-email` allows you to send Git-formatted patches in plain text easily
and is the preferred method for submission to the mailing list. Mail clients,
including Gmail's web interface, have a tendency to break patches by wrapping
lines and/or adjusting whitespace and should be avoided.
--
After you submit
----------------
--
* Don't get discouraged
Any feedback you get, positive or negative, has nothing to do with you. If a
patch is rejected, try taking the suggestions into account and re-submitting.
We welcome most submissions here, and some may take a bit longer to get
looked over than others. If you think your patch got lost in the shuffle,
send another email to the list in reply to the original asking if anyone has
looked at it yet.
* Respond to feedback
When you do get feedback, it usually merits a response, whether this be a
resubmission of the patch with corrections or a follow-up email asking for
clarifications. When neither of these occurs, don't expect your patch to get
further review. The all-volunteer staff don't have time to fix up patches that
aren't their own. When resubmitting patches, update the subject line to reflect
the version number ('[PATCHv2]'), and send it as a reply to the original
thread. When using `git format-patch` you can pass in e.g. -v2 to have it
automatically set the patch prefix appropriately.
--
/////
vim:set ts=4 sw=4 syntax=asciidoc noet spell spelllang=en_us:
/////

View File

@ -1,37 +0,0 @@
/////
vim:set ts=4 sw=4 syntax=asciidoc noet spell spelllang=en_us:
/////
updpkgsums(8)
===========
Name
----
updpkgsums - update checksums of a PKGBUILD file
Synopsis
--------
'updpkgsums' [options] [build file]
Description
-----------
'updpkgsums' will perform an in place update of the checksums in the path
specified by [build file], defaulting to PKGBUILD in the current working
directory.
Options
-------
*-V, \--version*::
Display version information and exit.
*-m, \--nocolor*::
Disable colorized output messages.
See Also
--------
linkman:makepkg[8], linkman:pkgbuild[5]
include::footer.txt[]

View File

@ -1,8 +0,0 @@
SUBDIRS=
DIST_SUBDIRS = $(SUBDIRS)
EXTRA_DIST = \
size_to_human.sh
# vim:set noet:

View File

@ -1,22 +0,0 @@
size_to_human() {
awk -v size="$1" '
BEGIN {
suffix[1] = "B"
suffix[2] = "KiB"
suffix[3] = "MiB"
suffix[4] = "GiB"
suffix[5] = "TiB"
suffix[6] = "PiB"
suffix[7] = "EiB"
count = 1
while (size > 1024) {
size /= 1024
count++
}
sizestr = sprintf("%.2f", size)
sub(/\.?0+$/, "", sizestr)
printf("%s %s", sizestr, suffix[count])
}'
}

View File

@ -1,160 +0,0 @@
dnl acinclude.m4 - configure macros used by pacman and libalpm
dnl Add some custom macros for pacman and libalpm
dnl GCC_STACK_PROTECT_LIB
dnl adds -lssp to LIBS if it is available
dnl ssp is usually provided as part of libc, but was previously a separate lib
dnl It does not hurt to add -lssp even if libc provides SSP - in that case
dnl libssp will simply be ignored.
AC_DEFUN([GCC_STACK_PROTECT_LIB],[
AC_CACHE_CHECK([whether libssp exists], ssp_cv_lib,
[ssp_old_libs="$LIBS"
LIBS="$LIBS -lssp"
AC_TRY_LINK(,, ssp_cv_lib=yes, ssp_cv_lib=no)
LIBS="$ssp_old_libs"
])
if test $ssp_cv_lib = yes; then
LIBS="$LIBS -lssp"
fi
])
dnl GCC_STACK_PROTECT_CC
dnl checks -fstack-protector-all with the C compiler, if it exists then updates
dnl CFLAGS and defines ENABLE_SSP_CC
AC_DEFUN([GCC_STACK_PROTECT_CC],[
AC_LANG_ASSERT(C)
if test "X$CC" != "X"; then
AC_CACHE_CHECK([whether ${CC} accepts -fstack-protector-all],
ssp_cv_cc,
[ssp_old_cflags="$CFLAGS"
CFLAGS="$CFLAGS -fstack-protector-all"
AC_TRY_COMPILE(,, ssp_cv_cc=yes, ssp_cv_cc=no)
CFLAGS="$ssp_old_cflags"
])
if test $ssp_cv_cc = yes; then
CFLAGS="$CFLAGS -fstack-protector-all"
AC_DEFINE([ENABLE_SSP_CC], 1, [Define if SSP C support is enabled.])
fi
fi
])
dnl GCC_FORTIFY_SOURCE_CC
dnl checks -D_FORTIFY_SOURCE with the C compiler, if it exists then updates
dnl CPPFLAGS
AC_DEFUN([GCC_FORTIFY_SOURCE_CC],[
AC_LANG_ASSERT(C)
if test "X$CC" != "X"; then
AC_MSG_CHECKING(for FORTIFY_SOURCE support)
fs_old_cppflags="$CPPFLAGS"
fs_old_cflags="$CFLAGS"
CPPFLAGS="$CPPFLAGS -D_FORTIFY_SOURCE=2"
CFLAGS="$CFLAGS -Werror"
AC_TRY_COMPILE([#include <features.h>], [
int main() {
#if !(__GNUC_PREREQ (4, 1) )
#error No FORTIFY_SOURCE support
#endif
return 0;
}
], [
AC_MSG_RESULT(yes)
CFLAGS="$fs_old_cflags"
], [
AC_MSG_RESULT(no)
CPPFLAGS="$fs_old_cppflags"
CFLAGS="$fs_old_cflags"
])
fi
])
dnl GCC_VISIBILITY_CC
dnl checks -fvisibility=internal with the C compiler, if it exists then
dnl defines ENABLE_VISIBILITY_CC in both configure script and Makefiles
AC_DEFUN([GCC_VISIBILITY_CC],[
AC_LANG_ASSERT(C)
if test "X$CC" != "X"; then
AC_CACHE_CHECK([whether ${CC} accepts -fvisibility=internal],
visibility_cv_cc,
[visibility_old_cflags="$CFLAGS"
CFLAGS="$CFLAGS -fvisibility=internal"
AC_TRY_COMPILE(,, visibility_cv_cc=yes, visibility_cv_cc=no)
CFLAGS="$visibility_old_cflags"
])
if test $visibility_cv_cc = yes; then
AC_DEFINE([ENABLE_VISIBILITY_CC], 1, [Define if symbol visibility C support is enabled.])
fi
AM_CONDITIONAL([ENABLE_VISIBILITY_CC], test "x$visibility_cv_cc" = "xyes")
fi
])
dnl CFLAGS_ADD(PARAMETER, VARIABLE)
dnl Adds parameter to VARIABLE if the compiler supports it. For example,
dnl CFLAGS_ADD([-Wall],[WARN_FLAGS]).
AC_DEFUN([CFLAGS_ADD],
[AS_VAR_PUSHDEF([my_cflags], [cflags_cv_warn_$1])dnl
AC_CACHE_CHECK([whether compiler handles $1], [my_cflags], [
save_CFLAGS="$CFLAGS"
CFLAGS="${CFLAGS} -Werror=unknown-warning-option"
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([])],
[],
[CFLAGS="$save_CFLAGS"])
CFLAGS="${CFLAGS} $1"
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([])],
[AS_VAR_SET([my_cflags], [yes])],
[AS_VAR_SET([my_cflags], [no])])
CFLAGS="$save_CFLAGS"
])
AS_VAR_PUSHDEF([new_cflags], [[$2]])dnl
AS_VAR_IF([my_cflags], [yes], [AS_VAR_APPEND([new_cflags], [" $1"])])
AS_VAR_POPDEF([new_cflags])dnl
AS_VAR_POPDEF([my_cflags])dnl
m4_ifval([$2], [AS_LITERAL_IF([$2], [AC_SUBST([$2])], [])])dnl
])
dnl Checks for getmntinfo and determines whether it uses statfs or statvfs
AC_DEFUN([FS_STATS_TYPE],
[AC_CACHE_CHECK([filesystem statistics type], fs_stats_cv_type,
[AC_CHECK_FUNC(getmntinfo,
[AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM([[
# include <sys/param.h>
# include <sys/mount.h>
#if HAVE_SYS_UCRED_H
#include <sys/ucred.h>
#endif
extern int getmntinfo (struct statfs **, int);
]],
[])],
[fs_stats_cv_type="struct statfs"],
[fs_stats_cv_type="struct statvfs"])],
[AC_CHECK_FUNC(getmntent,
[fs_stats_cv_type="struct statvfs"])]
)]
)
AC_DEFINE_UNQUOTED(FSSTATSTYPE, [$fs_stats_cv_type],
[Defined as the filesystem stats type ('statvfs' or 'statfs')])
if test $ac_cv_func_getmntinfo = yes; then
if test "$fs_stats_cv_type" = "struct statvfs"; then
AC_DEFINE([HAVE_GETMNTINFO_STATVFS], 1, [Define if getmntinfo() uses statvfs.])
else
AC_DEFINE([HAVE_GETMNTINFO_STATFS], 1, [Define if getmntinfo() uses statfs.])
fi
fi
])
dnl Checks for PATH_MAX and defines it if not present
AC_DEFUN([PATH_MAX_DEFINED],
[AC_CACHE_CHECK([PATH_MAX defined], path_max_cv_defined,
[AC_EGREP_CPP(yes, [[
#include <limits.h>
#if defined(PATH_MAX)
yes
#endif
]],
[path_max_cv_defined=yes],
[path_max_cv_defined=no])]
)
if test $path_max_cv_defined = no; then
AC_DEFINE([PATH_MAX], 4096, [Define if PATH_MAX is undefined by limits.h.])
fi
])

View File

@ -1,15 +0,0 @@
.deps/
checkupdates
paccache
paccache.service
pacdiff
paclist
paclog-pkglist
pacscripts
pacsearch
pacsort
pacsort.o
pactree
pactree.o
rankmirrors
updpkgsums

View File

@ -1,143 +0,0 @@
# enforce that all scripts have a --help and --version option
AUTOMAKE_OPTIONS = std-options
SUBDIRS=
DIST_SUBDIRS = $(SUBDIRS)
# paths set at make time
conffile = ${sysconfdir}/pacman.conf
dbpath = ${localstatedir}/lib/pacman/
gpgdir = ${sysconfdir}/pacman.d/gnupg/
bin_SCRIPTS = \
$(OURSCRIPTS)
bin_PROGRAMS = pacsort pactree
vim_ftdetect_dir = $(vim_dir)/ftdetect
vim_ftplugin_dir = $(vim_dir)/ftplugin
vim_syntax_dir = $(vim_dir)/syntax
vim_ftdetect__DATA = \
vim/ftdetect/PKGBUILD.vim
vim_ftplugin__DATA = \
vim/ftplugin/PKGBUILD.vim
vim_syntax__DATA = \
vim/syntax/PKGBUILD.vim
systemd_dir = ${libdir}/systemd/system
systemd__DATA = \
paccache.service paccache.timer \
pacman-filesdb-refresh.service pacman-filesdb-refresh.timer
BASHSCRIPTS = \
checkupdates \
paccache \
pacdiff \
paclist \
paclog-pkglist \
pacscripts \
rankmirrors \
updpkgsums
PERLSCRIPTS = \
pacsearch
OURSCRIPTS = \
$(BASHSCRIPTS) \
$(PERLSCRIPTS)
OURFILES = \
paccache.service \
pacman-filesdb-refresh.service
EXTRA_DIST = \
checkupdates.sh.in \
paccache.service.in \
paccache.sh.in \
paccache.timer \
pacdiff.sh.in \
paclist.sh.in \
paclog-pkglist.sh.in \
pacman-filesdb-refresh.service.in \
pacman-filesdb-refresh.timer \
pacscripts.sh.in \
pacsearch.pl.in \
pacsort.c \
pactree.c \
rankmirrors.sh.in \
updpkgsums.sh.in \
vim/syntax/PKGBUILD.vim \
vim/ftdetect/PKGBUILD.vim \
vim/ftplugin/PKGBUILD.vim
# Files that should be removed, but which Automake does not know.
MOSTLYCLEANFILES = $(OURSCRIPTS) $(OURFILES) *.tmp
if USE_GIT_VERSION
GIT_VERSION := $(shell sh -c 'git describe --long --abbrev=4 --dirty | sed s/^v//')
REAL_PACKAGE_VERSION = $(GIT_VERSION)
else
REAL_PACKAGE_VERSION = $(PACKAGE_VERSION)
endif
AM_CPPFLAGS = \
-DLOCALEDIR=\"@localedir@\" \
-DCONFFILE=\"$(conffile)\" \
-DDBPATH=\"$(dbpath)\" \
-DGPGDIR=\"$(gpgdir)\"
AM_CFLAGS = \
-pedantic \
-D_GNU_SOURCE \
$(WARNING_CFLAGS) \
$(LIBARCHIVE_CFLAGS) \
$(LIBALPM_CFLAGS)
edit = sed \
-e 's|@bindir[@]|$(bindir)|g' \
-e 's|@sysconfdir[@]|$(sysconfdir)|g' \
-e 's|@localstatedir[@]|$(localstatedir)|g' \
-e 's|@PACKAGE_VERSION[@]|$(REAL_PACKAGE_VERSION)|g' \
-e 's|@libmakepkgdir[@]|$(LIBMAKEPKGDIR)|g' \
-e 's|@SIZECMD[@]|$(SIZECMD)|g' \
-e 's|@SCRIPTNAME[@]|$@|g' \
-e '1s|!/bin/bash|!$(BASH_SHELL)|g' \
-e 's|@configure_input[@]|Generated from $@.sh.in; do not edit by hand.|g'
$(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
$(AM_V_at)chmod a-w $@.tmp
$(AM_V_at)mv $@.tmp $@
all-am: $(OURSCRIPTS) $(OURFILES)
$(BASHSCRIPTS): %: $(srcdir)/%.sh.in
$(PERLSCRIPTS): %: $(srcdir)/%.pl.in
# dependency links
paccache: $(top_srcdir)/lib/size_to_human.sh
pacsort_SOURCES = pacsort.c
pacsort_LDADD = $(LIBARCHIVE_LIBS) $(LIBALPM_LIBS)
pactree_SOURCES = pactree.c
pactree_LDADD = $(LIBARCHIVE_LIBS) $(LIBALPM_LIBS)
# vim:set noet:

View File

@ -1,131 +0,0 @@
#!/bin/bash
#
# checkupdates: Safely print a list of pending updates.
#
# Copyright (c) 2013 Kyle Keen <keenerd@gmail.com>
#
# 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/>.
#
declare -r myname='checkupdates'
declare -r myver='@PACKAGE_VERSION@'
LIBRARY=${LIBRARY:-'@libmakepkgdir@'}
DOWNLOAD_CACHE=0
USE_COLOR=0
# Import libmakepkg
source "$LIBRARY"/util/message.sh
source "$LIBRARY"/util/parseopts.sh
die() {
error "$@"
exit 1
}
runcmd() {
if (( EUID != 0 )); then
msg 'Escalating privileges using sudo'
if sudo -v &>/dev/null && sudo -l &>/dev/null; then
sudo "$@"
else
die 'Failed to escalate'
fi
else
"$@"
fi
}
usage() {
cat << __EOF__
${myname} v${myver}
Safely print a list of pending updates
Usage: ${myname} [options]
Options:
-d, --download download pending updates to the pacman cache.
-h, --help display this help message and exit.
Note: Export the "CHECKUPDATES_DB" variable to change the path of the temporary database.
__EOF__
}
OPT_SHORT='dh'
OPT_LONG=('download' 'help' 'nocolor')
if ! parseopts "$OPT_SHORT" "${OPT_LONG[@]}" -- "$@"; then
exit 1
fi
set -- "${OPTRET[@]}"
unset OPT_SHORT OPT_LONG OPTRET
while :; do
case $1 in
-d|--download)
DOWNLOAD_CACHE=1 ;;
-h|--help)
usage
exit 0 ;;
--nocolor)
USE_COLOR='n';;
--)
shift
break ;;
esac
shift
done
# check if messages are to be printed using color
if [[ -t 2 && $USE_COLOR != "n" ]]; then
colorize
else
unset ALL_OFF BOLD BLUE GREEN RED YELLOW
fi
if ! type -P fakeroot >/dev/null; then
die 'Cannot find the fakeroot binary'
fi
if [[ -z $CHECKUPDATES_DB ]]; then
CHECKUPDATES_DB="${TMPDIR:-/tmp}/checkup-db-${UID}/"
fi
trap 'rm -f $CHECKUPDATES_DB/db.lck' INT TERM EXIT
DBPath="$(pacman-conf DBPath)"
if [[ -z "$DBPath" ]] || [[ ! -d "$DBPath" ]]; then
DBPath="@localstatedir@/lib/pacman/"
fi
mkdir -p "$CHECKUPDATES_DB"
ln -s "${DBPath}/local" "$CHECKUPDATES_DB" &> /dev/null
if ! fakeroot -- pacman -Sy --dbpath "$CHECKUPDATES_DB" --logfile /dev/null &> /dev/null; then
die 'Cannot fetch updates'
fi
mapfile -t updates < <(pacman -Qu --dbpath "$CHECKUPDATES_DB" 2> /dev/null | grep -v '\[.*\]')
if (( ${#updates[@]} )); then
printf '%s\n' "${updates[@]}"
if (( DOWNLOAD_CACHE )); then
runcmd pacman -Sw --noconfirm "${updates[@]%% *}" --dbpath "$CHECKUPDATES_DB" --logfile /dev/null
fi
else
exit 2
fi
# vim: set noet:

View File

@ -1,39 +0,0 @@
[Unit]
Description=Remove unused cached package files
[Service]
Type=oneshot
ExecStart=@bindir@/paccache -r
# Lowering priority
OOMScoreAdjust=1000
Nice=19
CPUSchedulingPolicy=idle
IOSchedulingClass=idle
IOSchedulingPriority=7
# Sandboxing and other hardening
ProtectProc=invisible
ProcSubset=pid
NoNewPrivileges=yes
ProtectSystem=full
ProtectHome=yes
PrivateTmp=yes
PrivateDevices=yes
PrivateNetwork=yes
PrivateIPC=yes
PrivateUsers=yes
ProtectHostname=yes
ProtectClock=yes
ProtectKernelTunables=yes
ProtectKernelModules=yes
ProtectKernelLogs=yes
ProtectControlGroups=yes
RestrictAddressFamilies=none
RestrictNamespaces=yes
LockPersonality=yes
MemoryDenyWriteExecute=yes
RestrictRealtime=yes
RestrictSUIDSGID=yes
RemoveIPC=yes
PrivateMounts=yes
SystemCallFilter=@system-service @file-system
SystemCallArchitectures=native

View File

@ -1,410 +0,0 @@
#!/bin/bash
#
# paccache - flexible pacman cache cleaning
#
# Copyright (C) 2011 Dave Reisner <dreisner@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/>.
# Expand to nothing if there are no matches
shopt -s nullglob
shopt -s extglob
declare -r myname='paccache'
declare -r myver='@PACKAGE_VERSION@'
LIBRARY=${LIBRARY:-'@libmakepkgdir@'}
declare -a cachedirs=() candidates=() cmdopts=() whitelist=() blacklist=()
declare -i delete=0 dryrun=0 filecount=0 move=0 needsroot=0 totalsaved=0 verbose=0
declare -i min_atime=0 min_mtime=0
declare delim=$'\n' keep=3 movedir= scanarch=
QUIET=0
USE_COLOR='y'
# Import libmakepkg
source "$LIBRARY"/util/message.sh
source "$LIBRARY"/util/parseopts.sh
die() {
error "$@"
exit 1
}
# reads a list of files on stdin and prints out deletion candidates
pkgfilter() {
# there's whitelist and blacklist parameters passed to this
# script after the block of awk.
awk -v keep="$1" -v scanarch="$2" -v min_atime="$3" -v min_mtime="$4" '
function basename(str) {
sub(".*/", "", str);
return str;
}
function parse_filename(filename,
atime, mtime, parts, count, i, pkgname, arch) {
if (0 + min_atime + min_mtime != 0) {
# atime and mtime are in the first two columns and the
# separator is a single space
split(filename, parts, " ")
atime = parts[1]
mtime = parts[2]
filename = substr(filename, length(atime) + length(mtime) + 3)
}
count = split(basename(filename), parts, "-")
i = 1
pkgname = parts[i++]
while (i <= count - 3) {
pkgname = pkgname "-" parts[i++]
}
arch = substr(parts[count], 1, index(parts[count], ".") - 1)
# filter on whitelist or blacklist
if (wlen && !whitelist[pkgname]) return
if (blen && blacklist[pkgname]) return
if ("" == packages[pkgname,arch]) {
packages[pkgname,arch] = filename
atimes[pkgname,arch] = atime
mtimes[pkgname,arch] = mtime
} else {
packages[pkgname,arch] = packages[pkgname,arch] SUBSEP filename
atimes[pkgname,arch] = atimes[pkgname,arch] SUBSEP atime
mtimes[pkgname,arch] = mtimes[pkgname,arch] SUBSEP mtime
}
}
BEGIN {
# create whitelist
wlen = ARGV[1]; delete ARGV[1]
for (i = 2; i < 2 + wlen; i++) {
whitelist[ARGV[i]] = 1
delete ARGV[i]
}
# create blacklist
blen = ARGV[i]; delete ARGV[i]
while (i++ < ARGC) {
blacklist[ARGV[i]] = 1
delete ARGV[i]
}
# read package filenames
while (getline < "/dev/stdin") {
parse_filename($0)
}
for (pkglist in packages) {
# idx[1,2] = idx[pkgname,arch]
split(pkglist, idx, SUBSEP)
# enforce architecture match if specified
if (!scanarch || scanarch == idx[2]) {
count = split(packages[idx[1], idx[2]], pkgs, SUBSEP)
split(atimes[idx[1], idx[2]], atime, SUBSEP)
split(mtimes[idx[1], idx[2]], mtime, SUBSEP)
for(i = 1; i <= count - keep; i++) {
# If checking file age, potentially keep more candidates
if ((0 + min_atime == 0 || (strtonum(atime[i]) < 0 + min_atime)) &&
(0 + min_mtime == 0 || (strtonum(mtime[i]) < 0 + min_mtime)) \
) {
print pkgs[i]
}
}
}
}
}' "${@:5}"
}
m4_include(../lib/size_to_human.sh)
runcmd() {
if (( needsroot && EUID != 0 )); then
msg 'Escalating privileges using sudo'
if sudo -v &>/dev/null && sudo -l &>/dev/null; then
sudo "$@"
else
die 'Failed to escalate'
fi
else
"$@"
fi
}
summarize() {
(( QUIET )) && return
local -i filecount=$1; shift
local seenarch= seen= arch= name=
local -r pkg_re='(.+)-[^-]+-[0-9]+-([^.]+)\.pkg.*'
if (( delete )); then
printf -v output 'finished: %d packages removed' "$filecount"
elif (( move )); then
printf -v output "finished: %d packages moved to '%s'" "$filecount" "$movedir"
elif (( dryrun )); then
if (( verbose )); then
msg 'Candidate packages:'
while read -r pkg; do
if (( verbose >= 3 )); then
[[ $pkg =~ $pkg_re ]] && name=${BASH_REMATCH[1]} arch=${BASH_REMATCH[2]}
if [[ -z $seen || $seenarch != "$arch" || $seen != "$name" ]]; then
seen=$name seenarch=$arch
printf '%s (%s):\n' "${name##*/}" "$arch"
fi
printf ' %s\n' "${pkg##*/}"
elif (( verbose >= 2 )); then
printf "%s$delim" "$pkg"
else
printf "%s$delim" "${pkg##*/}"
fi
done < <(printf '%s\n' "$@" | pacsort --files)
fi
printf -v output 'finished dry run: %d candidates' "$filecount"
fi
echo
msg "$output (disk space saved: %s)" "$(size_to_human "$totalsaved")"
}
usage() {
cat <<EOF
${myname} v${myver}
A flexible pacman cache cleaning utility.
Usage: ${myname} <operation> [options] [targets...]
Operations:
-d, --dryrun perform a dry run, only finding candidate packages.
-m, --move <dir> move candidate packages to "dir".
-r, --remove remove candidate packages.
Options:
--min-atime <time>
--min-mtime <time> keep packages with an atime/mtime that is not older
than the time given, even if this means keeping more
than specified through the '--keep' option. Accepts
arguments according to 'info "Date input formats"',
e.g. '30 days ago'.
-a, --arch <arch> scan for "arch" (default: all architectures).
-c, --cachedir <dir> scan "dir" for packages. can be used more than once.
(default: read from @sysconfdir@/pacman.conf).
-f, --force apply force to mv(1) and rm(1) operations.
-h, --help display this help message and exit.
-i, --ignore <pkgs> ignore "pkgs", comma-separated. Alternatively, specify
"-" to read package names from stdin, newline-
delimited.
-k, --keep <num> keep "num" of each package in the cache (default: 3).
--nocolor remove color from output.
-q, --quiet minimize output
-u, --uninstalled target uninstalled packages.
-v, --verbose increase verbosity. specify up to 3 times.
-z, --null use null delimiters for candidate names (only with -v
and -vv).
EOF
}
version() {
printf "%s %s\n" "$myname" "$myver"
echo 'Copyright (C) 2011 Dave Reisner <dreisner@archlinux.org>'
}
OPT_SHORT=':a:c:dfhi:k:m:qrsuVvz'
OPT_LONG=('arch:' 'cachedir:' 'dryrun' 'force' 'help' 'ignore:' 'keep:' 'move:'
'nocolor' 'quiet' 'remove' 'uninstalled' 'version' 'verbose' 'null'
'min-atime:' 'min-mtime:')
if ! parseopts "$OPT_SHORT" "${OPT_LONG[@]}" -- "$@"; then
exit 1
fi
set -- "${OPTRET[@]}"
unset OPT_SHORT OPT_LONG OPTRET
while :; do
case $1 in
--min-atime)
min_atime=$(date -d "$2" +%s)
if (( $? )); then
die "argument to option --min-atime must be of the form described by 'info \"Date input formats\" '."
fi
shift ;;
--min-mtime)
min_mtime=$(date -d "$2" +%s)
if (( $? )); then
die "argument to option --min-mtime must be of the form described by 'info \"Date input formats\" '."
fi
shift ;;
-a|--arch)
scanarch=$2
shift ;;
-c|--cachedir)
cachedirs+=("$2")
shift ;;
-d|--dryrun)
dryrun=1 ;;
-f|--force)
cmdopts=(-f) ;;
-h|--help)
usage
exit 0 ;;
-i|--ignore)
if [[ $2 = '-' ]]; then
[[ ! -t 0 ]] && IFS=$'\n' read -r -d '' -a ign
else
IFS=',' read -r -a ign <<< "$2"
fi
blacklist+=("${ign[@]}")
unset i ign
shift ;;
-k|--keep)
keep=$2
if [[ -z $keep || -n ${keep//[0-9]/} ]]; then
die 'argument to option -k must be a non-negative integer'
else
keep=$(( 10#$keep ))
fi
shift ;;
-m|--move)
move=1 movedir=$2
shift ;;
--nocolor)
USE_COLOR='n' ;;
-q|--quiet)
QUIET=1 ;;
-r|--remove)
delete=1 ;;
-u|--uninstalled)
IFS=$'\n' read -r -d '' -a ign < <(pacman -Qq)
# pacman -Qq may exit with an error, thus making ign an empty array
(( ${#ign[@]} )) || die 'failed to retrieve the list of installed packages'
blacklist+=("${ign[@]}")
unset ign ;;
-V|--version)
version
exit 0 ;;
-v|--verbose)
(( ++verbose )) ;;
-z|--null)
delim='\0' ;;
--)
shift
break 2 ;;
esac
shift
done
# check if messages are to be printed using color
if [[ -t 2 && $USE_COLOR != "n" ]]; then
colorize
else
unset ALL_OFF BOLD BLUE GREEN RED YELLOW
fi
# setting default cachedirs
if [[ -z $cachedirs ]]; then
cachedirs=($(pacman-conf CacheDir))
fi
# remaining args are a whitelist
whitelist=("$@")
# sanity checks
case $(( dryrun+delete+move )) in
0) die 'no operation specified (use -h for help)' ;;
[^1]) die 'only one operation may be used at a time' ;;
esac
[[ $movedir && ! -d $movedir ]] &&
die "destination directory '%s' does not exist or is not a directory" "$movedir"
if (( move || delete )); then
# make it an absolute path since we're about to chdir
[[ $movedir && ${movedir:0:1} != '/' ]] && movedir=$PWD/$movedir
[[ $movedir && ! -w $movedir ]] && needsroot=1
fi
for cachedir in "${cachedirs[@]}"; do
[[ -d $cachedir ]] ||
die "cachedir '%s' does not exist or is not a directory" "$cachedir"
if (( move || delete )); then
[[ ! -w $cachedir ]] && needsroot=1
fi
# unlikely that this will fail, but better make sure
pushd "$cachedir" &>/dev/null || die "failed to chdir to '%s'" "$cachedir"
# note that these results are returned in an arbitrary order from awk, but
# they'll be resorted (in summarize) iff we have a verbosity level set.
IFS=$'\n' read -r -d '' -a cand < \
<( if (( min_atime || min_mtime )); then
find "$PWD" -name '*.pkg.tar*.sig' -prune -o \( -name '*.pkg.tar*' -printf '%A@ %T@ %p\n' \) |
pacsort --files --key 3 --separator ' '
else
printf '%s\n' "$PWD"/*.pkg.tar!(*.sig) |
pacsort --files
fi |
pkgfilter "$keep" "$scanarch" "$min_atime" "$min_mtime" \
"${#whitelist[*]}" "${whitelist[@]}" \
"${#blacklist[*]}" "${blacklist[@]}")
candidates+=("${cand[@]}")
unset cand
popd &>/dev/null
done
if (( ! ${#candidates[*]} )); then
msg 'no candidate packages found for pruning'
exit 0
fi
# grab this prior to signature scavenging
pkgcount=${#candidates[*]}
# copy the list, merging in any found sigs
for cand in "${candidates[@]}"; do
candtemp+=("$cand")
[[ -f $cand.sig ]] && candtemp+=("$cand.sig")
done
candidates=("${candtemp[@]}")
unset candtemp
# do this before we destroy anything
totalsaved=$(printf '%s\0' "${candidates[@]}" | xargs -0 @SIZECMD@ |
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
printf '%s\0' "${candidates[@]}" | runcmd xargs -0 rm "${cmdopts[@]}"
elif (( move )); then
printf '%s\0' "${candidates[@]}" | runcmd xargs -0 mv "${cmdopts[@]}" -t "$movedir"
fi
summarize "$pkgcount" "${candidates[@]}"
# vim: set noet:

View File

@ -1,10 +0,0 @@
[Unit]
Description=Discard unused packages weekly
[Timer]
OnCalendar=weekly
AccuracySec=1h
Persistent=true
[Install]
WantedBy=timers.target

View File

@ -1,292 +0,0 @@
#!/bin/bash
# pacdiff : a simple pacnew/pacsave updater
#
# Copyright (c) 2007 Aaron Griffin <aaronmgriffin@gmail.com>
# Copyright (c) 2013-2016 Pacman Development Team <pacman-dev@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/>.
#
shopt -s extglob
declare -r myname='pacdiff'
declare -r myver='@PACKAGE_VERSION@'
LIBRARY=${LIBRARY:-'@libmakepkgdir@'}
diffprog=${DIFFPROG:-'vim -d'}
diffsearchpath=${DIFFSEARCHPATH:-/etc}
mergeprog=${MERGEPROG:-'diff3 -m'}
cachedir=
USE_COLOR='y'
SUDO=''
declare -a oldsaves
declare -i USE_FIND=0 USE_LOCATE=0 USE_PACDB=0 OUTPUTONLY=0
# Import libmakepkg
source "$LIBRARY"/util/message.sh
die() {
error "$@"
exit 1
}
usage() {
cat <<EOF
${myname} v${myver}
A simple program to merge or remove pacnew/pacsave files.
Usage: $myname [-l | -f | -p] [--nocolor]
Search Options: select one (default: --pacmandb)
-l/--locate scan using locate
-f/--find scan using find
-p/--pacmandb scan active config files from pacman database
General Options:
-o/--output print files instead of merging them
--nocolor remove colors from output
-c/--cachedir <dir> scan "dir" for 3-way merge base candidates.
(default: read from @sysconfdir@/pacman.conf)
-s/--sudo use sudo to merge/remove files
Environment Variables:
DIFFPROG override the merge program: (default: 'vim -d')
DIFFSEARCHPATH override the search path. (only when using find)
(default: /etc)
MERGEPROG override the 3-way merge program: (default: 'diff3 -m')
Example: DIFFPROG=meld DIFFSEARCHPATH="/boot /etc /usr" MERGEPROG="git merge-file -p" $myname
Example: $myname --output --locate
EOF
}
version() {
printf "%s %s\n" "$myname" "$myver"
echo 'Copyright (C) 2007 Aaron Griffin <aaronmgriffin@gmail.com>'
echo 'Copyright (C) 2013-2016 Pacman Development Team <pacman-dev@archlinux.org>'
}
print_existing() {
[[ -f "$1" ]] && printf '%s\0' "$1"
}
print_existing_pacsave(){
for f in "${1}"?(.+([0-9])); do
[[ -f $f ]] && printf '%s\0' "$f"
done
}
base_cache_tar() {
package="$1"
[[ -d $cachedir ]] ||
die "cachedir '%s' does not exist or is not a directory" "$cachedir"
# unlikely that this will fail, but better make sure
pushd "$cachedir" &>/dev/null || die "failed to chdir to '%s'" "$cachedir"
find "$PWD" -name "$package-[0-9]*.pkg.tar*" | pacsort --files | sed -ne '2p'
popd &>/dev/null
}
merge_file() {
pacfile="$1"
file="$2"
package="$(pacman -Qoq "$file")" || return 1
base_tar="$(base_cache_tar "$package")"
if [[ -z $base_tar ]]; then
msg2 "Unable to find a base package."
return 1
fi
basename="$(basename "$file")"
tempdir="$(mktemp -d --tmpdir "pacdiff-merge-$basename.XXX")"
base="$(mktemp "$tempdir"/"$basename.base.XXX")"
merged="$(mktemp "$tempdir"/"$basename.merged.XXX")"
tar -xOf "$base_tar" "${file#/}" >"$base"
if $mergeprog "$file" "$base" "$pacfile" >"$merged"; then
msg2 "Merged without conflicts."
fi
$diffprog "$file" "$merged"
while :; do
ask "Would you like to use the results of the merge? [y/n] "
read c || return 1
case $c in
y|Y) break ;;
n|N) return 1 ;;
*) msg2 "Invalid answer." ;;
esac
done
if ! $SUDO cp -v "$merged" "$file"; then
warning "Unable to write merged file to %s. Merged file is preserved at %s" "$file" "$merged"
return 1
fi
$SUDO rm -rv "$pacfile" "$tempdir"
return 0
}
cmd() {
if (( USE_LOCATE )); then
locate -0 -e -b \*.pacnew \*.pacorig \*.pacsave '*.pacsave.[0-9]*'
elif (( USE_FIND )); then
find $diffsearchpath \( -name \*.pacnew -o -name \*.pacorig -o -name \*.pacsave -o -name '*.pacsave.[0-9]*' \) -print0
elif (( USE_PACDB )); then
awk '/^%BACKUP%$/ {
while (getline) {
if (/^$/) { nextfile }
print $1
}
}' "${pac_db}"/*/files | while read -r bkup; do
print_existing "/$bkup.pacnew"
print_existing "/$bkup.pacorig"
print_existing_pacsave "/$bkup.pacsave"
done
fi
}
while [[ -n "$1" ]]; do
case "$1" in
-l|--locate)
USE_LOCATE=1;;
-f|--find)
USE_FIND=1;;
-p|--pacmandb)
USE_PACDB=1;;
-o|--output)
OUTPUTONLY=1;;
--nocolor)
USE_COLOR='n';;
-c|--cachedir)
cachedir="$2"; shift;;
-s|--sudo)
SUDO=sudo;;
-V|--version)
version; exit 0;;
-h|--help)
usage; exit 0;;
*)
usage; exit 1;;
esac
shift
done
# check if messages are to be printed using color
if [[ -t 2 && $USE_COLOR != "n" ]]; then
colorize
else
unset ALL_OFF BOLD BLUE GREEN RED YELLOW
fi
if ! type -p ${diffprog%% *} >/dev/null && (( ! OUTPUTONLY )); then
die "Cannot find the $diffprog binary required for viewing differences."
fi
if ! type -p ${mergeprog%% *} >/dev/null && (( ! OUTPUTONLY )); then
die "Cannot find the $mergeprog binary required for merging differences."
fi
case $(( USE_FIND + USE_LOCATE + USE_PACDB )) in
0) USE_PACDB=1;; # set the default search option
[^1]) error "Only one search option may be used at a time"
usage; exit 1;;
esac
if (( USE_PACDB )); then
if ! DBPath="$(pacman-conf DBPath)"; then
error "unable to read @sysconfdir@/pacman.conf"
usage; exit 1
fi
pac_db="${DBPath:-@localstatedir@/lib/pacman}/local"
if [[ ! -d "${pac_db}" ]]; then
error "unable to read pacman database %s". "${pac_db}"
usage; exit 1
fi
fi
if [[ -z $cachedir ]]; then
cachedir="$(pacman-conf CacheDir)"
fi
# see http://mywiki.wooledge.org/BashFAQ/020
while IFS= read -u 3 -r -d '' pacfile; do
file="${pacfile%.pac*}"
file_type="pac${pacfile##*.pac}"
if (( OUTPUTONLY )); then
echo "$pacfile"
continue
fi
# add matches for pacsave.N to oldsaves array, do not prompt
if [[ $file_type = pacsave.+([0-9]) ]]; then
oldsaves+=("$pacfile")
continue
fi
msg "%s file found for %s" "$file_type" "$file"
if [ ! -f "$file" ]; then
warning "$file does not exist"
$SUDO rm -iv "$pacfile"
continue
fi
if cmp -s "$pacfile" "$file"; then
msg2 "Files are identical, removing..."
$SUDO rm -v "$pacfile"
else
while :; do
ask "(V)iew, (M)erge, (S)kip, (R)emove %s, (O)verwrite with %s, (Q)uit: [v/m/s/r/o/q] " "$file_type" "$file_type"
read c || break
case $c in
q|Q) exit 0;;
r|R) $SUDO rm -v "$pacfile"; break ;;
o|O) $SUDO mv -v "$pacfile" "$file"; break ;;
v|V)
if [[ -n "$SUDO" ]]; then
SUDO_EDITOR="$diffprog" sudoedit "$pacfile" "$file"
else
$diffprog "$pacfile" "$file"
fi
if cmp -s "$pacfile" "$file"; then
msg2 "Files are identical, removing..."
$SUDO rm -v "$pacfile"
break
fi ;;
m|M)
if merge_file "$pacfile" "$file"; then
break
fi ;;
s|S) break ;;
*) msg2 "Invalid answer." ;;
esac
done
fi
done 3< <(cmd)
(( ${#oldsaves[@]} )) && warning "Ignoring %s" "${oldsaves[@]}"
exit 0
# vim: set noet:

View File

@ -1,58 +0,0 @@
#!/bin/bash
# paclist - List all packages installed from a given repo
#
# Copyright (C) 2008 Dan McGee <dpmcgee@gmail.com>
# Copyright (C) 2011 Dave Reisner <dreisner@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/>.
declare -r myname='paclist'
declare -r myver='@PACKAGE_VERSION@'
usage() {
printf "%s v%s\n" "${myname}" "${myver}"
echo
printf "List all packages installed from a given repository\n" "${myname}"
echo
printf "Usage: %s <repository> ...\n" "${myname}"
echo
printf "Example: %s testing\n" "${myname}"
}
version() {
printf "%s %s\n" "$myname" "$myver"
echo 'Copyright (C) 2008 Dan McGee <dpmcgee@gmail.com>'
echo 'Copyright (C) 2011 Dave Reisner <dreisner@archlinux.org>'
}
if [[ -z $1 ]]; then
usage
exit 1
fi
if [[ $1 = -@(h|-help) ]]; then
usage
exit 0
elif [[ $1 = -@(V|-version) ]]; then
version
exit 0
fi
pacman -Sl "$@" | awk '/\[.*[[:alpha:]]+]$/ {print $2,$3};
/\[.*[[:digit:]]+]$/ {print $2,substr($NF, 1, length($NF) - 1)}'
# exit with pacman's return value, not awk's
exit ${PIPESTATUS[0]}
# vim: set noet:

View File

@ -1,99 +0,0 @@
#!/bin/bash
#
# paclog-pkglist - Parse a log file into a list of currently installed packages
#
# Copyright (C) 2011 Dave Reisner <dave@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/>.
declare -r myname='paclog-pkglist'
declare -r myver='@PACKAGE_VERSION@'
export TEXTDOMAIN='pacman'
export TEXTDOMAINDIR='/usr/share/locale'
declare logfile=${1:-@localstatedir@/log/pacman.log}
usage() {
printf "%s v%s\n" "${myname}" "${myver}"
echo
echo "Parse a log file into a list of currently installed packages"
echo
printf "Usage: %s [path to pacman log]\n" "${myname}"
echo
printf "Example: %s @localstatedir@/log/pacman.log\n" "${myname}"
echo
echo 'Defaults to: @localstatedir@/log/pacman.log'
}
version() {
printf "%s %s\n" "$myname" "$myver"
echo 'Copyright (C) 2011 Dave Reisner <dave@archlinux.org>'
}
if [[ $1 ]]; then
if [[ $1 = -@(h|-help) ]]; then
usage
exit 0
elif [[ $1 = -@(V|-version) ]]; then
version
exit 0
elif [[ ! -e $logfile ]]; then
printf $"target not found: %s\n" "$1"
exit 1
fi
fi
<"$logfile" awk '
{
if ($3 ~ /^\[.*\]$/) {
# new style with caller name
action = $4
pkgname = $5
pkgver = $6
upgver = $8
nfields = NF
} else {
action = $3
pkgname = $4
pkgver = $5
upgver = $7
nfields = (NF + 1) # compensate for missing caller field
}
}
nfields == 6 && action == "installed" {
gsub(/[()]/, "", pkgver)
pkg[pkgname] = pkgver
next
}
nfields == 8 && (action == "upgraded" || action == "downgraded") {
sub(/\)/, "", upgver)
pkg[pkgname] = upgver
next
}
nfields == 6 && action == "removed" {
pkg[pkgname] = -1
}
END {
for (i in pkg) {
if (pkg[i] != -1) {
printf "%s %s\n",i,pkg[i]
}
}
}' | sort
# vim: set noet:

View File

@ -1,12 +0,0 @@
[Unit]
Description=Refresh pacman files databases
RequiresMountsFor="/var/lib/pacman/sync"
After=network-online.target nss-lookup.target
Wants=network-online.target
[Service]
Type=oneshot
ExecStart=@bindir@/pacman -Fy
Nice=19
StandardOutput=null
StandardError=journal

View File

@ -1,10 +0,0 @@
[Unit]
Description=Refresh pacman files databases weekly
[Timer]
OnCalendar=weekly
AccuracySec=1h
Persistent=true
[Install]
WantedBy=timers.target

View File

@ -1,135 +0,0 @@
#!/bin/bash
#
# pacscripts : tries to print out the {pre,post}_{install,remove,upgrade}
# scripts of a given package
#
# Copyright (c) 2009 Xavier Chantry <shiningxc@gmail.com>
# Copyright (c) 2009-2016 Pacman Development Team <pacman-dev@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/>.
#
# bash options
set -o nounset
set -o errexit
declare -r myname='pacscripts'
declare -r myver='@PACKAGE_VERSION@'
error() {
local mesg=$1; shift
printf "==> $(gettext "ERROR:") ${mesg}\n" "$@" >&2
}
usage() {
echo "${myname} v${myver}"
echo
echo "Prints the {pre,post}_{install,remove,upgrade} scripts of a given package."
echo
echo "Usage: ${myname} <pkgname|pkgfile>"
echo
echo " Options:"
echo " -h, --help Print this help message"
echo " -v, --version Print program name and version"
echo
echo "Example: ${myname} gconf-editor"
echo "Example: ${myname} gconf-editor-3.0.1-3-x86_64.pkg.tar.xz"
}
if ! DBPath="$(pacman-conf DBPath)"; then
error "unable to read @sysconfdir@/pacman.conf"
exit 1
fi
pac_db="${DBPath:-@localstatedir@/lib/pacman}/local"
version() {
printf "%s %s\n" "$myname" "$myver"
echo 'Copyright (c) 2009 Giulio "giulivo" Fidente <giulivo.navigante@gmail.com>'
echo 'Copyright (c) 2009 Xavier Chantry <shiningxc@gmail.com>'
}
spacman() {
if [ $EUID -eq 0 ]; then
pacman "$@"
else
if ! type -p sudo; then
error "Cannot find the sudo binary!"
error "${myname} requires root privileges. Either install \"sudo\" or run as root."
exit 1
else
sudo pacman "$@"
fi
fi
}
print_db() {
pkg=$(pacman -Q "$1")
pkg=${pkg/ /-}
if [ -f $pac_db/$pkg*/install ]; then
cat $pac_db/$pkg*/install
echo
return 0
else
error "Package $1 does not include any .INSTALL script"
return 1
fi
}
print_pkg() {
if ! bsdtar -xqOf "$1" .INSTALL 2>/dev/null; then
error "Package $1 does not include any .INSTALL script"
return 1
fi
echo
}
print_scriptlet() {
if [ -f "$1" ]; then
if bsdtar tf "$1" .PKGINFO &>/dev/null; then
print_pkg "$1"
return
fi
fi
if pacman -Q "$1" &>/dev/null; then
print_db "$1"
return
fi
if ! pacman -Si $1 &>/dev/null; then
error "Package $1 not found"
return 1
fi
url=$(pacman -Sddp $1)
if [[ $url != file://* ]]; then
if ! spacman -Sddw --logfile /dev/null --noconfirm $1 >&2; then
error "Failed to download $1"
return 1
fi
echo >&2
url=$(pacman -Sddp $1)
fi
print_pkg "${url#file://}"
return
}
if [ $# -ne 1 ] ; then
usage
exit 1
fi
case "$1" in
--help|-h) usage; exit 0 ;;
--version|-v) version; exit 0 ;;
*) print_scriptlet $1 ;;
esac

View File

@ -1,125 +0,0 @@
#!/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 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:

View File

@ -1,567 +0,0 @@
/*
* pacsort.c - a sort utility implementing alpm_pkg_vercmp
*
* Copyright (c) 2010-2016 Pacman Development Team <pacman-dev@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/>.
*/
#include <errno.h>
#include <fnmatch.h>
#include <getopt.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <alpm.h>
#define DELIM ' '
#define INVALD_ESCAPE_CHAR ((char)-1)
#ifndef MIN
#define MIN(a, b) \
__extension__({ \
__typeof__(a) _a = (a); \
__typeof__(b) _b = (b); \
_a < _b ? _a : _b; \
})
#endif
struct buffer_t {
char *mem;
size_t len;
size_t maxlen;
};
struct list_t {
void **list;
size_t count;
size_t maxcount;
};
struct input_t {
char *data;
int is_file;
const char *pkgname;
size_t pkgname_len;
const char *pkgver;
size_t pkgver_len;
};
static struct options_t {
int order;
int sortkey;
int null;
int filemode;
int help;
int version;
char delim;
} opts;
static struct buffer_t *buffer_new(size_t initial_size)
{
struct buffer_t *buf;
buf = calloc(1, sizeof(*buf));
if(!buf) {
return NULL;
}
buf->mem = calloc(initial_size, sizeof(char));
if(!buf->mem) {
free(buf);
return NULL;
}
buf->len = 0;
buf->maxlen = initial_size;
return buf;
}
static void buffer_free(struct buffer_t *buf)
{
if(!buf) {
return;
}
free(buf->mem);
free(buf);
}
static int buffer_grow(struct buffer_t *buffer)
{
size_t newsz = buffer->maxlen * 2.5;
char* new_mem = realloc(buffer->mem, newsz * sizeof(char));
if(!new_mem) {
return 1;
}
buffer->mem = new_mem;
buffer->maxlen = newsz;
return 0;
}
static struct list_t *list_new(size_t initial_size)
{
struct list_t *list;
list = calloc(1, sizeof(struct list_t));
if(!list) {
return NULL;
}
list->list = calloc(initial_size, sizeof(char *));
if(!list->list) {
free(list);
return NULL;
}
list->maxcount = initial_size;
return list;
}
static int list_grow(struct list_t *list)
{
size_t newsz = list->maxcount * 2.5;
void **new_list = realloc(list->list, newsz * sizeof(char *));
if(!new_list) {
return 1;
}
list->list = new_list;
list->maxcount = newsz;
return 0;
}
static int list_add(struct list_t *list, void *obj)
{
if(!list || !obj) {
return 1;
}
if(list->count + 1 >= list->maxcount) {
if(list_grow(list) != 0) {
return 1;
}
}
list->list[list->count] = obj;
list->count++;
return 0;
}
static void list_free(struct list_t *list, void (*freefn)(void *))
{
size_t i;
if(!list) {
return;
}
if(list->list) {
for(i = 0; i < list->count; i++) {
freefn(list->list[i]);
}
free(list->list);
}
free(list);
}
static void input_free(void *p)
{
struct input_t *in = p;
if(in == NULL) {
return;
}
free(in->data);
free(in);
}
static struct input_t *input_new(const char *path, int pathlen)
{
const char *pkgver_end;
const char *slash;
struct input_t *in;
in = calloc(1, sizeof(struct input_t));
if(in == NULL) {
return NULL;
}
in->data = strndup(path, pathlen);
if(in->data == NULL) {
free(in);
return NULL;
}
in->is_file = fnmatch("*-*.pkg.tar*", in->data, 0) == 0;
if(!in->is_file) {
return in;
}
/* for files, we parse the pkgname and pkgrel from the full filename. */
slash = strrchr(in->data, '/');
if(slash == NULL) {
in->pkgname = in->data;
} else {
in->pkgname = slash + 1;
}
pkgver_end = strrchr(in->pkgname, '-');
/* read backwards through pkgrel */
for(in->pkgver = pkgver_end - 1;
in->pkgver > in->pkgname && *in->pkgver != '-';
--in->pkgver)
;
/* read backwards through pkgver */
for(--in->pkgver;
in->pkgver > in->pkgname && *in->pkgver != '-';
--in->pkgver)
;
++in->pkgver;
in->pkgname_len = in->pkgver - in->pkgname - 1;
in->pkgver_len = pkgver_end - in->pkgver;
return in;
}
static char *explode(struct buffer_t *buffer, struct list_t *list)
{
char *ptr, *end;
const char linedelim = opts.null ? '\0' : '\n';
struct input_t *meta;
ptr = buffer->mem;
while((end = memchr(ptr, linedelim, &buffer->mem[buffer->len] - ptr))) {
*end = '\0';
meta = input_new(ptr, end - ptr);
if(meta == NULL || list_add(list, meta) != 0) {
input_free(meta);
return NULL;
}
ptr = end + 1;
}
return ptr;
}
static int splitfile(FILE *stream, struct buffer_t *buffer, struct list_t *list)
{
size_t nread;
char *ptr;
while(!feof(stream)) {
/* check if a read of BUFSIZ chars will overflow */
if(buffer->len + BUFSIZ + 1 >= buffer->maxlen) {
if(buffer_grow(buffer) != 0) {
return 1;
}
}
nread = fread(&buffer->mem[buffer->len], 1, BUFSIZ, stream);
if(nread == 0) {
break; /* EOF */
}
buffer->len += nread;
if((ptr = explode(buffer, list)) == NULL) {
return 1;
}
if(ptr != buffer->mem) {
/* realign the data in the buffer */
buffer->len = &buffer->mem[buffer->len] - ptr;
memmove(&buffer->mem[0], ptr, buffer->len + 1);
}
}
if(buffer->len) {
struct input_t *meta = input_new(buffer->mem, buffer->len + 1);
if(meta == NULL || list_add(list, meta) != 0) {
input_free(meta);
return 1;
}
}
return 0;
}
/* returns a pointer to the nth column of a string without being destructive */
static const char *nth_column(const char *string)
{
const char *prev, *ptr;
int col;
ptr = prev = string;
for(col = 0; ptr && col < opts.sortkey; col++) {
prev = ptr;
ptr = strchr(ptr, opts.delim);
if(ptr) {
ptr++;
}
}
return prev;
}
static int compare_versions(const char *v1, const char *v2)
{
if(opts.sortkey == 0) {
return opts.order * alpm_pkg_vercmp(v1, v2);
} else {
return opts.order * alpm_pkg_vercmp(nth_column(v1), nth_column(v2));
}
}
static int compare_files(const struct input_t *meta1, const struct input_t *meta2)
{
int cmp;
char *verbuf;
const char *v1, *v2;
/* sort first by package name */
cmp = memcmp(meta1->pkgname, meta2->pkgname,
MIN(meta1->pkgname_len, meta2->pkgname_len));
/* 1) package names differ, sort by package name */
if(cmp != 0) {
return opts.order * cmp;
}
/* 2) prefixes are the same but length differs, sort by length */
if(meta1->pkgname_len != meta2->pkgname_len) {
return opts.order * (meta1->pkgname_len - meta2->pkgname_len);
}
/* allocate once with enough space for both pkgver */
verbuf = calloc(1, meta1->pkgver_len + 1 + meta2->pkgver_len + 1);
memcpy(verbuf, meta1->pkgver, meta1->pkgver_len);
memcpy(&verbuf[meta1->pkgver_len + 1], meta2->pkgver, meta2->pkgver_len);
/* 3) sort by package version */
v1 = verbuf;
v2 = verbuf + meta1->pkgver_len + 1;
cmp = compare_versions(v1, v2);
free(verbuf);
return cmp;
}
static int vercmp(const void *p1, const void *p2)
{
const struct input_t *meta1, *meta2;
meta1 = *(struct input_t **)p1;
meta2 = *(struct input_t **)p2;
if(opts.filemode && meta1->is_file && meta2->is_file) {
return compare_files(meta1, meta2);
} else {
return compare_versions(meta1->data, meta2->data);
}
}
static char escape_char(const char *string)
{
if(!string) {
return INVALD_ESCAPE_CHAR;
}
const size_t len = strlen(string);
if(len > 2) {
return INVALD_ESCAPE_CHAR;
}
if(len == 1) {
return *string;
}
if(*string != '\\') {
return INVALD_ESCAPE_CHAR;
}
switch(string[1]) {
case 't':
return '\t';
case 'n':
return '\n';
case 'v':
return '\v';
case '0':
return '\0';
default:
return INVALD_ESCAPE_CHAR;
}
}
static void usage(void)
{
printf("pacsort v" PACKAGE_VERSION "\n\n"
"A sort utility implementing alpm_pkg_vercmp.\n\n"
"Usage: pacsort [options] [files...]\n\n"
" -f, --files assume inputs are file paths of packages\n"
" -h, --help display this help message\n"
" -k, --key <index> sort input starting on specified column\n"
" -r, --reverse sort in reverse order (default: oldest to newest)\n"
" -t, --separator <sep> specify field separator (default: space)\n"
" -v, --version display the version\n"
" -z, --null lines end with null bytes, not newlines\n\n"
"pacsort writes the sorted concatenation of all files, to standard output.\n"
"Files should contain a list of inputs to sort.\n\n"
"Standard input is read when no files are given.\n\n");
}
static void version(void)
{
printf("pacsort v" PACKAGE_VERSION "\n");
}
static int parse_options(int argc, char **argv)
{
int opt;
static const struct option opttable[] = {
{"files", no_argument, 0, 'f'},
{"help", no_argument, 0, 'h'},
{"key", required_argument, 0, 'k'},
{"reverse", no_argument, 0, 'r'},
{"separator", required_argument, 0, 't'},
{"version", no_argument, 0, 'v'},
{"null", no_argument, 0, 'z'},
{0, 0, 0, 0}
};
while((opt = getopt_long(argc, argv, "fhk:rt:vz", opttable, NULL)) != -1) {
switch(opt) {
case 'f':
opts.filemode = 1;
break;
case 'h':
opts.help = 1;
return 0;
case 'k':
opts.sortkey = (int)strtol(optarg, NULL, 10);
if(opts.sortkey <= 0) {
fprintf(stderr, "error: invalid sort key -- %s\n", optarg);
return 1;
}
break;
case 'r':
opts.order = -1;
break;
case 't':
opts.delim = escape_char(optarg);
if(opts.delim == INVALD_ESCAPE_CHAR) {
fprintf(stderr, "error: invalid field separator -- `%s'\n", optarg);
return 1;
}
break;
case 'v':
opts.version = 1;
return 0;
case 'z':
opts.null = 1;
break;
default:
return 1;
}
}
return 0;
}
int main(int argc, char *argv[])
{
struct list_t *list;
struct buffer_t *buffer;
size_t i;
int ret = 0;
/* option defaults */
opts.order = 1;
opts.delim = DELIM;
opts.sortkey = 0;
opts.null = 0;
if(parse_options(argc, argv) != 0) {
usage();
return 2;
}
if(opts.help) {
usage();
return 0;
}
if(opts.version) {
version();
return 0;
}
list = list_new(100);
buffer = buffer_new(BUFSIZ * 3);
if(optind == argc) {
if(splitfile(stdin, buffer, list) != 0) {
fprintf(stderr, "%s: memory exhausted\n", argv[0]);
ret = ENOMEM;
goto cleanup;
}
} else {
while(optind < argc) {
FILE *input = fopen(argv[optind], "r");
if(input) {
if(splitfile(input, buffer, list) != 0) {
fprintf(stderr, "%s: memory exhausted\n", argv[0]);
fclose(input);
ret = ENOMEM;
goto cleanup;
}
fclose(input);
} else {
fprintf(stderr, "%s: %s: %s\n", argv[0], argv[optind], strerror(errno));
}
optind++;
}
}
if(list->count) {
const char linedelim = opts.null ? '\0' : '\n';
qsort(list->list, list->count, sizeof(void *), vercmp);
for(i = 0; i < list->count; i++) {
const struct input_t *in = list->list[i];
printf("%s%c", in->data, linedelim);
}
}
cleanup:
list_free(list, input_free);
buffer_free(buffer);
return ret;
}
/* vim: set noet: */

View File

@ -1,669 +0,0 @@
/*
* pactree.c - a simple dependency tree viewer
*
* Copyright (c) 2010-2016 Pacman Development Team <pacman-dev@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/>.
*/
#include <ctype.h>
#include <getopt.h>
#include <stdio.h>
#include <string.h>
#include <locale.h>
#include <alpm.h>
#include <alpm_list.h>
#include <langinfo.h>
#define LINE_MAX 512
#include <limits.h>
typedef struct tdepth {
struct tdepth *prev;
struct tdepth *next;
int level;
} tdepth;
/* output */
struct graph_style {
const char *provides;
const char *optional;
const char *tip;
const char *last;
const char *limb;
int indent;
};
#define UTF_V "\342\224\202" /* U+2502, Vertical line drawing char */
#define UTF_VR "\342\224\234" /* U+251C, Vertical and right */
#define UTF_H "\342\224\200" /* U+2500, Horizontal */
#define UTF_UR "\342\224\224" /* U+2514, Up and right */
static struct graph_style graph_utf8 = {
" provides",
" (optional)",
UTF_VR UTF_H,
UTF_UR UTF_H,
UTF_V " ",
2
};
static struct graph_style graph_default = {
" provides",
" (optional)",
"|-",
"`-",
"|",
2
};
static struct graph_style graph_linear = {
"",
"",
"",
"",
"",
0
};
/* color choices */
struct color_choices {
const char *branch1;
const char *branch2;
const char *leaf1;
const char *leaf2;
const char *error;
const char *warning;
const char *off;
};
static struct color_choices use_color = {
"\033[0;33m", /* yellow */
"\033[0;37m", /* white */
"\033[1;32m", /* bold green */
"\033[0;32m", /* green */
"\033[1;31m", /* bold red */
"\033[1;33m", /* bold yellow */
"\033[0m"
};
static struct color_choices no_color = {
"",
"",
"",
"",
"",
"",
""
};
/* long operations */
enum {
OP_CONFIG = 1000,
OP_DEBUG,
OP_GPGDIR
};
/* globals */
static alpm_handle_t *handle = NULL;
static alpm_list_t *walked = NULL;
static alpm_list_t *provisions = NULL;
/* options */
static struct color_choices *color = &no_color;
static struct graph_style *style = &graph_utf8;
static int graphviz = 0;
static int max_depth = -1;
static int reverse = 0;
static int unique = 0;
static int searchsyncs = 0;
static int debug = 0;
static int opt_level = 0;
static const char *dbpath = DBPATH;
static const char *configfile = CONFFILE;
static const char *gpgdir = GPGDIR;
void cb_log(void *ctx, alpm_loglevel_t level, const char *fmt, va_list args)
{
(void)ctx;
switch(level) {
case ALPM_LOG_ERROR:
fprintf(stderr, "%s%s%s", color->error, "error: ",
color->off);
break;
case ALPM_LOG_WARNING:
fprintf(stderr, "%s%s%s", color->warning, "warning: ",
color->off);
break;
case ALPM_LOG_DEBUG:
fprintf(stderr, "debug: ");
break;
case ALPM_LOG_FUNCTION:
fprintf(stderr, "function: ");
break;
}
vfprintf(stderr, fmt, args);
}
/* Trim whitespace and newlines from a string
*/
static size_t strtrim(char *str)
{
char *end, *pch = str;
if(str == NULL || *str == '\0') {
/* string is empty, so we're done. */
return 0;
}
while(isspace((unsigned char)*pch)) {
pch++;
}
if(pch != str) {
size_t len = strlen(pch);
/* check if there wasn't anything but whitespace in the string. */
if(len == 0) {
*str = '\0';
return 0;
}
memmove(str, pch, len + 1);
pch = str;
}
end = (str + strlen(str) - 1);
while(isspace((unsigned char)*end)) {
end--;
}
*++end = '\0';
return end - pch;
}
static int register_syncs(void)
{
FILE *fp;
char *section = NULL;
char line[LINE_MAX];
const alpm_siglevel_t level = ALPM_SIG_DATABASE | ALPM_SIG_DATABASE_OPTIONAL;
fp = fopen(configfile, "r");
if(!fp) {
fprintf(stderr, "error: config file %s could not be read\n", configfile);
return 1;
}
while(fgets(line, LINE_MAX, fp)) {
size_t linelen;
char *ptr;
/* ignore whole line and end of line comments */
if((ptr = strchr(line, '#'))) {
*ptr = '\0';
}
linelen = strtrim(line);
if(linelen == 0) {
continue;
}
if(line[0] == '[' && line[linelen - 1] == ']') {
free(section);
section = strndup(&line[1], linelen - 2);
if(section && strcmp(section, "options") != 0) {
alpm_db_t *db = alpm_register_syncdb(handle, section, level);
alpm_db_set_usage(db, ALPM_DB_USAGE_ALL);
}
}
}
free(section);
fclose(fp);
return 0;
}
static void cleanup(int ret)
{
alpm_list_free(walked);
FREELIST(provisions);
alpm_release(handle);
exit(ret);
}
static void usage(void)
{
fprintf(stdout, "pactree v" PACKAGE_VERSION "\n\n"
"A simple dependency tree viewer.\n\n"
"Usage: pactree [options] PACKAGE\n\n"
" -a, --ascii use ASCII characters for tree formatting\n"
" -b, --dbpath <path> set an alternate database location\n"
" -c, --color colorize output\n"
" -d, --depth <#> limit the depth of recursion\n"
" -g, --graph generate output for graphviz's dot\n"
" -h, --help display this help message\n"
" -l, --linear enable linear output\n"
" -r, --reverse list packages that depend on the named package\n"
" -s, --sync search sync databases instead of local\n"
" -u, --unique show dependencies with no duplicates (implies -l)\n"
" -o, --optional[=DEPTH] controls at which depth to stop printing optional deps\n"
" (-1 for no limit)\n"
" -v, --version display the version\n"
" --config <path> set an alternate configuration file\n"
" --debug display debug messages\n"
" --gpgdir <path> set an alternate home directory for GnuPG\n");
}
static void version(void)
{
fprintf(stdout, "pactree v" PACKAGE_VERSION "\n");
}
static int parse_options(int argc, char *argv[])
{
int opt, option_index = 0;
char *endptr = NULL;
static const struct option opts[] = {
{"ascii", no_argument, 0, 'a'},
{"dbpath", required_argument, 0, 'b'},
{"color", no_argument, 0, 'c'},
{"depth", required_argument, 0, 'd'},
{"graph", no_argument, 0, 'g'},
{"help", no_argument, 0, 'h'},
{"linear", no_argument, 0, 'l'},
{"reverse", no_argument, 0, 'r'},
{"sync", no_argument, 0, 's'},
{"unique", no_argument, 0, 'u'},
{"optional",optional_argument, 0, 'o'},
{"version", no_argument, 0, 'v'},
{"config", required_argument, 0, OP_CONFIG},
{"debug", no_argument, 0, OP_DEBUG},
{"gpgdir", required_argument, 0, OP_GPGDIR},
{0, 0, 0, 0}
};
setlocale(LC_ALL, "");
if(strcmp(nl_langinfo(CODESET), "UTF-8") == 0) {
style = &graph_utf8;
}
while((opt = getopt_long(argc, argv, "ab:cd:ghlrsuo::v", opts, &option_index))) {
if(opt < 0) {
break;
}
switch(opt) {
case OP_CONFIG:
configfile = optarg;
break;
case OP_DEBUG:
debug = 1;
break;
case OP_GPGDIR:
gpgdir = optarg;
break;
case 'a':
style = &graph_default;
break;
case 'b':
dbpath = optarg;
break;
case 'c':
color = &use_color;
break;
case 'd':
/* validate depth */
max_depth = (int)strtol(optarg, &endptr, 10);
if(*endptr != '\0') {
fprintf(stderr, "error: invalid depth -- %s\n", optarg);
return 1;
}
break;
case 'g':
graphviz = 1;
break;
case 'l':
style = &graph_linear;
break;
case 'r':
reverse = 1;
break;
case 's':
searchsyncs = 1;
break;
case 'u':
unique = 1;
style = &graph_linear;
break;
case 'v':
version();
cleanup(0);
case 'o':
if(optarg) {
opt_level = (int)strtol(optarg, &endptr, 10);
if(*endptr != '\0') {
fprintf(stderr, "error: invalid optional depth -- %s\n", optarg);
return 1;
}
} else {
opt_level = 1;
}
break;
case 'h':
usage();
cleanup(0);
default:
usage();
return 1;
}
}
if(!argv[optind] || argv[optind + 1]) {
usage();
return 1;
}
return 0;
}
static int should_show_satisfier(const char *pkg, const char *depstring)
{
int result;
alpm_depend_t *dep = alpm_dep_from_string(depstring);
if(!dep) return 1;
result = strcmp(pkg, dep->name) != 0;
free(dep);
return result;
}
/* pkg provides provision */
static void print_text(const char *pkg, const char *provision,
tdepth *depth, int last, int opt_dep)
{
const char *tip = "";
const char *opt_str = opt_dep ? style->optional : "";
int level = 1;
if(!pkg && !provision) {
/* not much we can do */
return;
}
if(depth->level > 0) {
tip = last ? style->last : style->tip;
/* print limbs */
while(depth->prev) {
depth = depth->prev;
}
printf("%s", color->branch1);
while(depth->next) {
printf("%*s%-*s", style->indent * (depth->level - level), "",
style->indent, style->limb);
level = depth->level + 1;
depth = depth->next;
}
printf("%*s", style->indent * (depth->level - level), "");
}
/* print tip */
/* If style->provides is empty (e.g. when using linear style), we do not
* want to print the provided package. This makes output easier to parse and
* to reuse. */
if(!pkg && provision) {
printf("%s%s%s%s [unresolvable]%s%s\n", tip, color->leaf1,
provision, color->branch1, opt_str, color->off);
} else if(provision && *(style->provides) != '\0' && should_show_satisfier(pkg, provision)) {
printf("%s%s%s%s%s %s%s%s%s\n", tip, color->leaf1, pkg,
color->leaf2, style->provides, color->leaf1, provision, opt_str,
color->off);
} else {
printf("%s%s%s%s%s\n", tip, color->leaf1, provision ? provision : pkg, opt_str, color->off);
}
}
static void print_graph(const char *parentname, const char *pkgname, const char *depname, int opt_dep)
{
const char *style = opt_dep ? ", style=dotted" : "";
if(depname) {
printf("\"%s\" -> \"%s\" [color=chocolate4%s];\n", parentname, depname, style);
if(pkgname && strcmp(depname, pkgname) != 0 && !alpm_list_find_str(provisions, depname)) {
printf("\"%s\" -> \"%s\" [arrowhead=none, color=grey%s];\n", depname, pkgname, style);
provisions = alpm_list_add(provisions, strdup(depname));
}
} else if(pkgname) {
printf("\"%s\" -> \"%s\" [color=chocolate4%s];\n", parentname, pkgname, style);
}
}
/* parent depends on dep which is satisfied by pkg */
static void print(const char *parentname, const char *pkgname,
const char *depname, tdepth *depth, int last, int opt_dep)
{
if(graphviz) {
print_graph(parentname, pkgname, depname, opt_dep);
} else {
print_text(pkgname, depname, depth, last, opt_dep);
}
}
static void print_start(const char *pkgname, const char *provname)
{
if(graphviz) {
printf("digraph G { START [color=red, style=filled];\n"
"node [style=filled, color=green];\n"
" \"START\" -> \"%s\";\n", pkgname);
} else {
tdepth d = {
NULL,
NULL,
0
};
print_text(pkgname, provname, &d, 0, 0);
}
}
static void print_end(void)
{
if(graphviz) {
/* close graph output */
printf("}\n");
}
}
static alpm_list_t *get_pkg_deps(alpm_pkg_t *pkg)
{
alpm_list_t *i, *dep_strings = NULL;
for(i = alpm_pkg_get_depends(pkg); i; i = alpm_list_next(i)) {
alpm_depend_t *dep = i->data;
char *ds = alpm_dep_compute_string(dep);
dep_strings = alpm_list_add(dep_strings, ds);
}
return dep_strings;
}
static alpm_list_t *get_pkg_optdeps(alpm_pkg_t *pkg)
{
alpm_list_t *i, *dep_strings = NULL;
for(i = alpm_pkg_get_optdepends(pkg); i; i = alpm_list_next(i)) {
alpm_depend_t *dep = i->data;
char *ds = alpm_dep_compute_string(dep);
dep_strings = alpm_list_add(dep_strings, ds);
}
return dep_strings;
}
/* forward declaration */
static void walk_deps(alpm_list_t *dblist, alpm_pkg_t *pkg, tdepth *depth, int rev, int optional);
/**
* print the dependency list given, passing the optional parameter when required
*/
static void print_dep_list(alpm_list_t *deps, alpm_list_t *dblist, alpm_pkg_t *pkg, tdepth *depth, int rev, int optional, int opt_dep, int final)
{
alpm_list_t *i;
int new_optional;
if(optional > 0) {
/* decrease the depth by 1 */
new_optional = optional - 1;
} else {
/* preserve 0 (ran out of depth) and negative numbers (infinite depth) */
new_optional = optional;
}
for(i = deps; i; i = alpm_list_next(i)) {
const char *pkgname = i->data;
int last = final && (alpm_list_next(i) ? 0 : 1);
alpm_pkg_t *dep_pkg = alpm_find_dbs_satisfier(handle, dblist, pkgname);
if(alpm_list_find_str(walked, dep_pkg ? alpm_pkg_get_name(dep_pkg) : pkgname)) {
/* if we've already seen this package, don't print in "unique" output
* and don't recurse */
if(!unique) {
print(alpm_pkg_get_name(pkg), alpm_pkg_get_name(dep_pkg), pkgname, depth, last, opt_dep);
}
} else {
print(alpm_pkg_get_name(pkg), alpm_pkg_get_name(dep_pkg), pkgname, depth, last, opt_dep);
if(dep_pkg) {
tdepth d = {
depth,
NULL,
depth->level + 1
};
depth->next = &d;
/* last dep, cut off the limb here */
if(last) {
if(depth->prev) {
depth->prev->next = &d;
d.prev = depth->prev;
depth = &d;
} else {
d.prev = NULL;
}
}
walk_deps(dblist, dep_pkg, &d, rev, new_optional);
depth->next = NULL;
}
}
}
}
/**
* walk dependencies, showing dependencies of the target
*/
static void walk_deps(alpm_list_t *dblist, alpm_pkg_t *pkg, tdepth *depth, int rev, int optional)
{
alpm_list_t *deps, *optdeps;
if(!pkg || ((max_depth >= 0) && (depth->level > max_depth))) {
return;
}
walked = alpm_list_add(walked, (void *)alpm_pkg_get_name(pkg));
if(rev) {
deps = alpm_pkg_compute_requiredby(pkg);
} else {
deps = get_pkg_deps(pkg);
}
optdeps = NULL;
if(optional){
if(rev) {
optdeps = alpm_pkg_compute_optionalfor(pkg);
} else {
optdeps = get_pkg_optdeps(pkg);
}
}
print_dep_list(deps, dblist, pkg, depth, rev, optional, 0, !optdeps);
FREELIST(deps);
print_dep_list(optdeps, dblist, pkg, depth, rev, optional, 1, 1);
FREELIST(optdeps);
}
int main(int argc, char *argv[])
{
int freelist = 0, ret;
alpm_errno_t err;
const char *target_name;
alpm_pkg_t *pkg;
alpm_list_t *dblist = NULL;
if((ret = parse_options(argc, argv)) != 0) {
cleanup(ret);
}
handle = alpm_initialize(ROOTDIR, dbpath, &err);
if(!handle) {
fprintf(stderr, "error: cannot initialize alpm: %s\n",
alpm_strerror(err));
cleanup(1);
}
if(debug) {
alpm_option_set_logcb(handle, cb_log, NULL);
}
/* no need to fail on error here */
alpm_option_set_gpgdir(handle, gpgdir);
if(searchsyncs) {
if(register_syncs() != 0) {
cleanup(1);
}
dblist = alpm_get_syncdbs(handle);
} else {
dblist = alpm_list_add(dblist, alpm_get_localdb(handle));
freelist = 1;
}
/* we only care about the first non option arg for walking */
target_name = argv[optind];
pkg = alpm_find_dbs_satisfier(handle, dblist, target_name);
if(!pkg) {
fprintf(stderr, "error: package '%s' not found\n", target_name);
cleanup(1);
}
print_start(alpm_pkg_get_name(pkg), target_name);
tdepth d = {
NULL,
NULL,
1
};
walk_deps(dblist, pkg, &d, reverse, opt_level);
print_end();
if(freelist) {
alpm_list_free(dblist);
}
cleanup(0);
}
/* vim: set noet: */

View File

@ -1,244 +0,0 @@
#!/bin/bash
#
# rankmirrors - read a list of mirrors from a file and rank them by speed
# @configure_input@
#
# Copyright (c) 2009 Matthew Bruenig <matthewbruenig@gmail.com>
#
# 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 3 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/>.
# traps interrupt key to spit out pre-interrupt info
trap finaloutput INT
declare -r myname='rankmirrors'
declare -r myver='@PACKAGE_VERSION@'
usage() {
echo "${myname} v${myver}"
echo
echo "Ranks pacman mirrors by their connection and opening speed. Pacman mirror"
echo "files are located in @sysconfdir@/pacman.d/. It can also rank one mirror if the URL is"
echo "provided."
echo
echo "Usage: ${myname} [options] MIRRORFILE | URL"
echo
echo "Options:"
echo " --version show program's version number and exit"
echo " -h, --help show this help message and exit"
echo " -n NUM number of servers to output, 0 for all"
echo " -m, --max-time NUM specify a ranking operation timeout, can be decimal number"
echo " -t, --times only output mirrors and their response times"
echo " -u, --url test a specific URL"
echo " -v, --verbose be verbose in output"
echo " -r, --repo specify a repository name instead of guessing"
exit 0
}
version() {
echo "${myname} (pacman) ${myver}"
echo "Copyright (c) 2009 Matthew Bruenig <matthewbruenig@gmail.com>."
echo
echo "This is free software; see the source for copying conditions."
echo "There is NO WARRANTY, to the extent permitted by law."
exit 0
}
err() {
echo "$1" >&2
exit 1
}
# gettime fetchurl (e.g gettime http://foo.com/core/os/i686/core.db.tar.gz)
# returns the fetching time, or timeout, or unreachable
gettime() {
IFS=' ' output=( $(curl -s -m $MAX_TIME -w "%{time_total} %{http_code}" "$1" -o/dev/null) )
(( $? == 28 )) && echo timeout && return
(( ${output[1]} >= 400 || ! ${output[1]} )) && echo unreachable && return
echo "${output[0]}"
}
# getfetchurl serverurl (e.g. getturl http://foo.com/core/os/i686)
# if $repo is in the line, then assumes core
# if $arch is in the line, then assumes $(uname -m)
# returns a fetchurl (e.g. http://foo.com/core/os/i686/core.db.tar.gz)
ARCH="$(uname -m)"
getfetchurl() {
local strippedurl="${1%/}"
local replacedurl="${strippedurl//'$arch'/$ARCH}"
if [[ ! $TARGETREPO ]]; then
replacedurl="${replacedurl//'$repo'/core}"
local tmp="${replacedurl%/*}"
tmp="${tmp%/*}"
local reponame="${tmp##*/}"
else
replacedurl="${replacedurl//'$repo'/$TARGETREPO}"
local reponame="$TARGETREPO"
fi
if [[ -z $reponame || $reponame = $replacedurl ]]; then
echo "fail"
else
local fetchurl="${replacedurl}/$reponame.db"
echo "$fetchurl"
fi
}
# This exists to remove the need for a separate interrupt function
finaloutput() {
IFS=$'\n' read -r -d '' -a sortedarray < \
<(printf '%s\n' "${timesarray[@]}" | LC_COLLATE=C sort)
# Final output for mirrorfile
numiterator="0"
if [[ $TIMESONLY ]]; then
echo
echo " Servers sorted by time (seconds):"
for line in "${sortedarray[@]}"; do
echo "${line#* } : ${line% *}"
((numiterator++))
(( NUM && numiterator >= NUM )) && break
done
else
for line in "${sortedarray[@]}"; do
echo "Server = ${line#* }"
((numiterator++))
(( NUM && numiterator >= NUM )) && break
done
fi
exit 0
}
# Argument parsing
[[ $1 ]] || usage
while [[ $1 ]]; do
if [[ ${1:0:2} = -- ]]; then
case "${1:2}" in
help) usage ;;
version) version ;;
max-time)
[[ $2 ]] || err "Must specify number.";
MAX_TIME="$2"
shift 2;;
times) TIMESONLY=1 ; shift ;;
verbose) VERBOSE=1 ; shift ;;
url)
CHECKURL=1;
[[ $2 ]] || err "Must specify URL.";
URL="$2";
shift 2;;
repo)
[[ $2 ]] || err "Must specify repository name.";
TARGETREPO="$2";
shift 2;;
*) err "'$1' is an invalid argument."
esac
elif [[ ${1:0:1} = - ]]; then
if [[ ! ${1:1:1} ]]; then
[[ -t 0 ]] && err "Stdin is empty."
IFS=$'\n' linearray=( $(</dev/stdin) )
STDIN=1
shift
else
snum=1
for ((i=1 ; i<${#1}; i++)); do
case ${1:$i:1} in
h) usage ;;
m)
[[ $2 ]] || err "Must specify number.";
MAX_TIME="$2"
snum=2;;
t) TIMESONLY=1 ;;
v) VERBOSE=1 ;;
u)
CHECKURL=1;
[[ $2 ]] || err "Must specify URL.";
URL="$2";
snum=2;;
r)
[[ $2 ]] || err "Must specify repository name.";
TARGETREPO="$2";
snum=2;;
n)
[[ $2 ]] || err "Must specify number.";
NUM="$2";
snum=2;;
*) err "'$1' is an invalid argument." ;;
esac
done
shift $snum
fi
elif [[ -f $1 ]]; then
FILE="1"
IFS=$'\n' linearray=( $(<$1) )
[[ $linearray ]] || err "File is empty."
shift
else
err "'$1' does not exist."
fi
done
# Some sanity checks
[[ $NUM ]] || NUM=0
[[ $MAX_TIME ]] || MAX_TIME=10
[[ $FILE && $CHECKURL ]] && err "Cannot specify a URL and mirrorfile."
[[ $FILE || $CHECKURL || $STDIN ]] || err "Must specify URL, mirrorfile, or stdin."
# Single URL handling
if [[ $CHECKURL ]]; then
url="$(getfetchurl "$URL")"
[[ $url = fail ]] && err "URL '$URL' is malformed."
[[ $VERBOSE ]] && echo "Testing $url..."
time=$(gettime "$url")
echo "$URL : $time"
exit 0
fi
# Get URL results from mirrorfile, fill up the array, and so on
if [[ $TIMESONLY ]]; then
echo "Querying servers. This may take some time..."
elif [[ $FILE ]]; then
echo "# Server list generated by rankmirrors on $(date +%Y-%m-%d)"
fi
timesarray=()
for line in "${linearray[@]}"; do
if [[ $line =~ ^[[:space:]]*# ]]; then
[[ $TIMESONLY ]] || echo $line
elif [[ $line =~ ^[[:space:]]*Server ]]; then
# Getting values and times and such
server="${line#*= }"
server="${server%%#*}"
url="$(getfetchurl "$server")"
[[ $url = fail ]] && err "URL '$URL' is malformed."
time=$(gettime "$url")
timesarray+=("$time $server")
# Output
if [[ $VERBOSE && $TIMESONLY ]]; then
echo "$server ... $time"
elif [[ $VERBOSE ]]; then
echo "# $server ... $time"
elif [[ $TIMESONLY ]]; then
echo -n " *"
fi
fi
done
finaloutput
# vim: set noet:

View File

@ -1,126 +0,0 @@
#!/bin/bash
#
# updpkgsums - update source checksums in-place in PKGBUILDs
#
# Copyright (C) 2012-2013 Dave Reisner <dreisner@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/>.
shopt -s extglob
declare -r myname='updpkgsums'
declare -r myver='@PACKAGE_VERSION@'
LIBRARY=${LIBRARY:-'@libmakepkgdir@'}
# Import libmakepkg
source "$LIBRARY"/util/schema.sh
usage() {
printf "%s v%s\n" "${myname}" "${myver}"
echo
printf "%s will perform an in place update of the checksums in the\n" "${myname}"
echo "path specified by [build file], defaulting to PKGBUILD in the current"
echo "working directory."
echo
printf "Usage: %s [options] [build file]\n" "${myname}"
echo
echo " -h, --help display this help message and exit"
echo " -V, --version display version information and exit"
echo
echo "These options can be passed to makepkg:"
echo " -m, --nocolor disable colorized output messages"
}
version() {
printf "%s %s\n" "$myname" "$myver"
echo 'Copyright (C) 2012-2013 Dave Reisner <dreisner@archlinux.org>'
}
die() {
printf "==> ERROR: $1\n" "${@:2}" >&2
exit 1
}
MAKEPKG_OPTS=()
buildfile='PKGBUILD'
while (( "$#" )); do
case "$1" in
-h|--help) usage; exit ;;
-m|--nocolor) MAKEPKG_OPTS+=("$1"); shift ;;
-V|--version) version; exit ;;
*) buildfile="$1"; break 2 ;;
esac
done
if [[ ! -f $buildfile ]]; then
die "%s not found or is not a file" "$buildfile"
fi
# Resolve any symlinks to avoid replacing the symlink with a file. But, we
# have to do this portably -- readlink's flags are inconsistent across OSes.
while [[ -L $buildfile ]]; do
buildfile=$(readlink "$buildfile")
if [[ $buildfile = */* ]]; then
cd "${buildfile%/*}"
buildfile=${buildfile##*/}
fi
done
# cd into the directory with the build file. This avoids creating random src/
# directories scattered about the filesystem, and avoids cases where we might
# not be able to write in the $PWD.
if [[ $buildfile = */* ]]; then
cd "${buildfile%/*}"
buildfile=${buildfile##*/}
fi
# Check $PWD/ for permission to unlink the $buildfile and write a new one
if [[ ! -w . ]]; then
die "No write permission in '%s'" "$PWD"
fi
# Generate the new sums
export BUILDDIR=$(mktemp -d "${TMPDIR:-/tmp}/updpkgsums.XXXXXX")
newbuildfile=$(mktemp "${TMPDIR:-/tmp}/updpkgsums.XXXXXX")
trap "rm -rf '$BUILDDIR' '$newbuildfile'" EXIT
sumtypes=$(IFS='|'; echo "${known_hash_algos[*]}")
newsums=$(makepkg -g -p "$buildfile" "${MAKEPKG_OPTS[@]}") || die 'Failed to generate new checksums'
if [[ -z $newsums ]]; then
die "$buildfile does not contain sources to update"
fi
awk -v sumtypes="$sumtypes" -v newsums="$newsums" '
$0 ~"^[[:blank:]]*(" sumtypes ")sums(_[^=]+)?=", $0 ~ "\\)[[:blank:]]*(#.*)?$" {
if (!w) {
print newsums
w++
}
next
}
1
END { if (!w) print newsums }
' "$buildfile" > "$newbuildfile" || die 'Failed to write new PKGBUILD'
# Rewrite the original buildfile. Use cat instead of mv/cp to preserve
# permissions implicitly.
if ! cat -- "$newbuildfile" >"$buildfile"; then
die "Failed to update %s. The file has not been modified." "$buildfile"
fi
# vim: set noet:

View File

@ -1 +0,0 @@
au BufNewFile,BufRead PKGBUILD set filetype=PKGBUILD

View File

@ -1,7 +0,0 @@
" Vim filetype plugin file
" Language: Arch Linux package build description file
if exists('b:did_ftplugin') | finish | endif
let b:did_ftplugin = 1
setlocal commentstring=#\ %s

View File

@ -1,8 +0,0 @@
" Vim indent file
" Language: Arch Linux package build description file
if exists('b:did_indent')
finish
endif
runtime! indent/sh.vim

View File

@ -1,347 +0,0 @@
" Vim syntax file
" Language: Arch Linux package build description file
" Original Author: Alessio 'mOLOk' Bolognino <themolok at gmail.com>
" quit when a syntax file was already loaded
if exists('b:current_syntax')
finish
endif
let b:main_syntax = 'sh'
let b:is_bash = 1
runtime! syntax/sh.vim
" case on
syn case match
" pkgname
" FIXME if '=' is in pkgname/pkgver, it highlights whole string, not just '='
syn keyword pb_k_pkgname pkgname contained
syn match pbValidPkgname /\([[:alnum:]]\|+\|-\|_\){,32}/ contained contains=pbIllegalPkgname
syn match pbIllegalPkgname /[[:upper:]]\|[^[:alnum:]-+_=]\|=.*=\|=['"]\?.\{33,\}['"]\?/ contained
syn match pbPkgnameGroup /^pkgname=.*/ contains=pbIllegalPkgname,pb_k_pkgname,shDoubleQuote,shSingleQuote
" pkgbase
" FIXME if '=' is in pkgbase/pkgname/pkgver, it highlights whole string, not just '='
syn keyword pb_k_pkgbase pkgbase contained
syn match pbValidPkgbase /\([[:alnum:]]\|+\|-\|_\){,32}/ contained contains=pbIllegalPkgbase
syn match pbIllegalPkgbase /[[:upper:]]\|[^[:alnum:]-+_=]\|=.*=\|=['"]\?.\{33,\}['"]\?/ contained
syn match pbPkgbaseGroup /^pkgbase=.*/ contains=pbIllegalPkgbase,pb_k_pkgbase,shDoubleQuote,shSingleQuote
" pkgver
syn keyword pb_k_pkgver pkgver contained
syn match pbValidPkgver /\([[:alnum:]]\|\.\|+\|_\)/ contained contains=pbIllegalPkgver
syn match pbIllegalPkgver /[^[:alnum:]+=\.\_]\|=.*=/ contained
syn match pbPkgverGroup /^pkgver=.*/ contains=pbIllegalPkgver,pbValidPkgver,pb_k_pkgver,shDoubleQuote,shSingleQuote
" pkgrel
syn keyword pb_k_pkgrel pkgrel contained
syn match pbValidPkgrel /[[:digit:]]*/ contained contains=pbIllegalPkgrel
syn match pbIllegalPkgrel /[^[:digit:]=]\|=.*=/ contained
syn match pbPkgrelGroup /^pkgrel=.*/ contains=pbIllegalPkgrel,pbValidPkgrel,pb_k_pkgrel,shDoubleQuote,shSingleQuote
" pkgdesc
syn keyword pb_k_desc pkgdesc contained
" 90 chars: 80 for description, 8 for pkgdesc and 2 for ''
syn match pbIllegalPkgdesc /.\{90,}\|=['"]\?.*['" ]\+[iI][sS] [aA]/ contained contains=pbPkgdescSign
syn match pbValidPkgdesc /[^='"]\.\{,80}/ contained contains=pbIllegalPkgdesc
syn match pbPkgdescGroup /^pkgdesc=.*/ contains=pbIllegalPkgdesc,pb_k_desc,pbValidPkgdesc,shDoubleQuote,shSingleQuote
syn match pbPkgdescSign /[='"]/ contained
" epoch
syn keyword pb_k_epoch epoch contained
syn match pbValidEpoch /[[:digit:]]*/ contained contains=pbIllegalEpoch
syn match pbIllegalEpoch /[^[:digit:]=]\|=.*=/ contained
syn match pbEpochGroup /^epoch=.*/ contains=pbIllegalEpoch,pbValidEpoch,pb_k_epoch,shDoubleQuote,shSingleQuote
" url
syn keyword pb_k_url url contained
syn match pbValidUrl /['"]*\(https\|http\|ftp\)\:\/.*\.\+.*/ contained
syn match pbIllegalUrl /[^=]/ contained contains=pbValidUrl
syn match pbUrlGroup /^url=.*/ contains=pbValidUrl,pb_k_url,pbIllegalUrl,shDoubleQuote,shSingleQuote
" license
syn keyword pb_k_license license contained
" echo $(pacman -Ql licenses | grep '/usr/share/licenses/common/' | cut -d'/' -f6 | sort -u)
syn keyword pbLicense AGPL AGPL3 Apache APACHE Artistic2.0 Boost CCPL CDDL CPL EPL FDL FDL1.2 FDL1.3 GPL GPL2 GPL3 LGPL LGPL2.1 LGPL3 LPPL MPL MPL2 PerlArtistic PHP PSF RUBY Unlicense W3C ZPL contained
" special cases from https://wiki.archlinux.org/index.php/PKGBUILD#license
syn keyword pbLicenseSpecial BSD MIT ZLIB Python contained
syn match pbLicenseCustom /custom\(:[[:alnum:]]*\)*/ contained
syn keyword pbLicenseUnknown unknown contained
syn match pbIllegalLicense /[^='"() ]/ contained contains=pbLicenseUnknown,pbLicenseCustom,pbLicenseSpecial,pbLicense
syn region pbLicenseGroup start=/^license=(/ end=/)/ contains=pb_k_license,pbLicenseCustom,pbLicenseSpecial,pbLicense,pbIllegalLicense
" backup
syn keyword pb_k_backup backup contained
syn match pbValidBackup /\.\?[[:alpha:]]*\/[[:alnum:]\{\}+._$-]*]*/ contained
syn region pbBackupGroup start=/^backup=(/ end=/)/ contains=pb_k_backup,pbValidBackup,shDoubleQuote,shSingleQuote
" arch
syn keyword pb_k_arch arch contained
syn keyword pbArch i686 x86_64 ppc any contained
syn match pbIllegalArch /[^='"() ]/ contained contains=pbArch
syn region pbArchGroup start=/^arch=(/ end=/)/ contains=pb_k_arch,pbArch,pbIllegalArch
" groups
syn keyword pb_k_groups groups contained
syn match pbValidGroups /\([[:alnum:]]\|+\|-\|_\)*/ contained
syn region pbGroupsGroup start=/^groups=(/ end=/)/ contains=pb_k_groups,pbValidGroups,shDoubleQuote,shSingleQuote
" depends
syn keyword pb_k_depends depends contained
syn match pbValidDepends /\([[:alnum:]]\|+\|-\|_\)*/ contained
syn region pbDependsGroup start=/^depends=(/ end=/)/ contains=pb_k_depends,pbValidDepends,shDoubleQuote,shSingleQuote
" makedepends
syn keyword pb_k_makedepends makedepends contained
syn match pbValidMakedepends /\([[:alnum:]]\|+\|-\|_\)*/ contained
syn region pbMakedependsGroup start=/^makedepends=(/ end=/)/ contains=pb_k_makedepends,pbValidMakedepends,shDoubleQuote,shSingleQuote
" optdepends
syn keyword pb_k_optdepends optdepends contained
syn match pbValidOptdepends /\([[:alnum:]]\|+\|-\|_\)*/ contained
syn region pbOptdependsGroup start=/^optdepends=(/ end=/)/ contains=pb_k_optdepends,pbValidOptdepends,shDoubleQuote,shSingleQuote
" checkdepends
syn keyword pb_k_ckdepends checkdepends contained
syn match pbValidCkdepends /\([[:alnum:]]\|+\|-\|_\)*/ contained
syn region pbCkdependsGroup start=/^checkdepends=(/ end=/)/ contains=pb_k_ckdepends,pbValidCkdepends,shDoubleQuote,shSingleQuote
" conflicts
syn keyword pb_k_conflicts conflicts contained
syn match pbValidConflicts /\([[:alnum:]]\|+\|-\|_\)*/ contained
syn region pbConflictsGroup start=/^conflicts=(/ end=/)/ contains=pb_k_conflicts,pbValidConflicts,shDoubleQuote,shSingleQuote
" provides
syn keyword pb_k_provides provides contained
syn match pbValidProvides /\([[:alnum:]]\|+\|-\|_\)*/ contained
syn region pbProvidesGroup start=/^provides=(/ end=/)/ contains=pb_k_provides,pbValidProvides,shDoubleQuote,shSingleQuote
" replaces
syn keyword pb_k_replaces replaces contained
syn match pbValidReplaces /\([[:alnum:]]\|+\|-\|_\)*/ contained
syn region pbReplacesGroup start=/^replaces=(/ end=/)/ contains=pb_k_replaces,pbValidReplaces,shDoubleQuote,shSingleQuote
" install
" XXX remove install from bashStatement, fix strange bug
syn clear bashStatement
syn keyword bashStatement chmod clear complete du egrep expr fgrep find gnufind gnugrep grep less ls mkdir mv rm rmdir rpm sed sleep sort strip tail touch
syn keyword pb_k_install install contained
syn match pbValidInstall /\([[:alnum:]]\|\$\|+\|-\|_\)*\.install/ contained
syn match pbIllegalInstall /[^=]/ contained contains=pbValidInstall
syn match pbInstallGroup /^install=.*/ contains=pb_k_install,pbValidInstall,pbIllegalInstall,shDeref,shDoubleQuote,shSingleQuote
" changelog
syn keyword pb_k_changelog changelog contained
syn match pbValidChangelog /\([[:alnum:]]\|\$\|+\|-\|_\)*/ contained
syn match pbIllegalChangelog /[^=]/ contained contains=pbValidChangelog
syn match pbChangelogGroup /^changelog=.*/ contains=pb_k_changelog,pbValidChangelog,pbIllegalChangelog,shDeref,shDoubleQuote,shSingleQuote
" source:
" XXX remove source from shStatement, fix strange bug
syn clear shStatement
syn keyword shStatement xxx wait getopts return autoload whence printf true popd nohup enable r trap readonly fc fg kill ulimit umask disown stop pushd read history logout times local exit test pwd time eval integer suspend dirs shopt hash false newgrp bg print jobs continue functions exec help cd break unalias chdir type shift builtin let bind
syn keyword pb_k_source source contained
syn match pbIllegalSource /\(http\|ftp\|https\).*\.\+\(dl\|download.\?\)\.\(sourceforge\|sf\).net/
syn region pbSourceGroup start=/^source=(/ end=/)/ contains=pb_k_source,pbIllegalSource,shNumber,shDoubleQuote,shSingleQuote,pbDerefEmulation
syn match pbDerefEmulation /\$[{]\?[[:alnum:]_]*[}]\?/ contained
hi def link pbDerefEmulation PreProc
" md5sums
syn keyword pb_k_md5sums md5sums contained
syn match pbIllegalMd5sums /[^='"()\/ ]/ contained contains=pbValidMd5sums
syn match pbValidMd5sums /\x\{32\}/ contained
syn region pbMd5sumsGroup start=/^md5sums/ end=/)/ contains=pb_k_md5sums,pbMd5Quotes,pbMd5Hash,pbIllegalMd5sums keepend
syn match pbMd5Quotes /'.*'\|".*"/ contained contains=pbMd5Hash,pbIllegalMd5sums
syn match pbMd5Hash /\x\+/ contained contains=pbValidMd5sums
hi def link pbMd5Quotes Keyword
hi def link pbMd5Hash Error
hi def link pbValidMd5sums Number
" sha1sums
syn keyword pb_k_sha1sums sha1sums contained
syn match pbIllegalSha1sums /[^='"()\/ ]/ contained contains=pbValidSha1sums
syn match pbValidSha1sums /\x\{40\}/ contained
syn region pbSha1sumsGroup start=/^sha1sums/ end=/)/ contains=pb_k_sha1sums,pbSha1Quotes,pbSha1Hash,pbIllegalSha1sums keepend
syn match pbSha1Quotes /'.*'\|".*"/ contained contains=pbSha1Hash,pbIllegalSha1sums
syn match pbSha1Hash /\x\+/ contained contains=pbValidSha1sums
hi def link pbSha1Quotes Keyword
hi def link pbSha1Hash Error
hi def link pbValidSha1sums Number
" sha224sums
syn keyword pb_k_sha224sums sha224sums contained
syn match pbIllegalsha224sums /[^='"()\/ ]/ contained contains=pbValidsha224sums
syn match pbValidsha224sums /\x\{64\}/ contained
syn region pbsha224sumsGroup start=/^sha224sums/ end=/)/ contains=pb_k_sha224sums,pbsha224Quotes,pbsha224Hash,pbIllegalsha224sums keepend
syn match pbsha224Quotes /'.*'\|".*"/ contained contains=pbsha224Hash,pbIllegalsha224sums
syn match pbsha224Hash /\x\+/ contained contains=pbValidsha224sums
hi def link pbsha224Quotes Keyword
hi def link pbsha224Hash Error
hi def link pbValidsha224sums Number
" sha256sums
syn keyword pb_k_sha256sums sha256sums contained
syn match pbIllegalSha256sums /[^='"()\/ ]/ contained contains=pbValidSha256sums
syn match pbValidSha256sums /\x\{64\}/ contained
syn region pbSha256sumsGroup start=/^sha256sums/ end=/)/ contains=pb_k_sha256sums,pbSha256Quotes,pbSha256Hash,pbIllegalSha256sums keepend
syn match pbSha256Quotes /'.*'\|".*"/ contained contains=pbSha256Hash,pbIllegalSha256sums
syn match pbSha256Hash /\x\+/ contained contains=pbValidSha256sums
hi def link pbSha256Quotes Keyword
hi def link pbSha256Hash Error
hi def link pbValidSha256sums Number
" sha384sums
syn keyword pb_k_sha384sums sha384sums contained
syn match pbIllegalSha384sums /[^='"()\/ ]/ contained contains=pbValidSha384sums
syn match pbValidSha384sums /\x\{96\}/ contained
syn region pbSha384sumsGroup start=/^sha384sums/ end=/)/ contains=pb_k_sha384sums,pbSha384Quotes,pbSha384Hash,pbIllegalSha384sums keepend
syn match pbSha384Quotes /'.*'\|".*"/ contained contains=pbSha384Hash,pbIllegalSha384sums
syn match pbSha384Hash /\x\+/ contained contains=pbValidSha384sums
hi def link pbSha384Quotes Keyword
hi def link pbSha384Hash Error
hi def link pbValidSha384sums Number
" sha512sums
syn keyword pb_k_sha512sums sha512sums contained
syn match pbIllegalSha512sums /[^='"()\/ ]/ contained contains=pbValidSha512sums
syn match pbValidSha512sums /\x\{128\}/ contained
syn region pbSha512sumsGroup start=/^sha512sums/ end=/)/ contains=pb_k_sha512sums,pbSha512Quotes,pbSha512Hash,pbIllegalSha512sums keepend
syn match pbSha512Quotes /'.*'\|".*"/ contained contains=pbSha512Hash,pbIllegalSha512sums
syn match pbSha512Hash /\x\+/ contained contains=pbValidSha512sums
hi def link pbSha512Quotes Keyword
hi def link pbSha512Hash Error
hi def link pbValidSha512sums Number
" b2sums
syn keyword pb_k_b2sums b2sums contained
syn match pbIllegalB2sums /[^='"()\/ ]/ contained contains=pbValidB2sums
syn match pbValidB2sums /\x\{128\}/ contained
syn region pbB2sumsGroup start=/^b2sums/ end=/)/ contains=pb_k_b2sums,pbB2Quotes,pbB2Hash,pbIllegalB2sums keepend
syn match pbB2Quotes /'.*'\|".*"/ contained contains=pbB2Hash,pbIllegalB2sums
syn match pbB2Hash /\x\+/ contained contains=pbValidB2sums
hi def link pbB2Quotes Keyword
hi def link pbB2Hash Error
hi def link pbValidB2sums Number
" validpgpkeys
syn keyword pb_k_validpgpkeys validpgpkeys contained
syn match pbValidPGPKeys /\([[:alnum:]]\)*/ contained
syn region pbValidPGPKeysGroup start=/^validpgpkeys=(/ end=/)/ contains=pb_k_validpgpkeys,pbValidPGPKeys,shDoubleQuote,shSingleQuote
" options
syn keyword pb_k_options options contained
syn match pbOptions /\(no\)\?\(strip\|docs\|libtool\|emptydirs\|zipman\|purge\|distcc\|color\|ccache\|check\|sign\|makeflags\|buildflags\)/ contained
syn match pbOptionsNeg /\!/ contained
syn match pbOptionsDeprec /no/ contained
syn region pbOptionsGroup start=/^options=(/ end=/)/ contains=pb_k_options,pbOptions,pbOptionsNeg,pbOptionsDeprec,pbIllegalOption
syn match pbIllegalOption /[^!"'()= ]/ contained contains=pbOptionsDeprec,pbOptions
" noextract
syn match pbNoextract /[[:alnum:]+._${}-]\+/ contained
syn keyword pb_k_noextract noextract contained
syn region pbNoextractGroup start=/^noextract=(/ end=/)/ contains=pb_k_noextract,pbNoextract,shDoubleQuote,shSingleQuote
" comments
syn keyword pb_k_maintainer Maintainer Contributor contained
syn match pbMaintainerGroup /Maintainer.*/ contains=pbMaintainer contained
syn match pbDate /[0-9]\{4}\/[0-9]\{2}\/[0-9]\{2}/ contained
syn cluster pbCommentGroup contains=pbTodo,pb_k_maintainer,pbMaintainerGroup,pbDate
syn keyword pbTodo contained COMBAK FIXME TODO XXX
syn match pbComment "^#.*$" contains=@pbCommentGroup
syn match pbComment "[^0-9]#.*$" contains=@pbCommentGroup
" quotes are handled by sh.vim
hi def link pbComment Comment
hi def link pbTodo Todo
hi def link pbIllegalPkgname Error
hi def link pb_k_pkgname pbKeywords
hi def link pbIllegalPkgbase Error
hi def link pb_k_pkgbase pbKeywords
hi def link pbIllegalPkgver Error
hi def link pb_k_pkgver pbKeywords
hi def link pbIllegalPkgrel Error
hi def link pb_k_pkgrel pbKeywords
hi def link pbIllegalPkgdesc Error
hi def link pb_k_desc pbKeywords
hi def link pbIllegalEpoch Error
hi def link pb_k_epoch pbKeywords
hi def link pbIllegalUrl Error
hi def link pb_k_url pbKeywords
hi def link pb_k_license pbKeywords
hi def link pbIllegalLicense Error
hi def link pb_k_backup pbKeywords
hi def link pb_k_arch pbKeywords
hi def link pbIllegalArch Error
hi def link pb_k_groups pbKeywords
hi def link pb_k_makedepends pbKeywords
hi def link pb_k_optdepends pbKeywords
hi def link pb_k_ckdepends pbKeywords
hi def link pb_k_depends pbKeywords
hi def link pb_k_replaces pbKeywords
hi def link pb_k_conflicts pbKeywords
hi def link pb_k_provides pbKeywords
hi def link pbIllegalInstall Error
hi def link pb_k_install pbKeywords
hi def link pbIllegalChangelog Error
hi def link pb_k_changelog pbKeywords
hi def link pb_k_source pbKeywords
hi def link pbIllegalSource Error
hi def link pb_k_validpgpkeys pbKeywords
hi def link pb_k_md5sums pbKeywords
hi def link pbIllegalMd5sums Error
hi def link pb_k_sha1sums pbKeywords
hi def link pbIllegalSha1sums Error
hi def link pb_k_sha224sums pbKeywords
hi def link pbIllegalSha224sums Error
hi def link pb_k_sha256sums pbKeywords
hi def link pbIllegalSha256sums Error
hi def link pb_k_sha384sums pbKeywords
hi def link pbIllegalSha384sums Error
hi def link pb_k_sha512sums pbKeywords
hi def link pbIllegalSha512sums Error
hi def link pb_k_b2sums pbKeywords
hi def link pbIllegalb2sums Error
hi def link pb_k_options pbKeywords
hi def link pbOptionsDeprec Todo
hi def link pbIllegalOption Error
hi def link pb_k_noextract pbKeywords
hi def link pbNoextract Normal
hi def link pb_k_maintainer pbKeywords
hi def link pbKeywords Keyword
hi def link pbDate Special
"let b:current_syntax = 'PKGBUILD'

View File

@ -1,3 +0,0 @@
pacsorttest.sh.log
pacsorttest.sh.trs
test-suite.log

View File

@ -1,8 +0,0 @@
check_SCRIPTS = \
pacsorttest.sh
noinst_SCRIPTS = $(check_SCRIPTS)
EXTRA_DIST = \
$(check_SCRIPTS) \
tap.sh

View File

@ -1,113 +0,0 @@
#!/bin/bash
#
# pacsorttest - a test suite for pacsort
#
# Copyright (c) 2013-2015 by Pacman Development Team <pacman-dev@archlinux.org>
# Copyright (c) 2011 by 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/>.
source "$(dirname "$0")"/tap.sh || exit 1
# default binary if one was not specified as $1
bin=${1:-${PMTEST_BIN_DIR}pacsort}
if ! type -p "$bin" &>/dev/null; then
tap_bail "pacsort binary ($bin) could not be located"
exit 1
fi
# args:
# runtest input expected test_description optional_opts
tap_runtest() {
# run the test
tap_diff <(printf "$1" | $bin $4) <(printf "$2") "$3"
}
tap_plan 26
in="1\n2\n3\n4\n"
tap_runtest $in $in "already ordered"
in="4\n2\n3\n1\n"
ex="1\n2\n3\n4\n"
tap_runtest $in $ex "easy reordering"
in="1\n2\n3\n4"
ex="1\n2\n3\n4\n"
tap_runtest $in $ex "add trailing newline"
in="1\n2\n4\n3"
ex="1\n2\n3\n4\n"
tap_runtest $in $ex "add trailing newline"
in="1.0-1\n1.0\n1.0-2\n1.0\n"
tap_runtest $in $in "stable sort"
in="firefox-18.0-2-x86_64.pkg.tar.xz\nfirefox-18.0.1-1-x86_64.pkg.tar.xz\n"
tap_runtest $in $in "filename sort" "--files"
in="firefox-18.0-2\nfirefox-18.0.1-1-x86_64.pkg.tar.xz\n"
tap_runtest $in $in "filename sort with invalid filename" "--files"
in="firefox-18.0-2-x86_64.pkg.tar.xz\n/path2/firefox-18.0.1-1-x86_64.pkg.tar.xz\n"
tap_runtest $in $in "filename sort maybe with leading paths" "--files"
in="/path1/firefox-18.0-2-x86_64.pkg.tar.xz\n/path2/firefox-18.0.1-1-x86_64.pkg.tar.xz\n"
tap_runtest $in $in "filename sort with different leading paths" "--files"
in="/path2/firefox-18.0-2-x86_64.pkg.tar.xz\n/path1/path2/firefox-18.0.1-1-x86_64.pkg.tar.xz\n"
tap_runtest $in $in "filename sort with uneven leading path components" "--files"
in="firefox-18.0-2-i686.pkg.tar.xz\nfirefox-18.0.1-1-x86_64.pkg.tar.gz\n"
tap_runtest $in $in "filename sort with different extensions" "--files"
in="/packages/dialog-1.2_20131001-1-x86_64.pkg.tar.xz\n/packages/dialog-1:1.2_20130928-1-x86_64.pkg.tar.xz\n"
tap_runtest $in $in "filename sort with epoch" "--files"
in="/packages/dia-log-1:1.2_20130928-1-x86_64.pkg.tar.xz\n/packages/dialog-1.2_20131001-1-x86_64.pkg.tar.xz\n"
tap_runtest $in $in "filename sort with differing package names and epoch" "--files"
in="/packages/systemd-217-1-x86_64.pkg.tar.xz\n/packages/systemd-sysvcompat-217-1-x86_64.pkg.tar.xz\n"
tap_runtest $in $in "filename sort with package names as shared substring" "--files"
# generate some long input/expected for the next few tests
declare normal reverse names_normal names_reverse
for ((i=1; i<600; i++)); do
normal="${normal}${i}\n"
reverse="${reverse}$((600 - ${i}))\n"
fields="${fields}colA bogus$((600 - ${i})) ${i}\n"
fields_reverse="${fields_reverse}colA bogus${i} $((600 - ${i}))\n"
separator="${separator}colA|bogus$((600 - ${i}))|${i}\n"
separator_reverse="${separator_reverse}colA|bogus${i}|$((600 - ${i}))\n"
done
tap_runtest $normal $normal "really long input"
tap_runtest $reverse $normal "really long input"
tap_runtest $reverse $reverse "really long input, reversed" "-r"
tap_runtest $normal $reverse "really long input, reversed" "-r"
tap_runtest "$fields" "$fields" "really long input, sort key" "-k3"
tap_runtest "$fields_reverse" "$fields" "really long input, sort key" "-k3"
tap_runtest "$fields_reverse" "$fields_reverse" "really long input, sort key, reversed" "-k 3 -r"
tap_runtest "$fields" "$fields_reverse" "really long input, sort key, reversed" "-k 3 -r"
tap_runtest "$separator" "$separator" "really long input, sort key, separator" "-k3 -t|"
tap_runtest "$separator_reverse" "$separator" "really long input, sort key, separator" "-k3 -t|"
tap_runtest "$separator_reverse" "$separator_reverse" "really long input, sort key, separator, reversed" "-k 3 -t| -r"
tap_runtest "$separator" "$separator_reverse" "really long input, sort key, separator, reversed" "-k 3 -t| -r"
tap_finish
# vim: set noet:

View File

@ -1,163 +0,0 @@
# Copyright 2014 Andrew Gregory <andrew.gregory.8@gmail.com>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to
# deal in the Software without restriction, including without limitation the
# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
# sell copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
# IN THE SOFTWARE.
#
# Project URL: http://github.com/andrewgregory/tap.sh
declare -i tap_planned=0 tap_run=0 tap_failed=0 tap_passed=0
declare tap_todo=''
tap_plan() {
tap_planned=$1
printf "1..%d\n" "$tap_planned"
}
tap_done_testing() {
tap_plan $tap_run
}
tap_skip_all() {
printf "1..0 # SKIP"
_tap_print_reason " " "$@"
printf "\n"
}
tap_diag() {
if [[ -n $tap_todo ]]; then
tap_note "$@"
else
tap_note "$@" 1>&2
fi
}
tap_note() {
printf "# "
printf -- "$@"
printf "\n"
}
tap_bail() {
printf "Bail out!"
_tap_print_reason " " "$@"
printf "\n"
}
tap_finish() {
local tap_todo=''
if (( tap_planned != tap_run )); then
tap_note "Looks like you planned %d tests but ran %d." "$tap_planned" "$tap_run"
elif (( tap_planned == tap_run && tap_failed == 0 )); then
tap_note "All %d tests successfully run." "$tap_planned"
else
tap_note "Failed %d of %d tests." "$tap_failed" "$tap_planned"
fi
(( tap_planned == tap_run && tap_failed == 0 ))
}
tap_skip() {
local -i count="$1"; shift
while (( count-- )); do
(( tap_run++ ))
printf "ok %d # SKIP" "$tap_run"
_tap_print_reason " " "$@"
printf "\n"
done
}
_tap_print_reason() {
local sep="$1"; shift
if [[ $# -gt 0 ]]; then
printf "%s" "$sep"
printf -- "$@"
fi
}
tap_ok() {
local ok="$1"; shift
(( tap_run++ ))
if [[ $ok -eq 0 ]]; then
(( tap_passed++ ))
printf "ok %d" "$tap_run"
else
(( tap_failed++ ))
printf "not ok %d" "$tap_run"
fi
_tap_print_reason " - " "$@"
if [[ -n $tap_todo ]]; then
printf " # TODO %s" "$tap_todo"
fi
printf "\n"
if [[ $ok -ne 0 ]]; then
local line func file
local -i i=0
read line func file < <(caller $i)
while [[ -n $func && $func == tap_* ]]; do
(( i++ ))
read line func file < <(caller $i)
done
if [[ -n $file ]]; then
file=${file##*/}
if [[ -n $tap_todo ]]; then
tap_diag " Failed (TODO) test at %s line %d." "${file}" "$line"
else
tap_diag " Failed test at %s line %d." "${file}" "$line"
fi
fi
fi
return $ok
}
tap_is_str() {
local got="$1" expected="$2"; shift 2
[[ $got == $expected ]]
local ret=$?
if ! tap_ok $ret "$@"; then
tap_diag " got: '%s'" "$got"
tap_diag " expected: '%s'" "$expected"
fi
return $ret
}
tap_is_int() {
local got="$1" expected="$2"; shift 2
[[ $got -eq $expected ]]
local ret=$?
if ! tap_ok $ret "$@"; then
tap_diag " got: '%s'" "$got"
tap_diag " expected: '%s'" "$expected"
fi
return $ret
}
tap_diff() {
local got="$1" expected="$2"; shift 2
local output ret
output="$(diff -u --label got --label expected "$got" "$expected" 2>&1)"
ret=$?
if ! tap_ok $ret "$@"; then
while IFS= read line; do
tap_diag "$line"
done <<<"$output"
fi
return $ret
}
# vim: ft=sh