mirror of
https://gitlab.archlinux.org/pacman/pacman.git
synced 2025-11-06 02:24:41 +01:00
Compare commits
58 Commits
andrew/tes
...
last-delta
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
377d47142f | ||
|
|
298bcf7986 | ||
|
|
e03752e6ad | ||
|
|
0113214db9 | ||
|
|
d197d8ab82 | ||
|
|
adb961a88e | ||
|
|
ba7a41031c | ||
|
|
3c774252ef | ||
|
|
656e851f0a | ||
|
|
4b83bcfcee | ||
|
|
477a66cd0e | ||
|
|
86004227d1 | ||
|
|
db102c67ef | ||
|
|
714a1b4e4e | ||
|
|
04e77591d6 | ||
|
|
11bc315cdb | ||
|
|
14755df06f | ||
|
|
75aae126c4 | ||
|
|
6cf0548128 | ||
|
|
776fbe1cde | ||
|
|
5bd54fa0c6 | ||
|
|
1e040153bc | ||
|
|
9c817b6549 | ||
|
|
ac0e21a6df | ||
|
|
1b9e358f1d | ||
|
|
4d1d857ef0 | ||
|
|
ff8c96fa7d | ||
|
|
c15f7ae606 | ||
|
|
a5090217f9 | ||
|
|
10bcf66db8 | ||
|
|
02598521b1 | ||
|
|
a769fbfd40 | ||
|
|
b76dbb1159 | ||
|
|
ce040514c4 | ||
|
|
5d2f7ee6c3 | ||
|
|
031611ff40 | ||
|
|
10fe71e5f3 | ||
|
|
aa284c97f1 | ||
|
|
f7efa6a93d | ||
|
|
30e3e21e87 | ||
|
|
03d85763e0 | ||
|
|
e9d91a688d | ||
|
|
9b2a90cfb1 | ||
|
|
9b637cc27a | ||
|
|
f9eb2aacb4 | ||
|
|
238fa4af45 | ||
|
|
268b0255fa | ||
|
|
c5c7fc7f4a | ||
|
|
2f15921230 | ||
|
|
7c5958e0eb | ||
|
|
e1fc2f901e | ||
|
|
3a5a0d53bc | ||
|
|
984492b92f | ||
|
|
4778f13188 | ||
|
|
2d403709d9 | ||
|
|
ecac357c1a | ||
|
|
d150b97190 | ||
|
|
33a8ced334 |
12
Makefile.am
12
Makefile.am
@@ -1,4 +1,4 @@
|
||||
SUBDIRS = lib/libalpm src/util src/pacman scripts etc test/makepkg test/pacman test/util test/scripts
|
||||
SUBDIRS = lib/libalpm src/util src/pacman scripts etc test/pacman test/util test/scripts
|
||||
if WANT_DOC
|
||||
SUBDIRS += doc
|
||||
endif
|
||||
@@ -27,15 +27,11 @@ dist_pkgdata_DATA = \
|
||||
$(top_srcdir)/test/pacman/tests/TESTS: $(wildcard test/pacman/tests/*.py)
|
||||
@printf "TESTS += %s\n" $^ | LC_ALL=C sort -u > "$@"
|
||||
|
||||
$(top_srcdir)/test/makepkg/tests/TESTS: $(wildcard test/makepkg/tests/*.sh)
|
||||
@printf "TESTS += %s\n" $^ | LC_ALL=C sort -u > "$@"
|
||||
|
||||
TESTS = test/scripts/parseopts_test.sh \
|
||||
test/scripts/human_to_size_test.sh \
|
||||
test/scripts/makepkg-template_test.sh \
|
||||
test/scripts/pacman-db-upgrade-v9.py \
|
||||
test/util/vercmptest.sh
|
||||
include $(top_srcdir)/test/makepkg/tests/TESTS
|
||||
include $(top_srcdir)/test/pacman/tests/TESTS
|
||||
|
||||
TEST_SUITE_LOG = test/test-suite.log
|
||||
@@ -55,6 +51,12 @@ AM_PY_LOG_FLAGS = \
|
||||
--ldconfig $(LDCONFIG) \
|
||||
--bindir $(top_builddir)/src/pacman \
|
||||
--bindir $(top_builddir)/scripts
|
||||
if !HAVE_LIBGPGME
|
||||
AM_PY_LOG_FLAGS += --without-gpg
|
||||
endif
|
||||
if !HAVE_LIBCURL
|
||||
AM_PY_LOG_FLAGS += --without-curl
|
||||
endif
|
||||
|
||||
# create the pacman DB, cache, makepkg-template and system hook directories upon install
|
||||
install-data-local:
|
||||
|
||||
12
NEWS
12
NEWS
@@ -167,7 +167,7 @@ VERSION DESCRIPTION
|
||||
- fix triggering of Install hooks (FS#47996)
|
||||
- fix handling of stdin scripts called by pacman
|
||||
- hook activity is logged
|
||||
- documentataion updates for alpm-hooks (FS#48080)
|
||||
- documentation updates for alpm-hooks (FS#48080)
|
||||
- makepkg:
|
||||
- increase robustness of variable array checks
|
||||
- makepkg -g does not perform current architecture checks
|
||||
@@ -259,9 +259,9 @@ VERSION DESCRIPTION
|
||||
- Fix removal of static libraries when the shared library
|
||||
uses the absolute path in symbolic links (FS#43395)
|
||||
- Improve Bazaar cloning (FS#43448)
|
||||
- Fix issues with architecture dependant checksum
|
||||
- Fix issues with architecture dependent checksum
|
||||
verification (FS#43192)
|
||||
- Fix .SRCINFO file with architecture dependant fields
|
||||
- Fix .SRCINFO file with architecture dependent fields
|
||||
(FS#43247)
|
||||
- Fix compatibility with older bash versions
|
||||
- Allow git checkouts to be downloaded into directory ending
|
||||
@@ -351,7 +351,7 @@ VERSION DESCRIPTION
|
||||
- checkupdates: rename CHECKUPDATE_DB to CHECKUPDATES_DB
|
||||
- pacdiff: add a "Quit" option, and many other improvements
|
||||
- pacsysclean is removed
|
||||
4.1.2 - validate %FILEPATH% when parsing repos to prevent arbitary
|
||||
4.1.2 - validate %FILEPATH% when parsing repos to prevent arbitrary
|
||||
file overwrites from malicious databases
|
||||
- makepkg:
|
||||
- restrict package name from starting with a dot
|
||||
@@ -816,7 +816,7 @@ VERSION DESCRIPTION
|
||||
- repo-add: use openssl instead of md5sum
|
||||
- simplify doc building process for ease of development
|
||||
- ensure correct handling of syscall interruptions
|
||||
- readd missing newline on -Qi/-Si output (FS#11331)
|
||||
- re-add missing newline on -Qi/-Si output (FS#11331)
|
||||
- fix TotalDownload regression (FS#11339)
|
||||
- makepkg:
|
||||
- replace getopt with an internal function
|
||||
@@ -1262,7 +1262,7 @@ VERSION DESCRIPTION
|
||||
external download utility like wget
|
||||
- added a license field to package meta-data
|
||||
- add url support to -A and -U operations (download packages)
|
||||
- -Ss now searches thru provides fields
|
||||
- -Ss now searches through provides fields
|
||||
- added --dbonly option to -R
|
||||
2.7.6 - added --print-uris option
|
||||
- fixed an http download bug (FS#667)
|
||||
|
||||
@@ -72,7 +72,7 @@ if test "x$CFLAGS" = "x"; then
|
||||
CFLAGS=""
|
||||
fi
|
||||
|
||||
# Set subsitution values for version stuff in Makefiles and anywhere else,
|
||||
# Set substitution values for version stuff in Makefiles and anywhere else,
|
||||
# and put LIB_VERSION in config.h
|
||||
AC_SUBST(LIB_VERSION)
|
||||
AC_SUBST(LIB_VERSION_INFO)
|
||||
@@ -443,6 +443,7 @@ if test "x$debug" = "xyes" ; then
|
||||
# Check for -fstack-protector availability
|
||||
GCC_STACK_PROTECT_LIB
|
||||
GCC_STACK_PROTECT_CC
|
||||
GCC_STACK_CLASH_PROTECTION
|
||||
GCC_FORTIFY_SOURCE_CC
|
||||
WARNING_CFLAGS="-g -Wall -Werror"
|
||||
else
|
||||
@@ -461,6 +462,7 @@ if test "x$warningflags" = "xyes" ; then
|
||||
CFLAGS_ADD([-Wformat-nonliteral], [WARNING_CFLAGS])
|
||||
CFLAGS_ADD([-Wformat-security], [WARNING_CFLAGS])
|
||||
CFLAGS_ADD([-Wignored-qualifiers], [WARNING_CFLAGS])
|
||||
CFLAGS_ADD([-Wimplicit-fallthrough], [WARNING_CFLAGS])
|
||||
CFLAGS_ADD([-Winit-self], [WARNING_CFLAGS])
|
||||
CFLAGS_ADD([-Wlogical-op], [WARNING_CFLAGS])
|
||||
CFLAGS_ADD([-Wmissing-declarations], [WARNING_CFLAGS])
|
||||
@@ -539,8 +541,6 @@ scripts/Makefile
|
||||
scripts/po/Makefile.in
|
||||
doc/Makefile
|
||||
etc/Makefile
|
||||
test/makepkg/Makefile
|
||||
test/makepkg/tests/Makefile
|
||||
test/pacman/Makefile
|
||||
test/pacman/tests/Makefile
|
||||
test/scripts/Makefile
|
||||
|
||||
@@ -16,23 +16,12 @@ MANPAGES = \
|
||||
makepkg.conf.5 \
|
||||
pacman.conf.5 \
|
||||
libalpm.3 \
|
||||
BUILDINFO.5
|
||||
BUILDINFO.5 \
|
||||
pacman-conf.8
|
||||
|
||||
DOXYGEN_MANS = $(wildcard man3/*.3)
|
||||
|
||||
HTML_MANPAGES = \
|
||||
alpm-hooks.5.html \
|
||||
pacman.8.html \
|
||||
makepkg.8.html \
|
||||
makepkg-template.1.html \
|
||||
repo-add.8.html \
|
||||
vercmp.8.html \
|
||||
pkgdelta.8.html \
|
||||
pacman-key.8.html \
|
||||
PKGBUILD.5.html \
|
||||
makepkg.conf.5.html \
|
||||
pacman.conf.5.html \
|
||||
libalpm.3.html
|
||||
HTML_MANPAGES = $(addsuffix .html,$(MANPAGES))
|
||||
|
||||
HTML_OTHER = \
|
||||
index.html \
|
||||
@@ -124,7 +113,8 @@ ASCIIDOC_OPTS = \
|
||||
-a pkgdatadir=$(pkgdatadir) \
|
||||
-a localstatedir=$(localstatedir) \
|
||||
-a sysconfdir=$(sysconfdir) \
|
||||
-a datarootdir=$(datarootdir)
|
||||
-a datarootdir=$(datarootdir) \
|
||||
-a rootdir=$(ROOTDIR)
|
||||
|
||||
A2X_OPTS = \
|
||||
--no-xmllint \
|
||||
|
||||
@@ -60,8 +60,8 @@ systems (see below).
|
||||
allows package maintainers to make updates to the package's configure
|
||||
flags, for example. This is typically set to '1' for each new upstream
|
||||
software release and incremented for intermediate PKGBUILD updates. The
|
||||
variable is a postive integer, with an optional subrelease level
|
||||
specified by adding another postive integer separated by a period
|
||||
variable is a positive integer, with an optional subrelease level
|
||||
specified by adding another positive integer separated by a period
|
||||
(i.e. in the form x.y).
|
||||
|
||||
*epoch*::
|
||||
@@ -154,7 +154,7 @@ contain whitespace characters.
|
||||
be skipped. To easily generate md5sums, run ``makepkg -g >> PKGBUILD''.
|
||||
If desired, move the md5sums line to an appropriate location.
|
||||
|
||||
*sha1sums, sha224sums, sha256sums, sha384sums, sha512sums (arrays)*::
|
||||
*sha1sums, sha224sums, sha256sums, sha384sums, sha512sums, b2sums (arrays)*::
|
||||
Alternative integrity checks that makepkg supports; these all behave
|
||||
similar to the md5sums option described above. To enable use and generation
|
||||
of these checksums, be sure to set up the `INTEGRITY_CHECK` option in
|
||||
|
||||
@@ -43,9 +43,11 @@ There are several man pages available for the programs, utilities, and
|
||||
configuration files dealing with pacman.
|
||||
|
||||
* linkman:alpm-hooks[5]
|
||||
* linkman:BUILDINFO[5]
|
||||
* linkman:PKGBUILD[5]
|
||||
* linkman:libalpm[3]
|
||||
* linkman:makepkg[8]
|
||||
* linkman:makepkg-template[1]
|
||||
* linkman:makepkg.conf[5]
|
||||
* linkman:pacman[8]
|
||||
* linkman:pacman-key[8]
|
||||
@@ -57,11 +59,11 @@ configuration files dealing with pacman.
|
||||
Changelog
|
||||
~~~~~~~~~
|
||||
For a good idea of what is going on in pacman development, take a look at the
|
||||
link:https://projects.archlinux.org/pacman.git/[Git summary page] for the
|
||||
link:https://git.archlinux.org/pacman.git/[Git summary page] for the
|
||||
project.
|
||||
|
||||
See the most recent
|
||||
link:https://projects.archlinux.org/pacman.git/tree/NEWS[NEWS]
|
||||
link:https://git.archlinux.org/pacman.git/tree/NEWS[NEWS]
|
||||
file for a not-as-frequently-updated list of changes. However, this should
|
||||
contain the biggest changes in a format more concise than the commit log.
|
||||
|
||||
@@ -201,8 +203,8 @@ Development
|
||||
Mailing List
|
||||
~~~~~~~~~~~~
|
||||
There is a mailing list devoted to pacman development, hosted by Arch Linux.
|
||||
link:https://mailman.archlinux.org/mailman/listinfo/pacman-dev/[Subscribe] or
|
||||
link:https://mailman.archlinux.org/pipermail/pacman-dev/[view the archives].
|
||||
link:https://lists.archlinux.org/listinfo/pacman-dev/[Subscribe] or
|
||||
link:https://lists.archlinux.org/pipermail/pacman-dev/[view the archives].
|
||||
|
||||
Source Code
|
||||
~~~~~~~~~~~
|
||||
@@ -213,11 +215,11 @@ these trees).
|
||||
|
||||
The current development tree can be fetched with the following command:
|
||||
|
||||
git clone git://projects.archlinux.org/pacman.git pacman
|
||||
git clone git://git.archlinux.org/pacman.git pacman
|
||||
|
||||
which will fetch the full development history into a directory named pacman.
|
||||
You can browse the source as well using
|
||||
link:https://projects.archlinux.org/pacman.git/[cgit]. HTTP/HTTPS URLs are also
|
||||
link:https://git.archlinux.org/pacman.git/[cgit]. HTTP/HTTPS URLs are also
|
||||
available for cloning purposes; these URLs are listed at the above page.
|
||||
|
||||
If you are interested in hacking on pacman, it is highly recommended you join
|
||||
@@ -236,15 +238,13 @@ Although the package manager itself is quite simple, many scripts have been
|
||||
developed that help automate building and installing packages. These are used
|
||||
extensively in link:https://www.archlinux.org/[Arch Linux]. Most of these utilities
|
||||
are available in the Arch Linux projects
|
||||
link:https://projects.archlinux.org/[code browser].
|
||||
link:https://git.archlinux.org/[code browser].
|
||||
|
||||
Utilities available:
|
||||
|
||||
* link:https://projects.archlinux.org/abs.git/[abs] - ABS (Arch Build System), scripts to download & use the Arch Linux PKGBUILD tree
|
||||
* link:https://projects.archlinux.org/dbscripts.git/[dbscripts] - scripts used by Arch Linux to manage the main package repositories
|
||||
* link:https://projects.archlinux.org/devtools.git/[devtools] - tools to assist in packaging and dependency checking
|
||||
* link:https://projects.archlinux.org/namcap.git/[namcap] - a package analysis utility written in python
|
||||
* link:https://projects.archlinux.org/srcpac.git/[srcpac] - a bash build-from-source pacman wrapper
|
||||
* link:https://git.archlinux.org/dbscripts.git/[dbscripts] - scripts used by Arch Linux to manage the main package repositories
|
||||
* link:https://git.archlinux.org/devtools.git/[devtools] - tools to assist in packaging and dependency checking
|
||||
* link:https://git.archlinux.org/namcap.git/[namcap] - a package analysis utility written in python
|
||||
|
||||
Bugs
|
||||
----
|
||||
|
||||
@@ -183,7 +183,7 @@ Options
|
||||
**INTEGRITY_CHECK=(**check1 ...**)**::
|
||||
File integrity checks to use. Multiple checks may be specified; this
|
||||
affects both generation and checking. The current valid options are:
|
||||
`md5`, `sha1`, `sha224`, `sha256`, `sha384`, and `sha512`.
|
||||
`md5`, `sha1`, `sha224`, `sha256`, `sha384`, `sha512`, and `b2`.
|
||||
|
||||
**STRIP_BINARIES=**"--strip-all"::
|
||||
Options to be used when stripping binaries. See linkman:strip[1]
|
||||
@@ -254,13 +254,14 @@ Options
|
||||
**COMPRESSLRZ=**"(lrzip -q)"::
|
||||
**COMPRESSLZ4=**"(lz4 -q)"::
|
||||
**COMPRESSZ=**"(compress -c -f)"::
|
||||
**COMPRESSLZ=**"(lzip -c -f)"::
|
||||
Sets the command and options used when compressing compiled or source
|
||||
packages in the named format.
|
||||
|
||||
**PKGEXT=**".pkg.tar.gz", **SRCEXT=**".src.tar.gz"::
|
||||
Sets the compression used when making compiled or source packages.
|
||||
Valid suffixes are `.tar`, `.tar.gz`, `.tar.bz2`, `.tar.xz`, `.tar.zst`,
|
||||
`.tar.lzo`, `.tar.lrz`, `.tar.lz4`, and `.tar.Z`.
|
||||
`.tar.lzo`, `.tar.lrz`, `.tar.lz4`, `.tar.lz` and `.tar.Z`.
|
||||
Do not touch these unless you know what you are doing.
|
||||
|
||||
|
||||
|
||||
@@ -12,6 +12,14 @@ manpages = [
|
||||
{ 'name': 'pacman.conf.5' },
|
||||
{ 'name': 'libalpm.3' },
|
||||
{ 'name': 'BUILDINFO.5' },
|
||||
{ 'name': 'pacman-conf.8' },
|
||||
]
|
||||
|
||||
sitepages = [
|
||||
{ 'name': 'submitting-patches' },
|
||||
{ 'name': 'translation-help' },
|
||||
{ 'name': 'HACKING', 'source': '../HACKING' },
|
||||
{ 'name': 'index' },
|
||||
]
|
||||
|
||||
asciidoc_conf = join_paths(meson.current_source_dir(), 'asciidoc.conf')
|
||||
@@ -24,6 +32,7 @@ asciidoc_opts = [
|
||||
'-a', 'localstatedir=@0@'.format(LOCALSTATEDIR),
|
||||
'-a', 'sysconfdir=@0@'.format(SYSCONFDIR),
|
||||
'-a', 'datarootdir=@0@'.format(DATAROOTDIR),
|
||||
'-a', 'rootdir=@0@'.format(ROOTDIR),
|
||||
]
|
||||
|
||||
html_targets = []
|
||||
@@ -58,6 +67,12 @@ foreach page : manpages
|
||||
install : true,
|
||||
install_dir : mandirn,
|
||||
)
|
||||
endforeach
|
||||
|
||||
foreach page: manpages + sitepages
|
||||
manpage = page['name']
|
||||
htmlpage = '@0@.html'.format(manpage)
|
||||
input = page.get('source', '@0@.asciidoc'.format(manpage))
|
||||
|
||||
html = custom_target(
|
||||
htmlpage,
|
||||
@@ -96,10 +111,6 @@ custom_target(
|
||||
'-C', meson.current_build_dir(),
|
||||
] + html_files + [
|
||||
'-C', meson.current_source_dir(),
|
||||
'submitting-patches.html',
|
||||
'translation-help.html',
|
||||
'HACKING.html',
|
||||
'index.html',
|
||||
'asciidoc-override.css',
|
||||
'-C', '/etc/asciidoc/stylesheets/',
|
||||
'asciidoc.css',
|
||||
|
||||
67
doc/pacman-conf.8.asciidoc
Normal file
67
doc/pacman-conf.8.asciidoc
Normal file
@@ -0,0 +1,67 @@
|
||||
pacman-conf(8)
|
||||
==============
|
||||
|
||||
Name
|
||||
----
|
||||
pacman-conf - query pacman's configuration file
|
||||
|
||||
|
||||
Synopsis
|
||||
--------
|
||||
'pacman-conf' [options] [<directive> ...]
|
||||
|
||||
'pacman-conf' (--repo-list|--help|--version)
|
||||
|
||||
|
||||
Description
|
||||
-----------
|
||||
'pacman-conf' is a utility for parsing the 'pacman' configuration file
|
||||
and returning script-friendly output. It is designed to properly handle
|
||||
non-trivial configuration features such as variable interpolation and
|
||||
the use of the Include directive, and guarantees that it will return the
|
||||
same configuration values which 'pacman' itself would use.
|
||||
|
||||
'pacman-conf' will output the fully-resolved contents of the
|
||||
configuration file by default, or, if provided with the name of a
|
||||
configuration directive, output the contents of the given directive alone.
|
||||
|
||||
|
||||
Options
|
||||
-------
|
||||
*-c, \--config* <path>::
|
||||
Specify an alternate configuration file.
|
||||
|
||||
*-R, \--rootdir* <path>::
|
||||
Specify an alternate installation root (default is `/`).
|
||||
|
||||
*-r, \--repo* <remote>::
|
||||
Query options for a specific repository.
|
||||
|
||||
*-v, \--verbose*::
|
||||
Always shown directive names.
|
||||
|
||||
*-l, \--repo-list*::
|
||||
List configured repositories.
|
||||
|
||||
*-h, \--help*::
|
||||
Output syntax and command line options.
|
||||
|
||||
*-V, \--version*::
|
||||
Display version and exit.
|
||||
|
||||
|
||||
Examples
|
||||
--------
|
||||
|
||||
pacman-conf -r core Usage::
|
||||
Show the value of the Usage configuration option for core repository.
|
||||
|
||||
pacman-conf HoldPkg::
|
||||
Show the value of the HoldPkg configuration option.
|
||||
|
||||
|
||||
See Also
|
||||
--------
|
||||
linkman:pacman.conf[5]
|
||||
|
||||
include::footer.asciidoc[]
|
||||
@@ -131,7 +131,7 @@ Options
|
||||
not automatically prepended.
|
||||
|
||||
*-r, \--root* <path>::
|
||||
Specify an alternative installation root (default is `/`). This should
|
||||
Specify an alternative installation root (default is +{rootdir}+). This should
|
||||
not be used as a way to install software into `/usr/local` instead of
|
||||
`/usr`.
|
||||
*NOTE*: If database path or log file are not specified on either the
|
||||
@@ -514,7 +514,7 @@ designated to be backed up. During an upgrade, three MD5 hashes are used for
|
||||
each backup file to determine the required action: one for the original file
|
||||
installed, one for the new file that is about to be installed, and one for the
|
||||
actual file existing on the file system. After comparing these three hashes, the
|
||||
follow scenarios can result:
|
||||
following scenarios can result:
|
||||
|
||||
original=X, current=X, new=X::
|
||||
All three files are the same, so overwrites are not an issue. Install the
|
||||
|
||||
@@ -20,7 +20,7 @@ started with GIT if you have not worked with it before.
|
||||
|
||||
The pacman code can be fetched using the following command:
|
||||
|
||||
git clone git://projects.archlinux.org/pacman.git
|
||||
git clone git://git.archlinux.org/pacman.git
|
||||
|
||||
|
||||
Creating your patch
|
||||
|
||||
@@ -4,10 +4,10 @@ Pacman - Translating
|
||||
This document is here to guide you in helping translate pacman messages,
|
||||
libalpm messages, and the manual pages for the entire pacman package.
|
||||
|
||||
We are currently using http://www.transifex.com/[Transifex] as the translation
|
||||
We are currently using https://www.transifex.com/[Transifex] as the translation
|
||||
platform for pacman and libalpm. You will need to sign up for an account there
|
||||
and then register with a translation team on the
|
||||
http://www.transifex.com/projects/p/archlinux-pacman/[pacman project page].
|
||||
https://www.transifex.com/projects/p/archlinux-pacman/[pacman project page].
|
||||
|
||||
NOTE: This may be old information due to our switch to Transifex, but the
|
||||
gettext website is a very useful guide to read before embarking on translation
|
||||
@@ -31,7 +31,7 @@ either be hand-edited, or modified with a tool such as poedit, gtranslator or
|
||||
kbabel. Using a translation tool tends to make the job easier.
|
||||
|
||||
Please read up on Transifex usage using the
|
||||
http://docs.transifex.com/[Transifex Help] if you are not familiar.
|
||||
https://docs.transifex.com/[Transifex Help] if you are not familiar.
|
||||
|
||||
Transifex provides a command-line client to help with translations. Here is
|
||||
an example set of commands if you have a source code checkout and are not
|
||||
@@ -78,7 +78,7 @@ Incremental Updates
|
||||
If you have more advanced needs you will have to get a copy of the pacman
|
||||
repository.
|
||||
|
||||
git clone git://projects.archlinux.org/pacman.git pacman
|
||||
git clone git://git.archlinux.org/pacman.git pacman
|
||||
|
||||
Next, you will need to run `./autogen.sh` and `./configure` in the base
|
||||
directory to generate the correct Makefiles. At this point, all necessary
|
||||
|
||||
@@ -87,7 +87,7 @@ BUILDENV=(!distcc color !ccache check !sign)
|
||||
#
|
||||
OPTIONS=(strip docs libtool staticlibs emptydirs zipman purge !debug)
|
||||
|
||||
#-- File integrity checks to use. Valid: md5, sha1, sha224, sha256, sha384, sha512
|
||||
#-- File integrity checks to use. Valid: md5, sha1, sha224, sha256, sha384, sha512, b2
|
||||
INTEGRITY_CHECK=(md5)
|
||||
#-- Options to be used when stripping binaries. See `man strip' for details.
|
||||
STRIP_BINARIES="@STRIP_BINARIES@"
|
||||
@@ -135,6 +135,7 @@ COMPRESSLRZ=(lrzip -q)
|
||||
COMPRESSLZO=(lzop -q)
|
||||
COMPRESSZ=(compress -c -f)
|
||||
COMPRESSLZ4=(lz4 -q)
|
||||
COMPRESSLZ=(lzip -c -f)
|
||||
|
||||
#########################################################################
|
||||
# EXTENSION DEFAULTS
|
||||
|
||||
@@ -53,6 +53,7 @@ int SYMEXPORT alpm_add_pkg(alpm_handle_t *handle, alpm_pkg_t *pkg)
|
||||
const char *pkgname, *pkgver;
|
||||
alpm_trans_t *trans;
|
||||
alpm_pkg_t *local;
|
||||
alpm_pkg_t *dup;
|
||||
|
||||
/* Sanity checks */
|
||||
CHECK_HANDLE(handle, return -1);
|
||||
@@ -70,12 +71,16 @@ int SYMEXPORT alpm_add_pkg(alpm_handle_t *handle, alpm_pkg_t *pkg)
|
||||
|
||||
_alpm_log(handle, ALPM_LOG_DEBUG, "adding package '%s'\n", pkgname);
|
||||
|
||||
if(alpm_pkg_find(trans->add, pkgname)) {
|
||||
if((dup = alpm_pkg_find(trans->add, pkgname))) {
|
||||
if(dup == pkg) {
|
||||
_alpm_log(handle, ALPM_LOG_DEBUG, "skipping duplicate target: %s\n", pkgname);
|
||||
return 0;
|
||||
}
|
||||
/* error for separate packages with the same name */
|
||||
RET_ERR(handle, ALPM_ERR_TRANS_DUP_TARGET, -1);
|
||||
}
|
||||
|
||||
local = _alpm_db_get_pkgfromcache(handle->db_local, pkgname);
|
||||
if(local) {
|
||||
if((local = _alpm_db_get_pkgfromcache(handle->db_local, pkgname))) {
|
||||
const char *localpkgname = local->name;
|
||||
const char *localpkgver = local->version;
|
||||
int cmp = _alpm_pkg_compare_versions(pkg, local);
|
||||
|
||||
@@ -1046,7 +1046,7 @@ alpm_list_t *alpm_db_get_groupcache(alpm_db_t *db);
|
||||
*/
|
||||
alpm_list_t *alpm_db_search(alpm_db_t *db, const alpm_list_t *needles);
|
||||
|
||||
typedef enum _alpm_db_usage_ {
|
||||
typedef enum _alpm_db_usage_t {
|
||||
ALPM_DB_USAGE_SYNC = 1,
|
||||
ALPM_DB_USAGE_SEARCH = (1 << 1),
|
||||
ALPM_DB_USAGE_INSTALL = (1 << 2),
|
||||
@@ -1452,7 +1452,7 @@ alpm_list_t *alpm_find_group_pkgs(alpm_list_t *dbs, const char *name);
|
||||
* Sync
|
||||
*/
|
||||
|
||||
alpm_pkg_t *alpm_sync_newversion(alpm_pkg_t *pkg, alpm_list_t *dbs_sync);
|
||||
alpm_pkg_t *alpm_sync_get_new_version(alpm_pkg_t *pkg, alpm_list_t *dbs_sync);
|
||||
|
||||
/** @addtogroup alpm_api_trans Transaction Functions
|
||||
* Functions to manipulate libalpm transactions
|
||||
|
||||
@@ -153,6 +153,18 @@ static alpm_list_t *_cache_get_optdepends(alpm_pkg_t *pkg)
|
||||
return pkg->optdepends;
|
||||
}
|
||||
|
||||
static alpm_list_t *_cache_get_makedepends(alpm_pkg_t *pkg)
|
||||
{
|
||||
LAZY_LOAD(INFRQ_DESC);
|
||||
return pkg->makedepends;
|
||||
}
|
||||
|
||||
static alpm_list_t *_cache_get_checkdepends(alpm_pkg_t *pkg)
|
||||
{
|
||||
LAZY_LOAD(INFRQ_DESC);
|
||||
return pkg->checkdepends;
|
||||
}
|
||||
|
||||
static alpm_list_t *_cache_get_conflicts(alpm_pkg_t *pkg)
|
||||
{
|
||||
LAZY_LOAD(INFRQ_DESC);
|
||||
@@ -303,36 +315,38 @@ static int _cache_force_load(alpm_pkg_t *pkg)
|
||||
* logic.
|
||||
*/
|
||||
static struct pkg_operations local_pkg_ops = {
|
||||
.get_base = _cache_get_base,
|
||||
.get_desc = _cache_get_desc,
|
||||
.get_url = _cache_get_url,
|
||||
.get_builddate = _cache_get_builddate,
|
||||
.get_base = _cache_get_base,
|
||||
.get_desc = _cache_get_desc,
|
||||
.get_url = _cache_get_url,
|
||||
.get_builddate = _cache_get_builddate,
|
||||
.get_installdate = _cache_get_installdate,
|
||||
.get_packager = _cache_get_packager,
|
||||
.get_arch = _cache_get_arch,
|
||||
.get_isize = _cache_get_isize,
|
||||
.get_reason = _cache_get_reason,
|
||||
.get_validation = _cache_get_validation,
|
||||
.has_scriptlet = _cache_has_scriptlet,
|
||||
.get_licenses = _cache_get_licenses,
|
||||
.get_groups = _cache_get_groups,
|
||||
.get_depends = _cache_get_depends,
|
||||
.get_optdepends = _cache_get_optdepends,
|
||||
.get_conflicts = _cache_get_conflicts,
|
||||
.get_provides = _cache_get_provides,
|
||||
.get_replaces = _cache_get_replaces,
|
||||
.get_files = _cache_get_files,
|
||||
.get_backup = _cache_get_backup,
|
||||
.get_packager = _cache_get_packager,
|
||||
.get_arch = _cache_get_arch,
|
||||
.get_isize = _cache_get_isize,
|
||||
.get_reason = _cache_get_reason,
|
||||
.get_validation = _cache_get_validation,
|
||||
.has_scriptlet = _cache_has_scriptlet,
|
||||
.get_licenses = _cache_get_licenses,
|
||||
.get_groups = _cache_get_groups,
|
||||
.get_depends = _cache_get_depends,
|
||||
.get_optdepends = _cache_get_optdepends,
|
||||
.get_makedepends = _cache_get_makedepends,
|
||||
.get_checkdepends = _cache_get_checkdepends,
|
||||
.get_conflicts = _cache_get_conflicts,
|
||||
.get_provides = _cache_get_provides,
|
||||
.get_replaces = _cache_get_replaces,
|
||||
.get_files = _cache_get_files,
|
||||
.get_backup = _cache_get_backup,
|
||||
|
||||
.changelog_open = _cache_changelog_open,
|
||||
.changelog_read = _cache_changelog_read,
|
||||
.changelog_open = _cache_changelog_open,
|
||||
.changelog_read = _cache_changelog_read,
|
||||
.changelog_close = _cache_changelog_close,
|
||||
|
||||
.mtree_open = _cache_mtree_open,
|
||||
.mtree_next = _cache_mtree_next,
|
||||
.mtree_close = _cache_mtree_close,
|
||||
.mtree_open = _cache_mtree_open,
|
||||
.mtree_next = _cache_mtree_next,
|
||||
.mtree_close = _cache_mtree_close,
|
||||
|
||||
.force_load = _cache_force_load,
|
||||
.force_load = _cache_force_load,
|
||||
};
|
||||
|
||||
static int checkdbdir(alpm_db_t *db)
|
||||
@@ -773,6 +787,10 @@ static int local_db_read(alpm_pkg_t *info, int inforeq)
|
||||
READ_AND_SPLITDEP(info->depends);
|
||||
} else if(strcmp(line, "%OPTDEPENDS%") == 0) {
|
||||
READ_AND_SPLITDEP(info->optdepends);
|
||||
} else if(strcmp(line, "%MAKEDEPENDS%") == 0) {
|
||||
READ_AND_SPLITDEP(info->makedepends);
|
||||
} else if(strcmp(line, "%CHECKDEPENDS%") == 0) {
|
||||
READ_AND_SPLITDEP(info->checkdepends);
|
||||
} else if(strcmp(line, "%CONFLICTS%") == 0) {
|
||||
READ_AND_SPLITDEP(info->conflicts);
|
||||
} else if(strcmp(line, "%PROVIDES%") == 0) {
|
||||
|
||||
@@ -700,17 +700,9 @@ static int sync_db_read(alpm_db_t *db, struct archive *archive,
|
||||
} else if(strcmp(line, "%OPTDEPENDS%") == 0) {
|
||||
READ_AND_SPLITDEP(pkg->optdepends);
|
||||
} else if(strcmp(line, "%MAKEDEPENDS%") == 0) {
|
||||
/* currently unused */
|
||||
while(1) {
|
||||
READ_NEXT();
|
||||
if(strlen(line) == 0) break;
|
||||
}
|
||||
READ_AND_SPLITDEP(pkg->makedepends);
|
||||
} else if(strcmp(line, "%CHECKDEPENDS%") == 0) {
|
||||
/* currently unused */
|
||||
while(1) {
|
||||
READ_NEXT();
|
||||
if(strlen(line) == 0) break;
|
||||
}
|
||||
READ_AND_SPLITDEP(pkg->checkdepends);
|
||||
} else if(strcmp(line, "%CONFLICTS%") == 0) {
|
||||
READ_AND_SPLITDEP(pkg->conflicts);
|
||||
} else if(strcmp(line, "%PROVIDES%") == 0) {
|
||||
|
||||
@@ -259,6 +259,7 @@ static void curl_set_handle_opts(struct dload_payload *payload,
|
||||
curl_easy_setopt(curl, CURLOPT_URL, payload->fileurl);
|
||||
curl_easy_setopt(curl, CURLOPT_ERRORBUFFER, error_buffer);
|
||||
curl_easy_setopt(curl, CURLOPT_CONNECTTIMEOUT, 10L);
|
||||
curl_easy_setopt(curl, CURLOPT_MAXREDIRS, 10L);
|
||||
curl_easy_setopt(curl, CURLOPT_FILETIME, 1L);
|
||||
curl_easy_setopt(curl, CURLOPT_NOPROGRESS, 0L);
|
||||
curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1L);
|
||||
@@ -534,7 +535,8 @@ static int curl_download_internal(struct dload_payload *payload,
|
||||
if(payload->content_disp_name) {
|
||||
/* content-disposition header has a better name for our file */
|
||||
free(payload->destfile_name);
|
||||
payload->destfile_name = get_fullpath(localpath, payload->content_disp_name, "");
|
||||
payload->destfile_name = get_fullpath(localpath,
|
||||
get_filename(payload->content_disp_name), "");
|
||||
} else {
|
||||
const char *effective_filename = strrchr(effective_url, '/');
|
||||
if(effective_filename && strlen(effective_filename) > 2) {
|
||||
|
||||
@@ -876,6 +876,8 @@ int SYMEXPORT alpm_option_set_disable_dl_timeout(alpm_handle_t *handle,
|
||||
CHECK_HANDLE(handle, return -1);
|
||||
#ifdef HAVE_LIBCURL
|
||||
handle->disable_dl_timeout = disable_dl_timeout;
|
||||
#else
|
||||
(void)disable_dl_timeout; /* silence unused variable warnings */
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -38,7 +38,7 @@
|
||||
/** Package operations struct. This struct contains function pointers to
|
||||
* all methods used to access data in a package to allow for things such
|
||||
* as lazy package initialization (such as used by the file backend). Each
|
||||
* backend is free to define a stuct containing pointers to a specific
|
||||
* backend is free to define a struct containing pointers to a specific
|
||||
* implementation of these methods. Some backends may find using the
|
||||
* defined default_pkg_ops struct to work just fine for their needs.
|
||||
*/
|
||||
|
||||
@@ -74,7 +74,8 @@ int SYMEXPORT alpm_remove_pkg(alpm_handle_t *handle, alpm_pkg_t *pkg)
|
||||
pkgname = pkg->name;
|
||||
|
||||
if(alpm_pkg_find(trans->remove, pkgname)) {
|
||||
RET_ERR(handle, ALPM_ERR_TRANS_DUP_TARGET, -1);
|
||||
_alpm_log(handle, ALPM_LOG_DEBUG, "skipping duplicate target: %s\n", pkgname);
|
||||
return 0;
|
||||
}
|
||||
|
||||
_alpm_log(handle, ALPM_LOG_DEBUG, "adding package %s to the transaction remove list\n",
|
||||
|
||||
@@ -182,7 +182,7 @@ static int init_gpgme(alpm_handle_t *handle)
|
||||
#endif
|
||||
/* NOTE:
|
||||
* The GPGME library installs a SIGPIPE signal handler automatically if
|
||||
* the default signal hander is in use. The only time we set a handler
|
||||
* the default signal handler is in use. The only time we set a handler
|
||||
* for SIGPIPE is in dload.c, and we reset it when we are done. Given that
|
||||
* we do this, we can let GPGME do its automagic. However, if we install
|
||||
* a library-wide SIGPIPE handler, we will have to be careful.
|
||||
|
||||
@@ -51,7 +51,7 @@
|
||||
/** Check for new version of pkg in sync repos
|
||||
* (only the first occurrence is considered in sync)
|
||||
*/
|
||||
alpm_pkg_t SYMEXPORT *alpm_sync_newversion(alpm_pkg_t *pkg, alpm_list_t *dbs_sync)
|
||||
alpm_pkg_t SYMEXPORT *alpm_sync_get_new_version(alpm_pkg_t *pkg, alpm_list_t *dbs_sync)
|
||||
{
|
||||
alpm_list_t *i;
|
||||
alpm_pkg_t *spkg = NULL;
|
||||
@@ -61,10 +61,6 @@ alpm_pkg_t SYMEXPORT *alpm_sync_newversion(alpm_pkg_t *pkg, alpm_list_t *dbs_syn
|
||||
|
||||
for(i = dbs_sync; !spkg && i; i = i->next) {
|
||||
alpm_db_t *db = i->data;
|
||||
if(!(db->usage & ALPM_DB_USAGE_SEARCH)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
spkg = _alpm_db_get_pkgfromcache(db, pkg->name);
|
||||
}
|
||||
|
||||
|
||||
@@ -38,6 +38,25 @@ AC_DEFUN([GCC_STACK_PROTECT_CC],[
|
||||
fi
|
||||
])
|
||||
|
||||
dnl GCC_STACK_CLASH_PROTECTION
|
||||
dnl check -fstack-clash-protection with the C compiler, if it exists then
|
||||
dnl updates CFLAGS
|
||||
AC_DEFUN([GCC_STACK_CLASH_PROTECTION],[
|
||||
AC_LANG_ASSERT(C)
|
||||
if test "X$CC" != "X"; then
|
||||
AC_CACHE_CHECK([whether ${CC} accepts -fstack-clash-protection],
|
||||
scp_cv_cc,
|
||||
[scp_old_cflags="$CFLAGS"
|
||||
CFLAGS="$CFLAGS -fstack-clash-protection"
|
||||
AC_TRY_COMPILE(,, scp_cv_cc=yes, scp_cv_cc=no)
|
||||
CFLAGS="$scp_old_cflags"
|
||||
])
|
||||
if test $scp_cv_cc = yes; then
|
||||
CFLAGS="$CFLAGS -fstack-clash-protection"
|
||||
fi
|
||||
fi
|
||||
])
|
||||
|
||||
dnl GCC_FORTIFY_SOURCE_CC
|
||||
dnl checks -D_FORTIFY_SOURCE with the C compiler, if it exists then updates
|
||||
dnl CPPFLAGS
|
||||
|
||||
16
meson.build
16
meson.build
@@ -220,6 +220,7 @@ if get_option('buildtype').startswith('debug')
|
||||
'-Wformat-nonliteral',
|
||||
'-Wformat-security',
|
||||
'-Wignored-qualifiers',
|
||||
'-Wimplicit-fallthrough',
|
||||
'-Winit-self',
|
||||
'-Wlogical-op',
|
||||
'-Wmissing-declarations',
|
||||
@@ -354,15 +355,24 @@ libcommon = static_library(
|
||||
include_directories : includes,
|
||||
install : false)
|
||||
|
||||
libalpm = library(
|
||||
libalpm_a = static_library(
|
||||
'alpm',
|
||||
libalpm_sources,
|
||||
version : libalpm_version,
|
||||
include_directories : includes,
|
||||
dependencies : [crypto_provider, libarchive, libcurl] + gpgme_libs,
|
||||
link_with : [libcommon],
|
||||
install : true)
|
||||
|
||||
if get_option('default_library') != 'static'
|
||||
libalpm = library(
|
||||
'alpm',
|
||||
version : libalpm_version,
|
||||
link_whole: [libalpm_a],
|
||||
install : true)
|
||||
else
|
||||
libalpm = libalpm_a
|
||||
endif
|
||||
|
||||
install_headers(
|
||||
'lib/libalpm/alpm.h',
|
||||
'lib/libalpm/alpm_list.h')
|
||||
@@ -413,7 +423,7 @@ executable(
|
||||
'vercmp',
|
||||
vercmp_sources,
|
||||
include_directories : includes,
|
||||
link_with : [libalpm],
|
||||
link_with : [libalpm_a],
|
||||
install : true,
|
||||
)
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
option('use-git-version', type : 'boolean', value : false,
|
||||
description : 'take version information from git')
|
||||
option('buildstatic', type : 'boolean', value : false,
|
||||
description : 'if true, build staticly linked binaries')
|
||||
description : 'if true, build statically linked binaries')
|
||||
|
||||
# directories and filenames
|
||||
option('root-dir', type : 'string', value : '/',
|
||||
|
||||
@@ -71,6 +71,7 @@ LIBMAKEPKG_IN = \
|
||||
libmakepkg/integrity/verify_signature.sh \
|
||||
libmakepkg/lint_config.sh \
|
||||
libmakepkg/lint_config/paths.sh \
|
||||
libmakepkg/lint_config/source_date_epoch.sh \
|
||||
libmakepkg/lint_config/variable.sh \
|
||||
libmakepkg/lint_package.sh \
|
||||
libmakepkg/lint_package/build_references.sh \
|
||||
@@ -79,17 +80,20 @@ LIBMAKEPKG_IN = \
|
||||
libmakepkg/lint_package/missing_backup.sh \
|
||||
libmakepkg/lint_pkgbuild.sh \
|
||||
libmakepkg/lint_pkgbuild/arch.sh \
|
||||
libmakepkg/lint_pkgbuild/arch_specific.sh \
|
||||
libmakepkg/lint_pkgbuild/backup.sh \
|
||||
libmakepkg/lint_pkgbuild/changelog.sh \
|
||||
libmakepkg/lint_pkgbuild/checkdepends.sh \
|
||||
libmakepkg/lint_pkgbuild/conflicts.sh \
|
||||
libmakepkg/lint_pkgbuild/depends.sh \
|
||||
libmakepkg/lint_pkgbuild/epoch.sh \
|
||||
libmakepkg/lint_pkgbuild/fullpkgver.sh \
|
||||
libmakepkg/lint_pkgbuild/install.sh \
|
||||
libmakepkg/lint_pkgbuild/makedepends.sh \
|
||||
libmakepkg/lint_pkgbuild/optdepends.sh \
|
||||
libmakepkg/lint_pkgbuild/options.sh \
|
||||
libmakepkg/lint_pkgbuild/package_function.sh \
|
||||
libmakepkg/lint_pkgbuild/package_function_variable.sh \
|
||||
libmakepkg/lint_pkgbuild/pkgbase.sh \
|
||||
libmakepkg/lint_pkgbuild/pkglist.sh \
|
||||
libmakepkg/lint_pkgbuild/pkgname.sh \
|
||||
@@ -122,6 +126,7 @@ LIBMAKEPKG_IN = \
|
||||
libmakepkg/util/option.sh \
|
||||
libmakepkg/util/parseopts.sh \
|
||||
libmakepkg/util/pkgbuild.sh \
|
||||
libmakepkg/util/schema.sh \
|
||||
libmakepkg/util/source.sh \
|
||||
libmakepkg/util/util.sh
|
||||
|
||||
|
||||
@@ -29,7 +29,7 @@ executable_functions+=('executable_checksum')
|
||||
executable_checksum() {
|
||||
if (( GENINTEG || ! SKIPCHECKSUMS )); then
|
||||
local integlist
|
||||
IFS=$'\n' read -rd '' -a integlist < <(get_integlist)
|
||||
mapfile -t integlist < <(get_integlist)
|
||||
|
||||
local integ
|
||||
for integ in "${integlist[@]}"; do
|
||||
|
||||
@@ -28,7 +28,7 @@ source "$LIBRARY/util/option.sh"
|
||||
executable_functions+=('executable_fakeroot')
|
||||
|
||||
executable_fakeroot() {
|
||||
if check_buildenv "fakeroot" "y" && (( EUID > 0 )); then
|
||||
if (( SOURCEONLY || BUILDPKG )); then
|
||||
if ! type -p fakeroot >/dev/null; then
|
||||
error "$(gettext "Cannot find the %s binary.")" "fakeroot"
|
||||
return 1
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#!/usr/bin/bash
|
||||
#
|
||||
# strip.sh - Confirm presense of strip binary
|
||||
# strip.sh - Confirm presence of strip binary
|
||||
#
|
||||
# Copyright (c) 2011-2018 Pacman Development Team <pacman-dev@archlinux.org>
|
||||
#
|
||||
|
||||
@@ -25,6 +25,7 @@ LIBRARY=${LIBRARY:-'@libmakepkgdir@'}
|
||||
|
||||
source "$LIBRARY/util/message.sh"
|
||||
source "$LIBRARY/util/pkgbuild.sh"
|
||||
source "$LIBRARY/util/schema.sh"
|
||||
|
||||
generate_one_checksum() {
|
||||
local integ=$1 arch=$2 sources numsrc indentsz idx
|
||||
@@ -52,7 +53,7 @@ generate_one_checksum() {
|
||||
proto="$(get_protocol "$netfile")"
|
||||
|
||||
case $proto in
|
||||
bzr*|git*|hg*|svn*)
|
||||
bzr|git|hg|svn)
|
||||
sum="SKIP"
|
||||
;;
|
||||
*)
|
||||
|
||||
@@ -25,6 +25,7 @@ LIBRARY=${LIBRARY:-'@libmakepkgdir@'}
|
||||
|
||||
source "$LIBRARY/util/message.sh"
|
||||
source "$LIBRARY/util/pkgbuild.sh"
|
||||
source "$LIBRARY/util/schema.sh"
|
||||
|
||||
check_checksums() {
|
||||
local integ a
|
||||
|
||||
@@ -49,8 +49,8 @@ check_pgpsigs() {
|
||||
for netfile in "${all_sources[@]}"; do
|
||||
proto="$(get_protocol "$netfile")"
|
||||
|
||||
if [[ $proto = git* ]]; then
|
||||
verify_git_signature "$netfile" "$statusfile" || continue
|
||||
if declare -f verify_${proto}_signature > /dev/null; then
|
||||
verify_${proto}_signature "$netfile" "$statusfile" || continue
|
||||
else
|
||||
verify_file_signature "$netfile" "$statusfile" || continue
|
||||
fi
|
||||
@@ -263,7 +263,8 @@ source_has_signatures() {
|
||||
proto="$(get_protocol "$netfile")"
|
||||
query=$(get_uri_query "$netfile")
|
||||
|
||||
if [[ ${netfile%%::*} = *.@(sig?(n)|asc) || ( $proto = git* && $query = signed ) ]]; then
|
||||
if [[ ${netfile%%::*} = *.@(sig?(n)|asc) ]] || \
|
||||
( declare -f verify_${proto}_signature > /dev/null && [[ $query = signed ]] ); then
|
||||
return 0
|
||||
fi
|
||||
done
|
||||
|
||||
@@ -2,6 +2,7 @@ libmakepkg_module = 'lint_config'
|
||||
|
||||
sources = [
|
||||
'paths.sh.in',
|
||||
'source_date_epoch.sh.in',
|
||||
'variable.sh.in',
|
||||
]
|
||||
|
||||
|
||||
37
scripts/libmakepkg/lint_config/source_date_epoch.sh.in
Executable file
37
scripts/libmakepkg/lint_config/source_date_epoch.sh.in
Executable file
@@ -0,0 +1,37 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# source_date_epoch.sh - Check that reproducible builds timestamp is valid
|
||||
#
|
||||
# Copyright (c) 2018 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/>.
|
||||
#
|
||||
|
||||
[[ -n $LIBMAKEPKG_LINT_CONFIG_SOURCE_DATE_EPOCH_SH ]] && return
|
||||
LIBMAKEPKG_LINT_CONFIG_SOURCE_DATE_EPOCH_SH=1
|
||||
|
||||
LIBRARY=${LIBRARY:-'@libmakepkgdir@'}
|
||||
|
||||
source "$LIBRARY/util/message.sh"
|
||||
|
||||
lint_config_functions+=('lint_source_date_epoch')
|
||||
|
||||
|
||||
lint_source_date_epoch() {
|
||||
if [[ $SOURCE_DATE_EPOCH = *[^[:digit:]]* ]]; then
|
||||
error "$(gettext "%s contains invalid characters: %s")" \
|
||||
"\$SOURCE_DATE_EPOCH" "${SOURCE_DATE_EPOCH//[[:digit:]]}"
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
@@ -33,8 +33,13 @@ lint_pkgbuild_functions+=('lint_arch')
|
||||
lint_arch() {
|
||||
local a name list ret=0
|
||||
|
||||
if [[ $arch == 'any' ]]; then
|
||||
return 0
|
||||
if in_array "any" "${arch[@]}"; then
|
||||
if (( ${#arch[@]} == 1 )); then
|
||||
return 0;
|
||||
else
|
||||
error "$(gettext "Can not use '%s' architecture with other architectures")" "any"
|
||||
return 1;
|
||||
fi
|
||||
fi
|
||||
|
||||
for a in "${arch[@]}"; do
|
||||
|
||||
82
scripts/libmakepkg/lint_pkgbuild/arch_specific.sh.in
Normal file
82
scripts/libmakepkg/lint_pkgbuild/arch_specific.sh.in
Normal file
@@ -0,0 +1,82 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# arch_specific.sh - Check that arch specific variables can be arch specific.
|
||||
#
|
||||
# Copyright (c) 2014-2018 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/>.
|
||||
#
|
||||
|
||||
[[ -n "$LIBMAKEPKG_LINT_PKGBUILD_ARCH_SPECIFIC_SH" ]] && return
|
||||
LIBMAKEPKG_LINT_PKGBUILD_ARCH_SPECIFIC_SH=1
|
||||
|
||||
LIBRARY=${LIBRARY:-'@libmakepkgdir@'}
|
||||
|
||||
source "$LIBRARY/util/message.sh"
|
||||
source "$LIBRARY/util/pkgbuild.sh"
|
||||
source "$LIBRARY/util/schema.sh"
|
||||
source "$LIBRARY/util/util.sh"
|
||||
|
||||
|
||||
lint_pkgbuild_functions+=('lint_arch_specific')
|
||||
|
||||
|
||||
lint_arch_specific() {
|
||||
local i a pkg ret=0
|
||||
|
||||
# global variables
|
||||
for a in ${arch[@]}; do
|
||||
if [[ $a == "any" ]]; then
|
||||
for i in ${pkgbuild_schema_arch_arrays[@]}; do
|
||||
if declare -p "${i}_${a}" > /dev/null 2>&1; then
|
||||
error "$(gettext "Can not provide architecture specific variables for the '%s' architecture: %s")" "any" "${i}_${a}"
|
||||
ret=1
|
||||
fi
|
||||
done
|
||||
fi
|
||||
|
||||
for i in ${pkgbuild_schema_arrays[@]} ${pkgbuild_schema_strings[@]}; do
|
||||
in_array "$i" ${pkgbuild_schema_arch_arrays[@]} && continue
|
||||
v="${i}_${a}"
|
||||
if declare -p "$v" > /dev/null 2>&1; then
|
||||
error "$(gettext "%s can not be architecture specific: %s")" "$i" "${i}_${a}"
|
||||
ret=1
|
||||
fi
|
||||
done
|
||||
done
|
||||
|
||||
# package function variables
|
||||
for pkg in ${pkgname[@]}; do
|
||||
for a in ${arch[@]}; do
|
||||
if [[ $a == "any" ]]; then
|
||||
for i in ${pkgbuild_schema_arch_arrays[@]}; do
|
||||
if exists_function_variable "package_$pkg" "${i}_${a}"; then
|
||||
error "$(gettext "Can not provide architecture specific variables for the '%s' architecture: %s")" "any" "${i}_${a}"
|
||||
ret=1
|
||||
fi
|
||||
done
|
||||
fi
|
||||
|
||||
for i in ${pkgbuild_schema_arrays[@]} ${pkgbuild_schema_strings[@]}; do
|
||||
in_array "$i" ${pkgbuild_schema_arch_arrays[@]} && continue
|
||||
if exists_function_variable "package_$pkg" "${i}_${a}"; then
|
||||
error "$(gettext "%s can not be architecture specific: %s")" "$i" "${i}_${a}"
|
||||
ret=1
|
||||
fi
|
||||
done
|
||||
done
|
||||
done
|
||||
|
||||
return $ret
|
||||
}
|
||||
@@ -23,8 +23,8 @@ LIBMAKEPKG_LINT_PKGBUILD_CHECKDEPENDS_SH=1
|
||||
|
||||
LIBRARY=${LIBRARY:-'@libmakepkgdir@'}
|
||||
|
||||
source "$LIBRARY/lint_pkgbuild/fullpkgver.sh"
|
||||
source "$LIBRARY/lint_pkgbuild/pkgname.sh"
|
||||
source "$LIBRARY/lint_pkgbuild/pkgver.sh"
|
||||
source "$LIBRARY/util/message.sh"
|
||||
source "$LIBRARY/util/pkgbuild.sh"
|
||||
|
||||
@@ -43,12 +43,10 @@ lint_checkdepends() {
|
||||
|
||||
for checkdepend in "${checkdepends_list[@]}"; do
|
||||
name=${checkdepend%%@(<|>|=|>=|<=)*}
|
||||
# remove optional epoch in version specifier
|
||||
ver=${checkdepend##$name@(<|>|=|>=|<=)?(+([0-9]):)}
|
||||
lint_one_pkgname checkdepends "$name" || ret=1
|
||||
if [[ $ver != $checkdepend ]]; then
|
||||
# remove optional pkgrel in version specifier
|
||||
check_pkgver "${ver%-+([0-9])?(.+([0-9]))}" checkdepends || ret=1
|
||||
if [[ $name != $checkdepend ]]; then
|
||||
ver=${checkdepend##$name@(<|>|=|>=|<=)}
|
||||
check_fullpkgver "$ver" checkdepends || ret=1
|
||||
fi
|
||||
done
|
||||
|
||||
|
||||
@@ -23,8 +23,8 @@ LIBMAKEPKG_LINT_PKGBUILD_CONFLICTS_SH=1
|
||||
|
||||
LIBRARY=${LIBRARY:-'@libmakepkgdir@'}
|
||||
|
||||
source "$LIBRARY/lint_pkgbuild/fullpkgver.sh"
|
||||
source "$LIBRARY/lint_pkgbuild/pkgname.sh"
|
||||
source "$LIBRARY/lint_pkgbuild/pkgver.sh"
|
||||
source "$LIBRARY/util/message.sh"
|
||||
source "$LIBRARY/util/pkgbuild.sh"
|
||||
|
||||
@@ -43,12 +43,10 @@ lint_conflicts() {
|
||||
|
||||
for conflict in "${conflicts_list[@]}"; do
|
||||
name=${conflict%%@(<|>|=|>=|<=)*}
|
||||
# remove optional epoch in version specifier
|
||||
ver=${conflict##$name@(<|>|=|>=|<=)?(+([0-9]):)}
|
||||
lint_one_pkgname conflicts "$name" || ret=1
|
||||
if [[ $ver != $conflict ]]; then
|
||||
# remove optional pkgrel in version specifier
|
||||
check_pkgver "${ver%-+([0-9])?(.+([0-9]))}" conflicts || ret=1
|
||||
if [[ $name != $conflict ]]; then
|
||||
ver=${conflict##$name@(<|>|=|>=|<=)}
|
||||
check_fullpkgver "$ver" conflicts || ret=1
|
||||
fi
|
||||
done
|
||||
|
||||
|
||||
@@ -23,8 +23,8 @@ LIBMAKEPKG_LINT_PKGBUILD_DEPENDS_SH=1
|
||||
|
||||
LIBRARY=${LIBRARY:-'@libmakepkgdir@'}
|
||||
|
||||
source "$LIBRARY/lint_pkgbuild/fullpkgver.sh"
|
||||
source "$LIBRARY/lint_pkgbuild/pkgname.sh"
|
||||
source "$LIBRARY/lint_pkgbuild/pkgver.sh"
|
||||
source "$LIBRARY/util/message.sh"
|
||||
source "$LIBRARY/util/pkgbuild.sh"
|
||||
|
||||
@@ -43,13 +43,13 @@ lint_depends() {
|
||||
|
||||
for depend in "${depends_list[@]}"; do
|
||||
name=${depend%%@(<|>|=|>=|<=)*}
|
||||
# remove optional epoch in version specifier
|
||||
ver=${depend##$name@(<|>|=|>=|<=)?(+([0-9]):)}
|
||||
lint_one_pkgname depends "$name" || ret=1
|
||||
# Don't validate empty version because of https://bugs.archlinux.org/task/58776
|
||||
if [[ $ver != $depend && -n $ver ]]; then
|
||||
# remove optional pkgrel in version specifier
|
||||
check_pkgver "${ver%-+([0-9])?(.+([0-9]))}" depends || ret=1
|
||||
if [[ $name != $depend ]]; then
|
||||
ver=${depend##$name@(<|>|=|>=|<=)}
|
||||
# Don't validate empty version because of https://bugs.archlinux.org/task/58776
|
||||
if [[ -n $ver ]]; then
|
||||
check_fullpkgver "$ver" depends || ret=1
|
||||
fi
|
||||
fi
|
||||
done
|
||||
|
||||
|
||||
@@ -29,9 +29,15 @@ source "$LIBRARY/util/message.sh"
|
||||
lint_pkgbuild_functions+=('lint_epoch')
|
||||
|
||||
|
||||
lint_epoch() {
|
||||
check_epoch() {
|
||||
local epoch=$1 type=$2
|
||||
|
||||
if [[ $epoch != *([[:digit:]]) ]]; then
|
||||
error "$(gettext "%s must be an integer, not %s.")" "epoch" "$epoch"
|
||||
error "$(gettext "%s must be an integer, not %s.")" "epoch${type:+ in $type}" "$epoch"
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
lint_epoch() {
|
||||
check_epoch "$epoch"
|
||||
}
|
||||
|
||||
58
scripts/libmakepkg/lint_pkgbuild/fullpkgver.sh.in
Normal file
58
scripts/libmakepkg/lint_pkgbuild/fullpkgver.sh.in
Normal file
@@ -0,0 +1,58 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# fullpkgver.sh - Check whether a full version conforms to requirements.
|
||||
#
|
||||
# Copyright (c) 2018 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/>.
|
||||
#
|
||||
|
||||
[[ -n "$LIBMAKEPKG_LINT_PKGBUILD_FULLPKGVER_SH" ]] && return
|
||||
LIBMAKEPKG_LINT_PKGBUILD_FULLPKGVER_SH=1
|
||||
|
||||
LIBRARY=${LIBRARY:-'@libmakepkgdir@'}
|
||||
|
||||
source "$LIBRARY/lint_pkgbuild/epoch.sh"
|
||||
source "$LIBRARY/lint_pkgbuild/pkgrel.sh"
|
||||
source "$LIBRARY/lint_pkgbuild/pkgver.sh"
|
||||
|
||||
|
||||
check_fullpkgver() {
|
||||
local fullver=$1 type=$2
|
||||
local ret=0
|
||||
|
||||
# If there are multiple colons or multiple hyphens, there's a
|
||||
# question of how we split it--it's invalid either way, but it
|
||||
# will affect error messages. Let's mimic version.c:parseEVR().
|
||||
|
||||
if [[ $fullver = *:* ]]; then
|
||||
# split at the *first* colon
|
||||
check_epoch "${fullver%%:*}" "$type" || ret=1
|
||||
fullver=${fullver#*:}
|
||||
fi
|
||||
|
||||
# Since ver isn't allowed to be empty, don't let rel strip it
|
||||
# down to nothing. Given "-XXX", "pkgver isn't allowed to
|
||||
# contain hyphens" is more helpful than "pkgver isn't allowed
|
||||
# to be empty".
|
||||
if [[ $fullver = ?*-* ]]; then
|
||||
# split at the *last* hyphen
|
||||
check_pkgrel "${fullver##*-}" "$type" || ret=1
|
||||
fullver=${fullver%-*}
|
||||
fi
|
||||
|
||||
check_pkgver "$fullver" "$type" || ret=1
|
||||
|
||||
return $ret
|
||||
}
|
||||
@@ -23,8 +23,8 @@ LIBMAKEPKG_LINT_PKGBUILD_MAKEDEPENDS_SH=1
|
||||
|
||||
LIBRARY=${LIBRARY:-'@libmakepkgdir@'}
|
||||
|
||||
source "$LIBRARY/lint_pkgbuild/fullpkgver.sh"
|
||||
source "$LIBRARY/lint_pkgbuild/pkgname.sh"
|
||||
source "$LIBRARY/lint_pkgbuild/pkgver.sh"
|
||||
source "$LIBRARY/util/message.sh"
|
||||
source "$LIBRARY/util/pkgbuild.sh"
|
||||
|
||||
@@ -43,12 +43,10 @@ lint_makedepends() {
|
||||
|
||||
for makedepend in "${makedepends_list[@]}"; do
|
||||
name=${makedepend%%@(<|>|=|>=|<=)*}
|
||||
# remove optional epoch in version specifier
|
||||
ver=${makedepend##$name@(<|>|=|>=|<=)?(+([0-9]):)}
|
||||
lint_one_pkgname makedepends "$name" || ret=1
|
||||
if [[ $ver != $makedepend ]]; then
|
||||
# remove optional pkgrel in version specifier
|
||||
check_pkgver "${ver%-+([0-9])?(.+([0-9]))}" makedepends || ret=1
|
||||
if [[ $name != $makedepend ]]; then
|
||||
ver=${makedepend##$name@(<|>|=|>=|<=)}
|
||||
check_fullpkgver "$ver" makedepends || ret=1
|
||||
fi
|
||||
done
|
||||
|
||||
|
||||
@@ -2,17 +2,20 @@ libmakepkg_module = 'lint_pkgbuild'
|
||||
|
||||
sources = [
|
||||
'arch.sh.in',
|
||||
'arch_specific.sh.in',
|
||||
'backup.sh.in',
|
||||
'changelog.sh.in',
|
||||
'checkdepends.sh.in',
|
||||
'conflicts.sh.in',
|
||||
'depends.sh.in',
|
||||
'epoch.sh.in',
|
||||
'fullpkgver.sh.in',
|
||||
'install.sh.in',
|
||||
'makedepends.sh.in',
|
||||
'optdepends.sh.in',
|
||||
'options.sh.in',
|
||||
'package_function.sh.in',
|
||||
'package_function_variable.sh.in',
|
||||
'pkgbase.sh.in',
|
||||
'pkglist.sh.in',
|
||||
'pkgname.sh.in',
|
||||
|
||||
@@ -23,6 +23,8 @@ LIBMAKEPKG_LINT_PKGBUILD_OPTDEPENDS_SH=1
|
||||
|
||||
LIBRARY=${LIBRARY:-'@libmakepkgdir@'}
|
||||
|
||||
source "$LIBRARY/lint_pkgbuild/fullpkgver.sh"
|
||||
source "$LIBRARY/lint_pkgbuild/pkgname.sh"
|
||||
source "$LIBRARY/util/message.sh"
|
||||
source "$LIBRARY/util/pkgbuild.sh"
|
||||
|
||||
@@ -41,12 +43,10 @@ lint_optdepends() {
|
||||
|
||||
for optdepend in "${optdepends_list[@]%%:[[:space:]]*}"; do
|
||||
name=${optdepend%%@(<|>|=|>=|<=)*}
|
||||
# remove optional epoch in version specifier
|
||||
ver=${optdepend##$name@(<|>|=|>=|<=)?(+([0-9]):)}
|
||||
lint_one_pkgname optdepends "$name" || ret=1
|
||||
if [[ $ver != $optdepend ]]; then
|
||||
# remove optional pkgrel in version specifier
|
||||
check_pkgver "${ver%-+([0-9])?(.+([0-9]))}" optdepends || ret=1
|
||||
if [[ $name != $optdepend ]]; then
|
||||
ver=${optdepend##$name@(<|>|=|>=|<=)}
|
||||
check_fullpkgver "$ver" optdepends || ret=1
|
||||
fi
|
||||
done
|
||||
|
||||
|
||||
@@ -0,0 +1,62 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# package_function_variable.sh - Check variables inside the package function.
|
||||
#
|
||||
# Copyright (c) 2014-2018 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/>.
|
||||
#
|
||||
|
||||
[[ -n "$LIBMAKEPKG_LINT_PKGBUILD_PACKAGE_FUNCTION_VARIABLE_SH" ]] && return
|
||||
LIBMAKEPKG_LINT_PKGBUILD_PACKAGE_FUNCTION_VARIABLE_SH=1
|
||||
|
||||
LIBRARY=${LIBRARY:-'@libmakepkgdir@'}
|
||||
|
||||
source "$LIBRARY/util/message.sh"
|
||||
source "$LIBRARY/util/pkgbuild.sh"
|
||||
source "$LIBRARY/util/schema.sh"
|
||||
source "$LIBRARY/util/util.sh"
|
||||
|
||||
|
||||
lint_pkgbuild_functions+=('lint_package_function_variable')
|
||||
|
||||
|
||||
lint_package_function_variable() {
|
||||
local i a pkg ret=0
|
||||
|
||||
# package function variables
|
||||
for pkg in ${pkgname[@]}; do
|
||||
for a in ${arch[@]}; do
|
||||
[[ $a == "any" ]] && continue
|
||||
|
||||
for i in ${pkgbuild_schema_arrays[@]} ${pkgbuild_schema_strings[@]}; do
|
||||
in_array "$i" ${pkgbuild_schema_package_overrides[@]} && continue
|
||||
if exists_function_variable "package_$pkg" "${i}_${a}"; then
|
||||
error "$(gettext "%s can not be set inside a package function")" "${i}_${a}"
|
||||
ret=1
|
||||
fi
|
||||
done
|
||||
done
|
||||
|
||||
for i in ${pkgbuild_schema_arrays[@]} ${pkgbuild_schema_strings[@]}; do
|
||||
in_array "$i" ${pkgbuild_schema_package_overrides[@]} && continue
|
||||
if exists_function_variable "package_$pkg" "$i"; then
|
||||
error "$(gettext "%s can not be set inside a package function")" "$i"
|
||||
ret=1
|
||||
fi
|
||||
done
|
||||
done
|
||||
|
||||
return $ret
|
||||
}
|
||||
@@ -29,14 +29,19 @@ source "$LIBRARY/util/message.sh"
|
||||
lint_pkgbuild_functions+=('lint_pkgrel')
|
||||
|
||||
|
||||
lint_pkgrel() {
|
||||
if [[ -z $pkgrel ]]; then
|
||||
error "$(gettext "%s is not allowed to be empty.")" "pkgrel"
|
||||
check_pkgrel() {
|
||||
local rel=$1 type=$2
|
||||
if [[ -z $rel ]]; then
|
||||
error "$(gettext "%s is not allowed to be empty.")" "pkgrel${type:+ in $type}"
|
||||
return 1
|
||||
fi
|
||||
|
||||
if [[ $pkgrel != +([0-9])?(.+([0-9])) ]]; then
|
||||
error "$(gettext "%s must be a decimal, not %s.")" "pkgrel" "$pkgrel"
|
||||
if [[ $rel != +([0-9])?(.+([0-9])) ]]; then
|
||||
error "$(gettext "%s must be of the form 'integer[.integer]', not %s.")" "pkgrel${type:+ in $type}" "$rel"
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
lint_pkgrel() {
|
||||
check_pkgrel "$pkgrel"
|
||||
}
|
||||
|
||||
@@ -23,8 +23,8 @@ LIBMAKEPKG_LINT_PKGBUILD_PROVIDES_SH=1
|
||||
|
||||
LIBRARY=${LIBRARY:-'@libmakepkgdir@'}
|
||||
|
||||
source "$LIBRARY/lint_pkgbuild/fullpkgver.sh"
|
||||
source "$LIBRARY/lint_pkgbuild/pkgname.sh"
|
||||
source "$LIBRARY/lint_pkgbuild/pkgver.sh"
|
||||
source "$LIBRARY/util/message.sh"
|
||||
source "$LIBRARY/util/pkgbuild.sh"
|
||||
|
||||
@@ -48,12 +48,10 @@ lint_provides() {
|
||||
continue
|
||||
fi
|
||||
name=${provide%=*}
|
||||
# remove optional epoch in version specifier
|
||||
ver=${provide##$name=?(+([0-9]):)}
|
||||
lint_one_pkgname provides "$name" || ret=1
|
||||
if [[ $ver != $provide ]]; then
|
||||
# remove optional pkgrel in version specifier
|
||||
check_pkgver "${ver%-+([0-9])?(.+([0-9]))}" provides || ret=1
|
||||
if [[ $name != $provide ]]; then
|
||||
ver=${provide##$name=}
|
||||
check_fullpkgver "$ver" provides || ret=1
|
||||
fi
|
||||
done
|
||||
|
||||
|
||||
@@ -25,25 +25,17 @@ LIBRARY=${LIBRARY:-'@libmakepkgdir@'}
|
||||
|
||||
source "$LIBRARY/util/message.sh"
|
||||
source "$LIBRARY/util/pkgbuild.sh"
|
||||
source "$LIBRARY/util/schema.sh"
|
||||
|
||||
lint_pkgbuild_functions+=('lint_variable')
|
||||
|
||||
|
||||
lint_variable() {
|
||||
# TODO: refactor - similar arrays are used elsewhere
|
||||
local array=(arch backup checkdepends groups license noextract options
|
||||
validpgpkeys)
|
||||
local arch_array=(conflicts depends makedepends md5sums optdepends provides
|
||||
replaces sha1sums sha224sums sha256sums sha384sums sha512sums
|
||||
source)
|
||||
local string=(changelog epoch install pkgbase pkgdesc pkgrel pkgver url)
|
||||
|
||||
local i a v pkg keys out bad ret=0
|
||||
local i a pkg out bad ret=0
|
||||
|
||||
# global variables
|
||||
for i in ${array[@]} ${arch_array[@]}; do
|
||||
eval "keys=(\"\${!$i[@]}\")"
|
||||
if (( ${#keys[*]} > 0 )); then
|
||||
for i in ${pkgbuild_schema_arrays[@]}; do
|
||||
if declare -p $i > /dev/null 2>&1; then
|
||||
if ! is_array $i; then
|
||||
error "$(gettext "%s should be an array")" "$i"
|
||||
ret=1
|
||||
@@ -54,21 +46,18 @@ lint_variable() {
|
||||
for a in ${arch[@]}; do
|
||||
[[ $a == "any" ]] && continue
|
||||
|
||||
for i in ${arch_array[@]}; do
|
||||
v="${i}_${a}"
|
||||
eval "keys=(\"\${!${v}[@]}\")"
|
||||
if (( ${#keys[*]} > 0 )); then
|
||||
if ! is_array $v; then
|
||||
error "$(gettext "%s_%s should be an array")" "$i" "$a"
|
||||
for i in ${pkgbuild_schema_arch_arrays[@]}; do
|
||||
if declare -p "${i}_${a}" > /dev/null 2>&1; then
|
||||
if ! is_array ${i}_${a}; then
|
||||
error "$(gettext "%s should be an array")" "${i}_${a}"
|
||||
ret=1
|
||||
fi
|
||||
fi
|
||||
done
|
||||
done
|
||||
|
||||
for i in ${string[@]}; do
|
||||
eval "keys=(\"\${!$i[@]}\")"
|
||||
if (( ${#keys[*]} > 0 )); then
|
||||
for i in ${pkgbuild_schema_strings[@]}; do
|
||||
if declare -p "$i" > /dev/null 2>&1; then
|
||||
if is_array $i; then
|
||||
error "$(gettext "%s should not be an array")" "$i"
|
||||
ret=1
|
||||
@@ -78,7 +67,7 @@ lint_variable() {
|
||||
|
||||
# package function variables
|
||||
for pkg in ${pkgname[@]}; do
|
||||
for i in ${array[@]} ${arch_array[@]}; do
|
||||
for i in ${pkgbuild_schema_arrays[@]}; do
|
||||
if extract_function_variable "package_$pkg" $i 0 out; then
|
||||
error "$(gettext "%s should be an array")" "$i"
|
||||
ret=1
|
||||
@@ -88,15 +77,15 @@ lint_variable() {
|
||||
for a in ${arch[@]}; do
|
||||
[[ $a == "any" ]] && continue
|
||||
|
||||
for i in ${arch_array[@]}; do
|
||||
for i in ${pkgbuild_schema_arch_arrays[@]}; do
|
||||
if extract_function_variable "package_$pkg" "${i}_${a}" 0 out; then
|
||||
error "$(gettext "%s_%s should be an array")" "$i" "$a"
|
||||
error "$(gettext "%s should be an array")" "${i}_${a}"
|
||||
ret=1
|
||||
fi
|
||||
done
|
||||
done
|
||||
|
||||
for i in ${string[@]}; do
|
||||
for i in ${pkgbuild_schema_strings[@]}; do
|
||||
if extract_function_variable "package_$pkg" $i 1 out; then
|
||||
error "$(gettext "%s should not be an array")" "$i"
|
||||
ret=1
|
||||
|
||||
@@ -59,26 +59,11 @@ download_sources() {
|
||||
pushd "$SRCDEST" &>/dev/null
|
||||
|
||||
local proto=$(get_protocol "$netfile")
|
||||
case "$proto" in
|
||||
local)
|
||||
download_local "$netfile"
|
||||
;;
|
||||
bzr*)
|
||||
(( get_vcs )) && download_bzr "$netfile"
|
||||
;;
|
||||
git*)
|
||||
(( get_vcs )) && download_git "$netfile"
|
||||
;;
|
||||
hg*)
|
||||
(( get_vcs )) && download_hg "$netfile"
|
||||
;;
|
||||
svn*)
|
||||
(( get_vcs )) && download_svn "$netfile"
|
||||
;;
|
||||
*)
|
||||
download_file "$netfile"
|
||||
;;
|
||||
esac
|
||||
if declare -f download_$proto > /dev/null; then
|
||||
download_$proto "$netfile"
|
||||
else
|
||||
download_file "$netfile"
|
||||
fi
|
||||
|
||||
popd &>/dev/null
|
||||
done
|
||||
@@ -92,22 +77,10 @@ extract_sources() {
|
||||
for netfile in "${all_sources[@]}"; do
|
||||
local file=$(get_filename "$netfile")
|
||||
local proto=$(get_protocol "$netfile")
|
||||
case "$proto" in
|
||||
bzr*)
|
||||
extract_bzr "$netfile"
|
||||
;;
|
||||
git*)
|
||||
extract_git "$netfile"
|
||||
;;
|
||||
hg*)
|
||||
extract_hg "$netfile"
|
||||
;;
|
||||
svn*)
|
||||
extract_svn "$netfile"
|
||||
;;
|
||||
*)
|
||||
extract_file "$file"
|
||||
;;
|
||||
esac
|
||||
if declare -f extract_$proto > /dev/null; then
|
||||
extract_$proto "$netfile"
|
||||
else
|
||||
extract_file "$file"
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
@@ -29,6 +29,11 @@ source "$LIBRARY/util/pkgbuild.sh"
|
||||
|
||||
|
||||
download_bzr() {
|
||||
# abort early if parent says not to fetch
|
||||
if declare -p get_vcs > /dev/null 2>&1; then
|
||||
(( get_vcs )) || return
|
||||
fi
|
||||
|
||||
local netfile=$1
|
||||
|
||||
local url=$(get_url "$netfile")
|
||||
|
||||
@@ -29,6 +29,11 @@ source "$LIBRARY/util/pkgbuild.sh"
|
||||
|
||||
|
||||
download_git() {
|
||||
# abort early if parent says not to fetch
|
||||
if declare -p get_vcs > /dev/null 2>&1; then
|
||||
(( get_vcs )) || return
|
||||
fi
|
||||
|
||||
local netfile=$1
|
||||
|
||||
local dir=$(get_filepath "$netfile")
|
||||
|
||||
@@ -29,6 +29,11 @@ source "$LIBRARY/util/pkgbuild.sh"
|
||||
|
||||
|
||||
download_hg() {
|
||||
# abort early if parent says not to fetch
|
||||
if declare -p get_vcs > /dev/null 2>&1; then
|
||||
(( get_vcs )) || return
|
||||
fi
|
||||
|
||||
local netfile=$1
|
||||
|
||||
local dir=$(get_filepath "$netfile")
|
||||
|
||||
@@ -29,6 +29,11 @@ source "$LIBRARY/util/pkgbuild.sh"
|
||||
|
||||
|
||||
download_svn() {
|
||||
# abort early if parent says not to fetch
|
||||
if declare -p get_vcs > /dev/null 2>&1; then
|
||||
(( get_vcs )) || return
|
||||
fi
|
||||
|
||||
local netfile=$1
|
||||
|
||||
local fragment=${netfile#*#}
|
||||
|
||||
@@ -24,6 +24,7 @@ LIBMAKEPKG_SRCINFO_SH=1
|
||||
LIBRARY=${LIBRARY:-'@libmakepkgdir@'}
|
||||
|
||||
source "$LIBRARY/util/pkgbuild.sh"
|
||||
source "$LIBRARY/util/schema.sh"
|
||||
|
||||
srcinfo_open_section() {
|
||||
printf '%s = %s\n' "$1" "$2"
|
||||
@@ -63,7 +64,7 @@ srcinfo_write_section_details() {
|
||||
local attr package_arch a
|
||||
local multivalued_arch_attrs=(source provides conflicts depends replaces
|
||||
optdepends makedepends checkdepends
|
||||
{md5,sha{1,224,256,384,512}}sums)
|
||||
"${known_hash_algos[@]/%/sums}")
|
||||
|
||||
for attr in "${singlevalued[@]}"; do
|
||||
pkgbuild_extract_to_srcinfo "$1" "$attr" 0
|
||||
|
||||
@@ -42,6 +42,7 @@ compress_as() {
|
||||
*tar.lzo) ${COMPRESSLZO[@]:-lzop -q} ;;
|
||||
*tar.Z) ${COMPRESSZ[@]:-compress -c -f} ;;
|
||||
*tar.lz4) ${COMPRESSLZ4[@]:-lz4 -q} ;;
|
||||
*tar.lz) ${COMPRESSLZ[@]:-lzip -c -f} ;;
|
||||
*tar) cat ;;
|
||||
*) warning "$(gettext "'%s' is not a valid archive extension.")" \
|
||||
"$ext"; cat ;;
|
||||
|
||||
@@ -7,6 +7,7 @@ sources = [
|
||||
'option.sh.in',
|
||||
'parseopts.sh.in',
|
||||
'pkgbuild.sh.in',
|
||||
'schema.sh.in',
|
||||
'source.sh.in',
|
||||
'util.sh.in',
|
||||
]
|
||||
|
||||
@@ -18,9 +18,11 @@
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
|
||||
[[ -n "${LIBMAKEPKG_UTIL_PKGBUILD_SH:-}" ]] && return
|
||||
[[ -n "$LIBMAKEPKG_UTIL_PKGBUILD_SH" ]] && return
|
||||
LIBMAKEPKG_UTIL_PKGBUILD_SH=1
|
||||
|
||||
source "$LIBRARY/util/schema.sh"
|
||||
|
||||
|
||||
have_function() {
|
||||
declare -f "$1" >/dev/null
|
||||
@@ -36,7 +38,7 @@ array_build() {
|
||||
# it's an error to try to copy a value which doesn't exist.
|
||||
declare -p "$2" &>/dev/null || return 1
|
||||
|
||||
# Build an array of the indicies of the source array.
|
||||
# Build an array of the indices of the source array.
|
||||
eval "keys=(\"\${!$2[@]}\")"
|
||||
|
||||
# Clear the destination array
|
||||
@@ -98,6 +100,15 @@ extract_function_variable() {
|
||||
return $r
|
||||
}
|
||||
|
||||
exists_function_variable() {
|
||||
# $1: function name
|
||||
# $2: variable name
|
||||
|
||||
local funcname=$1 attr=$2 out
|
||||
extract_function_variable "$funcname" "$attr" 0 out ||
|
||||
extract_function_variable "$funcname" "$attr" 1 out
|
||||
}
|
||||
|
||||
get_pkgbuild_attribute() {
|
||||
# $1: package name
|
||||
# $2: attribute name
|
||||
|
||||
49
scripts/libmakepkg/util/schema.sh.in
Normal file
49
scripts/libmakepkg/util/schema.sh.in
Normal file
@@ -0,0 +1,49 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# schema.sh - declare specific groups of pkgbuild variables
|
||||
#
|
||||
# Copyright (c) 2015-2018 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/>.
|
||||
#
|
||||
|
||||
[[ -n "$LIBMAKEPKG_SCHEMA_SH" ]] && return
|
||||
LIBMAKEPKG_SCHEMA_SH=1
|
||||
|
||||
LIBRARY=${LIBRARY:-'@libmakepkgdir@'}
|
||||
|
||||
source "$LIBRARY/util/util.sh"
|
||||
|
||||
|
||||
known_hash_algos=({md5,sha{1,224,256,384,512},b2})
|
||||
|
||||
pkgbuild_schema_arrays=(arch backup checkdepends conflicts depends groups
|
||||
license makedepends noextract optdepends options
|
||||
provides replaces source validpgpkeys
|
||||
"${known_hash_algos[@]/%/sums}")
|
||||
|
||||
pkgbuild_schema_strings=(changelog epoch install pkgbase pkgdesc pkgrel pkgver
|
||||
url)
|
||||
|
||||
pkgbuild_schema_arch_arrays=(checkdepends conflicts depends makedepends
|
||||
optdepends provides replaces source
|
||||
"${known_hash_algos[@]/%/sums}")
|
||||
|
||||
pkgbuild_schema_package_overrides=(pkgdesc arch url license groups depends
|
||||
optdepends provides conflicts replaces
|
||||
backup options install changelog)
|
||||
|
||||
readonly -a known_hash_algos pkgbuild_schema_arrays \
|
||||
pkgbuild_schema_strings pkgbuild_schema_arch_arrays \
|
||||
pkgbuild_schema_package_overrides
|
||||
@@ -41,10 +41,12 @@ get_protocol() {
|
||||
if [[ $1 = *://* ]]; then
|
||||
# strip leading filename
|
||||
local proto="${1#*::}"
|
||||
printf "%s\n" "${proto%%://*}"
|
||||
proto="${proto%%://*}"
|
||||
# strip proto+uri://
|
||||
printf "%s\n" "${proto%%+*}"
|
||||
elif [[ $1 = *lp:* ]]; then
|
||||
local proto="${1#*::}"
|
||||
printf "%s\n" "${proto%%lp:*}"
|
||||
printf "%s\n" "${proto%%+lp:*}"
|
||||
else
|
||||
printf "%s\n" local
|
||||
fi
|
||||
@@ -63,15 +65,15 @@ get_filename() {
|
||||
local proto=$(get_protocol "$netfile")
|
||||
|
||||
case $proto in
|
||||
bzr*|git*|hg*|svn*)
|
||||
bzr|git|hg|svn)
|
||||
filename=${netfile%%#*}
|
||||
filename=${filename%%\?*}
|
||||
filename=${filename%/}
|
||||
filename=${filename##*/}
|
||||
if [[ $proto = bzr* ]]; then
|
||||
if [[ $proto = bzr ]]; then
|
||||
filename=${filename#*lp:}
|
||||
fi
|
||||
if [[ $proto = git* ]]; then
|
||||
if [[ $proto = git ]]; then
|
||||
filename=${filename%%.git*}
|
||||
fi
|
||||
;;
|
||||
@@ -89,7 +91,7 @@ get_filepath() {
|
||||
local proto="$(get_protocol "$1")"
|
||||
|
||||
case $proto in
|
||||
bzr*|git*|hg*|svn*)
|
||||
bzr|git|hg|svn)
|
||||
if [[ -d "$startdir/$file" ]]; then
|
||||
file="$startdir/$file"
|
||||
elif [[ -d "$SRCDEST/$file" ]]; then
|
||||
|
||||
@@ -48,16 +48,10 @@ declare -r startdir="$(pwd -P)"
|
||||
|
||||
LIBRARY=${LIBRARY:-'@libmakepkgdir@'}
|
||||
|
||||
splitpkg_overrides=('pkgdesc' 'arch' 'url' 'license' 'groups' 'depends'
|
||||
'optdepends' 'provides' 'conflicts' 'replaces' 'backup'
|
||||
'options' 'install' 'changelog')
|
||||
readonly -a splitpkg_overrides
|
||||
|
||||
known_hash_algos=('md5' 'sha1' 'sha224' 'sha256' 'sha384' 'sha512')
|
||||
|
||||
# Options
|
||||
ASDEPS=0
|
||||
BUILDFUNC=0
|
||||
BUILDPKG=1
|
||||
CHECKFUNC=0
|
||||
CLEANBUILD=0
|
||||
CLEANUP=0
|
||||
@@ -223,17 +217,24 @@ missing_source_file() {
|
||||
|
||||
run_pacman() {
|
||||
local cmd
|
||||
if [[ $1 != -@(T|Q)*([[:alpha:]]) ]]; then
|
||||
cmd=("$PACMAN_PATH" "${PACMAN_OPTS[@]}" "$@")
|
||||
else
|
||||
if [[ $1 = -@(T|Q)*([[:alpha:]]) ]]; then
|
||||
cmd=("$PACMAN_PATH" "$@")
|
||||
fi
|
||||
if [[ $1 != -@(T|Q)*([[:alpha:]]) ]]; then
|
||||
else
|
||||
cmd=("$PACMAN_PATH" "${PACMAN_OPTS[@]}" "$@")
|
||||
if type -p sudo >/dev/null; then
|
||||
cmd=(sudo "${cmd[@]}")
|
||||
else
|
||||
cmd=(su root -c "$(printf '%q ' "${cmd[@]}")")
|
||||
fi
|
||||
local lockfile="$(pacman-conf DBPath)/db.lck"
|
||||
while [[ -f $lockfile ]]; do
|
||||
local timer=0
|
||||
msg "$(gettext "Pacman is currently in use, please wait...")"
|
||||
while [[ -f $lockfile ]] && (( timer < 10 )); do
|
||||
(( ++timer ))
|
||||
sleep 3
|
||||
done
|
||||
done
|
||||
fi
|
||||
"${cmd[@]}"
|
||||
}
|
||||
@@ -335,7 +336,7 @@ remove_deps() {
|
||||
|
||||
msg "Removing installed dependencies..."
|
||||
# exit cleanly on failure to remove deps as package has been built successfully
|
||||
if ! run_pacman -Rn ${deplist[@]}; then
|
||||
if ! run_pacman -Rnu ${deplist[@]}; then
|
||||
warning "$(gettext "Failed to remove installed dependencies.")"
|
||||
return $E_REMOVE_DEPS_FAILED
|
||||
fi
|
||||
@@ -739,7 +740,7 @@ create_debug_package() {
|
||||
return 0
|
||||
fi
|
||||
|
||||
pkgdir="$pkgdirbase/$pkgbase-@DEBUGSUFFIX@"
|
||||
local pkgdir="$pkgdirbase/$pkgbase-@DEBUGSUFFIX@"
|
||||
|
||||
# check if we have any debug symbols to package
|
||||
if dir_is_empty "$pkgdir/usr/lib/debug"; then
|
||||
@@ -904,7 +905,7 @@ check_build_status() {
|
||||
|
||||
backup_package_variables() {
|
||||
local var
|
||||
for var in ${splitpkg_overrides[@]}; do
|
||||
for var in ${pkgbuild_schema_package_overrides[@]}; do
|
||||
local indirect="${var}_backup"
|
||||
eval "${indirect}=(\"\${$var[@]}\")"
|
||||
done
|
||||
@@ -912,7 +913,7 @@ backup_package_variables() {
|
||||
|
||||
restore_package_variables() {
|
||||
local var
|
||||
for var in ${splitpkg_overrides[@]}; do
|
||||
for var in ${pkgbuild_schema_package_overrides[@]}; do
|
||||
local indirect="${var}_backup"
|
||||
if [[ -n ${!indirect} ]]; then
|
||||
eval "${var}=(\"\${$indirect[@]}\")"
|
||||
@@ -922,20 +923,25 @@ restore_package_variables() {
|
||||
done
|
||||
}
|
||||
|
||||
run_single_packaging() {
|
||||
local pkgdir="$pkgdirbase/$pkgname"
|
||||
mkdir "$pkgdir"
|
||||
if [[ -n $1 ]] || (( PKGFUNC )); then
|
||||
run_package $1
|
||||
fi
|
||||
tidy_install
|
||||
lint_package || exit $E_PACKAGE_FAILED
|
||||
create_package
|
||||
}
|
||||
|
||||
run_split_packaging() {
|
||||
local pkgname_backup=("${pkgname[@]}")
|
||||
backup_package_variables
|
||||
for pkgname in ${pkgname_backup[@]}; do
|
||||
pkgdir="$pkgdirbase/$pkgname"
|
||||
mkdir "$pkgdir"
|
||||
backup_package_variables
|
||||
run_package $pkgname
|
||||
tidy_install
|
||||
lint_package || exit $E_PACKAGE_FAILED
|
||||
create_package
|
||||
run_single_packaging $pkgname
|
||||
restore_package_variables
|
||||
done
|
||||
pkgname=("${pkgname_backup[@]}")
|
||||
create_debug_package
|
||||
}
|
||||
|
||||
usage() {
|
||||
@@ -1042,7 +1048,7 @@ while true; do
|
||||
--noprogressbar) PACMAN_OPTS+=("--noprogressbar") ;;
|
||||
|
||||
# Makepkg Options
|
||||
--allsource) SOURCEONLY=2 ;;
|
||||
--allsource) BUILDPKG=0 SOURCEONLY=2 ;;
|
||||
-A|--ignorearch) IGNOREARCH=1 ;;
|
||||
-c|--clean) CLEANUP=1 ;;
|
||||
-C|--cleanbuild) CLEANBUILD=1 ;;
|
||||
@@ -1053,7 +1059,7 @@ while true; do
|
||||
-f|--force) FORCE=1 ;;
|
||||
-F) INFAKEROOT=1 ;;
|
||||
# generating integrity checks does not depend on architecture
|
||||
-g|--geninteg) GENINTEG=1 IGNOREARCH=1;;
|
||||
-g|--geninteg) BUILDPKG=0 GENINTEG=1 IGNOREARCH=1;;
|
||||
--holdver) HOLDVER=1 ;;
|
||||
-i|--install) INSTALL=1 ;;
|
||||
--key) shift; GPGKEY=$1 ;;
|
||||
@@ -1063,10 +1069,10 @@ while true; do
|
||||
--nocheck) RUN_CHECK='n' ;;
|
||||
--noprepare) RUN_PREPARE='n' ;;
|
||||
--nosign) SIGNPKG='n' ;;
|
||||
-o|--nobuild) NOBUILD=1 ;;
|
||||
-o|--nobuild) BUILDPKG=0 NOBUILD=1 ;;
|
||||
-p) shift; BUILDFILE=$1 ;;
|
||||
--packagelist) PACKAGELIST=1 IGNOREARCH=1;;
|
||||
--printsrcinfo) PRINTSRCINFO=1 IGNOREARCH=1;;
|
||||
--packagelist) BUILDPKG=0 PACKAGELIST=1 IGNOREARCH=1;;
|
||||
--printsrcinfo) BUILDPKG=0 PRINTSRCINFO=1 IGNOREARCH=1;;
|
||||
-r|--rmdeps) RMDEPS=1 ;;
|
||||
-R|--repackage) REPKG=1 ;;
|
||||
--sign) SIGNPKG='y' ;;
|
||||
@@ -1074,8 +1080,8 @@ while true; do
|
||||
--skipinteg) SKIPCHECKSUMS=1; SKIPPGPCHECK=1 ;;
|
||||
--skippgpcheck) SKIPPGPCHECK=1;;
|
||||
-s|--syncdeps) DEP_BIN=1 ;;
|
||||
-S|--source) SOURCEONLY=1 ;;
|
||||
--verifysource) VERIFYSOURCE=1 ;;
|
||||
-S|--source) BUILDPKG=0 SOURCEONLY=1 ;;
|
||||
--verifysource) BUILDPKG=0 VERIFYSOURCE=1 ;;
|
||||
|
||||
-h|--help) usage; exit $E_OK ;;
|
||||
-V|--version) version; exit $E_OK ;;
|
||||
@@ -1138,7 +1144,7 @@ fi
|
||||
|
||||
# canonicalize paths and provide defaults if anything is still undefined
|
||||
for var in PKGDEST SRCDEST SRCPKGDEST LOGDEST BUILDDIR; do
|
||||
printf -v "$var" "$(canonicalize_path "${!var:-$startdir}")"
|
||||
printf -v "$var" '%s' "$(canonicalize_path "${!var:-$startdir}")"
|
||||
done
|
||||
unset var
|
||||
PACKAGER=${PACKAGER:-"Unknown Packager"}
|
||||
@@ -1211,12 +1217,12 @@ unset sha{1,224,256,384,512}sums makedepends optdepends options noextract validp
|
||||
unset "${!makedepends_@}" "${!depends_@}" "${!source_@}" "${!checkdepends_@}"
|
||||
unset "${!optdepends_@}" "${!conflicts_@}" "${!provides_@}" "${!replaces_@}"
|
||||
unset "${!md5sums_@}" "${!sha1sums_@}" "${!sha224sums_@}" "${!sha256sums_@}"
|
||||
unset "${!sha384sums_@}" "${!sha512sums_@}"
|
||||
unset "${!sha384sums_@}" "${!sha512sums_@}" "${!b2sums_@}"
|
||||
|
||||
BUILDFILE=${BUILDFILE:-$BUILDSCRIPT}
|
||||
if [[ ! -f $BUILDFILE ]]; then
|
||||
error "$(gettext "%s does not exist.")" "$BUILDFILE"
|
||||
exit $E_USER_FUNCTION_FAILED
|
||||
exit $E_PKGBUILD_ERROR
|
||||
|
||||
else
|
||||
if [[ $(<"$BUILDFILE") = *$'\r'* ]]; then
|
||||
@@ -1337,18 +1343,12 @@ if (( INFAKEROOT )); then
|
||||
|
||||
chmod 755 "$pkgdirbase"
|
||||
if (( ! SPLITPKG )); then
|
||||
pkgdir="$pkgdirbase/$pkgname"
|
||||
mkdir "$pkgdir"
|
||||
if (( PKGFUNC )); then
|
||||
run_package
|
||||
fi
|
||||
tidy_install
|
||||
lint_package || exit $E_PACKAGE_FAILED
|
||||
create_package
|
||||
create_debug_package
|
||||
run_single_packaging
|
||||
else
|
||||
run_split_packaging
|
||||
fi
|
||||
|
||||
create_debug_package
|
||||
|
||||
msg "$(gettext "Leaving %s environment.")" "fakeroot"
|
||||
exit $E_OK
|
||||
|
||||
@@ -159,8 +159,8 @@ db_write_delta() {
|
||||
md5sum=${md5sum%% *}
|
||||
csize=$(wc -c "$deltafile" | cut -d' ' -f1)
|
||||
|
||||
oldfile=$(xdelta3 printhdr "$deltafile" | grep "XDELTA filename (source)" | sed 's/.*: *//')
|
||||
newfile=$(xdelta3 printhdr "$deltafile" | grep "XDELTA filename (output)" | sed 's/.*: *//')
|
||||
oldfile=$(xdelta3 printhdr "$deltafile" | sed -n 's/XDELTA filename (source):\s\+\(\.*\)/\1/p')
|
||||
newfile=$(xdelta3 printhdr "$deltafile" | sed -n 's/XDELTA filename (output):\s\+\(\.*\)/\1/p')
|
||||
|
||||
if grep -q "$oldfile.*$newfile" "$deltas"; then
|
||||
sed -i.backup "/$oldfile.*$newfile/d" "$deltas" && rm -f "$deltas.backup"
|
||||
@@ -611,7 +611,7 @@ remove() {
|
||||
msg "$(gettext "Searching for package '%s'...")" "$pkgname"
|
||||
|
||||
if db_remove_entry "$pkgname"; then
|
||||
rm -f "$tmpdir/tree/$pkgname.deltas"
|
||||
rm -f "$tmpdir/db/$pkgname.deltas"
|
||||
return 0
|
||||
else
|
||||
error "$(gettext "Package matching '%s' not found.")" "$pkgname"
|
||||
|
||||
@@ -800,9 +800,9 @@ void cb_dl_progress(const char *filename, off_t file_xfered, off_t file_total)
|
||||
fname[len] = '\0';
|
||||
|
||||
/* 1 space + filenamelen + 1 space + 6 for size + 1 space + 3 for label +
|
||||
* + 2 spaces + 4 for rate + 1 for label + 2 for /s + 1 space +
|
||||
* 8 for eta, gives us the magic 30 */
|
||||
filenamelen = infolen - 30;
|
||||
* + 2 spaces + 4 for rate + 1 space + 3 for label + 2 for /s + 1 space +
|
||||
* 8 for eta, gives us the magic 33 */
|
||||
filenamelen = infolen - 33;
|
||||
/* see printf() code, we omit 'HH:' in these conditions */
|
||||
if(eta_h == 0 || eta_h >= 100) {
|
||||
filenamelen += 3;
|
||||
@@ -837,16 +837,16 @@ void cb_dl_progress(const char *filename, off_t file_xfered, off_t file_total)
|
||||
xfered_human = humanize_size(xfered, '\0', -1, &xfered_label);
|
||||
|
||||
printf(" %ls%-*s ", wcfname, padwid, "");
|
||||
/* We will show 1.62M/s, 11.6M/s, but 116K/s and 1116K/s */
|
||||
/* We will show 1.62 MiB/s, 11.6 MiB/s, but 116 KiB/s and 1116 KiB/s */
|
||||
if(rate_human < 9.995) {
|
||||
printf("%6.1f %3s %4.2f%c/s ",
|
||||
xfered_human, xfered_label, rate_human, rate_label[0]);
|
||||
printf("%6.1f %3s %4.2f %3s/s ",
|
||||
xfered_human, xfered_label, rate_human, rate_label);
|
||||
} else if(rate_human < 99.95) {
|
||||
printf("%6.1f %3s %4.1f%c/s ",
|
||||
xfered_human, xfered_label, rate_human, rate_label[0]);
|
||||
printf("%6.1f %3s %4.1f %3s/s ",
|
||||
xfered_human, xfered_label, rate_human, rate_label);
|
||||
} else {
|
||||
printf("%6.1f %3s %4.f%c/s ",
|
||||
xfered_human, xfered_label, rate_human, rate_label[0]);
|
||||
printf("%6.1f %3s %4.f %3s/s ",
|
||||
xfered_human, xfered_label, rate_human, rate_label);
|
||||
}
|
||||
if(eta_h == 0) {
|
||||
printf("%02u:%02u", eta_m, eta_s);
|
||||
|
||||
@@ -844,28 +844,28 @@ static int _parse_repo(const char *key, char *value, const char *file,
|
||||
int ret = 0;
|
||||
config_repo_t *repo = section->repo;
|
||||
|
||||
#define CHECK_VALUE(val) do { \
|
||||
if(!val) { \
|
||||
pm_printf(ALPM_LOG_ERROR, _("config file %s, line %d: directive '%s' needs a value\n"), \
|
||||
file, line, key); \
|
||||
return 1; \
|
||||
} \
|
||||
} while(0)
|
||||
|
||||
if(strcmp(key, "Server") == 0) {
|
||||
if(!value) {
|
||||
pm_printf(ALPM_LOG_ERROR, _("config file %s, line %d: directive '%s' needs a value\n"),
|
||||
file, line, key);
|
||||
ret = 1;
|
||||
} else {
|
||||
repo->servers = alpm_list_add(repo->servers, strdup(value));
|
||||
}
|
||||
CHECK_VALUE(value);
|
||||
repo->servers = alpm_list_add(repo->servers, strdup(value));
|
||||
} else if(strcmp(key, "SigLevel") == 0) {
|
||||
if(!value) {
|
||||
pm_printf(ALPM_LOG_ERROR, _("config file %s, line %d: directive '%s' needs a value\n"),
|
||||
file, line, key);
|
||||
} else {
|
||||
alpm_list_t *values = NULL;
|
||||
setrepeatingoption(value, "SigLevel", &values);
|
||||
if(values) {
|
||||
ret = process_siglevel(values, &repo->siglevel,
|
||||
&repo->siglevel_mask, file, line);
|
||||
FREELIST(values);
|
||||
}
|
||||
CHECK_VALUE(value);
|
||||
alpm_list_t *values = NULL;
|
||||
setrepeatingoption(value, "SigLevel", &values);
|
||||
if(values) {
|
||||
ret = process_siglevel(values, &repo->siglevel,
|
||||
&repo->siglevel_mask, file, line);
|
||||
FREELIST(values);
|
||||
}
|
||||
} else if(strcmp(key, "Usage") == 0) {
|
||||
CHECK_VALUE(value);
|
||||
alpm_list_t *values = NULL;
|
||||
setrepeatingoption(value, "Usage", &values);
|
||||
if(values) {
|
||||
@@ -881,6 +881,8 @@ static int _parse_repo(const char *key, char *value, const char *file,
|
||||
file, line, key, repo->name);
|
||||
}
|
||||
|
||||
#undef CHECK_VALUE
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
@@ -196,7 +196,7 @@ static void usage(int op, const char * const myname)
|
||||
addlist(_(" --ignore <pkg> ignore a package upgrade (can be used more than once)\n"));
|
||||
addlist(_(" --ignoregroup <grp>\n"
|
||||
" ignore a group upgrade (can be used more than once)\n"));
|
||||
/* pass through */
|
||||
/* fall through */
|
||||
case PM_OP_REMOVE:
|
||||
addlist(_(" -d, --nodeps skip dependency version checks (-dd to skip all checks)\n"));
|
||||
addlist(_(" --assume-installed <package=version>\n"
|
||||
|
||||
@@ -286,7 +286,7 @@ static int filter(alpm_pkg_t *pkg)
|
||||
return 0;
|
||||
}
|
||||
/* check if this pkg is outdated */
|
||||
if(config->op_q_upgrade && (alpm_sync_newversion(pkg,
|
||||
if(config->op_q_upgrade && (alpm_sync_get_new_version(pkg,
|
||||
alpm_get_syncdbs(config->handle)) == NULL)) {
|
||||
return 0;
|
||||
}
|
||||
@@ -325,10 +325,14 @@ static int display(alpm_pkg_t *pkg)
|
||||
colstr->version, alpm_pkg_get_version(pkg), colstr->nocolor);
|
||||
|
||||
if(config->op_q_upgrade) {
|
||||
alpm_pkg_t *newpkg = alpm_sync_newversion(pkg, alpm_get_syncdbs(config->handle));
|
||||
int usage;
|
||||
alpm_pkg_t *newpkg = alpm_sync_get_new_version(pkg, alpm_get_syncdbs(config->handle));
|
||||
alpm_db_t *db = alpm_pkg_get_db(newpkg);
|
||||
alpm_db_get_usage(db, &usage);
|
||||
|
||||
printf(" -> %s%s%s", colstr->version, alpm_pkg_get_version(newpkg), colstr->nocolor);
|
||||
|
||||
if(alpm_pkg_should_ignore(config->handle, pkg)) {
|
||||
if(alpm_pkg_should_ignore(config->handle, pkg) || !(usage & ALPM_DB_USAGE_UPGRADE)) {
|
||||
printf(" %s", _("[ignored]"));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -44,14 +44,8 @@ static int remove_target(const char *target)
|
||||
if((pkg = alpm_db_get_pkg(db_local, target)) != NULL) {
|
||||
if(alpm_remove_pkg(config->handle, pkg) == -1) {
|
||||
alpm_errno_t err = alpm_errno(config->handle);
|
||||
if(err == ALPM_ERR_TRANS_DUP_TARGET) {
|
||||
/* just skip duplicate targets */
|
||||
pm_printf(ALPM_LOG_WARNING, _("skipping target: %s\n"), target);
|
||||
return 0;
|
||||
} else {
|
||||
pm_printf(ALPM_LOG_ERROR, "'%s': %s\n", target, alpm_strerror(err));
|
||||
return -1;
|
||||
}
|
||||
pm_printf(ALPM_LOG_ERROR, "'%s': %s\n", target, alpm_strerror(err));
|
||||
return -1;
|
||||
}
|
||||
config->explicit_removes = alpm_list_add(config->explicit_removes, pkg);
|
||||
return 0;
|
||||
|
||||
@@ -521,15 +521,8 @@ static int process_pkg(alpm_pkg_t *pkg)
|
||||
|
||||
if(ret == -1) {
|
||||
alpm_errno_t err = alpm_errno(config->handle);
|
||||
if(err == ALPM_ERR_TRANS_DUP_TARGET) {
|
||||
/* just skip duplicate targets */
|
||||
pm_printf(ALPM_LOG_WARNING, _("skipping target: %s\n"), alpm_pkg_get_name(pkg));
|
||||
return 0;
|
||||
} else {
|
||||
pm_printf(ALPM_LOG_ERROR, "'%s': %s\n", alpm_pkg_get_name(pkg),
|
||||
alpm_strerror(err));
|
||||
return 1;
|
||||
}
|
||||
pm_printf(ALPM_LOG_ERROR, "'%s': %s\n", alpm_pkg_get_name(pkg), alpm_strerror(err));
|
||||
return 1;
|
||||
}
|
||||
config->explicit_adds = alpm_list_add(config->explicit_adds, pkg);
|
||||
return 0;
|
||||
|
||||
@@ -1359,7 +1359,7 @@ static int multiselect_parse(char *array, int count, char *response)
|
||||
len--;
|
||||
include = 0;
|
||||
} else if(str) {
|
||||
/* if first token is including, we unselect all targets */
|
||||
/* if first token is including, we deselect all targets */
|
||||
memset(array, 0, count);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,9 +0,0 @@
|
||||
SUBDIRS = tests
|
||||
|
||||
check_SCRIPTS = test_functions.sh
|
||||
|
||||
noinst_SCRIPTS = $(check_SCRIPTS)
|
||||
|
||||
EXTRA_DIST = $(check_SCRIPTS)
|
||||
|
||||
# vim:set noet:
|
||||
@@ -1,15 +0,0 @@
|
||||
README
|
||||
======
|
||||
|
||||
Running Tests
|
||||
-------------
|
||||
|
||||
Environment Variables
|
||||
---------------------
|
||||
|
||||
PMTEST_SCRIPT_DIR - location of the makepkg executable; defaults to "$(dirname "$0")/../../../scripts)"
|
||||
PMTEST_LIBMAKEPKG_DIR - base directory of the makepkg library; defaults to "$PMTEST_SCRIPT_DIR/libmakepkg"
|
||||
VERBOSE - enable additional test output for debugging
|
||||
|
||||
Adding New Tests
|
||||
----------------
|
||||
@@ -1,143 +0,0 @@
|
||||
# basic setup to run before every test
|
||||
# tap_init
|
||||
tap_init() {
|
||||
set +e
|
||||
set -u
|
||||
set -o pipefail
|
||||
}
|
||||
|
||||
# wrapper around tap_bail that immediately causes the test to exit non-zero
|
||||
# tap_xbail $reason...
|
||||
tap_xbail() {
|
||||
tap_bail "$@"
|
||||
exit 1;
|
||||
}
|
||||
|
||||
# read from stdin and reprint as diagnostic messages if VERBOSE is set and
|
||||
# non-zero, otherwise, discard
|
||||
# $command |& tap_filter
|
||||
tap_filter() {
|
||||
local v=${VERBOSE:-0}
|
||||
if (( $v )); then
|
||||
while IFS= read line; do
|
||||
tap_diag "$line"
|
||||
done
|
||||
else
|
||||
while IFS= read line; do
|
||||
:
|
||||
done
|
||||
fi
|
||||
}
|
||||
|
||||
# locate the script that should be tested
|
||||
locate_bin() {
|
||||
local scriptdir="${PMTEST_SCRIPT_DIR:-"$(dirname "$0")/../../../scripts"}"
|
||||
local script="$(realpath "${1:-"$scriptdir/makepkg-wrapper"}")"
|
||||
if ! type -p "$script" &>/dev/null; then
|
||||
tap_xbail "makepkg executable (%s) could not be located" "${script}"
|
||||
exit 1
|
||||
fi
|
||||
printf "%s" "$script"
|
||||
}
|
||||
|
||||
# locate an source libmakepkg files
|
||||
source_libmakepkg_file() {
|
||||
local file=$1; shift 1
|
||||
local scriptdir="${PMTEST_SCRIPT_DIR:-"$(dirname "$0")/../../../scripts"}"
|
||||
local libdir="${PMTEST_LIBMAKEPKG_DIR:-"$scriptdir/libmakepkg"}"
|
||||
source "$(realpath "$libdir/$file")"
|
||||
}
|
||||
|
||||
# eval a piece of code and test the return value
|
||||
# tap_eval $code $test_name...
|
||||
tap_eval() {
|
||||
local t=$1; shift 1
|
||||
eval "$t"
|
||||
tap_ok $? "$@"
|
||||
}
|
||||
|
||||
# extract ls-style information about a file:
|
||||
# mode nhardlinks user group size month date time/year filename
|
||||
_ar_stat() {
|
||||
local ar=$1 path=$2; shift 2
|
||||
bsdtar --fast-read -tvf "$ar" "$@" "$path" 2>/dev/null
|
||||
}
|
||||
|
||||
# same as _ar_stat but with numeric owner ids
|
||||
_ar_nstat() {
|
||||
local ar=$1 path=$2; shift 2
|
||||
_ar_stat "$ar" "$path" --numeric-owner "$@"
|
||||
}
|
||||
|
||||
# check the owner of a given file, owner may be a numeric id or user name
|
||||
# tap_ar_is_owner $path_to_archive $file $expected_owner $test_name...
|
||||
tap_ar_is_owner() {
|
||||
local ar=$1 path=$2 expect=$3; shift 3
|
||||
local statfun="_ar_stat" owner unused
|
||||
[[ $expect =~ ^[0-9]+$ ]] && statfun="_ar_nstat"
|
||||
if ! read -r unused unused owner unused < <($statfun "$ar" "$path"); then
|
||||
tap_ok 1 "$@"
|
||||
tap_diag " got: invalid path"
|
||||
tap_diag " expected: '%s'" "$expect"
|
||||
elif [[ $owner != $expect ]]; then
|
||||
tap_ok 1 "$@"
|
||||
tap_diag " got: '%s'" "$owner"
|
||||
tap_diag " expected: '%s'" "$expect"
|
||||
else
|
||||
tap_ok 0 "$@"
|
||||
fi
|
||||
}
|
||||
|
||||
# check the group of a given file, group may be a numeric id or user name
|
||||
# tap_ar_is_group $path_to_archive $file $expected_group $test_name...
|
||||
tap_ar_is_group() {
|
||||
local ar=$1 path=$2 expect=$3; shift 3
|
||||
local statfun="_ar_stat" group unused
|
||||
[[ $expect =~ ^[0-9]+$ ]] && statfun="_ar_nstat"
|
||||
if ! read -r unused unused unused group unused < <($statfun "$ar" "$path"); then
|
||||
tap_ok 1 "$@"
|
||||
tap_diag " got: invalid path"
|
||||
tap_diag " expected: '%s'" "$expect"
|
||||
elif [[ $group != $expect ]]; then
|
||||
tap_ok 1 "$@"
|
||||
tap_diag " got: '%s'" "$group"
|
||||
tap_diag " expected: '%s'" "$expect"
|
||||
else
|
||||
tap_ok 0 "$@"
|
||||
fi
|
||||
}
|
||||
|
||||
# check if a path within an archive refers to a file
|
||||
# tap_ar_is_file $path_to_archive $file $test_name...
|
||||
tap_ar_is_file() {
|
||||
local ar=$1 path=$2; shift 2
|
||||
local stat="$(_ar_stat "$ar" "$path")"
|
||||
if [[ ${stat:0:1} != '-' ]]; then
|
||||
tap_ok 1 "$@"
|
||||
tap_diag " got: not a file"
|
||||
tap_diag " expected: '%s'" "$path"
|
||||
else
|
||||
tap_ok 0 "$@"
|
||||
fi
|
||||
}
|
||||
|
||||
# check if a path within an archive refers to a symbolic link
|
||||
# tap_ar_is_link $path_to_archive $file $expected_destination $test_name...
|
||||
tap_ar_is_link() {
|
||||
local ar=$1 path=$2 dest=$3; shift 3
|
||||
local stat="$(_ar_stat "$ar" "$path")"
|
||||
if [[ ${stat:0:1} != 'l' ]]; then
|
||||
tap_ok 1 "$@"
|
||||
tap_diag " got: not a link"
|
||||
tap_diag " expected: '%s'" "$dest"
|
||||
elif [[ ${stat##*$path -> } != $dest ]]; then
|
||||
tap_ok 1 "$@"
|
||||
tap_diag " got: '%s'" "${stat##*$path -> }"
|
||||
tap_diag " expected: '%s'" "$dest"
|
||||
else
|
||||
tap_ok 0 "$@"
|
||||
fi
|
||||
}
|
||||
|
||||
source "$(dirname "$0")"/../../tap.sh || exit 1
|
||||
tap_init
|
||||
@@ -1,7 +0,0 @@
|
||||
check_SCRIPTS = $(wildcard *.sh)
|
||||
|
||||
noinst_SCRIPTS = $(check_SCRIPTS)
|
||||
|
||||
EXTRA_DIST = $(check_SCRIPTS)
|
||||
|
||||
# vim:set noet:
|
||||
@@ -1,4 +0,0 @@
|
||||
TESTS += test/makepkg/tests/dbfiles.sh
|
||||
TESTS += test/makepkg/tests/dotfiles.sh
|
||||
TESTS += test/makepkg/tests/pkgbuild.sh
|
||||
TESTS += test/makepkg/tests/util-pkgbuild.sh
|
||||
@@ -1,35 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
source "$(dirname "$0")"/../test_functions.sh || exit 1
|
||||
|
||||
script="$(locate_bin "${1:-}")"
|
||||
|
||||
TMPDIR="$(mktemp -d --tmpdir "${0##*/}.XXXXXX")"
|
||||
trap "rm -rf '${TMPDIR}'" EXIT TERM
|
||||
|
||||
tap_note "check that required metadata files are created"
|
||||
tap_note "testing '%s'" "$script"
|
||||
tap_note "using test dir '%s'" "$TMPDIR"
|
||||
|
||||
(
|
||||
set -e
|
||||
cd "$TMPDIR"
|
||||
cat >PKGBUILD <<-'PKGBUILD'
|
||||
pkgname=foo
|
||||
pkgver=1
|
||||
pkgrel=1
|
||||
arch=(any)
|
||||
PKGBUILD
|
||||
MAKEPKG_CONF="/dev/null" PKGEXT=".pkg.tar" $script
|
||||
) |& tap_filter
|
||||
[[ $? -eq 0 ]] || tap_xbail "test setup failed"
|
||||
|
||||
pkgfile="$TMPDIR/foo-1-1-any.pkg.tar"
|
||||
|
||||
tap_plan 10
|
||||
for f in .BUILDINFO .PKGINFO .MTREE; do
|
||||
tap_ar_is_file "$pkgfile" "$f" "pkg contains %s" "$f"
|
||||
tap_ar_is_owner "$pkgfile" "$f" "0" "%s owner is root" "$f"
|
||||
tap_ar_is_group "$pkgfile" "$f" "0" "%s group is root" "$f"
|
||||
done
|
||||
tap_is_int "$(bsdtar -tf "$pkgfile" | wc -l)" 3 "pkg only contains known metainfo files"
|
||||
@@ -1,33 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
source "$(dirname "$0")"/../test_functions.sh || exit 1
|
||||
|
||||
script="$(locate_bin "${1:-}")"
|
||||
|
||||
TMPDIR="$(mktemp -d --tmpdir "${0##*/}.XXXXXX")"
|
||||
[[ ${KEEPFILES:-0} == 0 ]] || trap "rm -rf '${TMPDIR}'" EXIT TERM
|
||||
|
||||
tap_note "test that dotfiles don't make it into the package root"
|
||||
tap_note "testing '%s'" "$script"
|
||||
tap_note "using test dir '%s'" "$TMPDIR"
|
||||
|
||||
output="$(
|
||||
set -e
|
||||
cd "$TMPDIR"
|
||||
cat >PKGBUILD <<-'PKGBUILD'
|
||||
pkgname=foo
|
||||
pkgver=1
|
||||
pkgrel=1
|
||||
arch=(any)
|
||||
package() {
|
||||
touch "$pkgdir"/.dotfile
|
||||
}
|
||||
PKGBUILD
|
||||
MAKEPKG_CONF="/dev/null" PKGEXT=".pkg.tar" $script 2>&1
|
||||
)"
|
||||
ret=$?
|
||||
|
||||
tap_plan 3
|
||||
tap_eval "[[ '$ret' -ne 0 ]]" "makepkg exited non-zero"
|
||||
tap_eval "[[ ! -f '$TMPDIR/foo-1-1-any.pkg.tar' ]]" "no package was built"
|
||||
tap_eval "[[ '$output' = *'Dotfile found in package root'* ]]" "error message references dotfile"
|
||||
@@ -1,53 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
source "$(dirname "$0")"/../test_functions.sh || exit 1
|
||||
|
||||
script="$(locate_bin "${1:-}")"
|
||||
|
||||
TMPDIR="$(mktemp -d --tmpdir "${0##*/}.XXXXXX")"
|
||||
trap "rm -rf '${TMPDIR}'" EXIT TERM
|
||||
|
||||
tap_note "basic package building test"
|
||||
tap_note "testing '%s'" "$script"
|
||||
tap_note "using test dir '%s'" "$TMPDIR"
|
||||
|
||||
(
|
||||
set -e
|
||||
cd "$TMPDIR"
|
||||
cat >PKGBUILD <<-'PKGBUILD'
|
||||
pkgname=foo
|
||||
pkgver=1
|
||||
pkgrel=1
|
||||
arch=(any)
|
||||
package() {
|
||||
touch "$pkgdir/!first"
|
||||
touch "$pkgdir/target"
|
||||
ln -s target "$pkgdir/link"
|
||||
mkdir "$pkgdir/dir"
|
||||
touch "$pkgdir/dir/.dotfile"
|
||||
}
|
||||
PKGBUILD
|
||||
MAKEPKG_CONF="/dev/null" PKGEXT=".pkg.tar" $script
|
||||
) |& tap_filter
|
||||
[[ $? -eq 0 ]] || tap_xbail "test setup failed"
|
||||
|
||||
pkgfile="$TMPDIR/foo-1-1-any.pkg.tar"
|
||||
|
||||
tap_plan 10
|
||||
tap_ar_is_file "$pkgfile" "!first" "pkg contains !first"
|
||||
tap_ar_is_file "$pkgfile" "target" "pkg contains target"
|
||||
tap_ar_is_file "$pkgfile" "dir/.dotfile" "pkg contains dir/.dotfile"
|
||||
tap_ar_is_link "$pkgfile" "link" "target" "pkg contains link to target"
|
||||
tap_ar_is_owner "$pkgfile" "target" "0" "target owner is root"
|
||||
tap_ar_is_group "$pkgfile" "target" "0" "target group is root"
|
||||
|
||||
tap_eval "! bsdtar -tf '$pkgfile' | grep -qE '^\\.?\\.?/'" \
|
||||
"package paths are relative without leading dot dirs"
|
||||
tap_eval "bsdtar -tf '$pkgfile' | grep -v '^\\.' | LANG=C sort -Cu" \
|
||||
"package files are sorted"
|
||||
tap_eval "bsdtar -tf '$pkgfile' | LANG=C sort | LANG=C sort -Cu" \
|
||||
"package files are unique"
|
||||
tap_eval "bsdtar -tf '$pkgfile' | head -n1 | grep -q '^\\.'" \
|
||||
"db files are placed at the beginning of the package"
|
||||
|
||||
tap_finish
|
||||
@@ -1,35 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
source "$(dirname "$0")"/../test_functions.sh || exit 1
|
||||
|
||||
tap_note "testing libmakepkg/util/pkgbuild.sh"
|
||||
|
||||
source_libmakepkg_file 'util/pkgbuild.sh'
|
||||
|
||||
test_foo() {
|
||||
myarray=(foo bar)
|
||||
myarray+=(baz)
|
||||
#myarray+=(this should be ignored)
|
||||
myscalar=baz
|
||||
myscalar=quux
|
||||
#myscalar=ignored
|
||||
}
|
||||
|
||||
declare -a oarray
|
||||
declare oscalar
|
||||
|
||||
tap_plan 9
|
||||
|
||||
tap_eval 'have_function test_foo' 'detected existing function test_foo'
|
||||
tap_eval '! have_function test_bar' 'detected missing function test_bar'
|
||||
|
||||
tap_eval 'extract_function_variable test_foo myarray 1 oarray' 'extract array variable'
|
||||
tap_is_int "${#oarray[@]}" 3 'extracted array length'
|
||||
tap_is_str "${oarray[0]}" 'foo' 'extracted array contents'
|
||||
tap_is_str "${oarray[1]}" 'bar' 'extracted array contents'
|
||||
tap_is_str "${oarray[2]}" 'baz' 'extracted array contents'
|
||||
|
||||
tap_eval 'extract_function_variable test_foo myscalar 0 oscalar' 'extract scalar variable'
|
||||
tap_is_str "$oscalar" 'quux' 'extracted scalar value'
|
||||
|
||||
tap_finish
|
||||
@@ -342,19 +342,26 @@ foreach testobj : pacman_tests
|
||||
input = testobj.get('name')
|
||||
test_name = input.split('/')[1]
|
||||
should_fail = testobj.get('should_fail', false)
|
||||
args = [
|
||||
join_paths(meson.source_root(), 'build-aux/tap-driver.py'),
|
||||
join_paths(meson.current_source_dir(), 'pactest.py'),
|
||||
'--scriptlet-shell', get_option('scriptlet-shell'),
|
||||
'--bindir', meson.build_root(),
|
||||
'--ldconfig', LDCONFIG,
|
||||
'--verbose',
|
||||
join_paths(meson.current_source_dir(), input)
|
||||
]
|
||||
if not conf.get('HAVE_LIBCURL')
|
||||
args += '--without-curl'
|
||||
endif
|
||||
if not conf.get('HAVE_LIBGPGME')
|
||||
args += '--without-gpg'
|
||||
endif
|
||||
|
||||
test(
|
||||
test_name,
|
||||
PYTHON,
|
||||
args : [
|
||||
join_paths(meson.source_root(), 'build-aux/tap-driver.py'),
|
||||
join_paths(meson.current_source_dir(), 'pactest.py'),
|
||||
'--scriptlet-shell', get_option('scriptlet-shell'),
|
||||
'--bindir', meson.build_root(),
|
||||
'--ldconfig', LDCONFIG,
|
||||
'--verbose',
|
||||
join_paths(meson.current_source_dir(), input)
|
||||
],
|
||||
args : args,
|
||||
depends : [pacman_bin],
|
||||
should_fail : should_fail)
|
||||
endforeach
|
||||
|
||||
@@ -77,6 +77,15 @@ def create_parser():
|
||||
parser.add_option("--bindir", type = "string",
|
||||
dest = "bindir", action = "append",
|
||||
help = "specify location of binaries")
|
||||
parser.add_option("--without-gpg", action = "store_true",
|
||||
dest = "missing_gpg", default = False,
|
||||
help = "skip gpg-related tests")
|
||||
parser.add_option("--without-curl", action = "store_true",
|
||||
dest = "missing_curl", default = False,
|
||||
help = "skip downloader-related tests")
|
||||
parser.add_option("--without-nls", action = "store_true",
|
||||
dest = "missing_nls", default = False,
|
||||
help = "skip translation-related tests")
|
||||
parser.add_option("--keep-root", action = "store_true",
|
||||
dest = "keeproot", default = False,
|
||||
help = "don't remove the generated pacman root filesystem")
|
||||
@@ -137,6 +146,9 @@ if __name__ == "__main__":
|
||||
env.pacman["manual-confirm"] = opts.manualconfirm
|
||||
env.pacman["scriptlet-shell"] = opts.scriptletshell
|
||||
env.pacman["ldconfig"] = opts.ldconfig
|
||||
env.config["gpg"] = not opts.missing_gpg
|
||||
env.config["nls"] = not opts.missing_nls
|
||||
env.config["curl"] = not opts.missing_curl
|
||||
|
||||
try:
|
||||
for i in args:
|
||||
@@ -160,6 +172,3 @@ if __name__ == "__main__":
|
||||
shutil.rmtree(root_path)
|
||||
else:
|
||||
tap.diag("pacman testing root saved: %s" % root_path)
|
||||
|
||||
if env.failed > 0:
|
||||
sys.exit(1)
|
||||
|
||||
@@ -24,12 +24,7 @@ import tap
|
||||
class pmenv(object):
|
||||
"""Environment object
|
||||
"""
|
||||
|
||||
testcases = []
|
||||
passed = 0
|
||||
failed = 0
|
||||
expectedfail = 0
|
||||
unexpectedpass = 0
|
||||
|
||||
def __init__(self, root = "root"):
|
||||
self.root = os.path.abspath(root)
|
||||
@@ -41,6 +36,11 @@ class pmenv(object):
|
||||
"valgrind": 0,
|
||||
"nolog": 0
|
||||
}
|
||||
self.config = {
|
||||
"gpg": True,
|
||||
"nls": True,
|
||||
"curl": True
|
||||
}
|
||||
|
||||
def __str__(self):
|
||||
return "root = %s\n" \
|
||||
@@ -57,15 +57,18 @@ class pmenv(object):
|
||||
def run(self):
|
||||
"""
|
||||
"""
|
||||
tap.plan(len(self.testcases))
|
||||
for testcase in self.testcases:
|
||||
t = pmtest.pmtest(testcase, self.root)
|
||||
tap.diag("Running '%s'" % t.testname)
|
||||
|
||||
t = pmtest.pmtest(testcase, self.root, self.config)
|
||||
t.load()
|
||||
t.generate(self.pacman)
|
||||
t.run(self.pacman)
|
||||
if t.skipall:
|
||||
tap.skip_all("skipping %s (%s)" % (t.description, t.skipall))
|
||||
else:
|
||||
tap.plan(1)
|
||||
tap.diag("Running '%s'" % t.testname)
|
||||
|
||||
tap.diag("==> Checking rules")
|
||||
tap.todo = t.expectfailure
|
||||
tap.subtest(lambda: t.check(), t.description)
|
||||
t.generate(self.pacman)
|
||||
t.run(self.pacman)
|
||||
|
||||
tap.diag("==> Checking rules")
|
||||
tap.todo = t.expectfailure
|
||||
tap.subtest(lambda: t.check(), t.description)
|
||||
|
||||
@@ -33,12 +33,13 @@ class pmtest(object):
|
||||
"""Test object
|
||||
"""
|
||||
|
||||
def __init__(self, name, root):
|
||||
def __init__(self, name, root, config):
|
||||
self.name = name
|
||||
self.testname = os.path.basename(name).replace('.py', '')
|
||||
self.root = root
|
||||
self.dbver = 9
|
||||
self.cachepkgs = True
|
||||
self.config = config
|
||||
self.cmd = ["pacman", "--noconfirm",
|
||||
"--config", self.configfile(),
|
||||
"--root", self.rootdir(),
|
||||
@@ -101,6 +102,7 @@ class pmtest(object):
|
||||
self.rules = []
|
||||
self.files = []
|
||||
self.expectfailure = False
|
||||
self.skipall = False
|
||||
|
||||
if os.path.isfile(self.name):
|
||||
# all tests expect this to be available
|
||||
@@ -201,6 +203,10 @@ class pmtest(object):
|
||||
self.files.append(f)
|
||||
vprint("\t%s" % f.name)
|
||||
|
||||
def require_capability(self, cap):
|
||||
if not self.config[cap]:
|
||||
self.skipall = "missing capability " + cap
|
||||
|
||||
def add_hook(self, name, content):
|
||||
if not name.endswith(".hook"):
|
||||
name = name + ".hook"
|
||||
|
||||
@@ -21,6 +21,11 @@ failed = 0
|
||||
def _output(msg):
|
||||
print("%s%s" % (" "*level, str(msg).replace("\n", "\\n")))
|
||||
|
||||
def skip_all(description=""):
|
||||
if description:
|
||||
description = " # " + description
|
||||
_output("1..0%s" % (description))
|
||||
|
||||
def ok(ok, description=""):
|
||||
global count, failed
|
||||
count += 1
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
self.description = "Add a bogus signature to a package DB"
|
||||
self.require_capability("gpg")
|
||||
|
||||
sp = pmpkg("pkg1")
|
||||
sp.pgpsig = "asdfasdfsdfasdfsdafasdfsdfasd"
|
||||
|
||||
Reference in New Issue
Block a user