forked from mirrors/pacman
Compare commits
1 Commits
allan/priv
...
morganamil
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6ce85053c5 |
@@ -16,22 +16,18 @@ default:
|
||||
python
|
||||
fakeroot fakechroot
|
||||
meson
|
||||
artifacts:
|
||||
when: always
|
||||
paths:
|
||||
- build/meson-logs/meson-log.txt
|
||||
|
||||
arch:
|
||||
extends: .arch-test
|
||||
script:
|
||||
- meson setup build
|
||||
- meson build
|
||||
- ninja -C build
|
||||
- fakechroot meson test -C build
|
||||
|
||||
arch-debug:
|
||||
extends: .arch-test
|
||||
script:
|
||||
- meson setup --buildtype=debug --werror build
|
||||
- meson --buildtype=debug build
|
||||
- ninja -C build
|
||||
- fakechroot meson test -C build
|
||||
|
||||
@@ -39,51 +35,50 @@ arch-docs:
|
||||
extends: .arch-test
|
||||
script:
|
||||
- pacman -Syu --needed --noconfirm asciidoc
|
||||
- meson setup -Ddoc=enabled build
|
||||
- meson -Ddoc=enabled build
|
||||
- ninja -C build
|
||||
|
||||
arch-clang:
|
||||
extends: .arch-test
|
||||
script:
|
||||
- pacman -Syu --needed --noconfirm clang
|
||||
- CC=clang meson setup build
|
||||
- CC=clang meson build
|
||||
- ninja -C build
|
||||
- fakechroot meson test -C build
|
||||
|
||||
#arch-valgrind:
|
||||
# extends: .arch-test
|
||||
# script:
|
||||
# - pacman -Syu --needed --noconfirm valgrind
|
||||
# - pacman -U --noconfirm https://geo.mirror.pkgbuild.com/core-debug/os/x86_64/glibc-debug-$(pacman -S --print-format %v glibc)-x86_64.pkg.tar.zst
|
||||
# - meson setup build
|
||||
# - ninja -C build
|
||||
# - PACTEST_VALGRIND=1 fakechroot meson test -C build
|
||||
arch-valgrind:
|
||||
extends: .arch-test
|
||||
script:
|
||||
- pacman -Syu --needed --noconfirm valgrind
|
||||
- meson build
|
||||
- ninja -C build
|
||||
- PACTEST_VALGRIND=1 fakechroot meson test -C build
|
||||
|
||||
arch-nettle:
|
||||
extends: .arch-test
|
||||
script:
|
||||
- meson setup -Dcrypto=nettle --buildtype=debug build
|
||||
- meson -Dcrypto=nettle --buildtype=debug build
|
||||
- ninja -C build
|
||||
- fakechroot meson test -C build
|
||||
|
||||
arch-no-gpg:
|
||||
extends: .arch-test
|
||||
script:
|
||||
- meson setup -Dgpgme=disabled --buildtype=debug build
|
||||
- meson -Dgpgme=disabled --buildtype=debug build
|
||||
- ninja -C build
|
||||
- fakechroot meson test -C build
|
||||
|
||||
arch-no-curl:
|
||||
extends: .arch-test
|
||||
script:
|
||||
- meson setup -Dcurl=disabled --buildtype=debug build
|
||||
- meson -Dcurl=disabled --buildtype=debug build
|
||||
- ninja -C build
|
||||
- fakechroot meson test -C build
|
||||
|
||||
arch-no-nls:
|
||||
extends: .arch-test
|
||||
script:
|
||||
- meson setup -Di18n=false --buildtype=debug build
|
||||
- meson -Di18n=false --buildtype=debug build
|
||||
- ninja -C build
|
||||
- fakechroot meson test -C build
|
||||
|
||||
@@ -98,7 +93,7 @@ debian:
|
||||
gettext python3 python3-setuptools dash gawk ca-certificates
|
||||
fakeroot fakechroot
|
||||
script:
|
||||
- meson setup --buildtype=debug build
|
||||
- meson --buildtype=debug build
|
||||
- ninja -C build
|
||||
- fakechroot meson test -C build
|
||||
|
||||
@@ -114,6 +109,6 @@ fedora:
|
||||
fakeroot fakechroot
|
||||
perl-Module-Load-Conditional
|
||||
script:
|
||||
- meson setup --buildtype=debug build
|
||||
- meson --buildtype=debug build
|
||||
- ninja -C build
|
||||
- fakechroot meson test -C build
|
||||
|
||||
@@ -1,17 +1,17 @@
|
||||
[main]
|
||||
host = https://www.transifex.com
|
||||
|
||||
[o:toofishes:p:archlinux-pacman:r:libalpm-pot]
|
||||
[archlinux-pacman.libalpm-pot]
|
||||
file_filter = lib/libalpm/po/<lang>.po
|
||||
source_file = lib/libalpm/po/libalpm.pot
|
||||
source_lang = en
|
||||
|
||||
[o:toofishes:p:archlinux-pacman:r:pacman-pot]
|
||||
[archlinux-pacman.pacman-pot]
|
||||
file_filter = src/pacman/po/<lang>.po
|
||||
source_file = src/pacman/po/pacman.pot
|
||||
source_lang = en
|
||||
|
||||
[o:toofishes:p:archlinux-pacman:r:pacman-scripts-pot]
|
||||
[archlinux-pacman.pacman-scripts-pot]
|
||||
file_filter = scripts/po/<lang>.po
|
||||
source_file = scripts/po/pacman-scripts.pot
|
||||
source_lang = en
|
||||
|
||||
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
|
||||
}
|
||||
2
RELEASE
2
RELEASE
@@ -14,7 +14,7 @@ The following checklist should be used for making a pacman release.
|
||||
- Update pacman website
|
||||
|
||||
Transifex updates are handled using the transifex client. The basic process is:
|
||||
- Pull updates from transifex ("tx pull -f --minimum-perc 75")
|
||||
- Pull updates from transifex ("tx pull -a -f --minimum-perc 75")
|
||||
- Update po files ("./build-aux/update-po")
|
||||
- Fix all translation errors found
|
||||
- Add any new locales to the relevant LINGUAS file
|
||||
|
||||
@@ -11,7 +11,6 @@ sed \
|
||||
-e "s|@localstatedir[@]|@localstatedir@|g" \
|
||||
-e "s|@libmakepkgdir[@]|@LIBMAKEPKGDIR@|g" \
|
||||
-e "s|@pkgdatadir[@]|@PKGDATADIR@|g" \
|
||||
-e "s|@keyringdir[@]|@KEYRINGDIR@|g" \
|
||||
-e "s|@prefix[@]|@PREFIX@|g" \
|
||||
-e "1s|#!/bin/bash|#!@BASH@|g" \
|
||||
-e "s|@PACKAGE_VERSION[@]|@PACKAGE_VERSION@|g" \
|
||||
@@ -21,7 +20,6 @@ sed \
|
||||
-e "s|@DEBUGSUFFIX[@]|@DEBUGSUFFIX@|g" \
|
||||
-e "s|@INODECMD[@]|@INODECMD@|g" \
|
||||
-e "s|@FILECMD[@]|@FILECMD@|g" \
|
||||
-e "s|@BSDTAR_NO_READ_SPARSE[@]|@BSDTAR_NO_READ_SPARSE@|g" \
|
||||
"$input" >"$output"
|
||||
|
||||
if [[ $mode ]]; then
|
||||
|
||||
@@ -3,4 +3,4 @@
|
||||
# This script serves as a trampoline for running scripts which depend on
|
||||
# libmakepkg with the libmakepkg within the build tree.
|
||||
|
||||
MAKEPKG_LIBRARY=@BUILDDIR@/libmakepkg exec @BASH@ -$- @REAL_PROGPATH@ "$@"
|
||||
LIBRARY=@BUILDDIR@/libmakepkg exec @BASH@ -$- @REAL_PROGPATH@ "$@"
|
||||
|
||||
@@ -18,7 +18,7 @@ value.
|
||||
Description
|
||||
-----------
|
||||
|
||||
This is a description of the contents of version '2' of the
|
||||
This is a description of the contents of version '1' of the
|
||||
BUILDINFO file format.
|
||||
|
||||
*format*::
|
||||
@@ -53,15 +53,6 @@ BUILDINFO file format.
|
||||
*startdir*::
|
||||
The directory from which makepkg was executed.
|
||||
|
||||
*buildtool*::
|
||||
The name of the tool ecosystem used to set up the build environment. Used
|
||||
for defining a spec for reproducible builds, e.g. the source of the
|
||||
linkman:makepkg.conf[5] used.
|
||||
|
||||
*buildtoolver*::
|
||||
The full version of the 'buildtool', for example:
|
||||
"$pkgver-$pkgrel-$pkgarch".
|
||||
|
||||
*buildenv (array)*::
|
||||
The build environment specified in makepkg.conf.
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
# Doxyfile 1.9.3
|
||||
# Doxyfile 1.8.20
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# Project related configuration options
|
||||
@@ -12,6 +12,7 @@ OUTPUT_DIRECTORY = @OUTPUT_DIRECTORY@
|
||||
CREATE_SUBDIRS = NO
|
||||
ALLOW_UNICODE_NAMES = NO
|
||||
OUTPUT_LANGUAGE = English
|
||||
OUTPUT_TEXT_DIRECTION = None
|
||||
BRIEF_MEMBER_DESC = YES
|
||||
REPEAT_BRIEF = YES
|
||||
ABBREVIATE_BRIEF = "The $name class" \
|
||||
@@ -72,7 +73,6 @@ EXTRACT_STATIC = NO
|
||||
EXTRACT_LOCAL_CLASSES = YES
|
||||
EXTRACT_LOCAL_METHODS = NO
|
||||
EXTRACT_ANON_NSPACES = NO
|
||||
RESOLVE_UNNAMED_PARAMS = YES
|
||||
HIDE_UNDOC_MEMBERS = NO
|
||||
HIDE_UNDOC_CLASSES = NO
|
||||
HIDE_FRIEND_COMPOUNDS = NO
|
||||
@@ -81,7 +81,6 @@ INTERNAL_DOCS = NO
|
||||
CASE_SENSE_NAMES = YES
|
||||
HIDE_SCOPE_NAMES = NO
|
||||
HIDE_COMPOUND_REFERENCE= NO
|
||||
SHOW_HEADERFILE = YES
|
||||
SHOW_INCLUDE_FILES = YES
|
||||
SHOW_GROUPED_MEMB_INC = NO
|
||||
FORCE_LOCAL_INCLUDES = NO
|
||||
@@ -111,7 +110,6 @@ QUIET = NO
|
||||
WARNINGS = YES
|
||||
WARN_IF_UNDOCUMENTED = YES
|
||||
WARN_IF_DOC_ERROR = YES
|
||||
WARN_IF_INCOMPLETE_DOC = YES
|
||||
WARN_NO_PARAMDOC = NO
|
||||
WARN_AS_ERROR = NO
|
||||
WARN_FORMAT = "$file:$line: $text"
|
||||
@@ -154,6 +152,7 @@ VERBATIM_HEADERS = YES
|
||||
# Configuration options related to the alphabetical class index
|
||||
#---------------------------------------------------------------------------
|
||||
ALPHABETICAL_INDEX = NO
|
||||
COLS_IN_ALPHA_INDEX = 5
|
||||
IGNORE_PREFIX =
|
||||
#---------------------------------------------------------------------------
|
||||
# Configuration options related to the HTML output
|
||||
@@ -169,12 +168,12 @@ HTML_EXTRA_FILES =
|
||||
HTML_COLORSTYLE_HUE = 220
|
||||
HTML_COLORSTYLE_SAT = 100
|
||||
HTML_COLORSTYLE_GAMMA = 80
|
||||
HTML_TIMESTAMP = YES
|
||||
HTML_DYNAMIC_MENUS = YES
|
||||
HTML_DYNAMIC_SECTIONS = NO
|
||||
HTML_INDEX_NUM_ENTRIES = 100
|
||||
GENERATE_DOCSET = NO
|
||||
DOCSET_FEEDNAME = "Doxygen generated docs"
|
||||
DOCSET_FEEDURL =
|
||||
DOCSET_BUNDLE_ID = org.doxygen.Project
|
||||
DOCSET_PUBLISHER_ID = org.doxygen.Publisher
|
||||
DOCSET_PUBLISHER_NAME = Publisher
|
||||
@@ -197,16 +196,14 @@ GENERATE_ECLIPSEHELP = NO
|
||||
ECLIPSE_DOC_ID = org.doxygen.Project
|
||||
DISABLE_INDEX = NO
|
||||
GENERATE_TREEVIEW = NO
|
||||
FULL_SIDEBAR = NO
|
||||
ENUM_VALUES_PER_LINE = 4
|
||||
TREEVIEW_WIDTH = 250
|
||||
EXT_LINKS_IN_WINDOW = NO
|
||||
OBFUSCATE_EMAILS = YES
|
||||
HTML_FORMULA_FORMAT = png
|
||||
FORMULA_FONTSIZE = 10
|
||||
FORMULA_TRANSPARENT = YES
|
||||
FORMULA_MACROFILE =
|
||||
USE_MATHJAX = NO
|
||||
MATHJAX_VERSION = MathJax_2
|
||||
MATHJAX_FORMAT = HTML-CSS
|
||||
MATHJAX_RELPATH = http://www.mathjax.org/mathjax
|
||||
MATHJAX_EXTENSIONS =
|
||||
@@ -237,7 +234,9 @@ PDF_HYPERLINKS = NO
|
||||
USE_PDFLATEX = NO
|
||||
LATEX_BATCHMODE = NO
|
||||
LATEX_HIDE_INDICES = NO
|
||||
LATEX_SOURCE_CODE = NO
|
||||
LATEX_BIB_STYLE = plain
|
||||
LATEX_TIMESTAMP = NO
|
||||
LATEX_EMOJI_DIRECTORY =
|
||||
#---------------------------------------------------------------------------
|
||||
# Configuration options related to the RTF output
|
||||
@@ -248,6 +247,7 @@ COMPACT_RTF = NO
|
||||
RTF_HYPERLINKS = NO
|
||||
RTF_STYLESHEET_FILE =
|
||||
RTF_EXTENSIONS_FILE =
|
||||
RTF_SOURCE_CODE = NO
|
||||
#---------------------------------------------------------------------------
|
||||
# Configuration options related to the man page output
|
||||
#---------------------------------------------------------------------------
|
||||
@@ -268,9 +268,7 @@ XML_NS_MEMB_FILE_SCOPE = NO
|
||||
#---------------------------------------------------------------------------
|
||||
GENERATE_DOCBOOK = NO
|
||||
DOCBOOK_OUTPUT = docbook
|
||||
#---------------------------------------------------------------------------
|
||||
# Configuration options for the AutoGen Definitions output
|
||||
#---------------------------------------------------------------------------
|
||||
DOCBOOK_PROGRAMLISTING = NO
|
||||
GENERATE_AUTOGEN_DEF = NO
|
||||
#---------------------------------------------------------------------------
|
||||
# Configuration options related to the Perl module output
|
||||
@@ -306,18 +304,19 @@ EXTERNAL_PAGES = YES
|
||||
#---------------------------------------------------------------------------
|
||||
# Configuration options related to the dot tool
|
||||
#---------------------------------------------------------------------------
|
||||
CLASS_DIAGRAMS = NO
|
||||
DIA_PATH =
|
||||
HIDE_UNDOC_RELATIONS = YES
|
||||
HAVE_DOT = YES
|
||||
DOT_NUM_THREADS = 0
|
||||
DOT_FONTNAME = Helvetica
|
||||
DOT_FONTSIZE = 10
|
||||
DOT_FONTPATH =
|
||||
CLASS_GRAPH = YES
|
||||
COLLABORATION_GRAPH = YES
|
||||
GROUP_GRAPHS = YES
|
||||
UML_LOOK = NO
|
||||
UML_LIMIT_NUM_FIELDS = 10
|
||||
DOT_UML_DETAILS = NO
|
||||
DOT_WRAP_THRESHOLD = 17
|
||||
TEMPLATE_RELATIONS = NO
|
||||
INCLUDE_GRAPH = YES
|
||||
INCLUDED_BY_GRAPH = YES
|
||||
@@ -325,7 +324,6 @@ CALL_GRAPH = NO
|
||||
CALLER_GRAPH = NO
|
||||
GRAPHICAL_HIERARCHY = YES
|
||||
DIRECTORY_GRAPH = YES
|
||||
DIR_GRAPH_MAX_DEPTH = 1
|
||||
DOT_IMAGE_FORMAT = png
|
||||
INTERACTIVE_SVG = NO
|
||||
DOT_PATH =
|
||||
@@ -337,6 +335,7 @@ PLANTUML_CFG_FILE =
|
||||
PLANTUML_INCLUDE_PATH =
|
||||
DOT_GRAPH_MAX_NODES = 50
|
||||
MAX_DOT_GRAPH_DEPTH = 3
|
||||
DOT_TRANSPARENT = NO
|
||||
DOT_MULTI_TARGETS = NO
|
||||
GENERATE_LEGEND = YES
|
||||
DOT_CLEANUP = YES
|
||||
|
||||
@@ -12,8 +12,8 @@ depends=('glibc')
|
||||
makedepends=('ed')
|
||||
optdepends=('ed: for "patch -e" functionality')
|
||||
source=("ftp://ftp.gnu.org/gnu/$pkgname/$pkgname-$pkgver.tar.xz"{,.sig})
|
||||
sha256sums=('9124ba46db0abd873d0995c2ca880e81252676bb6c03e0a37dfc5f608a9b0ceb'
|
||||
'SKIP')
|
||||
md5sums=('e9ae5393426d3ad783a300a338c09b72'
|
||||
'SKIP')
|
||||
|
||||
build() {
|
||||
cd "$srcdir/$pkgname-$pkgver"
|
||||
|
||||
@@ -3,7 +3,7 @@ PKGBUILD(5)
|
||||
|
||||
Name
|
||||
----
|
||||
PKGBUILD - Package build description file
|
||||
PKGBUILD - Arch Linux package build description file
|
||||
|
||||
|
||||
Synopsis
|
||||
@@ -84,7 +84,14 @@ systems (see below).
|
||||
|
||||
*license (array)*::
|
||||
This field specifies the license(s) that apply to the package.
|
||||
If multiple licenses are applicable, list all of them:
|
||||
Commonly used licenses can be found in '/usr/share/licenses/common'. If you
|
||||
see the package's license there, simply reference it in the license
|
||||
field (e.g., `license=('GPL')`). If the package provides a license not
|
||||
available in '/usr/share/licenses/common', then you should include it
|
||||
in the package itself and set `license=('custom')` or
|
||||
`license=('custom:LicenseName')`. The license should be placed in
|
||||
'$pkgdir/usr/share/licenses/$pkgname/' when building the package. If
|
||||
multiple licenses are applicable, list all of them:
|
||||
`license=('GPL' 'FDL')`.
|
||||
|
||||
*install*::
|
||||
@@ -180,6 +187,11 @@ contain whitespace characters.
|
||||
than or equal to), `<=` (less than or equal to), `=` (equal to), `>`
|
||||
(greater than), or `<` (less than).
|
||||
+
|
||||
If the dependency name appears to be a library (ends with .so), makepkg will
|
||||
try to find a binary that depends on the library in the built package and
|
||||
append the version needed by the binary. Appending the version yourself
|
||||
disables automatic detection.
|
||||
+
|
||||
Additional architecture-specific depends can be added by appending an
|
||||
underscore and the architecture name e.g., 'depends_x86_64=()'.
|
||||
|
||||
@@ -233,6 +245,10 @@ example, dcron can provide 'cron=2.0' to satisfy the 'cron>=2.0' dependency of
|
||||
other packages. Provisions involving the `>` and `<` operators are invalid as
|
||||
only specific versions of a package may be provided.
|
||||
+
|
||||
If the provision name appears to be a library (ends with .so), makepkg will
|
||||
try to find the library in the built package and append the correct
|
||||
version. Appending the version yourself disables automatic detection.
|
||||
+
|
||||
Additional architecture-specific provides can be added by appending an
|
||||
underscore and the architecture name e.g., 'provides_x86_64=()'.
|
||||
|
||||
@@ -336,13 +352,6 @@ function.
|
||||
the optional functions listed below. The packaging stage is run using
|
||||
fakeroot to ensure correct file permissions in the resulting package.
|
||||
All other functions will be run as the user calling makepkg.
|
||||
This function is run inside `$srcdir`.
|
||||
|
||||
*verify() Function*::
|
||||
An optional `verify()` function can be specified to implement arbitrary
|
||||
source authentication. The function should return a non-zero exit code when
|
||||
verification fails. This function is run before sources are extracted.
|
||||
This function is run inside `$startdir`.
|
||||
|
||||
*prepare() Function*::
|
||||
An optional `prepare()` function can be specified in which operations to
|
||||
@@ -350,19 +359,16 @@ function.
|
||||
function is run after the source extraction and before the `build()`
|
||||
function. The `prepare()` function is skipped when source extraction
|
||||
is skipped.
|
||||
This function is run inside `$srcdir`.
|
||||
|
||||
*build() Function*::
|
||||
The optional `build()` function is used to compile and/or adjust the source
|
||||
files in preparation to be installed by the `package()` function.
|
||||
This function is run inside `$srcdir`.
|
||||
|
||||
*check() Function*::
|
||||
An optional `check()` function can be specified in which a package's
|
||||
test-suite may be run. This function is run between the `build()` and
|
||||
`package()` functions. Be sure any exotic commands used are covered by the
|
||||
`checkdepends` array.
|
||||
This function is run inside `$srcdir`.
|
||||
|
||||
All of the above variables such as `$pkgname` and `$pkgver` are available for
|
||||
use in the packaging functions. In addition, makepkg defines the following
|
||||
@@ -372,6 +378,7 @@ variables:
|
||||
This contains the directory where makepkg extracts, or copies, all source
|
||||
files.
|
||||
+
|
||||
All of the packaging functions defined above are run starting inside `$srcdir`
|
||||
|
||||
*pkgdir*::
|
||||
This contains the directory where makepkg bundles the installed package.
|
||||
@@ -473,9 +480,6 @@ Currently makepkg supports the Bazaar, Git, Subversion, Fossil and Mercurial
|
||||
version control systems. For other version control systems, manual cloning of
|
||||
upstream repositories must be done in the `prepare()` function.
|
||||
|
||||
Some <<VCS,VCS Sources>> like Git support pinning the checkout by a checksum of
|
||||
its content using deterministic export functionality like ``git archive''.
|
||||
|
||||
The source URL is divided into four components:
|
||||
|
||||
*directory*::
|
||||
@@ -520,7 +524,8 @@ The source URL is divided into four components:
|
||||
Example
|
||||
-------
|
||||
The following is an example PKGBUILD for the 'patch' package. For more
|
||||
examples, look through the build files of your distribution's packages.
|
||||
examples, look through the build files of your distribution's packages. For
|
||||
those using Arch Linux, consult the Arch Build System (ABS) tree.
|
||||
|
||||
[source,sh]
|
||||
-------------------------------
|
||||
|
||||
@@ -18,6 +18,7 @@ Current maintainers:
|
||||
|
||||
* Allan McRae <allan@archlinux.org>
|
||||
* Andrew Gregory <andrew.gregory.8@gmail.com>
|
||||
* Eli Schwartz <eschwartz@archlinux.org>
|
||||
* Morgan Adamiec <morganamilo@archlinux.org>
|
||||
|
||||
Past major contributors:
|
||||
@@ -29,7 +30,6 @@ Past major contributors:
|
||||
* Xavier Chantry <shiningxc@gmail.com>
|
||||
* Nagy Gabor <ngaba@bibl.u-szeged.hu>
|
||||
* Dave Reisner <dreisner@archlinux.org>
|
||||
* Eli Schwartz <eschwartz@archlinux.org>
|
||||
|
||||
For additional contributors, use `git shortlog -s` on the pacman.git
|
||||
repository.
|
||||
|
||||
@@ -240,7 +240,7 @@ link:translation-help.html[translation-help].
|
||||
Bugs
|
||||
----
|
||||
If you find bugs (which is quite likely), please email them to the pacman-dev
|
||||
mailing last at mailto:pacman-dev@lists.archlinux.org[] with specific information
|
||||
mailing last at mailto:pacman-dev@archlinux.org[] with specific information
|
||||
such as your command-line, the nature of the bug, and even the package database
|
||||
if it helps.
|
||||
|
||||
@@ -250,7 +250,7 @@ bugs under the Pacman project.
|
||||
|
||||
Copyright
|
||||
---------
|
||||
pacman is Copyright (C) 2006-2022 Pacman Development Team
|
||||
<pacman-dev@lists.archlinux.org> and Copyright (C) 2002-2006 Judd Vinet
|
||||
pacman is Copyright (C) 2006-2021 Pacman Development Team
|
||||
<pacman-dev@archlinux.org> and Copyright (C) 2002-2006 Judd Vinet
|
||||
<jvinet@zeroflux.org> and is licensed through the GNU General Public License,
|
||||
version 2 or later.
|
||||
|
||||
@@ -85,7 +85,7 @@ Example PKGBUILD
|
||||
license=('PerlArtistic' 'GPL')
|
||||
depends=('perl')
|
||||
source=("http://search.cpan.org/CPAN/authors/id/S/SH/SHERZODR/Config-Simple-${pkgver}.tar.gz")
|
||||
sha256sums=('dd9995706f0f9384a15ccffe116c3b6e22f42ba2e58d8f24ed03c4a0e386edb4')
|
||||
md5sums=('f014aec54f0a1e2e880d317180fce502')
|
||||
_distname="Config-Simple"
|
||||
|
||||
# template start; name=perl-module; version=1.0;
|
||||
|
||||
@@ -75,7 +75,7 @@ Options
|
||||
For each source file in the source array of PKGBUILD, download the file
|
||||
if required and generate integrity checks. The integrity checks generated
|
||||
are determined by the checks present in the PKGBUILD, falling back to the
|
||||
value of the INTEGRITY_CHECK array in makepkg.conf(5) if these are absent.
|
||||
value of the INTEGRITY_CHECK array in makepkg.conf(5) if these are absent
|
||||
This output can be redirected into your PKGBUILD for source validation
|
||||
using "`makepkg -g >> PKGBUILD`".
|
||||
|
||||
@@ -146,9 +146,6 @@ Options
|
||||
*-C, \--cleanbuild*::
|
||||
Remove the $srcdir before building the package.
|
||||
|
||||
*-D* <dir>, *\--dir* <dir> ::
|
||||
Change to directory <dir> before reading the PKGBUILD or doing anything else.
|
||||
|
||||
*\--allsource*::
|
||||
Do not actually build the package, but build a source-only tarball that
|
||||
includes all sources, including those that are normally downloaded via
|
||||
@@ -171,9 +168,6 @@ Options
|
||||
*\--noprepare*::
|
||||
Do not run the prepare() function in the PKGBUILD.
|
||||
|
||||
*\--noverify*::
|
||||
Do not run the verify() function in the PKGBUILD.
|
||||
|
||||
*\--sign*::
|
||||
Sign the resulting package with gpg, overriding the setting in
|
||||
linkman:makepkg.conf[5].
|
||||
@@ -233,9 +227,6 @@ before building.
|
||||
|
||||
Environment Variables
|
||||
---------------------
|
||||
**MAKEPKG_LIBRARY**="/path/to/directory"::
|
||||
Use an alternative libmakepkg path instead of the {libmakepkgdir} default.
|
||||
|
||||
**PACMAN**::
|
||||
The command that will be used to check for missing dependencies and to
|
||||
install and remove packages. Pacman's '-Qq', '-Rns', '-S', '-T', and '-U'
|
||||
@@ -296,10 +287,6 @@ Environment Variables
|
||||
**BUILDTOOLVER=**"<version>"::
|
||||
The version of the '$BUILDTOOL' used.
|
||||
|
||||
**GITFLAGS**::
|
||||
The options to pass when checking out git sources, replacing the default
|
||||
"--mirror".
|
||||
|
||||
Configuration
|
||||
-------------
|
||||
See linkman:makepkg.conf[5] for more details on configuring makepkg using the
|
||||
|
||||
@@ -81,11 +81,6 @@ Options
|
||||
usage resembling ``-Wl,--hash-style=gnu''. Read ld(1) for more details on
|
||||
available linker flags.
|
||||
|
||||
**LTOFLAGS=**"ltoflags"::
|
||||
Additional compiler and linker flags appended to `CFLAGS`, `CXXFLAGS`
|
||||
and `LDFLAGS` when building with link time optimization. If empty,
|
||||
``-flto'' is used.
|
||||
|
||||
**MAKEFLAGS=**"makeflags"::
|
||||
This is often used to set the number of jobs used; for example, `-j2`.
|
||||
Other flags that make accepts can also be passed.
|
||||
@@ -195,14 +190,8 @@ Options
|
||||
package containing the debug symbols when used with `strip'.
|
||||
|
||||
*lto*;;
|
||||
Enable building packages using link time optimization. Adds the
|
||||
flags specified in LTOFLAGS to CFLAGS, CXXFLAGS and LDFLAGS (or
|
||||
``-flto'' if LTOFLAGS is empty).
|
||||
|
||||
*autodeps*;;
|
||||
Enable the automatic addition of libraries to the depends and
|
||||
provides arrays. Search library directories are controlled by
|
||||
the LIB_DIRS variable defined below.
|
||||
Enable building packages using link time optimization. Adds '-flto'
|
||||
to both CFLAGS and CXXFLAGS.
|
||||
|
||||
**INTEGRITY_CHECK=(**check1 ...**)**::
|
||||
File integrity checks to use. Multiple checks may be specified; this
|
||||
@@ -234,12 +223,6 @@ Options
|
||||
that are located in opt/, you may need to add the directory to this
|
||||
array. *NOTE:* Do not add the leading slash to the directory name.
|
||||
|
||||
**LIB_DIRS=(**lib:usr/lib ...**)**::
|
||||
If `autodeps` is specified in the `OPTIONS` array, this variable will
|
||||
instruct makepkg where to look to find libraries to add to the `provides`
|
||||
array. The format is "prefix:path", where provides will be added for
|
||||
libraries found in "path" with the specified prefix added.
|
||||
|
||||
**PURGE_TARGETS=(**usr/{,share}/info/dir .podlist *.pod...**)**::
|
||||
If `purge` is specified in the `OPTIONS` array, this variable will
|
||||
instruct makepkg which files to remove from the package. This is
|
||||
@@ -291,10 +274,9 @@ Options
|
||||
|
||||
**PKGEXT=**"{pkgext}", **SRCEXT=**"{srcext}"::
|
||||
Sets the compression used when making compiled or source packages.
|
||||
Valid suffixes are `.pkg` or `.src` (for PKGEXT and SRCEXT resepectively)
|
||||
followed by one of `.tar.gz`, `.tar.bz2`, `.tar.xz`, `.tar.zst`, `.tar.lzo`,
|
||||
`.tar.lrz`, `.tar.lz4`, `.tar.lz` and `.tar.Z`, or simply `.tar` to
|
||||
disable compression entirely.
|
||||
Valid suffixes are `.tar.gz`, `.tar.bz2`, `.tar.xz`, `.tar.zst`,
|
||||
`.tar.lzo`, `.tar.lrz`, `.tar.lz4`, `.tar.lz` and `.tar.Z`, or
|
||||
simply `.tar` to disable compression entirely.
|
||||
|
||||
**PACMAN_AUTH=()**::
|
||||
Specify a command prefix for running pacman as root. If unset, makepkg will
|
||||
|
||||
@@ -5,9 +5,7 @@ manpages = [
|
||||
{ 'name': 'makepkg-template.1' },
|
||||
{ 'name': 'repo-add.8' },
|
||||
{ 'name': 'vercmp.8' },
|
||||
{ 'name': 'testpkg.8' },
|
||||
{ 'name': 'pacman-key.8' },
|
||||
{ 'name': 'pacman-db-upgrade.8' },
|
||||
{ 'name': 'PKGBUILD.5', 'extra_depends' : [ 'PKGBUILD-example.txt' ] },
|
||||
{ 'name': 'makepkg.conf.5' },
|
||||
{ 'name': 'pacman.conf.5' },
|
||||
@@ -30,12 +28,10 @@ asciidoc_opts = [
|
||||
'-a', 'srcext=@0@'.format(get_option('src-ext')),
|
||||
'-a', 'pkgext=@0@'.format(get_option('pkg-ext')),
|
||||
'-a', 'pkgdatadir=@0@'.format(PKGDATADIR),
|
||||
'-a', 'keyringdir=@0@'.format(KEYRINGDIR),
|
||||
'-a', 'localstatedir=@0@'.format(LOCALSTATEDIR),
|
||||
'-a', 'sysconfdir=@0@'.format(SYSCONFDIR),
|
||||
'-a', 'datarootdir=@0@'.format(DATAROOTDIR),
|
||||
'-a', 'rootdir=@0@'.format(ROOTDIR),
|
||||
'-a', 'libmakepkgdir=@0@'.format(LIBMAKEPKGDIR),
|
||||
]
|
||||
|
||||
html_targets = []
|
||||
|
||||
@@ -34,7 +34,7 @@ Options
|
||||
*-R, \--rootdir* <path>::
|
||||
Specify an alternate installation root (default is `/`).
|
||||
|
||||
*-r, \--repo* <repository>::
|
||||
*-r, \--repo* <remote>::
|
||||
Query options for a specific repository.
|
||||
|
||||
*-v, \--verbose*::
|
||||
|
||||
@@ -1,36 +0,0 @@
|
||||
pacman-db-upgrade(8)
|
||||
====================
|
||||
|
||||
Name
|
||||
----
|
||||
pacman-db-upgrade - upgrade the local pacman database to a newer format
|
||||
|
||||
Synopsis
|
||||
--------
|
||||
'pacman-db-upgrade' [options]
|
||||
|
||||
Description
|
||||
-----------
|
||||
'pacman-db-upgrade' is a script that upgrades the local database used
|
||||
by linkman:pacman[8] to a newer format.
|
||||
|
||||
Options
|
||||
--------------
|
||||
*-h, \--help*::
|
||||
Show the built-in help message and exit.
|
||||
*-V, \--version*::
|
||||
Show version information and exit.
|
||||
*-d, \--dbpath* <path>::
|
||||
Set an alternate database location.
|
||||
*-r, \--root* <path>::
|
||||
Set an alternate installation root.
|
||||
*\--config* <path>::
|
||||
Set an alternate configuration file.
|
||||
*\--nocolor*::
|
||||
Remove color from output.
|
||||
|
||||
See Also
|
||||
--------
|
||||
linkman:pacman[8]
|
||||
|
||||
include::footer.asciidoc[]
|
||||
@@ -86,7 +86,7 @@ Operations
|
||||
|
||||
*\--populate*::
|
||||
Reload the default keys from the (optionally provided) keyrings in
|
||||
+{keyringdir}+. For more information, see
|
||||
+{pkgdatadir}/keyrings+. For more information, see
|
||||
<<PK,Providing a Keyring for Import>> below.
|
||||
|
||||
*-u, \--updatedb*::
|
||||
@@ -129,7 +129,7 @@ A distribution or other repository provided may want to provide a set of
|
||||
PGP keys used in the signing of its packages and repository databases that can
|
||||
be readily imported into the pacman keyring. This is achieved by providing a
|
||||
PGP keyring file `foo.gpg` that contains the keys for the foo keyring in the
|
||||
directory +{keyringdir}+.
|
||||
directory +{pkgdatadir}/keyrings+.
|
||||
|
||||
Optionally, the file `foo-trusted` can be provided containing a list of trusted
|
||||
key IDs for that keyring. This is a file in a format compatible with 'gpg
|
||||
|
||||
@@ -212,7 +212,7 @@ Transaction Options (apply to '-S', '-R' and '-U')
|
||||
|
||||
*\--assume-installed* <package=version>::
|
||||
Add a virtual package "package" with version "version" to the transaction
|
||||
to satisfy dependencies. This allows disabling the specific dependency checks
|
||||
to satisfy dependencies. This allows to disable specific dependency checks
|
||||
without affecting all dependency checks. To disable all dependency
|
||||
checking, see the '\--nodeps' option.
|
||||
|
||||
@@ -235,15 +235,8 @@ Transaction Options (apply to '-S', '-R' and '-U')
|
||||
|
||||
*\--print-format* <format>::
|
||||
Specify a printf-like format to control the output of the '\--print'
|
||||
operation. The possible attributes are: "%a" for arch, "%b" for
|
||||
builddate, "%d" for description, "%e" for pkgbase, "%f" for filename,
|
||||
"%g" for base64 encoded PGP signature, "%h" for sha256sum, "%m" for
|
||||
md5sum, "%n" for pkgname, "%p" for packager, "%v" for pkgver, "%l" for
|
||||
location, "%r" for repository, "%s" for size, "%C" for checkdepends,
|
||||
"%D" for depends, "%G" for groups, "%H" for conflicts, "%L" for
|
||||
licenses, "%M" for makedepends, "%O" for optional depends, "%P" for
|
||||
provides and "%R" for replaces.
|
||||
Implies '\--print'.
|
||||
operation. The possible attributes are: "%n" for pkgname, "%v" for pkgver,
|
||||
"%l" for location, "%r" for repository, and "%s" for size. Implies '\--print'.
|
||||
|
||||
|
||||
Upgrade Options (apply to '-S' and '-U')[[UO]]
|
||||
@@ -456,11 +449,11 @@ Additional targets can also be specified manually, so that '-Su foo' will do a
|
||||
system upgrade and install/upgrade the "foo" package in the same operation.
|
||||
|
||||
*-y, \--refresh*::
|
||||
Download a fresh copy of the master package databases '(repo.db)' from the
|
||||
server(s) defined in linkman:pacman.conf[5]. This should typically be used
|
||||
each time you use '\--sysupgrade' or '-u'. Passing two '\--refresh' or '-y'
|
||||
flags will force a refresh of all package databases, even if they appear to
|
||||
be up-to-date.
|
||||
Download a fresh copy of the master package database from the server(s)
|
||||
defined in linkman:pacman.conf[5]. This should typically be used each time
|
||||
you use '\--sysupgrade' or '-u'. Passing two '\--refresh' or '-y' flags
|
||||
will force a refresh of all package databases, even if they appear to be
|
||||
up-to-date.
|
||||
|
||||
|
||||
Database Options (apply to '-D')[[QO]]
|
||||
@@ -489,8 +482,8 @@ Database Options (apply to '-D')[[QO]]
|
||||
File Options (apply to '-F')[[FO]]
|
||||
----------------------------------
|
||||
*-y, --refresh*::
|
||||
Download fresh package file databases '(repo.files)' from the server.
|
||||
Use twice to force a refresh even if databases are up to date.
|
||||
Download fresh package databases from the server. Use twice to force a
|
||||
refresh even if databases are up to date.
|
||||
|
||||
*-l, \--list*::
|
||||
List the files owned by the queried package.
|
||||
|
||||
@@ -121,7 +121,7 @@ Options
|
||||
architecture 'any' can always be installed, as they are meant to be
|
||||
architecture independent.
|
||||
|
||||
*XferCommand =* /path/to/command %u [%o]::
|
||||
*XferCommand =* /path/to/command %u::
|
||||
If set, an external program will be used to download all remote files.
|
||||
All instances of `%u` will be replaced with the download URL. If present,
|
||||
instances of `%o` will be replaced with the local filename, plus a
|
||||
@@ -207,10 +207,6 @@ Options
|
||||
positive integer. If this config option is not set then only one download
|
||||
stream is used (i.e. downloads happen sequentially).
|
||||
|
||||
*DownloadUser =* username::
|
||||
Specifies the user to switch to for downloading files. If this config
|
||||
option is not set then the downloads are done as the user running pacman.
|
||||
|
||||
|
||||
Repository Sections
|
||||
-------------------
|
||||
@@ -244,12 +240,6 @@ number.
|
||||
general configuration options. Wildcards in the specified paths will get
|
||||
expanded based on linkman:glob[7] rules.
|
||||
|
||||
*CacheServer =* url::
|
||||
A full URL to a location where the packages, and signatures (if
|
||||
available) for this repository can be found. Cache servers will be tried
|
||||
before any non-cache servers, will not be removed from the server pool for
|
||||
404 download errors, and will not be used for database files.
|
||||
|
||||
*Server =* url::
|
||||
A full URL to a location where the database, packages, and signatures (if
|
||||
available) for this repository can be found.
|
||||
|
||||
@@ -1,20 +0,0 @@
|
||||
testpkg(8)
|
||||
==========
|
||||
|
||||
Name
|
||||
----
|
||||
testpkg - test a pacman package for validity
|
||||
|
||||
Synopsis
|
||||
--------
|
||||
'testpkg' <package file>
|
||||
|
||||
Description
|
||||
-----------
|
||||
'testpkg' is a script used to make sure that a pacman package is valid.
|
||||
|
||||
See Also
|
||||
--------
|
||||
linkman:pacman[8]
|
||||
|
||||
include::footer.asciidoc[]
|
||||
@@ -55,7 +55,7 @@ Pre-release Updates
|
||||
~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
A week or two before each release, the codebase will go into a string freeze
|
||||
and an email will be sent to the mailto:pacman-dev@lists.archlinux.org[pacman-dev]
|
||||
and an email will be sent to the mailto:pacman-dev@archlinux.org[pacman-dev]
|
||||
mailing list asking for translations. This email will have a prefix of
|
||||
*[translation]* for anyone looking to set up an email filter.
|
||||
|
||||
@@ -150,4 +150,4 @@ There are currently no efforts underway to include translated manual pages in
|
||||
the pacman codebase. However, this is not to say translations are unwelcome. If
|
||||
someone has experience with i18n man pages and how to best include them with our
|
||||
source, please contact the pacman-dev mailing list at
|
||||
mailto:pacman-dev@lists.archlinux.org[].
|
||||
mailto:pacman-dev@archlinux.org[].
|
||||
|
||||
@@ -1,11 +0,0 @@
|
||||
#!/hint/bash
|
||||
#
|
||||
# @sysconfdir@/makepkg.conf.d/rust.conf
|
||||
#
|
||||
|
||||
#########################################################################
|
||||
# RUST LANGUAGE SUPPORT
|
||||
#########################################################################
|
||||
#
|
||||
#RUSTFLAGS="-C opt-level=2"
|
||||
#DEBUG_RUSTFLAGS="-C debuginfo=2"
|
||||
@@ -9,10 +9,10 @@
|
||||
#
|
||||
#-- The download utilities that makepkg should use to acquire sources
|
||||
# Format: 'protocol::agent'
|
||||
DLAGENTS=('file::/usr/bin/curl -qgC - -o %o %u'
|
||||
'ftp::/usr/bin/curl -qgfC - --ftp-pasv --retry 3 --retry-delay 3 -o %o %u'
|
||||
'http::/usr/bin/curl -qgb "" -fLC - --retry 3 --retry-delay 3 -o %o %u'
|
||||
'https::/usr/bin/curl -qgb "" -fLC - --retry 3 --retry-delay 3 -o %o %u'
|
||||
DLAGENTS=('file::/usr/bin/curl -gqC - -o %o %u'
|
||||
'ftp::/usr/bin/curl -gqfC - --ftp-pasv --retry 3 --retry-delay 3 -o %o %u'
|
||||
'http::/usr/bin/curl -gqb "" -fLC - --retry 3 --retry-delay 3 -o %o %u'
|
||||
'https::/usr/bin/curl -gqb "" -fLC - --retry 3 --retry-delay 3 -o %o %u'
|
||||
'rsync::/usr/bin/rsync --no-motd -z %u %o'
|
||||
'scp::/usr/bin/scp -C %u %o')
|
||||
|
||||
@@ -23,7 +23,7 @@ DLAGENTS=('file::/usr/bin/curl -qgC - -o %o %u'
|
||||
|
||||
#-- The package required by makepkg to download VCS sources
|
||||
# Format: 'protocol::package'
|
||||
VCSCLIENTS=('bzr::breezy'
|
||||
VCSCLIENTS=('bzr::bzr'
|
||||
'fossil::fossil'
|
||||
'git::git'
|
||||
'hg::mercurial'
|
||||
@@ -41,12 +41,13 @@ CHOST="@CHOST@"
|
||||
#CFLAGS="-O2 -pipe"
|
||||
#CXXFLAGS="-O2 -pipe"
|
||||
#LDFLAGS=""
|
||||
#LTOFLAGS="-flto"
|
||||
#RUSTFLAGS="-C opt-level=2"
|
||||
#-- Make Flags: change this for DistCC/SMP systems
|
||||
#MAKEFLAGS="-j2"
|
||||
#-- Debugging flags
|
||||
#DEBUG_CFLAGS="-g"
|
||||
#DEBUG_CXXFLAGS="-g"
|
||||
#DEBUG_RUSTFLAGS="-C debuginfo=2"
|
||||
|
||||
#########################################################################
|
||||
# BUILD ENVIRONMENT
|
||||
@@ -75,8 +76,7 @@ BUILDENV=(!distcc color !ccache check !sign)
|
||||
# These are default values for the options=() settings
|
||||
#########################################################################
|
||||
#
|
||||
# Makepkg defaults:
|
||||
# OPTIONS=(!strip docs libtool staticlibs emptydirs !zipman !purge !debug !lto !autodeps)
|
||||
# Makepkg defaults: OPTIONS=(!strip docs libtool staticlibs emptydirs !zipman !purge !debug !lto)
|
||||
# A negated option will do the opposite of the comments below.
|
||||
#
|
||||
#-- strip: Strip symbols from binaries/libraries
|
||||
@@ -88,9 +88,8 @@ BUILDENV=(!distcc color !ccache check !sign)
|
||||
#-- purge: Remove files specified by PURGE_TARGETS
|
||||
#-- debug: Add debugging flags as specified in DEBUG_* variables
|
||||
#-- lto: Add compile flags for building with link time optimization
|
||||
#-- autodeps: Automatically add depends/provides
|
||||
#
|
||||
OPTIONS=(strip docs libtool staticlibs emptydirs zipman purge !debug !lto !autodeps)
|
||||
OPTIONS=(strip docs libtool staticlibs emptydirs zipman purge !debug !lto)
|
||||
|
||||
#-- File integrity checks to use. Valid: ck, md5, sha1, sha224, sha256, sha384, sha512, b2
|
||||
INTEGRITY_CHECK=(ck)
|
||||
@@ -108,8 +107,6 @@ DOC_DIRS=(usr/{,local/}{,share/}{doc,gtk-doc} opt/*/{doc,gtk-doc})
|
||||
PURGE_TARGETS=(usr/{,share}/info/dir .packlist *.pod)
|
||||
#-- Directory to store source code in for debug packages
|
||||
DBGSRCDIR="/usr/src/debug"
|
||||
#-- Prefix and directories for library autodeps
|
||||
LIB_DIRS=('lib:usr/lib' 'lib32:usr/lib32')
|
||||
|
||||
#########################################################################
|
||||
# PACKAGE OUTPUT
|
||||
|
||||
@@ -74,4 +74,4 @@ ParallelDownloads = 5
|
||||
# tips on creating your own repositories.
|
||||
#[custom]
|
||||
#SigLevel = Optional TrustAll
|
||||
#Server = file:///home/packages
|
||||
#Server = file:///home/custompkgs
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* add.c
|
||||
*
|
||||
* Copyright (c) 2006-2022 Pacman Development Team <pacman-dev@lists.archlinux.org>
|
||||
* Copyright (c) 2006-2021 Pacman Development Team <pacman-dev@archlinux.org>
|
||||
* Copyright (c) 2002-2006 by Judd Vinet <jvinet@zeroflux.org>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
@@ -262,7 +262,7 @@ static int extract_single_file(alpm_handle_t *handle, struct archive *archive,
|
||||
"filesystem: %o package: %o\n"), filename, lsbuf.st_mode & mask,
|
||||
entrymode & mask);
|
||||
alpm_logaction(handle, ALPM_CALLER_PREFIX,
|
||||
"warning: directory permissions differ on %s, "
|
||||
"warning: directory permissions differ on %s\n"
|
||||
"filesystem: %o package: %o\n", filename, lsbuf.st_mode & mask,
|
||||
entrymode & mask);
|
||||
}
|
||||
@@ -277,7 +277,7 @@ static int extract_single_file(alpm_handle_t *handle, struct archive *archive,
|
||||
"filesystem: %u:%u package: %u:%u\n"), filename,
|
||||
lsbuf.st_uid, lsbuf.st_gid, entryuid, entrygid);
|
||||
alpm_logaction(handle, ALPM_CALLER_PREFIX,
|
||||
"warning: directory ownership differs on %s, "
|
||||
"warning: directory ownership differs on %s\n"
|
||||
"filesystem: %u:%u package: %u:%u\n", filename,
|
||||
lsbuf.st_uid, lsbuf.st_gid, entryuid, entrygid);
|
||||
}
|
||||
@@ -415,7 +415,7 @@ static int extract_single_file(alpm_handle_t *handle, struct archive *archive,
|
||||
static int commit_single_pkg(alpm_handle_t *handle, alpm_pkg_t *newpkg,
|
||||
size_t pkg_current, size_t pkg_count)
|
||||
{
|
||||
int ret = 0, errors = 0;
|
||||
int i, ret = 0, errors = 0;
|
||||
int is_upgrade = 0;
|
||||
alpm_pkg_t *oldpkg = NULL;
|
||||
alpm_db_t *db = handle->db_local;
|
||||
@@ -538,7 +538,7 @@ static int commit_single_pkg(alpm_handle_t *handle, alpm_pkg_t *newpkg,
|
||||
/* call PROGRESS once with 0 percent, as we sort-of skip that here */
|
||||
PROGRESS(handle, progress, newpkg->name, 0, pkg_count, pkg_current);
|
||||
|
||||
while(archive_read_next_header(archive, &entry) == ARCHIVE_OK) {
|
||||
for(i = 0; archive_read_next_header(archive, &entry) == ARCHIVE_OK; i++) {
|
||||
int percent;
|
||||
|
||||
if(newpkg->size != 0) {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* add.h
|
||||
*
|
||||
* Copyright (c) 2006-2022 Pacman Development Team <pacman-dev@lists.archlinux.org>
|
||||
* Copyright (c) 2006-2021 Pacman Development Team <pacman-dev@archlinux.org>
|
||||
* Copyright (c) 2002-2006 by Judd Vinet <jvinet@zeroflux.org>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* alpm.c
|
||||
*
|
||||
* Copyright (c) 2006-2022 Pacman Development Team <pacman-dev@lists.archlinux.org>
|
||||
* Copyright (c) 2006-2021 Pacman Development Team <pacman-dev@archlinux.org>
|
||||
* Copyright (c) 2002-2006 by Judd Vinet <jvinet@zeroflux.org>
|
||||
* Copyright (c) 2005 by Aurelien Foret <orelien@chez.com>
|
||||
* Copyright (c) 2005 by Christian Hamar <krics@linuxforum.hu>
|
||||
@@ -93,16 +93,34 @@ cleanup:
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* check current state and free all resources including storage locks */
|
||||
int SYMEXPORT alpm_release(alpm_handle_t *myhandle)
|
||||
{
|
||||
int ret = 0;
|
||||
alpm_db_t *db;
|
||||
|
||||
CHECK_HANDLE(myhandle, return -1);
|
||||
ASSERT(myhandle->trans == NULL, RET_ERR(myhandle, ALPM_ERR_TRANS_NOT_NULL, -1));
|
||||
|
||||
/* close local database */
|
||||
db = myhandle->db_local;
|
||||
if(db) {
|
||||
db->ops->unregister(db);
|
||||
myhandle->db_local = NULL;
|
||||
}
|
||||
|
||||
if(alpm_unregister_all_syncdbs(myhandle) == -1) {
|
||||
ret = -1;
|
||||
}
|
||||
|
||||
#ifdef HAVE_LIBCURL
|
||||
curl_multi_cleanup(myhandle->curlm);
|
||||
curl_global_cleanup();
|
||||
FREELIST(myhandle->server_errors);
|
||||
#endif
|
||||
|
||||
_alpm_handle_unlock(myhandle);
|
||||
_alpm_handle_free(myhandle);
|
||||
|
||||
return 0;
|
||||
return ret;
|
||||
}
|
||||
|
||||
const char SYMEXPORT *alpm_version(void)
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* alpm.h
|
||||
*
|
||||
* Copyright (c) 2006-2022 Pacman Development Team <pacman-dev@lists.archlinux.org>
|
||||
* Copyright (c) 2006-2021 Pacman Development Team <pacman-dev@archlinux.org>
|
||||
* Copyright (c) 2002-2006 by Judd Vinet <jvinet@zeroflux.org>
|
||||
* Copyright (c) 2005 by Aurelien Foret <orelien@chez.com>
|
||||
* Copyright (c) 2005 by Christian Hamar <krics@linuxforum.hu>
|
||||
@@ -107,20 +107,12 @@ typedef struct _alpm_db_t alpm_db_t;
|
||||
* Packages from databases are automatically freed when the database is unregistered. Packages loaded
|
||||
* from a file must be freed manually.
|
||||
*
|
||||
* Packages can then be queried for metadata or added to a transaction
|
||||
* Packages can then be queried for metadata or added to a \link alpm_trans_t transaction \endlink
|
||||
* to be added or removed from the system.
|
||||
* @ingroup libalpm_packages
|
||||
*/
|
||||
typedef struct _alpm_pkg_t alpm_pkg_t;
|
||||
|
||||
/** The extended data type used to store non-standard package data fields
|
||||
* @ingroup libalpm_packages
|
||||
*/
|
||||
typedef struct _alpm_pkg_xdata_t {
|
||||
char *name;
|
||||
char *value;
|
||||
} alpm_pkg_xdata_t;
|
||||
|
||||
/** The time type used by libalpm. Represents a unix time stamp
|
||||
* @ingroup libalpm_misc */
|
||||
typedef int64_t alpm_time_t;
|
||||
@@ -164,7 +156,7 @@ typedef struct _alpm_backup_t {
|
||||
* @param path the path to search for in the package
|
||||
* @return a pointer to the matching file or NULL if not found
|
||||
*/
|
||||
alpm_file_t *alpm_filelist_contains(const alpm_filelist_t *filelist, const char *path);
|
||||
alpm_file_t *alpm_filelist_contains(alpm_filelist_t *filelist, const char *path);
|
||||
|
||||
/* End of libalpm_files */
|
||||
/** @} */
|
||||
@@ -488,7 +480,7 @@ typedef struct _alpm_siglist_t {
|
||||
* Check the PGP signature for the given package file.
|
||||
* @param pkg the package to check
|
||||
* @param siglist a pointer to storage for signature results
|
||||
* @return 0 if valid, -1 if an error occurred or signature is invalid
|
||||
* @return a int value : 0 (valid), 1 (invalid), -1 (an error occurred)
|
||||
*/
|
||||
int alpm_pkg_check_pgp_signature(alpm_pkg_t *pkg, alpm_siglist_t *siglist);
|
||||
|
||||
@@ -496,7 +488,7 @@ int alpm_pkg_check_pgp_signature(alpm_pkg_t *pkg, alpm_siglist_t *siglist);
|
||||
* Check the PGP signature for the given database.
|
||||
* @param db the database to check
|
||||
* @param siglist a pointer to storage for signature results
|
||||
* @return 0 if valid, -1 if an error occurred or signature is invalid
|
||||
* @return a int value : 0 (valid), 1 (invalid), -1 (an error occurred)
|
||||
*/
|
||||
int alpm_db_check_pgp_signature(alpm_db_t *db, alpm_siglist_t *siglist);
|
||||
|
||||
@@ -600,10 +592,16 @@ typedef struct _alpm_depmissing_t {
|
||||
|
||||
/** A conflict that has occurred between two packages. */
|
||||
typedef struct _alpm_conflict_t {
|
||||
/** The first package */
|
||||
alpm_pkg_t *package1;
|
||||
/** The second package */
|
||||
alpm_pkg_t *package2;
|
||||
/** Hash of the first package name
|
||||
* (used internally to speed up conflict checks) */
|
||||
unsigned long package1_hash;
|
||||
/** Hash of the second package name
|
||||
* (used internally to speed up conflict checks) */
|
||||
unsigned long package2_hash;
|
||||
/** Name of the first package */
|
||||
char *package1;
|
||||
/** Name of the second package */
|
||||
char *package2;
|
||||
/** The conflict */
|
||||
alpm_depend_t *reason;
|
||||
} alpm_conflict_t;
|
||||
@@ -969,7 +967,7 @@ typedef union _alpm_event_t {
|
||||
* Called when an event occurs
|
||||
* @param ctx user-provided context
|
||||
* @param event the event that occurred */
|
||||
typedef void (*alpm_cb_event)(void *ctx, alpm_event_t *event);
|
||||
typedef void (*alpm_cb_event)(void *ctx, alpm_event_t *);
|
||||
|
||||
/**
|
||||
* Type of question.
|
||||
@@ -1116,7 +1114,7 @@ typedef union _alpm_question_t {
|
||||
* @param ctx user-provided context
|
||||
* @param question the question being asked.
|
||||
*/
|
||||
typedef void (*alpm_cb_question)(void *ctx, alpm_question_t *question);
|
||||
typedef void (*alpm_cb_question)(void *ctx, alpm_question_t *);
|
||||
|
||||
/** An enum over different kinds of progress alerts. */
|
||||
typedef enum _alpm_progress_t {
|
||||
@@ -1283,12 +1281,6 @@ int alpm_unregister_all_syncdbs(alpm_handle_t *handle);
|
||||
*/
|
||||
int alpm_db_unregister(alpm_db_t *db);
|
||||
|
||||
/** Get the handle of a package database.
|
||||
* @param db pointer to the package database
|
||||
* @return the alpm handle that the package database belongs to
|
||||
*/
|
||||
alpm_handle_t *alpm_db_get_handle(alpm_db_t *db);
|
||||
|
||||
/** Get the name of a package database.
|
||||
* @param db pointer to the package database
|
||||
* @return the name of the package database, NULL on error
|
||||
@@ -1343,34 +1335,6 @@ int alpm_db_add_server(alpm_db_t *db, const char *url);
|
||||
*/
|
||||
int alpm_db_remove_server(alpm_db_t *db, const char *url);
|
||||
|
||||
/** Get the list of cache servers assigned to this db.
|
||||
* @param db pointer to the database to get the servers from
|
||||
* @return a char* list of servers
|
||||
*/
|
||||
alpm_list_t *alpm_db_get_cache_servers(const alpm_db_t *db);
|
||||
|
||||
/** Sets the list of cache servers for the database to use.
|
||||
* @param db the database to set the servers. The list will be duped and
|
||||
* the original will still need to be freed by the caller.
|
||||
* @param servers a char* list of servers.
|
||||
*/
|
||||
int alpm_db_set_cache_servers(alpm_db_t *db, alpm_list_t *servers);
|
||||
|
||||
/** Add a download cache server to a database.
|
||||
* @param db database pointer
|
||||
* @param url url of the server
|
||||
* @return 0 on success, -1 on error (pm_errno is set accordingly)
|
||||
*/
|
||||
int alpm_db_add_cache_server(alpm_db_t *db, const char *url);
|
||||
|
||||
/** Remove a download cache server from a database.
|
||||
* @param db database pointer
|
||||
* @param url url of the server
|
||||
* @return 0 on success, 1 on server not present,
|
||||
* -1 on error (pm_errno is set accordingly)
|
||||
*/
|
||||
int alpm_db_remove_cache_server(alpm_db_t *db, const char *url);
|
||||
|
||||
/* End of server accessors */
|
||||
/** @} */
|
||||
|
||||
@@ -1866,29 +1830,7 @@ const char *alpm_option_get_gpgdir(alpm_handle_t *handle);
|
||||
* @param gpgdir the gpgdir to set
|
||||
*/
|
||||
int alpm_option_set_gpgdir(alpm_handle_t *handle, const char *gpgdir);
|
||||
/* End of gpgdir accessors */
|
||||
/** @} */
|
||||
|
||||
|
||||
/** @name Accessors for use sandboxuser
|
||||
*
|
||||
* This controls the user that libalpm will use for sensitive operations like
|
||||
* downloading files.
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** Returns the user to switch to for sensitive operations.
|
||||
* @return the user name
|
||||
*/
|
||||
const char *alpm_option_get_sandboxuser(alpm_handle_t *handle);
|
||||
|
||||
/** Sets the user to switch to for sensitive operations.
|
||||
* @param handle the context handle
|
||||
* @param sandboxuser the user to set
|
||||
*/
|
||||
int alpm_option_set_sandboxuser(alpm_handle_t *handle, const char *sandboxuser);
|
||||
|
||||
/* End of sandboxuser accessors */
|
||||
/* End of gpdir accessors */
|
||||
/** @} */
|
||||
|
||||
|
||||
@@ -2444,12 +2386,6 @@ int alpm_pkg_should_ignore(alpm_handle_t *handle, alpm_pkg_t *pkg);
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** Gets the handle of a package
|
||||
* @param pkg a pointer to package
|
||||
* @return the alpm handle that the package belongs to
|
||||
*/
|
||||
alpm_handle_t *alpm_pkg_get_handle(alpm_pkg_t *pkg);
|
||||
|
||||
/** Gets the name of the file from which the package was loaded.
|
||||
* @param pkg a pointer to package
|
||||
* @return a reference to an internal string
|
||||
@@ -2650,12 +2586,6 @@ int alpm_pkg_get_sig(alpm_pkg_t *pkg, unsigned char **sig, size_t *sig_len);
|
||||
*/
|
||||
int alpm_pkg_get_validation(alpm_pkg_t *pkg);
|
||||
|
||||
/** Gets the extended data field of a package.
|
||||
* @param pkg a pointer to package
|
||||
* @return a reference to a list of alpm_pkg_xdata_t objects
|
||||
*/
|
||||
alpm_list_t *alpm_pkg_get_xdata(alpm_pkg_t *pkg);
|
||||
|
||||
/** Returns whether the package has an install scriptlet.
|
||||
* @return 0 if FALSE, TRUE otherwise
|
||||
*/
|
||||
@@ -2951,12 +2881,6 @@ const char *alpm_version(void);
|
||||
* */
|
||||
int alpm_capabilities(void);
|
||||
|
||||
/** Drop privileges by switching to a different user.
|
||||
* @param sandboxuser the user to switch to
|
||||
* @return 0 on success, -1 on failure
|
||||
*/
|
||||
int alpm_sandbox_setup_child(const char *sandboxuser);
|
||||
|
||||
/* End of libalpm_misc */
|
||||
/** @} */
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* alpm_list.c
|
||||
*
|
||||
* Copyright (c) 2006-2022 Pacman Development Team <pacman-dev@lists.archlinux.org>
|
||||
* Copyright (c) 2006-2021 Pacman Development Team <pacman-dev@archlinux.org>
|
||||
* Copyright (c) 2002-2006 by Judd Vinet <jvinet@zeroflux.org>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
@@ -417,7 +417,6 @@ alpm_list_t SYMEXPORT *alpm_list_reverse(alpm_list_t *list)
|
||||
while(lp) {
|
||||
if(alpm_list_append(&newlist, lp->data) == NULL) {
|
||||
alpm_list_free(newlist);
|
||||
list->prev = backup;
|
||||
return NULL;
|
||||
}
|
||||
lp = lp->prev;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* alpm_list.h
|
||||
*
|
||||
* Copyright (c) 2006-2022 Pacman Development Team <pacman-dev@lists.archlinux.org>
|
||||
* Copyright (c) 2006-2021 Pacman Development Team <pacman-dev@archlinux.org>
|
||||
* Copyright (c) 2002-2006 by Judd Vinet <jvinet@zeroflux.org>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* backup.c
|
||||
*
|
||||
* Copyright (c) 2006-2022 Pacman Development Team <pacman-dev@lists.archlinux.org>
|
||||
* Copyright (c) 2006-2021 Pacman Development Team <pacman-dev@archlinux.org>
|
||||
* Copyright (c) 2005 by Judd Vinet <jvinet@zeroflux.org>
|
||||
* Copyright (c) 2005 by Aurelien Foret <orelien@chez.com>
|
||||
* Copyright (c) 2005 by Christian Hamar <krics@linuxforum.hu>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* backup.h
|
||||
*
|
||||
* Copyright (c) 2006-2022 Pacman Development Team <pacman-dev@lists.archlinux.org>
|
||||
* Copyright (c) 2006-2021 Pacman Development Team <pacman-dev@archlinux.org>
|
||||
* Copyright (c) 2002-2006 by Judd Vinet <jvinet@zeroflux.org>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* be_local.c : backend for the local database
|
||||
*
|
||||
* Copyright (c) 2006-2022 Pacman Development Team <pacman-dev@lists.archlinux.org>
|
||||
* Copyright (c) 2006-2021 Pacman Development Team <pacman-dev@archlinux.org>
|
||||
* Copyright (c) 2002-2006 by Judd Vinet <jvinet@zeroflux.org>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
@@ -195,12 +195,6 @@ static alpm_list_t *_cache_get_backup(alpm_pkg_t *pkg)
|
||||
return pkg->backup;
|
||||
}
|
||||
|
||||
static alpm_list_t *_cache_get_xdata(alpm_pkg_t *pkg)
|
||||
{
|
||||
LAZY_LOAD(INFRQ_DESC);
|
||||
return pkg->xdata;
|
||||
}
|
||||
|
||||
/**
|
||||
* Open a package changelog for reading. Similar to fopen in functionality,
|
||||
* except that the returned 'file stream' is from the database.
|
||||
@@ -250,6 +244,7 @@ static int _cache_changelog_close(const alpm_pkg_t UNUSED *pkg, void *fp)
|
||||
*/
|
||||
static struct archive *_cache_mtree_open(alpm_pkg_t *pkg)
|
||||
{
|
||||
int r;
|
||||
struct archive *mtree;
|
||||
|
||||
alpm_db_t *db = alpm_pkg_get_db(pkg);
|
||||
@@ -267,7 +262,7 @@ static struct archive *_cache_mtree_open(alpm_pkg_t *pkg)
|
||||
_alpm_archive_read_support_filter_all(mtree);
|
||||
archive_read_support_format_mtree(mtree);
|
||||
|
||||
if(_alpm_archive_read_open_file(mtree, mtfile, ALPM_BUFFER_SIZE)) {
|
||||
if((r = _alpm_archive_read_open_file(mtree, mtfile, ALPM_BUFFER_SIZE))) {
|
||||
_alpm_log(pkg->handle, ALPM_LOG_ERROR, _("error while reading file %s: %s\n"),
|
||||
mtfile, archive_error_string(mtree));
|
||||
_alpm_archive_read_free(mtree);
|
||||
@@ -354,7 +349,6 @@ static const struct pkg_operations local_pkg_ops = {
|
||||
.get_replaces = _cache_get_replaces,
|
||||
.get_files = _cache_get_files,
|
||||
.get_backup = _cache_get_backup,
|
||||
.get_xdata = _cache_get_xdata,
|
||||
|
||||
.changelog_open = _cache_changelog_open,
|
||||
.changelog_read = _cache_changelog_read,
|
||||
@@ -810,18 +804,6 @@ static int local_db_read(alpm_pkg_t *info, int inforeq)
|
||||
READ_AND_SPLITDEP(info->conflicts);
|
||||
} else if(strcmp(line, "%PROVIDES%") == 0) {
|
||||
READ_AND_SPLITDEP(info->provides);
|
||||
} else if(strcmp(line, "%XDATA%") == 0) {
|
||||
alpm_list_t *i, *lines = NULL;
|
||||
READ_AND_STORE_ALL(lines);
|
||||
for(i = lines; i; i = i->next) {
|
||||
alpm_pkg_xdata_t *pd = _alpm_pkg_parse_xdata(i->data);
|
||||
if(pd == NULL || !alpm_list_append(&info->xdata, pd)) {
|
||||
_alpm_pkg_xdata_free(pd);
|
||||
FREELIST(lines);
|
||||
goto error;
|
||||
}
|
||||
}
|
||||
FREELIST(lines);
|
||||
}
|
||||
}
|
||||
fclose(fp);
|
||||
@@ -1058,15 +1040,6 @@ int _alpm_local_db_write(alpm_db_t *db, alpm_pkg_t *info, int inforeq)
|
||||
write_deps(fp, "%CONFLICTS%", info->conflicts);
|
||||
write_deps(fp, "%PROVIDES%", info->provides);
|
||||
|
||||
if(info->xdata) {
|
||||
fputs("%XDATA%\n", fp);
|
||||
for(lp = info->xdata; lp; lp = lp->next) {
|
||||
alpm_pkg_xdata_t *pd = lp->data;
|
||||
fprintf(fp, "%s=%s\n", pd->name, pd->value);
|
||||
}
|
||||
fputc('\n', fp);
|
||||
}
|
||||
|
||||
fclose(fp);
|
||||
fp = NULL;
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* be_package.c : backend for packages
|
||||
*
|
||||
* Copyright (c) 2006-2022 Pacman Development Team <pacman-dev@lists.archlinux.org>
|
||||
* Copyright (c) 2006-2021 Pacman Development Team <pacman-dev@archlinux.org>
|
||||
* Copyright (c) 2002-2006 by Judd Vinet <jvinet@zeroflux.org>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
@@ -244,12 +244,10 @@ static int parse_descfile(alpm_handle_t *handle, struct archive *a, alpm_pkg_t *
|
||||
CALLOC(backup, 1, sizeof(alpm_backup_t), return -1);
|
||||
STRDUP(backup->name, ptr, FREE(backup); return -1);
|
||||
newpkg->backup = alpm_list_add(newpkg->backup, backup);
|
||||
} else if(strcmp(key, "xdata") == 0) {
|
||||
alpm_pkg_xdata_t *pd = _alpm_pkg_parse_xdata(ptr);
|
||||
if(pd == NULL || !alpm_list_append(&newpkg->xdata, pd)) {
|
||||
_alpm_pkg_xdata_free(pd);
|
||||
return -1;
|
||||
}
|
||||
} else if(strcmp(key, "force") == 0) {
|
||||
/* deprecated, skip it */
|
||||
} else if(strcmp(key, "makepkgopt") == 0) {
|
||||
/* not used atm */
|
||||
} else {
|
||||
_alpm_log(handle, ALPM_LOG_DEBUG, "%s: unknown key '%s' in description file line %d\n",
|
||||
newpkg->name ? newpkg->name : "error", key, linenum);
|
||||
@@ -653,6 +651,7 @@ alpm_pkg_t *_alpm_pkg_load_internal(alpm_handle_t *handle,
|
||||
}
|
||||
|
||||
_alpm_archive_read_free(archive);
|
||||
close(fd);
|
||||
|
||||
/* internal fields for package struct */
|
||||
newpkg->origin = ALPM_PKG_FROM_FILE;
|
||||
@@ -675,7 +674,6 @@ alpm_pkg_t *_alpm_pkg_load_internal(alpm_handle_t *handle,
|
||||
newpkg->infolevel |= INFRQ_FILES;
|
||||
}
|
||||
|
||||
close(fd);
|
||||
return newpkg;
|
||||
|
||||
pkg_invalid:
|
||||
@@ -683,7 +681,9 @@ pkg_invalid:
|
||||
error:
|
||||
_alpm_pkg_free(newpkg);
|
||||
_alpm_archive_read_free(archive);
|
||||
close(fd);
|
||||
if(fd >= 0) {
|
||||
close(fd);
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
@@ -723,6 +723,7 @@ int SYMEXPORT alpm_pkg_load(alpm_handle_t *handle, const char *filename, int ful
|
||||
int validation = 0;
|
||||
char *sigpath;
|
||||
alpm_pkg_t *pkg_temp;
|
||||
char *packager;
|
||||
|
||||
CHECK_HANDLE(handle, return -1);
|
||||
ASSERT(pkg != NULL, RET_ERR(handle, ALPM_ERR_WRONG_ARGS, -1));
|
||||
@@ -748,7 +749,13 @@ int SYMEXPORT alpm_pkg_load(alpm_handle_t *handle, const char *filename, int ful
|
||||
char *key = k->data;
|
||||
if(_alpm_key_in_keychain(handle, key) == 0) {
|
||||
pkg_temp = _alpm_pkg_load_internal(handle, filename, full);
|
||||
if(_alpm_key_import(handle, NULL, key) == -1) {
|
||||
if(pkg_temp) {
|
||||
packager = pkg_temp->packager;
|
||||
|
||||
} else {
|
||||
packager = NULL;
|
||||
}
|
||||
if(_alpm_key_import(handle, packager, key) == -1) {
|
||||
fail = 1;
|
||||
}
|
||||
_alpm_pkg_free(pkg_temp);
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* be_sync.c : backend for sync databases
|
||||
*
|
||||
* Copyright (c) 2006-2022 Pacman Development Team <pacman-dev@lists.archlinux.org>
|
||||
* Copyright (c) 2006-2021 Pacman Development Team <pacman-dev@archlinux.org>
|
||||
* Copyright (c) 2002-2006 by Judd Vinet <jvinet@zeroflux.org>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
@@ -189,18 +189,6 @@ int SYMEXPORT alpm_db_update(alpm_handle_t *handle, alpm_list_t *dbs, int force)
|
||||
MALLOC(payload->filepath, len,
|
||||
FREE(payload); GOTO_ERR(handle, ALPM_ERR_MEMORY, cleanup));
|
||||
snprintf(payload->filepath, len, "%s%s", db->treename, dbext);
|
||||
|
||||
STRDUP(payload->remote_name, payload->filepath,
|
||||
_alpm_dload_payload_reset(payload); FREE(payload);
|
||||
GOTO_ERR(handle, ALPM_ERR_MEMORY, cleanup));
|
||||
payload->destfile_name = _alpm_get_fullpath(syncpath, payload->remote_name, "");
|
||||
payload->tempfile_name = _alpm_get_fullpath(syncpath, payload->remote_name, ".part");
|
||||
if(!payload->destfile_name || !payload->tempfile_name) {
|
||||
_alpm_dload_payload_reset(payload);
|
||||
FREE(payload);
|
||||
GOTO_ERR(handle, ALPM_ERR_MEMORY, cleanup);
|
||||
}
|
||||
|
||||
payload->handle = handle;
|
||||
payload->force = dbforce;
|
||||
payload->unlink_on_fail = 1;
|
||||
@@ -678,18 +666,6 @@ static int sync_db_read(alpm_db_t *db, struct archive *archive,
|
||||
pkg->files.count = files_count;
|
||||
pkg->files.files = files;
|
||||
_alpm_filelist_sort(&pkg->files);
|
||||
} else if(strcmp(line, "%DATA%") == 0) {
|
||||
alpm_list_t *i, *lines = NULL;
|
||||
READ_AND_STORE_ALL(lines);
|
||||
for(i = lines; i; i = i->next) {
|
||||
alpm_pkg_xdata_t *pd = _alpm_pkg_parse_xdata(i->data);
|
||||
if(pd == NULL || !alpm_list_append(&pkg->xdata, pd)) {
|
||||
_alpm_pkg_xdata_free(pd);
|
||||
FREELIST(lines);
|
||||
goto error;
|
||||
}
|
||||
}
|
||||
FREELIST(lines);
|
||||
}
|
||||
}
|
||||
if(ret != ARCHIVE_EOF) {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* conflict.c
|
||||
*
|
||||
* Copyright (c) 2006-2022 Pacman Development Team <pacman-dev@lists.archlinux.org>
|
||||
* Copyright (c) 2006-2021 Pacman Development Team <pacman-dev@archlinux.org>
|
||||
* Copyright (c) 2002-2006 by Judd Vinet <jvinet@zeroflux.org>
|
||||
* Copyright (c) 2005 by Aurelien Foret <orelien@chez.com>
|
||||
* Copyright (c) 2006 by David Kimpe <dnaku@frugalware.org>
|
||||
@@ -50,8 +50,10 @@ static alpm_conflict_t *conflict_new(alpm_pkg_t *pkg1, alpm_pkg_t *pkg2,
|
||||
|
||||
CALLOC(conflict, 1, sizeof(alpm_conflict_t), return NULL);
|
||||
|
||||
ASSERT(_alpm_pkg_dup(pkg1, &conflict->package1) == 0, goto error);
|
||||
ASSERT(_alpm_pkg_dup(pkg2, &conflict->package2) == 0, goto error);
|
||||
conflict->package1_hash = pkg1->name_hash;
|
||||
conflict->package2_hash = pkg2->name_hash;
|
||||
STRDUP(conflict->package1, pkg1->name, goto error);
|
||||
STRDUP(conflict->package2, pkg2->name, goto error);
|
||||
conflict->reason = reason;
|
||||
|
||||
return conflict;
|
||||
@@ -64,9 +66,8 @@ error:
|
||||
void SYMEXPORT alpm_conflict_free(alpm_conflict_t *conflict)
|
||||
{
|
||||
ASSERT(conflict != NULL, return);
|
||||
_alpm_pkg_free(conflict->package1);
|
||||
_alpm_pkg_free(conflict->package2);
|
||||
|
||||
FREE(conflict->package2);
|
||||
FREE(conflict->package1);
|
||||
FREE(conflict);
|
||||
}
|
||||
|
||||
@@ -78,8 +79,10 @@ alpm_conflict_t *_alpm_conflict_dup(const alpm_conflict_t *conflict)
|
||||
alpm_conflict_t *newconflict;
|
||||
CALLOC(newconflict, 1, sizeof(alpm_conflict_t), return NULL);
|
||||
|
||||
ASSERT(_alpm_pkg_dup(conflict->package1, &newconflict->package1) == 0, goto error);
|
||||
ASSERT(_alpm_pkg_dup(conflict->package2, &newconflict->package2) == 0, goto error);
|
||||
newconflict->package1_hash = conflict->package1_hash;
|
||||
newconflict->package2_hash = conflict->package2_hash;
|
||||
STRDUP(newconflict->package1, conflict->package1, goto error);
|
||||
STRDUP(newconflict->package2, conflict->package2, goto error);
|
||||
newconflict->reason = conflict->reason;
|
||||
|
||||
return newconflict;
|
||||
@@ -102,10 +105,10 @@ static int conflict_isin(alpm_conflict_t *needle, alpm_list_t *haystack)
|
||||
alpm_list_t *i;
|
||||
for(i = haystack; i; i = i->next) {
|
||||
alpm_conflict_t *conflict = i->data;
|
||||
if(needle->package1->name_hash == conflict->package1->name_hash
|
||||
&& needle->package2->name_hash == conflict->package2->name_hash
|
||||
&& strcmp(needle->package1->name, conflict->package1->name) == 0
|
||||
&& strcmp(needle->package2->name, conflict->package2->name) == 0) {
|
||||
if(needle->package1_hash == conflict->package1_hash
|
||||
&& needle->package2_hash == conflict->package2_hash
|
||||
&& strcmp(needle->package1, conflict->package1) == 0
|
||||
&& strcmp(needle->package2, conflict->package2) == 0) {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* conflict.h
|
||||
*
|
||||
* Copyright (c) 2006-2022 Pacman Development Team <pacman-dev@lists.archlinux.org>
|
||||
* Copyright (c) 2006-2021 Pacman Development Team <pacman-dev@archlinux.org>
|
||||
* Copyright (c) 2002-2006 by Judd Vinet <jvinet@zeroflux.org>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* db.c
|
||||
*
|
||||
* Copyright (c) 2006-2022 Pacman Development Team <pacman-dev@lists.archlinux.org>
|
||||
* Copyright (c) 2006-2021 Pacman Development Team <pacman-dev@archlinux.org>
|
||||
* Copyright (c) 2002-2006 by Judd Vinet <jvinet@zeroflux.org>
|
||||
* Copyright (c) 2005 by Aurelien Foret <orelien@chez.com>
|
||||
* Copyright (c) 2005 by Christian Hamar <krics@linuxforum.hu>
|
||||
@@ -131,26 +131,6 @@ int SYMEXPORT alpm_db_unregister(alpm_db_t *db)
|
||||
return 0;
|
||||
}
|
||||
|
||||
alpm_list_t SYMEXPORT *alpm_db_get_cache_servers(const alpm_db_t *db)
|
||||
{
|
||||
ASSERT(db != NULL, return NULL);
|
||||
return db->cache_servers;
|
||||
}
|
||||
|
||||
int SYMEXPORT alpm_db_set_cache_servers(alpm_db_t *db, alpm_list_t *cache_servers)
|
||||
{
|
||||
alpm_list_t *i;
|
||||
ASSERT(db != NULL, return -1);
|
||||
FREELIST(db->cache_servers);
|
||||
for(i = cache_servers; i; i = i->next) {
|
||||
char *url = i->data;
|
||||
if(alpm_db_add_cache_server(db, url) != 0) {
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
alpm_list_t SYMEXPORT *alpm_db_get_servers(const alpm_db_t *db)
|
||||
{
|
||||
ASSERT(db != NULL, return NULL);
|
||||
@@ -184,25 +164,6 @@ static char *sanitize_url(const char *url)
|
||||
return newurl;
|
||||
}
|
||||
|
||||
int SYMEXPORT alpm_db_add_cache_server(alpm_db_t *db, const char *url)
|
||||
{
|
||||
char *newurl;
|
||||
|
||||
/* Sanity checks */
|
||||
ASSERT(db != NULL, return -1);
|
||||
db->handle->pm_errno = ALPM_ERR_OK;
|
||||
ASSERT(url != NULL && strlen(url) != 0, RET_ERR(db->handle, ALPM_ERR_WRONG_ARGS, -1));
|
||||
|
||||
newurl = sanitize_url(url);
|
||||
ASSERT(newurl != NULL, RET_ERR(db->handle, ALPM_ERR_MEMORY, -1));
|
||||
|
||||
db->cache_servers = alpm_list_add(db->cache_servers, newurl);
|
||||
_alpm_log(db->handle, ALPM_LOG_DEBUG, "adding new cache server URL to database '%s': %s\n",
|
||||
db->treename, newurl);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int SYMEXPORT alpm_db_add_server(alpm_db_t *db, const char *url)
|
||||
{
|
||||
char *newurl;
|
||||
@@ -213,8 +174,9 @@ int SYMEXPORT alpm_db_add_server(alpm_db_t *db, const char *url)
|
||||
ASSERT(url != NULL && strlen(url) != 0, RET_ERR(db->handle, ALPM_ERR_WRONG_ARGS, -1));
|
||||
|
||||
newurl = sanitize_url(url);
|
||||
ASSERT(newurl != NULL, RET_ERR(db->handle, ALPM_ERR_MEMORY, -1));
|
||||
|
||||
if(!newurl) {
|
||||
return -1;
|
||||
}
|
||||
db->servers = alpm_list_add(db->servers, newurl);
|
||||
_alpm_log(db->handle, ALPM_LOG_DEBUG, "adding new server URL to database '%s': %s\n",
|
||||
db->treename, newurl);
|
||||
@@ -222,32 +184,6 @@ int SYMEXPORT alpm_db_add_server(alpm_db_t *db, const char *url)
|
||||
return 0;
|
||||
}
|
||||
|
||||
int SYMEXPORT alpm_db_remove_cache_server(alpm_db_t *db, const char *url)
|
||||
{
|
||||
char *newurl, *vdata = NULL;
|
||||
int ret = 1;
|
||||
|
||||
/* Sanity checks */
|
||||
ASSERT(db != NULL, return -1);
|
||||
db->handle->pm_errno = ALPM_ERR_OK;
|
||||
ASSERT(url != NULL && strlen(url) != 0, RET_ERR(db->handle, ALPM_ERR_WRONG_ARGS, -1));
|
||||
|
||||
newurl = sanitize_url(url);
|
||||
ASSERT(newurl != NULL, RET_ERR(db->handle, ALPM_ERR_MEMORY, -1));
|
||||
|
||||
db->cache_servers = alpm_list_remove_str(db->cache_servers, newurl, &vdata);
|
||||
|
||||
if(vdata) {
|
||||
_alpm_log(db->handle, ALPM_LOG_DEBUG, "removed cache server URL from database '%s': %s\n",
|
||||
db->treename, newurl);
|
||||
free(vdata);
|
||||
ret = 0;
|
||||
}
|
||||
|
||||
free(newurl);
|
||||
return ret;
|
||||
}
|
||||
|
||||
int SYMEXPORT alpm_db_remove_server(alpm_db_t *db, const char *url)
|
||||
{
|
||||
char *newurl, *vdata = NULL;
|
||||
@@ -259,7 +195,9 @@ int SYMEXPORT alpm_db_remove_server(alpm_db_t *db, const char *url)
|
||||
ASSERT(url != NULL && strlen(url) != 0, RET_ERR(db->handle, ALPM_ERR_WRONG_ARGS, -1));
|
||||
|
||||
newurl = sanitize_url(url);
|
||||
ASSERT(newurl != NULL, RET_ERR(db->handle, ALPM_ERR_MEMORY, -1));
|
||||
if(!newurl) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
db->servers = alpm_list_remove_str(db->servers, newurl, &vdata);
|
||||
|
||||
@@ -274,12 +212,6 @@ int SYMEXPORT alpm_db_remove_server(alpm_db_t *db, const char *url)
|
||||
return ret;
|
||||
}
|
||||
|
||||
alpm_handle_t SYMEXPORT *alpm_db_get_handle(alpm_db_t *db)
|
||||
{
|
||||
ASSERT(db != NULL, return NULL);
|
||||
return db->handle;
|
||||
}
|
||||
|
||||
const char SYMEXPORT *alpm_db_get_name(const alpm_db_t *db)
|
||||
{
|
||||
ASSERT(db != NULL, return NULL);
|
||||
@@ -390,7 +322,6 @@ void _alpm_db_free(alpm_db_t *db)
|
||||
/* cleanup pkgcache */
|
||||
_alpm_db_free_pkgcache(db);
|
||||
/* cleanup server list */
|
||||
FREELIST(db->cache_servers);
|
||||
FREELIST(db->servers);
|
||||
FREE(db->_path);
|
||||
FREE(db->treename);
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* db.h
|
||||
*
|
||||
* Copyright (c) 2006-2022 Pacman Development Team <pacman-dev@lists.archlinux.org>
|
||||
* Copyright (c) 2006-2021 Pacman Development Team <pacman-dev@archlinux.org>
|
||||
* Copyright (c) 2002-2006 by Judd Vinet <jvinet@zeroflux.org>
|
||||
* Copyright (c) 2005 by Aurelien Foret <orelien@chez.com>
|
||||
* Copyright (c) 2006 by Miklos Vajna <vmiklos@frugalware.org>
|
||||
@@ -69,7 +69,6 @@ struct _alpm_db_t {
|
||||
char *_path;
|
||||
alpm_pkghash_t *pkgcache;
|
||||
alpm_list_t *grpcache;
|
||||
alpm_list_t *cache_servers;
|
||||
alpm_list_t *servers;
|
||||
const struct db_operations *ops;
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* deps.c
|
||||
*
|
||||
* Copyright (c) 2006-2022 Pacman Development Team <pacman-dev@lists.archlinux.org>
|
||||
* Copyright (c) 2006-2021 Pacman Development Team <pacman-dev@archlinux.org>
|
||||
* Copyright (c) 2002-2006 by Judd Vinet <jvinet@zeroflux.org>
|
||||
* Copyright (c) 2005 by Aurelien Foret <orelien@chez.com>
|
||||
* Copyright (c) 2005, 2006 by Miklos Vajna <vmiklos@frugalware.org>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* deps.h
|
||||
*
|
||||
* Copyright (c) 2006-2022 Pacman Development Team <pacman-dev@lists.archlinux.org>
|
||||
* Copyright (c) 2006-2021 Pacman Development Team <pacman-dev@archlinux.org>
|
||||
* Copyright (c) 2002-2006 by Judd Vinet <jvinet@zeroflux.org>
|
||||
* Copyright (c) 2005 by Aurelien Foret <orelien@chez.com>
|
||||
* Copyright (c) 2006 by Miklos Vajna <vmiklos@frugalware.org>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* diskspace.c
|
||||
*
|
||||
* Copyright (c) 2010-2022 Pacman Development Team <pacman-dev@lists.archlinux.org>
|
||||
* Copyright (c) 2010-2021 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
|
||||
@@ -111,10 +111,6 @@ static alpm_list_t *mount_point_list(alpm_handle_t *handle)
|
||||
}
|
||||
|
||||
while((mnt = getmntent(fp))) {
|
||||
if(mnt->mnt_dir == NULL) {
|
||||
continue;
|
||||
}
|
||||
|
||||
CALLOC(mp, 1, sizeof(alpm_mountpoint_t), RET_ERR(handle, ALPM_ERR_MEMORY, NULL));
|
||||
STRDUP(mp->mount_dir, mnt->mnt_dir, free(mp); RET_ERR(handle, ALPM_ERR_MEMORY, NULL));
|
||||
mp->mount_dir_len = strlen(mp->mount_dir);
|
||||
@@ -138,10 +134,6 @@ static alpm_list_t *mount_point_list(alpm_handle_t *handle)
|
||||
}
|
||||
|
||||
while((ret = getmntent(fp, &mnt)) == 0) {
|
||||
if(mnt->mnt_mountp == NULL) {
|
||||
continue;
|
||||
}
|
||||
|
||||
CALLOC(mp, 1, sizeof(alpm_mountpoint_t), RET_ERR(handle, ALPM_ERR_MEMORY, NULL));
|
||||
STRDUP(mp->mount_dir, mnt->mnt_mountp, free(mp); RET_ERR(handle, ALPM_ERR_MEMORY, NULL));
|
||||
mp->mount_dir_len = strlen(mp->mount_dir);
|
||||
@@ -169,10 +161,6 @@ static alpm_list_t *mount_point_list(alpm_handle_t *handle)
|
||||
}
|
||||
|
||||
for(; entries-- > 0; fsp++) {
|
||||
if(fsp->f_mntonname == NULL) {
|
||||
continue;
|
||||
}
|
||||
|
||||
CALLOC(mp, 1, sizeof(alpm_mountpoint_t), RET_ERR(handle, ALPM_ERR_MEMORY, NULL));
|
||||
STRDUP(mp->mount_dir, fsp->f_mntonname, free(mp); RET_ERR(handle, ALPM_ERR_MEMORY, NULL));
|
||||
mp->mount_dir_len = strlen(mp->mount_dir);
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* diskspace.h
|
||||
*
|
||||
* Copyright (c) 2010-2022 Pacman Development Team <pacman-dev@lists.archlinux.org>
|
||||
* Copyright (c) 2010-2021 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
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* dload.c
|
||||
*
|
||||
* Copyright (c) 2006-2022 Pacman Development Team <pacman-dev@lists.archlinux.org>
|
||||
* Copyright (c) 2006-2021 Pacman Development Team <pacman-dev@archlinux.org>
|
||||
* Copyright (c) 2002-2006 by Judd Vinet <jvinet@zeroflux.org>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
@@ -28,9 +28,7 @@
|
||||
#include <sys/time.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/wait.h>
|
||||
#include <signal.h>
|
||||
#include <pwd.h>
|
||||
|
||||
#ifdef HAVE_NETINET_IN_H
|
||||
#include <netinet/in.h> /* IPPROTO_TCP */
|
||||
@@ -50,145 +48,6 @@
|
||||
#include "log.h"
|
||||
#include "util.h"
|
||||
#include "handle.h"
|
||||
#include "sandbox.h"
|
||||
|
||||
|
||||
static const char *get_filename(const char *url)
|
||||
{
|
||||
char *filename = strrchr(url, '/');
|
||||
if(filename != NULL) {
|
||||
return filename + 1;
|
||||
}
|
||||
|
||||
/* no slash found, it's a filename */
|
||||
return url;
|
||||
}
|
||||
|
||||
/* prefix to avoid possible future clash with getumask(3) */
|
||||
static mode_t _getumask(void)
|
||||
{
|
||||
mode_t mask = umask(0);
|
||||
umask(mask);
|
||||
return mask;
|
||||
}
|
||||
|
||||
static int touch_and_own_file(const char *filename, const char *user)
|
||||
{
|
||||
int fd;
|
||||
struct passwd const *pw = NULL;
|
||||
|
||||
ASSERT(filename != NULL, return -1);
|
||||
ASSERT(user != NULL, return -1);
|
||||
|
||||
ASSERT((fd = open(filename, O_CREAT | O_WRONLY, 0644)) != -1, return -1);
|
||||
close(fd);
|
||||
|
||||
ASSERT((pw = getpwnam(user)) != NULL, return -1);
|
||||
ASSERT(chown(filename, pw->pw_uid, pw->pw_gid) != -1, return -1);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int intialize_download_file(struct dload_payload *p)
|
||||
{
|
||||
int ret = 0;
|
||||
|
||||
ret = touch_and_own_file(p->tempfile_name, p->handle->sandboxuser);
|
||||
|
||||
if(ret == 0 && p->download_signature) {
|
||||
int len = strlen(p->destfile_name) + strlen(".sig") + strlen(".part") + 1;
|
||||
char * sig;
|
||||
MALLOC(sig, len, FREE(sig); RET_ERR(p->handle, ALPM_ERR_MEMORY, -1));
|
||||
snprintf(sig, len, "%s.sig.part", p->destfile_name);
|
||||
ret = touch_and_own_file(sig, p->handle->sandboxuser);
|
||||
free(sig);
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int unlink_or_move(const char *file, const char* dest) {
|
||||
struct stat st;
|
||||
|
||||
ASSERT(stat(file, &st) == 0, return -1);
|
||||
|
||||
if(st.st_size == 0) {
|
||||
unlink(file);
|
||||
} else {
|
||||
ASSERT(chown(file, 0, 0) != -1, return -1);
|
||||
if(rename(file, dest)) {
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int finalize_download_file(struct dload_payload *p)
|
||||
{
|
||||
int ret = 0;
|
||||
|
||||
ret = unlink_or_move(p->tempfile_name, p->destfile_name);
|
||||
|
||||
if(ret == -1) {
|
||||
_alpm_log(p->handle, ALPM_LOG_ERROR, _("could not rename %s to %s (%s)\n"),
|
||||
p->tempfile_name, p->destfile_name, strerror(errno));
|
||||
return -1;
|
||||
}
|
||||
|
||||
if(p->download_signature) {
|
||||
char *sig_temp, *sig_dest;
|
||||
int len = strlen(p->destfile_name) + strlen(".sig") + 1;
|
||||
MALLOC(sig_dest, len, RET_ERR(p->handle, ALPM_ERR_MEMORY, -1));
|
||||
snprintf(sig_dest, len, "%s.sig", p->destfile_name);
|
||||
len = len + 5;
|
||||
MALLOC(sig_temp, len, FREE(sig_dest); RET_ERR(p->handle, ALPM_ERR_MEMORY, -1));
|
||||
snprintf(sig_temp, len, "%s.sig.part", p->destfile_name);
|
||||
|
||||
ret = unlink_or_move(sig_temp, sig_dest);
|
||||
if(ret == -1) {
|
||||
_alpm_log(p->handle, ALPM_LOG_ERROR, _("could not rename %s to %s (%s)\n"),
|
||||
sig_temp, sig_dest, strerror(errno));
|
||||
}
|
||||
|
||||
free(sig_dest);
|
||||
free(sig_temp);
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static FILE *create_tempfile(struct dload_payload *payload, const char *localpath)
|
||||
{
|
||||
int fd;
|
||||
FILE *fp;
|
||||
char *randpath;
|
||||
size_t len;
|
||||
|
||||
/* create a random filename, which is opened with O_EXCL */
|
||||
len = strlen(localpath) + 14 + 1;
|
||||
MALLOC(randpath, len, RET_ERR(payload->handle, ALPM_ERR_MEMORY, NULL));
|
||||
snprintf(randpath, len, "%salpmtmp.XXXXXX", localpath);
|
||||
if((fd = mkstemp(randpath)) == -1 ||
|
||||
fchmod(fd, ~(_getumask()) & 0666) ||
|
||||
!(fp = fdopen(fd, payload->tempfile_openmode))) {
|
||||
unlink(randpath);
|
||||
close(fd);
|
||||
_alpm_log(payload->handle, ALPM_LOG_ERROR,
|
||||
_("failed to create temporary file for download\n"));
|
||||
free(randpath);
|
||||
return NULL;
|
||||
}
|
||||
/* fp now points to our alpmtmp.XXXXXX */
|
||||
free(payload->tempfile_name);
|
||||
payload->tempfile_name = randpath;
|
||||
free(payload->remote_name);
|
||||
STRDUP(payload->remote_name, strrchr(randpath, '/') + 1,
|
||||
fclose(fp); RET_ERR(payload->handle, ALPM_ERR_MEMORY, NULL));
|
||||
|
||||
return fp;
|
||||
}
|
||||
|
||||
|
||||
#ifdef HAVE_LIBCURL
|
||||
|
||||
@@ -196,16 +55,16 @@ static FILE *create_tempfile(struct dload_payload *payload, const char *localpat
|
||||
#define HOSTNAME_SIZE 256
|
||||
|
||||
static int curl_add_payload(alpm_handle_t *handle, CURLM *curlm,
|
||||
struct dload_payload *payload);
|
||||
struct dload_payload *payload, const char *localpath);
|
||||
static int curl_gethost(const char *url, char *buffer, size_t buf_len);
|
||||
|
||||
/* number of "soft" errors required to blacklist a server, set to 0 to disable
|
||||
* server blacklisting */
|
||||
const int server_error_limit = 3;
|
||||
const unsigned int server_error_limit = 3;
|
||||
|
||||
struct server_error_count {
|
||||
char server[HOSTNAME_SIZE];
|
||||
int errors;
|
||||
unsigned int errors;
|
||||
};
|
||||
|
||||
static struct server_error_count *find_server_errors(alpm_handle_t *handle, const char *server)
|
||||
@@ -235,34 +94,22 @@ static struct server_error_count *find_server_errors(alpm_handle_t *handle, cons
|
||||
}
|
||||
}
|
||||
|
||||
/* skip for hard errors or too many soft errors */
|
||||
static int should_skip_server(alpm_handle_t *handle, const char *server)
|
||||
{
|
||||
struct server_error_count *h;
|
||||
if(server_error_limit && (h = find_server_errors(handle, server)) ) {
|
||||
return h->errors < 0 || h->errors >= server_error_limit;
|
||||
return h->errors >= server_error_limit;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* only skip for hard errors */
|
||||
static int should_skip_cache_server(alpm_handle_t *handle, const char *server)
|
||||
{
|
||||
struct server_error_count *h;
|
||||
if(server_error_limit && (h = find_server_errors(handle, server)) ) {
|
||||
return h->errors < 0;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* block normal servers after too many errors */
|
||||
static void server_soft_error(alpm_handle_t *handle, const char *server)
|
||||
static void server_increment_error(alpm_handle_t *handle, const char *server, int count)
|
||||
{
|
||||
struct server_error_count *h;
|
||||
if(server_error_limit
|
||||
&& (h = find_server_errors(handle, server))
|
||||
&& !should_skip_server(handle, server) ) {
|
||||
h->errors++;
|
||||
h->errors += count;
|
||||
|
||||
if(should_skip_server(handle, server)) {
|
||||
_alpm_log(handle, ALPM_LOG_WARNING,
|
||||
@@ -272,50 +119,42 @@ static void server_soft_error(alpm_handle_t *handle, const char *server)
|
||||
}
|
||||
}
|
||||
|
||||
/* immediate block for both servers and cache servers */
|
||||
static void server_hard_error(alpm_handle_t *handle, const char *server)
|
||||
static void server_soft_error(alpm_handle_t *handle, const char *server)
|
||||
{
|
||||
struct server_error_count *h;
|
||||
if(server_error_limit && (h = find_server_errors(handle, server))) {
|
||||
if(h->errors != -1) {
|
||||
/* always set even if already skipped for soft errors
|
||||
* to disable cache servers too */
|
||||
h->errors = -1;
|
||||
|
||||
_alpm_log(handle, ALPM_LOG_WARNING,
|
||||
_("fatal error from %s, skipping for the remainder of this transaction\n"),
|
||||
h->server);
|
||||
}
|
||||
}
|
||||
server_increment_error(handle, server, 1);
|
||||
}
|
||||
|
||||
static const char *payload_next_server(struct dload_payload *payload)
|
||||
static void server_hard_error(alpm_handle_t *handle, const char *server)
|
||||
{
|
||||
while(payload->cache_servers
|
||||
&& should_skip_cache_server(payload->handle, payload->cache_servers->data)) {
|
||||
payload->cache_servers = payload->cache_servers->next;
|
||||
server_increment_error(handle, server, server_error_limit);
|
||||
}
|
||||
|
||||
static const char *get_filename(const char *url)
|
||||
{
|
||||
char *filename = strrchr(url, '/');
|
||||
if(filename != NULL) {
|
||||
return filename + 1;
|
||||
}
|
||||
if(payload->cache_servers) {
|
||||
const char *server = payload->cache_servers->data;
|
||||
payload->cache_servers = payload->cache_servers->next;
|
||||
payload->request_errors_ok = 1;
|
||||
return server;
|
||||
}
|
||||
while(payload->servers
|
||||
&& should_skip_server(payload->handle, payload->servers->data)) {
|
||||
payload->servers = payload->servers->next;
|
||||
}
|
||||
if(payload->servers) {
|
||||
const char *server = payload->servers->data;
|
||||
payload->servers = payload->servers->next;
|
||||
payload->request_errors_ok = payload->errors_ok;
|
||||
return server;
|
||||
}
|
||||
return NULL;
|
||||
|
||||
/* no slash found, it's a filename */
|
||||
return url;
|
||||
}
|
||||
|
||||
static char *get_fullpath(const char *path, const char *filename,
|
||||
const char *suffix)
|
||||
{
|
||||
char *filepath;
|
||||
/* len = localpath len + filename len + suffix len + null */
|
||||
size_t len = strlen(path) + strlen(filename) + strlen(suffix) + 1;
|
||||
MALLOC(filepath, len, return NULL);
|
||||
snprintf(filepath, len, "%s%s%s", path, filename, suffix);
|
||||
|
||||
return filepath;
|
||||
}
|
||||
|
||||
enum {
|
||||
ABORT_OVER_MAXFILESIZE = 1,
|
||||
ABORT_SIGINT = 1,
|
||||
ABORT_OVER_MAXFILESIZE
|
||||
};
|
||||
|
||||
static int dload_interrupted;
|
||||
@@ -424,12 +263,42 @@ static int utimes_long(const char *path, long seconds)
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* prefix to avoid possible future clash with getumask(3) */
|
||||
static mode_t _getumask(void)
|
||||
{
|
||||
mode_t mask = umask(0);
|
||||
umask(mask);
|
||||
return mask;
|
||||
}
|
||||
|
||||
static size_t dload_parseheader_cb(void *ptr, size_t size, size_t nmemb, void *user)
|
||||
{
|
||||
size_t realsize = size * nmemb;
|
||||
const char *fptr, *endptr = NULL;
|
||||
const char * const cd_header = "Content-Disposition:";
|
||||
const char * const fn_key = "filename=";
|
||||
struct dload_payload *payload = (struct dload_payload *)user;
|
||||
long respcode;
|
||||
(void) ptr;
|
||||
|
||||
if(_alpm_raw_ncmp(cd_header, ptr, strlen(cd_header)) == 0) {
|
||||
if((fptr = strstr(ptr, fn_key))) {
|
||||
fptr += strlen(fn_key);
|
||||
|
||||
/* find the end of the field, which is either a semi-colon, or the end of
|
||||
* the data. As per curl_easy_setopt(3), we cannot count on headers being
|
||||
* null terminated, so we look for the closing \r\n */
|
||||
endptr = fptr + strcspn(fptr, ";\r\n") - 1;
|
||||
|
||||
/* remove quotes */
|
||||
if(*fptr == '"' && *endptr == '"') {
|
||||
fptr++;
|
||||
endptr--;
|
||||
}
|
||||
|
||||
STRNDUP(payload->content_disp_name, fptr, endptr - fptr + 1,
|
||||
RET_ERR(payload->handle, ALPM_ERR_MEMORY, realsize));
|
||||
}
|
||||
}
|
||||
|
||||
curl_easy_getinfo(payload->curl, CURLINFO_RESPONSE_CODE, &respcode);
|
||||
if(payload->respcode != respcode) {
|
||||
@@ -503,28 +372,62 @@ static void curl_set_handle_opts(CURL *curl, struct dload_payload *payload)
|
||||
}
|
||||
}
|
||||
|
||||
static FILE *create_tempfile(struct dload_payload *payload, const char *localpath)
|
||||
{
|
||||
int fd;
|
||||
FILE *fp;
|
||||
char *randpath;
|
||||
size_t len;
|
||||
|
||||
/* create a random filename, which is opened with O_EXCL */
|
||||
len = strlen(localpath) + 14 + 1;
|
||||
MALLOC(randpath, len, RET_ERR(payload->handle, ALPM_ERR_MEMORY, NULL));
|
||||
snprintf(randpath, len, "%salpmtmp.XXXXXX", localpath);
|
||||
if((fd = mkstemp(randpath)) == -1 ||
|
||||
fchmod(fd, ~(_getumask()) & 0666) ||
|
||||
!(fp = fdopen(fd, payload->tempfile_openmode))) {
|
||||
unlink(randpath);
|
||||
close(fd);
|
||||
_alpm_log(payload->handle, ALPM_LOG_ERROR,
|
||||
_("failed to create temporary file for download\n"));
|
||||
free(randpath);
|
||||
return NULL;
|
||||
}
|
||||
/* fp now points to our alpmtmp.XXXXXX */
|
||||
free(payload->tempfile_name);
|
||||
payload->tempfile_name = randpath;
|
||||
free(payload->remote_name);
|
||||
STRDUP(payload->remote_name, strrchr(randpath, '/') + 1,
|
||||
fclose(fp); RET_ERR(payload->handle, ALPM_ERR_MEMORY, NULL));
|
||||
|
||||
return fp;
|
||||
}
|
||||
|
||||
/* Return 0 if retry was successful, -1 otherwise */
|
||||
static int curl_retry_next_server(CURLM *curlm, CURL *curl, struct dload_payload *payload)
|
||||
{
|
||||
const char *server = NULL;
|
||||
const char *server;
|
||||
size_t len;
|
||||
struct stat st;
|
||||
alpm_handle_t *handle = payload->handle;
|
||||
|
||||
if((server = payload_next_server(payload)) == NULL) {
|
||||
while(payload->servers && should_skip_server(handle, payload->servers->data)) {
|
||||
payload->servers = payload->servers->next;
|
||||
}
|
||||
if(!payload->servers) {
|
||||
_alpm_log(payload->handle, ALPM_LOG_DEBUG,
|
||||
"%s: no more servers to retry\n", payload->remote_name);
|
||||
return -1;
|
||||
}
|
||||
server = payload->servers->data;
|
||||
payload->servers = payload->servers->next;
|
||||
|
||||
/* regenerate a new fileurl */
|
||||
FREE(payload->fileurl);
|
||||
len = strlen(server) + strlen(payload->filepath) + 2;
|
||||
MALLOC(payload->fileurl, len, RET_ERR(handle, ALPM_ERR_MEMORY, -1));
|
||||
snprintf(payload->fileurl, len, "%s/%s", server, payload->filepath);
|
||||
_alpm_log(handle, ALPM_LOG_DEBUG,
|
||||
"%s: retrying from %s\n",
|
||||
payload->remote_name, payload->fileurl);
|
||||
|
||||
|
||||
fflush(payload->localf);
|
||||
|
||||
@@ -565,9 +468,10 @@ static int curl_retry_next_server(CURLM *curlm, CURL *curl, struct dload_payload
|
||||
* Returns -1 if an error happened for a required file
|
||||
* Returns -2 if an error happened for an optional file
|
||||
*/
|
||||
static int curl_check_finished_download(alpm_handle_t *handle, CURLM *curlm, CURLMsg *msg,
|
||||
int *active_downloads_num)
|
||||
static int curl_check_finished_download(CURLM *curlm, CURLMsg *msg,
|
||||
const char *localpath, int *active_downloads_num)
|
||||
{
|
||||
alpm_handle_t *handle = NULL;
|
||||
struct dload_payload *payload = NULL;
|
||||
CURL *curl = msg->easy_handle;
|
||||
CURLcode curlerr;
|
||||
@@ -582,11 +486,12 @@ static int curl_check_finished_download(alpm_handle_t *handle, CURLM *curlm, CUR
|
||||
|
||||
curlerr = curl_easy_getinfo(curl, CURLINFO_PRIVATE, &payload);
|
||||
ASSERT(curlerr == CURLE_OK, RET_ERR(handle, ALPM_ERR_LIBCURL, -1));
|
||||
handle = payload->handle;
|
||||
|
||||
curl_gethost(payload->fileurl, hostname, sizeof(hostname));
|
||||
curlerr = msg->data.result;
|
||||
_alpm_log(handle, ALPM_LOG_DEBUG, "%s: %s returned result %d from transfer\n",
|
||||
payload->remote_name, "curl", curlerr);
|
||||
_alpm_log(handle, ALPM_LOG_DEBUG, "%s: curl returned result %d from transfer\n",
|
||||
payload->remote_name, curlerr);
|
||||
|
||||
/* was it a success? */
|
||||
switch(curlerr) {
|
||||
@@ -595,7 +500,7 @@ static int curl_check_finished_download(alpm_handle_t *handle, CURLM *curlm, CUR
|
||||
_alpm_log(handle, ALPM_LOG_DEBUG, "%s: response code %ld\n",
|
||||
payload->remote_name, payload->respcode);
|
||||
if(payload->respcode >= 400) {
|
||||
if(!payload->request_errors_ok) {
|
||||
if(!payload->errors_ok) {
|
||||
handle->pm_errno = ALPM_ERR_RETRIEVE;
|
||||
/* non-translated message is same as libcurl */
|
||||
snprintf(payload->error_buffer, sizeof(payload->error_buffer),
|
||||
@@ -650,7 +555,7 @@ static int curl_check_finished_download(alpm_handle_t *handle, CURLM *curlm, CUR
|
||||
goto cleanup;
|
||||
}
|
||||
default:
|
||||
if(!payload->request_errors_ok) {
|
||||
if(!payload->errors_ok) {
|
||||
handle->pm_errno = ALPM_ERR_LIBCURL;
|
||||
_alpm_log(handle, ALPM_LOG_ERROR,
|
||||
_("failed retrieving file '%s' from %s : %s\n"),
|
||||
@@ -680,6 +585,31 @@ static int curl_check_finished_download(alpm_handle_t *handle, CURLM *curlm, CUR
|
||||
curl_easy_getinfo(curl, CURLINFO_CONDITION_UNMET, &timecond);
|
||||
curl_easy_getinfo(curl, CURLINFO_EFFECTIVE_URL, &effective_url);
|
||||
|
||||
if(payload->trust_remote_name) {
|
||||
if(payload->content_disp_name) {
|
||||
/* content-disposition header has a better name for our file */
|
||||
free(payload->destfile_name);
|
||||
payload->destfile_name = get_fullpath(localpath,
|
||||
get_filename(payload->content_disp_name), "");
|
||||
} else {
|
||||
const char *effective_filename = strrchr(effective_url, '/');
|
||||
|
||||
if(effective_filename && strlen(effective_filename) > 2) {
|
||||
effective_filename++;
|
||||
|
||||
/* if destfile was never set, we wrote to a tempfile. even if destfile is
|
||||
* set, we may have followed some redirects and the effective url may
|
||||
* have a better suggestion as to what to name our file. in either case,
|
||||
* refactor destfile to this newly derived name. */
|
||||
if(!payload->destfile_name || strcmp(effective_filename,
|
||||
strrchr(payload->destfile_name, '/') + 1) != 0) {
|
||||
free(payload->destfile_name);
|
||||
payload->destfile_name = get_fullpath(localpath, effective_filename, "");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Let's check if client requested downloading accompanion *.sig file */
|
||||
if(!payload->signature && payload->download_signature && curlerr == CURLE_OK && payload->respcode < 400) {
|
||||
struct dload_payload *sig = NULL;
|
||||
@@ -711,23 +641,22 @@ static int curl_check_finished_download(alpm_handle_t *handle, CURLM *curlm, CUR
|
||||
MALLOC(sig->fileurl, len, FREE(sig); GOTO_ERR(handle, ALPM_ERR_MEMORY, cleanup));
|
||||
snprintf(sig->fileurl, len, "%s.sig", url);
|
||||
|
||||
int remote_name_len = strlen(payload->remote_name) + 5;
|
||||
MALLOC(sig->remote_name, remote_name_len, _alpm_dload_payload_reset(sig);
|
||||
FREE(sig); GOTO_ERR(handle, ALPM_ERR_MEMORY, cleanup));
|
||||
snprintf(sig->remote_name, remote_name_len, "%s.sig", payload->remote_name);
|
||||
if(payload->trust_remote_name) {
|
||||
/* In this case server might provide a new name for the main payload.
|
||||
* Choose *.sig filename based on this new name.
|
||||
*/
|
||||
const char *final_file = get_filename(realname);
|
||||
int remote_name_len = strlen(final_file) + 5;
|
||||
MALLOC(sig->remote_name, remote_name_len, FREE(sig->fileurl); FREE(sig); GOTO_ERR(handle, ALPM_ERR_MEMORY, cleanup));
|
||||
snprintf(sig->remote_name, remote_name_len, "%s.sig", final_file);
|
||||
}
|
||||
|
||||
/* force the filename to be realname + ".sig" */
|
||||
int destfile_name_len = strlen(realname) + 5;
|
||||
MALLOC(sig->destfile_name, destfile_name_len, _alpm_dload_payload_reset(sig);
|
||||
FREE(sig); GOTO_ERR(handle, ALPM_ERR_MEMORY, cleanup));
|
||||
MALLOC(sig->destfile_name, destfile_name_len, FREE(sig->remote_name);
|
||||
FREE(sig->fileurl); FREE(sig); GOTO_ERR(handle, ALPM_ERR_MEMORY, cleanup));
|
||||
snprintf(sig->destfile_name, destfile_name_len, "%s.sig", realname);
|
||||
|
||||
int tempfile_name_len = strlen(realname) + 10;
|
||||
MALLOC(sig->tempfile_name, tempfile_name_len, _alpm_dload_payload_reset(sig);
|
||||
FREE(sig); GOTO_ERR(handle, ALPM_ERR_MEMORY, cleanup));
|
||||
snprintf(sig->tempfile_name, tempfile_name_len, "%s.sig.part", realname);
|
||||
|
||||
|
||||
sig->signature = 1;
|
||||
sig->handle = handle;
|
||||
sig->force = payload->force;
|
||||
@@ -736,7 +665,7 @@ static int curl_check_finished_download(alpm_handle_t *handle, CURLM *curlm, CUR
|
||||
/* set hard upper limit of 16KiB */
|
||||
sig->max_size = 16 * 1024;
|
||||
|
||||
curl_add_payload(handle, curlm, sig);
|
||||
curl_add_payload(handle, curlm, sig, localpath);
|
||||
(*active_downloads_num)++;
|
||||
}
|
||||
|
||||
@@ -775,7 +704,7 @@ cleanup:
|
||||
}
|
||||
|
||||
if(ret == 0) {
|
||||
if(payload->destfile_name && handle->sandboxuser == NULL) {
|
||||
if(payload->destfile_name) {
|
||||
if(rename(payload->tempfile_name, payload->destfile_name)) {
|
||||
_alpm_log(handle, ALPM_LOG_ERROR, _("could not rename %s to %s (%s)\n"),
|
||||
payload->tempfile_name, payload->destfile_name, strerror(errno));
|
||||
@@ -819,7 +748,7 @@ cleanup:
|
||||
* Returns -1 if am error happened while starting a new download
|
||||
*/
|
||||
static int curl_add_payload(alpm_handle_t *handle, CURLM *curlm,
|
||||
struct dload_payload *payload)
|
||||
struct dload_payload *payload, const char *localpath)
|
||||
{
|
||||
size_t len;
|
||||
CURL *curl = NULL;
|
||||
@@ -832,24 +761,53 @@ static int curl_add_payload(alpm_handle_t *handle, CURLM *curlm,
|
||||
if(payload->fileurl) {
|
||||
ASSERT(!payload->servers, GOTO_ERR(handle, ALPM_ERR_WRONG_ARGS, cleanup));
|
||||
ASSERT(!payload->filepath, GOTO_ERR(handle, ALPM_ERR_WRONG_ARGS, cleanup));
|
||||
payload->request_errors_ok = payload->errors_ok;
|
||||
} else {
|
||||
const char *server = payload_next_server(payload);
|
||||
const char *server;
|
||||
while(payload->servers && should_skip_server(handle, payload->servers->data)) {
|
||||
payload->servers = payload->servers->next;
|
||||
}
|
||||
|
||||
ASSERT(server, GOTO_ERR(handle, ALPM_ERR_SERVER_NONE, cleanup));
|
||||
ASSERT(payload->servers, GOTO_ERR(handle, ALPM_ERR_SERVER_NONE, cleanup));
|
||||
ASSERT(payload->filepath, GOTO_ERR(handle, ALPM_ERR_WRONG_ARGS, cleanup));
|
||||
|
||||
server = payload->servers->data;
|
||||
payload->servers = payload->servers->next;
|
||||
|
||||
len = strlen(server) + strlen(payload->filepath) + 2;
|
||||
MALLOC(payload->fileurl, len, GOTO_ERR(handle, ALPM_ERR_MEMORY, cleanup));
|
||||
snprintf(payload->fileurl, len, "%s/%s", server, payload->filepath);
|
||||
}
|
||||
|
||||
payload->tempfile_openmode = "wb";
|
||||
if(!payload->remote_name) {
|
||||
STRDUP(payload->remote_name, get_filename(payload->fileurl),
|
||||
GOTO_ERR(handle, ALPM_ERR_MEMORY, cleanup));
|
||||
}
|
||||
if(curl_gethost(payload->fileurl, hostname, sizeof(hostname)) != 0) {
|
||||
_alpm_log(handle, ALPM_LOG_ERROR, _("url '%s' is invalid\n"), payload->fileurl);
|
||||
GOTO_ERR(handle, ALPM_ERR_SERVER_BAD_URL, cleanup);
|
||||
}
|
||||
|
||||
if(!payload->random_partfile && payload->remote_name && strlen(payload->remote_name) > 0) {
|
||||
if(!payload->destfile_name) {
|
||||
payload->destfile_name = get_fullpath(localpath, payload->remote_name, "");
|
||||
}
|
||||
payload->tempfile_name = get_fullpath(localpath, payload->remote_name, ".part");
|
||||
if(!payload->destfile_name || !payload->tempfile_name) {
|
||||
goto cleanup;
|
||||
}
|
||||
} else {
|
||||
/* We want a random filename or the URL does not contain a filename, so download to a
|
||||
* temporary location. We can not support resuming this kind of download; any partial
|
||||
* transfers will be destroyed */
|
||||
payload->unlink_on_fail = 1;
|
||||
|
||||
payload->localf = create_tempfile(payload, localpath);
|
||||
if(payload->localf == NULL) {
|
||||
goto cleanup;
|
||||
}
|
||||
}
|
||||
|
||||
curl_set_handle_opts(curl, payload);
|
||||
|
||||
if(payload->max_size == payload->initial_size && payload->max_size != 0) {
|
||||
@@ -907,7 +865,8 @@ static int compare_dload_payload_sizes(const void *left_ptr, const void *right_p
|
||||
* Returns 1 if no files were downloaded and all errors were non-fatal
|
||||
*/
|
||||
static int curl_download_internal(alpm_handle_t *handle,
|
||||
alpm_list_t *payloads /* struct dload_payload */)
|
||||
alpm_list_t *payloads /* struct dload_payload */,
|
||||
const char *localpath)
|
||||
{
|
||||
int active_downloads_num = 0;
|
||||
int err = 0;
|
||||
@@ -925,7 +884,7 @@ static int curl_download_internal(alpm_handle_t *handle,
|
||||
for(; active_downloads_num < max_streams && payloads; active_downloads_num++) {
|
||||
struct dload_payload *payload = payloads->data;
|
||||
|
||||
if(curl_add_payload(handle, curlm, payload) == 0) {
|
||||
if(curl_add_payload(handle, curlm, payload, localpath) == 0) {
|
||||
payloads = payloads->next;
|
||||
} else {
|
||||
/* The payload failed to start. Do not start any new downloads.
|
||||
@@ -955,8 +914,8 @@ static int curl_download_internal(alpm_handle_t *handle,
|
||||
break;
|
||||
}
|
||||
if(msg->msg == CURLMSG_DONE) {
|
||||
int ret = curl_check_finished_download(handle, curlm, msg,
|
||||
&active_downloads_num);
|
||||
int ret = curl_check_finished_download(curlm, msg,
|
||||
localpath, &active_downloads_num);
|
||||
if(ret == -1) {
|
||||
/* if current payload failed to download then stop adding new payloads but wait for the
|
||||
* current ones
|
||||
@@ -976,177 +935,8 @@ static int curl_download_internal(alpm_handle_t *handle,
|
||||
return err ? -1 : updated ? 0 : 1;
|
||||
}
|
||||
|
||||
/* Download the requested files by launching a process inside a sandbox.
|
||||
* Returns -1 if an error happened for a required file
|
||||
* Returns 0 if a payload was actually downloaded
|
||||
* Returns 1 if no files were downloaded and all errors were non-fatal
|
||||
*/
|
||||
static int curl_download_internal_sandboxed(alpm_handle_t *handle,
|
||||
alpm_list_t *payloads /* struct dload_payload */,
|
||||
const char *localpath)
|
||||
{
|
||||
int pid, err = 0, ret = -1, callbacks_fd[2];
|
||||
sigset_t oldblock;
|
||||
struct sigaction sa_ign, oldint, oldquit;
|
||||
_alpm_sandbox_callback_context callbacks_ctx;
|
||||
|
||||
sigemptyset(&sa_ign.sa_mask);
|
||||
sa_ign.sa_handler = SIG_IGN;
|
||||
sa_ign.sa_flags=0;
|
||||
|
||||
if(pipe(callbacks_fd) != 0) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
sigaction(SIGINT, &sa_ign, &oldint);
|
||||
sigaction(SIGQUIT, &sa_ign, &oldquit);
|
||||
sigaddset(&sa_ign.sa_mask, SIGCHLD);
|
||||
sigprocmask(SIG_BLOCK, &sa_ign.sa_mask, &oldblock);
|
||||
|
||||
pid = fork();
|
||||
if(pid == -1) {
|
||||
/* fork failed, make sure errno is preserved after cleanup */
|
||||
err = errno;
|
||||
}
|
||||
|
||||
/* child */
|
||||
if(pid == 0) {
|
||||
close(callbacks_fd[0]);
|
||||
fcntl(callbacks_fd[1], F_SETFD, FD_CLOEXEC);
|
||||
callbacks_ctx.callback_pipe = callbacks_fd[1];
|
||||
alpm_option_set_logcb(handle, _alpm_sandbox_cb_log, &callbacks_ctx);
|
||||
alpm_option_set_dlcb(handle, _alpm_sandbox_cb_dl, &callbacks_ctx);
|
||||
alpm_option_set_fetchcb(handle, NULL, NULL);
|
||||
alpm_option_set_eventcb(handle, NULL, NULL);
|
||||
alpm_option_set_questioncb(handle, NULL, NULL);
|
||||
alpm_option_set_progresscb(handle, NULL, NULL);
|
||||
|
||||
/* restore default signal handling in the child */
|
||||
_alpm_reset_signals();
|
||||
|
||||
/* cwd to the download directory */
|
||||
ret = chdir(localpath);
|
||||
if(ret != 0) {
|
||||
handle->pm_errno = errno;
|
||||
_alpm_log(handle, ALPM_LOG_ERROR, _("could not chdir to download directory %s\n"), localpath);
|
||||
ret = -1;
|
||||
} else {
|
||||
ret = alpm_sandbox_setup_child(handle->sandboxuser);
|
||||
if (ret != 0) {
|
||||
_alpm_log(handle, ALPM_LOG_ERROR, _("switching to sandbox user '%s' failed!\n"), handle->sandboxuser);
|
||||
_Exit(ret | 128);
|
||||
}
|
||||
|
||||
ret = curl_download_internal(handle, payloads);
|
||||
}
|
||||
|
||||
/* pass the result back to the parent */
|
||||
if(ret == 0) {
|
||||
/* a payload was actually downloaded */
|
||||
_Exit(0);
|
||||
}
|
||||
else if(ret == 1) {
|
||||
/* no files were downloaded and all errors were non-fatal */
|
||||
_Exit(handle->pm_errno);
|
||||
}
|
||||
else {
|
||||
/* an error happened for a required file */
|
||||
_Exit(handle->pm_errno | 128);
|
||||
}
|
||||
}
|
||||
|
||||
/* parent */
|
||||
close(callbacks_fd[1]);
|
||||
|
||||
if(pid != -1) {
|
||||
bool had_error = false;
|
||||
while(true) {
|
||||
_alpm_sandbox_callback_t callback_type;
|
||||
ssize_t got = read(callbacks_fd[0], &callback_type, sizeof(callback_type));
|
||||
if(got < 0 || (size_t)got != sizeof(callback_type)) {
|
||||
had_error = true;
|
||||
break;
|
||||
}
|
||||
|
||||
if(callback_type == ALPM_SANDBOX_CB_DOWNLOAD) {
|
||||
if(!_alpm_sandbox_process_cb_download(handle, callbacks_fd[0])) {
|
||||
had_error = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
else if(callback_type == ALPM_SANDBOX_CB_LOG) {
|
||||
if(!_alpm_sandbox_process_cb_log(handle, callbacks_fd[0])) {
|
||||
had_error = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if(had_error) {
|
||||
kill(pid, SIGTERM);
|
||||
}
|
||||
|
||||
int wret;
|
||||
while((wret = waitpid(pid, &ret, 0)) == -1 && errno == EINTR);
|
||||
if(wret > 0) {
|
||||
if(!WIFEXITED(ret)) {
|
||||
/* the child did not terminate normally */
|
||||
ret = -1;
|
||||
}
|
||||
else {
|
||||
ret = WEXITSTATUS(ret);
|
||||
if(ret != 0) {
|
||||
if(ret & 128) {
|
||||
/* an error happened for a required file, or unexpected exit status */
|
||||
handle->pm_errno = ret & ~128;
|
||||
ret = -1;
|
||||
}
|
||||
else {
|
||||
handle->pm_errno = ret;
|
||||
ret = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
/* waitpid failed */
|
||||
err = errno;
|
||||
}
|
||||
}
|
||||
|
||||
close(callbacks_fd[0]);
|
||||
|
||||
sigaction(SIGINT, &oldint, NULL);
|
||||
sigaction(SIGQUIT, &oldquit, NULL);
|
||||
sigprocmask(SIG_SETMASK, &oldblock, NULL);
|
||||
|
||||
if(err) {
|
||||
errno = err;
|
||||
ret = -1;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
static int payload_download_fetchcb(struct dload_payload *payload,
|
||||
const char *server, const char *localpath)
|
||||
{
|
||||
int ret;
|
||||
char *fileurl;
|
||||
alpm_handle_t *handle = payload->handle;
|
||||
|
||||
size_t len = strlen(server) + strlen(payload->filepath) + 2;
|
||||
MALLOC(fileurl, len, RET_ERR(handle, ALPM_ERR_MEMORY, -1));
|
||||
snprintf(fileurl, len, "%s/%s", server, payload->filepath);
|
||||
|
||||
ret = handle->fetchcb(handle->fetchcb_ctx, fileurl, localpath, payload->force);
|
||||
free(fileurl);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* Returns -1 if an error happened for a required file
|
||||
* Returns 0 if a payload was actually downloaded
|
||||
* Returns 1 if no files were downloaded and all errors were non-fatal
|
||||
@@ -1157,26 +947,7 @@ int _alpm_download(alpm_handle_t *handle,
|
||||
{
|
||||
if(handle->fetchcb == NULL) {
|
||||
#ifdef HAVE_LIBCURL
|
||||
if(handle->sandboxuser) {
|
||||
int ret = 0;
|
||||
alpm_list_t *i;
|
||||
|
||||
for(i = payloads; i; i = i->next) {
|
||||
struct dload_payload *p = i->data;
|
||||
intialize_download_file(p);
|
||||
}
|
||||
|
||||
ret = curl_download_internal_sandboxed(handle, payloads, localpath);
|
||||
|
||||
for(i = payloads; i; i = i->next) {
|
||||
struct dload_payload *p = i->data;
|
||||
finalize_download_file(p);
|
||||
}
|
||||
|
||||
return ret;
|
||||
} else {
|
||||
return curl_download_internal(handle, payloads);
|
||||
}
|
||||
return curl_download_internal(handle, payloads, localpath);
|
||||
#else
|
||||
RET_ERR(handle, ALPM_ERR_EXTERNAL_DOWNLOAD, -1);
|
||||
#endif
|
||||
@@ -1191,11 +962,16 @@ int _alpm_download(alpm_handle_t *handle,
|
||||
if(payload->fileurl) {
|
||||
ret = handle->fetchcb(handle->fetchcb_ctx, payload->fileurl, localpath, payload->force);
|
||||
} else {
|
||||
for(s = payload->cache_servers; s && ret == -1; s = s->next) {
|
||||
ret = payload_download_fetchcb(payload, s->data, localpath);
|
||||
}
|
||||
for(s = payload->servers; s && ret == -1; s = s->next) {
|
||||
ret = payload_download_fetchcb(payload, s->data, localpath);
|
||||
const char *server = s->data;
|
||||
char *fileurl;
|
||||
|
||||
size_t len = strlen(server) + strlen(payload->filepath) + 2;
|
||||
MALLOC(fileurl, len, RET_ERR(handle, ALPM_ERR_MEMORY, -1));
|
||||
snprintf(fileurl, len, "%s/%s", server, payload->filepath);
|
||||
|
||||
ret = handle->fetchcb(handle->fetchcb_ctx, fileurl, localpath, payload->force);
|
||||
free(fileurl);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1255,34 +1031,16 @@ int SYMEXPORT alpm_fetch_pkgurl(alpm_handle_t *handle, const alpm_list_t *urls,
|
||||
CALLOC(payload, 1, sizeof(*payload), GOTO_ERR(handle, ALPM_ERR_MEMORY, err));
|
||||
STRDUP(payload->fileurl, url, FREE(payload); GOTO_ERR(handle, ALPM_ERR_MEMORY, err));
|
||||
|
||||
STRDUP(payload->remote_name, get_filename(payload->fileurl),
|
||||
GOTO_ERR(handle, ALPM_ERR_MEMORY, err));
|
||||
|
||||
c = strrchr(url, '/');
|
||||
if(payload->remote_name && strlen(payload->remote_name) > 0 && strstr(c, ".pkg")) {
|
||||
if(strstr(c, ".pkg")) {
|
||||
/* we probably have a usable package filename to download to */
|
||||
payload->destfile_name = _alpm_get_fullpath(cachedir, payload->remote_name, "");
|
||||
payload->tempfile_name = _alpm_get_fullpath(cachedir, payload->remote_name, ".part");
|
||||
payload->allow_resume = 1;
|
||||
|
||||
if(!payload->destfile_name || !payload->tempfile_name) {
|
||||
goto err;
|
||||
}
|
||||
|
||||
} else {
|
||||
/* The URL does not contain a filename, so download to a temporary location.
|
||||
* We can not support resuming this kind of download; any partial transfers
|
||||
* will be destroyed */
|
||||
payload->unlink_on_fail = 1;
|
||||
|
||||
payload->tempfile_openmode = "wb";
|
||||
payload->localf = create_tempfile(payload, cachedir);
|
||||
if(payload->localf == NULL) {
|
||||
goto err;
|
||||
}
|
||||
payload->random_partfile = 1;
|
||||
}
|
||||
|
||||
payload->handle = handle;
|
||||
payload->trust_remote_name = 1;
|
||||
payload->download_signature = (handle->siglevel & ALPM_SIG_PACKAGE);
|
||||
payload->signature_optional = (handle->siglevel & ALPM_SIG_PACKAGE_OPTIONAL);
|
||||
payloads = alpm_list_add(payloads, payload);
|
||||
@@ -1343,6 +1101,7 @@ void _alpm_dload_payload_reset(struct dload_payload *payload)
|
||||
FREE(payload->remote_name);
|
||||
FREE(payload->tempfile_name);
|
||||
FREE(payload->destfile_name);
|
||||
FREE(payload->content_disp_name);
|
||||
FREE(payload->fileurl);
|
||||
FREE(payload->filepath);
|
||||
*payload = (struct dload_payload){0};
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* dload.h
|
||||
*
|
||||
* Copyright (c) 2006-2022 Pacman Development Team <pacman-dev@lists.archlinux.org>
|
||||
* Copyright (c) 2006-2021 Pacman Development Team <pacman-dev@archlinux.org>
|
||||
* Copyright (c) 2002-2006 by Judd Vinet <jvinet@zeroflux.org>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
@@ -26,12 +26,10 @@
|
||||
struct dload_payload {
|
||||
alpm_handle_t *handle;
|
||||
const char *tempfile_openmode;
|
||||
/* name of the remote file */
|
||||
char *remote_name;
|
||||
/* temporary file name, to which the payload is downloaded */
|
||||
char *tempfile_name;
|
||||
/* name to which the downloaded file will be renamed */
|
||||
char *destfile_name;
|
||||
char *content_disp_name;
|
||||
/* client has to provide either
|
||||
* 1) fileurl - full URL to the file
|
||||
* 2) pair of (servers, filepath), in this case ALPM iterates over the
|
||||
@@ -39,7 +37,6 @@ struct dload_payload {
|
||||
*/
|
||||
char *fileurl;
|
||||
char *filepath; /* download URL path */
|
||||
alpm_list_t *cache_servers;
|
||||
alpm_list_t *servers;
|
||||
long respcode;
|
||||
off_t initial_size;
|
||||
@@ -47,17 +44,18 @@ struct dload_payload {
|
||||
off_t prevprogress;
|
||||
int force;
|
||||
int allow_resume;
|
||||
int random_partfile;
|
||||
int errors_ok;
|
||||
int unlink_on_fail;
|
||||
int trust_remote_name;
|
||||
int download_signature; /* specifies if an accompanion *.sig file need to be downloaded*/
|
||||
int signature_optional; /* *.sig file is optional */
|
||||
#ifdef HAVE_LIBCURL
|
||||
CURL *curl;
|
||||
char error_buffer[CURL_ERROR_SIZE];
|
||||
int signature; /* specifies if this payload is for a signature file */
|
||||
int request_errors_ok; /* per-request errors-ok */
|
||||
#endif
|
||||
FILE *localf; /* temp download file */
|
||||
int signature; /* specifies if this payload is for a signature file */
|
||||
#endif
|
||||
};
|
||||
|
||||
void _alpm_dload_payload_reset(struct dload_payload *payload);
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* error.c
|
||||
*
|
||||
* Copyright (c) 2006-2022 Pacman Development Team <pacman-dev@lists.archlinux.org>
|
||||
* Copyright (c) 2006-2021 Pacman Development Team <pacman-dev@archlinux.org>
|
||||
* Copyright (c) 2002-2006 by Judd Vinet <jvinet@zeroflux.org>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* filelist.c
|
||||
*
|
||||
* Copyright (c) 2012-2022 Pacman Development Team <pacman-dev@lists.archlinux.org>
|
||||
* Copyright (c) 2012-2021 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
|
||||
@@ -118,7 +118,7 @@ static int _alpm_files_cmp(const void *f1, const void *f2)
|
||||
return strcmp(file1->name, file2->name);
|
||||
}
|
||||
|
||||
alpm_file_t SYMEXPORT *alpm_filelist_contains(const alpm_filelist_t *filelist,
|
||||
alpm_file_t SYMEXPORT *alpm_filelist_contains(alpm_filelist_t *filelist,
|
||||
const char *path)
|
||||
{
|
||||
alpm_file_t key;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* filelist.h
|
||||
*
|
||||
* Copyright (c) 2012-2022 Pacman Development Team <pacman-dev@lists.archlinux.org>
|
||||
* Copyright (c) 2012-2021 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
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* graph.c - helpful graph structure and setup/teardown methods
|
||||
*
|
||||
* Copyright (c) 2007-2022 Pacman Development Team <pacman-dev@lists.archlinux.org>
|
||||
* Copyright (c) 2007-2021 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
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* graph.h - helpful graph structure and setup/teardown methods
|
||||
*
|
||||
* Copyright (c) 2007-2022 Pacman Development Team <pacman-dev@lists.archlinux.org>
|
||||
* Copyright (c) 2007-2021 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
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* group.c
|
||||
*
|
||||
* Copyright (c) 2006-2022 Pacman Development Team <pacman-dev@lists.archlinux.org>
|
||||
* Copyright (c) 2006-2021 Pacman Development Team <pacman-dev@archlinux.org>
|
||||
* Copyright (c) 2002-2006 by Judd Vinet <jvinet@zeroflux.org>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* group.h
|
||||
*
|
||||
* Copyright (c) 2006-2022 Pacman Development Team <pacman-dev@lists.archlinux.org>
|
||||
* Copyright (c) 2006-2021 Pacman Development Team <pacman-dev@archlinux.org>
|
||||
* Copyright (c) 2002-2006 by Judd Vinet <jvinet@zeroflux.org>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* handle.c
|
||||
*
|
||||
* Copyright (c) 2006-2022 Pacman Development Team <pacman-dev@lists.archlinux.org>
|
||||
* Copyright (c) 2006-2021 Pacman Development Team <pacman-dev@archlinux.org>
|
||||
* Copyright (c) 2002-2006 by Judd Vinet <jvinet@zeroflux.org>
|
||||
* Copyright (c) 2005 by Aurelien Foret <orelien@chez.com>
|
||||
* Copyright (c) 2005, 2006 by Miklos Vajna <vmiklos@frugalware.org>
|
||||
@@ -48,28 +48,12 @@ alpm_handle_t *_alpm_handle_new(void)
|
||||
return handle;
|
||||
}
|
||||
|
||||
/* free all in-memory resources */
|
||||
void _alpm_handle_free(alpm_handle_t *handle)
|
||||
{
|
||||
alpm_list_t *i;
|
||||
alpm_db_t *db;
|
||||
|
||||
if(handle == NULL) {
|
||||
return;
|
||||
}
|
||||
|
||||
/* close local database */
|
||||
if((db = handle->db_local)) {
|
||||
db->ops->unregister(db);
|
||||
}
|
||||
|
||||
/* unregister all sync dbs */
|
||||
for(i = handle->dbs_sync; i; i = i->next) {
|
||||
db = i->data;
|
||||
db->ops->unregister(db);
|
||||
}
|
||||
alpm_list_free(handle->dbs_sync);
|
||||
|
||||
/* close logfile */
|
||||
if(handle->logstream) {
|
||||
fclose(handle->logstream);
|
||||
@@ -84,12 +68,6 @@ void _alpm_handle_free(alpm_handle_t *handle)
|
||||
FREELIST(handle->known_keys);
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_LIBCURL
|
||||
curl_multi_cleanup(handle->curlm);
|
||||
curl_global_cleanup();
|
||||
FREELIST(handle->server_errors);
|
||||
#endif
|
||||
|
||||
/* free memory */
|
||||
_alpm_trans_free(handle->trans);
|
||||
FREE(handle->root);
|
||||
@@ -101,7 +79,6 @@ void _alpm_handle_free(alpm_handle_t *handle)
|
||||
FREE(handle->lockfile);
|
||||
FREELIST(handle->architectures);
|
||||
FREE(handle->gpgdir);
|
||||
FREE(handle->sandboxuser);
|
||||
FREELIST(handle->noupgrade);
|
||||
FREELIST(handle->noextract);
|
||||
FREELIST(handle->ignorepkg);
|
||||
@@ -293,12 +270,6 @@ const char SYMEXPORT *alpm_option_get_gpgdir(alpm_handle_t *handle)
|
||||
return handle->gpgdir;
|
||||
}
|
||||
|
||||
const char SYMEXPORT *alpm_option_get_sandboxuser(alpm_handle_t *handle)
|
||||
{
|
||||
CHECK_HANDLE(handle, return NULL);
|
||||
return handle->sandboxuser;
|
||||
}
|
||||
|
||||
int SYMEXPORT alpm_option_get_usesyslog(alpm_handle_t *handle)
|
||||
{
|
||||
CHECK_HANDLE(handle, return -1);
|
||||
@@ -602,19 +573,6 @@ int SYMEXPORT alpm_option_set_gpgdir(alpm_handle_t *handle, const char *gpgdir)
|
||||
return 0;
|
||||
}
|
||||
|
||||
int SYMEXPORT alpm_option_set_sandboxuser(alpm_handle_t *handle, const char *sandboxuser)
|
||||
{
|
||||
CHECK_HANDLE(handle, return -1);
|
||||
if(handle->sandboxuser) {
|
||||
FREE(handle->sandboxuser);
|
||||
}
|
||||
|
||||
STRDUP(handle->sandboxuser, sandboxuser, RET_ERR(handle, ALPM_ERR_MEMORY, -1));
|
||||
|
||||
_alpm_log(handle, ALPM_LOG_DEBUG, "option 'sandboxuser' = %s\n", handle->sandboxuser);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int SYMEXPORT alpm_option_set_usesyslog(alpm_handle_t *handle, int usesyslog)
|
||||
{
|
||||
CHECK_HANDLE(handle, return -1);
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* handle.h
|
||||
*
|
||||
* Copyright (c) 2006-2022 Pacman Development Team <pacman-dev@lists.archlinux.org>
|
||||
* Copyright (c) 2006-2021 Pacman Development Team <pacman-dev@archlinux.org>
|
||||
* Copyright (c) 2002-2006 by Judd Vinet <jvinet@zeroflux.org>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
@@ -91,7 +91,6 @@ struct _alpm_handle_t {
|
||||
char *logfile; /* Name of the log file */
|
||||
char *lockfile; /* Name of the lock file */
|
||||
char *gpgdir; /* Directory where GnuPG files are stored */
|
||||
char *sandboxuser; /* User to switch to for sensitive operations */
|
||||
alpm_list_t *cachedirs; /* Paths to pacman cache directories */
|
||||
alpm_list_t *hookdirs; /* Paths to hook directories */
|
||||
alpm_list_t *overwrite_files; /* Paths that may be overwritten */
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* hook.c
|
||||
*
|
||||
* Copyright (c) 2015-2022 Pacman Development Team <pacman-dev@lists.archlinux.org>
|
||||
* Copyright (c) 2015-2021 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
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* hook.h
|
||||
*
|
||||
* Copyright (c) 2015-2022 Pacman Development Team <pacman-dev@lists.archlinux.org>
|
||||
* Copyright (c) 2015-2021 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
|
||||
|
||||
13
lib/libalpm/libalpm.pc.in
Normal file
13
lib/libalpm/libalpm.pc.in
Normal file
@@ -0,0 +1,13 @@
|
||||
prefix=@prefix@
|
||||
exec_prefix=@exec_prefix@
|
||||
libdir=@libdir@
|
||||
includedir=@includedir@
|
||||
|
||||
Name: libalpm
|
||||
Description: Arch Linux package management library
|
||||
URL: http://archlinux.org/pacman/
|
||||
Version: @LIB_VERSION@
|
||||
Requires.private: libarchive @pc_crypto@ @pc_libcurl@ @pc_gpgme@
|
||||
Cflags: -I${includedir} @LFS_CFLAGS@
|
||||
Libs: -L${libdir} -lalpm
|
||||
Libs.private: @LIBS@ @pc_gpgme_libs@ @LIBINTL@
|
||||
@@ -4,7 +4,7 @@
|
||||
/*
|
||||
* libarchive-compat.h
|
||||
*
|
||||
* Copyright (c) 2013-2022 Pacman Development Team <pacman-dev@lists.archlinux.org>
|
||||
* Copyright (c) 2013-2021 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
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* log.c
|
||||
*
|
||||
* Copyright (c) 2006-2022 Pacman Development Team <pacman-dev@lists.archlinux.org>
|
||||
* Copyright (c) 2006-2021 Pacman Development Team <pacman-dev@archlinux.org>
|
||||
* Copyright (c) 2002-2006 by Judd Vinet <jvinet@zeroflux.org>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* log.h
|
||||
*
|
||||
* Copyright (c) 2006-2022 Pacman Development Team <pacman-dev@lists.archlinux.org>
|
||||
* Copyright (c) 2006-2021 Pacman Development Team <pacman-dev@archlinux.org>
|
||||
* Copyright (c) 2002-2006 by Judd Vinet <jvinet@zeroflux.org>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
|
||||
@@ -24,7 +24,6 @@ libalpm_sources = files('''
|
||||
pkghash.h pkghash.c
|
||||
rawstr.c
|
||||
remove.h remove.c
|
||||
sandbox.h sandbox.c
|
||||
signing.c signing.h
|
||||
sync.h sync.c
|
||||
trans.h trans.c
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* package.c
|
||||
*
|
||||
* Copyright (c) 2006-2022 Pacman Development Team <pacman-dev@lists.archlinux.org>
|
||||
* Copyright (c) 2006-2021 Pacman Development Team <pacman-dev@archlinux.org>
|
||||
* Copyright (c) 2002-2006 by Judd Vinet <jvinet@zeroflux.org>
|
||||
* Copyright (c) 2005 by Aurelien Foret <orelien@chez.com>
|
||||
* Copyright (c) 2005, 2006 by Christian Hamar <krics@linuxforum.hu>
|
||||
@@ -98,7 +98,6 @@ static alpm_list_t *_pkg_get_provides(alpm_pkg_t *pkg) { return pkg->provides;
|
||||
static alpm_list_t *_pkg_get_replaces(alpm_pkg_t *pkg) { return pkg->replaces; }
|
||||
static alpm_filelist_t *_pkg_get_files(alpm_pkg_t *pkg) { return &(pkg->files); }
|
||||
static alpm_list_t *_pkg_get_backup(alpm_pkg_t *pkg) { return pkg->backup; }
|
||||
static alpm_list_t *_pkg_get_xdata(alpm_pkg_t *pkg) { return pkg->xdata; }
|
||||
|
||||
static void *_pkg_changelog_open(alpm_pkg_t UNUSED *pkg)
|
||||
{
|
||||
@@ -163,7 +162,6 @@ const struct pkg_operations default_pkg_ops = {
|
||||
.get_replaces = _pkg_get_replaces,
|
||||
.get_files = _pkg_get_files,
|
||||
.get_backup = _pkg_get_backup,
|
||||
.get_xdata = _pkg_get_xdata,
|
||||
|
||||
.changelog_open = _pkg_changelog_open,
|
||||
.changelog_read = _pkg_changelog_read,
|
||||
@@ -193,12 +191,6 @@ const char SYMEXPORT *alpm_pkg_get_base(alpm_pkg_t *pkg)
|
||||
return pkg->ops->get_base(pkg);
|
||||
}
|
||||
|
||||
alpm_handle_t SYMEXPORT *alpm_pkg_get_handle(alpm_pkg_t *pkg)
|
||||
{
|
||||
ASSERT(pkg != NULL, return NULL);
|
||||
return pkg->handle;
|
||||
}
|
||||
|
||||
const char SYMEXPORT *alpm_pkg_get_name(alpm_pkg_t *pkg)
|
||||
{
|
||||
ASSERT(pkg != NULL, return NULL);
|
||||
@@ -487,13 +479,6 @@ int SYMEXPORT alpm_pkg_has_scriptlet(alpm_pkg_t *pkg)
|
||||
return pkg->ops->has_scriptlet(pkg);
|
||||
}
|
||||
|
||||
alpm_list_t SYMEXPORT *alpm_pkg_get_xdata(alpm_pkg_t *pkg)
|
||||
{
|
||||
ASSERT(pkg != NULL, return NULL);
|
||||
pkg->handle->pm_errno = ALPM_ERR_OK;
|
||||
return pkg->ops->get_xdata(pkg);
|
||||
}
|
||||
|
||||
static void find_requiredby(alpm_pkg_t *pkg, alpm_db_t *db, alpm_list_t **reqs,
|
||||
int optional)
|
||||
{
|
||||
@@ -686,30 +671,6 @@ static void free_deplist(alpm_list_t *deps)
|
||||
alpm_list_free(deps);
|
||||
}
|
||||
|
||||
alpm_pkg_xdata_t *_alpm_pkg_parse_xdata(const char *string)
|
||||
{
|
||||
alpm_pkg_xdata_t *pd;
|
||||
const char *sep;
|
||||
if(string == NULL || (sep = strchr(string, '=')) == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
CALLOC(pd, 1, sizeof(alpm_pkg_xdata_t), return NULL);
|
||||
STRNDUP(pd->name, string, sep - string, FREE(pd); return NULL);
|
||||
STRDUP(pd->value, sep + 1, FREE(pd->name); FREE(pd); return NULL);
|
||||
|
||||
return pd;
|
||||
}
|
||||
|
||||
void _alpm_pkg_xdata_free(alpm_pkg_xdata_t *pd)
|
||||
{
|
||||
if(pd) {
|
||||
free(pd->name);
|
||||
free(pd->value);
|
||||
free(pd);
|
||||
}
|
||||
}
|
||||
|
||||
void _alpm_pkg_free(alpm_pkg_t *pkg)
|
||||
{
|
||||
if(pkg == NULL) {
|
||||
@@ -740,8 +701,6 @@ void _alpm_pkg_free(alpm_pkg_t *pkg)
|
||||
}
|
||||
alpm_list_free_inner(pkg->backup, (alpm_list_fn_free)_alpm_backup_free);
|
||||
alpm_list_free(pkg->backup);
|
||||
alpm_list_free_inner(pkg->xdata, (alpm_list_fn_free)_alpm_pkg_xdata_free);
|
||||
alpm_list_free(pkg->xdata);
|
||||
free_deplist(pkg->depends);
|
||||
free_deplist(pkg->optdepends);
|
||||
free_deplist(pkg->checkdepends);
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* package.h
|
||||
*
|
||||
* Copyright (c) 2006-2022 Pacman Development Team <pacman-dev@lists.archlinux.org>
|
||||
* Copyright (c) 2006-2021 Pacman Development Team <pacman-dev@archlinux.org>
|
||||
* Copyright (c) 2002-2006 by Judd Vinet <jvinet@zeroflux.org>
|
||||
* Copyright (c) 2005 by Aurelien Foret <orelien@chez.com>
|
||||
* Copyright (c) 2006 by David Kimpe <dnaku@frugalware.org>
|
||||
@@ -67,8 +67,6 @@ struct pkg_operations {
|
||||
alpm_filelist_t *(*get_files) (alpm_pkg_t *);
|
||||
alpm_list_t *(*get_backup) (alpm_pkg_t *);
|
||||
|
||||
alpm_list_t *(*get_xdata) (alpm_pkg_t *);
|
||||
|
||||
void *(*changelog_open) (alpm_pkg_t *);
|
||||
size_t (*changelog_read) (void *, size_t, const alpm_pkg_t *, void *);
|
||||
int (*changelog_close) (const alpm_pkg_t *, void *);
|
||||
@@ -138,8 +136,6 @@ struct _alpm_pkg_t {
|
||||
alpm_pkgreason_t reason;
|
||||
int scriptlet;
|
||||
|
||||
alpm_list_t *xdata;
|
||||
|
||||
/* Bitfield from alpm_dbinfrq_t */
|
||||
int infolevel;
|
||||
/* Bitfield from alpm_pkgvalidation_t */
|
||||
@@ -162,7 +158,4 @@ alpm_pkg_t *_alpm_pkg_load_internal(alpm_handle_t *handle,
|
||||
int _alpm_pkg_cmp(const void *p1, const void *p2);
|
||||
int _alpm_pkg_compare_versions(alpm_pkg_t *local_pkg, alpm_pkg_t *pkg);
|
||||
|
||||
alpm_pkg_xdata_t *_alpm_pkg_parse_xdata(const char *string);
|
||||
void _alpm_pkg_xdata_free(alpm_pkg_xdata_t *pd);
|
||||
|
||||
#endif /* ALPM_PACKAGE_H */
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* pkghash.c
|
||||
*
|
||||
* Copyright (c) 2011-2022 Pacman Development Team <pacman-dev@lists.archlinux.org>
|
||||
* Copyright (c) 2011-2021 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
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* pkghash.h
|
||||
*
|
||||
* Copyright (c) 2011-2022 Pacman Development Team <pacman-dev@lists.archlinux.org>
|
||||
* Copyright (c) 2011-2021 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
|
||||
|
||||
@@ -15,7 +15,7 @@ XGETTEXT_OPTIONS = \
|
||||
# This is the copyright holder that gets inserted into the header of the
|
||||
# $(DOMAIN).pot file. Set this to the copyright holder of the surrounding
|
||||
# package.
|
||||
COPYRIGHT_HOLDER = Pacman Development Team <pacman-dev@lists.archlinux.org>
|
||||
COPYRIGHT_HOLDER = Pacman Development Team <pacman-dev@archlinux.org>
|
||||
|
||||
# This is the email address or URL to which the translators shall report
|
||||
# bugs in the untranslated strings.
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* remove.c
|
||||
*
|
||||
* Copyright (c) 2006-2022 Pacman Development Team <pacman-dev@lists.archlinux.org>
|
||||
* Copyright (c) 2006-2021 Pacman Development Team <pacman-dev@archlinux.org>
|
||||
* Copyright (c) 2002-2006 by Judd Vinet <jvinet@zeroflux.org>
|
||||
* Copyright (c) 2005 by Aurelien Foret <orelien@chez.com>
|
||||
* Copyright (c) 2005 by Christian Hamar <krics@linuxforum.hu>
|
||||
@@ -332,7 +332,7 @@ static int can_remove_file(alpm_handle_t *handle, const alpm_file_t *file)
|
||||
/* If we fail write permissions due to a read-only filesystem, abort.
|
||||
* Assume all other possible failures are covered somewhere else */
|
||||
if(_alpm_access(handle, NULL, filepath, W_OK) == -1) {
|
||||
if(errno != EACCES && errno != ETXTBSY && _alpm_access(handle, NULL, filepath, F_OK) == 0) {
|
||||
if(errno != EACCES && errno != ETXTBSY && access(filepath, F_OK) == 0) {
|
||||
/* only return failure if the file ACTUALLY exists and we can't write to
|
||||
* it - ignore "chmod -w" simple permission failures */
|
||||
_alpm_log(handle, ALPM_LOG_ERROR, _("cannot remove file '%s': %s\n"),
|
||||
@@ -420,9 +420,7 @@ static void shift_pacsave(alpm_handle_t *handle, const char *file)
|
||||
|
||||
cleanup:
|
||||
free(dirname);
|
||||
if(dir != NULL) {
|
||||
closedir(dir);
|
||||
}
|
||||
closedir(dir);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* remove.h
|
||||
*
|
||||
* Copyright (c) 2006-2022 Pacman Development Team <pacman-dev@lists.archlinux.org>
|
||||
* Copyright (c) 2006-2021 Pacman Development Team <pacman-dev@archlinux.org>
|
||||
* Copyright (c) 2002-2006 by Judd Vinet <jvinet@zeroflux.org>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
|
||||
@@ -1,224 +0,0 @@
|
||||
/*
|
||||
* sandbox.c
|
||||
*
|
||||
* Copyright (c) 2021-2022 Pacman Development Team <pacman-dev@lists.archlinux.org>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <errno.h>
|
||||
#include <grp.h>
|
||||
#include <pwd.h>
|
||||
#include <sys/types.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include "alpm.h"
|
||||
#include "log.h"
|
||||
#include "sandbox.h"
|
||||
#include "util.h"
|
||||
|
||||
int SYMEXPORT alpm_sandbox_setup_child(const char* sandboxuser)
|
||||
{
|
||||
struct passwd const *pw = NULL;
|
||||
|
||||
ASSERT(sandboxuser != NULL, return EINVAL);
|
||||
ASSERT(getuid() == 0, return EPERM);
|
||||
ASSERT((pw = getpwnam(sandboxuser)), return errno);
|
||||
ASSERT(setgid(pw->pw_gid) == 0, return errno);
|
||||
ASSERT(setgroups(0, NULL) == 0, return errno);
|
||||
ASSERT(setuid(pw->pw_uid) == 0, return errno);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int should_retry(int errnum)
|
||||
{
|
||||
return errnum == EINTR;
|
||||
}
|
||||
|
||||
static int read_from_pipe(int fd, void *buf, size_t count)
|
||||
{
|
||||
size_t nread = 0;
|
||||
|
||||
ASSERT(count > 0, return -1);
|
||||
|
||||
while(nread < count) {
|
||||
ssize_t r = read(fd, (char *)buf + nread, count-nread);
|
||||
if(r < 0) {
|
||||
if(!should_retry(errno)) {
|
||||
return -1;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
if(r == 0) {
|
||||
/* we hit EOF unexpectedly - bail */
|
||||
return -1;
|
||||
}
|
||||
nread += r;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int write_to_pipe(int fd, const void *buf, size_t count)
|
||||
{
|
||||
size_t nwrite = 0;
|
||||
|
||||
ASSERT(count > 0, return -1);
|
||||
|
||||
while(nwrite < count) {
|
||||
ssize_t r = write(fd, (char *)buf + nwrite, count-nwrite);
|
||||
if(r < 0) {
|
||||
if(!should_retry(errno)) {
|
||||
return -1;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
nwrite += r;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void _alpm_sandbox_cb_log(void *ctx, alpm_loglevel_t level, const char *fmt, va_list args)
|
||||
{
|
||||
_alpm_sandbox_callback_t type = ALPM_SANDBOX_CB_LOG;
|
||||
_alpm_sandbox_callback_context *context = ctx;
|
||||
char *string = NULL;
|
||||
int string_size = 0;
|
||||
|
||||
if(!context || context->callback_pipe == -1) {
|
||||
return;
|
||||
}
|
||||
|
||||
/* compute the required size, as allowed by POSIX.1-2001 and C99 */
|
||||
/* first we need to copy the va_list as it will be consumed by the first call */
|
||||
va_list copy;
|
||||
va_copy(copy, args);
|
||||
string_size = vsnprintf(NULL, 0, fmt, copy);
|
||||
if(string_size <= 0) {
|
||||
va_end(copy);
|
||||
return;
|
||||
}
|
||||
MALLOC(string, string_size + 1, return);
|
||||
string_size = vsnprintf(string, string_size + 1, fmt, args);
|
||||
if(string_size > 0) {
|
||||
write_to_pipe(context->callback_pipe, &type, sizeof(type));
|
||||
write_to_pipe(context->callback_pipe, &level, sizeof(level));
|
||||
write_to_pipe(context->callback_pipe, &string_size, sizeof(string_size));
|
||||
write_to_pipe(context->callback_pipe, string, string_size);
|
||||
}
|
||||
va_end(copy);
|
||||
FREE(string);
|
||||
}
|
||||
|
||||
void _alpm_sandbox_cb_dl(void *ctx, const char *filename, alpm_download_event_type_t event, void *data)
|
||||
{
|
||||
_alpm_sandbox_callback_t type = ALPM_SANDBOX_CB_DOWNLOAD;
|
||||
_alpm_sandbox_callback_context *context = ctx;
|
||||
size_t filename_len;
|
||||
|
||||
if(!context || context->callback_pipe == -1) {
|
||||
return;
|
||||
}
|
||||
|
||||
ASSERT(filename != NULL, return);
|
||||
ASSERT(event == ALPM_DOWNLOAD_INIT || event == ALPM_DOWNLOAD_PROGRESS || event == ALPM_DOWNLOAD_RETRY || event == ALPM_DOWNLOAD_COMPLETED, return);
|
||||
|
||||
filename_len = strlen(filename);
|
||||
|
||||
write_to_pipe(context->callback_pipe, &type, sizeof(type));
|
||||
write_to_pipe(context->callback_pipe, &event, sizeof(event));
|
||||
switch(event) {
|
||||
case ALPM_DOWNLOAD_INIT:
|
||||
write_to_pipe(context->callback_pipe, data, sizeof(alpm_download_event_init_t));
|
||||
break;
|
||||
case ALPM_DOWNLOAD_PROGRESS:
|
||||
write_to_pipe(context->callback_pipe, data, sizeof(alpm_download_event_progress_t));
|
||||
break;
|
||||
case ALPM_DOWNLOAD_RETRY:
|
||||
write_to_pipe(context->callback_pipe, data, sizeof(alpm_download_event_retry_t));
|
||||
break;
|
||||
case ALPM_DOWNLOAD_COMPLETED:
|
||||
write_to_pipe(context->callback_pipe, data, sizeof(alpm_download_event_completed_t));
|
||||
break;
|
||||
}
|
||||
write_to_pipe(context->callback_pipe, &filename_len, sizeof(filename_len));
|
||||
write_to_pipe(context->callback_pipe, filename, filename_len);
|
||||
}
|
||||
|
||||
|
||||
bool _alpm_sandbox_process_cb_log(alpm_handle_t *handle, int callback_pipe) {
|
||||
alpm_loglevel_t level;
|
||||
char *string = NULL;
|
||||
int string_size = 0;
|
||||
|
||||
ASSERT(read_from_pipe(callback_pipe, &level, sizeof(level)) != -1, return false);
|
||||
ASSERT(read_from_pipe(callback_pipe, &string_size, sizeof(string_size)) != -1, return false);
|
||||
|
||||
MALLOC(string, string_size + 1, return false);
|
||||
|
||||
ASSERT(read_from_pipe(callback_pipe, string, string_size) != -1, FREE(string); return false);
|
||||
string[string_size] = '\0';
|
||||
|
||||
_alpm_log(handle, level, "%s", string);
|
||||
FREE(string);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool _alpm_sandbox_process_cb_download(alpm_handle_t *handle, int callback_pipe) {
|
||||
alpm_download_event_type_t type;
|
||||
char *filename = NULL;
|
||||
size_t filename_size, cb_data_size;
|
||||
union {
|
||||
alpm_download_event_init_t init;
|
||||
alpm_download_event_progress_t progress;
|
||||
alpm_download_event_retry_t retry;
|
||||
alpm_download_event_completed_t completed;
|
||||
} cb_data;
|
||||
|
||||
ASSERT(read_from_pipe(callback_pipe, &type, sizeof(type)) != -1, return false);
|
||||
|
||||
switch (type) {
|
||||
case ALPM_DOWNLOAD_INIT:
|
||||
cb_data_size = sizeof(alpm_download_event_init_t);
|
||||
ASSERT(read_from_pipe(callback_pipe, &cb_data.init, cb_data_size) != -1, return false);
|
||||
break;
|
||||
case ALPM_DOWNLOAD_PROGRESS:
|
||||
cb_data_size = sizeof(alpm_download_event_progress_t);
|
||||
ASSERT(read_from_pipe(callback_pipe, &cb_data.progress, cb_data_size) != -1, return false);
|
||||
break;
|
||||
case ALPM_DOWNLOAD_RETRY:
|
||||
cb_data_size = sizeof(alpm_download_event_retry_t);
|
||||
ASSERT(read_from_pipe(callback_pipe, &cb_data.retry, cb_data_size) != -1, return false);
|
||||
break;
|
||||
case ALPM_DOWNLOAD_COMPLETED:
|
||||
cb_data_size = sizeof(alpm_download_event_completed_t);
|
||||
ASSERT(read_from_pipe(callback_pipe, &cb_data.completed, cb_data_size) != -1, return false);
|
||||
break;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
|
||||
ASSERT(read_from_pipe(callback_pipe, &filename_size, sizeof(filename_size)) != -1, return false);;
|
||||
|
||||
MALLOC(filename, filename_size + 1, return false);
|
||||
|
||||
ASSERT(read_from_pipe(callback_pipe, filename, filename_size) != -1, FREE(filename); return false);
|
||||
filename[filename_size] = '\0';
|
||||
|
||||
handle->dlcb(handle->dlcb_ctx, filename, type, &cb_data);
|
||||
FREE(filename);
|
||||
return true;
|
||||
}
|
||||
@@ -1,51 +0,0 @@
|
||||
/*
|
||||
* sandbox.h
|
||||
*
|
||||
* Copyright (c) 2021-2022 Pacman Development Team <pacman-dev@lists.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/>.
|
||||
*/
|
||||
|
||||
#ifndef ALPM_SANDBOX_H
|
||||
#define ALPM_SANDBOX_H
|
||||
|
||||
#include <stdbool.h>
|
||||
|
||||
|
||||
/* The type of callbacks that can happen during a sandboxed operation */
|
||||
typedef enum {
|
||||
ALPM_SANDBOX_CB_LOG,
|
||||
ALPM_SANDBOX_CB_DOWNLOAD
|
||||
} _alpm_sandbox_callback_t;
|
||||
|
||||
typedef struct {
|
||||
int callback_pipe;
|
||||
} _alpm_sandbox_callback_context;
|
||||
|
||||
|
||||
/* Sandbox callbacks */
|
||||
|
||||
__attribute__((format(printf, 3, 0)))
|
||||
void _alpm_sandbox_cb_log(void *ctx, alpm_loglevel_t level, const char *fmt, va_list args);
|
||||
|
||||
void _alpm_sandbox_cb_dl(void *ctx, const char *filename, alpm_download_event_type_t event, void *data);
|
||||
|
||||
|
||||
/* Functions to capture sandbox callbacks and convert them to alpm callbacks */
|
||||
|
||||
bool _alpm_sandbox_process_cb_log(alpm_handle_t *handle, int callback_pipe);
|
||||
bool _alpm_sandbox_process_cb_download(alpm_handle_t *handle, int callback_pipe);
|
||||
|
||||
|
||||
#endif /* ALPM_SANDBOX_H */
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* signing.c
|
||||
*
|
||||
* Copyright (c) 2008-2022 Pacman Development Team <pacman-dev@lists.archlinux.org>
|
||||
* Copyright (c) 2008-2021 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
|
||||
@@ -253,10 +253,9 @@ error:
|
||||
* This requires GPGME to call the gpg binary.
|
||||
* @param handle the context handle
|
||||
* @param email the email address of the key to import
|
||||
* @param fpr the fingerprint key ID to look up (or NULL)
|
||||
* @return 0 on success, -1 on error
|
||||
*/
|
||||
static int key_import_wkd(alpm_handle_t *handle, const char *email, const char *fpr)
|
||||
static int key_import_wkd(alpm_handle_t *handle, const char *email)
|
||||
{
|
||||
gpgme_error_t gpg_err;
|
||||
gpgme_ctx_t ctx = {0};
|
||||
@@ -275,12 +274,7 @@ static int key_import_wkd(alpm_handle_t *handle, const char *email, const char *
|
||||
_alpm_log(handle, ALPM_LOG_DEBUG, _("looking up key %s using WKD\n"), email);
|
||||
gpg_err = gpgme_get_key(ctx, email, &key, 0);
|
||||
if(gpg_err_code(gpg_err) == GPG_ERR_NO_ERROR) {
|
||||
/* check if correct key was imported via WKD */
|
||||
if(fpr && _alpm_key_in_keychain(handle, fpr)) {
|
||||
ret = 0;
|
||||
} else {
|
||||
_alpm_log(handle, ALPM_LOG_DEBUG, "key lookup failed: WKD imported wrong fingerprint\n");
|
||||
}
|
||||
ret = 0;
|
||||
}
|
||||
gpgme_key_unref(key);
|
||||
|
||||
@@ -359,18 +353,14 @@ static int key_search_keyserver(alpm_handle_t *handle, const char *fpr,
|
||||
} else {
|
||||
pgpkey->fingerprint = key->subkeys->keyid;
|
||||
}
|
||||
|
||||
/* we are probably going to fail importing, but continue anyway... */
|
||||
if(key->uids != NULL) {
|
||||
pgpkey->uid = key->uids->uid;
|
||||
pgpkey->name = key->uids->name;
|
||||
pgpkey->email = key->uids->email;
|
||||
}
|
||||
|
||||
pgpkey->uid = key->uids->uid;
|
||||
pgpkey->name = key->uids->name;
|
||||
pgpkey->email = key->uids->email;
|
||||
pgpkey->created = key->subkeys->timestamp;
|
||||
pgpkey->expires = key->subkeys->expires;
|
||||
pgpkey->length = key->subkeys->length;
|
||||
pgpkey->revoked = key->subkeys->revoked;
|
||||
|
||||
/* Initialize with '?', this is overwritten unless public key
|
||||
* algorithm is unknown. */
|
||||
pgpkey->pubkey_algo = '?';
|
||||
@@ -526,7 +516,7 @@ int _alpm_key_import(alpm_handle_t *handle, const char *uid, const char *fpr)
|
||||
if(question.import) {
|
||||
/* Try to import the key from a WKD first */
|
||||
if(email_from_uid(uid, &email) == 0) {
|
||||
ret = key_import_wkd(handle, email, fpr);
|
||||
ret = key_import_wkd(handle, email);
|
||||
free(email);
|
||||
}
|
||||
|
||||
@@ -539,7 +529,7 @@ int _alpm_key_import(alpm_handle_t *handle, const char *uid, const char *fpr)
|
||||
ret = 0;
|
||||
} else {
|
||||
_alpm_log(handle, ALPM_LOG_ERROR,
|
||||
_("key \"%s\" could not be imported\n"), fpr);
|
||||
_("key \"%s\" could not be imported\n"), fetch_key.uid);
|
||||
}
|
||||
} else {
|
||||
_alpm_log(handle, ALPM_LOG_ERROR,
|
||||
@@ -1044,7 +1034,7 @@ int SYMEXPORT alpm_siglist_cleanup(alpm_siglist_t *siglist)
|
||||
static size_t length_check(size_t length, size_t position, size_t a,
|
||||
alpm_handle_t *handle, const char *identifier)
|
||||
{
|
||||
if( a == 0 || position > length || length - position <= a) {
|
||||
if( a == 0 || length - position <= a) {
|
||||
_alpm_log(handle, ALPM_LOG_ERROR,
|
||||
_("%s: signature format error\n"), identifier);
|
||||
return -1;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* signing.h
|
||||
*
|
||||
* Copyright (c) 2008-2022 Pacman Development Team <pacman-dev@lists.archlinux.org>
|
||||
* Copyright (c) 2008-2021 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
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* sync.c
|
||||
*
|
||||
* Copyright (c) 2006-2022 Pacman Development Team <pacman-dev@lists.archlinux.org>
|
||||
* Copyright (c) 2006-2021 Pacman Development Team <pacman-dev@archlinux.org>
|
||||
* Copyright (c) 2002-2006 by Judd Vinet <jvinet@zeroflux.org>
|
||||
* Copyright (c) 2005 by Aurelien Foret <orelien@chez.com>
|
||||
* Copyright (c) 2005 by Christian Hamar <krics@linuxforum.hu>
|
||||
@@ -470,6 +470,7 @@ int _alpm_sync_prepare(alpm_handle_t *handle, alpm_list_t **data)
|
||||
for(j = i->next; j; j = j->next) {
|
||||
alpm_pkg_t *pkg2 = j->data;
|
||||
if(strcmp(pkg1->filename, pkg2->filename) == 0) {
|
||||
alpm_list_free(resolved);
|
||||
ret = -1;
|
||||
handle->pm_errno = ALPM_ERR_TRANS_DUP_FILENAME;
|
||||
_alpm_log(handle, ALPM_LOG_ERROR, _("packages %s and %s have the same filename: %s\n"),
|
||||
@@ -479,7 +480,6 @@ int _alpm_sync_prepare(alpm_handle_t *handle, alpm_list_t **data)
|
||||
}
|
||||
|
||||
if(ret != 0) {
|
||||
alpm_list_free(resolved);
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
@@ -517,23 +517,21 @@ int _alpm_sync_prepare(alpm_handle_t *handle, alpm_list_t **data)
|
||||
|
||||
for(i = deps; i; i = i->next) {
|
||||
alpm_conflict_t *conflict = i->data;
|
||||
const char *name1 = conflict->package1->name;
|
||||
const char *name2 = conflict->package2->name;
|
||||
alpm_pkg_t *rsync, *sync, *sync1, *sync2;
|
||||
|
||||
/* have we already removed one of the conflicting targets? */
|
||||
sync1 = alpm_pkg_find(trans->add, name1);
|
||||
sync2 = alpm_pkg_find(trans->add, name2);
|
||||
sync1 = alpm_pkg_find(trans->add, conflict->package1);
|
||||
sync2 = alpm_pkg_find(trans->add, conflict->package2);
|
||||
if(!sync1 || !sync2) {
|
||||
continue;
|
||||
}
|
||||
|
||||
_alpm_log(handle, ALPM_LOG_DEBUG, "conflicting packages in the sync list: '%s' <-> '%s'\n",
|
||||
name1, name2);
|
||||
conflict->package1, conflict->package2);
|
||||
|
||||
/* if sync1 provides sync2, we remove sync2 from the targets, and vice versa */
|
||||
alpm_depend_t *dep1 = alpm_dep_from_string(name1);
|
||||
alpm_depend_t *dep2 = alpm_dep_from_string(name2);
|
||||
alpm_depend_t *dep1 = alpm_dep_from_string(conflict->package1);
|
||||
alpm_depend_t *dep2 = alpm_dep_from_string(conflict->package2);
|
||||
if(_alpm_depcmp(sync1, dep2)) {
|
||||
rsync = sync2;
|
||||
sync = sync1;
|
||||
@@ -561,8 +559,8 @@ int _alpm_sync_prepare(alpm_handle_t *handle, alpm_list_t **data)
|
||||
|
||||
/* Prints warning */
|
||||
_alpm_log(handle, ALPM_LOG_WARNING,
|
||||
_("removing '%s-%s' from target list because it conflicts with '%s-%s'\n"),
|
||||
rsync->name, rsync->version, sync->name, sync->version);
|
||||
_("removing '%s' from target list because it conflicts with '%s'\n"),
|
||||
rsync->name, sync->name);
|
||||
trans->add = alpm_list_remove(trans->add, rsync, _alpm_pkg_cmp, NULL);
|
||||
/* rsync is not a transaction target anymore */
|
||||
trans->unresolvable = alpm_list_add(trans->unresolvable, rsync);
|
||||
@@ -583,18 +581,16 @@ int _alpm_sync_prepare(alpm_handle_t *handle, alpm_list_t **data)
|
||||
.conflict = i->data
|
||||
};
|
||||
alpm_conflict_t *conflict = i->data;
|
||||
const char *name1 = conflict->package1->name;
|
||||
const char *name2 = conflict->package2->name;
|
||||
int found = 0;
|
||||
|
||||
/* if name2 (the local package) is not elected for removal,
|
||||
/* if conflict->package2 (the local package) is not elected for removal,
|
||||
we ask the user */
|
||||
if(alpm_pkg_find(trans->remove, name2)) {
|
||||
if(alpm_pkg_find(trans->remove, conflict->package2)) {
|
||||
found = 1;
|
||||
}
|
||||
for(j = trans->add; j && !found; j = j->next) {
|
||||
alpm_pkg_t *spkg = j->data;
|
||||
if(alpm_pkg_find(spkg->removes, name2)) {
|
||||
if(alpm_pkg_find(spkg->removes, conflict->package2)) {
|
||||
found = 1;
|
||||
}
|
||||
}
|
||||
@@ -602,15 +598,15 @@ int _alpm_sync_prepare(alpm_handle_t *handle, alpm_list_t **data)
|
||||
continue;
|
||||
}
|
||||
|
||||
_alpm_log(handle, ALPM_LOG_DEBUG, "package '%s-%s' conflicts with '%s-%s'\n",
|
||||
name1, conflict->package1->version, name2,conflict->package2->version);
|
||||
_alpm_log(handle, ALPM_LOG_DEBUG, "package '%s' conflicts with '%s'\n",
|
||||
conflict->package1, conflict->package2);
|
||||
|
||||
QUESTION(handle, &question);
|
||||
if(question.remove) {
|
||||
/* append to the removes list */
|
||||
alpm_pkg_t *sync = alpm_pkg_find(trans->add, name1);
|
||||
alpm_pkg_t *local = _alpm_db_get_pkgfromcache(handle->db_local, name2);
|
||||
_alpm_log(handle, ALPM_LOG_DEBUG, "electing '%s' for removal\n", name2);
|
||||
alpm_pkg_t *sync = alpm_pkg_find(trans->add, conflict->package1);
|
||||
alpm_pkg_t *local = _alpm_db_get_pkgfromcache(handle->db_local, conflict->package2);
|
||||
_alpm_log(handle, ALPM_LOG_DEBUG, "electing '%s' for removal\n", conflict->package2);
|
||||
sync->removes = alpm_list_add(sync->removes, local);
|
||||
} else { /* abort */
|
||||
_alpm_log(handle, ALPM_LOG_ERROR, _("unresolvable package conflicts detected\n"));
|
||||
@@ -736,7 +732,7 @@ static int find_dl_candidates(alpm_handle_t *handle, alpm_list_t **files)
|
||||
handle->pm_errno = ALPM_ERR_SERVER_NONE;
|
||||
_alpm_log(handle, ALPM_LOG_ERROR, "%s: %s\n",
|
||||
alpm_strerror(handle->pm_errno), repo->treename);
|
||||
return -1;
|
||||
return 1;
|
||||
}
|
||||
|
||||
ASSERT(spkg->filename != NULL, RET_ERR(handle, ALPM_ERR_PKG_INVALID_NAME, -1));
|
||||
@@ -767,7 +763,6 @@ static int find_dl_candidates(alpm_handle_t *handle, alpm_list_t **files)
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static int download_files(alpm_handle_t *handle)
|
||||
{
|
||||
const char *cachedir;
|
||||
@@ -826,17 +821,9 @@ static int download_files(alpm_handle_t *handle)
|
||||
CALLOC(payload, 1, sizeof(*payload), GOTO_ERR(handle, ALPM_ERR_MEMORY, finish));
|
||||
STRDUP(payload->remote_name, pkg->filename, FREE(payload); GOTO_ERR(handle, ALPM_ERR_MEMORY, finish));
|
||||
STRDUP(payload->filepath, pkg->filename,
|
||||
_alpm_dload_payload_reset(payload); FREE(payload);
|
||||
FREE(payload->remote_name); FREE(payload);
|
||||
GOTO_ERR(handle, ALPM_ERR_MEMORY, finish));
|
||||
payload->destfile_name = _alpm_get_fullpath(cachedir, payload->remote_name, "");
|
||||
payload->tempfile_name = _alpm_get_fullpath(cachedir, payload->remote_name, ".part");
|
||||
if(!payload->destfile_name || !payload->tempfile_name) {
|
||||
_alpm_dload_payload_reset(payload);
|
||||
FREE(payload);
|
||||
GOTO_ERR(handle, ALPM_ERR_MEMORY, finish);
|
||||
}
|
||||
payload->max_size = pkg->size;
|
||||
payload->cache_servers = pkg->origin_data.db->cache_servers;
|
||||
payload->servers = pkg->origin_data.db->servers;
|
||||
payload->handle = handle;
|
||||
payload->allow_resume = 1;
|
||||
@@ -1004,13 +991,6 @@ static int check_validity(alpm_handle_t *handle,
|
||||
|
||||
current_bytes += v.pkg->size;
|
||||
v.path = _alpm_filecache_find(handle, v.pkg->filename);
|
||||
|
||||
if(!v.path) {
|
||||
_alpm_log(handle, ALPM_LOG_ERROR,
|
||||
_("%s: could not find package in cache\n"), v.pkg->name);
|
||||
RET_ERR(handle, ALPM_ERR_PKG_NOT_FOUND, -1);
|
||||
}
|
||||
|
||||
v.siglevel = alpm_db_get_siglevel(alpm_pkg_get_db(v.pkg));
|
||||
|
||||
if(_alpm_pkg_validate_internal(handle, v.path, v.pkg,
|
||||
@@ -1102,12 +1082,6 @@ static int load_packages(alpm_handle_t *handle, alpm_list_t **data,
|
||||
current_bytes += spkg->size;
|
||||
filepath = _alpm_filecache_find(handle, spkg->filename);
|
||||
|
||||
if(!filepath) {
|
||||
_alpm_log(handle, ALPM_LOG_ERROR,
|
||||
_("%s: could not find package in cache\n"), spkg->name);
|
||||
RET_ERR(handle, ALPM_ERR_PKG_NOT_FOUND, -1);
|
||||
}
|
||||
|
||||
/* load the package file and replace pkgcache entry with it in the target list */
|
||||
/* TODO: alpm_pkg_get_db() will not work on this target anymore */
|
||||
_alpm_log(handle, ALPM_LOG_DEBUG,
|
||||
@@ -1135,7 +1109,6 @@ static int load_packages(alpm_handle_t *handle, alpm_list_t **data,
|
||||
errors++;
|
||||
*data = alpm_list_add(*data, strdup(spkg->filename));
|
||||
free(filepath);
|
||||
_alpm_pkg_free(pkgfile);
|
||||
continue;
|
||||
}
|
||||
free(filepath);
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* sync.h
|
||||
*
|
||||
* Copyright (c) 2006-2022 Pacman Development Team <pacman-dev@lists.archlinux.org>
|
||||
* Copyright (c) 2006-2021 Pacman Development Team <pacman-dev@archlinux.org>
|
||||
* Copyright (c) 2002-2006 by Judd Vinet <jvinet@zeroflux.org>
|
||||
* Copyright (c) 2005 by Aurelien Foret <orelien@chez.com>
|
||||
* Copyright (c) 2005, 2006 by Miklos Vajna <vmiklos@frugalware.org>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* trans.c
|
||||
*
|
||||
* Copyright (c) 2006-2022 Pacman Development Team <pacman-dev@lists.archlinux.org>
|
||||
* Copyright (c) 2006-2021 Pacman Development Team <pacman-dev@archlinux.org>
|
||||
* Copyright (c) 2002-2006 by Judd Vinet <jvinet@zeroflux.org>
|
||||
* Copyright (c) 2005 by Aurelien Foret <orelien@chez.com>
|
||||
* Copyright (c) 2005 by Christian Hamar <krics@linuxforum.hu>
|
||||
@@ -177,7 +177,8 @@ int SYMEXPORT alpm_trans_commit(alpm_handle_t *handle, alpm_list_t **data)
|
||||
ASSERT(trans != NULL, RET_ERR(handle, ALPM_ERR_TRANS_NULL, -1));
|
||||
ASSERT(trans->state == STATE_PREPARED, RET_ERR(handle, ALPM_ERR_TRANS_NOT_PREPARED, -1));
|
||||
|
||||
ASSERT(!(trans->flags & ALPM_TRANS_FLAG_NOLOCK), RET_ERR(handle, ALPM_ERR_TRANS_NOT_LOCKED, -1));
|
||||
ASSERT(!(trans->flags & ALPM_TRANS_FLAG_NOLOCK && !(trans->flags & ALPM_TRANS_FLAG_DOWNLOADONLY)),
|
||||
RET_ERR(handle, ALPM_ERR_TRANS_NOT_LOCKED, -1));
|
||||
|
||||
/* If there's nothing to do, return without complaining */
|
||||
if(trans->add == NULL && trans->remove == NULL) {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* trans.h
|
||||
*
|
||||
* Copyright (c) 2006-2022 Pacman Development Team <pacman-dev@lists.archlinux.org>
|
||||
* Copyright (c) 2006-2021 Pacman Development Team <pacman-dev@archlinux.org>
|
||||
* Copyright (c) 2002-2006 by Judd Vinet <jvinet@zeroflux.org>
|
||||
* Copyright (c) 2005 by Aurelien Foret <orelien@chez.com>
|
||||
* Copyright (c) 2005 by Christian Hamar <krics@linuxforum.hu>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* util.c
|
||||
*
|
||||
* Copyright (c) 2006-2022 Pacman Development Team <pacman-dev@lists.archlinux.org>
|
||||
* Copyright (c) 2006-2021 Pacman Development Team <pacman-dev@archlinux.org>
|
||||
* Copyright (c) 2002-2006 by Judd Vinet <jvinet@zeroflux.org>
|
||||
* Copyright (c) 2005 by Aurelien Foret <orelien@chez.com>
|
||||
* Copyright (c) 2005 by Christian Hamar <krics@linuxforum.hu>
|
||||
@@ -31,7 +31,6 @@
|
||||
#include <limits.h>
|
||||
#include <sys/wait.h>
|
||||
#include <sys/socket.h>
|
||||
#include <fcntl.h>
|
||||
#include <fnmatch.h>
|
||||
#include <poll.h>
|
||||
#include <signal.h>
|
||||
@@ -41,7 +40,8 @@
|
||||
#include <archive_entry.h>
|
||||
|
||||
#ifdef HAVE_LIBSSL
|
||||
#include <openssl/evp.h>
|
||||
#include <openssl/md5.h>
|
||||
#include <openssl/sha.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_LIBNETTLE
|
||||
@@ -197,23 +197,6 @@ cleanup:
|
||||
return ret;
|
||||
}
|
||||
|
||||
/** Combines a directory, filename and suffix to provide full path of a file
|
||||
* @param path directory path
|
||||
* @param filename file name
|
||||
* @param suffix suffix
|
||||
* @return file path
|
||||
*/
|
||||
char *_alpm_get_fullpath(const char *path, const char *filename, const char *suffix)
|
||||
{
|
||||
char *filepath;
|
||||
/* len = localpath len + filename len + suffix len + null */
|
||||
size_t len = strlen(path) + strlen(filename) + strlen(suffix) + 1;
|
||||
MALLOC(filepath, len, return NULL);
|
||||
snprintf(filepath, len, "%s%s%s", path, filename, suffix);
|
||||
|
||||
return filepath;
|
||||
}
|
||||
|
||||
/** Trim trailing newlines from a string (if any exist).
|
||||
* @param str a single line of text
|
||||
* @param len size of str, if known, else 0
|
||||
@@ -366,11 +349,6 @@ int _alpm_unpack(alpm_handle_t *handle, const char *path, const char *prefix,
|
||||
|
||||
entryname = archive_entry_pathname(entry);
|
||||
|
||||
if(entryname == NULL) {
|
||||
ret = 1;
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
/* If specific files were requested, skip entries that don't match. */
|
||||
if(list) {
|
||||
char *entry_prefix = NULL;
|
||||
@@ -572,7 +550,7 @@ static int _alpm_chroot_read_from_child(alpm_handle_t *handle, int fd,
|
||||
return 0;
|
||||
}
|
||||
|
||||
void _alpm_reset_signals(void)
|
||||
static void _alpm_reset_signals(void)
|
||||
{
|
||||
/* reset POSIX defined signals (see signal.h) */
|
||||
/* there are likely more but there is no easy way
|
||||
@@ -672,9 +650,7 @@ int _alpm_run_chroot(alpm_handle_t *handle, const char *cmd, char *const argv[],
|
||||
}
|
||||
|
||||
/* use fprintf instead of _alpm_log to send output through the parent */
|
||||
/* don't chroot() to "/": this allows running with less caps when the
|
||||
* caller puts us in the right root */
|
||||
if(strcmp(handle->root, "/") != 0 && chroot(handle->root) != 0) {
|
||||
if(chroot(handle->root) != 0) {
|
||||
fprintf(stderr, _("could not change the root directory (%s)\n"), strerror(errno));
|
||||
exit(1);
|
||||
}
|
||||
@@ -683,16 +659,8 @@ int _alpm_run_chroot(alpm_handle_t *handle, const char *cmd, char *const argv[],
|
||||
"/", strerror(errno));
|
||||
exit(1);
|
||||
}
|
||||
/* bash assumes it's being run under rsh/ssh if stdin is a socket and
|
||||
* sources ~/.bashrc if it thinks it's the top-level shell.
|
||||
* set SHLVL before running to indicate that it's a child shell and
|
||||
* disable this behavior */
|
||||
setenv("SHLVL", "1", 0);
|
||||
/* bash sources $BASH_ENV when run non-interactively */
|
||||
unsetenv("BASH_ENV");
|
||||
umask(0022);
|
||||
_alpm_reset_signals();
|
||||
_alpm_handle_free(handle);
|
||||
execv(cmd, argv);
|
||||
/* execv only returns if there was an error */
|
||||
fprintf(stderr, _("call to execv failed (%s)\n"), strerror(errno));
|
||||
@@ -863,17 +831,10 @@ char *_alpm_filecache_find(alpm_handle_t *handle, const char *filename)
|
||||
for(i = handle->cachedirs; i; i = i->next) {
|
||||
snprintf(path, PATH_MAX, "%s%s", (char *)i->data,
|
||||
filename);
|
||||
if(stat(path, &buf) == 0) {
|
||||
if(S_ISREG(buf.st_mode)) {
|
||||
retpath = strdup(path);
|
||||
_alpm_log(handle, ALPM_LOG_DEBUG, "found cached pkg: %s\n", retpath);
|
||||
return retpath;
|
||||
} else {
|
||||
_alpm_log(handle, ALPM_LOG_WARNING,
|
||||
"cached pkg '%s' is not a regular file: mode=%i\n", path, buf.st_mode);
|
||||
}
|
||||
} else if(errno != ENOENT) {
|
||||
_alpm_log(handle, ALPM_LOG_WARNING, "could not open '%s'\n: %s", path, strerror(errno));
|
||||
if(stat(path, &buf) == 0 && S_ISREG(buf.st_mode)) {
|
||||
retpath = strdup(path);
|
||||
_alpm_log(handle, ALPM_LOG_DEBUG, "found cached pkg: %s\n", retpath);
|
||||
return retpath;
|
||||
}
|
||||
}
|
||||
/* package wasn't found in any cachedir */
|
||||
@@ -955,8 +916,7 @@ const char *_alpm_filecache_setup(alpm_handle_t *handle)
|
||||
static int md5_file(const char *path, unsigned char output[16])
|
||||
{
|
||||
#if HAVE_LIBSSL
|
||||
EVP_MD_CTX *ctx;
|
||||
const EVP_MD *md = EVP_get_digestbyname("MD5");
|
||||
MD5_CTX ctx;
|
||||
#else /* HAVE_LIBNETTLE */
|
||||
struct md5_ctx ctx;
|
||||
#endif
|
||||
@@ -973,8 +933,7 @@ static int md5_file(const char *path, unsigned char output[16])
|
||||
}
|
||||
|
||||
#if HAVE_LIBSSL
|
||||
ctx = EVP_MD_CTX_create();
|
||||
EVP_DigestInit_ex(ctx, md, NULL);
|
||||
MD5_Init(&ctx);
|
||||
#else /* HAVE_LIBNETTLE */
|
||||
md5_init(&ctx);
|
||||
#endif
|
||||
@@ -984,7 +943,7 @@ static int md5_file(const char *path, unsigned char output[16])
|
||||
continue;
|
||||
}
|
||||
#if HAVE_LIBSSL
|
||||
EVP_DigestUpdate(ctx, buf, n);
|
||||
MD5_Update(&ctx, buf, n);
|
||||
#else /* HAVE_LIBNETTLE */
|
||||
md5_update(&ctx, n, buf);
|
||||
#endif
|
||||
@@ -998,8 +957,7 @@ static int md5_file(const char *path, unsigned char output[16])
|
||||
}
|
||||
|
||||
#if HAVE_LIBSSL
|
||||
EVP_DigestFinal_ex(ctx, output, NULL);
|
||||
EVP_MD_CTX_destroy(ctx);
|
||||
MD5_Final(output, &ctx);
|
||||
#else /* HAVE_LIBNETTLE */
|
||||
md5_digest(&ctx, MD5_DIGEST_SIZE, output);
|
||||
#endif
|
||||
@@ -1014,8 +972,7 @@ static int md5_file(const char *path, unsigned char output[16])
|
||||
static int sha256_file(const char *path, unsigned char output[32])
|
||||
{
|
||||
#if HAVE_LIBSSL
|
||||
EVP_MD_CTX *ctx;
|
||||
const EVP_MD *md = EVP_get_digestbyname("SHA256");
|
||||
SHA256_CTX ctx;
|
||||
#else /* HAVE_LIBNETTLE */
|
||||
struct sha256_ctx ctx;
|
||||
#endif
|
||||
@@ -1032,8 +989,7 @@ static int sha256_file(const char *path, unsigned char output[32])
|
||||
}
|
||||
|
||||
#if HAVE_LIBSSL
|
||||
ctx = EVP_MD_CTX_create();
|
||||
EVP_DigestInit_ex(ctx, md, NULL);
|
||||
SHA256_Init(&ctx);
|
||||
#else /* HAVE_LIBNETTLE */
|
||||
sha256_init(&ctx);
|
||||
#endif
|
||||
@@ -1043,7 +999,7 @@ static int sha256_file(const char *path, unsigned char output[32])
|
||||
continue;
|
||||
}
|
||||
#if HAVE_LIBSSL
|
||||
EVP_DigestUpdate(ctx, buf, n);
|
||||
SHA256_Update(&ctx, buf, n);
|
||||
#else /* HAVE_LIBNETTLE */
|
||||
sha256_update(&ctx, n, buf);
|
||||
#endif
|
||||
@@ -1057,8 +1013,7 @@ static int sha256_file(const char *path, unsigned char output[32])
|
||||
}
|
||||
|
||||
#if HAVE_LIBSSL
|
||||
EVP_DigestFinal_ex(ctx, output, NULL);
|
||||
EVP_MD_CTX_destroy(ctx);
|
||||
SHA256_Final(output, &ctx);
|
||||
#else /* HAVE_LIBNETTLE */
|
||||
sha256_digest(&ctx, SHA256_DIGEST_SIZE, output);
|
||||
#endif
|
||||
@@ -1380,11 +1335,6 @@ int _alpm_access(alpm_handle_t *handle, const char *dir, const char *file, int a
|
||||
size_t len = 0;
|
||||
int ret = 0;
|
||||
|
||||
int flag = 0;
|
||||
#ifdef AT_SYMLINK_NOFOLLOW
|
||||
flag |= AT_SYMLINK_NOFOLLOW;
|
||||
#endif
|
||||
|
||||
if(dir) {
|
||||
char *check_path;
|
||||
|
||||
@@ -1392,11 +1342,11 @@ int _alpm_access(alpm_handle_t *handle, const char *dir, const char *file, int a
|
||||
CALLOC(check_path, len, sizeof(char), RET_ERR(handle, ALPM_ERR_MEMORY, -1));
|
||||
snprintf(check_path, len, "%s%s", dir, file);
|
||||
|
||||
ret = faccessat(AT_FDCWD, check_path, amode, flag);
|
||||
ret = access(check_path, amode);
|
||||
free(check_path);
|
||||
} else {
|
||||
dir = "";
|
||||
ret = faccessat(AT_FDCWD, file, amode, flag);
|
||||
ret = access(file, amode);
|
||||
}
|
||||
|
||||
if(ret != 0) {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* util.h
|
||||
*
|
||||
* Copyright (c) 2006-2022 Pacman Development Team <pacman-dev@lists.archlinux.org>
|
||||
* Copyright (c) 2006-2021 Pacman Development Team <pacman-dev@archlinux.org>
|
||||
* Copyright (c) 2002-2006 by Judd Vinet <jvinet@zeroflux.org>
|
||||
* Copyright (c) 2005 by Aurelien Foret <orelien@chez.com>
|
||||
* Copyright (c) 2005 by Christian Hamar <krics@linuxforum.hu>
|
||||
@@ -116,7 +116,6 @@ struct archive_read_buffer {
|
||||
int _alpm_makepath(const char *path);
|
||||
int _alpm_makepath_mode(const char *path, mode_t mode);
|
||||
int _alpm_copyfile(const char *src, const char *dest);
|
||||
char *_alpm_get_fullpath(const char *path, const char *filename, const char *suffix);
|
||||
size_t _alpm_strip_newline(char *str, size_t len);
|
||||
|
||||
int _alpm_open_archive(alpm_handle_t *handle, const char *path,
|
||||
@@ -130,7 +129,6 @@ ssize_t _alpm_files_in_directory(alpm_handle_t *handle, const char *path, int fu
|
||||
|
||||
typedef ssize_t (*_alpm_cb_io)(void *buf, ssize_t len, void *ctx);
|
||||
|
||||
void _alpm_reset_signals(void);
|
||||
int _alpm_run_chroot(alpm_handle_t *handle, const char *cmd, char *const argv[],
|
||||
_alpm_cb_io in_cb, void *in_ctx);
|
||||
int _alpm_ldconfig(alpm_handle_t *handle);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2006-2022 Pacman Development Team <pacman-dev@lists.archlinux.org>
|
||||
* Copyright (c) 2006-2021 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
|
||||
|
||||
71
meson.build
71
meson.build
@@ -8,7 +8,7 @@ project('pacman',
|
||||
'sysconfdir=/etc',
|
||||
'localstatedir=/var',
|
||||
],
|
||||
meson_version : '>= 0.56')
|
||||
meson_version : '>= 0.51')
|
||||
|
||||
libalpm_version = '13.0.1'
|
||||
|
||||
@@ -26,15 +26,14 @@ 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())
|
||||
KEYRINGDIR = join_paths(PREFIX, DATAROOTDIR, get_option('keyringdir'))
|
||||
|
||||
PYTHON = import('python').find_installation('python3')
|
||||
LDCONFIG = get_option('ldconfig')
|
||||
MESON_MAKE_SYMLINK = join_paths(meson.project_source_root(), 'build-aux/meson-make-symlink.sh')
|
||||
MESON_MAKE_SYMLINK = join_paths(meson.source_root(), 'build-aux/meson-make-symlink.sh')
|
||||
|
||||
BASH = find_program('bash4', 'bash')
|
||||
if BASH.found()
|
||||
bash_version = run_command(BASH, '-c', 'IFS=.; echo "${BASH_VERSINFO[*]:0:3}"', check: true).stdout()
|
||||
bash_version = run_command(BASH, '-c', 'IFS=.; echo "${BASH_VERSINFO[*]:0:3}"').stdout()
|
||||
|
||||
have_bash = bash_version.version_compare('>= 4.4.0')
|
||||
endif
|
||||
@@ -44,7 +43,7 @@ endif
|
||||
|
||||
bashcompletion = dependency('bash-completion', required : false)
|
||||
if bashcompletion.found()
|
||||
BASHCOMPDIR = bashcompletion.get_variable(pkgconfig: 'completionsdir')
|
||||
BASHCOMPDIR = bashcompletion.get_pkgconfig_variable('completionsdir')
|
||||
else
|
||||
BASHCOMPDIR = join_paths(DATAROOTDIR, 'bash-completion/completions')
|
||||
endif
|
||||
@@ -54,8 +53,7 @@ if get_option('use-git-version')
|
||||
find_program('git'),
|
||||
'describe',
|
||||
'--abbrev=4',
|
||||
'--dirty',
|
||||
check: true).stdout().strip().strip('v')
|
||||
'--dirty').stdout().strip().strip('v')
|
||||
else
|
||||
PACKAGE_VERSION = meson.project_version()
|
||||
endif
|
||||
@@ -92,11 +90,6 @@ endif
|
||||
libarchive = dependency('libarchive',
|
||||
version : '>=3.0.0',
|
||||
static : get_option('buildstatic'))
|
||||
if libarchive.version().version_compare('>=3.6.0')
|
||||
bsdtar_no_read_sparse = '--no-read-sparse'
|
||||
else
|
||||
bsdtar_no_read_sparse = ''
|
||||
endif
|
||||
|
||||
libcurl = dependency('libcurl',
|
||||
version : '>=7.55.0',
|
||||
@@ -104,7 +97,7 @@ libcurl = dependency('libcurl',
|
||||
static : get_option('buildstatic'))
|
||||
conf.set('HAVE_LIBCURL', libcurl.found())
|
||||
|
||||
needed_gpgme_version = '>=1.12.0'
|
||||
needed_gpgme_version = '>=1.3.0'
|
||||
gpgme = dependency('gpgme',
|
||||
version : needed_gpgme_version,
|
||||
required : get_option('gpgme'),
|
||||
@@ -182,22 +175,7 @@ foreach type : [
|
||||
endif
|
||||
endforeach
|
||||
|
||||
|
||||
if conf.has('HAVE_GETMNTINFO')
|
||||
if cc.compiles('''
|
||||
#include <sys/types.h>
|
||||
#include <sys/statvfs.h>
|
||||
|
||||
void func() {
|
||||
struct statvfs *buf;
|
||||
getmntinfo(&buf, 0);
|
||||
}
|
||||
''')
|
||||
conf.set('FSSTATSTYPE', 'struct statvfs')
|
||||
else
|
||||
conf.set('FSSTATSTYPE', 'struct statfs')
|
||||
endif
|
||||
elif conf.has('HAVE_STRUCT_STATVFS_F_FLAG')
|
||||
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')
|
||||
@@ -205,7 +183,6 @@ endif
|
||||
|
||||
if get_option('debug')
|
||||
extra_cflags = [
|
||||
'-pedantic',
|
||||
'-Wcast-align',
|
||||
'-Wclobbered',
|
||||
'-Wempty-body',
|
||||
@@ -233,7 +210,6 @@ if get_option('debug')
|
||||
'-Wuninitialized',
|
||||
'-Wunused-but-set-parameter',
|
||||
'-Wunused-parameter',
|
||||
'-Wunused-result',
|
||||
'-Wwrite-strings',
|
||||
]
|
||||
add_project_arguments(cc.get_supported_arguments(extra_cflags), language : 'c')
|
||||
@@ -254,7 +230,7 @@ strip_static = '--strip-debug'
|
||||
|
||||
file_seccomp = get_option('file-seccomp')
|
||||
# meson-git has find_program('file', required: false, version: '>=5.38')
|
||||
filever = run_command('sh', '-c', 'file --version | sed -n "s/^file-\(.*\)/\\1/p"', check: true).stdout()
|
||||
filever = run_command('sh', '-c', 'file --version | sed -n "s/^file-\(.*\)/\\1/p"').stdout()
|
||||
if file_seccomp.enabled() or ( file_seccomp.auto() and filever.version_compare('>= 5.38') )
|
||||
filecmd = 'file -S'
|
||||
endif
|
||||
@@ -269,7 +245,7 @@ elif os.contains('bsd') or os == 'dragonfly'
|
||||
inodecmd = 'stat -f \'%i %N\''
|
||||
endif
|
||||
|
||||
chost = run_command(cc, '-dumpmachine', check: true).stdout().strip()
|
||||
chost = run_command(cc, '-dumpmachine').stdout().strip()
|
||||
carch = chost.split('-')[0]
|
||||
|
||||
# annoyingly, we have to maintain two sets of configuration_data which is
|
||||
@@ -284,9 +260,8 @@ substs.set('LOCALEDIR', LOCALEDIR)
|
||||
substs.set('sysconfdir', SYSCONFDIR)
|
||||
substs.set('localstatedir', LOCALSTATEDIR)
|
||||
substs.set('PKGDATADIR', PKGDATADIR)
|
||||
substs.set('KEYRINGDIR', KEYRINGDIR)
|
||||
substs.set('PREFIX', PREFIX)
|
||||
substs.set('BASH', BASH.full_path())
|
||||
substs.set('BASH', BASH.path())
|
||||
substs.set('PACKAGE_VERSION', PACKAGE_VERSION)
|
||||
substs.set('PACKAGE_NAME', meson.project_name())
|
||||
substs.set('BUILDSCRIPT', BUILDSCRIPT)
|
||||
@@ -298,7 +273,6 @@ substs.set('LIBMAKEPKGDIR', LIBMAKEPKGDIR)
|
||||
substs.set('STRIP_BINARIES', strip_binaries)
|
||||
substs.set('STRIP_SHARED', strip_shared)
|
||||
substs.set('STRIP_STATIC', strip_static)
|
||||
substs.set('BSDTAR_NO_READ_SPARSE', bsdtar_no_read_sparse)
|
||||
|
||||
subdir('lib/libalpm')
|
||||
subdir('src/common')
|
||||
@@ -337,7 +311,7 @@ libalpm_a = static_library(
|
||||
'alpm_objlib',
|
||||
libalpm_sources,
|
||||
# https://github.com/mesonbuild/meson/issues/3937
|
||||
objects : libcommon.extract_all_objects(recursive: true),
|
||||
objects : libcommon.extract_all_objects(),
|
||||
include_directories : includes,
|
||||
gnu_symbol_visibility : 'hidden',
|
||||
dependencies : alpm_deps)
|
||||
@@ -360,9 +334,7 @@ pkgconfig.generate(
|
||||
name : 'libalpm',
|
||||
description : 'Arch Linux package management library',
|
||||
version : libalpm_version,
|
||||
url : 'http://archlinux.org/pacman/',
|
||||
extra_cflags: [ '-D_FILE_OFFSET_BITS=64' ],
|
||||
)
|
||||
url : 'http://archlinux.org/pacman/')
|
||||
|
||||
pacman_bin = executable(
|
||||
'pacman',
|
||||
@@ -401,7 +373,7 @@ executable(
|
||||
|
||||
foreach wrapper : script_wrappers
|
||||
cdata = configuration_data()
|
||||
cdata.set_quoted('BASH', BASH.full_path())
|
||||
cdata.set_quoted('BASH', BASH.path())
|
||||
cdata.set_quoted('BUILDDIR', wrapper[2])
|
||||
cdata.set_quoted('REAL_PROGPATH', wrapper[1].full_path())
|
||||
|
||||
@@ -409,7 +381,7 @@ foreach wrapper : script_wrappers
|
||||
# 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.project_source_root(), 'build-aux', 'script-wrapper.sh.in'),
|
||||
input : join_paths(meson.source_root(), 'build-aux', 'script-wrapper.sh.in'),
|
||||
output : wrapper[0],
|
||||
configuration : cdata)
|
||||
endforeach
|
||||
@@ -420,12 +392,6 @@ configure_file(
|
||||
configuration : substs,
|
||||
install_dir : SYSCONFDIR)
|
||||
|
||||
configure_file(
|
||||
input : 'etc/makepkg.conf.d/rust.conf.in',
|
||||
output : 'rust.conf',
|
||||
configuration : substs,
|
||||
install_dir : join_paths(SYSCONFDIR, 'makepkg.conf.d/'))
|
||||
|
||||
configure_file(
|
||||
input : 'etc/pacman.conf.in',
|
||||
output : 'pacman.conf',
|
||||
@@ -449,10 +415,10 @@ foreach path : [
|
||||
endforeach
|
||||
|
||||
TEST_ENV = environment()
|
||||
TEST_ENV.set('PMTEST_SCRIPTLIB_DIR', join_paths(meson.project_source_root(), 'scripts/library/'))
|
||||
TEST_ENV.set('PMTEST_LIBMAKEPKG_DIR', join_paths(meson.project_build_root(), 'scripts/libmakepkg/'))
|
||||
TEST_ENV.set('PMTEST_UTIL_DIR', meson.project_build_root() + '/')
|
||||
TEST_ENV.set('PMTEST_SCRIPT_DIR', join_paths(meson.project_build_root(), 'scripts/'))
|
||||
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')
|
||||
@@ -467,7 +433,6 @@ message('\n '.join([
|
||||
' localstatedir : @0@'.format(LOCALSTATEDIR),
|
||||
' database dir : @0@'.format(join_paths(LOCALSTATEDIR, 'lib/pacman/')),
|
||||
' cache dir : @0@'.format(join_paths(LOCALSTATEDIR, 'cache/pacman/pkg/')),
|
||||
' keyringdir : @0@'.format(KEYRINGDIR),
|
||||
' compiler : @0@ @1@'.format(cc.get_id(), cc.version()),
|
||||
'',
|
||||
' Architecture : @0@'.format(carch),
|
||||
|
||||
@@ -26,9 +26,6 @@ option('buildscript', type : 'string', value : 'PKGBUILD',
|
||||
option('datarootdir', type : 'string', value : 'share',
|
||||
description : 'FIXME')
|
||||
|
||||
option('keyringdir', type : 'string', value: 'pacman/keyrings',
|
||||
description : 'Where to look for keyring files under datarootdir')
|
||||
|
||||
option('makepkg-template-dir', type : 'string', value : '/usr/share/makepkg-template',
|
||||
description : 'template dir used by makepkg-template')
|
||||
|
||||
|
||||
@@ -28,7 +28,7 @@ changelog=
|
||||
source=("$pkgbase-$pkgver.tar.gz"
|
||||
"$pkgname-$pkgver.patch")
|
||||
noextract=()
|
||||
sha256sums=()
|
||||
md5sums=()
|
||||
validpgpkeys=()
|
||||
|
||||
prepare() {
|
||||
|
||||
@@ -25,7 +25,7 @@ options=()
|
||||
install=
|
||||
source=('FOLDER::VCS+URL#FRAGMENT')
|
||||
noextract=()
|
||||
sha256sums=('SKIP')
|
||||
md5sums=('SKIP')
|
||||
|
||||
# Please refer to the 'USING VCS SOURCES' section of the PKGBUILD man page for
|
||||
# a description of each element in the source array.
|
||||
|
||||
@@ -27,7 +27,7 @@ changelog=
|
||||
source=("$pkgname-$pkgver.tar.gz"
|
||||
"$pkgname-$pkgver.patch")
|
||||
noextract=()
|
||||
sha256sums=()
|
||||
md5sums=()
|
||||
validpgpkeys=()
|
||||
|
||||
prepare() {
|
||||
|
||||
@@ -553,7 +553,7 @@ _pacman_conf_directive() {
|
||||
|
||||
_pacman_conf_commands=(
|
||||
{-l,--repo-list}'[List configured repositories]:*: :->repo_list'
|
||||
{-h,--help}'[Output syntax and command line options]:*: :->complete'
|
||||
{-h,--help}'[Output systax and command line options]:*: :->complete'
|
||||
{-V,--version}'[Display version and exit]:*: :->complete'
|
||||
)
|
||||
|
||||
@@ -564,7 +564,7 @@ _pacman_conf_options=(
|
||||
|
||||
_pacman_conf_options_common=(
|
||||
'*'{-c,--config=}'[Specify an alternate configuration file]: :_files'
|
||||
'*'{-R,--rootdir=}'[Specify an alternate installation root]: :_files'
|
||||
'*'{-R,--rootdir=}'[Specify an alternate insallation root]: :_files'
|
||||
)
|
||||
|
||||
_pacman_conf() {
|
||||
@@ -586,38 +586,38 @@ _pacman_conf() {
|
||||
esac
|
||||
}
|
||||
|
||||
_pacman_key_shortopts=(
|
||||
_key_shortopts=(
|
||||
'-h[show help]'
|
||||
'-a[Add the specified keys (empty for stdin)]: :_files'
|
||||
'-d[Remove the Specified keyids]:*: :_pacman_key_list'
|
||||
'-e[Export the specified or all keyids]:*: :_pacman_key_list'
|
||||
'-f[List fingerprint for specified or all keyids]:*: :_pacman_key_list'
|
||||
'-l[List the specified or all keys]:*: :_pacman_key_list'
|
||||
'-r[Fetch the specified keyids]:*: :_pacman_key_list'
|
||||
'-d[Remove the Specified keyids]:*: :_keys'
|
||||
'-e[Export the specified or all keyids]:*: :_keys'
|
||||
'-f[List fingerprint for specified or all keyids]:*: :_keys'
|
||||
'-l[List the specified or all keys]:*: :_keys'
|
||||
'-r[Fetch the specified keyids]:*: :_keys'
|
||||
'-u[Update the trustdb of pacman]'
|
||||
'-v[Verify the file specified by the signature]: :_files -g "*.sig"'
|
||||
'-V[Show program version]'
|
||||
)
|
||||
|
||||
_pacman_key_longopts=(
|
||||
_key_longopts=(
|
||||
'--help[show help]'
|
||||
'--add[Add the specified keys (empty for stdin)]: :_files'
|
||||
'--delete[Remove the Specified keyids]:*: :_pacman_key_list'
|
||||
'--export[Export the specified or all keyids]:*: :_pacman_key_list'
|
||||
'--finger[List fingerprint for specified or all keyids]:*: :_pacman_key_list'
|
||||
'--list-keys[List the specified or all keys]:*: :_pacman_key_list'
|
||||
'--recv-keys[Fetch the specified keyids]:*: :_pacman_key_list'
|
||||
'--delete[Remove the Specified keyids]:*: :_keys'
|
||||
'--export[Export the specified or all keyids]:*: :_keys'
|
||||
'--finger[List fingerprint for specified or all keyids]:*: :_keys'
|
||||
'--list-keys[List the specified or all keys]:*: :_keys'
|
||||
'--recv-keys[Fetch the specified keyids]:*: :_keys'
|
||||
'--updatedb[Update the trustdb of pacman]'
|
||||
'--verify[Verify the file specified by the signature]: :_files -g "*.sig"'
|
||||
'--version[Show program version]'
|
||||
'--edit-key[Present a menu for key management task on keyids]:*: :_pacman_key_list'
|
||||
'--edit-key[Present a menu for key management task on keyids]:*: :_keys'
|
||||
'--import[Imports pubring.gpg from dir(s)]: :_files -g "*.gpg"'
|
||||
'--import-tb[Imports ownertrust values from trustdb.gpg in dir(s)]: :_files -g "*.gpg"'
|
||||
'--init[Ensure the keyring is properly initialized]'
|
||||
'--list-sigs[List keys and their signatures]:*: :_pacman_key_list'
|
||||
'--lsign-key[Locally sign the specified keyid]:*: :_pacman_key_list'
|
||||
'--populate[Reload the default keys from the (given) keyrings in '@keyringdir@']: :_path_files -W @keyringdir@'
|
||||
'--refresh-keys[Update specified or all keys from a keyserver]:*: :_pacman_key_list'
|
||||
'--list-sigs[List keys and their signatures]:*: :_keys'
|
||||
'--lsign-key[Locally sign the specified keyid]:*: :_keys'
|
||||
'--populate[Reload the default keys from the (given) keyrings in '/usr/share/pacman/keyrings']: :_path_files -W /usr/share/pacman/keyrings'
|
||||
'--refresh-keys[Update specified or all keys from a keyserver]:*: :_keys'
|
||||
)
|
||||
|
||||
_pacman_key_options=(
|
||||
@@ -631,13 +631,13 @@ _pacman_key() {
|
||||
--*)
|
||||
_arguments -s : \
|
||||
"$_pacman_key_options[@]" \
|
||||
"$_pacman_key_longopts[@]"
|
||||
"$_key_longopts[@]"
|
||||
;;
|
||||
-*)
|
||||
_arguments -s : \
|
||||
"$_pacman_key_options[@]" \
|
||||
"$_pacman_key_shortopts[@]" \
|
||||
"$_pacman_key_longopts[@]"
|
||||
"$_key_shortopts[@]" \
|
||||
"$_key_longopts[@]"
|
||||
;;
|
||||
*)
|
||||
i=$#
|
||||
@@ -648,13 +648,13 @@ _pacman_key() {
|
||||
--*)
|
||||
_arguments -s : \
|
||||
"$_pacman_key_options[@]" \
|
||||
"$_pacman_key_longopts[@]"
|
||||
"$_key_longopts[@]"
|
||||
;;
|
||||
-*)
|
||||
_arguments -s : \
|
||||
"$_pacman_key_options[@]" \
|
||||
"$_pacman_key_shortopts[@]" \
|
||||
"$_pacman_key_longopts[@]"
|
||||
"$_key_shortopts[@]" \
|
||||
"$_key_longopts[@]"
|
||||
;;
|
||||
*)
|
||||
return 1
|
||||
@@ -664,7 +664,7 @@ _pacman_key() {
|
||||
esac
|
||||
}
|
||||
|
||||
_pacman_key_list() {
|
||||
_keys() {
|
||||
local keylist keys
|
||||
keylist=$(pacman-key --list-keys 2>/dev/null | awk '
|
||||
$1 == "pub" {
|
||||
@@ -733,7 +733,7 @@ _makepkg_longopts=(
|
||||
'--check[Run check() function in the PKGBUILD]'
|
||||
'--config[Use an alternate config file instead of '@sysconfdir@/makepkg.conf']: :_files'
|
||||
'--holdver[Do not update VCS sources]'
|
||||
'--key[Specify key to use for gpg signing instead of the default]: :_pacman_key_list'
|
||||
'--key[Specify key to use for gpg signing instead of the default]: :_keys'
|
||||
'--noarchive[Do not create package archive]'
|
||||
'--nocheck[Do not run the check() function in the PKGBUILD]'
|
||||
'--noprepare[Do not run the prepare() function in the PKGBUILD]'
|
||||
|
||||
@@ -1,38 +0,0 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# autodep.sh - functions for automatically adding depends/provides
|
||||
#
|
||||
# Copyright (c) 2021-2022 Pacman Development Team <pacman-dev@lists.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_AUTODEP_SH" ]] && return
|
||||
LIBMAKEPKG_AUTODEP_SH=1
|
||||
|
||||
MAKEPKG_LIBRARY=${MAKEPKG_LIBRARY:-'@libmakepkgdir@'}
|
||||
|
||||
declare -a autodep_functions
|
||||
|
||||
for lib in "$MAKEPKG_LIBRARY/autodep/"*.sh; do
|
||||
source "$lib"
|
||||
done
|
||||
|
||||
readonly -a autodep_functions
|
||||
|
||||
generate_autodeps() {
|
||||
for func in ${autodep_functions[@]}; do
|
||||
$func
|
||||
done
|
||||
}
|
||||
@@ -1,75 +0,0 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# library_depends.sh - Automatically add library requirements to depends
|
||||
#
|
||||
# Copyright (c) 2021-2022 Pacman Development Team <pacman-dev@lists.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_AUTODEP_LIBRARY_DEPENDS_SH" ]] && return
|
||||
LIBMAKEPKG_AUTODEP_LIBRARY_DEPENDS_SH=1
|
||||
|
||||
MAKEPKG_LIBRARY=${MAKEPKG_LIBRARY:-'@libmakepkgdir@'}
|
||||
|
||||
autodep_functions+=('library_depends')
|
||||
|
||||
library_depends() {
|
||||
if check_option "autodeps" "y"; then
|
||||
local dep filename libdeps libdir libpath prefix sofile
|
||||
declare -a libdeps
|
||||
|
||||
while IFS= read -rd '' filename; do
|
||||
for sofile in $(LC_ALL=C readelf -d $filename 2>/dev/null | sed -nr 's/.*Shared library: \[(.*)\].*/\1/p'); do
|
||||
# get the full path of the library
|
||||
libpath=$(ldd $filename | sed -nr "s/.$sofile => (.*) \(.*\)/\1/p")
|
||||
|
||||
# if ldd can not find the library, it is likely part of the package and not in filesystem
|
||||
if [[ -z $libpath ]]; then
|
||||
continue
|
||||
fi
|
||||
|
||||
# skip if the library is part of the package
|
||||
if [[ -e "$pkgdir/$libpath" ]]; then
|
||||
continue
|
||||
fi
|
||||
|
||||
# find the prefix for the dependency
|
||||
libpath=${libpath#/}
|
||||
libpath=${libpath%/*}
|
||||
|
||||
unset prefix
|
||||
for libdir in ${LIB_DIRS[@]}; do
|
||||
if [[ ${libdir/*:} == ${libpath} ]]; then
|
||||
prefix=${libdir/:*}
|
||||
fi
|
||||
done
|
||||
|
||||
if [[ -z ${prefix} ]]; then
|
||||
continue
|
||||
fi
|
||||
|
||||
# only add library dependency if it exists - this helps bootstraping dependencies
|
||||
if [[ $(run_pacman -T "$prefix:$sofile") ]]; then
|
||||
continue
|
||||
fi
|
||||
|
||||
libdeps+=("$prefix:$sofile")
|
||||
done
|
||||
|
||||
done < <(find "$pkgdir" -type f -perm -u+x -print0)
|
||||
|
||||
depends+=($(printf '%s\n' "${libdeps[@]}" | LC_ALL=C sort -u))
|
||||
fi
|
||||
}
|
||||
@@ -1,56 +0,0 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# library_provides.sh - Automatically add a packages libraries to provides
|
||||
#
|
||||
# Copyright (c) 2021-2022 Pacman Development Team <pacman-dev@lists.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_AUTODEP_LIBRARY_PROVIDES_SH" ]] && return
|
||||
LIBMAKEPKG_AUTODEP_LIBRARY_PROVIDES_SH=1
|
||||
|
||||
MAKEPKG_LIBRARY=${MAKEPKG_LIBRARY:-'@libmakepkgdir@'}
|
||||
|
||||
autodep_functions+=('library_provides')
|
||||
|
||||
library_provides() {
|
||||
if check_option "autodeps" "y"; then
|
||||
for lib in ${LIB_DIRS[@]}; do
|
||||
dir=${lib/*:}
|
||||
prefix=${lib/:*}
|
||||
|
||||
if [[ ! -d "$pkgdir/$dir" ]]; then
|
||||
continue;
|
||||
fi
|
||||
|
||||
mapfile -t filenames < <(find "$pkgdir/$dir" -maxdepth 1 -type f | LC_ALL=C sort)
|
||||
|
||||
for fn in "${filenames[@]}"; do
|
||||
# check we have a shared library
|
||||
if LC_ALL=C readelf -h "$fn" 2>/dev/null | grep -q '.*Type:.*DYN (Shared object file).*'; then
|
||||
# extract library soname
|
||||
local sofile=$(LC_ALL=C readelf -d "$fn" 2>/dev/null | sed -n 's/.*Library soname: \[\(.*\)\].*/\1/p')
|
||||
|
||||
if [[ -z "$sofile" ]]; then
|
||||
# the library has no soname
|
||||
continue
|
||||
fi
|
||||
|
||||
provides+=("$prefix:$sofile")
|
||||
fi
|
||||
done
|
||||
done
|
||||
fi
|
||||
}
|
||||
@@ -1,18 +0,0 @@
|
||||
libmakepkg_module = 'autodep'
|
||||
|
||||
sources = [
|
||||
'library_depends.sh.in',
|
||||
'library_provides.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
|
||||
@@ -3,7 +3,7 @@
|
||||
# buildenv.sh - functions for altering the build environment before
|
||||
# compilation
|
||||
#
|
||||
# Copyright (c) 2015-2022 Pacman Development Team <pacman-dev@lists.archlinux.org>
|
||||
# Copyright (c) 2015-2021 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
|
||||
@@ -22,25 +22,21 @@
|
||||
[[ -n "$LIBMAKEPKG_BUILDENV_SH" ]] && return
|
||||
LIBMAKEPKG_BUILDENV_SH=1
|
||||
|
||||
MAKEPKG_LIBRARY=${MAKEPKG_LIBRARY:-'@libmakepkgdir@'}
|
||||
LIBRARY=${LIBRARY:-'@libmakepkgdir@'}
|
||||
|
||||
declare -a buildenv_functions build_options
|
||||
buildenv_vars=('CPPFLAGS' 'CFLAGS' 'CXXFLAGS' 'LDFLAGS' 'MAKEFLAGS' 'CHOST')
|
||||
|
||||
for lib in "$MAKEPKG_LIBRARY/buildenv/"*.sh; do
|
||||
for lib in "$LIBRARY/buildenv/"*.sh; do
|
||||
source "$lib"
|
||||
done
|
||||
|
||||
readonly -a buildenv_functions buildenv_vars build_options
|
||||
readonly -a buildenv_functions build_options
|
||||
|
||||
prepare_buildenv() {
|
||||
# ensure this function runs first
|
||||
buildenv_buildflags
|
||||
|
||||
for func in ${buildenv_functions[@]}; do
|
||||
$func
|
||||
done
|
||||
|
||||
# ensure all necessary build variables are exported
|
||||
export ${buildenv_vars[@]}
|
||||
export CPPFLAGS CFLAGS CXXFLAGS LDFLAGS RUSTFLAGS MAKEFLAGS CHOST
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
#
|
||||
# buildflags.sh - Clear user-specified buildflags if requested
|
||||
#
|
||||
# Copyright (c) 2011-2022 Pacman Development Team <pacman-dev@lists.archlinux.org>
|
||||
# Copyright (c) 2011-2021 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
|
||||
@@ -21,14 +21,15 @@
|
||||
[[ -n "$LIBMAKEPKG_BUILDENV_BUILDFLAGS_SH" ]] && return
|
||||
LIBMAKEPKG_BUILDENV_BUILDFLAGS_SH=1
|
||||
|
||||
MAKEPKG_LIBRARY=${MAKEPKG_LIBRARY:-'@libmakepkgdir@'}
|
||||
LIBRARY=${LIBRARY:-'@libmakepkgdir@'}
|
||||
|
||||
source "$MAKEPKG_LIBRARY/util/option.sh"
|
||||
source "$LIBRARY/util/option.sh"
|
||||
|
||||
build_options+=('buildflags')
|
||||
buildenv_functions+=('buildenv_buildflags')
|
||||
|
||||
buildenv_buildflags() {
|
||||
if check_option "buildflags" "n"; then
|
||||
unset ${buildenv_vars[@]}
|
||||
unset CPPFLAGS CFLAGS DEBUG_CFLAGS CXXFLAGS DEBUG_CXXFLAGS LDFLAGS RUSTFLAGS DEBUG_RUSTFLAGS
|
||||
fi
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
# ccache - Cache compilations and reuse them to save time on repetitions
|
||||
# distcc - Distribute compilation of C and C++ across machines
|
||||
#
|
||||
# Copyright (c) 2007-2022 Pacman Development Team <pacman-dev@lists.archlinux.org>
|
||||
# Copyright (c) 2007-2021 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
|
||||
@@ -23,9 +23,9 @@
|
||||
[[ -n "$LIBMAKEPKG_BUILDENV_COMPILER_SH" ]] && return
|
||||
LIBMAKEPKG_BUILDENV_COMPILER_SH=1
|
||||
|
||||
MAKEPKG_LIBRARY=${MAKEPKG_LIBRARY:-'@libmakepkgdir@'}
|
||||
LIBRARY=${LIBRARY:-'@libmakepkgdir@'}
|
||||
|
||||
source "$MAKEPKG_LIBRARY/util/option.sh"
|
||||
source "$LIBRARY/util/option.sh"
|
||||
|
||||
build_options+=('ccache' 'distcc')
|
||||
buildenv_functions+=('buildenv_ccache' 'buildenv_distcc')
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
# debugflags.sh - Specify flags for building a package with debugging
|
||||
# symbols
|
||||
#
|
||||
# Copyright (c) 2012-2022 Pacman Development Team <pacman-dev@lists.archlinux.org>
|
||||
# Copyright (c) 2012-2021 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
|
||||
@@ -22,18 +22,19 @@
|
||||
[[ -n "$LIBMAKEPKG_BUILDENV_DEBUGFLAGS_SH" ]] && return
|
||||
LIBMAKEPKG_BUILDENV_DEBUGFLAGS_SH=1
|
||||
|
||||
MAKEPKG_LIBRARY=${MAKEPKG_LIBRARY:-'@libmakepkgdir@'}
|
||||
LIBRARY=${LIBRARY:-'@libmakepkgdir@'}
|
||||
|
||||
source "$MAKEPKG_LIBRARY/util/option.sh"
|
||||
source "$MAKEPKG_LIBRARY/util/util.sh"
|
||||
source "$LIBRARY/util/option.sh"
|
||||
|
||||
buildenv_functions+=('buildenv_debugflags')
|
||||
|
||||
buildenv_debugflags() {
|
||||
if check_option "debug" "y" && ! check_option "buildflags" "n"; then
|
||||
append_once DEBUG_CFLAGS "-ffile-prefix-map=$srcdir=${DBGSRCDIR:-/usr/src/debug}/${pkgbase}"
|
||||
append_once DEBUG_CXXFLAGS "-ffile-prefix-map=$srcdir=${DBGSRCDIR:-/usr/src/debug}/${pkgbase}"
|
||||
append_once CFLAGS "$DEBUG_CFLAGS"
|
||||
append_once CXXFLAGS "$DEBUG_CXXFLAGS"
|
||||
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}"
|
||||
DEBUG_RUSTFLAGS+=" --remap-path-prefix=$srcdir=${DBGSRCDIR:-/usr/src/debug}"
|
||||
CFLAGS+=" $DEBUG_CFLAGS"
|
||||
CXXFLAGS+=" $DEBUG_CXXFLAGS"
|
||||
RUSTFLAGS+=" $DEBUG_RUSTFLAGS"
|
||||
fi
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
# lto.sh - Specify flags for building a package with link-time
|
||||
# optimisation
|
||||
#
|
||||
# Copyright (c) 2021-2022 Pacman Development Team <pacman-dev@lists.archlinux.org>
|
||||
# Copyright (c) 2021 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
|
||||
@@ -22,18 +22,16 @@
|
||||
[[ -n "$LIBMAKEPKG_BUILDENV_LTO_SH" ]] && return
|
||||
LIBMAKEPKG_BUILDENV_LTO_SH=1
|
||||
|
||||
MAKEPKG_LIBRARY=${MAKEPKG_LIBRARY:-'@libmakepkgdir@'}
|
||||
LIBRARY=${LIBRARY:-'@libmakepkgdir@'}
|
||||
|
||||
source "$MAKEPKG_LIBRARY/util/option.sh"
|
||||
source "$MAKEPKG_LIBRARY/util/util.sh"
|
||||
source "$LIBRARY/util/option.sh"
|
||||
|
||||
build_options+=('lto')
|
||||
buildenv_functions+=('buildenv_lto')
|
||||
|
||||
buildenv_lto() {
|
||||
if check_option "lto" "y" && ! check_option "buildflags" "n"; then
|
||||
append_once CFLAGS "${LTOFLAGS:--flto}"
|
||||
append_once CXXFLAGS "${LTOFLAGS:--flto}"
|
||||
append_once LDFLAGS "${LTOFLAGS:--flto}"
|
||||
if check_option "lto" "y"; then
|
||||
CFLAGS+=" -flto"
|
||||
CXXFLAGS+=" -flto"
|
||||
fi
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
#
|
||||
# makeflags.sh - Clear user-specified makeflags if requested
|
||||
#
|
||||
# Copyright (c) 2007-2022 Pacman Development Team <pacman-dev@lists.archlinux.org>
|
||||
# Copyright (c) 2007-2021 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
|
||||
@@ -21,9 +21,9 @@
|
||||
[[ -n "$LIBMAKEPKG_BUILDENV_MAKEFLAGS_SH" ]] && return
|
||||
LIBMAKEPKG_BUILDENV_MAKEFLAGS_SH=1
|
||||
|
||||
MAKEPKG_LIBRARY=${MAKEPKG_LIBRARY:-'@libmakepkgdir@'}
|
||||
LIBRARY=${LIBRARY:-'@libmakepkgdir@'}
|
||||
|
||||
source "$MAKEPKG_LIBRARY/util/option.sh"
|
||||
source "$LIBRARY/util/option.sh"
|
||||
|
||||
build_options+=('makeflags')
|
||||
buildenv_functions+=('buildenv_makeflags')
|
||||
|
||||
@@ -6,7 +6,6 @@ sources = [
|
||||
'debugflags.sh.in',
|
||||
'lto.sh.in',
|
||||
'makeflags.sh.in',
|
||||
'rust.sh.in',
|
||||
]
|
||||
|
||||
foreach src : sources
|
||||
|
||||
@@ -1,37 +0,0 @@
|
||||
#!/usr/bin/bash
|
||||
#
|
||||
# rust.sh - Specify flags for building a package with rust
|
||||
#
|
||||
# Copyright (c) 2022 Pacman Development Team <pacman-dev@lists.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_RUST_SH" ]] && return
|
||||
LIBMAKEPKG_BUILDENV_RUST_SH=1
|
||||
|
||||
MAKEPKG_LIBRARY=${MAKEPKG_LIBRARY:-'@libmakepkgdir@'}
|
||||
|
||||
source "$MAKEPKG_LIBRARY/util/option.sh"
|
||||
source "$MAKEPKG_LIBRARY/util/util.sh"
|
||||
|
||||
buildenv_vars+=('RUSTFLAGS' 'DEBUG_RUSTFLAGS')
|
||||
buildenv_functions+=('buildenv_rust')
|
||||
|
||||
buildenv_rust() {
|
||||
if check_option "debug" "y" && ! check_option "buildflags" "n"; then
|
||||
append_once DEBUG_RUSTFLAGS "--remap-path-prefix=$srcdir=${DBGSRCDIR:-/usr/src/debug}/${pkgbase}"
|
||||
append_once RUSTFLAGS "$DEBUG_RUSTFLAGS"
|
||||
fi
|
||||
}
|
||||
@@ -2,7 +2,7 @@
|
||||
#
|
||||
# executable.sh - confirm presence of dependent executables
|
||||
#
|
||||
# Copyright (c) 2018-2022 Pacman Development Team <pacman-dev@lists.archlinux.org>
|
||||
# Copyright (c) 2018-2021 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
|
||||
@@ -21,11 +21,11 @@
|
||||
[[ -n "$LIBMAKEPKG_EXECUTABLE_SH" ]] && return
|
||||
LIBMAKEPKG_EXECUTABLE_SH=1
|
||||
|
||||
MAKEPKG_LIBRARY=${MAKEPKG_LIBRARY:-'@libmakepkgdir@'}
|
||||
LIBRARY=${LIBRARY:-'@libmakepkgdir@'}
|
||||
|
||||
declare -a executable_functions
|
||||
|
||||
for lib in "$MAKEPKG_LIBRARY/executable/"*.sh; do
|
||||
for lib in "$LIBRARY/executable/"*.sh; do
|
||||
source "$lib"
|
||||
done
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user