mirror of
https://gitlab.archlinux.org/pacman/pacman.git
synced 2025-11-30 05:24:40 +01:00
Compare commits
88 Commits
v5.1.3
...
andrew/tes
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b24d664309 | ||
|
|
555c8ff976 | ||
|
|
6b541404cc | ||
|
|
281cdb2e1c | ||
|
|
b109d7096b | ||
|
|
77b8ca7032 | ||
|
|
d73fed4e13 | ||
|
|
b67ec90520 | ||
|
|
36a5069a59 | ||
|
|
f28ddd9d93 | ||
|
|
9f1b735d76 | ||
|
|
65e09705d3 | ||
|
|
f615f7bd5a | ||
|
|
5fc3056e6a | ||
|
|
e1b9dc6bea | ||
|
|
71f837e45e | ||
|
|
83a16d3041 | ||
|
|
363664e47d | ||
|
|
fbc6d8b428 | ||
|
|
6e819c819a | ||
|
|
b95ba13df1 | ||
|
|
44cfc09511 | ||
|
|
61fe738043 | ||
|
|
3726693612 | ||
|
|
508b4e3ec0 | ||
|
|
0bb04fa16a | ||
|
|
d81b5cc2a5 | ||
|
|
1aaf95089a | ||
|
|
926eb345c2 | ||
|
|
c41222837d | ||
|
|
0dd1492442 | ||
|
|
de915c4f14 | ||
|
|
3dfec574a3 | ||
|
|
635a9c911c | ||
|
|
d230ec6f17 | ||
|
|
51db84750e | ||
|
|
dab45f0808 | ||
|
|
b5d62d2c91 | ||
|
|
3561c872ca | ||
|
|
882e707e40 | ||
|
|
b5191ea140 | ||
|
|
e12d032174 | ||
|
|
ea877c596b | ||
|
|
c887d2cf00 | ||
|
|
ac959bb9c6 | ||
|
|
9886566abb | ||
|
|
2c91d08e62 | ||
|
|
79a528735e | ||
|
|
02255fd97e | ||
|
|
8c9046e604 | ||
|
|
afb9c0140f | ||
|
|
ffde85aadf | ||
|
|
d96d0ffe7c | ||
|
|
7afe51171f | ||
|
|
bae74c8e9e | ||
|
|
cd7b2d6e07 | ||
|
|
192d6166e9 | ||
|
|
b54b33d816 | ||
|
|
3d5a056452 | ||
|
|
961ef1a4c8 | ||
|
|
2bec380e10 | ||
|
|
3318039e3b | ||
|
|
ba2984db3e | ||
|
|
58c76daf5e | ||
|
|
d03409ccde | ||
|
|
62eef5bbdb | ||
|
|
5b2ff51c39 | ||
|
|
16f6aae330 | ||
|
|
48c8f9f2a2 | ||
|
|
0696307a3b | ||
|
|
3370c08a29 | ||
|
|
3e9a62e721 | ||
|
|
9fde55c0c7 | ||
|
|
8b2f3323b8 | ||
|
|
2d8d8af915 | ||
|
|
7d05ffceaf | ||
|
|
e4be26b732 | ||
|
|
4e83abaae5 | ||
|
|
92bc0a4740 | ||
|
|
b0a8f44f10 | ||
|
|
885bbb504a | ||
|
|
9e960d9d5a | ||
|
|
7f1f1355bb | ||
|
|
0937d322ba | ||
|
|
7edbbd9a63 | ||
|
|
f2788244d3 | ||
|
|
0cbb128818 | ||
|
|
fd16da2ed6 |
250
.ycm_extra_conf.py
Normal file
250
.ycm_extra_conf.py
Normal file
@@ -0,0 +1,250 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
# SPDX-License-Identifier: Unlicense
|
||||
#
|
||||
# Based on the template file provided by the 'YCM-Generator' project authored by
|
||||
# Reuben D'Netto.
|
||||
# Jiahui Xie has re-reformatted and expanded the original script in accordance
|
||||
# to the requirements of the PEP 8 style guide and 'systemd' project,
|
||||
# respectively.
|
||||
#
|
||||
# The original license is preserved as it is.
|
||||
#
|
||||
#
|
||||
# This is free and unencumbered software released into the public domain.
|
||||
#
|
||||
# Anyone is free to copy, modify, publish, use, compile, sell, or
|
||||
# distribute this software, either in source code form or as a compiled
|
||||
# binary, for any purpose, commercial or non-commercial, and by any
|
||||
# means.
|
||||
#
|
||||
# In jurisdictions that recognize copyright laws, the author or authors
|
||||
# of this software dedicate any and all copyright interest in the
|
||||
# software to the public domain. We make this dedication for the benefit
|
||||
# of the public at large and to the detriment of our heirs and
|
||||
# successors. We intend this dedication to be an overt act of
|
||||
# relinquishment in perpetuity of all present and future rights to this
|
||||
# software under copyright law.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
# IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
||||
# OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
# ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||
# OTHER DEALINGS IN THE SOFTWARE.
|
||||
#
|
||||
# For more information, please refer to <http://unlicense.org/>
|
||||
|
||||
"""
|
||||
YouCompleteMe configuration file tailored to support the 'meson' build system
|
||||
used by the 'systemd' project.
|
||||
"""
|
||||
|
||||
import glob
|
||||
import os
|
||||
import ycm_core
|
||||
|
||||
|
||||
SOURCE_EXTENSIONS = (".C", ".cpp", ".cxx", ".cc", ".c", ".m", ".mm")
|
||||
HEADER_EXTENSIONS = (".H", ".h", ".hxx", ".hpp", ".hh")
|
||||
|
||||
|
||||
def DirectoryOfThisScript():
|
||||
"""
|
||||
Return the absolute path of the parent directory containing this
|
||||
script.
|
||||
"""
|
||||
return os.path.dirname(os.path.abspath(__file__))
|
||||
|
||||
|
||||
def GuessBuildDirectory():
|
||||
"""
|
||||
Guess the build directory using the following heuristics:
|
||||
|
||||
1. Returns the current directory of this script plus 'build'
|
||||
subdirectory in absolute path if this subdirectory exists.
|
||||
|
||||
2. Otherwise, probes whether there exists any directory
|
||||
containing '.ninja_log' file two levels above the current directory;
|
||||
returns this single directory only if there is one candidate.
|
||||
"""
|
||||
result = os.path.join(DirectoryOfThisScript(), "build")
|
||||
|
||||
if os.path.exists(result):
|
||||
return result
|
||||
|
||||
result = glob.glob(os.path.join(DirectoryOfThisScript(),
|
||||
"..", "..", "*", ".ninja_log"))
|
||||
|
||||
if not result:
|
||||
return ""
|
||||
|
||||
if 1 != len(result):
|
||||
return ""
|
||||
|
||||
return os.path.split(result[0])[0]
|
||||
|
||||
|
||||
def TraverseByDepth(root, include_extensions):
|
||||
"""
|
||||
Return a set of child directories of the 'root' containing file
|
||||
extensions specified in 'include_extensions'.
|
||||
|
||||
NOTE:
|
||||
1. The 'root' directory itself is excluded from the result set.
|
||||
2. No subdirectories would be excluded if 'include_extensions' is left
|
||||
to 'None'.
|
||||
3. Each entry in 'include_extensions' must begin with string '.'.
|
||||
"""
|
||||
is_root = True
|
||||
result = set()
|
||||
# Perform a depth first top down traverse of the given directory tree.
|
||||
for root_dir, subdirs, file_list in os.walk(root):
|
||||
if not is_root:
|
||||
# print("Relative Root: ", root_dir)
|
||||
# print(subdirs)
|
||||
if include_extensions:
|
||||
get_ext = os.path.splitext
|
||||
subdir_extensions = {
|
||||
get_ext(f)[-1] for f in file_list if get_ext(f)[-1]
|
||||
}
|
||||
if subdir_extensions & include_extensions:
|
||||
result.add(root_dir)
|
||||
else:
|
||||
result.add(root_dir)
|
||||
else:
|
||||
is_root = False
|
||||
|
||||
return result
|
||||
|
||||
|
||||
_project_src_dir = os.path.join(DirectoryOfThisScript(), "src")
|
||||
_include_dirs_set = TraverseByDepth(_project_src_dir, frozenset({".h"}))
|
||||
flags = [
|
||||
"-x",
|
||||
"c"
|
||||
# The following flags are partially redundant due to the existence of
|
||||
# 'compile_commands.json'.
|
||||
# '-Wall',
|
||||
# '-Wextra',
|
||||
# '-Wfloat-equal',
|
||||
# '-Wpointer-arith',
|
||||
# '-Wshadow',
|
||||
# '-std=gnu99',
|
||||
]
|
||||
|
||||
for include_dir in _include_dirs_set:
|
||||
flags.append("-I" + include_dir)
|
||||
|
||||
# Set this to the absolute path to the folder (NOT the file!) containing the
|
||||
# compile_commands.json file to use that instead of 'flags'. See here for
|
||||
# more details: http://clang.llvm.org/docs/JSONCompilationDatabase.html
|
||||
#
|
||||
# You can get CMake to generate this file for you by adding:
|
||||
# set( CMAKE_EXPORT_COMPILE_COMMANDS 1 )
|
||||
# to your CMakeLists.txt file.
|
||||
#
|
||||
# Most projects will NOT need to set this to anything; you can just change the
|
||||
# 'flags' list of compilation flags. Notice that YCM itself uses that approach.
|
||||
compilation_database_folder = GuessBuildDirectory()
|
||||
|
||||
if os.path.exists(compilation_database_folder):
|
||||
database = ycm_core.CompilationDatabase(compilation_database_folder)
|
||||
else:
|
||||
database = None
|
||||
|
||||
|
||||
def MakeRelativePathsInFlagsAbsolute(flags, working_directory):
|
||||
"""
|
||||
Iterate through 'flags' and replace the relative paths prefixed by
|
||||
'-isystem', '-I', '-iquote', '--sysroot=' with absolute paths
|
||||
start with 'working_directory'.
|
||||
"""
|
||||
if not working_directory:
|
||||
return list(flags)
|
||||
new_flags = []
|
||||
make_next_absolute = False
|
||||
path_flags = ["-isystem", "-I", "-iquote", "--sysroot="]
|
||||
for flag in flags:
|
||||
new_flag = flag
|
||||
|
||||
if make_next_absolute:
|
||||
make_next_absolute = False
|
||||
if not flag.startswith("/"):
|
||||
new_flag = os.path.join(working_directory, flag)
|
||||
|
||||
for path_flag in path_flags:
|
||||
if flag == path_flag:
|
||||
make_next_absolute = True
|
||||
break
|
||||
|
||||
if flag.startswith(path_flag):
|
||||
path = flag[len(path_flag):]
|
||||
new_flag = path_flag + os.path.join(working_directory, path)
|
||||
break
|
||||
|
||||
if new_flag:
|
||||
new_flags.append(new_flag)
|
||||
return new_flags
|
||||
|
||||
|
||||
def IsHeaderFile(filename):
|
||||
"""
|
||||
Check whether 'filename' is considered as a header file.
|
||||
"""
|
||||
extension = os.path.splitext(filename)[1]
|
||||
return extension in HEADER_EXTENSIONS
|
||||
|
||||
|
||||
def GetCompilationInfoForFile(filename):
|
||||
"""
|
||||
Helper function to look up compilation info of 'filename' in the 'database'.
|
||||
"""
|
||||
# The compilation_commands.json file generated by CMake does not have
|
||||
# entries for header files. So we do our best by asking the db for flags for
|
||||
# a corresponding source file, if any. If one exists, the flags for that
|
||||
# file should be good enough.
|
||||
if not database:
|
||||
return None
|
||||
|
||||
if IsHeaderFile(filename):
|
||||
basename = os.path.splitext(filename)[0]
|
||||
for extension in SOURCE_EXTENSIONS:
|
||||
replacement_file = basename + extension
|
||||
if os.path.exists(replacement_file):
|
||||
compilation_info = \
|
||||
database.GetCompilationInfoForFile(replacement_file)
|
||||
if compilation_info.compiler_flags_:
|
||||
return compilation_info
|
||||
return None
|
||||
return database.GetCompilationInfoForFile(filename)
|
||||
|
||||
|
||||
def FlagsForFile(filename, **kwargs):
|
||||
"""
|
||||
Callback function to be invoked by YouCompleteMe in order to get the
|
||||
information necessary to compile 'filename'.
|
||||
|
||||
It returns a dictionary with a single element 'flags'. This element is a
|
||||
list of compiler flags to pass to libclang for the file 'filename'.
|
||||
"""
|
||||
if database:
|
||||
# Bear in mind that compilation_info.compiler_flags_ does NOT return a
|
||||
# python list, but a "list-like" StringVec object
|
||||
compilation_info = GetCompilationInfoForFile(filename)
|
||||
if not compilation_info:
|
||||
return None
|
||||
|
||||
final_flags = MakeRelativePathsInFlagsAbsolute(
|
||||
compilation_info.compiler_flags_,
|
||||
compilation_info.compiler_working_dir_)
|
||||
|
||||
else:
|
||||
relative_to = DirectoryOfThisScript()
|
||||
final_flags = MakeRelativePathsInFlagsAbsolute(flags, relative_to)
|
||||
|
||||
return {
|
||||
"flags": final_flags,
|
||||
"do_cache": True
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
SUBDIRS = lib/libalpm src/util src/pacman scripts etc test/pacman test/util test/scripts
|
||||
SUBDIRS = lib/libalpm src/util src/pacman scripts etc test/makepkg test/pacman test/util test/scripts
|
||||
if WANT_DOC
|
||||
SUBDIRS += doc
|
||||
endif
|
||||
@@ -9,7 +9,8 @@ ACLOCAL_AMFLAGS = -I m4 --install
|
||||
AM_MAKEFLAGS = --no-print-directory
|
||||
|
||||
# Make sure we test and build manpages when doing distcheck
|
||||
DISTCHECK_CONFIGURE_FLAGS = --enable-doc --disable-git-version
|
||||
DISTCHECK_CONFIGURE_FLAGS = --enable-doc --disable-git-version \
|
||||
bashcompdir='$${prefix}/share/bash-completion/completions'
|
||||
|
||||
# Some files automatically included, so they aren't specified below:
|
||||
# AUTHORS, COPYING, NEWS, README
|
||||
@@ -26,11 +27,15 @@ 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
|
||||
|
||||
33
NEWS
33
NEWS
@@ -1,5 +1,20 @@
|
||||
VERSION DESCRIPTION
|
||||
-----------------------------------------------------------------------------
|
||||
5.1.2 - pacman-conf: add missing DisableDownloadTimeout support
|
||||
- Include version when checking optdepend install status
|
||||
during -Qi (FS#60106)
|
||||
- Improve error message for unresolvable urls (FS#48285)
|
||||
- Do not raise SIGINT when a downloaded file exceeds the expected
|
||||
size
|
||||
- Fix previous download interruption status carrying over to new
|
||||
downloads
|
||||
- Reset known signal handlers before running install scripts or
|
||||
hooks (FS#56756)
|
||||
- Properly handle signal interrupts while running install scripts
|
||||
or hooks (FS#60396)
|
||||
- Allow explicitly disabling signature checks when compiled
|
||||
without signature support (FS#60880)
|
||||
- makepkg: fix linting error on environment variables (FS#60681)
|
||||
5.1.1 - Allow full path including root prefix to be passed to
|
||||
--overwrite
|
||||
- Revert deprecation of --root
|
||||
@@ -129,6 +144,24 @@ VERSION DESCRIPTION
|
||||
- vercmp:
|
||||
- remove duplicate, undocumented --usage option
|
||||
- fail when the wrong number of arguments are used (FS#49093)
|
||||
5.0.2 - fix database file checks with -Qkk and non-standard root
|
||||
(FS#48563)
|
||||
- improve optdepend detection for status messages (FS#44957)
|
||||
- make Y/N prompt multi-byte-character aware (FS#47992)
|
||||
- properly detect dependency cycles with --recursive (FS#41031)
|
||||
- improve free disk space calculation (FS#37402)
|
||||
- extract database files with --dbonly (FS#52052)
|
||||
- repo-add:
|
||||
- do not alter the database if only verifying signature
|
||||
(FS#48085)
|
||||
- fix error for directories containing whitespace (FS#50285)
|
||||
- makepkg:
|
||||
- fix building packages with only architecture-specific
|
||||
sources (FS#48340)
|
||||
- ignore PKGBUILD architecture for --printsrcinfo
|
||||
- do not die on non-empty directories under !emptydirs
|
||||
(FS#48515)
|
||||
- preserve checksum type for architecture-specific sources
|
||||
5.0.1 - fix alignment issues with wide character locales (FS#47980)
|
||||
- fix removal of .pacnew files (FS#47993)
|
||||
- fix triggering of Install hooks (FS#47996)
|
||||
|
||||
33
build-aux/edit-script.sh.in
Normal file
33
build-aux/edit-script.sh.in
Normal file
@@ -0,0 +1,33 @@
|
||||
#!@BASH@
|
||||
|
||||
input=$1
|
||||
output=$2
|
||||
mode=$3
|
||||
|
||||
"@SED@" \
|
||||
-e "s|@rootdir[@]|@ROOTDIR@|g" \
|
||||
-e "s|@localedir[@]|@LOCALEDIR@|g" \
|
||||
-e "s|@sysconfdir[@]|@sysconfdir@|g" \
|
||||
-e "s|@localstatedir[@]|@localstatedir@|g" \
|
||||
-e "s|@libmakepkgdir[@]|@LIBMAKEPKGDIR@|g" \
|
||||
-e "s|@pkgdatadir[@]|@PKGDATADIR@|g" \
|
||||
-e "s|@prefix[@]|@PREFIX@|g" \
|
||||
-e "1s|#!/bin/bash|#!@BASH@|g" \
|
||||
-e "s|@PACKAGE_VERSION[@]|@PACKAGE_VERSION@|g" \
|
||||
-e "s|@PACKAGE_NAME[@]|@PACKAGE_NAME@|g" \
|
||||
-e "s|@BUILDSCRIPT[@]|@BUILDSCRIPT@|g" \
|
||||
-e "s|@TEMPLATE_DIR[@]|@TEMPLATE_DIR@|g" \
|
||||
-e "s|@DEBUGSUFFIX[@]|@DEBUGSUFFIX@|g" \
|
||||
-e "s|@INODECMD[@]|@INODECMD@|g" \
|
||||
-e "s|@OWNERCMD[@]|@OWNERCMD@|g" \
|
||||
-e "s|@MODECMD[@]|@MODECMD@|g" \
|
||||
-e "s|@SEDINPLACEFLAGS[@]|@SEDINPLACEFLAGS@|g" \
|
||||
-e "s|@SEDPATH[@]|@SEDPATH@|g" \
|
||||
-e "s|@DUFLAGS[@]|@DUFLAGS@|g" \
|
||||
-e "s|@DUPATH[@]|@DUPATH@|g" \
|
||||
-e "s|@configure_input[@]|Generated from ${input##*/}; do not edit by hand.|g" \
|
||||
"$input" >"$output"
|
||||
|
||||
if [[ $mode ]]; then
|
||||
chmod "$mode" "$output"
|
||||
fi
|
||||
6
build-aux/meson-install-script.sh
Normal file
6
build-aux/meson-install-script.sh
Normal file
@@ -0,0 +1,6 @@
|
||||
#!/bin/sh
|
||||
|
||||
built_script=$1
|
||||
dest_path=$2
|
||||
|
||||
install -Dm755 "$built_script" "$DESTDIR/$dest_path"
|
||||
12
build-aux/meson-make-symlink.sh
Normal file
12
build-aux/meson-make-symlink.sh
Normal file
@@ -0,0 +1,12 @@
|
||||
#!/bin/sh
|
||||
set -eu
|
||||
|
||||
# this is needed mostly because $DESTDIR is provided as a variable,
|
||||
# and we need to create the target directory...
|
||||
|
||||
mkdir -vp "$(dirname "${DESTDIR:-}$2")"
|
||||
if [ "$(dirname $1)" = . ]; then
|
||||
ln -vfs -T "$1" "${DESTDIR:-}$2"
|
||||
else
|
||||
ln -vfs -T --relative "${DESTDIR:-}$1" "${DESTDIR:-}$2"
|
||||
fi
|
||||
6
build-aux/script-wrapper.sh.in
Executable file
6
build-aux/script-wrapper.sh.in
Executable file
@@ -0,0 +1,6 @@
|
||||
#!/bin/bash
|
||||
|
||||
# This script serves as a trampoline for running scripts which depend on
|
||||
# libmakepkg with the libmakepkg within the build tree.
|
||||
|
||||
LIBRARY=@BUILDDIR@/libmakepkg exec @BASH@ -$- @REAL_PROGPATH@ "$@"
|
||||
296
build-aux/tap-driver.py
Normal file
296
build-aux/tap-driver.py
Normal file
@@ -0,0 +1,296 @@
|
||||
#!/usr/bin/env python3
|
||||
# Adapted from tappy copyright (c) 2016, Matt Layman
|
||||
# MIT license
|
||||
# https://github.com/python-tap/tappy
|
||||
|
||||
import io
|
||||
import re
|
||||
import subprocess
|
||||
import sys
|
||||
|
||||
|
||||
class Directive(object):
|
||||
"""A representation of a result line directive."""
|
||||
|
||||
skip_pattern = re.compile(
|
||||
r"""^SKIP\S*
|
||||
(?P<whitespace>\s*) # Optional whitespace.
|
||||
(?P<reason>.*) # Slurp up the rest.""",
|
||||
re.IGNORECASE | re.VERBOSE)
|
||||
todo_pattern = re.compile(
|
||||
r"""^TODO\b # The directive name
|
||||
(?P<whitespace>\s*) # Immediately following must be whitespace.
|
||||
(?P<reason>.*) # Slurp up the rest.""",
|
||||
re.IGNORECASE | re.VERBOSE)
|
||||
|
||||
def __init__(self, text):
|
||||
"""Initialize the directive by parsing the text.
|
||||
The text is assumed to be everything after a '#\s*' on a result line.
|
||||
"""
|
||||
self._text = text
|
||||
self._skip = False
|
||||
self._todo = False
|
||||
self._reason = None
|
||||
|
||||
match = self.skip_pattern.match(text)
|
||||
if match:
|
||||
self._skip = True
|
||||
self._reason = match.group('reason')
|
||||
|
||||
match = self.todo_pattern.match(text)
|
||||
if match:
|
||||
if match.group('whitespace'):
|
||||
self._todo = True
|
||||
else:
|
||||
# Catch the case where the directive has no descriptive text.
|
||||
if match.group('reason') == '':
|
||||
self._todo = True
|
||||
self._reason = match.group('reason')
|
||||
|
||||
@property
|
||||
def text(self):
|
||||
"""Get the entire text."""
|
||||
return self._text
|
||||
|
||||
@property
|
||||
def skip(self):
|
||||
"""Check if the directive is a SKIP type."""
|
||||
return self._skip
|
||||
|
||||
@property
|
||||
def todo(self):
|
||||
"""Check if the directive is a TODO type."""
|
||||
return self._todo
|
||||
|
||||
@property
|
||||
def reason(self):
|
||||
"""Get the reason for the directive."""
|
||||
return self._reason
|
||||
|
||||
|
||||
class Parser(object):
|
||||
"""A parser for TAP files and lines."""
|
||||
|
||||
# ok and not ok share most of the same characteristics.
|
||||
result_base = r"""
|
||||
\s* # Optional whitespace.
|
||||
(?P<number>\d*) # Optional test number.
|
||||
\s* # Optional whitespace.
|
||||
(?P<description>[^#]*) # Optional description before #.
|
||||
\#? # Optional directive marker.
|
||||
\s* # Optional whitespace.
|
||||
(?P<directive>.*) # Optional directive text.
|
||||
"""
|
||||
ok = re.compile(r'^ok' + result_base, re.VERBOSE)
|
||||
not_ok = re.compile(r'^not\ ok' + result_base, re.VERBOSE)
|
||||
plan = re.compile(r"""
|
||||
^1..(?P<expected>\d+) # Match the plan details.
|
||||
[^#]* # Consume any non-hash character to confirm only
|
||||
# directives appear with the plan details.
|
||||
\#? # Optional directive marker.
|
||||
\s* # Optional whitespace.
|
||||
(?P<directive>.*) # Optional directive text.
|
||||
""", re.VERBOSE)
|
||||
diagnostic = re.compile(r'^#')
|
||||
bail = re.compile(r"""
|
||||
^Bail\ out!
|
||||
\s* # Optional whitespace.
|
||||
(?P<reason>.*) # Optional reason.
|
||||
""", re.VERBOSE)
|
||||
version = re.compile(r'^TAP version (?P<version>\d+)$')
|
||||
|
||||
TAP_MINIMUM_DECLARED_VERSION = 13
|
||||
|
||||
def parse(self, fh):
|
||||
"""Generate tap.line.Line objects, given a file-like object `fh`.
|
||||
`fh` may be any object that implements both the iterator and
|
||||
context management protocol (i.e. it can be used in both a
|
||||
"with" statement and a "for...in" statement.)
|
||||
Trailing whitespace and newline characters will be automatically
|
||||
stripped from the input lines.
|
||||
"""
|
||||
with fh:
|
||||
for line in fh:
|
||||
yield self.parse_line(line.rstrip())
|
||||
|
||||
def parse_line(self, text):
|
||||
"""Parse a line into whatever TAP category it belongs."""
|
||||
match = self.ok.match(text)
|
||||
if match:
|
||||
return self._parse_result(True, match)
|
||||
|
||||
match = self.not_ok.match(text)
|
||||
if match:
|
||||
return self._parse_result(False, match)
|
||||
|
||||
if self.diagnostic.match(text):
|
||||
return ('diagnostic', text)
|
||||
|
||||
match = self.plan.match(text)
|
||||
if match:
|
||||
return self._parse_plan(match)
|
||||
|
||||
match = self.bail.match(text)
|
||||
if match:
|
||||
return ('bail', match.group('reason'))
|
||||
|
||||
match = self.version.match(text)
|
||||
if match:
|
||||
return self._parse_version(match)
|
||||
|
||||
return ('unknown',)
|
||||
|
||||
def _parse_plan(self, match):
|
||||
"""Parse a matching plan line."""
|
||||
expected_tests = int(match.group('expected'))
|
||||
directive = Directive(match.group('directive'))
|
||||
|
||||
# Only SKIP directives are allowed in the plan.
|
||||
if directive.text and not directive.skip:
|
||||
return ('unknown',)
|
||||
|
||||
return ('plan', expected_tests, directive)
|
||||
|
||||
def _parse_result(self, ok, match):
|
||||
"""Parse a matching result line into a result instance."""
|
||||
return ('result', ok, match.group('number'),
|
||||
match.group('description').strip(),
|
||||
Directive(match.group('directive')))
|
||||
|
||||
def _parse_version(self, match):
|
||||
version = int(match.group('version'))
|
||||
if version < self.TAP_MINIMUM_DECLARED_VERSION:
|
||||
raise ValueError('It is an error to explicitly specify '
|
||||
'any version lower than 13.')
|
||||
return ('version', version)
|
||||
|
||||
|
||||
class Rules(object):
|
||||
|
||||
def __init__(self):
|
||||
self._lines_seen = {'plan': [], 'test': 0, 'failed': 0, 'version': []}
|
||||
self._errors = []
|
||||
|
||||
def check(self, final_line_count):
|
||||
"""Check the status of all provided data and update the suite."""
|
||||
if self._lines_seen['version']:
|
||||
self._process_version_lines()
|
||||
self._process_plan_lines(final_line_count)
|
||||
|
||||
def check_errors(self):
|
||||
if self._lines_seen['failed'] > 0:
|
||||
self._add_error('Tests failed.')
|
||||
if self._errors:
|
||||
for error in self._errors:
|
||||
print(error)
|
||||
return 1
|
||||
return 0
|
||||
|
||||
def _process_version_lines(self):
|
||||
"""Process version line rules."""
|
||||
if len(self._lines_seen['version']) > 1:
|
||||
self._add_error('Multiple version lines appeared.')
|
||||
elif self._lines_seen['version'][0] != 1:
|
||||
self._add_error('The version must be on the first line.')
|
||||
|
||||
def _process_plan_lines(self, final_line_count):
|
||||
"""Process plan line rules."""
|
||||
if not self._lines_seen['plan']:
|
||||
self._add_error('Missing a plan.')
|
||||
return
|
||||
|
||||
if len(self._lines_seen['plan']) > 1:
|
||||
self._add_error('Only one plan line is permitted per file.')
|
||||
return
|
||||
|
||||
expected_tests, at_line = self._lines_seen['plan'][0]
|
||||
if not self._plan_on_valid_line(at_line, final_line_count):
|
||||
self._add_error(
|
||||
'A plan must appear at the beginning or end of the file.')
|
||||
return
|
||||
|
||||
if expected_tests != self._lines_seen['test']:
|
||||
self._add_error(
|
||||
'Expected {expected_count} tests '
|
||||
'but only {seen_count} ran.'.format(
|
||||
expected_count=expected_tests,
|
||||
seen_count=self._lines_seen['test']))
|
||||
|
||||
def _plan_on_valid_line(self, at_line, final_line_count):
|
||||
"""Check if a plan is on a valid line."""
|
||||
# Put the common cases first.
|
||||
if at_line == 1 or at_line == final_line_count:
|
||||
return True
|
||||
|
||||
# The plan may only appear on line 2 if the version is at line 1.
|
||||
after_version = (
|
||||
self._lines_seen['version'] and
|
||||
self._lines_seen['version'][0] == 1 and
|
||||
at_line == 2)
|
||||
if after_version:
|
||||
return True
|
||||
|
||||
return False
|
||||
|
||||
def handle_bail(self, reason):
|
||||
"""Handle a bail line."""
|
||||
self._add_error('Bailed: {reason}').format(reason=reason)
|
||||
|
||||
def handle_skipping_plan(self):
|
||||
"""Handle a plan that contains a SKIP directive."""
|
||||
sys.exit(77)
|
||||
|
||||
def saw_plan(self, expected_tests, at_line):
|
||||
"""Record when a plan line was seen."""
|
||||
self._lines_seen['plan'].append((expected_tests, at_line))
|
||||
|
||||
def saw_test(self, ok):
|
||||
"""Record when a test line was seen."""
|
||||
self._lines_seen['test'] += 1
|
||||
if not ok:
|
||||
self._lines_seen['failed'] += 1
|
||||
|
||||
def saw_version_at(self, line_counter):
|
||||
"""Record when a version line was seen."""
|
||||
self._lines_seen['version'].append(line_counter)
|
||||
|
||||
def _add_error(self, message):
|
||||
self._errors += [message]
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
parser = Parser()
|
||||
rules = Rules()
|
||||
|
||||
try:
|
||||
out = subprocess.check_output(sys.argv[1:], universal_newlines=True)
|
||||
except subprocess.CalledProcessError as e:
|
||||
sys.stdout.write(e.output)
|
||||
raise e
|
||||
|
||||
line_generator = parser.parse(io.StringIO(out))
|
||||
line_counter = 0
|
||||
for line in line_generator:
|
||||
line_counter += 1
|
||||
|
||||
if line[0] == 'unknown':
|
||||
continue
|
||||
|
||||
if line[0] == 'result':
|
||||
rules.saw_test(line[1])
|
||||
print('{okay} {num} {description} {directive}'.format(
|
||||
okay=('' if line[1] else 'not ') + 'ok', num=line[2],
|
||||
description=line[3], directive=line[4].text))
|
||||
elif line[0] == 'plan':
|
||||
if line[2].skip:
|
||||
rules.handle_skipping_plan()
|
||||
rules.saw_plan(line[1], line_counter)
|
||||
elif line[0] == 'bail':
|
||||
rules.handle_bail(line[1])
|
||||
elif line[0] == 'version':
|
||||
rules.saw_version_at(line_counter)
|
||||
elif line[0] == 'diagnostic':
|
||||
print(line[1])
|
||||
|
||||
rules.check(line_counter)
|
||||
sys.exit(rules.check_errors())
|
||||
@@ -1,652 +0,0 @@
|
||||
#! /bin/sh
|
||||
# Copyright (C) 2011-2013 Free Software Foundation, Inc.
|
||||
#
|
||||
# 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, 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/>.
|
||||
|
||||
# As a special exception to the GNU General Public License, if you
|
||||
# distribute this file as part of a program that contains a
|
||||
# configuration script generated by Autoconf, you may include it under
|
||||
# the same distribution terms that you use for the rest of that program.
|
||||
|
||||
# This file is maintained in Automake, please report
|
||||
# bugs to <bug-automake@gnu.org> or send patches to
|
||||
# <automake-patches@gnu.org>.
|
||||
|
||||
scriptversion=2011-12-27.17; # UTC
|
||||
|
||||
# Make unconditional expansion of undefined variables an error. This
|
||||
# helps a lot in preventing typo-related bugs.
|
||||
set -u
|
||||
|
||||
me=tap-driver.sh
|
||||
|
||||
fatal ()
|
||||
{
|
||||
echo "$me: fatal: $*" >&2
|
||||
exit 1
|
||||
}
|
||||
|
||||
usage_error ()
|
||||
{
|
||||
echo "$me: $*" >&2
|
||||
print_usage >&2
|
||||
exit 2
|
||||
}
|
||||
|
||||
print_usage ()
|
||||
{
|
||||
cat <<END
|
||||
Usage:
|
||||
tap-driver.sh --test-name=NAME --log-file=PATH --trs-file=PATH
|
||||
[--expect-failure={yes|no}] [--color-tests={yes|no}]
|
||||
[--enable-hard-errors={yes|no}] [--ignore-exit]
|
||||
[--diagnostic-string=STRING] [--merge|--no-merge]
|
||||
[--comments|--no-comments] [--] TEST-COMMAND
|
||||
The \`--test-name', \`--log-file' and \`--trs-file' options are mandatory.
|
||||
END
|
||||
}
|
||||
|
||||
# TODO: better error handling in option parsing (in particular, ensure
|
||||
# TODO: $log_file, $trs_file and $test_name are defined).
|
||||
test_name= # Used for reporting.
|
||||
log_file= # Where to save the result and output of the test script.
|
||||
trs_file= # Where to save the metadata of the test run.
|
||||
expect_failure=0
|
||||
color_tests=0
|
||||
merge=0
|
||||
ignore_exit=0
|
||||
comments=0
|
||||
diag_string='#'
|
||||
while test $# -gt 0; do
|
||||
case $1 in
|
||||
--help) print_usage; exit $?;;
|
||||
--version) echo "$me $scriptversion"; exit $?;;
|
||||
--test-name) test_name=$2; shift;;
|
||||
--log-file) log_file=$2; shift;;
|
||||
--trs-file) trs_file=$2; shift;;
|
||||
--color-tests) color_tests=$2; shift;;
|
||||
--expect-failure) expect_failure=$2; shift;;
|
||||
--enable-hard-errors) shift;; # No-op.
|
||||
--merge) merge=1;;
|
||||
--no-merge) merge=0;;
|
||||
--ignore-exit) ignore_exit=1;;
|
||||
--comments) comments=1;;
|
||||
--no-comments) comments=0;;
|
||||
--diagnostic-string) diag_string=$2; shift;;
|
||||
--) shift; break;;
|
||||
-*) usage_error "invalid option: '$1'";;
|
||||
esac
|
||||
shift
|
||||
done
|
||||
|
||||
test $# -gt 0 || usage_error "missing test command"
|
||||
|
||||
case $expect_failure in
|
||||
yes) expect_failure=1;;
|
||||
*) expect_failure=0;;
|
||||
esac
|
||||
|
||||
if test $color_tests = yes; then
|
||||
init_colors='
|
||||
color_map["red"]="[0;31m" # Red.
|
||||
color_map["grn"]="[0;32m" # Green.
|
||||
color_map["lgn"]="[1;32m" # Light green.
|
||||
color_map["blu"]="[1;34m" # Blue.
|
||||
color_map["mgn"]="[0;35m" # Magenta.
|
||||
color_map["std"]="[m" # No color.
|
||||
color_for_result["ERROR"] = "mgn"
|
||||
color_for_result["PASS"] = "grn"
|
||||
color_for_result["XPASS"] = "red"
|
||||
color_for_result["FAIL"] = "red"
|
||||
color_for_result["XFAIL"] = "lgn"
|
||||
color_for_result["SKIP"] = "blu"'
|
||||
else
|
||||
init_colors=''
|
||||
fi
|
||||
|
||||
# :; is there to work around a bug in bash 3.2 (and earlier) which
|
||||
# does not always set '$?' properly on redirection failure.
|
||||
# See the Autoconf manual for more details.
|
||||
:;{
|
||||
(
|
||||
# Ignore common signals (in this subshell only!), to avoid potential
|
||||
# problems with Korn shells. Some Korn shells are known to propagate
|
||||
# to themselves signals that have killed a child process they were
|
||||
# waiting for; this is done at least for SIGINT (and usually only for
|
||||
# it, in truth). Without the `trap' below, such a behaviour could
|
||||
# cause a premature exit in the current subshell, e.g., in case the
|
||||
# test command it runs gets terminated by a SIGINT. Thus, the awk
|
||||
# script we are piping into would never seen the exit status it
|
||||
# expects on its last input line (which is displayed below by the
|
||||
# last `echo $?' statement), and would thus die reporting an internal
|
||||
# error.
|
||||
# For more information, see the Autoconf manual and the threads:
|
||||
# <http://lists.gnu.org/archive/html/bug-autoconf/2011-09/msg00004.html>
|
||||
# <http://mail.opensolaris.org/pipermail/ksh93-integration-discuss/2009-February/004121.html>
|
||||
trap : 1 3 2 13 15
|
||||
if test $merge -gt 0; then
|
||||
exec 2>&1
|
||||
else
|
||||
exec 2>&3
|
||||
fi
|
||||
"$@"
|
||||
echo $?
|
||||
) | LC_ALL=C ${AM_TAP_AWK-awk} \
|
||||
-v me="$me" \
|
||||
-v test_script_name="$test_name" \
|
||||
-v log_file="$log_file" \
|
||||
-v trs_file="$trs_file" \
|
||||
-v expect_failure="$expect_failure" \
|
||||
-v merge="$merge" \
|
||||
-v ignore_exit="$ignore_exit" \
|
||||
-v comments="$comments" \
|
||||
-v diag_string="$diag_string" \
|
||||
'
|
||||
# FIXME: the usages of "cat >&3" below could be optimized when using
|
||||
# FIXME: GNU awk, and/on on systems that supports /dev/fd/.
|
||||
|
||||
# Implementation note: in what follows, `result_obj` will be an
|
||||
# associative array that (partly) simulates a TAP result object
|
||||
# from the `TAP::Parser` perl module.
|
||||
|
||||
## ----------- ##
|
||||
## FUNCTIONS ##
|
||||
## ----------- ##
|
||||
|
||||
function fatal(msg)
|
||||
{
|
||||
print me ": " msg | "cat >&2"
|
||||
exit 1
|
||||
}
|
||||
|
||||
function abort(where)
|
||||
{
|
||||
fatal("internal error " where)
|
||||
}
|
||||
|
||||
# Convert a boolean to a "yes"/"no" string.
|
||||
function yn(bool)
|
||||
{
|
||||
return bool ? "yes" : "no";
|
||||
}
|
||||
|
||||
function add_test_result(result)
|
||||
{
|
||||
if (!test_results_index)
|
||||
test_results_index = 0
|
||||
test_results_list[test_results_index] = result
|
||||
test_results_index += 1
|
||||
test_results_seen[result] = 1;
|
||||
}
|
||||
|
||||
# Whether the test script should be re-run by "make recheck".
|
||||
function must_recheck()
|
||||
{
|
||||
for (k in test_results_seen)
|
||||
if (k != "XFAIL" && k != "PASS" && k != "SKIP")
|
||||
return 1
|
||||
return 0
|
||||
}
|
||||
|
||||
# Whether the content of the log file associated to this test should
|
||||
# be copied into the "global" test-suite.log.
|
||||
function copy_in_global_log()
|
||||
{
|
||||
for (k in test_results_seen)
|
||||
if (k != "PASS")
|
||||
return 1
|
||||
return 0
|
||||
}
|
||||
|
||||
# FIXME: this can certainly be improved ...
|
||||
function get_global_test_result()
|
||||
{
|
||||
if ("ERROR" in test_results_seen)
|
||||
return "ERROR"
|
||||
if ("FAIL" in test_results_seen || "XPASS" in test_results_seen)
|
||||
return "FAIL"
|
||||
all_skipped = 1
|
||||
for (k in test_results_seen)
|
||||
if (k != "SKIP")
|
||||
all_skipped = 0
|
||||
if (all_skipped)
|
||||
return "SKIP"
|
||||
return "PASS";
|
||||
}
|
||||
|
||||
function stringify_result_obj(result_obj)
|
||||
{
|
||||
if (result_obj["is_unplanned"] || result_obj["number"] != testno)
|
||||
return "ERROR"
|
||||
|
||||
if (plan_seen == LATE_PLAN)
|
||||
return "ERROR"
|
||||
|
||||
if (result_obj["directive"] == "TODO")
|
||||
return result_obj["is_ok"] ? "XPASS" : "XFAIL"
|
||||
|
||||
if (result_obj["directive"] == "SKIP")
|
||||
return result_obj["is_ok"] ? "SKIP" : COOKED_FAIL;
|
||||
|
||||
if (length(result_obj["directive"]))
|
||||
abort("in function stringify_result_obj()")
|
||||
|
||||
return result_obj["is_ok"] ? COOKED_PASS : COOKED_FAIL
|
||||
}
|
||||
|
||||
function decorate_result(result)
|
||||
{
|
||||
color_name = color_for_result[result]
|
||||
if (color_name)
|
||||
return color_map[color_name] "" result "" color_map["std"]
|
||||
# If we are not using colorized output, or if we do not know how
|
||||
# to colorize the given result, we should return it unchanged.
|
||||
return result
|
||||
}
|
||||
|
||||
function report(result, details)
|
||||
{
|
||||
if (result ~ /^(X?(PASS|FAIL)|SKIP|ERROR)/)
|
||||
{
|
||||
msg = ": " test_script_name
|
||||
add_test_result(result)
|
||||
}
|
||||
else if (result == "#")
|
||||
{
|
||||
msg = " " test_script_name ":"
|
||||
}
|
||||
else
|
||||
{
|
||||
abort("in function report()")
|
||||
}
|
||||
if (length(details))
|
||||
msg = msg " " details
|
||||
# Output on console might be colorized.
|
||||
print decorate_result(result) msg
|
||||
# Log the result in the log file too, to help debugging (this is
|
||||
# especially true when said result is a TAP error or "Bail out!").
|
||||
print result msg | "cat >&3";
|
||||
}
|
||||
|
||||
function testsuite_error(error_message)
|
||||
{
|
||||
report("ERROR", "- " error_message)
|
||||
}
|
||||
|
||||
function handle_tap_result()
|
||||
{
|
||||
details = result_obj["number"];
|
||||
if (length(result_obj["description"]))
|
||||
details = details " " result_obj["description"]
|
||||
|
||||
if (plan_seen == LATE_PLAN)
|
||||
{
|
||||
details = details " # AFTER LATE PLAN";
|
||||
}
|
||||
else if (result_obj["is_unplanned"])
|
||||
{
|
||||
details = details " # UNPLANNED";
|
||||
}
|
||||
else if (result_obj["number"] != testno)
|
||||
{
|
||||
details = sprintf("%s # OUT-OF-ORDER (expecting %d)",
|
||||
details, testno);
|
||||
}
|
||||
else if (result_obj["directive"])
|
||||
{
|
||||
details = details " # " result_obj["directive"];
|
||||
if (length(result_obj["explanation"]))
|
||||
details = details " " result_obj["explanation"]
|
||||
}
|
||||
|
||||
report(stringify_result_obj(result_obj), details)
|
||||
}
|
||||
|
||||
# `skip_reason` should be empty whenever planned > 0.
|
||||
function handle_tap_plan(planned, skip_reason)
|
||||
{
|
||||
planned += 0 # Avoid getting confused if, say, `planned` is "00"
|
||||
if (length(skip_reason) && planned > 0)
|
||||
abort("in function handle_tap_plan()")
|
||||
if (plan_seen)
|
||||
{
|
||||
# Error, only one plan per stream is acceptable.
|
||||
testsuite_error("multiple test plans")
|
||||
return;
|
||||
}
|
||||
planned_tests = planned
|
||||
# The TAP plan can come before or after *all* the TAP results; we speak
|
||||
# respectively of an "early" or a "late" plan. If we see the plan line
|
||||
# after at least one TAP result has been seen, assume we have a late
|
||||
# plan; in this case, any further test result seen after the plan will
|
||||
# be flagged as an error.
|
||||
plan_seen = (testno >= 1 ? LATE_PLAN : EARLY_PLAN)
|
||||
# If testno > 0, we have an error ("too many tests run") that will be
|
||||
# automatically dealt with later, so do not worry about it here. If
|
||||
# $plan_seen is true, we have an error due to a repeated plan, and that
|
||||
# has already been dealt with above. Otherwise, we have a valid "plan
|
||||
# with SKIP" specification, and should report it as a particular kind
|
||||
# of SKIP result.
|
||||
if (planned == 0 && testno == 0)
|
||||
{
|
||||
if (length(skip_reason))
|
||||
skip_reason = "- " skip_reason;
|
||||
report("SKIP", skip_reason);
|
||||
}
|
||||
}
|
||||
|
||||
function extract_tap_comment(line)
|
||||
{
|
||||
if (index(line, diag_string) == 1)
|
||||
{
|
||||
# Strip leading `diag_string` from `line`.
|
||||
line = substr(line, length(diag_string) + 1)
|
||||
# And strip any leading and trailing whitespace left.
|
||||
sub("^[ \t]*", "", line)
|
||||
sub("[ \t]*$", "", line)
|
||||
# Return what is left (if any).
|
||||
return line;
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
# When this function is called, we know that line is a TAP result line,
|
||||
# so that it matches the (perl) RE "^(not )?ok\b".
|
||||
function setup_result_obj(line)
|
||||
{
|
||||
# Get the result, and remove it from the line.
|
||||
result_obj["is_ok"] = (substr(line, 1, 2) == "ok" ? 1 : 0)
|
||||
sub("^(not )?ok[ \t]*", "", line)
|
||||
|
||||
# If the result has an explicit number, get it and strip it; otherwise,
|
||||
# automatically assing the next progresive number to it.
|
||||
if (line ~ /^[0-9]+$/ || line ~ /^[0-9]+[^a-zA-Z0-9_]/)
|
||||
{
|
||||
match(line, "^[0-9]+")
|
||||
# The final `+ 0` is to normalize numbers with leading zeros.
|
||||
result_obj["number"] = substr(line, 1, RLENGTH) + 0
|
||||
line = substr(line, RLENGTH + 1)
|
||||
}
|
||||
else
|
||||
{
|
||||
result_obj["number"] = testno
|
||||
}
|
||||
|
||||
if (plan_seen == LATE_PLAN)
|
||||
# No further test results are acceptable after a "late" TAP plan
|
||||
# has been seen.
|
||||
result_obj["is_unplanned"] = 1
|
||||
else if (plan_seen && testno > planned_tests)
|
||||
result_obj["is_unplanned"] = 1
|
||||
else
|
||||
result_obj["is_unplanned"] = 0
|
||||
|
||||
# Strip trailing and leading whitespace.
|
||||
sub("^[ \t]*", "", line)
|
||||
sub("[ \t]*$", "", line)
|
||||
|
||||
# This will have to be corrected if we have a "TODO"/"SKIP" directive.
|
||||
result_obj["description"] = line
|
||||
result_obj["directive"] = ""
|
||||
result_obj["explanation"] = ""
|
||||
|
||||
if (index(line, "#") == 0)
|
||||
return # No possible directive, nothing more to do.
|
||||
|
||||
# Directives are case-insensitive.
|
||||
rx = "[ \t]*#[ \t]*([tT][oO][dD][oO]|[sS][kK][iI][pP])[ \t]*"
|
||||
|
||||
# See whether we have the directive, and if yes, where.
|
||||
pos = match(line, rx "$")
|
||||
if (!pos)
|
||||
pos = match(line, rx "[^a-zA-Z0-9_]")
|
||||
|
||||
# If there was no TAP directive, we have nothing more to do.
|
||||
if (!pos)
|
||||
return
|
||||
|
||||
# Let`s now see if the TAP directive has been escaped. For example:
|
||||
# escaped: ok \# SKIP
|
||||
# not escaped: ok \\# SKIP
|
||||
# escaped: ok \\\\\# SKIP
|
||||
# not escaped: ok \ # SKIP
|
||||
if (substr(line, pos, 1) == "#")
|
||||
{
|
||||
bslash_count = 0
|
||||
for (i = pos; i > 1 && substr(line, i - 1, 1) == "\\"; i--)
|
||||
bslash_count += 1
|
||||
if (bslash_count % 2)
|
||||
return # Directive was escaped.
|
||||
}
|
||||
|
||||
# Strip the directive and its explanation (if any) from the test
|
||||
# description.
|
||||
result_obj["description"] = substr(line, 1, pos - 1)
|
||||
# Now remove the test description from the line, that has been dealt
|
||||
# with already.
|
||||
line = substr(line, pos)
|
||||
# Strip the directive, and save its value (normalized to upper case).
|
||||
sub("^[ \t]*#[ \t]*", "", line)
|
||||
result_obj["directive"] = toupper(substr(line, 1, 4))
|
||||
line = substr(line, 5)
|
||||
# Now get the explanation for the directive (if any), with leading
|
||||
# and trailing whitespace removed.
|
||||
sub("^[ \t]*", "", line)
|
||||
sub("[ \t]*$", "", line)
|
||||
result_obj["explanation"] = line
|
||||
}
|
||||
|
||||
function get_test_exit_message(status)
|
||||
{
|
||||
if (status == 0)
|
||||
return ""
|
||||
if (status !~ /^[1-9][0-9]*$/)
|
||||
abort("getting exit status")
|
||||
if (status < 127)
|
||||
exit_details = ""
|
||||
else if (status == 127)
|
||||
exit_details = " (command not found?)"
|
||||
else if (status >= 128 && status <= 255)
|
||||
exit_details = sprintf(" (terminated by signal %d?)", status - 128)
|
||||
else if (status > 256 && status <= 384)
|
||||
# We used to report an "abnormal termination" here, but some Korn
|
||||
# shells, when a child process die due to signal number n, can leave
|
||||
# in $? an exit status of 256+n instead of the more standard 128+n.
|
||||
# Apparently, both behaviours are allowed by POSIX (2008), so be
|
||||
# prepared to handle them both. See also Austing Group report ID
|
||||
# 0000051 <http://www.austingroupbugs.net/view.php?id=51>
|
||||
exit_details = sprintf(" (terminated by signal %d?)", status - 256)
|
||||
else
|
||||
# Never seen in practice.
|
||||
exit_details = " (abnormal termination)"
|
||||
return sprintf("exited with status %d%s", status, exit_details)
|
||||
}
|
||||
|
||||
function write_test_results()
|
||||
{
|
||||
print ":global-test-result: " get_global_test_result() > trs_file
|
||||
print ":recheck: " yn(must_recheck()) > trs_file
|
||||
print ":copy-in-global-log: " yn(copy_in_global_log()) > trs_file
|
||||
for (i = 0; i < test_results_index; i += 1)
|
||||
print ":test-result: " test_results_list[i] > trs_file
|
||||
close(trs_file);
|
||||
}
|
||||
|
||||
BEGIN {
|
||||
|
||||
## ------- ##
|
||||
## SETUP ##
|
||||
## ------- ##
|
||||
|
||||
'"$init_colors"'
|
||||
|
||||
# Properly initialized once the TAP plan is seen.
|
||||
planned_tests = 0
|
||||
|
||||
COOKED_PASS = expect_failure ? "XPASS": "PASS";
|
||||
COOKED_FAIL = expect_failure ? "XFAIL": "FAIL";
|
||||
|
||||
# Enumeration-like constants to remember which kind of plan (if any)
|
||||
# has been seen. It is important that NO_PLAN evaluates "false" as
|
||||
# a boolean.
|
||||
NO_PLAN = 0
|
||||
EARLY_PLAN = 1
|
||||
LATE_PLAN = 2
|
||||
|
||||
testno = 0 # Number of test results seen so far.
|
||||
bailed_out = 0 # Whether a "Bail out!" directive has been seen.
|
||||
|
||||
# Whether the TAP plan has been seen or not, and if yes, which kind
|
||||
# it is ("early" is seen before any test result, "late" otherwise).
|
||||
plan_seen = NO_PLAN
|
||||
|
||||
## --------- ##
|
||||
## PARSING ##
|
||||
## --------- ##
|
||||
|
||||
is_first_read = 1
|
||||
|
||||
while (1)
|
||||
{
|
||||
# Involutions required so that we are able to read the exit status
|
||||
# from the last input line.
|
||||
st = getline
|
||||
if (st < 0) # I/O error.
|
||||
fatal("I/O error while reading from input stream")
|
||||
else if (st == 0) # End-of-input
|
||||
{
|
||||
if (is_first_read)
|
||||
abort("in input loop: only one input line")
|
||||
break
|
||||
}
|
||||
if (is_first_read)
|
||||
{
|
||||
is_first_read = 0
|
||||
nextline = $0
|
||||
continue
|
||||
}
|
||||
else
|
||||
{
|
||||
curline = nextline
|
||||
nextline = $0
|
||||
$0 = curline
|
||||
}
|
||||
# Copy any input line verbatim into the log file.
|
||||
print | "cat >&3"
|
||||
# Parsing of TAP input should stop after a "Bail out!" directive.
|
||||
if (bailed_out)
|
||||
continue
|
||||
|
||||
# TAP test result.
|
||||
if ($0 ~ /^(not )?ok$/ || $0 ~ /^(not )?ok[^a-zA-Z0-9_]/)
|
||||
{
|
||||
testno += 1
|
||||
setup_result_obj($0)
|
||||
handle_tap_result()
|
||||
}
|
||||
# TAP plan (normal or "SKIP" without explanation).
|
||||
else if ($0 ~ /^1\.\.[0-9]+[ \t]*$/)
|
||||
{
|
||||
# The next two lines will put the number of planned tests in $0.
|
||||
sub("^1\\.\\.", "")
|
||||
sub("[^0-9]*$", "")
|
||||
handle_tap_plan($0, "")
|
||||
continue
|
||||
}
|
||||
# TAP "SKIP" plan, with an explanation.
|
||||
else if ($0 ~ /^1\.\.0+[ \t]*#/)
|
||||
{
|
||||
# The next lines will put the skip explanation in $0, stripping
|
||||
# any leading and trailing whitespace. This is a little more
|
||||
# tricky in truth, since we want to also strip a potential leading
|
||||
# "SKIP" string from the message.
|
||||
sub("^[^#]*#[ \t]*(SKIP[: \t][ \t]*)?", "")
|
||||
sub("[ \t]*$", "");
|
||||
handle_tap_plan(0, $0)
|
||||
}
|
||||
# "Bail out!" magic.
|
||||
# Older versions of prove and TAP::Harness (e.g., 3.17) did not
|
||||
# recognize a "Bail out!" directive when preceded by leading
|
||||
# whitespace, but more modern versions (e.g., 3.23) do. So we
|
||||
# emulate the latter, "more modern" behaviour.
|
||||
else if ($0 ~ /^[ \t]*Bail out!/)
|
||||
{
|
||||
bailed_out = 1
|
||||
# Get the bailout message (if any), with leading and trailing
|
||||
# whitespace stripped. The message remains stored in `$0`.
|
||||
sub("^[ \t]*Bail out![ \t]*", "");
|
||||
sub("[ \t]*$", "");
|
||||
# Format the error message for the
|
||||
bailout_message = "Bail out!"
|
||||
if (length($0))
|
||||
bailout_message = bailout_message " " $0
|
||||
testsuite_error(bailout_message)
|
||||
}
|
||||
# Maybe we have too look for dianogtic comments too.
|
||||
else if (comments != 0)
|
||||
{
|
||||
comment = extract_tap_comment($0);
|
||||
if (length(comment))
|
||||
report("#", comment);
|
||||
}
|
||||
}
|
||||
|
||||
## -------- ##
|
||||
## FINISH ##
|
||||
## -------- ##
|
||||
|
||||
# A "Bail out!" directive should cause us to ignore any following TAP
|
||||
# error, as well as a non-zero exit status from the TAP producer.
|
||||
if (!bailed_out)
|
||||
{
|
||||
if (!plan_seen)
|
||||
{
|
||||
testsuite_error("missing test plan")
|
||||
}
|
||||
else if (planned_tests != testno)
|
||||
{
|
||||
bad_amount = testno > planned_tests ? "many" : "few"
|
||||
testsuite_error(sprintf("too %s tests run (expected %d, got %d)",
|
||||
bad_amount, planned_tests, testno))
|
||||
}
|
||||
if (!ignore_exit)
|
||||
{
|
||||
# Fetch exit status from the last line.
|
||||
exit_message = get_test_exit_message(nextline)
|
||||
if (exit_message)
|
||||
testsuite_error(exit_message)
|
||||
}
|
||||
}
|
||||
|
||||
write_test_results()
|
||||
|
||||
exit 0
|
||||
|
||||
} # End of "BEGIN" block.
|
||||
'
|
||||
|
||||
# TODO: document that we consume the file descriptor 3 :-(
|
||||
} 3>"$log_file"
|
||||
|
||||
test $? -eq 0 || fatal "I/O or internal error"
|
||||
|
||||
# Local Variables:
|
||||
# mode: shell-script
|
||||
# sh-indentation: 2
|
||||
# eval: (add-hook 'write-file-hooks 'time-stamp)
|
||||
# time-stamp-start: "scriptversion="
|
||||
# time-stamp-format: "%:y-%02m-%02d.%02H"
|
||||
# time-stamp-time-zone: "UTC"
|
||||
# time-stamp-end: "; # UTC"
|
||||
# End:
|
||||
39
build-aux/update-po
Executable file
39
build-aux/update-po
Executable file
@@ -0,0 +1,39 @@
|
||||
#!/bin/bash
|
||||
|
||||
find_build_directory() {
|
||||
local build_dirs=(*/.ninja_log)
|
||||
|
||||
if [[ ! -e ${build_dirs[0]} ]]; then
|
||||
echo "error: No build directory found. Have you run 'meson build' yet?" >&2
|
||||
return 1
|
||||
elif (( ${#build_dirs[*]} > 1 )); then
|
||||
echo "error: Multiple build directories found. Unable to proceed." >&2
|
||||
return 1
|
||||
fi
|
||||
|
||||
printf '%s\n' "${build_dirs[0]%/*}"
|
||||
}
|
||||
|
||||
|
||||
filter_targets_by_name() {
|
||||
if command -v jq &>/dev/null; then
|
||||
jq --arg re "$1" -r 'map(.name)[] | select(match($re))'
|
||||
else
|
||||
json_pp | awk -v filter="$1" -F'[:"]' \
|
||||
'$2 == "name" && $(NF - 1) ~ filter { print $(NF - 1) }'
|
||||
fi
|
||||
}
|
||||
|
||||
# Make things simple and require that we're in the build root rather than
|
||||
# trying to chase down the location of this script and the relative build dir.
|
||||
if [[ ! -d .git ]]; then
|
||||
echo "This script must be run from the root of the repository" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
build_dir=$(find_build_directory) || exit 1
|
||||
|
||||
mapfile -t targets < \
|
||||
<(meson introspect "$build_dir" --targets | filter_targets_by_name "-update-po$")
|
||||
|
||||
ninja -C "$build_dir" "${targets[@]}"
|
||||
17
configure.ac
17
configure.ac
@@ -101,7 +101,7 @@ AC_ARG_WITH(buildscript,
|
||||
# Help line for buildscript filename
|
||||
AC_ARG_WITH(makepkg-template-dir,
|
||||
AS_HELP_STRING([--with-makepkg-template-dir=name], [set the template dir used by makepkg-template]),
|
||||
[TEMPLATE_DIR=$withval], [TEMPLATE_DIR=/usr/share/makepkg-template])
|
||||
[TEMPLATE_DIR=$withval], [TEMPLATE_DIR=${datarootdir}/makepkg-template])
|
||||
|
||||
# Help line for debug package suffix
|
||||
AC_ARG_WITH(debug-suffix,
|
||||
@@ -179,7 +179,7 @@ AC_SUBST(LFS_CFLAGS)
|
||||
AC_PROG_AWK
|
||||
AC_PROG_CC_C99
|
||||
AC_PROG_INSTALL
|
||||
AC_CHECK_PROGS([PYTHON], [python2.7 python2 python], [false])
|
||||
AC_CHECK_PROGS([PYTHON], [python3 python], [false])
|
||||
AC_PATH_PROGS([BASH_SHELL], [bash bash4], [false])
|
||||
|
||||
# check for perl 5.10.1 (needed by makepkg-template)
|
||||
@@ -193,18 +193,18 @@ AC_DEFUN([AX_PROG_PERL_VERSION],
|
||||
AX_PROG_PERL_VERSION([5.10.1], [], [AC_MSG_ERROR([perl is too old])])
|
||||
|
||||
AS_IF([test "x$BASH_SHELL" = "xfalse"],
|
||||
AC_MSG_WARN([*** bash >= 4.1.0 is required for pacman scripts]),
|
||||
AC_MSG_WARN([*** bash >= 4.4.0 is required for pacman scripts]),
|
||||
[bash_version_major=`$BASH_SHELL -c 'echo "${BASH_VERSINFO[[0]]}"'`
|
||||
bash_version_minor=`$BASH_SHELL -c 'echo "${BASH_VERSINFO[[1]]}"'`
|
||||
ok=yes
|
||||
if test "$bash_version_major" -lt 4; then
|
||||
ok=no
|
||||
fi
|
||||
if test "$bash_version_major" -eq 4 && test "$bash_version_minor" -lt 1; then
|
||||
if test "$bash_version_major" -eq 4 && test "$bash_version_minor" -lt 4; then
|
||||
ok=no
|
||||
fi
|
||||
if test "$ok" = "no"; then
|
||||
AC_MSG_ERROR([*** bash >= 4.1.0 is required for pacman scripts])
|
||||
AC_MSG_ERROR([*** bash >= 4.4.0 is required for pacman scripts])
|
||||
fi
|
||||
unset bash_version_major bash_version_minor ok])
|
||||
|
||||
@@ -215,6 +215,9 @@ AM_GNU_GETTEXT_VERSION(0.13.1)
|
||||
AC_CHECK_LIB([m], [fabs], ,
|
||||
AC_MSG_ERROR([libm is needed to compile pacman!]))
|
||||
|
||||
PKG_CHECK_VAR(bashcompdir, [bash-completion], [completionsdir], ,
|
||||
bashcompdir="${datarootdir}/bash-completion/completions")
|
||||
|
||||
# Check for libarchive
|
||||
PKG_CHECK_MODULES(LIBARCHIVE, [libarchive >= 3.0.0], ,
|
||||
AC_MSG_ERROR([*** libarchive >= 3.0.0 is needed to compile pacman!]))
|
||||
@@ -326,8 +329,6 @@ PATH_MAX_DEFINED
|
||||
AC_FUNC_FORK
|
||||
AC_FUNC_GETMNTENT
|
||||
AC_FUNC_LSTAT_FOLLOWS_SLASHED_SYMLINK
|
||||
AC_FUNC_MKTIME
|
||||
AC_FUNC_STRCOLL
|
||||
AC_CHECK_FUNCS([dup2 getcwd getmntinfo gettimeofday memmove memset \
|
||||
mkdir realpath regcomp rmdir setenv setlocale strcasecmp \
|
||||
strchr strcspn strdup strerror strndup strnlen strrchr \
|
||||
@@ -538,6 +539,8 @@ 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
|
||||
|
||||
1
doc/.gitignore
vendored
1
doc/.gitignore
vendored
@@ -6,3 +6,4 @@ asciidoc.js
|
||||
*.xml
|
||||
man3
|
||||
website.tar.gz
|
||||
Doxyfile
|
||||
|
||||
@@ -8,7 +8,7 @@ PROJECT_NAME = libalpm
|
||||
PROJECT_NUMBER =
|
||||
PROJECT_BRIEF = "Arch Linux Package Manager Library"
|
||||
PROJECT_LOGO =
|
||||
OUTPUT_DIRECTORY = ./
|
||||
OUTPUT_DIRECTORY = @OUTPUT_DIRECTORY@
|
||||
CREATE_SUBDIRS = NO
|
||||
OUTPUT_LANGUAGE = English
|
||||
BRIEF_MEMBER_DESC = YES
|
||||
@@ -3,7 +3,7 @@
|
||||
# files listed in EXTRA_DIST no matter what. However, we only add them to
|
||||
# man_MANS if --enable-asciidoc and/or --enable-doxygen are used.
|
||||
|
||||
ASCIIDOC_MANS = \
|
||||
MANPAGES = \
|
||||
alpm-hooks.5 \
|
||||
pacman.8 \
|
||||
makepkg.8 \
|
||||
@@ -65,12 +65,11 @@ EXTRA_DIST = \
|
||||
index.asciidoc \
|
||||
submitting-patches.asciidoc \
|
||||
translation-help.asciidoc \
|
||||
Doxyfile \
|
||||
$(ASCIIDOC_MANS) \
|
||||
$(MANPAGES) \
|
||||
$(DOXYGEN_MANS)
|
||||
|
||||
# Files that should be removed, but which Automake does not know.
|
||||
MOSTLYCLEANFILES = *.xml $(ASCIIDOC_MANS) $(HTML_DOCS) repo-remove.8 website.tar.gz
|
||||
MOSTLYCLEANFILES = *.xml $(MANPAGES) $(HTML_DOCS) repo-remove.8 website.tar.gz
|
||||
|
||||
# Ensure manpages are fresh when building a dist tarball
|
||||
dist-hook:
|
||||
@@ -85,17 +84,21 @@ REAL_PACKAGE_VERSION = $(PACKAGE_VERSION)
|
||||
endif
|
||||
|
||||
man_MANS =
|
||||
dist_man_MANS = $(ASCIIDOC_MANS)
|
||||
dist_man_MANS = $(MANPAGES)
|
||||
|
||||
if USE_DOXYGEN
|
||||
man_MANS += $(DOXYGEN_MANS)
|
||||
|
||||
all-local: doxygen.in
|
||||
|
||||
doxygen.in:
|
||||
Doxyfile: Doxyfile.in
|
||||
sed 's,@OUTPUT_DIRECTORY@,./,' Doxyfile.in >Doxyfile
|
||||
|
||||
doxygen.in: Doxyfile
|
||||
$(DOXYGEN) $(srcdir)/Doxyfile
|
||||
endif
|
||||
|
||||
man: $(MANPAGES)
|
||||
html: $(HTML_DOCS)
|
||||
|
||||
website: website.tar.gz
|
||||
@@ -129,11 +132,12 @@ A2X_OPTS = \
|
||||
-f manpage \
|
||||
--xsltproc-opts='-param man.endnotes.list.enabled 0 -param man.endnotes.are.numbered 0'
|
||||
|
||||
# These rules are due to the includes and files of the asciidoc text
|
||||
$(ASCIIDOC_MANS): asciidoc.conf footer.asciidoc Makefile.am
|
||||
# Generate manpages
|
||||
%: %.asciidoc asciidoc.conf footer.asciidoc Makefile.am
|
||||
$(AM_V_GEN)a2x $(A2X_OPTS) --asciidoc-opts="$(ASCIIDOC_OPTS) --out-file=./$@.xml" $(srcdir)/$@.asciidoc
|
||||
|
||||
%.html: %.asciidoc
|
||||
# Generate HTML pages
|
||||
%.html: %.asciidoc asciidoc.conf footer.asciidoc Makefile.am
|
||||
$(AM_V_GEN)asciidoc $(ASCIIDOC_OPTS) -o - $*.asciidoc | \
|
||||
sed -e 's/\r$$//' > $@
|
||||
|
||||
@@ -142,27 +146,15 @@ HACKING.html: ../HACKING
|
||||
sed -e 's/\r$$//' > $@
|
||||
|
||||
# Customizations for certain HTML docs
|
||||
$(HTML_MANPAGES): asciidoc.conf footer.asciidoc Makefile.am
|
||||
$(HTML_OTHER): asciidoc.conf Makefile.am
|
||||
%.html: ASCIIDOC_OPTS += -a linkcss -a toc -a icons -a max-width=960px -a stylesheet=asciidoc-override.css
|
||||
%.8.html: ASCIIDOC_OPTS += -d manpage
|
||||
%.5.html: ASCIIDOC_OPTS += -d manpage
|
||||
%.3.html: ASCIIDOC_OPTS += -d manpage
|
||||
|
||||
# Dependency rules
|
||||
alpm-hooks.5 alpm-hooks.5.html: alpm-hooks.5.asciidoc
|
||||
pacman.8 pacman.8.html: pacman.8.asciidoc
|
||||
makepkg.8 makepkg.8.html: makepkg.8.asciidoc
|
||||
makepkg-template.1 makepkg-template.1.html: makepkg-template.1.asciidoc
|
||||
repo-add.8 repo-add.8.html: repo-add.8.asciidoc
|
||||
vercmp.8 vercmp.8.html: vercmp.8.asciidoc
|
||||
pkgdelta.8 pkgdelta.8.html: pkgdelta.8.asciidoc
|
||||
pacman-key.8 pacman-key.8.html: pacman-key.8.asciidoc
|
||||
# Custom dependency rules
|
||||
PKGBUILD.5 PKGBUILD.5.html: PKGBUILD.5.asciidoc PKGBUILD-example.txt
|
||||
makepkg.conf.5 makepkg.conf.5.html: makepkg.conf.5.asciidoc
|
||||
pacman.conf.5 pacman.conf.5.html: pacman.conf.5.asciidoc
|
||||
libalpm.3 libalpm.3.html: libalpm.3.asciidoc
|
||||
# this one is just a symlink
|
||||
|
||||
# Manpages as symlinks
|
||||
repo-remove.8: repo-add.8
|
||||
$(RM) repo-remove.8
|
||||
$(LN_S) repo-add.8 repo-remove.8
|
||||
|
||||
@@ -75,8 +75,10 @@ Releases
|
||||
[frame="topbot",grid="none",options="header,autowidth"]
|
||||
!======
|
||||
!Version !Date
|
||||
!5.1.2 !2018-12-25
|
||||
!5.1.1 !2018-07-27
|
||||
!5.1.0 !2018-05-28
|
||||
!5.0.2 !2017-06-03
|
||||
!5.0.1 !2016-02-23
|
||||
!5.0.0 !2016-01-30
|
||||
!4.2.1 !2015-02-20
|
||||
|
||||
@@ -249,16 +249,18 @@ Options
|
||||
**COMPRESSGZ=**"(gzip -c -f -n)"::
|
||||
**COMPRESSBZ2=**"(bzip2 -c -f)"::
|
||||
**COMPRESSXZ=**"(xz -c -z -)"::
|
||||
**COMPRESSZST=**"(zstd -c -z -)"::
|
||||
**COMPRESSLZO**"(lzop -q)"::
|
||||
**COMPRESSLRZ=**"(lrzip -q)"::
|
||||
**COMPRESSLZ4=**"(lz4 -q)"::
|
||||
**COMPRESSZ=**"(compress -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.lzo`, `.tar.lrz`, and `.tar.Z`.
|
||||
Valid suffixes are `.tar`, `.tar.gz`, `.tar.bz2`, `.tar.xz`, `.tar.zst`,
|
||||
`.tar.lzo`, `.tar.lrz`, `.tar.lz4`, and `.tar.Z`.
|
||||
Do not touch these unless you know what you are doing.
|
||||
|
||||
|
||||
|
||||
138
doc/meson.build
Normal file
138
doc/meson.build
Normal file
@@ -0,0 +1,138 @@
|
||||
manpages = [
|
||||
{ 'name': 'alpm-hooks.5' },
|
||||
{ 'name': 'pacman.8' },
|
||||
{ 'name': 'makepkg.8' },
|
||||
{ 'name': 'makepkg-template.1' },
|
||||
{ 'name': 'repo-add.8' },
|
||||
{ 'name': 'vercmp.8' },
|
||||
{ 'name': 'pkgdelta.8' },
|
||||
{ 'name': 'pacman-key.8' },
|
||||
{ 'name': 'PKGBUILD.5', 'extra_depends' : [ 'PKGBUILD-example.txt' ] },
|
||||
{ 'name': 'makepkg.conf.5' },
|
||||
{ 'name': 'pacman.conf.5' },
|
||||
{ 'name': 'libalpm.3' },
|
||||
{ 'name': 'BUILDINFO.5' },
|
||||
]
|
||||
|
||||
asciidoc_conf = join_paths(meson.current_source_dir(), 'asciidoc.conf')
|
||||
|
||||
asciidoc_opts = [
|
||||
'-f', asciidoc_conf,
|
||||
'-a', 'pacman_version="@0@"'.format(PACKAGE_VERSION),
|
||||
'-a', 'pacman_date=@0@'.format(run_command('date', '+%Y-%m-%d').stdout().strip()),
|
||||
'-a', 'pkgdatadir=@0@'.format(PKGDATADIR),
|
||||
'-a', 'localstatedir=@0@'.format(LOCALSTATEDIR),
|
||||
'-a', 'sysconfdir=@0@'.format(SYSCONFDIR),
|
||||
'-a', 'datarootdir=@0@'.format(DATAROOTDIR),
|
||||
]
|
||||
|
||||
html_targets = []
|
||||
html_files = []
|
||||
|
||||
foreach page : manpages
|
||||
manpage = page['name']
|
||||
htmlpage = '@0@.html'.format(manpage)
|
||||
input = '@0@.asciidoc'.format(manpage)
|
||||
|
||||
section = page['name'].split('.')[-1]
|
||||
|
||||
mandirn = join_paths(MANDIR, 'man' + section)
|
||||
|
||||
custom_target(
|
||||
manpage,
|
||||
command : [
|
||||
A2X,
|
||||
'--no-xmllint',
|
||||
'-d', 'manpage',
|
||||
'-f', 'manpage',
|
||||
'--xsltproc-opts', '-param man.endnotes.list.enabled 0 -param man.endnotes.are.numbered 0',
|
||||
'-D', '@OUTDIR@',
|
||||
'--asciidoc-opts', ' '.join(asciidoc_opts),
|
||||
'@INPUT@',
|
||||
],
|
||||
input : input,
|
||||
output : [manpage],
|
||||
depend_files : [
|
||||
asciidoc_conf,
|
||||
] + page.get('extra_depends', []),
|
||||
install : true,
|
||||
install_dir : mandirn,
|
||||
)
|
||||
|
||||
html = custom_target(
|
||||
htmlpage,
|
||||
command : [
|
||||
ASCIIDOC,
|
||||
] + asciidoc_opts + [
|
||||
'-a', 'linkcss',
|
||||
'-a', 'toc',
|
||||
'-a', 'icons',
|
||||
'-a', 'max-width=960px',
|
||||
'-a', 'stylesheet=asciidoc-override.css',
|
||||
'-o', '@OUTPUT@',
|
||||
'@INPUT@',
|
||||
],
|
||||
input : input,
|
||||
output : [htmlpage],
|
||||
depend_files : [
|
||||
asciidoc_conf,
|
||||
'asciidoc-override.css',
|
||||
] + page.get('extra_depends', []),
|
||||
build_by_default : false,
|
||||
install : false,
|
||||
)
|
||||
html_targets += [html]
|
||||
html_files += [htmlpage]
|
||||
endforeach
|
||||
|
||||
run_target('html',
|
||||
command : ['/bin/true'],
|
||||
depends : html_targets)
|
||||
|
||||
custom_target(
|
||||
'website.tar.gz',
|
||||
command : [
|
||||
'bsdtar', 'czf', '@OUTPUT@',
|
||||
'-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',
|
||||
'-C', '/etc/asciidoc/javascripts/',
|
||||
'asciidoc.js',
|
||||
'-C', '/etc/asciidoc/',
|
||||
'images',
|
||||
],
|
||||
output : ['website.tar.gz'],
|
||||
build_by_default : false,
|
||||
depends : html_targets,
|
||||
)
|
||||
|
||||
meson.add_install_script(MESON_MAKE_SYMLINK,
|
||||
'repo-add.8',
|
||||
join_paths(MANDIR, 'man8/repo-remove.8'))
|
||||
|
||||
doxygen = find_program('doxygen', required : get_option('doxygen'))
|
||||
if doxygen.found() and not get_option('doxygen').disabled()
|
||||
doxyconf = configuration_data()
|
||||
doxyconf.set('OUTPUT_DIRECTORY', meson.current_build_dir())
|
||||
doxyfile = configure_file(
|
||||
input : 'Doxyfile.in',
|
||||
output : 'Doxyfile',
|
||||
configuration : doxyconf,
|
||||
install : false)
|
||||
|
||||
custom_target(
|
||||
'doxygen',
|
||||
input : doxyfile,
|
||||
output : ['man3'],
|
||||
command : [doxygen, doxyfile],
|
||||
build_by_default : true,
|
||||
install : true,
|
||||
install_dir : MANDIR)
|
||||
endif
|
||||
@@ -97,7 +97,13 @@ Operations
|
||||
Displays the program version.
|
||||
|
||||
*-v, \--verify*::
|
||||
Verify the file(s) specified by the signature(s).
|
||||
Assume that the first argument is a signature and verify it. If a second
|
||||
argument is provided, it is the file to be verified.
|
||||
+
|
||||
With only one argument given, assume that the signature is a detached
|
||||
signature, and look for a matching data file to verify by stripping the file
|
||||
extension. If no matching data file is found, fall back on GnuPG semantics and
|
||||
attempt to verify a file with an embedded signature.
|
||||
|
||||
|
||||
Options
|
||||
|
||||
@@ -176,7 +176,7 @@ Options
|
||||
operation on a local file. Uses the value from SigLevel as the default.
|
||||
|
||||
*RemoteFileSigLevel =* ...::
|
||||
Set the signature verification level for installing packages using the "-U"
|
||||
Set the signature verification level for installing packages using the "-U"
|
||||
operation on a remote file URL. Uses the value from SigLevel as the default.
|
||||
|
||||
*UseSyslog*::
|
||||
|
||||
@@ -39,7 +39,7 @@ address if you're afraid of spam.
|
||||
|
||||
* Describe your patch.
|
||||
|
||||
It helps if you describe the overview and goals of the patch in the git commit
|
||||
It helps if you describe the overview and goals of the patch in the git commit
|
||||
log. This allows others to see what you intended so as to compare it to what
|
||||
was actually done, and allows better feedback.
|
||||
|
||||
|
||||
@@ -130,9 +130,11 @@ DBGSRCDIR="/usr/src/debug"
|
||||
COMPRESSGZ=(gzip -c -f -n)
|
||||
COMPRESSBZ2=(bzip2 -c -f)
|
||||
COMPRESSXZ=(xz -c -z -)
|
||||
COMPRESSZST=(zstd -c -z -q -)
|
||||
COMPRESSLRZ=(lrzip -q)
|
||||
COMPRESSLZO=(lzop -q)
|
||||
COMPRESSZ=(compress -c -f)
|
||||
COMPRESSLZ4=(lz4 -q)
|
||||
|
||||
#########################################################################
|
||||
# EXTENSION DEFAULTS
|
||||
|
||||
@@ -427,7 +427,7 @@ static int commit_single_pkg(alpm_handle_t *handle, alpm_pkg_t *newpkg,
|
||||
ASSERT(trans != NULL, return -1);
|
||||
|
||||
/* see if this is an upgrade. if so, remove the old package first */
|
||||
if((oldpkg = newpkg->oldpkg)) {
|
||||
if(_alpm_db_get_pkgfromcache(db, newpkg->name) && (oldpkg = newpkg->oldpkg)) {
|
||||
int cmp = _alpm_pkg_compare_versions(newpkg, oldpkg);
|
||||
if(cmp < 0) {
|
||||
log_msg = "downgrading";
|
||||
|
||||
@@ -118,7 +118,9 @@ typedef enum _alpm_errno_t {
|
||||
ALPM_ERR_LIBARCHIVE,
|
||||
ALPM_ERR_LIBCURL,
|
||||
ALPM_ERR_EXTERNAL_DOWNLOAD,
|
||||
ALPM_ERR_GPGME
|
||||
ALPM_ERR_GPGME,
|
||||
/* Missing compile-time features */
|
||||
ALPM_ERR_MISSING_CAPABILITY_SIGNATURES
|
||||
} alpm_errno_t;
|
||||
|
||||
/** Returns the current error code from the handle. */
|
||||
@@ -1461,8 +1463,7 @@ alpm_pkg_t *alpm_sync_newversion(alpm_pkg_t *pkg, alpm_list_t *dbs_sync);
|
||||
typedef enum _alpm_transflag_t {
|
||||
/** Ignore dependency checks. */
|
||||
ALPM_TRANS_FLAG_NODEPS = 1,
|
||||
/** Ignore file conflicts and overwrite files. */
|
||||
ALPM_TRANS_FLAG_FORCE = (1 << 1),
|
||||
/* (1 << 1) flag can go here */
|
||||
/** Delete files even if they are tagged as backup. */
|
||||
ALPM_TRANS_FLAG_NOSAVE = (1 << 2),
|
||||
/** Ignore version numbers when checking dependencies. */
|
||||
|
||||
@@ -787,8 +787,8 @@ alpm_db_t *_alpm_db_register_sync(alpm_handle_t *handle, const char *treename,
|
||||
_alpm_log(handle, ALPM_LOG_DEBUG, "registering sync database '%s'\n", treename);
|
||||
|
||||
#ifndef HAVE_LIBGPGME
|
||||
if(level != ALPM_SIG_USE_DEFAULT) {
|
||||
RET_ERR(handle, ALPM_ERR_WRONG_ARGS, NULL);
|
||||
if(level != 0 && level != ALPM_SIG_USE_DEFAULT) {
|
||||
RET_ERR(handle, ALPM_ERR_MISSING_CAPABILITY_SIGNATURES, NULL);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
@@ -401,8 +401,7 @@ static alpm_pkg_t *_alpm_find_file_owner(alpm_handle_t *handle, const char *path
|
||||
|
||||
static int _alpm_can_overwrite_file(alpm_handle_t *handle, const char *path, const char *rootedpath)
|
||||
{
|
||||
return handle->trans->flags & ALPM_TRANS_FLAG_FORCE
|
||||
|| _alpm_fnmatch_patterns(handle->overwrite_files, path) == 0
|
||||
return _alpm_fnmatch_patterns(handle->overwrite_files, path) == 0
|
||||
|| _alpm_fnmatch_patterns(handle->overwrite_files, rootedpath) == 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -431,6 +431,7 @@ static int curl_download_internal(struct dload_payload *payload,
|
||||
/* Ignore any SIGPIPE signals. With libcurl, these shouldn't be happening,
|
||||
* but better safe than sorry. Store the old signal handler first. */
|
||||
mask_signal(SIGPIPE, SIG_IGN, &orig_sig_pipe);
|
||||
dload_interrupted = 0;
|
||||
mask_signal(SIGINT, &inthandler, &orig_sig_int);
|
||||
|
||||
/* perform transfer */
|
||||
@@ -473,6 +474,13 @@ static int curl_download_internal(struct dload_payload *payload,
|
||||
payload->remote_name, hostname);
|
||||
}
|
||||
goto cleanup;
|
||||
case CURLE_COULDNT_RESOLVE_HOST:
|
||||
payload->unlink_on_fail = 1;
|
||||
handle->pm_errno = ALPM_ERR_SERVER_BAD_URL;
|
||||
_alpm_log(handle, ALPM_LOG_ERROR,
|
||||
_("failed retrieving file '%s' from %s : %s\n"),
|
||||
payload->remote_name, hostname, error_buffer);
|
||||
goto cleanup;
|
||||
default:
|
||||
/* delete zero length downloads */
|
||||
if(fstat(fileno(localf), &st) == 0 && st.st_size == 0) {
|
||||
@@ -578,7 +586,7 @@ cleanup:
|
||||
unmask_signal(SIGINT, &orig_sig_int);
|
||||
unmask_signal(SIGPIPE, &orig_sig_pipe);
|
||||
/* if we were interrupted, trip the old handler */
|
||||
if(dload_interrupted) {
|
||||
if(dload_interrupted == ABORT_SIGINT) {
|
||||
raise(SIGINT);
|
||||
}
|
||||
|
||||
|
||||
@@ -159,6 +159,9 @@ const char SYMEXPORT *alpm_strerror(alpm_errno_t err)
|
||||
return _("gpgme error");
|
||||
case ALPM_ERR_EXTERNAL_DOWNLOAD:
|
||||
return _("error invoking external downloader");
|
||||
/* Missing compile-time features */
|
||||
case ALPM_ERR_MISSING_CAPABILITY_SIGNATURES:
|
||||
return _("compiled without signature support");
|
||||
/* Unknown error! */
|
||||
default:
|
||||
return _("unexpected error");
|
||||
|
||||
@@ -803,11 +803,14 @@ int SYMEXPORT alpm_option_set_default_siglevel(alpm_handle_t *handle,
|
||||
int level)
|
||||
{
|
||||
CHECK_HANDLE(handle, return -1);
|
||||
if(level == ALPM_SIG_USE_DEFAULT) {
|
||||
RET_ERR(handle, ALPM_ERR_WRONG_ARGS, -1);
|
||||
}
|
||||
#ifdef HAVE_LIBGPGME
|
||||
handle->siglevel = level;
|
||||
#else
|
||||
if(level != 0 && level != ALPM_SIG_USE_DEFAULT) {
|
||||
RET_ERR(handle, ALPM_ERR_WRONG_ARGS, -1);
|
||||
if(level != 0) {
|
||||
RET_ERR(handle, ALPM_ERR_MISSING_CAPABILITY_SIGNATURES, -1);
|
||||
}
|
||||
#endif
|
||||
return 0;
|
||||
@@ -827,7 +830,7 @@ int SYMEXPORT alpm_option_set_local_file_siglevel(alpm_handle_t *handle,
|
||||
handle->localfilesiglevel = level;
|
||||
#else
|
||||
if(level != 0 && level != ALPM_SIG_USE_DEFAULT) {
|
||||
RET_ERR(handle, ALPM_ERR_WRONG_ARGS, -1);
|
||||
RET_ERR(handle, ALPM_ERR_MISSING_CAPABILITY_SIGNATURES, -1);
|
||||
}
|
||||
#endif
|
||||
return 0;
|
||||
@@ -851,7 +854,7 @@ int SYMEXPORT alpm_option_set_remote_file_siglevel(alpm_handle_t *handle,
|
||||
handle->remotefilesiglevel = level;
|
||||
#else
|
||||
if(level != 0 && level != ALPM_SIG_USE_DEFAULT) {
|
||||
RET_ERR(handle, ALPM_ERR_WRONG_ARGS, -1);
|
||||
RET_ERR(handle, ALPM_ERR_MISSING_CAPABILITY_SIGNATURES, -1);
|
||||
}
|
||||
#endif
|
||||
return 0;
|
||||
|
||||
@@ -551,7 +551,16 @@ static int _alpm_hook_triggered(alpm_handle_t *handle, struct _alpm_hook_t *hook
|
||||
|
||||
static int _alpm_hook_cmp(struct _alpm_hook_t *h1, struct _alpm_hook_t *h2)
|
||||
{
|
||||
return strcmp(h1->name, h2->name);
|
||||
size_t suflen = strlen(ALPM_HOOK_SUFFIX), l1, l2;
|
||||
int ret;
|
||||
l1 = strlen(h1->name) - suflen;
|
||||
l2 = strlen(h2->name) - suflen;
|
||||
/* exclude the suffixes from comparison */
|
||||
ret = strncmp(h1->name, h2->name, l1 <= l2 ? l1 : l2);
|
||||
if(ret == 0 && l1 != l2) {
|
||||
return l1 < l2 ? -1 : 1;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
static alpm_list_t *find_hook(alpm_list_t *haystack, const void *needle)
|
||||
@@ -634,8 +643,7 @@ int _alpm_hook_run(alpm_handle_t *handle, alpm_hook_when_t when)
|
||||
alpm_event_hook_t event = { .when = when };
|
||||
alpm_event_hook_run_t hook_event;
|
||||
alpm_list_t *i, *hooks = NULL, *hooks_triggered = NULL;
|
||||
const char *suffix = ".hook";
|
||||
size_t suflen = strlen(suffix), triggered = 0;
|
||||
size_t suflen = strlen(ALPM_HOOK_SUFFIX), triggered = 0;
|
||||
int ret = 0;
|
||||
|
||||
for(i = alpm_list_last(handle->hookdirs); i; i = alpm_list_previous(i)) {
|
||||
@@ -681,7 +689,7 @@ int _alpm_hook_run(alpm_handle_t *handle, alpm_hook_when_t when)
|
||||
memcpy(path + dirlen, entry->d_name, name_len + 1);
|
||||
|
||||
if(name_len < suflen
|
||||
|| strcmp(entry->d_name + name_len - suflen, suffix) != 0) {
|
||||
|| strcmp(entry->d_name + name_len - suflen, ALPM_HOOK_SUFFIX) != 0) {
|
||||
_alpm_log(handle, ALPM_LOG_DEBUG, "skipping non-hook file %s\n", path);
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -22,6 +22,8 @@
|
||||
|
||||
#include "alpm.h"
|
||||
|
||||
#define ALPM_HOOK_SUFFIX ".hook"
|
||||
|
||||
int _alpm_hook_run(alpm_handle_t *handle, alpm_hook_when_t when);
|
||||
|
||||
#endif /* ALPM_HOOK_H */
|
||||
|
||||
33
lib/libalpm/meson.build
Normal file
33
lib/libalpm/meson.build
Normal file
@@ -0,0 +1,33 @@
|
||||
libalpm_sources = files('''
|
||||
add.h add.c
|
||||
alpm.h alpm.c
|
||||
alpm_list.h alpm_list.c
|
||||
backup.h backup.c
|
||||
base64.h base64.c
|
||||
be_local.c
|
||||
be_package.c
|
||||
be_sync.c
|
||||
conflict.h conflict.c
|
||||
db.h db.c
|
||||
delta.h delta.c
|
||||
deps.h deps.c
|
||||
diskspace.h diskspace.c
|
||||
dload.h dload.c
|
||||
error.c
|
||||
filelist.h filelist.c
|
||||
graph.h graph.c
|
||||
group.h group.c
|
||||
handle.h handle.c
|
||||
hook.h hook.c
|
||||
libarchive-compat.h
|
||||
log.h log.c
|
||||
package.h package.c
|
||||
pkghash.h pkghash.c
|
||||
rawstr.c
|
||||
remove.h remove.c
|
||||
signing.c signing.h
|
||||
sync.h sync.c
|
||||
trans.h trans.c
|
||||
util.h util.c
|
||||
version.c
|
||||
'''.split())
|
||||
15
lib/libalpm/po/meson.build
Normal file
15
lib/libalpm/po/meson.build
Normal file
@@ -0,0 +1,15 @@
|
||||
i18n.gettext(
|
||||
'libalpm',
|
||||
args : [
|
||||
'--directory=@0@'.format(meson.current_source_dir()),
|
||||
'--msgid-bugs-address=http://bugs.archlinux.org/index.php?project=3',
|
||||
'--copyright-holder="Pacman Development Team <pacman-dev@archlinux.org>"',
|
||||
'--language', 'c',
|
||||
|
||||
'--keyword=_',
|
||||
'--flag=_:1:c-format',
|
||||
|
||||
'--keyword=_n:1,2',
|
||||
'--flag=_n:1:c-format',
|
||||
'--flag=_n:2:c-format',
|
||||
])
|
||||
@@ -277,10 +277,21 @@ alpm_list_t SYMEXPORT *alpm_find_group_pkgs(alpm_list_t *dbs,
|
||||
|
||||
for(j = grp->packages; j; j = j->next) {
|
||||
alpm_pkg_t *pkg = j->data;
|
||||
alpm_trans_t *trans = db->handle->trans;
|
||||
|
||||
if(alpm_pkg_find(ignorelist, pkg->name)) {
|
||||
continue;
|
||||
}
|
||||
if(trans != NULL && trans->flags & ALPM_TRANS_FLAG_NEEDED) {
|
||||
alpm_pkg_t *local = _alpm_db_get_pkgfromcache(db->handle->db_local, pkg->name);
|
||||
if(local && _alpm_pkg_compare_versions(pkg, local) == 0) {
|
||||
/* with the NEEDED flag, packages up to date are not reinstalled */
|
||||
_alpm_log(db->handle, ALPM_LOG_WARNING, _("%s-%s is up to date -- skipping\n"),
|
||||
local->name, local->version);
|
||||
ignorelist = alpm_list_add(ignorelist, pkg);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if(alpm_pkg_should_ignore(db->handle, pkg)) {
|
||||
alpm_question_install_ignorepkg_t question = {
|
||||
.type = ALPM_QUESTION_INSTALL_IGNOREPKG,
|
||||
@@ -1176,17 +1187,28 @@ static int check_validity(alpm_handle_t *handle,
|
||||
if(errors) {
|
||||
for(i = errors; i; i = i->next) {
|
||||
struct validity *v = i->data;
|
||||
if(v->error == ALPM_ERR_PKG_MISSING_SIG) {
|
||||
_alpm_log(handle, ALPM_LOG_ERROR,
|
||||
_("%s: missing required signature\n"), v->pkg->name);
|
||||
} else if(v->error == ALPM_ERR_PKG_INVALID_SIG) {
|
||||
_alpm_process_siglist(handle, v->pkg->name, v->siglist,
|
||||
v->siglevel & ALPM_SIG_PACKAGE_OPTIONAL,
|
||||
v->siglevel & ALPM_SIG_PACKAGE_MARGINAL_OK,
|
||||
v->siglevel & ALPM_SIG_PACKAGE_UNKNOWN_OK);
|
||||
prompt_to_delete(handle, v->path, v->error);
|
||||
} else if(v->error == ALPM_ERR_PKG_INVALID_CHECKSUM) {
|
||||
prompt_to_delete(handle, v->path, v->error);
|
||||
switch(v->error) {
|
||||
case ALPM_ERR_PKG_MISSING_SIG:
|
||||
_alpm_log(handle, ALPM_LOG_ERROR,
|
||||
_("%s: missing required signature\n"), v->pkg->name);
|
||||
break;
|
||||
case ALPM_ERR_PKG_INVALID_SIG:
|
||||
_alpm_process_siglist(handle, v->pkg->name, v->siglist,
|
||||
v->siglevel & ALPM_SIG_PACKAGE_OPTIONAL,
|
||||
v->siglevel & ALPM_SIG_PACKAGE_MARGINAL_OK,
|
||||
v->siglevel & ALPM_SIG_PACKAGE_UNKNOWN_OK);
|
||||
/* fallthrough */
|
||||
case ALPM_ERR_PKG_INVALID_CHECKSUM:
|
||||
prompt_to_delete(handle, v->path, v->error);
|
||||
break;
|
||||
case ALPM_ERR_PKG_NOT_FOUND:
|
||||
case ALPM_ERR_BADPERMS:
|
||||
case ALPM_ERR_PKG_OPEN:
|
||||
_alpm_log(handle, ALPM_LOG_ERROR, _("failed to read file %s: %s\n"), v->path, alpm_strerror(v->error));
|
||||
break;
|
||||
default:
|
||||
/* ignore */
|
||||
break;
|
||||
}
|
||||
alpm_siglist_cleanup(v->siglist);
|
||||
free(v->siglist);
|
||||
|
||||
@@ -548,6 +548,25 @@ static int _alpm_chroot_read_from_child(alpm_handle_t *handle, int fd,
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void _alpm_reset_signals(void)
|
||||
{
|
||||
/* reset POSIX defined signals (see signal.h) */
|
||||
/* there are likely more but there is no easy way
|
||||
* to get the full list of valid signals */
|
||||
int *i, signals[] = {
|
||||
SIGABRT, SIGALRM, SIGBUS, SIGCHLD, SIGCONT, SIGFPE, SIGHUP, SIGILL,
|
||||
SIGINT, SIGKILL, SIGPIPE, SIGQUIT, SIGSEGV, SIGSTOP, SIGTERM, SIGTSTP,
|
||||
SIGTTIN, SIGTTOU, SIGUSR1, SIGUSR2, SIGPOLL, SIGPROF, SIGSYS, SIGTRAP,
|
||||
SIGURG, SIGVTALRM, SIGXCPU, SIGXFSZ,
|
||||
0
|
||||
};
|
||||
struct sigaction def;
|
||||
def.sa_handler = SIG_DFL;
|
||||
for(i = signals; *i; i++) {
|
||||
sigaction(*i, &def, NULL);
|
||||
}
|
||||
}
|
||||
|
||||
/** Execute a command with arguments in a chroot.
|
||||
* @param handle the context handle
|
||||
* @param cmd command to execute
|
||||
@@ -633,6 +652,7 @@ int _alpm_run_chroot(alpm_handle_t *handle, const char *cmd, char *const argv[],
|
||||
exit(1);
|
||||
}
|
||||
umask(0022);
|
||||
_alpm_reset_signals();
|
||||
execv(cmd, argv);
|
||||
/* execv only returns if there was an error */
|
||||
fprintf(stderr, _("call to execv failed (%s)\n"), strerror(errno));
|
||||
@@ -645,6 +665,7 @@ int _alpm_run_chroot(alpm_handle_t *handle, const char *cmd, char *const argv[],
|
||||
ssize_t olen = 0, ilen = 0;
|
||||
nfds_t nfds = 2;
|
||||
struct pollfd fds[2], *child2parent = &(fds[0]), *parent2child = &(fds[1]);
|
||||
int poll_ret;
|
||||
|
||||
child2parent->fd = child2parent_pipefd[TAIL];
|
||||
child2parent->events = POLLIN;
|
||||
@@ -665,7 +686,14 @@ int _alpm_run_chroot(alpm_handle_t *handle, const char *cmd, char *const argv[],
|
||||
#define STOP_POLLING(p) do { close(p->fd); p->fd = -1; } while(0)
|
||||
|
||||
while((child2parent->fd != -1 || parent2child->fd != -1)
|
||||
&& poll(fds, nfds, -1) > 0) {
|
||||
&& (poll_ret = poll(fds, nfds, -1)) != 0) {
|
||||
if(poll_ret == -1) {
|
||||
if(errno == EINTR) {
|
||||
continue;
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(child2parent->revents & POLLIN) {
|
||||
if(_alpm_chroot_read_from_child(handle, child2parent->fd,
|
||||
ibuf, &ilen, sizeof(ibuf)) != 0) {
|
||||
|
||||
497
meson.build
Normal file
497
meson.build
Normal file
@@ -0,0 +1,497 @@
|
||||
project('pacman',
|
||||
'c',
|
||||
version : '5.1.0',
|
||||
license : 'GPLv2+',
|
||||
default_options : [
|
||||
'c_std=gnu99',
|
||||
'prefix=/usr',
|
||||
'sysconfdir=/etc',
|
||||
'localstatedir=/var',
|
||||
],
|
||||
meson_version : '>= 0.47')
|
||||
|
||||
libalpm_version = '11.0.1'
|
||||
|
||||
cc = meson.get_compiler('c')
|
||||
|
||||
# commandline options
|
||||
PREFIX = get_option('prefix')
|
||||
DATAROOTDIR = join_paths(PREFIX, get_option('datarootdir'))
|
||||
SYSCONFDIR = join_paths(PREFIX, get_option('sysconfdir'))
|
||||
LOCALSTATEDIR = join_paths(PREFIX, get_option('localstatedir'))
|
||||
LOCALEDIR = join_paths(PREFIX, get_option('localedir'))
|
||||
ROOTDIR = get_option('root-dir')
|
||||
BINDIR = join_paths(PREFIX, get_option('bindir'))
|
||||
MANDIR = join_paths(PREFIX, get_option('mandir'))
|
||||
BUILDSCRIPT = get_option('buildscript')
|
||||
LIBMAKEPKGDIR = join_paths(PREFIX, DATAROOTDIR, 'makepkg')
|
||||
PKGDATADIR = join_paths(PREFIX, DATAROOTDIR, meson.project_name())
|
||||
|
||||
PYTHON = import('python').find_installation('python3')
|
||||
M4 = find_program('m4')
|
||||
SED = find_program('sed')
|
||||
DU = find_program('du')
|
||||
LDCONFIG = get_option('ldconfig')
|
||||
MESON_MAKE_SYMLINK = join_paths(meson.source_root(), 'build-aux/meson-make-symlink.sh')
|
||||
MESON_INSTALL_SCRIPT = join_paths(meson.source_root(), 'build-aux/meson-install-script.sh')
|
||||
|
||||
BASH = find_program('bash4', 'bash')
|
||||
if BASH.found()
|
||||
bash_version = run_command(BASH, '-c', 'IFS=.; echo "${BASH_VERSINFO[*]:0:3}"').stdout()
|
||||
|
||||
have_bash = bash_version.version_compare('>= 4.4.0')
|
||||
endif
|
||||
if not have_bash
|
||||
error('bash >= 4.4.0 is required for pacman scripts.')
|
||||
endif
|
||||
|
||||
bashcompletion = dependency('bash-completion', required : false)
|
||||
if bashcompletion.found()
|
||||
BASHCOMPDIR = bashcompletion.get_pkgconfig_variable('completionsdir')
|
||||
else
|
||||
BASHCOMPDIR = join_paths(DATAROOTDIR, 'bash-completion/completions')
|
||||
endif
|
||||
|
||||
if get_option('use-git-version')
|
||||
PACKAGE_VERSION = run_command(
|
||||
find_program('git'),
|
||||
'describe',
|
||||
'--abbrev=4',
|
||||
'--dirty').stdout().strip().strip('v')
|
||||
else
|
||||
PACKAGE_VERSION = meson.project_version()
|
||||
endif
|
||||
|
||||
conf = configuration_data()
|
||||
conf.set('_GNU_SOURCE', true)
|
||||
conf.set_quoted('PACKAGE', meson.project_name())
|
||||
conf.set_quoted('PACKAGE_VERSION', PACKAGE_VERSION)
|
||||
conf.set_quoted('LOCALEDIR', LOCALEDIR)
|
||||
conf.set_quoted('SCRIPTLET_SHELL', get_option('scriptlet-shell'))
|
||||
conf.set_quoted('LDCONFIG', LDCONFIG)
|
||||
conf.set_quoted('LIB_VERSION', meson.project_version())
|
||||
conf.set_quoted('SYSHOOKDIR', join_paths(DATAROOTDIR, 'libalpm/hooks/'))
|
||||
conf.set_quoted('CONFFILE', join_paths(SYSCONFDIR, 'pacman.conf'))
|
||||
conf.set_quoted('DBPATH', join_paths(LOCALSTATEDIR, 'lib/pacman/'))
|
||||
conf.set_quoted('GPGDIR', join_paths(SYSCONFDIR, 'pacman.d/gnupg/'))
|
||||
conf.set_quoted('LOGFILE', join_paths(LOCALSTATEDIR, 'log/pacman.log'))
|
||||
conf.set_quoted('CACHEDIR', join_paths(LOCALSTATEDIR, 'cache/pacman/pkg/'))
|
||||
conf.set_quoted('HOOKDIR', join_paths(SYSCONFDIR, 'pacman.d/hooks/'))
|
||||
conf.set_quoted('ROOTDIR', ROOTDIR)
|
||||
|
||||
if get_option('i18n')
|
||||
if not cc.has_function('ngettext')
|
||||
error('ngettext not found but NLS support requested')
|
||||
endif
|
||||
conf.set('ENABLE_NLS', 1)
|
||||
endif
|
||||
|
||||
# dependencies
|
||||
libarchive = dependency('libarchive',
|
||||
version : '>=3.0.0',
|
||||
static : get_option('buildstatic'))
|
||||
|
||||
libcurl = dependency('libcurl',
|
||||
version : '>=7.32.0',
|
||||
required : get_option('curl'),
|
||||
static : get_option('buildstatic'))
|
||||
conf.set('HAVE_LIBCURL', libcurl.found())
|
||||
|
||||
want_gpgme = get_option('gpgme')
|
||||
gpgme_config = find_program('gpgme-config', required : want_gpgme)
|
||||
if not want_gpgme.disabled() and gpgme_config.found()
|
||||
gpgme_version = run_command(gpgme_config, '--version').stdout().strip()
|
||||
|
||||
needed_gpgme_version = '>=1.3.0'
|
||||
have = gpgme_version.version_compare(needed_gpgme_version)
|
||||
if want_gpgme.enabled() and not have
|
||||
error('gpgme @0@ is needed for GPG signature support'.format(needed_gpgme_version))
|
||||
endif
|
||||
|
||||
gpgme_libs = [
|
||||
cc.find_library('gpgme', required : have,
|
||||
dirs : [get_option('gpgme-libdir')]),
|
||||
cc.find_library('gpg-error', required : have,
|
||||
dirs : [get_option('gpgme-libdir')]),
|
||||
cc.find_library('assuan', required : have,
|
||||
dirs : [get_option('gpgme-libdir')]),
|
||||
]
|
||||
|
||||
conf.set('HAVE_LIBGPGME', have)
|
||||
else
|
||||
gpgme_libs = []
|
||||
conf.set('HAVE_LIBGPGME', false)
|
||||
endif
|
||||
|
||||
want_crypto = get_option('crypto')
|
||||
if want_crypto == 'openssl'
|
||||
libcrypto = dependency('libcrypto', static : get_option('buildstatic'))
|
||||
if not libcrypto.found()
|
||||
error('openssl support requested but not found')
|
||||
endif
|
||||
crypto_provider = libcrypto
|
||||
conf.set10('HAVE_LIBSSL', true)
|
||||
elif want_crypto == 'nettle'
|
||||
libnettle = dependency('nettle', static : get_option('buildstatic'))
|
||||
if not libnettle.found()
|
||||
error('nettle support requested but not found')
|
||||
endif
|
||||
crypto_provider = libnettle
|
||||
conf.set10('HAVE_LIBNETTLE', true)
|
||||
else
|
||||
error('unhandled crypto value @0@'.format(want_crypto))
|
||||
endif
|
||||
|
||||
foreach header : [
|
||||
'mntent.h',
|
||||
'sys/mnttab.h',
|
||||
'sys/mount.h',
|
||||
'sys/param.h',
|
||||
'sys/statvfs.h',
|
||||
'sys/types.h',
|
||||
'sys/ucred.h',
|
||||
'termios.h',
|
||||
]
|
||||
if cc.has_header(header)
|
||||
conf.set('HAVE_' + header.underscorify().to_upper(), true)
|
||||
endif
|
||||
endforeach
|
||||
|
||||
foreach sym : [
|
||||
'dup2',
|
||||
'fork',
|
||||
'getcwd',
|
||||
'getmntent',
|
||||
'getmntinfo',
|
||||
'gettimeofday',
|
||||
'memmove',
|
||||
'memset',
|
||||
'mkdir',
|
||||
'realpath',
|
||||
'regcomp',
|
||||
'rmdir',
|
||||
'setenv',
|
||||
'setlocale',
|
||||
'strcasecmp',
|
||||
'strchr',
|
||||
'strcspn',
|
||||
'strdup',
|
||||
'strerror',
|
||||
'strndup',
|
||||
'strnlen',
|
||||
'strnlen',
|
||||
'strrchr',
|
||||
'strsep',
|
||||
'strsep',
|
||||
'strstr',
|
||||
'strtol',
|
||||
'swprintf',
|
||||
'tcflush',
|
||||
'tcflush',
|
||||
'uname',
|
||||
'wcwidth',
|
||||
]
|
||||
have = cc.has_function(sym, args : '-D_GNU_SOURCE')
|
||||
conf.set10('HAVE_' + sym.to_upper(), have)
|
||||
endforeach
|
||||
|
||||
foreach member : [
|
||||
['struct stat', 'st_blksize', '''#include <sys/stat.h>'''],
|
||||
['struct statvfs', 'f_flag', '''#include <sys/statvfs.h>'''],
|
||||
['struct statfs', 'f_flags', '''#include <sys/param.h>
|
||||
#include <sys/mount.h>'''],
|
||||
]
|
||||
have = cc.has_member(member[0], member[1], prefix : member[2])
|
||||
conf.set('HAVE_' + '_'.join([member[0], member[1]]).underscorify().to_upper(), have)
|
||||
endforeach
|
||||
|
||||
if conf.has('HAVE_STRUCT_STATVFS_F_FLAG')
|
||||
conf.set('FSSTATSTYPE', 'struct statvfs')
|
||||
elif conf.has('HAVE_STRUCT_STATFS_F_FLAGS')
|
||||
conf.set('FSSTATSTYPE', 'struct statfs')
|
||||
endif
|
||||
|
||||
if get_option('buildtype').startswith('debug')
|
||||
extra_cflags = [
|
||||
'-Wcast-align',
|
||||
'-Wclobbered',
|
||||
'-Wempty-body',
|
||||
'-Wfloat-equal',
|
||||
'-Wformat-nonliteral',
|
||||
'-Wformat-security',
|
||||
'-Wignored-qualifiers',
|
||||
'-Winit-self',
|
||||
'-Wlogical-op',
|
||||
'-Wmissing-declarations',
|
||||
'-Wmissing-field-initializers',
|
||||
'-Wmissing-parameter-type',
|
||||
'-Wmissing-prototypes',
|
||||
'-Wold-style-declaration',
|
||||
'-Woverride-init',
|
||||
'-Wpointer-arith',
|
||||
'-Wredundant-decls',
|
||||
'-Wshadow',
|
||||
'-Wsign-compare',
|
||||
'-Wstrict-aliasing',
|
||||
'-Wstrict-overflow=5',
|
||||
'-Wstrict-prototypes',
|
||||
'-Wtype-limits',
|
||||
'-Wuninitialized',
|
||||
'-Wunused-but-set-parameter',
|
||||
'-Wunused-parameter',
|
||||
'-Wwrite-strings',
|
||||
]
|
||||
add_project_arguments(cc.get_supported_arguments(extra_cflags), language : 'c')
|
||||
|
||||
conf.set('PACMAN_DEBUG', 1)
|
||||
endif
|
||||
|
||||
config_h = configure_file(
|
||||
output : 'config.h',
|
||||
configuration : conf)
|
||||
add_project_arguments('-include', 'config.h', language : 'c')
|
||||
|
||||
default_duflags = ' -sk --apparent-size'
|
||||
default_sedinplaceflags = ' --follow-symlinks -i'
|
||||
inodecmd = 'stat -c \'%i %n\''
|
||||
ownercmd = 'stat -c \'%u:%g\''
|
||||
modecmd = 'stat -c \'%a\''
|
||||
strip_binaries = '--strip-all'
|
||||
strip_shared = '--strip-unneeded'
|
||||
strip_static = '--strip-debug'
|
||||
|
||||
os = host_machine.system()
|
||||
if os.startswith('darwin')
|
||||
inodecmd = '/usr/bin/stat -f \'%i %n\''
|
||||
ownercmd = '/usr/bin/stat -f \'%u:%g\''
|
||||
modecmd = '/usr/bin/stat -f \'%lp\''
|
||||
default_sedinplaceflags = ' -i \'\''
|
||||
default_duflags = ' -sk'
|
||||
strip_binaries = ''
|
||||
strip_shared = '-s'
|
||||
strip_static = '-s'
|
||||
elif os.contains('bsd') or os == 'dragonfly'
|
||||
inodecmd = 'stat -f \'%i %n\''
|
||||
ownercmd = 'stat -f \'%u:%g\''
|
||||
modecmd = 'stat -f \'%lp\''
|
||||
default_sedinplaceflags = ' -i \'\''
|
||||
default_duflags = ' -sk'
|
||||
endif
|
||||
|
||||
duflags = get_option('duflags')
|
||||
if duflags == 'autodetect'
|
||||
duflags = default_duflags
|
||||
endif
|
||||
|
||||
sedinplaceflags = get_option('sedinplaceflags')
|
||||
if sedinplaceflags == 'auto'
|
||||
sedinplaceflags = default_sedinplaceflags
|
||||
endif
|
||||
|
||||
chost = run_command(cc, '-dumpmachine').stdout().strip()
|
||||
carch = chost.split('-')[0]
|
||||
|
||||
# annoyingly, we have to maintain two sets of configuration_data which is
|
||||
# largely identical, but which distinguishes between quoting needs.
|
||||
substs = configuration_data()
|
||||
substs.set('SED', SED.path())
|
||||
substs.set('M4', M4.path())
|
||||
substs.set('CARCH', carch)
|
||||
substs.set('CHOST', chost)
|
||||
substs.set('PKGEXT', get_option('pkg-ext'))
|
||||
substs.set('SRCEXT', get_option('src-ext'))
|
||||
substs.set('ROOTDIR', ROOTDIR)
|
||||
substs.set('LOCALEDIR', LOCALEDIR)
|
||||
substs.set('sysconfdir', SYSCONFDIR)
|
||||
substs.set('localstatedir', LOCALSTATEDIR)
|
||||
substs.set('PKGDATADIR', PKGDATADIR)
|
||||
substs.set('PREFIX', PREFIX)
|
||||
substs.set('BASH', BASH.path())
|
||||
substs.set('PACKAGE_VERSION', PACKAGE_VERSION)
|
||||
substs.set('PACKAGE_NAME', meson.project_name())
|
||||
substs.set('BUILDSCRIPT', BUILDSCRIPT)
|
||||
substs.set('TEMPLATE_DIR', get_option('makepkg-template-dir'))
|
||||
substs.set('DEBUGSUFFIX', get_option('debug-suffix'))
|
||||
substs.set('INODECMD', inodecmd)
|
||||
substs.set('OWNERCMD', ownercmd)
|
||||
substs.set('MODECMD', modecmd)
|
||||
substs.set('SEDINPLACEFLAGS', sedinplaceflags)
|
||||
substs.set('SEDPATH', SED.path())
|
||||
substs.set('DUFLAGS', duflags)
|
||||
substs.set('DUPATH', DU.path())
|
||||
substs.set('LIBMAKEPKGDIR', LIBMAKEPKGDIR)
|
||||
substs.set('STRIP_BINARIES', strip_binaries)
|
||||
substs.set('STRIP_SHARED', strip_shared)
|
||||
substs.set('STRIP_STATIC', strip_static)
|
||||
|
||||
subdir('lib/libalpm')
|
||||
subdir('src/common')
|
||||
subdir('src/pacman')
|
||||
subdir('src/util')
|
||||
subdir('scripts')
|
||||
|
||||
# Internationalization
|
||||
if get_option('i18n')
|
||||
i18n = import('i18n')
|
||||
subdir('lib/libalpm/po')
|
||||
subdir('src/pacman/po')
|
||||
subdir('scripts/po')
|
||||
endif
|
||||
|
||||
want_doc = get_option('doc')
|
||||
ASCIIDOC = find_program('asciidoc', required : want_doc)
|
||||
A2X = find_program('a2x', required : want_doc)
|
||||
build_doc = A2X.found() and not want_doc.disabled()
|
||||
if build_doc
|
||||
subdir('doc')
|
||||
endif
|
||||
|
||||
includes = include_directories('src/common', 'lib/libalpm')
|
||||
|
||||
libcommon = static_library(
|
||||
'common',
|
||||
libcommon_sources,
|
||||
include_directories : includes,
|
||||
install : false)
|
||||
|
||||
libalpm = library(
|
||||
'alpm',
|
||||
libalpm_sources,
|
||||
version : libalpm_version,
|
||||
include_directories : includes,
|
||||
dependencies : [crypto_provider, libarchive, libcurl] + gpgme_libs,
|
||||
link_with : [libcommon],
|
||||
install : true)
|
||||
|
||||
install_headers(
|
||||
'lib/libalpm/alpm.h',
|
||||
'lib/libalpm/alpm_list.h')
|
||||
|
||||
# TODO: libs.private seem quite wrong here
|
||||
pkgconfig = import('pkgconfig')
|
||||
pkgconfig.generate(
|
||||
libalpm,
|
||||
name : 'libalpm',
|
||||
description : 'Arch Linux package management library',
|
||||
version : libalpm_version,
|
||||
url : 'http://www.archlinux.org/pacman/')
|
||||
|
||||
pacman_bin = executable(
|
||||
'pacman',
|
||||
pacman_sources,
|
||||
include_directories : includes,
|
||||
link_with : [libalpm, libcommon],
|
||||
dependencies : [libarchive],
|
||||
install : true,
|
||||
)
|
||||
|
||||
executable(
|
||||
'pacman-conf',
|
||||
pacman_conf_sources,
|
||||
include_directories : includes,
|
||||
link_with : [libalpm],
|
||||
install : true,
|
||||
)
|
||||
|
||||
executable(
|
||||
'cleanupdelta',
|
||||
cleanupdelta_sources,
|
||||
include_directories : includes,
|
||||
link_with : [libalpm],
|
||||
install : true,
|
||||
)
|
||||
|
||||
executable(
|
||||
'testpkg',
|
||||
testpkg_sources,
|
||||
include_directories : includes,
|
||||
link_with : [libalpm],
|
||||
install : true,
|
||||
)
|
||||
|
||||
executable(
|
||||
'vercmp',
|
||||
vercmp_sources,
|
||||
include_directories : includes,
|
||||
link_with : [libalpm],
|
||||
install : true,
|
||||
)
|
||||
|
||||
configure_file(
|
||||
input : 'etc/makepkg.conf.in',
|
||||
output : 'makepkg.conf',
|
||||
configuration : substs,
|
||||
install_dir : SYSCONFDIR)
|
||||
|
||||
configure_file(
|
||||
input : 'etc/pacman.conf.in',
|
||||
output : 'pacman.conf',
|
||||
configuration : substs,
|
||||
install_dir : SYSCONFDIR)
|
||||
|
||||
install_data(
|
||||
'proto/PKGBUILD-split.proto',
|
||||
'proto/PKGBUILD-vcs.proto',
|
||||
'proto/PKGBUILD.proto',
|
||||
'proto/proto.install',
|
||||
install_dir : join_paths(DATAROOTDIR, 'pacman'))
|
||||
|
||||
foreach path : [
|
||||
join_paths(LOCALSTATEDIR, 'lib/pacman/'),
|
||||
join_paths(LOCALSTATEDIR, 'cache/pacman/pkg/'),
|
||||
join_paths(DATAROOTDIR, 'makepkg-template/'),
|
||||
join_paths(DATAROOTDIR, 'libalpm/hooks/'),
|
||||
]
|
||||
meson.add_install_script('sh', '-c', 'mkdir -p "$DESTDIR/@0@"'.format(path))
|
||||
endforeach
|
||||
|
||||
TEST_ENV = environment()
|
||||
TEST_ENV.set('PMTEST_SCRIPTLIB_DIR', join_paths(meson.source_root(), 'scripts/library/'))
|
||||
TEST_ENV.set('PMTEST_LIBMAKEPKG_DIR', join_paths(meson.build_root(), 'scripts/libmakepkg/'))
|
||||
TEST_ENV.set('PMTEST_UTIL_DIR', meson.build_root() + '/')
|
||||
TEST_ENV.set('PMTEST_SCRIPT_DIR', join_paths(meson.build_root(), 'scripts/'))
|
||||
|
||||
subdir('test/pacman')
|
||||
subdir('test/scripts')
|
||||
subdir('test/util')
|
||||
|
||||
message('\n '.join([
|
||||
'@0@ @1@'.format(meson.project_name(), meson.project_version()),
|
||||
'Build information:',
|
||||
' prefix : @0@'.format(PREFIX),
|
||||
' sysconfdir : @0@'.format(SYSCONFDIR),
|
||||
' conf file : @0@'.format(join_paths(SYSCONFDIR, 'pacman.conf')),
|
||||
' localstatedir : @0@'.format(LOCALSTATEDIR),
|
||||
' database dir : @0@'.format(join_paths(LOCALSTATEDIR, 'lib/pacman/')),
|
||||
' cache dir : @0@'.format(join_paths(LOCALSTATEDIR, 'cache/pacman/pkg/')),
|
||||
' compiler : @0@ @1@'.format(cc.get_id(), cc.version()),
|
||||
'',
|
||||
' Architecture : @0@'.format(carch),
|
||||
' Host Type : @0@'.format(chost),
|
||||
' File inode command : @0@'.format(inodecmd),
|
||||
' File owner command : @0@'.format(ownercmd),
|
||||
' File mode command : @0@'.format(modecmd),
|
||||
' Directory size command : @0@ @1@'.format(DU.path(), duflags),
|
||||
' In-place sed command : @0@ @1@'.format(SED.path(), sedinplaceflags),
|
||||
' libalpm version : @0@'.format(libalpm_version),
|
||||
' pacman version : @0@'.format(PACKAGE_VERSION),
|
||||
'',
|
||||
'Directory and file information:',
|
||||
' root working directory : @0@'.format(ROOTDIR),
|
||||
' package extension : @0@'.format(get_option('pkg-ext')),
|
||||
' source pkg extension : @0@'.format(get_option('src-ext')),
|
||||
' build script name : @0@'.format(BUILDSCRIPT),
|
||||
' template directory : @0@'.format(get_option('makepkg-template-dir')),
|
||||
'',
|
||||
'Compilation options:',
|
||||
' i18n support : @0@'.format(get_option('i18n')),
|
||||
' Build docs : @0@'.format(build_doc),
|
||||
' debug build : @0@'.format(get_option('buildtype') == 'debug'),
|
||||
' Use libcurl : @0@'.format(conf.get('HAVE_LIBCURL')),
|
||||
' Use GPGME : @0@'.format(conf.get('HAVE_LIBGPGME')),
|
||||
' Use OpenSSL : @0@'.format(conf.has('HAVE_LIBSSL') and
|
||||
conf.get('HAVE_LIBSSL') == 1),
|
||||
' Use nettle : @0@'.format(conf.has('HAVE_LIBNETTLE') and
|
||||
conf.get('HAVE_LIBNETTLE') == 1),
|
||||
'',
|
||||
]))
|
||||
61
meson_options.txt
Normal file
61
meson_options.txt
Normal file
@@ -0,0 +1,61 @@
|
||||
# build behavior
|
||||
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')
|
||||
|
||||
# directories and filenames
|
||||
option('root-dir', type : 'string', value : '/',
|
||||
description : 'set the location of the root operating directory')
|
||||
|
||||
option('pkg-ext', type : 'string', value : '.pkg.tar.gz',
|
||||
description : 'set the file extension used by packages')
|
||||
|
||||
option('src-ext', type : 'string', value : '.src.tar.gz',
|
||||
description : 'set the file extension used by source packages')
|
||||
|
||||
option('scriptlet-shell', type : 'string', value : '/bin/sh',
|
||||
description : 'The full path of the shell used to run install scriptlets')
|
||||
|
||||
option('ldconfig', type : 'string', value : '/sbin/ldconfig',
|
||||
description : 'set the full path to ldconfig')
|
||||
|
||||
option('buildscript', type : 'string', value : 'PKGBUILD',
|
||||
description : 'set the build script name used by makepkg')
|
||||
|
||||
option('datarootdir', type : 'string', value : 'share',
|
||||
description : 'FIXME')
|
||||
|
||||
option('makepkg-template-dir', type : 'string', value : '/usr/share/makepkg-template',
|
||||
description : 'template dir used by makepkg-template')
|
||||
|
||||
option('debug-suffix', type : 'string', value : 'debug',
|
||||
description : 'suffix for split debugging symbol packages used by makepkg')
|
||||
|
||||
# dependencies, features
|
||||
option('doc', type : 'feature', value : 'auto',
|
||||
description : 'generate docs and manpages')
|
||||
|
||||
option('doxygen', type : 'feature', value : 'disabled',
|
||||
description : 'generate doxygen manpages and html')
|
||||
|
||||
option('curl', type : 'feature', value : 'auto',
|
||||
description : 'use curl to download files')
|
||||
|
||||
option('crypto', type : 'combo', choices : ['openssl', 'nettle'],
|
||||
description : 'select crypto implementation')
|
||||
|
||||
option('gpgme', type : 'feature', value : 'auto',
|
||||
description : 'use GPGME for PGP signature verification')
|
||||
option('gpgme-libdir', type : 'string', value : '/usr/lib',
|
||||
description : 'search directory for gpgme libraries.')
|
||||
|
||||
option('i18n', type : 'boolean', value : true,
|
||||
description : 'enable localization of pacman, libalpm and scripts')
|
||||
|
||||
# tools
|
||||
option('duflags', type : 'string', value : 'autodetect',
|
||||
description : 'flags to pass to du to measure file size')
|
||||
|
||||
option('sedinplaceflags', type : 'string', value : 'auto',
|
||||
description : 'flags to pass to sed to edit a file in-place')
|
||||
@@ -1,10 +1,7 @@
|
||||
# enforce that all scripts have a --help and --version option
|
||||
AUTOMAKE_OPTIONS = std-options
|
||||
AM_INSTALLCHECK_STD_OPTIONS_EXEMPT = \
|
||||
makepkg-wrapper \
|
||||
pacman-db-upgrade-wrapper \
|
||||
pacman-key-wrapper \
|
||||
pkgdelta-wrapper
|
||||
$(WRAPPER)
|
||||
|
||||
SUBDIRS = po
|
||||
|
||||
@@ -35,14 +32,13 @@ EXTRA_DIST = \
|
||||
$(LIBMAKEPKG_DIST)
|
||||
|
||||
LIBRARY = \
|
||||
library/output_format.sh \
|
||||
library/human_to_size.sh \
|
||||
library/size_to_human.sh \
|
||||
library/term_colors.sh
|
||||
library/human_to_size.sh
|
||||
|
||||
libmakepkgdir = $(datarootdir)/makepkg
|
||||
|
||||
LIBMAKEPKGDIRS = \
|
||||
buildenv \
|
||||
executable \
|
||||
integrity \
|
||||
lint_config \
|
||||
lint_package \
|
||||
@@ -52,6 +48,22 @@ LIBMAKEPKGDIRS = \
|
||||
util
|
||||
|
||||
LIBMAKEPKG_IN = \
|
||||
libmakepkg/executable.sh \
|
||||
libmakepkg/executable/ccache.sh \
|
||||
libmakepkg/executable/checksum.sh \
|
||||
libmakepkg/executable/distcc.sh \
|
||||
libmakepkg/executable/fakeroot.sh \
|
||||
libmakepkg/executable/gpg.sh \
|
||||
libmakepkg/executable/gzip.sh \
|
||||
libmakepkg/executable/pacman.sh \
|
||||
libmakepkg/executable/strip.sh \
|
||||
libmakepkg/executable/sudo.sh \
|
||||
libmakepkg/executable/vcs.sh \
|
||||
libmakepkg/buildenv.sh \
|
||||
libmakepkg/buildenv/buildflags.sh \
|
||||
libmakepkg/buildenv/compiler.sh \
|
||||
libmakepkg/buildenv/debugflags.sh \
|
||||
libmakepkg/buildenv/makeflags.sh \
|
||||
libmakepkg/integrity.sh \
|
||||
libmakepkg/integrity/generate_checksum.sh \
|
||||
libmakepkg/integrity/generate_signature.sh \
|
||||
@@ -120,7 +132,8 @@ WRAPPER = \
|
||||
makepkg-wrapper \
|
||||
pacman-db-upgrade-wrapper \
|
||||
pacman-key-wrapper \
|
||||
pkgdelta-wrapper
|
||||
pkgdelta-wrapper \
|
||||
repo-add-wrapper
|
||||
|
||||
COMPLETION_IN = \
|
||||
completion/bash_completion \
|
||||
@@ -161,18 +174,17 @@ edit = sed \
|
||||
-e "s|@INODECMD[@]|$(INODECMD)|g" \
|
||||
-e "s|@OWNERCMD[@]|$(OWNERCMD)|g" \
|
||||
-e "s|@MODECMD[@]|$(MODECMD)|g" \
|
||||
-e 's|@SIZECMD[@]|$(SIZECMD)|g' \
|
||||
-e 's|@SEDINPLACEFLAGS[@]|$(SEDINPLACEFLAGS)|g' \
|
||||
-e 's|@SEDPATH[@]|$(SEDPATH)|g' \
|
||||
-e 's|@DUFLAGS[@]|$(DUFLAGS)|g' \
|
||||
-e 's|@DUPATH[@]|$(DUPATH)|g' \
|
||||
-e 's|@SCRIPTNAME[@]|$@|g' \
|
||||
-e 's|@configure_input[@]|Generated from $@.sh.in; do not edit by hand.|g'
|
||||
-e 's|@configure_input[@]|Generated from $<; do not edit by hand.|g'
|
||||
|
||||
## All the scripts depend on Makefile so that they are rebuilt when the
|
||||
## prefix etc. changes. Use chmod -w to prevent people from editing the
|
||||
## wrong file by accident.
|
||||
$(OURSCRIPTS): Makefile
|
||||
$(OURSCRIPTS): %: %.sh.in wrapper.sh.in $(LIBMAKEPKG_IN) Makefile
|
||||
$(AM_V_at)$(RM) $@
|
||||
$(AM_V_GEN)test -f $(srcdir)/$@.sh.in && m4 -P -I $(srcdir) $(srcdir)/$@.sh.in | $(edit) >$@
|
||||
$(AM_V_at)chmod +x,a-w $@
|
||||
@@ -193,11 +205,6 @@ $(COMPLETION_IN): %: %.in Makefile
|
||||
|
||||
all-am: $(COMPLETION_IN)
|
||||
|
||||
makepkg: \
|
||||
$(srcdir)/makepkg.sh.in \
|
||||
$(srcdir)/wrapper.sh.in \
|
||||
$(LIBMAKEPKG_IN)
|
||||
|
||||
makepkg-template: \
|
||||
$(srcdir)/makepkg-template.pl.in \
|
||||
Makefile
|
||||
@@ -206,32 +213,13 @@ makepkg-template: \
|
||||
$(AM_V_GEN)$(edit) $< > $@
|
||||
$(AM_V_at)chmod +x,a-w $@
|
||||
|
||||
pacman-db-upgrade: \
|
||||
$(srcdir)/pacman-db-upgrade.sh.in \
|
||||
$(srcdir)/library/output_format.sh
|
||||
|
||||
pacman-key: \
|
||||
$(srcdir)/pacman-key.sh.in \
|
||||
$(srcdir)/library/output_format.sh
|
||||
|
||||
pkgdelta: \
|
||||
$(srcdir)/pkgdelta.sh.in \
|
||||
$(srcdir)/library/output_format.sh
|
||||
|
||||
repo-add: \
|
||||
$(srcdir)/repo-add.sh.in \
|
||||
$(srcdir)/library/output_format.sh
|
||||
|
||||
repo-remove: $(srcdir)/repo-add.sh.in
|
||||
$(AM_V_at)$(RM) repo-remove
|
||||
$(AM_V_at)$(LN_S) repo-add repo-remove
|
||||
|
||||
repo-elephant: $(srcdir)/repo-add.sh.in
|
||||
$(AM_V_at)$(RM) repo-elephant
|
||||
$(AM_V_at)$(LN_S) repo-add repo-elephant
|
||||
repo-remove repo-elephant: repo-add
|
||||
$(AM_V_at)$(RM) $@
|
||||
$(AM_V_at)$(LN_S) repo-add $@
|
||||
|
||||
.SECONDEXPANSION:
|
||||
$(WRAPPER): \
|
||||
$(srcdir)/wrapper.sh.in \
|
||||
$$(subst -wrapper,,$$@)
|
||||
|
||||
$(AM_V_at)$(MKDIR_P) .lib
|
||||
@@ -246,13 +234,18 @@ $(WRAPPER): \
|
||||
$(AM_V_at)$(LN_S) $@ $(subst -wrapper,,$@)
|
||||
|
||||
install-data-local:
|
||||
$(MKDIR_P) $(DESTDIR)$(sysconfdir)/bash_completion.d/
|
||||
$(INSTALL_DATA) completion/bash_completion $(DESTDIR)$(sysconfdir)/bash_completion.d/pacman
|
||||
$(MKDIR_P) $(DESTDIR)$(bashcompdir)
|
||||
$(INSTALL_DATA) completion/bash_completion $(DESTDIR)/$(bashcompdir)/pacman
|
||||
for completion in makepkg pacman-key; do \
|
||||
$(LN_S) pacman $(DESTDIR)/$(bashcompdir)/$$completion; \
|
||||
done
|
||||
$(MKDIR_P) $(DESTDIR)$(datarootdir)/zsh/site-functions/
|
||||
$(INSTALL_DATA) completion/zsh_completion $(DESTDIR)$(datarootdir)/zsh/site-functions/_pacman
|
||||
|
||||
uninstall-local:
|
||||
$(RM) $(DESTDIR)$(sysconfdir)/bash_completion.d/pacman
|
||||
$(RM) $(DESTDIR)$(bashcompdir)/makepkg
|
||||
$(RM) $(DESTDIR)$(bashcompdir)/pacman
|
||||
$(RM) $(DESTDIR)$(bashcompdir)/pacman-key
|
||||
$(RM) $(DESTDIR)$(datarootdir)/zsh/site-functions/_pacman
|
||||
|
||||
install-exec-hook:
|
||||
|
||||
@@ -71,10 +71,13 @@ _pacman_key() {
|
||||
}
|
||||
|
||||
_makepkg() {
|
||||
compopt +o default
|
||||
local cur opts prev
|
||||
COMPREPLY=()
|
||||
_get_comp_words_by_ref cur prev
|
||||
if [[ $cur = -* && ! $prev =~ ^-(-(config|help|key|version)$|\w*[Vhp]) ]]; then
|
||||
if [[ $prev = @(-p|--config) ]]; then
|
||||
compopt -o default
|
||||
elif [[ ! $prev =~ ^-(-(config|help|key|version)$|\w*[Vh]) ]]; then
|
||||
opts=('allsource asdeps check clean cleanbuild config force geninteg help
|
||||
holdver ignorearch install key log needed noarchive nobuild nocheck
|
||||
nocolor noconfirm nodeps noextract noprepare noprogressbar nosign
|
||||
@@ -101,6 +104,7 @@ _pacman_repo_list() {
|
||||
}
|
||||
|
||||
_pacman() {
|
||||
compopt -o default
|
||||
local common core cur database files prev query remove sync upgrade o
|
||||
COMPREPLY=()
|
||||
_get_comp_words_by_ref cur prev
|
||||
@@ -131,16 +135,20 @@ _pacman() {
|
||||
D|R)
|
||||
_pacman_pkg Qq;;
|
||||
F)
|
||||
_arch_incomp 'l list' && _pacman_pkg Slq;
|
||||
;;
|
||||
{ _arch_incomp 'l list' && _pacman_pkg Slq ; } ||
|
||||
_arch_incomp 'o owns' ||
|
||||
compopt +o default;;
|
||||
Q)
|
||||
{ _arch_incomp 'g groups' && _pacman_pkg Qg sort; } ||
|
||||
{ _arch_incomp 'p file' && _pacman_file; } ||
|
||||
_arch_incomp 'o owns' || _arch_incomp 'u upgrades' ||
|
||||
{ _arch_incomp 's search' && compopt +o default; } ||
|
||||
{ _arch_incomp 'u upgrades' && compopt +o default; } ||
|
||||
_arch_incomp 'o owns' ||
|
||||
_pacman_pkg Qq;;
|
||||
S)
|
||||
{ _arch_incomp 'g groups' && _pacman_pkg Sg; } ||
|
||||
{ _arch_incomp 'l list' && _pacman_repo_list; } ||
|
||||
{ _arch_incomp 's search' && compopt +o default; } ||
|
||||
_pacman_pkg Slq;;
|
||||
U)
|
||||
_pacman_file;;
|
||||
@@ -153,8 +161,8 @@ _pacman_file() {
|
||||
compopt -o filenames; _filedir 'pkg.tar*'
|
||||
}
|
||||
|
||||
complete -F _pacman -o default pacman
|
||||
complete -F _makepkg -o default makepkg
|
||||
complete -F _pacman pacman
|
||||
complete -F _makepkg makepkg
|
||||
complete -F _pacman_key -o default pacman-key
|
||||
|
||||
# ex:et ts=2 sw=2 ft=sh
|
||||
|
||||
@@ -370,7 +370,7 @@ _pacman_get_command() {
|
||||
|
||||
# main dispatcher
|
||||
_pacman_zsh_comp() {
|
||||
local -a args cmds;
|
||||
local -a args cmds
|
||||
local tmp
|
||||
args=( ${${${(M)words:#-*}#-}:#-*} )
|
||||
for tmp in $words; do
|
||||
@@ -465,7 +465,7 @@ _pacman_zsh_comp() {
|
||||
if (( ${(w)#cmds} == 1 )); then
|
||||
_pacman_action_help
|
||||
else
|
||||
return 0;
|
||||
return 0
|
||||
fi
|
||||
;;
|
||||
*--sync*)
|
||||
@@ -554,7 +554,7 @@ _pacman_key() {
|
||||
"$_key_longopts[@]"
|
||||
;;
|
||||
*)
|
||||
i=$#;
|
||||
i=$#
|
||||
while [[ $words[$i] != -* ]] && [[ $words[$i] != "pacman-key" ]];do
|
||||
i=$(($i-1))
|
||||
done
|
||||
@@ -681,7 +681,7 @@ _makepkg(){
|
||||
*)
|
||||
i=$#
|
||||
while [[ $words[i] != -* ]] && [[ $words[$i] != "makepkg" ]];do
|
||||
i=$((i-1));
|
||||
i=$((i-1))
|
||||
done
|
||||
case $words[$i] in
|
||||
-*)
|
||||
|
||||
45
scripts/libmakepkg/buildenv.sh.in
Normal file
45
scripts/libmakepkg/buildenv.sh.in
Normal file
@@ -0,0 +1,45 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# buildenv.sh - functions for altering the build environment before
|
||||
# compiliation
|
||||
#
|
||||
# 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_BUILDENV_SH" ]] && return
|
||||
LIBMAKEPKG_BUILDENV_SH=1
|
||||
|
||||
LIBRARY=${LIBRARY:-'@libmakepkgdir@'}
|
||||
|
||||
source "$LIBRARY/util/message.sh"
|
||||
|
||||
|
||||
declare -a buildenv_functions build_options
|
||||
|
||||
for lib in "$LIBRARY/buildenv/"*.sh; do
|
||||
source "$lib"
|
||||
done
|
||||
|
||||
readonly -a buildenv_functions build_options
|
||||
|
||||
prepare_buildenv() {
|
||||
for func in ${buildenv_functions[@]}; do
|
||||
$func
|
||||
done
|
||||
|
||||
# ensure all necessary build variables are exported
|
||||
export CPPFLAGS CFLAGS CXXFLAGS LDFLAGS MAKEFLAGS CHOST
|
||||
}
|
||||
35
scripts/libmakepkg/buildenv/buildflags.sh.in
Normal file
35
scripts/libmakepkg/buildenv/buildflags.sh.in
Normal file
@@ -0,0 +1,35 @@
|
||||
#!/usr/bin/bash
|
||||
#
|
||||
# buildflags.sh - Clear user-specified buildflags if requested
|
||||
#
|
||||
# Copyright (c) 2011-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_BUILDENV_BUILDFLAGS_SH" ]] && return
|
||||
LIBMAKEPKG_BUILDENV_BUILDFLAGS_SH=1
|
||||
|
||||
LIBRARY=${LIBRARY:-'@libmakepkgdir@'}
|
||||
|
||||
source "$LIBRARY/util/option.sh"
|
||||
|
||||
build_options+=('buildflags')
|
||||
buildenv_functions+=('buildenv_buildflags')
|
||||
|
||||
buildenv_buildflags() {
|
||||
if check_option "buildflags" "n"; then
|
||||
unset CPPFLAGS CFLAGS DEBUG_CFLAGS CXXFLAGS DEBUG_CXXFLAGS LDFLAGS
|
||||
fi
|
||||
}
|
||||
55
scripts/libmakepkg/buildenv/compiler.sh.in
Normal file
55
scripts/libmakepkg/buildenv/compiler.sh.in
Normal file
@@ -0,0 +1,55 @@
|
||||
#!/usr/bin/bash
|
||||
#
|
||||
# compiler.sh - CCache and DistCC compilation
|
||||
# ccache - Cache compilations and reuse them to save time on repetitions
|
||||
# distcc - Distribute compilation of C and C++ across machines
|
||||
#
|
||||
# Copyright (c) 2007-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_BUILDENV_COMPILER_SH" ]] && return
|
||||
LIBMAKEPKG_BUILDENV_COMPILER_SH=1
|
||||
|
||||
LIBRARY=${LIBRARY:-'@libmakepkgdir@'}
|
||||
|
||||
source "$LIBRARY/util/option.sh"
|
||||
|
||||
build_options+=('ccache' 'distcc')
|
||||
buildenv_functions+=('buildenv_ccache' 'buildenv_distcc')
|
||||
|
||||
using_ccache=0
|
||||
|
||||
buildenv_ccache() {
|
||||
if check_buildoption "ccache" "y"; then
|
||||
if [ -d /usr/lib/ccache/bin ]; then
|
||||
export PATH="/usr/lib/ccache/bin:$PATH"
|
||||
using_ccache=1
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
buildenv_distcc() {
|
||||
if check_buildoption "distcc" "y"; then
|
||||
if (( using_ccache )); then
|
||||
export CCACHE_PREFIX="${CCACHE_PREFIX:+$CCACHE_PREFIX }distcc"
|
||||
export CCACHE_BASEDIR="$srcdir"
|
||||
elif [[ -d /usr/lib/distcc/bin ]]; then
|
||||
export PATH="/usr/lib/distcc/bin:$PATH"
|
||||
fi
|
||||
|
||||
export DISTCC_HOSTS
|
||||
fi
|
||||
}
|
||||
38
scripts/libmakepkg/buildenv/debugflags.sh.in
Normal file
38
scripts/libmakepkg/buildenv/debugflags.sh.in
Normal file
@@ -0,0 +1,38 @@
|
||||
#!/usr/bin/bash
|
||||
#
|
||||
# debugflags.sh - Specify flags for building a package with debugging
|
||||
# symbols
|
||||
#
|
||||
# Copyright (c) 2012-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_BUILDENV_DEBUGFLAGS_SH" ]] && return
|
||||
LIBMAKEPKG_BUILDENV_DEBUGFLAGS_SH=1
|
||||
|
||||
LIBRARY=${LIBRARY:-'@libmakepkgdir@'}
|
||||
|
||||
source "$LIBRARY/util/option.sh"
|
||||
|
||||
buildenv_functions+=('buildenv_debugflags')
|
||||
|
||||
buildenv_debugflags() {
|
||||
if check_option "debug" "y"; then
|
||||
DEBUG_CFLAGS+=" -fdebug-prefix-map=$srcdir=${DBGSRCDIR:-/usr/src/debug}"
|
||||
DEBUG_CXXFLAGS+=" -fdebug-prefix-map=$srcdir=${DBGSRCDIR:-/usr/src/debug}"
|
||||
CFLAGS+=" $DEBUG_CFLAGS"
|
||||
CXXFLAGS+=" $DEBUG_CXXFLAGS"
|
||||
fi
|
||||
}
|
||||
35
scripts/libmakepkg/buildenv/makeflags.sh.in
Normal file
35
scripts/libmakepkg/buildenv/makeflags.sh.in
Normal file
@@ -0,0 +1,35 @@
|
||||
#!/usr/bin/bash
|
||||
#
|
||||
# makeflags.sh - Clear user-specified makeflags if requested
|
||||
#
|
||||
# Copyright (c) 2007-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_BUILDENV_MAKEFLAGS_SH" ]] && return
|
||||
LIBMAKEPKG_BUILDENV_MAKEFLAGS_SH=1
|
||||
|
||||
LIBRARY=${LIBRARY:-'@libmakepkgdir@'}
|
||||
|
||||
source "$LIBRARY/util/option.sh"
|
||||
|
||||
build_options+=('makeflags')
|
||||
buildenv_functions+=('buildenv_makeflags')
|
||||
|
||||
buildenv_makeflags() {
|
||||
if check_option "makeflags" "n"; then
|
||||
unset MAKEFLAGS
|
||||
fi
|
||||
}
|
||||
20
scripts/libmakepkg/buildenv/meson.build
Normal file
20
scripts/libmakepkg/buildenv/meson.build
Normal file
@@ -0,0 +1,20 @@
|
||||
libmakepkg_module = 'buildenv'
|
||||
|
||||
sources = [
|
||||
'buildflags.sh.in',
|
||||
'compiler.sh.in',
|
||||
'debugflags.sh.in',
|
||||
'makeflags.sh.in',
|
||||
]
|
||||
|
||||
foreach src : sources
|
||||
output_dir = join_paths(get_option('datadir'), 'makepkg', libmakepkg_module)
|
||||
|
||||
custom_target(
|
||||
libmakepkg_module + '_' + src.underscorify(),
|
||||
command : [ SCRIPT_EDITOR, '@INPUT@', '@OUTPUT@' ],
|
||||
input : src,
|
||||
output : '@BASENAME@',
|
||||
install : true,
|
||||
install_dir : output_dir)
|
||||
endforeach
|
||||
45
scripts/libmakepkg/executable.sh.in
Normal file
45
scripts/libmakepkg/executable.sh.in
Normal file
@@ -0,0 +1,45 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# executable.sh - confirm presence of dependent executables
|
||||
#
|
||||
# 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_EXECUTABLE_SH" ]] && return
|
||||
LIBMAKEPKG_EXECUTABLE_SH=1
|
||||
|
||||
LIBRARY=${LIBRARY:-'@libmakepkgdir@'}
|
||||
|
||||
source "$LIBRARY/util/message.sh"
|
||||
|
||||
|
||||
declare -a executable_functions
|
||||
|
||||
for lib in "$LIBRARY/executable/"*.sh; do
|
||||
source "$lib"
|
||||
done
|
||||
|
||||
readonly -a executable_functions
|
||||
|
||||
check_software() {
|
||||
local ret=0
|
||||
|
||||
for func in ${executable_functions[@]}; do
|
||||
$func || ret=1
|
||||
done
|
||||
|
||||
return $ret
|
||||
}
|
||||
37
scripts/libmakepkg/executable/ccache.sh.in
Normal file
37
scripts/libmakepkg/executable/ccache.sh.in
Normal file
@@ -0,0 +1,37 @@
|
||||
#!/usr/bin/bash
|
||||
#
|
||||
# ccache.sh - Confirm presence of ccache binary
|
||||
#
|
||||
# Copyright (c) 2011-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_EXECUTABLE_CCACHE_SH" ]] && return
|
||||
LIBMAKEPKG_EXECUTABLE_CCACHE_SH=1
|
||||
|
||||
LIBRARY=${LIBRARY:-'@libmakepkgdir@'}
|
||||
|
||||
source "$LIBRARY/util/option.sh"
|
||||
|
||||
executable_functions+=('executable_ccache')
|
||||
|
||||
executable_ccache() {
|
||||
if check_buildoption "ccache" "y"; then
|
||||
if ! type -p ccache >/dev/null; then
|
||||
error "$(gettext "Cannot find the %s binary required for compiler cache usage.")" "ccache"
|
||||
return 1
|
||||
fi
|
||||
fi
|
||||
}
|
||||
42
scripts/libmakepkg/executable/checksum.sh.in
Normal file
42
scripts/libmakepkg/executable/checksum.sh.in
Normal file
@@ -0,0 +1,42 @@
|
||||
#!/usr/bin/bash
|
||||
#
|
||||
# checksum.sh - Confirm presence of binaries for checksum operations
|
||||
#
|
||||
# Copyright (c) 2016-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_EXECUTABLE_CHECKSUM_SH" ]] && return
|
||||
LIBMAKEPKG_EXECUTABLE_CHECKSUM_SH=1
|
||||
|
||||
LIBRARY=${LIBRARY:-'@libmakepkgdir@'}
|
||||
|
||||
|
||||
executable_functions+=('executable_checksum')
|
||||
|
||||
executable_checksum() {
|
||||
if (( GENINTEG || ! SKIPCHECKSUMS )); then
|
||||
local integlist
|
||||
IFS=$'\n' read -rd '' -a integlist < <(get_integlist)
|
||||
|
||||
local integ
|
||||
for integ in "${integlist[@]}"; do
|
||||
if ! type -p "${integ}sum" >/dev/null; then
|
||||
error "$(gettext "Cannot find the %s binary required for source file checksums operations.")" "${integ}sum"
|
||||
return 1
|
||||
fi
|
||||
done
|
||||
fi
|
||||
}
|
||||
37
scripts/libmakepkg/executable/distcc.sh.in
Normal file
37
scripts/libmakepkg/executable/distcc.sh.in
Normal file
@@ -0,0 +1,37 @@
|
||||
#!/usr/bin/bash
|
||||
#
|
||||
# distcc.sh - Confirm presence of distcc binary
|
||||
#
|
||||
# Copyright (c) 2011-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_EXECUTABLE_DISTCC_SH" ]] && return
|
||||
LIBMAKEPKG_EXECUTABLE_DISTCC_SH=1
|
||||
|
||||
LIBRARY=${LIBRARY:-'@libmakepkgdir@'}
|
||||
|
||||
source "$LIBRARY/util/option.sh"
|
||||
|
||||
executable_functions+=('executable_distcc')
|
||||
|
||||
executable_distcc() {
|
||||
if check_buildoption "distcc" "y"; then
|
||||
if ! type -p distcc >/dev/null; then
|
||||
error "$(gettext "Cannot find the %s binary required for distributed compilation.")" "distcc"
|
||||
return 1
|
||||
fi
|
||||
fi
|
||||
}
|
||||
37
scripts/libmakepkg/executable/fakeroot.sh.in
Normal file
37
scripts/libmakepkg/executable/fakeroot.sh.in
Normal file
@@ -0,0 +1,37 @@
|
||||
#!/usr/bin/bash
|
||||
#
|
||||
# fakeroot.sh - Confirm presence of fakeroot binary
|
||||
#
|
||||
# Copyright (c) 2011-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_EXECUTABLE_FAKEROOT_SH" ]] && return
|
||||
LIBMAKEPKG_EXECUTABLE_FAKEROOT_SH=1
|
||||
|
||||
LIBRARY=${LIBRARY:-'@libmakepkgdir@'}
|
||||
|
||||
source "$LIBRARY/util/option.sh"
|
||||
|
||||
executable_functions+=('executable_fakeroot')
|
||||
|
||||
executable_fakeroot() {
|
||||
if check_buildenv "fakeroot" "y" && (( EUID > 0 )); then
|
||||
if ! type -p fakeroot >/dev/null; then
|
||||
error "$(gettext "Cannot find the %s binary.")" "fakeroot"
|
||||
return 1
|
||||
fi
|
||||
fi
|
||||
}
|
||||
48
scripts/libmakepkg/executable/gpg.sh.in
Normal file
48
scripts/libmakepkg/executable/gpg.sh.in
Normal file
@@ -0,0 +1,48 @@
|
||||
#!/usr/bin/bash
|
||||
#
|
||||
# gpg.sh - Confirm presence of gpg binary
|
||||
#
|
||||
# Copyright (c) 2011-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_EXECUTABLE_GPG_SH" ]] && return
|
||||
LIBMAKEPKG_EXECUTABLE_GPG_SH=1
|
||||
|
||||
LIBRARY=${LIBRARY:-'@libmakepkgdir@'}
|
||||
|
||||
source "$LIBRARY/util/option.sh"
|
||||
|
||||
executable_functions+=('executable_gpg')
|
||||
|
||||
executable_gpg() {
|
||||
local ret=0
|
||||
|
||||
if [[ $SIGNPKG == 'y' ]] || { [[ -z $SIGNPKG ]] && check_buildenv "sign" "y"; }; then
|
||||
if ! type -p gpg >/dev/null; then
|
||||
error "$(gettext "Cannot find the %s binary required for signing packages.")" "gpg"
|
||||
ret=1
|
||||
fi
|
||||
fi
|
||||
|
||||
if (( ! SKIPPGPCHECK )) && source_has_signatures; then
|
||||
if ! type -p gpg >/dev/null; then
|
||||
error "$(gettext "Cannot find the %s binary required for verifying source files.")" "gpg"
|
||||
ret=1
|
||||
fi
|
||||
fi
|
||||
|
||||
return $ret
|
||||
}
|
||||
37
scripts/libmakepkg/executable/gzip.sh.in
Normal file
37
scripts/libmakepkg/executable/gzip.sh.in
Normal file
@@ -0,0 +1,37 @@
|
||||
#!/usr/bin/bash
|
||||
#
|
||||
# gzip.sh - Confirm presence of gzip binary
|
||||
#
|
||||
# Copyright (c) 2011-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_EXECUTABLE_GZIP_SH" ]] && return
|
||||
LIBMAKEPKG_EXECUTABLE_GZIP_SH=1
|
||||
|
||||
LIBRARY=${LIBRARY:-'@libmakepkgdir@'}
|
||||
|
||||
source "$LIBRARY/util/option.sh"
|
||||
|
||||
executable_functions+=('executable_gzip')
|
||||
|
||||
executable_gzip() {
|
||||
if check_option "zipman" "y"; then
|
||||
if ! type -p gzip >/dev/null; then
|
||||
error "$(gettext "Cannot find the %s binary required for compressing man and info pages.")" "gzip"
|
||||
return 1
|
||||
fi
|
||||
fi
|
||||
}
|
||||
26
scripts/libmakepkg/executable/meson.build
Normal file
26
scripts/libmakepkg/executable/meson.build
Normal file
@@ -0,0 +1,26 @@
|
||||
libmakepkg_module = 'executable'
|
||||
|
||||
sources = [
|
||||
'ccache.sh.in',
|
||||
'checksum.sh.in',
|
||||
'distcc.sh.in',
|
||||
'fakeroot.sh.in',
|
||||
'gpg.sh.in',
|
||||
'gzip.sh.in',
|
||||
'pacman.sh.in',
|
||||
'strip.sh.in',
|
||||
'sudo.sh.in',
|
||||
'vcs.sh.in',
|
||||
]
|
||||
|
||||
foreach src : sources
|
||||
output_dir = join_paths(get_option('datadir'), 'makepkg', libmakepkg_module)
|
||||
|
||||
custom_target(
|
||||
libmakepkg_module + '_' + src.underscorify(),
|
||||
command : [ SCRIPT_EDITOR, '@INPUT@', '@OUTPUT@' ],
|
||||
input : src,
|
||||
output : '@BASENAME@',
|
||||
install : true,
|
||||
install_dir : output_dir)
|
||||
endforeach
|
||||
37
scripts/libmakepkg/executable/pacman.sh.in
Normal file
37
scripts/libmakepkg/executable/pacman.sh.in
Normal file
@@ -0,0 +1,37 @@
|
||||
#!/usr/bin/bash
|
||||
#
|
||||
# pacman.sh - Confirm presence of pacman binary
|
||||
#
|
||||
# Copyright (c) 2012-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_EXECUTABLE_PACMAN_SH" ]] && return
|
||||
LIBMAKEPKG_EXECUTABLE_PACMAN_SH=1
|
||||
|
||||
LIBRARY=${LIBRARY:-'@libmakepkgdir@'}
|
||||
|
||||
source "$LIBRARY/util/option.sh"
|
||||
|
||||
executable_functions+=('executable_pacman')
|
||||
|
||||
executable_pacman() {
|
||||
if (( ! NODEPS || DEP_BIN || RMDEPS || INSTALL )); then
|
||||
if [[ -z $PACMAN_PATH ]]; then
|
||||
error "$(gettext "Cannot find the %s binary required for dependency operations.")" "$PACMAN"
|
||||
return 1
|
||||
fi
|
||||
fi
|
||||
}
|
||||
37
scripts/libmakepkg/executable/strip.sh.in
Normal file
37
scripts/libmakepkg/executable/strip.sh.in
Normal file
@@ -0,0 +1,37 @@
|
||||
#!/usr/bin/bash
|
||||
#
|
||||
# strip.sh - Confirm presense of strip binary
|
||||
#
|
||||
# Copyright (c) 2011-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_EXECUTABLE_STRIP_SH" ]] && return
|
||||
LIBMAKEPKG_EXECUTABLE_STRIP_SH=1
|
||||
|
||||
LIBRARY=${LIBRARY:-'@libmakepkgdir@'}
|
||||
|
||||
source "$LIBRARY/util/option.sh"
|
||||
|
||||
executable_functions+=('executable_strip')
|
||||
|
||||
executable_strip() {
|
||||
if check_option "strip" "y"; then
|
||||
if ! type -p strip >/dev/null; then
|
||||
error "$(gettext "Cannot find the %s binary required for object file stripping.")" "strip"
|
||||
return 1
|
||||
fi
|
||||
fi
|
||||
}
|
||||
36
scripts/libmakepkg/executable/sudo.sh.in
Normal file
36
scripts/libmakepkg/executable/sudo.sh.in
Normal file
@@ -0,0 +1,36 @@
|
||||
#!/usr/bin/bash
|
||||
#
|
||||
# sudo.sh - Confirm presence of sudo binary
|
||||
#
|
||||
# Copyright (c) 2011-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_EXECUTABLE_SUDO_SH" ]] && return
|
||||
LIBMAKEPKG_EXECUTABLE_SUDO_SH=1
|
||||
|
||||
LIBRARY=${LIBRARY:-'@libmakepkgdir@'}
|
||||
|
||||
source "$LIBRARY/util/option.sh"
|
||||
|
||||
executable_functions+=('executable_sudo')
|
||||
|
||||
executable_sudo() {
|
||||
if (( DEP_BIN || RMDEPS || INSTALL )); then
|
||||
if ! type -p sudo >/dev/null; then
|
||||
warning "$(gettext "Cannot find the %s binary. Will use %s to acquire root privileges.")" "sudo" "su"
|
||||
fi
|
||||
fi
|
||||
}
|
||||
103
scripts/libmakepkg/executable/vcs.sh.in
Normal file
103
scripts/libmakepkg/executable/vcs.sh.in
Normal file
@@ -0,0 +1,103 @@
|
||||
#!/usr/bin/bash
|
||||
#
|
||||
# vcs.sh - Confirm presence of binaries for VCS operations
|
||||
#
|
||||
# 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_EXECUTABLE_VCS_SH" ]] && return
|
||||
LIBMAKEPKG_EXECUTABLE_VCS_SH=1
|
||||
|
||||
LIBRARY=${LIBRARY:-'@libmakepkgdir@'}
|
||||
|
||||
source "$LIBRARY/util/option.sh"
|
||||
|
||||
executable_functions+=('executable_vcs')
|
||||
|
||||
get_vcsclient() {
|
||||
local proto=${1%%+*}
|
||||
|
||||
local i
|
||||
for i in "${VCSCLIENTS[@]}"; do
|
||||
local handler="${i%%::*}"
|
||||
if [[ $proto = "$handler" ]]; then
|
||||
local client="${i##*::}"
|
||||
break
|
||||
fi
|
||||
done
|
||||
|
||||
# if we didn't find an client, return an error
|
||||
if [[ -z $client ]]; then
|
||||
error "$(gettext "Unknown download protocol: %s")" "$proto"
|
||||
plain "$(gettext "Aborting...")"
|
||||
exit $E_CONFIG_ERROR
|
||||
fi
|
||||
|
||||
printf "%s\n" "$client"
|
||||
}
|
||||
|
||||
executable_vcs() {
|
||||
local netfile all_sources all_deps deps ret=0
|
||||
|
||||
if (( SOURCEONLY == 1 )); then
|
||||
# we will not download VCS sources
|
||||
return $ret
|
||||
fi
|
||||
|
||||
if [[ -z $PACMAN_PATH ]]; then
|
||||
warning "$(gettext "Cannot find the %s binary needed to check VCS source requirements.")" "$PACMAN"
|
||||
return $ret
|
||||
fi
|
||||
|
||||
# we currently only use global depends/makedepends arrays for --syncdeps
|
||||
for attr in depends makedepends; do
|
||||
get_pkgbuild_attribute "$pkg" "$attr" 1 'deps'
|
||||
all_deps+=("${deps[@]}")
|
||||
|
||||
get_pkgbuild_attribute "$pkg" "${attr}_$CARCH" 1 'deps'
|
||||
all_deps+=("${deps[@]}")
|
||||
done
|
||||
|
||||
get_all_sources_for_arch 'all_sources'
|
||||
for netfile in ${all_sources[@]}; do
|
||||
local proto=$(get_protocol "$netfile")
|
||||
|
||||
case $proto in
|
||||
bzr*|git*|hg*|svn*)
|
||||
if ! type -p ${proto%%+*} > /dev/null; then
|
||||
local client
|
||||
client=$(get_vcsclient "$proto") || exit $?
|
||||
# ensure specified program is installed
|
||||
local uninstalled
|
||||
uninstalled=$(check_deps "$client") || exit $E_INSTALL_DEPS_FAILED
|
||||
# if not installed, check presence in depends or makedepends
|
||||
if [[ -n "$uninstalled" ]] && (( ! NODEPS || ( VERIFYSOURCE && !DEP_BIN ) )); then
|
||||
if ! in_array "$client" ${all_deps[@]}; then
|
||||
error "$(gettext "Cannot find the %s package needed to handle %s sources.")" \
|
||||
"$client" "${proto%%+*}"
|
||||
ret=1
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
;;
|
||||
*)
|
||||
# non VCS source
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
return $ret
|
||||
}
|
||||
@@ -78,7 +78,7 @@ generate_one_checksum() {
|
||||
}
|
||||
|
||||
generate_checksums() {
|
||||
msg "$(gettext "Generating checksums for source files...")"
|
||||
msg "$(gettext "Generating checksums for source files...")" >&2
|
||||
|
||||
local integlist
|
||||
if (( $# == 0 )); then
|
||||
|
||||
@@ -40,7 +40,7 @@ create_signature() {
|
||||
if (( ! ret )); then
|
||||
msg2 "$(gettext "Created signature file %s.")" "${filename##*/}.sig"
|
||||
else
|
||||
warning "$(gettext "Failed to sign package file.")"
|
||||
warning "$(gettext "Failed to sign package file %s.")" "${filename##*/}"
|
||||
fi
|
||||
|
||||
return $ret
|
||||
|
||||
20
scripts/libmakepkg/integrity/meson.build
Normal file
20
scripts/libmakepkg/integrity/meson.build
Normal file
@@ -0,0 +1,20 @@
|
||||
libmakepkg_module = 'integrity'
|
||||
|
||||
sources = [
|
||||
'generate_checksum.sh.in',
|
||||
'generate_signature.sh.in',
|
||||
'verify_checksum.sh.in',
|
||||
'verify_signature.sh.in',
|
||||
]
|
||||
|
||||
foreach src : sources
|
||||
output_dir = join_paths(get_option('datadir'), 'makepkg', libmakepkg_module)
|
||||
|
||||
custom_target(
|
||||
libmakepkg_module + '_' + src.underscorify(),
|
||||
command : [ SCRIPT_EDITOR, '@INPUT@', '@OUTPUT@' ],
|
||||
input : src,
|
||||
output : '@BASENAME@',
|
||||
install : true,
|
||||
install_dir : output_dir)
|
||||
endforeach
|
||||
@@ -137,7 +137,7 @@ verify_file_signature() {
|
||||
for ext in "" gz bz2 xz lrz lzo Z; do
|
||||
if sourcefile="$(get_filepath "${file%.*}${ext:+.$ext}")"; then
|
||||
found=1
|
||||
break;
|
||||
break
|
||||
fi
|
||||
done
|
||||
if (( ! found )); then
|
||||
|
||||
18
scripts/libmakepkg/lint_config/meson.build
Normal file
18
scripts/libmakepkg/lint_config/meson.build
Normal file
@@ -0,0 +1,18 @@
|
||||
libmakepkg_module = 'lint_config'
|
||||
|
||||
sources = [
|
||||
'paths.sh.in',
|
||||
'variable.sh.in',
|
||||
]
|
||||
|
||||
foreach src : sources
|
||||
output_dir = join_paths(get_option('datadir'), 'makepkg', libmakepkg_module)
|
||||
|
||||
custom_target(
|
||||
libmakepkg_module + '_' + src.underscorify(),
|
||||
command : [ SCRIPT_EDITOR, '@INPUT@', '@OUTPUT@' ],
|
||||
input : src,
|
||||
output : '@BASENAME@',
|
||||
install : true,
|
||||
install_dir : output_dir)
|
||||
endforeach
|
||||
@@ -25,10 +25,10 @@ LIBRARY=${LIBRARY:-'@libmakepkgdir@'}
|
||||
|
||||
source "$LIBRARY/util/message.sh"
|
||||
|
||||
lint_config_functions+=('lint_variable')
|
||||
lint_config_functions+=('lint_config_variables')
|
||||
|
||||
|
||||
lint_variable() {
|
||||
lint_config_variables() {
|
||||
local array=(DLAGENTS VCSCLIENTS BUILDENV OPTIONS INTEGRITY_CHECK MAN_DIRS
|
||||
DOC_DIRS PURGE_TARGETS COMPRESSGZ COMPRESSBZ2 COMPRESSXZ
|
||||
COMPRESSLRZ COMPRESSLZO COMPRESSZ)
|
||||
|
||||
20
scripts/libmakepkg/lint_package/meson.build
Normal file
20
scripts/libmakepkg/lint_package/meson.build
Normal file
@@ -0,0 +1,20 @@
|
||||
libmakepkg_module = 'lint_package'
|
||||
|
||||
sources = [
|
||||
'build_references.sh.in',
|
||||
'dotfiles.sh.in',
|
||||
'file_names.sh.in',
|
||||
'missing_backup.sh.in',
|
||||
]
|
||||
|
||||
foreach src : sources
|
||||
output_dir = join_paths(get_option('datadir'), 'makepkg', libmakepkg_module)
|
||||
|
||||
custom_target(
|
||||
libmakepkg_module + '_' + src.underscorify(),
|
||||
command : [ SCRIPT_EDITOR, '@INPUT@', '@OUTPUT@' ],
|
||||
input : src,
|
||||
output : '@BASENAME@',
|
||||
install : true,
|
||||
install_dir : output_dir)
|
||||
endforeach
|
||||
37
scripts/libmakepkg/lint_pkgbuild/meson.build
Normal file
37
scripts/libmakepkg/lint_pkgbuild/meson.build
Normal file
@@ -0,0 +1,37 @@
|
||||
libmakepkg_module = 'lint_pkgbuild'
|
||||
|
||||
sources = [
|
||||
'arch.sh.in',
|
||||
'backup.sh.in',
|
||||
'changelog.sh.in',
|
||||
'checkdepends.sh.in',
|
||||
'conflicts.sh.in',
|
||||
'depends.sh.in',
|
||||
'epoch.sh.in',
|
||||
'install.sh.in',
|
||||
'makedepends.sh.in',
|
||||
'optdepends.sh.in',
|
||||
'options.sh.in',
|
||||
'package_function.sh.in',
|
||||
'pkgbase.sh.in',
|
||||
'pkglist.sh.in',
|
||||
'pkgname.sh.in',
|
||||
'pkgrel.sh.in',
|
||||
'pkgver.sh.in',
|
||||
'provides.sh.in',
|
||||
'source.sh.in',
|
||||
'util.sh.in',
|
||||
'variable.sh.in',
|
||||
]
|
||||
|
||||
foreach src : sources
|
||||
output_dir = join_paths(get_option('datadir'), 'makepkg', libmakepkg_module)
|
||||
|
||||
custom_target(
|
||||
libmakepkg_module + '_' + src.underscorify(),
|
||||
command : [ SCRIPT_EDITOR, '@INPUT@', '@OUTPUT@' ],
|
||||
input : src,
|
||||
output : '@BASENAME@',
|
||||
install : true,
|
||||
install_dir : output_dir)
|
||||
endforeach
|
||||
@@ -34,11 +34,18 @@ lint_package_function() {
|
||||
local i ret=0
|
||||
|
||||
if (( ${#pkgname[@]} == 1 )); then
|
||||
if have_function 'build' && ! { have_function 'package' || have_function "package_$pkgname"; }; then
|
||||
if have_function 'package' && have_function "package_$pkgname"; then
|
||||
error "$(gettext "Conflicting %s and %s functions in %s")" "package()" "package_$pkgname()" "$BUILDFILE"
|
||||
ret=1
|
||||
elif have_function 'build' && ! { have_function 'package' || have_function "package_$pkgname"; }; then
|
||||
error "$(gettext "Missing %s function in %s")" "package()" "$BUILDFILE"
|
||||
ret=1
|
||||
fi
|
||||
else
|
||||
if have_function "package"; then
|
||||
error "$(gettext "Extra %s function for split package '%s'")" "package()" "$pkgbase"
|
||||
ret=1
|
||||
fi
|
||||
for i in "${pkgname[@]}"; do
|
||||
if ! have_function "package_$i"; then
|
||||
error "$(gettext "Missing %s function for split package '%s'")" "package_$i()" "$i"
|
||||
|
||||
@@ -44,10 +44,5 @@ check_pkgver() {
|
||||
}
|
||||
|
||||
lint_pkgver() {
|
||||
if (( PKGVERFUNC )); then
|
||||
# defer check to after getting version from pkgver function
|
||||
return 0
|
||||
fi
|
||||
|
||||
check_pkgver "$pkgver"
|
||||
}
|
||||
|
||||
@@ -36,7 +36,7 @@ lint_variable() {
|
||||
local arch_array=(conflicts depends makedepends md5sums optdepends provides
|
||||
replaces sha1sums sha224sums sha256sums sha384sums sha512sums
|
||||
source)
|
||||
local string=(changelog epoch install pkgdesc pkgrel pkgver url)
|
||||
local string=(changelog epoch install pkgbase pkgdesc pkgrel pkgver url)
|
||||
|
||||
local i a v pkg keys out bad ret=0
|
||||
|
||||
|
||||
26
scripts/libmakepkg/meson.build
Normal file
26
scripts/libmakepkg/meson.build
Normal file
@@ -0,0 +1,26 @@
|
||||
libmakepkg_modules = [
|
||||
{ 'name' : 'buildenv', 'has_subdir' : true },
|
||||
{ 'name' : 'executable', 'has_subdir' : true },
|
||||
{ 'name' : 'integrity', 'has_subdir' : true },
|
||||
{ 'name' : 'lint_config', 'has_subdir' : true },
|
||||
{ 'name' : 'lint_package', 'has_subdir' : true },
|
||||
{ 'name' : 'lint_pkgbuild', 'has_subdir' : true },
|
||||
{ 'name' : 'source', 'has_subdir' : true },
|
||||
{ 'name' : 'srcinfo', },
|
||||
{ 'name' : 'tidy', 'has_subdir' : true },
|
||||
{ 'name' : 'util', 'has_subdir' : true },
|
||||
]
|
||||
|
||||
foreach module : libmakepkg_modules
|
||||
custom_target(
|
||||
'libmakepkg_@0@'.format(module['name']),
|
||||
command : [ SCRIPT_EDITOR, '@INPUT@', '@OUTPUT@' ],
|
||||
input : '@0@.sh.in'.format(module['name']),
|
||||
output : '@BASENAME@',
|
||||
install : true,
|
||||
install_dir : join_paths(get_option('datadir'), 'makepkg'))
|
||||
|
||||
if module.get('has_subdir', false)
|
||||
subdir(module['name'])
|
||||
endif
|
||||
endforeach
|
||||
22
scripts/libmakepkg/source/meson.build
Normal file
22
scripts/libmakepkg/source/meson.build
Normal file
@@ -0,0 +1,22 @@
|
||||
libmakepkg_module = 'source'
|
||||
|
||||
sources = [
|
||||
'bzr.sh.in',
|
||||
'file.sh.in',
|
||||
'git.sh.in',
|
||||
'hg.sh.in',
|
||||
'local.sh.in',
|
||||
'svn.sh.in',
|
||||
]
|
||||
|
||||
foreach src : sources
|
||||
output_dir = join_paths(get_option('datadir'), 'makepkg', libmakepkg_module)
|
||||
|
||||
custom_target(
|
||||
libmakepkg_module + '_' + src.underscorify(),
|
||||
command : [ SCRIPT_EDITOR, '@INPUT@', '@OUTPUT@' ],
|
||||
input : src,
|
||||
output : '@BASENAME@',
|
||||
install : true,
|
||||
install_dir : output_dir)
|
||||
endforeach
|
||||
23
scripts/libmakepkg/tidy/meson.build
Normal file
23
scripts/libmakepkg/tidy/meson.build
Normal file
@@ -0,0 +1,23 @@
|
||||
libmakepkg_module = 'tidy'
|
||||
|
||||
sources = [
|
||||
'docs.sh.in',
|
||||
'emptydirs.sh.in',
|
||||
'libtool.sh.in',
|
||||
'purge.sh.in',
|
||||
'staticlibs.sh.in',
|
||||
'strip.sh.in',
|
||||
'zipman.sh.in',
|
||||
]
|
||||
|
||||
foreach src : sources
|
||||
output_dir = join_paths(get_option('datadir'), 'makepkg', libmakepkg_module)
|
||||
|
||||
custom_target(
|
||||
libmakepkg_module + '_' + src.underscorify(),
|
||||
command : [ SCRIPT_EDITOR, '@INPUT@', '@OUTPUT@' ],
|
||||
input : src,
|
||||
output : '@BASENAME@',
|
||||
install : true,
|
||||
install_dir : output_dir)
|
||||
endforeach
|
||||
@@ -37,9 +37,11 @@ compress_as() {
|
||||
*tar.gz) ${COMPRESSGZ[@]:-gzip -c -f -n} ;;
|
||||
*tar.bz2) ${COMPRESSBZ2[@]:-bzip2 -c -f} ;;
|
||||
*tar.xz) ${COMPRESSXZ[@]:-xz -c -z -} ;;
|
||||
*tar.zst) ${COMPRESSZST[@]:-zstd -c -z -q -} ;;
|
||||
*tar.lrz) ${COMPRESSLRZ[@]:-lrzip -q} ;;
|
||||
*tar.lzo) ${COMPRESSLZO[@]:-lzop -q} ;;
|
||||
*tar.Z) ${COMPRESSZ[@]:-compress -c -f} ;;
|
||||
*tar.lz4) ${COMPRESSLZ4[@]:-lz4 -q} ;;
|
||||
*tar) cat ;;
|
||||
*) warning "$(gettext "'%s' is not a valid archive extension.")" \
|
||||
"$ext"; cat ;;
|
||||
|
||||
24
scripts/libmakepkg/util/meson.build
Normal file
24
scripts/libmakepkg/util/meson.build
Normal file
@@ -0,0 +1,24 @@
|
||||
libmakepkg_module = 'util'
|
||||
|
||||
sources = [
|
||||
'compress.sh.in',
|
||||
'error.sh.in',
|
||||
'message.sh.in',
|
||||
'option.sh.in',
|
||||
'parseopts.sh.in',
|
||||
'pkgbuild.sh.in',
|
||||
'source.sh.in',
|
||||
'util.sh.in',
|
||||
]
|
||||
|
||||
foreach src : sources
|
||||
output_dir = join_paths(get_option('datadir'), 'makepkg', libmakepkg_module)
|
||||
|
||||
custom_target(
|
||||
libmakepkg_module + '_' + src.underscorify(),
|
||||
command : [ SCRIPT_EDITOR, '@INPUT@', '@OUTPUT@' ],
|
||||
input : src,
|
||||
output : '@BASENAME@',
|
||||
install : true,
|
||||
install_dir : output_dir)
|
||||
endforeach
|
||||
@@ -44,18 +44,26 @@ colorize() {
|
||||
}
|
||||
|
||||
plain() {
|
||||
(( QUIET )) && return
|
||||
local mesg=$1; shift
|
||||
printf "${BOLD} ${mesg}${ALL_OFF}\n" "$@" >&2
|
||||
printf "${BOLD} ${mesg}${ALL_OFF}\n" "$@"
|
||||
}
|
||||
|
||||
msg() {
|
||||
(( QUIET )) && return
|
||||
local mesg=$1; shift
|
||||
printf "${GREEN}==>${ALL_OFF}${BOLD} ${mesg}${ALL_OFF}\n" "$@" >&2
|
||||
printf "${GREEN}==>${ALL_OFF}${BOLD} ${mesg}${ALL_OFF}\n" "$@"
|
||||
}
|
||||
|
||||
msg2() {
|
||||
(( QUIET )) && return
|
||||
local mesg=$1; shift
|
||||
printf "${BLUE} ->${ALL_OFF}${BOLD} ${mesg}${ALL_OFF}\n" "$@" >&2
|
||||
printf "${BLUE} ->${ALL_OFF}${BOLD} ${mesg}${ALL_OFF}\n" "$@"
|
||||
}
|
||||
|
||||
ask() {
|
||||
local mesg=$1; shift
|
||||
printf "${BLUE}::${ALL_OFF}${BOLD} ${mesg}${ALL_OFF}" "$@"
|
||||
}
|
||||
|
||||
warning() {
|
||||
|
||||
@@ -48,6 +48,30 @@ in_opt_array() {
|
||||
}
|
||||
|
||||
|
||||
##
|
||||
# usage : check_opt_array( $option, $expected_val, $haystack )
|
||||
# return : 0 - matches expected
|
||||
# 1 - does not match expected
|
||||
# 127 - not found
|
||||
##
|
||||
check_opt_array() {
|
||||
local option=$1 expected=$2; shift 2
|
||||
|
||||
in_opt_array "$option" "$@"
|
||||
case $? in
|
||||
0) # assert enabled
|
||||
[[ $expected = y ]]
|
||||
return ;;
|
||||
1) # assert disabled
|
||||
[[ $expected = n ]]
|
||||
return ;;
|
||||
esac
|
||||
|
||||
# not found
|
||||
return 127
|
||||
}
|
||||
|
||||
|
||||
##
|
||||
# Checks to see if options are present in makepkg.conf or PKGBUILD;
|
||||
# PKGBUILD options always take precedence.
|
||||
@@ -58,29 +82,7 @@ in_opt_array() {
|
||||
# 127 - not found
|
||||
##
|
||||
check_option() {
|
||||
in_opt_array "$1" ${options[@]}
|
||||
case $? in
|
||||
0) # assert enabled
|
||||
[[ $2 = y ]]
|
||||
return ;;
|
||||
1) # assert disabled
|
||||
[[ $2 = n ]]
|
||||
return
|
||||
esac
|
||||
|
||||
# fall back to makepkg.conf options
|
||||
in_opt_array "$1" ${OPTIONS[@]}
|
||||
case $? in
|
||||
0) # assert enabled
|
||||
[[ $2 = y ]]
|
||||
return ;;
|
||||
1) # assert disabled
|
||||
[[ $2 = n ]]
|
||||
return
|
||||
esac
|
||||
|
||||
# not found
|
||||
return 127
|
||||
check_opt_array "$@" "${OPTIONS[@]}" "${options[@]}"
|
||||
}
|
||||
|
||||
|
||||
@@ -93,20 +95,10 @@ check_option() {
|
||||
# 127 - not found
|
||||
##
|
||||
check_buildenv() {
|
||||
in_opt_array "$1" ${BUILDENV[@]}
|
||||
case $? in
|
||||
0) # assert enabled
|
||||
[[ $2 = "y" ]]
|
||||
return ;;
|
||||
1) # assert disabled
|
||||
[[ $2 = "n" ]]
|
||||
return ;;
|
||||
esac
|
||||
|
||||
# not found
|
||||
return 127
|
||||
check_opt_array "$@" "${BUILDENV[@]}"
|
||||
}
|
||||
|
||||
|
||||
##
|
||||
# Checks to see if options are present in BUILDENV or PKGBUILD;
|
||||
# PKGBUILD options always take precedence.
|
||||
@@ -117,26 +109,5 @@ check_buildenv() {
|
||||
# 127 - not found
|
||||
##
|
||||
check_buildoption() {
|
||||
in_opt_array "$1" ${options[@]}
|
||||
case $? in
|
||||
0) # assert enabled
|
||||
[[ $2 = y ]]
|
||||
return ;;
|
||||
1) # assert disabled
|
||||
[[ $2 = n ]]
|
||||
return
|
||||
esac
|
||||
|
||||
in_opt_array "$1" ${BUILDENV[@]}
|
||||
case $? in
|
||||
0) # assert enabled
|
||||
[[ $2 = y ]]
|
||||
return ;;
|
||||
1) # assert disabled
|
||||
[[ $2 = n ]]
|
||||
return
|
||||
esac
|
||||
|
||||
# not found
|
||||
return 127
|
||||
check_opt_array "$@" "${BUILDENV[@]}" "${options[@]}"
|
||||
}
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
# 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
|
||||
|
||||
|
||||
@@ -60,7 +60,7 @@ extract_global_variable() {
|
||||
|
||||
if (( isarray )); then
|
||||
array_build ref "$attr"
|
||||
[[ ${ref[@]} ]] && array_build "$outputvar" "$attr"
|
||||
(( ${#ref[@]} )) && array_build "$outputvar" "$attr"
|
||||
else
|
||||
[[ ${!attr} ]] && printf -v "$outputvar" %s "${!attr}"
|
||||
fi
|
||||
@@ -144,7 +144,7 @@ get_pkgbuild_all_split_attributes() {
|
||||
done
|
||||
done
|
||||
|
||||
[[ ${all_list[@]} ]] && array_build "$outputvar" all_list
|
||||
(( ${#all_list[@]} )) && array_build "$outputvar" all_list
|
||||
}
|
||||
|
||||
##
|
||||
|
||||
@@ -42,7 +42,7 @@ is_array() {
|
||||
local v=$1
|
||||
local ret=1
|
||||
|
||||
if [[ $(declare -p "$v") == declare\ -*([[:alnum:]])a*([[:alnum:]])\ * ]]; then
|
||||
if [[ ${!v@a} = *a* ]]; then
|
||||
ret=0
|
||||
fi
|
||||
|
||||
@@ -51,7 +51,7 @@ is_array() {
|
||||
|
||||
# Canonicalize a directory path if it exists
|
||||
canonicalize_path() {
|
||||
local path="$1";
|
||||
local path="$1"
|
||||
|
||||
if [[ -d $path ]]; then
|
||||
(
|
||||
|
||||
@@ -1,24 +1,10 @@
|
||||
This directory contains code snippets that can be reused by multiple
|
||||
scripts. A brief description of each file follows.
|
||||
|
||||
output_format.sh:
|
||||
Provides basic output formatting functions with levels 'plain', 'msg',
|
||||
'msg2', 'warning' and 'error'. The 'msg' amd 'msg2' functions print to
|
||||
stdout and can be silenced by defining 'QUIET'. The 'warning' and 'error'
|
||||
functions print to stderr with the appropriate prefix added to the
|
||||
message.
|
||||
|
||||
human_to_size.sh:
|
||||
A function to convert human readable sizes (such as "5.3 GiB") to raw byte
|
||||
equivalents. base10 and base2 suffixes are supported, case sensitively. If
|
||||
successful, the converted byte value is written to stdout and the function
|
||||
returns 0. If an error occurs, nothing in written and the function returns 1.
|
||||
returns 0. If an error occurs, nothing is written and the function returns 1.
|
||||
Results may be inaccurate when using a broken implementation of awk, such
|
||||
as mawk or busybox awk.
|
||||
|
||||
size_to_human.sh:
|
||||
The reverse of human_to_size, this function takes an integer byte size and
|
||||
prints its in human readable format, with SI prefixes (e.g. MiB, TiB).
|
||||
|
||||
term_colors.sh:
|
||||
Contains some common color settings for output_format.sh.
|
||||
|
||||
@@ -1,32 +0,0 @@
|
||||
plain() {
|
||||
(( QUIET )) && return
|
||||
local mesg=$1; shift
|
||||
printf "${BOLD} ${mesg}${ALL_OFF}\n" "$@" >&1
|
||||
}
|
||||
|
||||
msg() {
|
||||
(( QUIET )) && return
|
||||
local mesg=$1; shift
|
||||
printf "${GREEN}==>${ALL_OFF}${BOLD} ${mesg}${ALL_OFF}\n" "$@" >&1
|
||||
}
|
||||
|
||||
msg2() {
|
||||
(( QUIET )) && return
|
||||
local mesg=$1; shift
|
||||
printf "${BLUE} ->${ALL_OFF}${BOLD} ${mesg}${ALL_OFF}\n" "$@" >&1
|
||||
}
|
||||
|
||||
ask() {
|
||||
local mesg=$1; shift
|
||||
printf "${BLUE}::${ALL_OFF}${BOLD} ${mesg}${ALL_OFF}" "$@" >&1
|
||||
}
|
||||
|
||||
warning() {
|
||||
local mesg=$1; shift
|
||||
printf "${YELLOW}==> $(gettext "WARNING:")${ALL_OFF}${BOLD} ${mesg}${ALL_OFF}\n" "$@" >&2
|
||||
}
|
||||
|
||||
error() {
|
||||
local mesg=$1; shift
|
||||
printf "${RED}==> $(gettext "ERROR:")${ALL_OFF}${BOLD} ${mesg}${ALL_OFF}\n" "$@" >&2
|
||||
}
|
||||
@@ -1,22 +0,0 @@
|
||||
size_to_human() {
|
||||
awk -v size="$1" '
|
||||
BEGIN {
|
||||
suffix[1] = "B"
|
||||
suffix[2] = "KiB"
|
||||
suffix[3] = "MiB"
|
||||
suffix[4] = "GiB"
|
||||
suffix[5] = "TiB"
|
||||
suffix[6] = "PiB"
|
||||
suffix[7] = "EiB"
|
||||
count = 1
|
||||
|
||||
while (size > 1024) {
|
||||
size /= 1024
|
||||
count++
|
||||
}
|
||||
|
||||
sizestr = sprintf("%.2f", size)
|
||||
sub(/\.?0+$/, "", sizestr)
|
||||
printf("%s %s", sizestr, suffix[count])
|
||||
}'
|
||||
}
|
||||
@@ -1,21 +0,0 @@
|
||||
# check if messages are to be printed using color
|
||||
unset ALL_OFF BOLD BLUE GREEN RED YELLOW
|
||||
if [[ -t 2 && ! $USE_COLOR = "n" ]]; then
|
||||
# prefer terminal safe colored and bold text when tput is supported
|
||||
if tput setaf 0 &>/dev/null; then
|
||||
ALL_OFF="$(tput sgr0)"
|
||||
BOLD="$(tput bold)"
|
||||
BLUE="${BOLD}$(tput setaf 4)"
|
||||
GREEN="${BOLD}$(tput setaf 2)"
|
||||
RED="${BOLD}$(tput setaf 1)"
|
||||
YELLOW="${BOLD}$(tput setaf 3)"
|
||||
else
|
||||
ALL_OFF="\e[1;0m"
|
||||
BOLD="\e[1;1m"
|
||||
BLUE="${BOLD}\e[1;34m"
|
||||
GREEN="${BOLD}\e[1;32m"
|
||||
RED="${BOLD}\e[1;31m"
|
||||
YELLOW="${BOLD}\e[1;33m"
|
||||
fi
|
||||
fi
|
||||
readonly ALL_OFF BOLD BLUE GREEN RED YELLOW
|
||||
@@ -48,13 +48,12 @@ declare -r startdir="$(pwd -P)"
|
||||
|
||||
LIBRARY=${LIBRARY:-'@libmakepkgdir@'}
|
||||
|
||||
build_options=('ccache' 'distcc' 'buildflags' 'makeflags')
|
||||
splitpkg_overrides=('pkgdesc' 'arch' 'url' 'license' 'groups' 'depends'
|
||||
'optdepends' 'provides' 'conflicts' 'replaces' 'backup'
|
||||
'options' 'install' 'changelog')
|
||||
readonly -a build_options splitpkg_overrides
|
||||
readonly -a splitpkg_overrides
|
||||
|
||||
known_hash_algos=('md5' 'sha1' 'sha224' 'sha256' 'sha384' 'sha512' 'whirlpool')
|
||||
known_hash_algos=('md5' 'sha1' 'sha224' 'sha256' 'sha384' 'sha512')
|
||||
|
||||
# Options
|
||||
ASDEPS=0
|
||||
@@ -181,13 +180,17 @@ clean_up() {
|
||||
|
||||
enter_fakeroot() {
|
||||
msg "$(gettext "Entering %s environment...")" "fakeroot"
|
||||
fakeroot -- $0 -F "${ARGLIST[@]}" || exit $?
|
||||
fakeroot -- bash -$- "${BASH_SOURCE[0]}" -F "${ARGLIST[@]}" || exit $?
|
||||
}
|
||||
|
||||
# Automatically update pkgver variable if a pkgver() function is provided
|
||||
# Re-sources the PKGBUILD afterwards to allow for other variables that use $pkgver
|
||||
update_pkgver() {
|
||||
msg "$(gettext "Starting %s()...")" "pkgver"
|
||||
newpkgver=$(run_function_safe pkgver)
|
||||
if (( $? != 0 )); then
|
||||
error_function pkgver
|
||||
fi
|
||||
if ! check_pkgver "$newpkgver"; then
|
||||
error "$(gettext "pkgver() generated an invalid version: %s")" "$newpkgver"
|
||||
exit $E_PKGBUILD_ERROR
|
||||
@@ -376,55 +379,15 @@ source_buildfile() {
|
||||
source_safe "$@"
|
||||
}
|
||||
|
||||
prepare_buildenv() {
|
||||
# clear user-specified buildflags if requested
|
||||
if check_option "buildflags" "n"; then
|
||||
unset CPPFLAGS CFLAGS CXXFLAGS LDFLAGS
|
||||
fi
|
||||
|
||||
if check_option "debug" "y"; then
|
||||
DEBUG_CFLAGS+=" -fdebug-prefix-map=$srcdir=${DBGSRCDIR:-/usr/src/debug}"
|
||||
DEBUG_CXXFLAGS+=" -fdebug-prefix-map=$srcdir=${DBGSRCDIR:-/usr/src/debug}"
|
||||
CFLAGS+=" $DEBUG_CFLAGS"
|
||||
CXXFLAGS+=" $DEBUG_CXXFLAGS"
|
||||
fi
|
||||
|
||||
# clear user-specified makeflags if requested
|
||||
if check_option "makeflags" "n"; then
|
||||
unset MAKEFLAGS
|
||||
fi
|
||||
|
||||
# ensure all necessary build variables are exported
|
||||
export CPPFLAGS CFLAGS CXXFLAGS LDFLAGS MAKEFLAGS CHOST
|
||||
|
||||
local ccache=0
|
||||
|
||||
# use ccache if it is requested (check buildenv and PKGBUILD opts)
|
||||
if check_buildoption "ccache" "y" && [[ -d /usr/lib/ccache/bin ]]; then
|
||||
export PATH="/usr/lib/ccache/bin:$PATH"
|
||||
ccache=1
|
||||
fi
|
||||
|
||||
# use distcc if it is requested (check buildenv and PKGBUILD opts)
|
||||
if check_buildoption "distcc" "y"; then
|
||||
if (( ccache )); then
|
||||
export CCACHE_PREFIX="${CCACHE_PREFIX:+$CCACHE_PREFIX }distcc"
|
||||
export CCACHE_BASEDIR="$srcdir"
|
||||
elif [[ -d /usr/lib/distcc/bin ]]; then
|
||||
export PATH="/usr/lib/distcc/bin:$PATH"
|
||||
fi
|
||||
export DISTCC_HOSTS
|
||||
fi
|
||||
}
|
||||
|
||||
run_function_safe() {
|
||||
local restoretrap restoreset restoreshopt
|
||||
local restoretrap restoreshopt
|
||||
|
||||
# we don't set any special shopts of our own, but we don't want the user to
|
||||
# muck with our environment.
|
||||
restoreshopt=$(shopt -p)
|
||||
|
||||
restoreset=$(shopt -o -p)
|
||||
# localize 'set' shell options to this function - this does not work for shopt
|
||||
local -
|
||||
shopt -o -s errexit errtrace
|
||||
|
||||
restoretrap=$(trap -p ERR)
|
||||
@@ -434,7 +397,6 @@ run_function_safe() {
|
||||
|
||||
trap - ERR
|
||||
eval "$restoretrap"
|
||||
eval "$restoreset"
|
||||
eval "$restoreshopt"
|
||||
}
|
||||
|
||||
@@ -444,12 +406,11 @@ run_function() {
|
||||
fi
|
||||
local pkgfunc="$1"
|
||||
|
||||
msg "$(gettext "Starting %s()...")" "$pkgfunc"
|
||||
if (( ! BASH_SUBSHELL )); then
|
||||
msg "$(gettext "Starting %s()...")" "$pkgfunc"
|
||||
fi
|
||||
cd_safe "$srcdir"
|
||||
|
||||
# save our shell options so pkgfunc() can't override what we need
|
||||
local shellopts=$(shopt -p)
|
||||
|
||||
local ret=0
|
||||
if (( LOGGING )); then
|
||||
local fullver=$(get_full_version)
|
||||
@@ -479,8 +440,6 @@ run_function() {
|
||||
else
|
||||
"$pkgfunc"
|
||||
fi
|
||||
# reset our shell options
|
||||
eval "$shellopts"
|
||||
}
|
||||
|
||||
run_prepare() {
|
||||
@@ -496,24 +455,17 @@ run_check() {
|
||||
}
|
||||
|
||||
run_package() {
|
||||
local pkgfunc
|
||||
if [[ -z $1 ]]; then
|
||||
pkgfunc="package"
|
||||
else
|
||||
pkgfunc="package_$1"
|
||||
fi
|
||||
|
||||
run_function_safe "$pkgfunc"
|
||||
run_function_safe "package${1:+_$1}"
|
||||
}
|
||||
|
||||
find_libdepends() {
|
||||
local d sodepends;
|
||||
local d sodepends
|
||||
|
||||
sodepends=0;
|
||||
sodepends=0
|
||||
for d in "${depends[@]}"; do
|
||||
if [[ $d = *.so ]]; then
|
||||
sodepends=1;
|
||||
break;
|
||||
sodepends=1
|
||||
break
|
||||
fi
|
||||
done
|
||||
|
||||
@@ -522,8 +474,8 @@ find_libdepends() {
|
||||
return 0
|
||||
fi
|
||||
|
||||
local libdeps filename soarch sofile soname soversion;
|
||||
declare -A libdeps;
|
||||
local libdeps filename soarch sofile soname soversion
|
||||
declare -A libdeps
|
||||
|
||||
while read -r filename; do
|
||||
# get architecture of the file; if soarch is empty it's not an ELF binary
|
||||
@@ -640,7 +592,6 @@ write_pkginfo() {
|
||||
|
||||
merge_arch_attrs
|
||||
|
||||
msg2 "$(gettext "Generating %s file...")" ".PKGINFO"
|
||||
printf "# Generated by makepkg %s\n" "$makepkg_version"
|
||||
printf "# using %s\n" "$(fakeroot -v)"
|
||||
|
||||
@@ -678,8 +629,6 @@ write_pkginfo() {
|
||||
}
|
||||
|
||||
write_buildinfo() {
|
||||
msg2 "$(gettext "Generating %s file...")" ".BUILDINFO"
|
||||
|
||||
write_kv_pair "format" "1"
|
||||
|
||||
write_kv_pair "pkgname" "$pkgname"
|
||||
@@ -714,8 +663,11 @@ write_buildinfo() {
|
||||
# database files are placed at the beginning of the package regardless of
|
||||
# sorting
|
||||
list_package_files() {
|
||||
(find . -path './.*' \! -name '.'; find . \! -path './.*' \! -name '.' | LC_ALL=C sort) |
|
||||
sed -e 's|^\./||' | tr '\n' '\0'
|
||||
(
|
||||
export LC_COLLATE=C
|
||||
shopt -s dotglob globstar
|
||||
printf '%s\0' **
|
||||
)
|
||||
}
|
||||
|
||||
create_package() {
|
||||
@@ -731,7 +683,9 @@ create_package() {
|
||||
msg "$(gettext "Creating package \"%s\"...")" "$pkgname"
|
||||
|
||||
pkgarch=$(get_pkg_arch)
|
||||
msg2 "$(gettext "Generating %s file...")" ".PKGINFO"
|
||||
write_pkginfo > .PKGINFO
|
||||
msg2 "$(gettext "Generating %s file...")" ".BUILDINFO"
|
||||
write_buildinfo > .BUILDINFO
|
||||
|
||||
# check for changelog/install files
|
||||
@@ -901,178 +855,6 @@ install_package() {
|
||||
fi
|
||||
}
|
||||
|
||||
get_vcsclient() {
|
||||
local proto=${1%%+*}
|
||||
|
||||
local i
|
||||
for i in "${VCSCLIENTS[@]}"; do
|
||||
local handler="${i%%::*}"
|
||||
if [[ $proto = "$handler" ]]; then
|
||||
local client="${i##*::}"
|
||||
break
|
||||
fi
|
||||
done
|
||||
|
||||
# if we didn't find an client, return an error
|
||||
if [[ -z $client ]]; then
|
||||
error "$(gettext "Unknown download protocol: %s")" "$proto"
|
||||
plain "$(gettext "Aborting...")"
|
||||
exit $E_CONFIG_ERROR
|
||||
fi
|
||||
|
||||
printf "%s\n" "$client"
|
||||
}
|
||||
|
||||
check_vcs_software() {
|
||||
local netfile all_sources all_deps deps ret=0
|
||||
|
||||
if (( SOURCEONLY == 1 )); then
|
||||
# we will not download VCS sources
|
||||
return $ret
|
||||
fi
|
||||
|
||||
if [[ -z $PACMAN_PATH ]]; then
|
||||
warning "$(gettext "Cannot find the %s binary needed to check VCS source requirements.")" "$PACMAN"
|
||||
return $ret
|
||||
fi
|
||||
|
||||
# we currently only use global depends/makedepends arrays for --syncdeps
|
||||
for attr in depends makedepends; do
|
||||
get_pkgbuild_attribute "$pkg" "$attr" 1 'deps'
|
||||
all_deps+=("${deps[@]}")
|
||||
|
||||
get_pkgbuild_attribute "$pkg" "${attr}_$CARCH" 1 'deps'
|
||||
all_deps+=("${deps[@]}")
|
||||
done
|
||||
|
||||
get_all_sources_for_arch 'all_sources'
|
||||
for netfile in ${all_sources[@]}; do
|
||||
local proto=$(get_protocol "$netfile")
|
||||
|
||||
case $proto in
|
||||
bzr*|git*|hg*|svn*)
|
||||
if ! type -p ${proto%%+*} > /dev/null; then
|
||||
local client
|
||||
client=$(get_vcsclient "$proto") || exit $?
|
||||
# ensure specified program is installed
|
||||
local uninstalled
|
||||
uninstalled=$(check_deps "$client") || exit $E_INSTALL_DEPS_FAILED
|
||||
# if not installed, check presence in depends or makedepends
|
||||
if [[ -n "$uninstalled" ]] && (( ! NODEPS || ( VERIFYSOURCE && !DEP_BIN ) )); then
|
||||
if ! in_array "$client" ${all_deps[@]}; then
|
||||
error "$(gettext "Cannot find the %s package needed to handle %s sources.")" \
|
||||
"$client" "${proto%%+*}"
|
||||
ret=1
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
;;
|
||||
*)
|
||||
# non VCS source
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
return $ret
|
||||
}
|
||||
|
||||
check_software() {
|
||||
# check for needed software
|
||||
local ret=0
|
||||
|
||||
# check for PACMAN if we need it
|
||||
if (( ! NODEPS || DEP_BIN || RMDEPS || INSTALL )); then
|
||||
if [[ -z $PACMAN_PATH ]]; then
|
||||
error "$(gettext "Cannot find the %s binary required for dependency operations.")" "$PACMAN"
|
||||
ret=1
|
||||
fi
|
||||
fi
|
||||
|
||||
# check for sudo if we will need it during makepkg execution
|
||||
if (( DEP_BIN || RMDEPS || INSTALL )); then
|
||||
if ! type -p sudo >/dev/null; then
|
||||
warning "$(gettext "Cannot find the %s binary. Will use %s to acquire root privileges.")" "sudo" "su"
|
||||
fi
|
||||
fi
|
||||
|
||||
# fakeroot - correct package file permissions
|
||||
if check_buildenv "fakeroot" "y" && (( EUID > 0 )); then
|
||||
if ! type -p fakeroot >/dev/null; then
|
||||
error "$(gettext "Cannot find the %s binary.")" "fakeroot"
|
||||
ret=1
|
||||
fi
|
||||
fi
|
||||
|
||||
# gpg - package signing
|
||||
if [[ $SIGNPKG == 'y' ]] || { [[ -z $SIGNPKG ]] && check_buildenv "sign" "y"; }; then
|
||||
if ! type -p gpg >/dev/null; then
|
||||
error "$(gettext "Cannot find the %s binary required for signing packages.")" "gpg"
|
||||
ret=1
|
||||
fi
|
||||
fi
|
||||
|
||||
# gpg - source verification
|
||||
if (( ! SKIPPGPCHECK )) && source_has_signatures; then
|
||||
if ! type -p gpg >/dev/null; then
|
||||
error "$(gettext "Cannot find the %s binary required for verifying source files.")" "gpg"
|
||||
ret=1
|
||||
fi
|
||||
fi
|
||||
|
||||
# checksum operations
|
||||
if (( GENINTEG || ! SKIPCHECKSUMS )); then
|
||||
local integlist
|
||||
IFS=$'\n' read -rd '' -a integlist < <(get_integlist)
|
||||
|
||||
local integ
|
||||
for integ in "${integlist[@]}"; do
|
||||
if ! type -p "${integ}sum" >/dev/null; then
|
||||
error "$(gettext "Cannot find the %s binary required for source file checksums operations.")" "${integ}sum"
|
||||
ret=1
|
||||
fi
|
||||
done
|
||||
fi
|
||||
|
||||
# distcc - compilation with distcc
|
||||
if check_buildoption "distcc" "y"; then
|
||||
if ! type -p distcc >/dev/null; then
|
||||
error "$(gettext "Cannot find the %s binary required for distributed compilation.")" "distcc"
|
||||
ret=1
|
||||
fi
|
||||
fi
|
||||
|
||||
# ccache - compilation with ccache
|
||||
if check_buildoption "ccache" "y"; then
|
||||
if ! type -p ccache >/dev/null; then
|
||||
error "$(gettext "Cannot find the %s binary required for compiler cache usage.")" "ccache"
|
||||
ret=1
|
||||
fi
|
||||
fi
|
||||
|
||||
# strip - strip symbols from binaries/libraries
|
||||
if check_option "strip" "y"; then
|
||||
if ! type -p strip >/dev/null; then
|
||||
error "$(gettext "Cannot find the %s binary required for object file stripping.")" "strip"
|
||||
ret=1
|
||||
fi
|
||||
fi
|
||||
|
||||
# gzip - compressig man and info pages
|
||||
if check_option "zipman" "y"; then
|
||||
if ! type -p gzip >/dev/null; then
|
||||
error "$(gettext "Cannot find the %s binary required for compressing man and info pages.")" "gzip"
|
||||
ret=1
|
||||
fi
|
||||
fi
|
||||
|
||||
# tools to download vcs sources
|
||||
if ! check_vcs_software; then
|
||||
ret=1
|
||||
fi
|
||||
|
||||
return $ret
|
||||
}
|
||||
|
||||
check_build_status() {
|
||||
if (( ! SPLITPKG )); then
|
||||
fullver=$(get_full_version)
|
||||
@@ -1212,9 +994,10 @@ usage() {
|
||||
|
||||
version() {
|
||||
printf "makepkg (pacman) %s\n" "$makepkg_version"
|
||||
printf -- "Copyright (c) 2006-2018 Pacman Development Team <pacman-dev@archlinux.org>.\n"
|
||||
printf -- "Copyright (C) 2002-2006 Judd Vinet <jvinet@zeroflux.org>.\n"
|
||||
printf '\n'
|
||||
printf -- "$(gettext "\
|
||||
Copyright (c) 2006-2018 Pacman Development Team <pacman-dev@archlinux.org>.\n\
|
||||
Copyright (C) 2002-2006 Judd Vinet <jvinet@zeroflux.org>.\n\n\
|
||||
This is free software; see the source for copying conditions.\n\
|
||||
There is NO WARRANTY, to the extent permitted by law.\n")"
|
||||
}
|
||||
@@ -1245,7 +1028,7 @@ OPT_LONG=('allsource' 'check' 'clean' 'cleanbuild' 'config:' 'force' 'geninteg'
|
||||
OPT_LONG+=('asdeps' 'noconfirm' 'needed' 'noprogressbar')
|
||||
|
||||
if ! parseopts "$OPT_SHORT" "${OPT_LONG[@]}" -- "$@"; then
|
||||
exit $E_INVALID_OPTION;
|
||||
exit $E_INVALID_OPTION
|
||||
fi
|
||||
set -- "${OPTRET[@]}"
|
||||
unset OPT_SHORT OPT_LONG OPTRET
|
||||
@@ -1479,7 +1262,7 @@ if (( GENINTEG )); then
|
||||
mkdir -p "$srcdir"
|
||||
chmod a-s "$srcdir"
|
||||
cd_safe "$srcdir"
|
||||
download_sources novcs allarch
|
||||
download_sources novcs allarch >&2
|
||||
generate_checksums
|
||||
exit $E_OK
|
||||
fi
|
||||
@@ -1491,7 +1274,7 @@ fi
|
||||
# check we have the software required to process the PKGBUILD
|
||||
check_software || exit $E_MISSING_MAKEPKG_DEPS
|
||||
|
||||
if (( ${#pkgname[@]} > 1 )); then
|
||||
if (( ${#pkgname[@]} > 1 )) || have_function package_${pkgname}; then
|
||||
SPLITPKG=1
|
||||
fi
|
||||
|
||||
@@ -1513,8 +1296,6 @@ if have_function check; then
|
||||
fi
|
||||
if have_function package; then
|
||||
PKGFUNC=1
|
||||
elif [[ $SPLITPKG -eq 0 ]] && have_function package_${pkgname}; then
|
||||
SPLITPKG=1
|
||||
fi
|
||||
|
||||
# check if gpg signature is to be created and if signing key is valid
|
||||
|
||||
103
scripts/meson.build
Normal file
103
scripts/meson.build
Normal file
@@ -0,0 +1,103 @@
|
||||
wrapped_scripts = [
|
||||
'makepkg.sh.in',
|
||||
'pacman-db-upgrade.sh.in',
|
||||
'pacman-key.sh.in',
|
||||
'pkgdelta.sh.in',
|
||||
'repo-add.sh.in'
|
||||
]
|
||||
|
||||
scripts = [
|
||||
'makepkg-template.pl.in',
|
||||
]
|
||||
|
||||
library_files = [
|
||||
'library/human_to_size.sh',
|
||||
]
|
||||
|
||||
SCRIPT_EDITOR = find_program(configure_file(
|
||||
input : join_paths(meson.source_root(), 'build-aux/edit-script.sh.in'),
|
||||
output : 'edit-script.sh',
|
||||
configuration : substs))
|
||||
|
||||
m4_edit = generator(
|
||||
M4,
|
||||
arguments : ['-P', '-I', meson.current_source_dir(), '@INPUT@'],
|
||||
output : '@PLAINNAME@',
|
||||
capture : true)
|
||||
|
||||
foreach script : scripts
|
||||
script_shortname = script.split('.')[0]
|
||||
|
||||
custom_target(
|
||||
script,
|
||||
input : m4_edit.process(script),
|
||||
command : [ SCRIPT_EDITOR, '@INPUT@', '@OUTPUT@', '0755'],
|
||||
output : script_shortname,
|
||||
depend_files : library_files,
|
||||
install : true,
|
||||
install_dir : get_option('bindir'))
|
||||
endforeach
|
||||
|
||||
foreach script : wrapped_scripts
|
||||
script_shortname = script.split('.')[0]
|
||||
|
||||
# Build the script, but don't install it. We want to keep it as a "private"
|
||||
# artifact that we reference from a wrapper script in order to bootstrap it
|
||||
# the build directory.
|
||||
internal_script = custom_target(
|
||||
script,
|
||||
input : m4_edit.process(script),
|
||||
command : [ SCRIPT_EDITOR, '@INPUT@', '@OUTPUT@', '0755'],
|
||||
output : script,
|
||||
depend_files : library_files,
|
||||
build_by_default : true)
|
||||
|
||||
cdata = configuration_data()
|
||||
cdata.set_quoted('BASH', BASH.path())
|
||||
cdata.set_quoted('BUILDDIR', meson.current_build_dir())
|
||||
cdata.set_quoted('REAL_PROGPATH', internal_script.full_path())
|
||||
|
||||
# Create a wrapper script that bootstraps the real script within the build
|
||||
# directory. Use configure_file instead of a custom_target to ensure that
|
||||
# permissions on the input script wrapper are preserved.
|
||||
configure_file(
|
||||
input : join_paths(meson.source_root(), 'build-aux', 'script-wrapper.sh.in'),
|
||||
output : script_shortname,
|
||||
configuration : cdata)
|
||||
|
||||
# Install the real script
|
||||
meson.add_install_script(MESON_INSTALL_SCRIPT,
|
||||
internal_script.full_path(),
|
||||
join_paths(BINDIR, script_shortname))
|
||||
endforeach
|
||||
|
||||
foreach symlink : ['repo-remove', 'repo-elephant']
|
||||
meson.add_install_script(MESON_MAKE_SYMLINK,
|
||||
'repo-add',
|
||||
join_paths(BINDIR, symlink))
|
||||
endforeach
|
||||
|
||||
subdir('libmakepkg')
|
||||
|
||||
custom_target(
|
||||
'bash_completion',
|
||||
command : [ SCRIPT_EDITOR, '@INPUT@', '@OUTPUT@' ],
|
||||
input : 'completion/bash_completion.in',
|
||||
output : 'pacman',
|
||||
install : true,
|
||||
install_dir : BASHCOMPDIR)
|
||||
|
||||
foreach symlink : ['pacman-key', 'makepkg']
|
||||
meson.add_install_script(MESON_MAKE_SYMLINK,
|
||||
'pacman',
|
||||
join_paths(BASHCOMPDIR, symlink))
|
||||
endforeach
|
||||
|
||||
zsh_completion_dir = join_paths(DATAROOTDIR, 'zsh/site-functions')
|
||||
custom_target(
|
||||
'zsh_completion',
|
||||
command : [ SCRIPT_EDITOR, '@INPUT@', '@OUTPUT@' ],
|
||||
input : 'completion/zsh_completion.in',
|
||||
output : '_pacman',
|
||||
install : true,
|
||||
install_dir : zsh_completion_dir)
|
||||
@@ -28,11 +28,10 @@ export TEXTDOMAINDIR='@localedir@'
|
||||
|
||||
declare -r myver='@PACKAGE_VERSION@'
|
||||
|
||||
m4_include(library/output_format.sh)
|
||||
|
||||
LIBRARY=${LIBRARY:-'@libmakepkgdir@'}
|
||||
|
||||
# Import parseopts.sh
|
||||
# Import libmakepkg
|
||||
source "$LIBRARY"/util/message.sh
|
||||
source "$LIBRARY"/util/parseopts.sh
|
||||
|
||||
usage() {
|
||||
@@ -54,8 +53,9 @@ usage() {
|
||||
|
||||
version() {
|
||||
printf "pacman-db-upgrade (pacman) %s\n" "$myver"
|
||||
printf -- "Copyright (c) 2010-2018 Pacman Development Team <pacman-dev@archlinux.org>.\n"
|
||||
printf '\n'
|
||||
printf -- "$(gettext "\
|
||||
Copyright (c) 2010-2018 Pacman Development Team <pacman-dev@archlinux.org>.\n\
|
||||
This is free software; see the source for copying conditions.\n\
|
||||
There is NO WARRANTY, to the extent permitted by law.\n")"
|
||||
}
|
||||
@@ -112,7 +112,12 @@ conffile=${conffile:-@sysconfdir@/pacman.conf}
|
||||
[[ -z $pacroot ]] && pacroot=$(pacman-conf --config="$conffile" rootdir)
|
||||
[[ -z $dbroot ]] && dbroot=$(pacman-conf --config="$conffile" --rootdir="$pacroot" dbpath)
|
||||
|
||||
m4_include(library/term_colors.sh)
|
||||
# check if messages are to be printed using color
|
||||
if [[ -t 2 && $USE_COLOR != "n" ]]; then
|
||||
colorize
|
||||
else
|
||||
unset ALL_OFF BOLD BLUE GREEN RED YELLOW
|
||||
fi
|
||||
|
||||
if [[ ! -d $dbroot ]]; then
|
||||
die "$(gettext "%s does not exist or is not a directory.")" "$dbroot"
|
||||
|
||||
@@ -28,7 +28,8 @@ declare -r myver="@PACKAGE_VERSION@"
|
||||
|
||||
LIBRARY=${LIBRARY:-'@libmakepkgdir@'}
|
||||
|
||||
# Import parseopts.sh
|
||||
# Import libmakepkg
|
||||
source "$LIBRARY"/util/message.sh
|
||||
source "$LIBRARY"/util/parseopts.sh
|
||||
|
||||
# Options
|
||||
@@ -51,8 +52,6 @@ UPDATEDB=0
|
||||
USE_COLOR='y'
|
||||
VERIFY=0
|
||||
|
||||
m4_include(library/output_format.sh)
|
||||
|
||||
usage() {
|
||||
printf "pacman-key (pacman) %s\n" ${myver}
|
||||
echo
|
||||
@@ -92,8 +91,9 @@ usage() {
|
||||
|
||||
version() {
|
||||
printf "pacman-key (pacman) %s\n" "${myver}"
|
||||
printf -- "Copyright (c) 2010-2018 Pacman Development Team <pacman-dev@archlinux.org>.\n"
|
||||
printf '\n'
|
||||
printf -- "$(gettext "\
|
||||
Copyright (c) 2010-2018 Pacman Development Team <pacman-dev@archlinux.org>.\n\
|
||||
This is free software; see the source for copying conditions.\n\
|
||||
There is NO WARRANTY, to the extent permitted by law.\n")"
|
||||
}
|
||||
@@ -485,18 +485,25 @@ refresh_keys() {
|
||||
}
|
||||
|
||||
verify_sig() {
|
||||
local ret=0
|
||||
for sig; do
|
||||
msg "Checking %s..." "$sig"
|
||||
if grep -q 'BEGIN PGP SIGNATURE' "$sig"; then
|
||||
error "$(gettext "Cannot use armored signatures for packages: %s")" "$sig"
|
||||
return 1
|
||||
fi
|
||||
if ! "${GPG_PACMAN[@]}" --status-fd 1 --verify "$sig" | grep -qE '^\[GNUPG:\] TRUST_(FULLY|ULTIMATE).*$'; then
|
||||
error "$(gettext "The signature identified by %s could not be verified.")" "$sig"
|
||||
ret=1
|
||||
fi
|
||||
done
|
||||
local ret=0 sig=$1 file=$2
|
||||
if [[ -z $file && -f ${sig%.*} ]]; then
|
||||
file=${sig%.*}
|
||||
fi
|
||||
if [[ -n $file ]]; then
|
||||
local files=("$sig" "$file")
|
||||
msg "Checking %s... (detached)" "$sig"
|
||||
else
|
||||
local files=("$sig")
|
||||
msg "Checking %s... (embedded)" "$sig"
|
||||
fi
|
||||
if grep -q 'BEGIN PGP SIGNATURE' "$sig"; then
|
||||
error "$(gettext "Cannot use armored signatures for packages: %s")" "$sig"
|
||||
exit 1
|
||||
fi
|
||||
if ! "${GPG_PACMAN[@]}" --status-fd 1 --verify "${files[@]}" | grep -qE '^\[GNUPG:\] TRUST_(FULLY|ULTIMATE).*$'; then
|
||||
error "$(gettext "The signature identified by %s could not be verified.")" "$sig"
|
||||
ret=1
|
||||
fi
|
||||
exit $ret
|
||||
}
|
||||
|
||||
@@ -521,14 +528,14 @@ OPT_LONG=('add' 'config:' 'delete' 'edit-key' 'export' 'finger' 'gpgdir:'
|
||||
'lsign-key' 'nocolor' 'populate' 'recv-keys' 'refresh-keys' 'updatedb'
|
||||
'verify' 'version')
|
||||
if ! parseopts "$OPT_SHORT" "${OPT_LONG[@]}" -- "$@"; then
|
||||
exit 1 # E_INVALID_OPTION;
|
||||
exit 1 # E_INVALID_OPTION
|
||||
fi
|
||||
set -- "${OPTRET[@]}"
|
||||
unset OPT_SHORT OPT_LONG OPTRET
|
||||
|
||||
if [[ $1 == "--" ]]; then
|
||||
usage;
|
||||
exit 0;
|
||||
usage
|
||||
exit 0
|
||||
fi
|
||||
|
||||
while (( $# )); do
|
||||
@@ -562,7 +569,12 @@ while (( $# )); do
|
||||
shift
|
||||
done
|
||||
|
||||
m4_include(library/term_colors.sh)
|
||||
# check if messages are to be printed using color
|
||||
if [[ -t 2 && $USE_COLOR != "n" ]]; then
|
||||
colorize
|
||||
else
|
||||
unset ALL_OFF BOLD BLUE GREEN RED YELLOW
|
||||
fi
|
||||
|
||||
if ! type -p gpg >/dev/null; then
|
||||
error "$(gettext "Cannot find the %s binary required for all %s operations.")" "gpg" "pacman-key"
|
||||
|
||||
@@ -30,7 +30,8 @@ declare -r myver='@PACKAGE_VERSION@'
|
||||
|
||||
LIBRARY=${LIBRARY:-'@libmakepkgdir@'}
|
||||
|
||||
# Import parseopts.sh
|
||||
# Import libmakepkg
|
||||
source "$LIBRARY"/util/message.sh
|
||||
source "$LIBRARY"/util/parseopts.sh
|
||||
|
||||
# Options
|
||||
@@ -47,8 +48,6 @@ max_delta_size=70
|
||||
# ensure we have a sane umask set
|
||||
umask 0022
|
||||
|
||||
m4_include(library/output_format.sh)
|
||||
|
||||
# print usage instructions
|
||||
usage() {
|
||||
printf "pkgdelta (pacman) %s\n" "${myver}"
|
||||
@@ -70,8 +69,9 @@ This delta file can then be added to a database using repo-add.\n")"
|
||||
|
||||
version() {
|
||||
printf "pkgdelta (pacman) %s\n" "$myver"
|
||||
printf -- "Copyright (c) 2009 Xavier Chantry <shiningxc@gmail.com>.\n"
|
||||
printf '\n'
|
||||
printf -- "$(gettext "\
|
||||
Copyright (c) 2009 Xavier Chantry <shiningxc@gmail.com>.\n\n\
|
||||
This is free software; see the source for copying conditions.\n\
|
||||
There is NO WARRANTY, to the extent permitted by law.\n")"
|
||||
}
|
||||
@@ -207,7 +207,12 @@ while :; do
|
||||
shift
|
||||
done
|
||||
|
||||
m4_include(library/term_colors.sh)
|
||||
# check if messages are to be printed using color
|
||||
if [[ -t 2 && $USE_COLOR != "n" ]]; then
|
||||
colorize
|
||||
else
|
||||
unset ALL_OFF BOLD BLUE GREEN RED YELLOW
|
||||
fi
|
||||
|
||||
if (( $# != 2 )); then
|
||||
usage
|
||||
|
||||
@@ -67,6 +67,3 @@ scripts/libmakepkg/util/pkgbuild.sh.in
|
||||
scripts/libmakepkg/util/source.sh.in
|
||||
scripts/libmakepkg/util/util.sh.in
|
||||
scripts/library/human_to_size.sh
|
||||
scripts/library/output_format.sh
|
||||
scripts/library/size_to_human.sh
|
||||
scripts/library/term_colors.sh
|
||||
|
||||
15
scripts/po/meson.build
Normal file
15
scripts/po/meson.build
Normal file
@@ -0,0 +1,15 @@
|
||||
i18n.gettext(
|
||||
'pacman-scripts',
|
||||
args : [
|
||||
'--directory=@0@'.format(meson.current_source_dir()),
|
||||
'--msgid-bugs-address=http://bugs.archlinux.org/index.php?project=3',
|
||||
'--copyright-holder="Pacman Development Team <pacman-dev@archlinux.org>"',
|
||||
'--language', 'shell',
|
||||
|
||||
'--keyword=_',
|
||||
'--flag=_:1:c-format',
|
||||
|
||||
'--keyword=_n:1,2',
|
||||
'--flag=_n:1:c-format',
|
||||
'--flag=_n:2:c-format',
|
||||
])
|
||||
@@ -28,6 +28,8 @@ export TEXTDOMAINDIR='@localedir@'
|
||||
declare -r myver='@PACKAGE_VERSION@'
|
||||
declare -r confdir='@sysconfdir@'
|
||||
|
||||
LIBRARY=${LIBRARY:-'@libmakepkgdir@'}
|
||||
|
||||
QUIET=0
|
||||
DELTA=0
|
||||
ONLYADDNEW=0
|
||||
@@ -42,11 +44,12 @@ LOCKFILE=
|
||||
CLEAN_LOCK=0
|
||||
USE_COLOR='y'
|
||||
|
||||
# Import libmakepkg
|
||||
source "$LIBRARY"/util/message.sh
|
||||
|
||||
# ensure we have a sane umask set
|
||||
umask 0022
|
||||
|
||||
m4_include(library/output_format.sh)
|
||||
|
||||
# print usage instructions
|
||||
usage() {
|
||||
cmd=${0##*/}
|
||||
@@ -93,8 +96,9 @@ See %s(8) for more details and descriptions of the available options.\n")" $cmd
|
||||
version() {
|
||||
cmd=${0##*/}
|
||||
printf "%s (pacman) %s\n\n" "$cmd" "$myver"
|
||||
printf -- "Copyright (c) 2006-2018 Pacman Development Team <pacman-dev@archlinux.org>.\n"
|
||||
printf '\n'
|
||||
printf -- "$(gettext "\
|
||||
Copyright (c) 2006-2018 Pacman Development Team <pacman-dev@archlinux.org>\n\n\
|
||||
This is free software; see the source for copying conditions.\n\
|
||||
There is NO WARRANTY, to the extent permitted by law.\n")"
|
||||
}
|
||||
@@ -300,6 +304,7 @@ verify_repo_extension() {
|
||||
*.db.tar.gz) TAR_OPT="z" ;;
|
||||
*.db.tar.bz2) TAR_OPT="j" ;;
|
||||
*.db.tar.xz) TAR_OPT="J" ;;
|
||||
*.db.tar.zst) TAR_OPT="--zstd" ;;
|
||||
*.db.tar.Z) TAR_OPT="Z" ;;
|
||||
*.db.tar) TAR_OPT="" ;;
|
||||
*) error "$(gettext "'%s' does not have a valid database archive extension.")" \
|
||||
@@ -350,7 +355,7 @@ db_write_entry() {
|
||||
if [[ -d $tmpdir/db/$pkgname-$pkgver ]]; then
|
||||
warning "$(gettext "An entry for '%s' already existed")" "$pkgname-$pkgver"
|
||||
if (( ONLYADDNEW )); then
|
||||
return 0;
|
||||
return 0
|
||||
fi
|
||||
else
|
||||
if (( DELTA || RMEXISTING )); then
|
||||
@@ -538,7 +543,7 @@ prepare_repo_db() {
|
||||
fi
|
||||
fi
|
||||
verify_signature "$dbfile"
|
||||
msg "$(gettext "Extracting database to a temporary location...")"
|
||||
msg "$(gettext "Extracting %s to a temporary location...")" "${dbfile##*/}"
|
||||
bsdtar -xf "$dbfile" -C "$tmpdir/$repo"
|
||||
else
|
||||
case $cmd in
|
||||
@@ -772,7 +777,12 @@ while (( $# )); do
|
||||
shift
|
||||
done
|
||||
|
||||
m4_include(library/term_colors.sh)
|
||||
# check if messages are to be printed using color
|
||||
if [[ -t 2 && $USE_COLOR != "n" ]]; then
|
||||
colorize
|
||||
else
|
||||
unset ALL_OFF BOLD BLUE GREEN RED YELLOW
|
||||
fi
|
||||
|
||||
REPO_DB_FILE=${args[0]}
|
||||
if [[ -z $REPO_DB_FILE ]]; then
|
||||
|
||||
@@ -20,4 +20,4 @@
|
||||
|
||||
DIR="@PWD@"
|
||||
|
||||
LIBRARY="$DIR"/libmakepkg exec "$DIR"/.lib/@PROGNAME@ "$@"
|
||||
LIBRARY="$DIR"/libmakepkg exec bash -$- "$DIR"/.lib/@PROGNAME@ "$@"
|
||||
|
||||
@@ -19,12 +19,11 @@
|
||||
|
||||
#include <errno.h>
|
||||
#include <limits.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h> /* strdup */
|
||||
|
||||
#include <alpm.h>
|
||||
|
||||
#include "ini.h"
|
||||
#include "util.h"
|
||||
#include "util-common.h"
|
||||
|
||||
/**
|
||||
* @brief Parse a pacman-style INI config file.
|
||||
|
||||
4
src/common/meson.build
Normal file
4
src/common/meson.build
Normal file
@@ -0,0 +1,4 @@
|
||||
libcommon_sources = files('''
|
||||
ini.c ini.h
|
||||
util-common.c util-common.h
|
||||
'''.split())
|
||||
@@ -35,7 +35,6 @@
|
||||
#include "conf.h"
|
||||
#include "ini.h"
|
||||
#include "util.h"
|
||||
#include "pacman.h"
|
||||
#include "callback.h"
|
||||
|
||||
/* global config variable */
|
||||
|
||||
@@ -101,6 +101,7 @@ static int files_fileowner(alpm_list_t *syncs, alpm_list_t *targets) {
|
||||
|
||||
static int files_search(alpm_list_t *syncs, alpm_list_t *targets, int regex) {
|
||||
int ret = 0;
|
||||
alpm_db_t *db_local = alpm_get_localdb(config->handle);
|
||||
alpm_list_t *t;
|
||||
const colstr_t *colstr = &config->colstr;
|
||||
|
||||
@@ -157,10 +158,14 @@ static int files_search(alpm_list_t *syncs, alpm_list_t *targets, int regex) {
|
||||
printf("%s/%s\n", alpm_db_get_name(repo), alpm_pkg_get_name(pkg));
|
||||
} else {
|
||||
alpm_list_t *ml;
|
||||
printf("%s%s/%s%s %s%s%s\n", colstr->repo, alpm_db_get_name(repo),
|
||||
printf("%s%s/%s%s %s%s%s", colstr->repo, alpm_db_get_name(repo),
|
||||
colstr->title, alpm_pkg_get_name(pkg),
|
||||
colstr->version, alpm_pkg_get_version(pkg), colstr->nocolor);
|
||||
|
||||
print_groups(pkg);
|
||||
print_installed(db_local, pkg);
|
||||
printf("\n");
|
||||
|
||||
for(ml = match; ml; ml = alpm_list_next(ml)) {
|
||||
c = ml->data;
|
||||
printf(" %s\n", c);
|
||||
|
||||
23
src/pacman/meson.build
Normal file
23
src/pacman/meson.build
Normal file
@@ -0,0 +1,23 @@
|
||||
pacman_sources = files('''
|
||||
check.h check.c
|
||||
conf.h conf.c
|
||||
database.c
|
||||
deptest.c
|
||||
files.c
|
||||
package.h package.c
|
||||
pacman.h pacman.c
|
||||
query.c
|
||||
remove.c
|
||||
sighandler.h sighandler.c
|
||||
sync.c
|
||||
callback.h callback.c
|
||||
upgrade.c
|
||||
util.h util.c
|
||||
'''.split())
|
||||
|
||||
pacman_conf_sources = files('''
|
||||
pacman-conf.c
|
||||
util.h util.c
|
||||
callback.h callback.c
|
||||
conf.h conf.c
|
||||
'''.split())
|
||||
@@ -170,7 +170,7 @@ static void optdeplist_display(alpm_pkg_t *pkg, unsigned short cols)
|
||||
alpm_depend_t *optdep = i->data;
|
||||
char *depstring = alpm_dep_compute_string(optdep);
|
||||
if(alpm_pkg_get_origin(pkg) == ALPM_PKG_FROM_LOCALDB) {
|
||||
if(alpm_find_satisfier(alpm_db_get_pkgcache(localdb), optdep->name)) {
|
||||
if(alpm_find_satisfier(alpm_db_get_pkgcache(localdb), depstring)) {
|
||||
const char *installed = _(" [installed]");
|
||||
depstring = realloc(depstring, strlen(depstring) + strlen(installed) + 1);
|
||||
strcpy(depstring + strlen(depstring), installed);
|
||||
@@ -494,6 +494,25 @@ void print_installed(alpm_db_t *db_local, alpm_pkg_t *pkg)
|
||||
}
|
||||
}
|
||||
|
||||
void print_groups(alpm_pkg_t *pkg)
|
||||
{
|
||||
alpm_list_t *grp;
|
||||
if((grp = alpm_pkg_get_groups(pkg)) != NULL) {
|
||||
const colstr_t *colstr = &config->colstr;
|
||||
alpm_list_t *k;
|
||||
printf(" %s(", colstr->groups);
|
||||
for(k = grp; k; k = alpm_list_next(k)) {
|
||||
const char *group = k->data;
|
||||
fputs(group, stdout);
|
||||
if(alpm_list_next(k)) {
|
||||
/* only print a spacer if there are more groups */
|
||||
putchar(' ');
|
||||
}
|
||||
}
|
||||
printf(")%s", colstr->nocolor);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Display the details of a search.
|
||||
* @param db the database we're searching
|
||||
@@ -526,7 +545,6 @@ int dump_pkg_search(alpm_db_t *db, alpm_list_t *targets, int show_status)
|
||||
|
||||
cols = getcols();
|
||||
for(i = searchlist; i; i = alpm_list_next(i)) {
|
||||
alpm_list_t *grp;
|
||||
alpm_pkg_t *pkg = i->data;
|
||||
|
||||
if(config->quiet) {
|
||||
@@ -536,20 +554,7 @@ int dump_pkg_search(alpm_db_t *db, alpm_list_t *targets, int show_status)
|
||||
colstr->title, alpm_pkg_get_name(pkg),
|
||||
colstr->version, alpm_pkg_get_version(pkg), colstr->nocolor);
|
||||
|
||||
if((grp = alpm_pkg_get_groups(pkg)) != NULL) {
|
||||
alpm_list_t *k;
|
||||
printf(" %s(", colstr->groups);
|
||||
for(k = grp; k; k = alpm_list_next(k)) {
|
||||
const char *group = k->data;
|
||||
fputs(group, stdout);
|
||||
if(alpm_list_next(k)) {
|
||||
/* only print a spacer if there are more groups */
|
||||
putchar(' ');
|
||||
}
|
||||
}
|
||||
printf(")%s", colstr->nocolor);
|
||||
}
|
||||
|
||||
print_groups(pkg);
|
||||
if(show_status) {
|
||||
print_installed(db_local, pkg);
|
||||
}
|
||||
|
||||
@@ -29,6 +29,7 @@ void dump_pkg_files(alpm_pkg_t *pkg, int quiet);
|
||||
void dump_pkg_changelog(alpm_pkg_t *pkg);
|
||||
|
||||
void print_installed(alpm_db_t *db_local, alpm_pkg_t *pkg);
|
||||
void print_groups(alpm_pkg_t *pkg);
|
||||
int dump_pkg_search(alpm_db_t *db, alpm_list_t *targets, int show_status);
|
||||
|
||||
#endif /* PM_PACKAGE_H */
|
||||
|
||||
@@ -266,6 +266,7 @@ static void dump_config(void)
|
||||
show_bool("TotalDownload", config->totaldownload);
|
||||
show_bool("CheckSpace", config->checkspace);
|
||||
show_bool("VerbosePkgLists", config->verbosepkglists);
|
||||
show_bool("DisableDownloadTimeout", config->disable_dl_timeout);
|
||||
show_bool("ILoveCandy", config->chomp);
|
||||
|
||||
show_float("UseDelta", config->deltaratio);
|
||||
@@ -376,6 +377,8 @@ static int list_directives(void)
|
||||
show_bool("CheckSpace", config->checkspace);
|
||||
} else if(strcasecmp(i->data, "VerbosePkgLists") == 0) {
|
||||
show_bool("VerbosePkgLists", config->verbosepkglists);
|
||||
} else if(strcasecmp(i->data, "DisableDownloadTimeout") == 0) {
|
||||
show_bool("DisableDownloadTimeout", config->disable_dl_timeout);
|
||||
|
||||
} else if(strcasecmp(i->data, "UseDelta") == 0) {
|
||||
show_float("UseDelta", config->deltaratio);
|
||||
|
||||
@@ -716,11 +716,6 @@ static int parsearg_upgrade(int opt)
|
||||
return 0;
|
||||
}
|
||||
switch(opt) {
|
||||
case OP_FORCE:
|
||||
pm_printf(ALPM_LOG_WARNING,
|
||||
_("option --force is deprecated; use --overwrite instead\n"));
|
||||
config->flags |= ALPM_TRANS_FLAG_FORCE;
|
||||
break;
|
||||
case OP_OVERWRITE_FILES:
|
||||
parsearg_util_addlist(&(config->overwrite_files));
|
||||
break;
|
||||
|
||||
15
src/pacman/po/meson.build
Normal file
15
src/pacman/po/meson.build
Normal file
@@ -0,0 +1,15 @@
|
||||
i18n.gettext(
|
||||
'pacman',
|
||||
args : [
|
||||
'--directory=@0@'.format(meson.current_source_dir()),
|
||||
'--msgid-bugs-address=http://bugs.archlinux.org/index.php?project=3',
|
||||
'--copyright-holder="Pacman Development Team <pacman-dev@archlinux.org>"',
|
||||
'--language', 'c',
|
||||
|
||||
'--keyword=_',
|
||||
'--flag=_:1:c-format',
|
||||
|
||||
'--keyword=_n:1,2',
|
||||
'--flag=_n:1:c-format',
|
||||
'--flag=_n:2:c-format',
|
||||
])
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user