forked from mirrors/pacman
Compare commits
1 Commits
allan/priv
...
allan/pkgd
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f1c7341a81 |
@@ -16,10 +16,6 @@ default:
|
|||||||
python
|
python
|
||||||
fakeroot fakechroot
|
fakeroot fakechroot
|
||||||
meson
|
meson
|
||||||
artifacts:
|
|
||||||
when: always
|
|
||||||
paths:
|
|
||||||
- build/meson-logs/meson-log.txt
|
|
||||||
|
|
||||||
arch:
|
arch:
|
||||||
extends: .arch-test
|
extends: .arch-test
|
||||||
|
|||||||
@@ -3,4 +3,4 @@
|
|||||||
# This script serves as a trampoline for running scripts which depend on
|
# This script serves as a trampoline for running scripts which depend on
|
||||||
# libmakepkg with the libmakepkg within the build tree.
|
# libmakepkg with the libmakepkg within the build tree.
|
||||||
|
|
||||||
MAKEPKG_LIBRARY=@BUILDDIR@/libmakepkg exec @BASH@ -$- @REAL_PROGPATH@ "$@"
|
LIBRARY=@BUILDDIR@/libmakepkg exec @BASH@ -$- @REAL_PROGPATH@ "$@"
|
||||||
|
|||||||
@@ -169,6 +169,7 @@ HTML_EXTRA_FILES =
|
|||||||
HTML_COLORSTYLE_HUE = 220
|
HTML_COLORSTYLE_HUE = 220
|
||||||
HTML_COLORSTYLE_SAT = 100
|
HTML_COLORSTYLE_SAT = 100
|
||||||
HTML_COLORSTYLE_GAMMA = 80
|
HTML_COLORSTYLE_GAMMA = 80
|
||||||
|
HTML_TIMESTAMP = YES
|
||||||
HTML_DYNAMIC_MENUS = YES
|
HTML_DYNAMIC_MENUS = YES
|
||||||
HTML_DYNAMIC_SECTIONS = NO
|
HTML_DYNAMIC_SECTIONS = NO
|
||||||
HTML_INDEX_NUM_ENTRIES = 100
|
HTML_INDEX_NUM_ENTRIES = 100
|
||||||
@@ -238,6 +239,7 @@ USE_PDFLATEX = NO
|
|||||||
LATEX_BATCHMODE = NO
|
LATEX_BATCHMODE = NO
|
||||||
LATEX_HIDE_INDICES = NO
|
LATEX_HIDE_INDICES = NO
|
||||||
LATEX_BIB_STYLE = plain
|
LATEX_BIB_STYLE = plain
|
||||||
|
LATEX_TIMESTAMP = NO
|
||||||
LATEX_EMOJI_DIRECTORY =
|
LATEX_EMOJI_DIRECTORY =
|
||||||
#---------------------------------------------------------------------------
|
#---------------------------------------------------------------------------
|
||||||
# Configuration options related to the RTF output
|
# Configuration options related to the RTF output
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ depends=('glibc')
|
|||||||
makedepends=('ed')
|
makedepends=('ed')
|
||||||
optdepends=('ed: for "patch -e" functionality')
|
optdepends=('ed: for "patch -e" functionality')
|
||||||
source=("ftp://ftp.gnu.org/gnu/$pkgname/$pkgname-$pkgver.tar.xz"{,.sig})
|
source=("ftp://ftp.gnu.org/gnu/$pkgname/$pkgname-$pkgver.tar.xz"{,.sig})
|
||||||
sha256sums=('9124ba46db0abd873d0995c2ca880e81252676bb6c03e0a37dfc5f608a9b0ceb'
|
md5sums=('e9ae5393426d3ad783a300a338c09b72'
|
||||||
'SKIP')
|
'SKIP')
|
||||||
|
|
||||||
build() {
|
build() {
|
||||||
|
|||||||
@@ -336,13 +336,6 @@ function.
|
|||||||
the optional functions listed below. The packaging stage is run using
|
the optional functions listed below. The packaging stage is run using
|
||||||
fakeroot to ensure correct file permissions in the resulting package.
|
fakeroot to ensure correct file permissions in the resulting package.
|
||||||
All other functions will be run as the user calling makepkg.
|
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*::
|
*prepare() Function*::
|
||||||
An optional `prepare()` function can be specified in which operations to
|
An optional `prepare()` function can be specified in which operations to
|
||||||
@@ -350,19 +343,16 @@ function.
|
|||||||
function is run after the source extraction and before the `build()`
|
function is run after the source extraction and before the `build()`
|
||||||
function. The `prepare()` function is skipped when source extraction
|
function. The `prepare()` function is skipped when source extraction
|
||||||
is skipped.
|
is skipped.
|
||||||
This function is run inside `$srcdir`.
|
|
||||||
|
|
||||||
*build() Function*::
|
*build() Function*::
|
||||||
The optional `build()` function is used to compile and/or adjust the source
|
The optional `build()` function is used to compile and/or adjust the source
|
||||||
files in preparation to be installed by the `package()` function.
|
files in preparation to be installed by the `package()` function.
|
||||||
This function is run inside `$srcdir`.
|
|
||||||
|
|
||||||
*check() Function*::
|
*check() Function*::
|
||||||
An optional `check()` function can be specified in which a package's
|
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
|
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
|
`package()` functions. Be sure any exotic commands used are covered by the
|
||||||
`checkdepends` array.
|
`checkdepends` array.
|
||||||
This function is run inside `$srcdir`.
|
|
||||||
|
|
||||||
All of the above variables such as `$pkgname` and `$pkgver` are available for
|
All of the above variables such as `$pkgname` and `$pkgver` are available for
|
||||||
use in the packaging functions. In addition, makepkg defines the following
|
use in the packaging functions. In addition, makepkg defines the following
|
||||||
@@ -372,6 +362,7 @@ variables:
|
|||||||
This contains the directory where makepkg extracts, or copies, all source
|
This contains the directory where makepkg extracts, or copies, all source
|
||||||
files.
|
files.
|
||||||
+
|
+
|
||||||
|
All of the packaging functions defined above are run starting inside `$srcdir`
|
||||||
|
|
||||||
*pkgdir*::
|
*pkgdir*::
|
||||||
This contains the directory where makepkg bundles the installed package.
|
This contains the directory where makepkg bundles the installed package.
|
||||||
@@ -473,9 +464,6 @@ Currently makepkg supports the Bazaar, Git, Subversion, Fossil and Mercurial
|
|||||||
version control systems. For other version control systems, manual cloning of
|
version control systems. For other version control systems, manual cloning of
|
||||||
upstream repositories must be done in the `prepare()` function.
|
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:
|
The source URL is divided into four components:
|
||||||
|
|
||||||
*directory*::
|
*directory*::
|
||||||
|
|||||||
@@ -18,6 +18,7 @@ Current maintainers:
|
|||||||
|
|
||||||
* Allan McRae <allan@archlinux.org>
|
* Allan McRae <allan@archlinux.org>
|
||||||
* Andrew Gregory <andrew.gregory.8@gmail.com>
|
* Andrew Gregory <andrew.gregory.8@gmail.com>
|
||||||
|
* Eli Schwartz <eschwartz@archlinux.org>
|
||||||
* Morgan Adamiec <morganamilo@archlinux.org>
|
* Morgan Adamiec <morganamilo@archlinux.org>
|
||||||
|
|
||||||
Past major contributors:
|
Past major contributors:
|
||||||
@@ -29,7 +30,6 @@ Past major contributors:
|
|||||||
* Xavier Chantry <shiningxc@gmail.com>
|
* Xavier Chantry <shiningxc@gmail.com>
|
||||||
* Nagy Gabor <ngaba@bibl.u-szeged.hu>
|
* Nagy Gabor <ngaba@bibl.u-szeged.hu>
|
||||||
* Dave Reisner <dreisner@archlinux.org>
|
* Dave Reisner <dreisner@archlinux.org>
|
||||||
* Eli Schwartz <eschwartz@archlinux.org>
|
|
||||||
|
|
||||||
For additional contributors, use `git shortlog -s` on the pacman.git
|
For additional contributors, use `git shortlog -s` on the pacman.git
|
||||||
repository.
|
repository.
|
||||||
|
|||||||
@@ -85,7 +85,7 @@ Example PKGBUILD
|
|||||||
license=('PerlArtistic' 'GPL')
|
license=('PerlArtistic' 'GPL')
|
||||||
depends=('perl')
|
depends=('perl')
|
||||||
source=("http://search.cpan.org/CPAN/authors/id/S/SH/SHERZODR/Config-Simple-${pkgver}.tar.gz")
|
source=("http://search.cpan.org/CPAN/authors/id/S/SH/SHERZODR/Config-Simple-${pkgver}.tar.gz")
|
||||||
sha256sums=('dd9995706f0f9384a15ccffe116c3b6e22f42ba2e58d8f24ed03c4a0e386edb4')
|
md5sums=('f014aec54f0a1e2e880d317180fce502')
|
||||||
_distname="Config-Simple"
|
_distname="Config-Simple"
|
||||||
|
|
||||||
# template start; name=perl-module; version=1.0;
|
# template start; name=perl-module; version=1.0;
|
||||||
|
|||||||
@@ -146,9 +146,6 @@ Options
|
|||||||
*-C, \--cleanbuild*::
|
*-C, \--cleanbuild*::
|
||||||
Remove the $srcdir before building the package.
|
Remove the $srcdir before building the package.
|
||||||
|
|
||||||
*-D* <dir>, *\--dir* <dir> ::
|
|
||||||
Change to directory <dir> before reading the PKGBUILD or doing anything else.
|
|
||||||
|
|
||||||
*\--allsource*::
|
*\--allsource*::
|
||||||
Do not actually build the package, but build a source-only tarball that
|
Do not actually build the package, but build a source-only tarball that
|
||||||
includes all sources, including those that are normally downloaded via
|
includes all sources, including those that are normally downloaded via
|
||||||
@@ -171,9 +168,6 @@ Options
|
|||||||
*\--noprepare*::
|
*\--noprepare*::
|
||||||
Do not run the prepare() function in the PKGBUILD.
|
Do not run the prepare() function in the PKGBUILD.
|
||||||
|
|
||||||
*\--noverify*::
|
|
||||||
Do not run the verify() function in the PKGBUILD.
|
|
||||||
|
|
||||||
*\--sign*::
|
*\--sign*::
|
||||||
Sign the resulting package with gpg, overriding the setting in
|
Sign the resulting package with gpg, overriding the setting in
|
||||||
linkman:makepkg.conf[5].
|
linkman:makepkg.conf[5].
|
||||||
@@ -233,9 +227,6 @@ before building.
|
|||||||
|
|
||||||
Environment Variables
|
Environment Variables
|
||||||
---------------------
|
---------------------
|
||||||
**MAKEPKG_LIBRARY**="/path/to/directory"::
|
|
||||||
Use an alternative libmakepkg path instead of the {libmakepkgdir} default.
|
|
||||||
|
|
||||||
**PACMAN**::
|
**PACMAN**::
|
||||||
The command that will be used to check for missing dependencies and to
|
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'
|
install and remove packages. Pacman's '-Qq', '-Rns', '-S', '-T', and '-U'
|
||||||
|
|||||||
@@ -35,7 +35,6 @@ asciidoc_opts = [
|
|||||||
'-a', 'sysconfdir=@0@'.format(SYSCONFDIR),
|
'-a', 'sysconfdir=@0@'.format(SYSCONFDIR),
|
||||||
'-a', 'datarootdir=@0@'.format(DATAROOTDIR),
|
'-a', 'datarootdir=@0@'.format(DATAROOTDIR),
|
||||||
'-a', 'rootdir=@0@'.format(ROOTDIR),
|
'-a', 'rootdir=@0@'.format(ROOTDIR),
|
||||||
'-a', 'libmakepkgdir=@0@'.format(LIBMAKEPKGDIR),
|
|
||||||
]
|
]
|
||||||
|
|
||||||
html_targets = []
|
html_targets = []
|
||||||
|
|||||||
@@ -237,12 +237,10 @@ Transaction Options (apply to '-S', '-R' and '-U')
|
|||||||
Specify a printf-like format to control the output of the '\--print'
|
Specify a printf-like format to control the output of the '\--print'
|
||||||
operation. The possible attributes are: "%a" for arch, "%b" for
|
operation. The possible attributes are: "%a" for arch, "%b" for
|
||||||
builddate, "%d" for description, "%e" for pkgbase, "%f" for filename,
|
builddate, "%d" for description, "%e" for pkgbase, "%f" for filename,
|
||||||
"%g" for base64 encoded PGP signature, "%h" for sha256sum, "%m" for
|
"%g" for base64 encoded PGP signature, "%h" for sha256sum, "%n" for
|
||||||
md5sum, "%n" for pkgname, "%p" for packager, "%v" for pkgver, "%l" for
|
pkgname, "%p" for packager, "%v" for pkgver, "%l" for location, "%r"
|
||||||
location, "%r" for repository, "%s" for size, "%C" for checkdepends,
|
for repository, "%s" for size, "%C" for checkdepends, "%D" for depends
|
||||||
"%D" for depends, "%G" for groups, "%H" for conflicts, "%L" for
|
and "%M" for makedepends.
|
||||||
licenses, "%M" for makedepends, "%O" for optional depends, "%P" for
|
|
||||||
provides and "%R" for replaces.
|
|
||||||
Implies '\--print'.
|
Implies '\--print'.
|
||||||
|
|
||||||
|
|
||||||
@@ -456,11 +454,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.
|
system upgrade and install/upgrade the "foo" package in the same operation.
|
||||||
|
|
||||||
*-y, \--refresh*::
|
*-y, \--refresh*::
|
||||||
Download a fresh copy of the master package databases '(repo.db)' from the
|
Download a fresh copy of the master package database from the server(s)
|
||||||
server(s) defined in linkman:pacman.conf[5]. This should typically be used
|
defined in linkman:pacman.conf[5]. This should typically be used each time
|
||||||
each time you use '\--sysupgrade' or '-u'. Passing two '\--refresh' or '-y'
|
you use '\--sysupgrade' or '-u'. Passing two '\--refresh' or '-y' flags
|
||||||
flags will force a refresh of all package databases, even if they appear to
|
will force a refresh of all package databases, even if they appear to be
|
||||||
be up-to-date.
|
up-to-date.
|
||||||
|
|
||||||
|
|
||||||
Database Options (apply to '-D')[[QO]]
|
Database Options (apply to '-D')[[QO]]
|
||||||
@@ -489,8 +487,8 @@ Database Options (apply to '-D')[[QO]]
|
|||||||
File Options (apply to '-F')[[FO]]
|
File Options (apply to '-F')[[FO]]
|
||||||
----------------------------------
|
----------------------------------
|
||||||
*-y, --refresh*::
|
*-y, --refresh*::
|
||||||
Download fresh package file databases '(repo.files)' from the server.
|
Download fresh package databases from the server. Use twice to force a
|
||||||
Use twice to force a refresh even if databases are up to date.
|
refresh even if databases are up to date.
|
||||||
|
|
||||||
*-l, \--list*::
|
*-l, \--list*::
|
||||||
List the files owned by the queried package.
|
List the files owned by the queried package.
|
||||||
|
|||||||
@@ -207,10 +207,6 @@ Options
|
|||||||
positive integer. If this config option is not set then only one download
|
positive integer. If this config option is not set then only one download
|
||||||
stream is used (i.e. downloads happen sequentially).
|
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
|
Repository Sections
|
||||||
-------------------
|
-------------------
|
||||||
@@ -244,12 +240,6 @@ number.
|
|||||||
general configuration options. Wildcards in the specified paths will get
|
general configuration options. Wildcards in the specified paths will get
|
||||||
expanded based on linkman:glob[7] rules.
|
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::
|
*Server =* url::
|
||||||
A full URL to a location where the database, packages, and signatures (if
|
A full URL to a location where the database, packages, and signatures (if
|
||||||
available) for this repository can be found.
|
available) for this repository can be found.
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ DLAGENTS=('file::/usr/bin/curl -qgC - -o %o %u'
|
|||||||
|
|
||||||
#-- The package required by makepkg to download VCS sources
|
#-- The package required by makepkg to download VCS sources
|
||||||
# Format: 'protocol::package'
|
# Format: 'protocol::package'
|
||||||
VCSCLIENTS=('bzr::breezy'
|
VCSCLIENTS=('bzr::bzr'
|
||||||
'fossil::fossil'
|
'fossil::fossil'
|
||||||
'git::git'
|
'git::git'
|
||||||
'hg::mercurial'
|
'hg::mercurial'
|
||||||
|
|||||||
@@ -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,
|
"filesystem: %o package: %o\n"), filename, lsbuf.st_mode & mask,
|
||||||
entrymode & mask);
|
entrymode & mask);
|
||||||
alpm_logaction(handle, ALPM_CALLER_PREFIX,
|
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,
|
"filesystem: %o package: %o\n", filename, lsbuf.st_mode & mask,
|
||||||
entrymode & 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,
|
"filesystem: %u:%u package: %u:%u\n"), filename,
|
||||||
lsbuf.st_uid, lsbuf.st_gid, entryuid, entrygid);
|
lsbuf.st_uid, lsbuf.st_gid, entryuid, entrygid);
|
||||||
alpm_logaction(handle, ALPM_CALLER_PREFIX,
|
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,
|
"filesystem: %u:%u package: %u:%u\n", filename,
|
||||||
lsbuf.st_uid, lsbuf.st_gid, entryuid, entrygid);
|
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,
|
static int commit_single_pkg(alpm_handle_t *handle, alpm_pkg_t *newpkg,
|
||||||
size_t pkg_current, size_t pkg_count)
|
size_t pkg_current, size_t pkg_count)
|
||||||
{
|
{
|
||||||
int ret = 0, errors = 0;
|
int i, ret = 0, errors = 0;
|
||||||
int is_upgrade = 0;
|
int is_upgrade = 0;
|
||||||
alpm_pkg_t *oldpkg = NULL;
|
alpm_pkg_t *oldpkg = NULL;
|
||||||
alpm_db_t *db = handle->db_local;
|
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 */
|
/* call PROGRESS once with 0 percent, as we sort-of skip that here */
|
||||||
PROGRESS(handle, progress, newpkg->name, 0, pkg_count, pkg_current);
|
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;
|
int percent;
|
||||||
|
|
||||||
if(newpkg->size != 0) {
|
if(newpkg->size != 0) {
|
||||||
|
|||||||
@@ -93,16 +93,34 @@ cleanup:
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* check current state and free all resources including storage locks */
|
|
||||||
int SYMEXPORT alpm_release(alpm_handle_t *myhandle)
|
int SYMEXPORT alpm_release(alpm_handle_t *myhandle)
|
||||||
{
|
{
|
||||||
|
int ret = 0;
|
||||||
|
alpm_db_t *db;
|
||||||
|
|
||||||
CHECK_HANDLE(myhandle, return -1);
|
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_unlock(myhandle);
|
||||||
_alpm_handle_free(myhandle);
|
_alpm_handle_free(myhandle);
|
||||||
|
|
||||||
return 0;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
const char SYMEXPORT *alpm_version(void)
|
const char SYMEXPORT *alpm_version(void)
|
||||||
|
|||||||
@@ -488,7 +488,7 @@ typedef struct _alpm_siglist_t {
|
|||||||
* Check the PGP signature for the given package file.
|
* Check the PGP signature for the given package file.
|
||||||
* @param pkg the package to check
|
* @param pkg the package to check
|
||||||
* @param siglist a pointer to storage for signature results
|
* @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);
|
int alpm_pkg_check_pgp_signature(alpm_pkg_t *pkg, alpm_siglist_t *siglist);
|
||||||
|
|
||||||
@@ -496,7 +496,7 @@ int alpm_pkg_check_pgp_signature(alpm_pkg_t *pkg, alpm_siglist_t *siglist);
|
|||||||
* Check the PGP signature for the given database.
|
* Check the PGP signature for the given database.
|
||||||
* @param db the database to check
|
* @param db the database to check
|
||||||
* @param siglist a pointer to storage for signature results
|
* @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);
|
int alpm_db_check_pgp_signature(alpm_db_t *db, alpm_siglist_t *siglist);
|
||||||
|
|
||||||
@@ -600,10 +600,16 @@ typedef struct _alpm_depmissing_t {
|
|||||||
|
|
||||||
/** A conflict that has occurred between two packages. */
|
/** A conflict that has occurred between two packages. */
|
||||||
typedef struct _alpm_conflict_t {
|
typedef struct _alpm_conflict_t {
|
||||||
/** The first package */
|
/** Hash of the first package name
|
||||||
alpm_pkg_t *package1;
|
* (used internally to speed up conflict checks) */
|
||||||
/** The second package */
|
unsigned long package1_hash;
|
||||||
alpm_pkg_t *package2;
|
/** 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 */
|
/** The conflict */
|
||||||
alpm_depend_t *reason;
|
alpm_depend_t *reason;
|
||||||
} alpm_conflict_t;
|
} alpm_conflict_t;
|
||||||
@@ -1343,34 +1349,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);
|
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 */
|
/* End of server accessors */
|
||||||
/** @} */
|
/** @} */
|
||||||
|
|
||||||
@@ -1870,28 +1848,6 @@ int alpm_option_set_gpgdir(alpm_handle_t *handle, const char *gpgdir);
|
|||||||
/** @} */
|
/** @} */
|
||||||
|
|
||||||
|
|
||||||
/** @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 */
|
|
||||||
/** @} */
|
|
||||||
|
|
||||||
|
|
||||||
/** @name Accessors for use syslog
|
/** @name Accessors for use syslog
|
||||||
*
|
*
|
||||||
* This controls whether libalpm will also use the syslog. Even if this option
|
* This controls whether libalpm will also use the syslog. Even if this option
|
||||||
@@ -2951,12 +2907,6 @@ const char *alpm_version(void);
|
|||||||
* */
|
* */
|
||||||
int alpm_capabilities(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 */
|
/* End of libalpm_misc */
|
||||||
/** @} */
|
/** @} */
|
||||||
|
|
||||||
|
|||||||
@@ -417,7 +417,6 @@ alpm_list_t SYMEXPORT *alpm_list_reverse(alpm_list_t *list)
|
|||||||
while(lp) {
|
while(lp) {
|
||||||
if(alpm_list_append(&newlist, lp->data) == NULL) {
|
if(alpm_list_append(&newlist, lp->data) == NULL) {
|
||||||
alpm_list_free(newlist);
|
alpm_list_free(newlist);
|
||||||
list->prev = backup;
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
lp = lp->prev;
|
lp = lp->prev;
|
||||||
|
|||||||
@@ -250,6 +250,7 @@ static int _cache_changelog_close(const alpm_pkg_t UNUSED *pkg, void *fp)
|
|||||||
*/
|
*/
|
||||||
static struct archive *_cache_mtree_open(alpm_pkg_t *pkg)
|
static struct archive *_cache_mtree_open(alpm_pkg_t *pkg)
|
||||||
{
|
{
|
||||||
|
int r;
|
||||||
struct archive *mtree;
|
struct archive *mtree;
|
||||||
|
|
||||||
alpm_db_t *db = alpm_pkg_get_db(pkg);
|
alpm_db_t *db = alpm_pkg_get_db(pkg);
|
||||||
@@ -267,7 +268,7 @@ static struct archive *_cache_mtree_open(alpm_pkg_t *pkg)
|
|||||||
_alpm_archive_read_support_filter_all(mtree);
|
_alpm_archive_read_support_filter_all(mtree);
|
||||||
archive_read_support_format_mtree(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"),
|
_alpm_log(pkg->handle, ALPM_LOG_ERROR, _("error while reading file %s: %s\n"),
|
||||||
mtfile, archive_error_string(mtree));
|
mtfile, archive_error_string(mtree));
|
||||||
_alpm_archive_read_free(mtree);
|
_alpm_archive_read_free(mtree);
|
||||||
|
|||||||
@@ -683,7 +683,9 @@ pkg_invalid:
|
|||||||
error:
|
error:
|
||||||
_alpm_pkg_free(newpkg);
|
_alpm_pkg_free(newpkg);
|
||||||
_alpm_archive_read_free(archive);
|
_alpm_archive_read_free(archive);
|
||||||
|
if(fd >= 0) {
|
||||||
close(fd);
|
close(fd);
|
||||||
|
}
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -189,18 +189,6 @@ int SYMEXPORT alpm_db_update(alpm_handle_t *handle, alpm_list_t *dbs, int force)
|
|||||||
MALLOC(payload->filepath, len,
|
MALLOC(payload->filepath, len,
|
||||||
FREE(payload); GOTO_ERR(handle, ALPM_ERR_MEMORY, cleanup));
|
FREE(payload); GOTO_ERR(handle, ALPM_ERR_MEMORY, cleanup));
|
||||||
snprintf(payload->filepath, len, "%s%s", db->treename, dbext);
|
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->handle = handle;
|
||||||
payload->force = dbforce;
|
payload->force = dbforce;
|
||||||
payload->unlink_on_fail = 1;
|
payload->unlink_on_fail = 1;
|
||||||
|
|||||||
@@ -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);
|
CALLOC(conflict, 1, sizeof(alpm_conflict_t), return NULL);
|
||||||
|
|
||||||
ASSERT(_alpm_pkg_dup(pkg1, &conflict->package1) == 0, goto error);
|
conflict->package1_hash = pkg1->name_hash;
|
||||||
ASSERT(_alpm_pkg_dup(pkg2, &conflict->package2) == 0, goto error);
|
conflict->package2_hash = pkg2->name_hash;
|
||||||
|
STRDUP(conflict->package1, pkg1->name, goto error);
|
||||||
|
STRDUP(conflict->package2, pkg2->name, goto error);
|
||||||
conflict->reason = reason;
|
conflict->reason = reason;
|
||||||
|
|
||||||
return conflict;
|
return conflict;
|
||||||
@@ -64,9 +66,8 @@ error:
|
|||||||
void SYMEXPORT alpm_conflict_free(alpm_conflict_t *conflict)
|
void SYMEXPORT alpm_conflict_free(alpm_conflict_t *conflict)
|
||||||
{
|
{
|
||||||
ASSERT(conflict != NULL, return);
|
ASSERT(conflict != NULL, return);
|
||||||
_alpm_pkg_free(conflict->package1);
|
FREE(conflict->package2);
|
||||||
_alpm_pkg_free(conflict->package2);
|
FREE(conflict->package1);
|
||||||
|
|
||||||
FREE(conflict);
|
FREE(conflict);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -78,8 +79,10 @@ alpm_conflict_t *_alpm_conflict_dup(const alpm_conflict_t *conflict)
|
|||||||
alpm_conflict_t *newconflict;
|
alpm_conflict_t *newconflict;
|
||||||
CALLOC(newconflict, 1, sizeof(alpm_conflict_t), return NULL);
|
CALLOC(newconflict, 1, sizeof(alpm_conflict_t), return NULL);
|
||||||
|
|
||||||
ASSERT(_alpm_pkg_dup(conflict->package1, &newconflict->package1) == 0, goto error);
|
newconflict->package1_hash = conflict->package1_hash;
|
||||||
ASSERT(_alpm_pkg_dup(conflict->package2, &newconflict->package2) == 0, goto error);
|
newconflict->package2_hash = conflict->package2_hash;
|
||||||
|
STRDUP(newconflict->package1, conflict->package1, goto error);
|
||||||
|
STRDUP(newconflict->package2, conflict->package2, goto error);
|
||||||
newconflict->reason = conflict->reason;
|
newconflict->reason = conflict->reason;
|
||||||
|
|
||||||
return newconflict;
|
return newconflict;
|
||||||
@@ -102,10 +105,10 @@ static int conflict_isin(alpm_conflict_t *needle, alpm_list_t *haystack)
|
|||||||
alpm_list_t *i;
|
alpm_list_t *i;
|
||||||
for(i = haystack; i; i = i->next) {
|
for(i = haystack; i; i = i->next) {
|
||||||
alpm_conflict_t *conflict = i->data;
|
alpm_conflict_t *conflict = i->data;
|
||||||
if(needle->package1->name_hash == conflict->package1->name_hash
|
if(needle->package1_hash == conflict->package1_hash
|
||||||
&& needle->package2->name_hash == conflict->package2->name_hash
|
&& needle->package2_hash == conflict->package2_hash
|
||||||
&& strcmp(needle->package1->name, conflict->package1->name) == 0
|
&& strcmp(needle->package1, conflict->package1) == 0
|
||||||
&& strcmp(needle->package2->name, conflict->package2->name) == 0) {
|
&& strcmp(needle->package2, conflict->package2) == 0) {
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -131,26 +131,6 @@ int SYMEXPORT alpm_db_unregister(alpm_db_t *db)
|
|||||||
return 0;
|
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)
|
alpm_list_t SYMEXPORT *alpm_db_get_servers(const alpm_db_t *db)
|
||||||
{
|
{
|
||||||
ASSERT(db != NULL, return NULL);
|
ASSERT(db != NULL, return NULL);
|
||||||
@@ -184,25 +164,6 @@ static char *sanitize_url(const char *url)
|
|||||||
return newurl;
|
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)
|
int SYMEXPORT alpm_db_add_server(alpm_db_t *db, const char *url)
|
||||||
{
|
{
|
||||||
char *newurl;
|
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));
|
ASSERT(url != NULL && strlen(url) != 0, RET_ERR(db->handle, ALPM_ERR_WRONG_ARGS, -1));
|
||||||
|
|
||||||
newurl = sanitize_url(url);
|
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);
|
db->servers = alpm_list_add(db->servers, newurl);
|
||||||
_alpm_log(db->handle, ALPM_LOG_DEBUG, "adding new server URL to database '%s': %s\n",
|
_alpm_log(db->handle, ALPM_LOG_DEBUG, "adding new server URL to database '%s': %s\n",
|
||||||
db->treename, newurl);
|
db->treename, newurl);
|
||||||
@@ -222,32 +184,6 @@ int SYMEXPORT alpm_db_add_server(alpm_db_t *db, const char *url)
|
|||||||
return 0;
|
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)
|
int SYMEXPORT alpm_db_remove_server(alpm_db_t *db, const char *url)
|
||||||
{
|
{
|
||||||
char *newurl, *vdata = NULL;
|
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));
|
ASSERT(url != NULL && strlen(url) != 0, RET_ERR(db->handle, ALPM_ERR_WRONG_ARGS, -1));
|
||||||
|
|
||||||
newurl = sanitize_url(url);
|
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);
|
db->servers = alpm_list_remove_str(db->servers, newurl, &vdata);
|
||||||
|
|
||||||
@@ -390,7 +328,6 @@ void _alpm_db_free(alpm_db_t *db)
|
|||||||
/* cleanup pkgcache */
|
/* cleanup pkgcache */
|
||||||
_alpm_db_free_pkgcache(db);
|
_alpm_db_free_pkgcache(db);
|
||||||
/* cleanup server list */
|
/* cleanup server list */
|
||||||
FREELIST(db->cache_servers);
|
|
||||||
FREELIST(db->servers);
|
FREELIST(db->servers);
|
||||||
FREE(db->_path);
|
FREE(db->_path);
|
||||||
FREE(db->treename);
|
FREE(db->treename);
|
||||||
|
|||||||
@@ -69,7 +69,6 @@ struct _alpm_db_t {
|
|||||||
char *_path;
|
char *_path;
|
||||||
alpm_pkghash_t *pkgcache;
|
alpm_pkghash_t *pkgcache;
|
||||||
alpm_list_t *grpcache;
|
alpm_list_t *grpcache;
|
||||||
alpm_list_t *cache_servers;
|
|
||||||
alpm_list_t *servers;
|
alpm_list_t *servers;
|
||||||
const struct db_operations *ops;
|
const struct db_operations *ops;
|
||||||
|
|
||||||
|
|||||||
@@ -111,10 +111,6 @@ static alpm_list_t *mount_point_list(alpm_handle_t *handle)
|
|||||||
}
|
}
|
||||||
|
|
||||||
while((mnt = getmntent(fp))) {
|
while((mnt = getmntent(fp))) {
|
||||||
if(mnt->mnt_dir == NULL) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
CALLOC(mp, 1, sizeof(alpm_mountpoint_t), RET_ERR(handle, ALPM_ERR_MEMORY, NULL));
|
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));
|
STRDUP(mp->mount_dir, mnt->mnt_dir, free(mp); RET_ERR(handle, ALPM_ERR_MEMORY, NULL));
|
||||||
mp->mount_dir_len = strlen(mp->mount_dir);
|
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) {
|
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));
|
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));
|
STRDUP(mp->mount_dir, mnt->mnt_mountp, free(mp); RET_ERR(handle, ALPM_ERR_MEMORY, NULL));
|
||||||
mp->mount_dir_len = strlen(mp->mount_dir);
|
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++) {
|
for(; entries-- > 0; fsp++) {
|
||||||
if(fsp->f_mntonname == NULL) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
CALLOC(mp, 1, sizeof(alpm_mountpoint_t), RET_ERR(handle, ALPM_ERR_MEMORY, NULL));
|
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));
|
STRDUP(mp->mount_dir, fsp->f_mntonname, free(mp); RET_ERR(handle, ALPM_ERR_MEMORY, NULL));
|
||||||
mp->mount_dir_len = strlen(mp->mount_dir);
|
mp->mount_dir_len = strlen(mp->mount_dir);
|
||||||
|
|||||||
@@ -28,9 +28,7 @@
|
|||||||
#include <sys/time.h>
|
#include <sys/time.h>
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
#include <sys/wait.h>
|
|
||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
#include <pwd.h>
|
|
||||||
|
|
||||||
#ifdef HAVE_NETINET_IN_H
|
#ifdef HAVE_NETINET_IN_H
|
||||||
#include <netinet/in.h> /* IPPROTO_TCP */
|
#include <netinet/in.h> /* IPPROTO_TCP */
|
||||||
@@ -50,145 +48,6 @@
|
|||||||
#include "log.h"
|
#include "log.h"
|
||||||
#include "util.h"
|
#include "util.h"
|
||||||
#include "handle.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
|
#ifdef HAVE_LIBCURL
|
||||||
|
|
||||||
@@ -196,16 +55,16 @@ static FILE *create_tempfile(struct dload_payload *payload, const char *localpat
|
|||||||
#define HOSTNAME_SIZE 256
|
#define HOSTNAME_SIZE 256
|
||||||
|
|
||||||
static int curl_add_payload(alpm_handle_t *handle, CURLM *curlm,
|
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);
|
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
|
/* number of "soft" errors required to blacklist a server, set to 0 to disable
|
||||||
* server blacklisting */
|
* server blacklisting */
|
||||||
const int server_error_limit = 3;
|
const unsigned int server_error_limit = 3;
|
||||||
|
|
||||||
struct server_error_count {
|
struct server_error_count {
|
||||||
char server[HOSTNAME_SIZE];
|
char server[HOSTNAME_SIZE];
|
||||||
int errors;
|
unsigned int errors;
|
||||||
};
|
};
|
||||||
|
|
||||||
static struct server_error_count *find_server_errors(alpm_handle_t *handle, const char *server)
|
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)
|
static int should_skip_server(alpm_handle_t *handle, const char *server)
|
||||||
{
|
{
|
||||||
struct server_error_count *h;
|
struct server_error_count *h;
|
||||||
if(server_error_limit && (h = find_server_errors(handle, server)) ) {
|
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;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* only skip for hard errors */
|
static void server_increment_error(alpm_handle_t *handle, const char *server, int count)
|
||||||
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)
|
|
||||||
{
|
{
|
||||||
struct server_error_count *h;
|
struct server_error_count *h;
|
||||||
if(server_error_limit
|
if(server_error_limit
|
||||||
&& (h = find_server_errors(handle, server))
|
&& (h = find_server_errors(handle, server))
|
||||||
&& !should_skip_server(handle, server) ) {
|
&& !should_skip_server(handle, server) ) {
|
||||||
h->errors++;
|
h->errors += count;
|
||||||
|
|
||||||
if(should_skip_server(handle, server)) {
|
if(should_skip_server(handle, server)) {
|
||||||
_alpm_log(handle, ALPM_LOG_WARNING,
|
_alpm_log(handle, ALPM_LOG_WARNING,
|
||||||
@@ -272,46 +119,37 @@ static void server_soft_error(alpm_handle_t *handle, const char *server)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* immediate block for both servers and cache servers */
|
static void server_soft_error(alpm_handle_t *handle, const char *server)
|
||||||
|
{
|
||||||
|
server_increment_error(handle, server, 1);
|
||||||
|
}
|
||||||
|
|
||||||
static void server_hard_error(alpm_handle_t *handle, const char *server)
|
static void server_hard_error(alpm_handle_t *handle, const char *server)
|
||||||
{
|
{
|
||||||
struct server_error_count *h;
|
server_increment_error(handle, server, server_error_limit);
|
||||||
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);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static const char *payload_next_server(struct dload_payload *payload)
|
static const char *get_filename(const char *url)
|
||||||
{
|
{
|
||||||
while(payload->cache_servers
|
char *filename = strrchr(url, '/');
|
||||||
&& should_skip_cache_server(payload->handle, payload->cache_servers->data)) {
|
if(filename != NULL) {
|
||||||
payload->cache_servers = payload->cache_servers->next;
|
return filename + 1;
|
||||||
}
|
}
|
||||||
if(payload->cache_servers) {
|
|
||||||
const char *server = payload->cache_servers->data;
|
/* no slash found, it's a filename */
|
||||||
payload->cache_servers = payload->cache_servers->next;
|
return url;
|
||||||
payload->request_errors_ok = 1;
|
|
||||||
return server;
|
|
||||||
}
|
}
|
||||||
while(payload->servers
|
|
||||||
&& should_skip_server(payload->handle, payload->servers->data)) {
|
static char *get_fullpath(const char *path, const char *filename,
|
||||||
payload->servers = payload->servers->next;
|
const char *suffix)
|
||||||
}
|
{
|
||||||
if(payload->servers) {
|
char *filepath;
|
||||||
const char *server = payload->servers->data;
|
/* len = localpath len + filename len + suffix len + null */
|
||||||
payload->servers = payload->servers->next;
|
size_t len = strlen(path) + strlen(filename) + strlen(suffix) + 1;
|
||||||
payload->request_errors_ok = payload->errors_ok;
|
MALLOC(filepath, len, return NULL);
|
||||||
return server;
|
snprintf(filepath, len, "%s%s%s", path, filename, suffix);
|
||||||
}
|
|
||||||
return NULL;
|
return filepath;
|
||||||
}
|
}
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
@@ -424,12 +262,45 @@ static int utimes_long(const char *path, long seconds)
|
|||||||
return 0;
|
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)
|
static size_t dload_parseheader_cb(void *ptr, size_t size, size_t nmemb, void *user)
|
||||||
{
|
{
|
||||||
size_t realsize = size * nmemb;
|
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;
|
struct dload_payload *payload = (struct dload_payload *)user;
|
||||||
long respcode;
|
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--;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* avoid information leakage with badly formed headers */
|
||||||
|
if(endptr > fptr) {
|
||||||
|
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);
|
curl_easy_getinfo(payload->curl, CURLINFO_RESPONSE_CODE, &respcode);
|
||||||
if(payload->respcode != respcode) {
|
if(payload->respcode != respcode) {
|
||||||
@@ -503,19 +374,55 @@ 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 */
|
/* Return 0 if retry was successful, -1 otherwise */
|
||||||
static int curl_retry_next_server(CURLM *curlm, CURL *curl, struct dload_payload *payload)
|
static int curl_retry_next_server(CURLM *curlm, CURL *curl, struct dload_payload *payload)
|
||||||
{
|
{
|
||||||
const char *server = NULL;
|
const char *server;
|
||||||
size_t len;
|
size_t len;
|
||||||
struct stat st;
|
struct stat st;
|
||||||
alpm_handle_t *handle = payload->handle;
|
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,
|
_alpm_log(payload->handle, ALPM_LOG_DEBUG,
|
||||||
"%s: no more servers to retry\n", payload->remote_name);
|
"%s: no more servers to retry\n", payload->remote_name);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
server = payload->servers->data;
|
||||||
|
payload->servers = payload->servers->next;
|
||||||
|
|
||||||
/* regenerate a new fileurl */
|
/* regenerate a new fileurl */
|
||||||
FREE(payload->fileurl);
|
FREE(payload->fileurl);
|
||||||
@@ -526,6 +433,7 @@ static int curl_retry_next_server(CURLM *curlm, CURL *curl, struct dload_payload
|
|||||||
"%s: retrying from %s\n",
|
"%s: retrying from %s\n",
|
||||||
payload->remote_name, payload->fileurl);
|
payload->remote_name, payload->fileurl);
|
||||||
|
|
||||||
|
|
||||||
fflush(payload->localf);
|
fflush(payload->localf);
|
||||||
|
|
||||||
if(payload->allow_resume && stat(payload->tempfile_name, &st) == 0) {
|
if(payload->allow_resume && stat(payload->tempfile_name, &st) == 0) {
|
||||||
@@ -566,7 +474,7 @@ static int curl_retry_next_server(CURLM *curlm, CURL *curl, struct dload_payload
|
|||||||
* Returns -2 if an error happened for an optional 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,
|
static int curl_check_finished_download(alpm_handle_t *handle, CURLM *curlm, CURLMsg *msg,
|
||||||
int *active_downloads_num)
|
const char *localpath, int *active_downloads_num)
|
||||||
{
|
{
|
||||||
struct dload_payload *payload = NULL;
|
struct dload_payload *payload = NULL;
|
||||||
CURL *curl = msg->easy_handle;
|
CURL *curl = msg->easy_handle;
|
||||||
@@ -595,7 +503,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",
|
_alpm_log(handle, ALPM_LOG_DEBUG, "%s: response code %ld\n",
|
||||||
payload->remote_name, payload->respcode);
|
payload->remote_name, payload->respcode);
|
||||||
if(payload->respcode >= 400) {
|
if(payload->respcode >= 400) {
|
||||||
if(!payload->request_errors_ok) {
|
if(!payload->errors_ok) {
|
||||||
handle->pm_errno = ALPM_ERR_RETRIEVE;
|
handle->pm_errno = ALPM_ERR_RETRIEVE;
|
||||||
/* non-translated message is same as libcurl */
|
/* non-translated message is same as libcurl */
|
||||||
snprintf(payload->error_buffer, sizeof(payload->error_buffer),
|
snprintf(payload->error_buffer, sizeof(payload->error_buffer),
|
||||||
@@ -650,7 +558,7 @@ static int curl_check_finished_download(alpm_handle_t *handle, CURLM *curlm, CUR
|
|||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
if(!payload->request_errors_ok) {
|
if(!payload->errors_ok) {
|
||||||
handle->pm_errno = ALPM_ERR_LIBCURL;
|
handle->pm_errno = ALPM_ERR_LIBCURL;
|
||||||
_alpm_log(handle, ALPM_LOG_ERROR,
|
_alpm_log(handle, ALPM_LOG_ERROR,
|
||||||
_("failed retrieving file '%s' from %s : %s\n"),
|
_("failed retrieving file '%s' from %s : %s\n"),
|
||||||
@@ -680,6 +588,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_CONDITION_UNMET, &timecond);
|
||||||
curl_easy_getinfo(curl, CURLINFO_EFFECTIVE_URL, &effective_url);
|
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 */
|
/* Let's check if client requested downloading accompanion *.sig file */
|
||||||
if(!payload->signature && payload->download_signature && curlerr == CURLE_OK && payload->respcode < 400) {
|
if(!payload->signature && payload->download_signature && curlerr == CURLE_OK && payload->respcode < 400) {
|
||||||
struct dload_payload *sig = NULL;
|
struct dload_payload *sig = NULL;
|
||||||
@@ -711,23 +644,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));
|
MALLOC(sig->fileurl, len, FREE(sig); GOTO_ERR(handle, ALPM_ERR_MEMORY, cleanup));
|
||||||
snprintf(sig->fileurl, len, "%s.sig", url);
|
snprintf(sig->fileurl, len, "%s.sig", url);
|
||||||
|
|
||||||
int remote_name_len = strlen(payload->remote_name) + 5;
|
if(payload->trust_remote_name) {
|
||||||
MALLOC(sig->remote_name, remote_name_len, _alpm_dload_payload_reset(sig);
|
/* In this case server might provide a new name for the main payload.
|
||||||
FREE(sig); GOTO_ERR(handle, ALPM_ERR_MEMORY, cleanup));
|
* Choose *.sig filename based on this new name.
|
||||||
snprintf(sig->remote_name, remote_name_len, "%s.sig", payload->remote_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" */
|
/* force the filename to be realname + ".sig" */
|
||||||
int destfile_name_len = strlen(realname) + 5;
|
int destfile_name_len = strlen(realname) + 5;
|
||||||
MALLOC(sig->destfile_name, destfile_name_len, _alpm_dload_payload_reset(sig);
|
MALLOC(sig->destfile_name, destfile_name_len, FREE(sig->remote_name);
|
||||||
FREE(sig); GOTO_ERR(handle, ALPM_ERR_MEMORY, cleanup));
|
FREE(sig->fileurl); FREE(sig); GOTO_ERR(handle, ALPM_ERR_MEMORY, cleanup));
|
||||||
snprintf(sig->destfile_name, destfile_name_len, "%s.sig", realname);
|
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->signature = 1;
|
||||||
sig->handle = handle;
|
sig->handle = handle;
|
||||||
sig->force = payload->force;
|
sig->force = payload->force;
|
||||||
@@ -736,7 +668,7 @@ static int curl_check_finished_download(alpm_handle_t *handle, CURLM *curlm, CUR
|
|||||||
/* set hard upper limit of 16KiB */
|
/* set hard upper limit of 16KiB */
|
||||||
sig->max_size = 16 * 1024;
|
sig->max_size = 16 * 1024;
|
||||||
|
|
||||||
curl_add_payload(handle, curlm, sig);
|
curl_add_payload(handle, curlm, sig, localpath);
|
||||||
(*active_downloads_num)++;
|
(*active_downloads_num)++;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -775,7 +707,7 @@ cleanup:
|
|||||||
}
|
}
|
||||||
|
|
||||||
if(ret == 0) {
|
if(ret == 0) {
|
||||||
if(payload->destfile_name && handle->sandboxuser == NULL) {
|
if(payload->destfile_name) {
|
||||||
if(rename(payload->tempfile_name, 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"),
|
_alpm_log(handle, ALPM_LOG_ERROR, _("could not rename %s to %s (%s)\n"),
|
||||||
payload->tempfile_name, payload->destfile_name, strerror(errno));
|
payload->tempfile_name, payload->destfile_name, strerror(errno));
|
||||||
@@ -819,7 +751,7 @@ cleanup:
|
|||||||
* Returns -1 if am error happened while starting a new download
|
* Returns -1 if am error happened while starting a new download
|
||||||
*/
|
*/
|
||||||
static int curl_add_payload(alpm_handle_t *handle, CURLM *curlm,
|
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;
|
size_t len;
|
||||||
CURL *curl = NULL;
|
CURL *curl = NULL;
|
||||||
@@ -832,24 +764,53 @@ static int curl_add_payload(alpm_handle_t *handle, CURLM *curlm,
|
|||||||
if(payload->fileurl) {
|
if(payload->fileurl) {
|
||||||
ASSERT(!payload->servers, GOTO_ERR(handle, ALPM_ERR_WRONG_ARGS, cleanup));
|
ASSERT(!payload->servers, GOTO_ERR(handle, ALPM_ERR_WRONG_ARGS, cleanup));
|
||||||
ASSERT(!payload->filepath, 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 {
|
} 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));
|
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;
|
len = strlen(server) + strlen(payload->filepath) + 2;
|
||||||
MALLOC(payload->fileurl, len, GOTO_ERR(handle, ALPM_ERR_MEMORY, cleanup));
|
MALLOC(payload->fileurl, len, GOTO_ERR(handle, ALPM_ERR_MEMORY, cleanup));
|
||||||
snprintf(payload->fileurl, len, "%s/%s", server, payload->filepath);
|
snprintf(payload->fileurl, len, "%s/%s", server, payload->filepath);
|
||||||
}
|
}
|
||||||
|
|
||||||
payload->tempfile_openmode = "wb";
|
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) {
|
if(curl_gethost(payload->fileurl, hostname, sizeof(hostname)) != 0) {
|
||||||
_alpm_log(handle, ALPM_LOG_ERROR, _("url '%s' is invalid\n"), payload->fileurl);
|
_alpm_log(handle, ALPM_LOG_ERROR, _("url '%s' is invalid\n"), payload->fileurl);
|
||||||
GOTO_ERR(handle, ALPM_ERR_SERVER_BAD_URL, cleanup);
|
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);
|
curl_set_handle_opts(curl, payload);
|
||||||
|
|
||||||
if(payload->max_size == payload->initial_size && payload->max_size != 0) {
|
if(payload->max_size == payload->initial_size && payload->max_size != 0) {
|
||||||
@@ -907,7 +868,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
|
* Returns 1 if no files were downloaded and all errors were non-fatal
|
||||||
*/
|
*/
|
||||||
static int curl_download_internal(alpm_handle_t *handle,
|
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 active_downloads_num = 0;
|
||||||
int err = 0;
|
int err = 0;
|
||||||
@@ -925,7 +887,7 @@ static int curl_download_internal(alpm_handle_t *handle,
|
|||||||
for(; active_downloads_num < max_streams && payloads; active_downloads_num++) {
|
for(; active_downloads_num < max_streams && payloads; active_downloads_num++) {
|
||||||
struct dload_payload *payload = payloads->data;
|
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;
|
payloads = payloads->next;
|
||||||
} else {
|
} else {
|
||||||
/* The payload failed to start. Do not start any new downloads.
|
/* The payload failed to start. Do not start any new downloads.
|
||||||
@@ -956,7 +918,7 @@ static int curl_download_internal(alpm_handle_t *handle,
|
|||||||
}
|
}
|
||||||
if(msg->msg == CURLMSG_DONE) {
|
if(msg->msg == CURLMSG_DONE) {
|
||||||
int ret = curl_check_finished_download(handle, curlm, msg,
|
int ret = curl_check_finished_download(handle, curlm, msg,
|
||||||
&active_downloads_num);
|
localpath, &active_downloads_num);
|
||||||
if(ret == -1) {
|
if(ret == -1) {
|
||||||
/* if current payload failed to download then stop adding new payloads but wait for the
|
/* if current payload failed to download then stop adding new payloads but wait for the
|
||||||
* current ones
|
* current ones
|
||||||
@@ -976,177 +938,8 @@ static int curl_download_internal(alpm_handle_t *handle,
|
|||||||
return err ? -1 : updated ? 0 : 1;
|
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
|
#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 -1 if an error happened for a required file
|
||||||
* Returns 0 if a payload was actually downloaded
|
* Returns 0 if a payload was actually downloaded
|
||||||
* Returns 1 if no files were downloaded and all errors were non-fatal
|
* Returns 1 if no files were downloaded and all errors were non-fatal
|
||||||
@@ -1157,26 +950,7 @@ int _alpm_download(alpm_handle_t *handle,
|
|||||||
{
|
{
|
||||||
if(handle->fetchcb == NULL) {
|
if(handle->fetchcb == NULL) {
|
||||||
#ifdef HAVE_LIBCURL
|
#ifdef HAVE_LIBCURL
|
||||||
if(handle->sandboxuser) {
|
return curl_download_internal(handle, payloads, localpath);
|
||||||
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);
|
|
||||||
}
|
|
||||||
#else
|
#else
|
||||||
RET_ERR(handle, ALPM_ERR_EXTERNAL_DOWNLOAD, -1);
|
RET_ERR(handle, ALPM_ERR_EXTERNAL_DOWNLOAD, -1);
|
||||||
#endif
|
#endif
|
||||||
@@ -1191,11 +965,16 @@ int _alpm_download(alpm_handle_t *handle,
|
|||||||
if(payload->fileurl) {
|
if(payload->fileurl) {
|
||||||
ret = handle->fetchcb(handle->fetchcb_ctx, payload->fileurl, localpath, payload->force);
|
ret = handle->fetchcb(handle->fetchcb_ctx, payload->fileurl, localpath, payload->force);
|
||||||
} else {
|
} 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) {
|
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 +1034,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));
|
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->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, '/');
|
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 */
|
/* 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;
|
payload->allow_resume = 1;
|
||||||
|
|
||||||
if(!payload->destfile_name || !payload->tempfile_name) {
|
|
||||||
goto err;
|
|
||||||
}
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
/* The URL does not contain a filename, so download to a temporary location.
|
payload->random_partfile = 1;
|
||||||
* 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->handle = handle;
|
payload->handle = handle;
|
||||||
|
payload->trust_remote_name = 1;
|
||||||
payload->download_signature = (handle->siglevel & ALPM_SIG_PACKAGE);
|
payload->download_signature = (handle->siglevel & ALPM_SIG_PACKAGE);
|
||||||
payload->signature_optional = (handle->siglevel & ALPM_SIG_PACKAGE_OPTIONAL);
|
payload->signature_optional = (handle->siglevel & ALPM_SIG_PACKAGE_OPTIONAL);
|
||||||
payloads = alpm_list_add(payloads, payload);
|
payloads = alpm_list_add(payloads, payload);
|
||||||
@@ -1343,6 +1104,7 @@ void _alpm_dload_payload_reset(struct dload_payload *payload)
|
|||||||
FREE(payload->remote_name);
|
FREE(payload->remote_name);
|
||||||
FREE(payload->tempfile_name);
|
FREE(payload->tempfile_name);
|
||||||
FREE(payload->destfile_name);
|
FREE(payload->destfile_name);
|
||||||
|
FREE(payload->content_disp_name);
|
||||||
FREE(payload->fileurl);
|
FREE(payload->fileurl);
|
||||||
FREE(payload->filepath);
|
FREE(payload->filepath);
|
||||||
*payload = (struct dload_payload){0};
|
*payload = (struct dload_payload){0};
|
||||||
|
|||||||
@@ -26,12 +26,10 @@
|
|||||||
struct dload_payload {
|
struct dload_payload {
|
||||||
alpm_handle_t *handle;
|
alpm_handle_t *handle;
|
||||||
const char *tempfile_openmode;
|
const char *tempfile_openmode;
|
||||||
/* name of the remote file */
|
|
||||||
char *remote_name;
|
char *remote_name;
|
||||||
/* temporary file name, to which the payload is downloaded */
|
|
||||||
char *tempfile_name;
|
char *tempfile_name;
|
||||||
/* name to which the downloaded file will be renamed */
|
|
||||||
char *destfile_name;
|
char *destfile_name;
|
||||||
|
char *content_disp_name;
|
||||||
/* client has to provide either
|
/* client has to provide either
|
||||||
* 1) fileurl - full URL to the file
|
* 1) fileurl - full URL to the file
|
||||||
* 2) pair of (servers, filepath), in this case ALPM iterates over the
|
* 2) pair of (servers, filepath), in this case ALPM iterates over the
|
||||||
@@ -39,7 +37,6 @@ struct dload_payload {
|
|||||||
*/
|
*/
|
||||||
char *fileurl;
|
char *fileurl;
|
||||||
char *filepath; /* download URL path */
|
char *filepath; /* download URL path */
|
||||||
alpm_list_t *cache_servers;
|
|
||||||
alpm_list_t *servers;
|
alpm_list_t *servers;
|
||||||
long respcode;
|
long respcode;
|
||||||
off_t initial_size;
|
off_t initial_size;
|
||||||
@@ -47,17 +44,18 @@ struct dload_payload {
|
|||||||
off_t prevprogress;
|
off_t prevprogress;
|
||||||
int force;
|
int force;
|
||||||
int allow_resume;
|
int allow_resume;
|
||||||
|
int random_partfile;
|
||||||
int errors_ok;
|
int errors_ok;
|
||||||
int unlink_on_fail;
|
int unlink_on_fail;
|
||||||
|
int trust_remote_name;
|
||||||
int download_signature; /* specifies if an accompanion *.sig file need to be downloaded*/
|
int download_signature; /* specifies if an accompanion *.sig file need to be downloaded*/
|
||||||
int signature_optional; /* *.sig file is optional */
|
int signature_optional; /* *.sig file is optional */
|
||||||
#ifdef HAVE_LIBCURL
|
#ifdef HAVE_LIBCURL
|
||||||
CURL *curl;
|
CURL *curl;
|
||||||
char error_buffer[CURL_ERROR_SIZE];
|
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 */
|
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);
|
void _alpm_dload_payload_reset(struct dload_payload *payload);
|
||||||
|
|||||||
@@ -48,28 +48,12 @@ alpm_handle_t *_alpm_handle_new(void)
|
|||||||
return handle;
|
return handle;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* free all in-memory resources */
|
|
||||||
void _alpm_handle_free(alpm_handle_t *handle)
|
void _alpm_handle_free(alpm_handle_t *handle)
|
||||||
{
|
{
|
||||||
alpm_list_t *i;
|
|
||||||
alpm_db_t *db;
|
|
||||||
|
|
||||||
if(handle == NULL) {
|
if(handle == NULL) {
|
||||||
return;
|
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 */
|
/* close logfile */
|
||||||
if(handle->logstream) {
|
if(handle->logstream) {
|
||||||
fclose(handle->logstream);
|
fclose(handle->logstream);
|
||||||
@@ -84,12 +68,6 @@ void _alpm_handle_free(alpm_handle_t *handle)
|
|||||||
FREELIST(handle->known_keys);
|
FREELIST(handle->known_keys);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef HAVE_LIBCURL
|
|
||||||
curl_multi_cleanup(handle->curlm);
|
|
||||||
curl_global_cleanup();
|
|
||||||
FREELIST(handle->server_errors);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* free memory */
|
/* free memory */
|
||||||
_alpm_trans_free(handle->trans);
|
_alpm_trans_free(handle->trans);
|
||||||
FREE(handle->root);
|
FREE(handle->root);
|
||||||
@@ -101,7 +79,6 @@ void _alpm_handle_free(alpm_handle_t *handle)
|
|||||||
FREE(handle->lockfile);
|
FREE(handle->lockfile);
|
||||||
FREELIST(handle->architectures);
|
FREELIST(handle->architectures);
|
||||||
FREE(handle->gpgdir);
|
FREE(handle->gpgdir);
|
||||||
FREE(handle->sandboxuser);
|
|
||||||
FREELIST(handle->noupgrade);
|
FREELIST(handle->noupgrade);
|
||||||
FREELIST(handle->noextract);
|
FREELIST(handle->noextract);
|
||||||
FREELIST(handle->ignorepkg);
|
FREELIST(handle->ignorepkg);
|
||||||
@@ -293,12 +270,6 @@ const char SYMEXPORT *alpm_option_get_gpgdir(alpm_handle_t *handle)
|
|||||||
return handle->gpgdir;
|
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)
|
int SYMEXPORT alpm_option_get_usesyslog(alpm_handle_t *handle)
|
||||||
{
|
{
|
||||||
CHECK_HANDLE(handle, return -1);
|
CHECK_HANDLE(handle, return -1);
|
||||||
@@ -602,19 +573,6 @@ int SYMEXPORT alpm_option_set_gpgdir(alpm_handle_t *handle, const char *gpgdir)
|
|||||||
return 0;
|
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)
|
int SYMEXPORT alpm_option_set_usesyslog(alpm_handle_t *handle, int usesyslog)
|
||||||
{
|
{
|
||||||
CHECK_HANDLE(handle, return -1);
|
CHECK_HANDLE(handle, return -1);
|
||||||
|
|||||||
@@ -91,7 +91,6 @@ struct _alpm_handle_t {
|
|||||||
char *logfile; /* Name of the log file */
|
char *logfile; /* Name of the log file */
|
||||||
char *lockfile; /* Name of the lock file */
|
char *lockfile; /* Name of the lock file */
|
||||||
char *gpgdir; /* Directory where GnuPG files are stored */
|
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 *cachedirs; /* Paths to pacman cache directories */
|
||||||
alpm_list_t *hookdirs; /* Paths to hook directories */
|
alpm_list_t *hookdirs; /* Paths to hook directories */
|
||||||
alpm_list_t *overwrite_files; /* Paths that may be overwritten */
|
alpm_list_t *overwrite_files; /* Paths that may be overwritten */
|
||||||
|
|||||||
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@
|
||||||
@@ -24,7 +24,6 @@ libalpm_sources = files('''
|
|||||||
pkghash.h pkghash.c
|
pkghash.h pkghash.c
|
||||||
rawstr.c
|
rawstr.c
|
||||||
remove.h remove.c
|
remove.h remove.c
|
||||||
sandbox.h sandbox.c
|
|
||||||
signing.c signing.h
|
signing.c signing.h
|
||||||
sync.h sync.c
|
sync.h sync.c
|
||||||
trans.h trans.c
|
trans.h trans.c
|
||||||
|
|||||||
@@ -420,10 +420,8 @@ static void shift_pacsave(alpm_handle_t *handle, const char *file)
|
|||||||
|
|
||||||
cleanup:
|
cleanup:
|
||||||
free(dirname);
|
free(dirname);
|
||||||
if(dir != NULL) {
|
|
||||||
closedir(dir);
|
closedir(dir);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -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 */
|
|
||||||
@@ -1044,7 +1044,7 @@ int SYMEXPORT alpm_siglist_cleanup(alpm_siglist_t *siglist)
|
|||||||
static size_t length_check(size_t length, size_t position, size_t a,
|
static size_t length_check(size_t length, size_t position, size_t a,
|
||||||
alpm_handle_t *handle, const char *identifier)
|
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,
|
_alpm_log(handle, ALPM_LOG_ERROR,
|
||||||
_("%s: signature format error\n"), identifier);
|
_("%s: signature format error\n"), identifier);
|
||||||
return -1;
|
return -1;
|
||||||
|
|||||||
@@ -517,23 +517,21 @@ int _alpm_sync_prepare(alpm_handle_t *handle, alpm_list_t **data)
|
|||||||
|
|
||||||
for(i = deps; i; i = i->next) {
|
for(i = deps; i; i = i->next) {
|
||||||
alpm_conflict_t *conflict = i->data;
|
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;
|
alpm_pkg_t *rsync, *sync, *sync1, *sync2;
|
||||||
|
|
||||||
/* have we already removed one of the conflicting targets? */
|
/* have we already removed one of the conflicting targets? */
|
||||||
sync1 = alpm_pkg_find(trans->add, name1);
|
sync1 = alpm_pkg_find(trans->add, conflict->package1);
|
||||||
sync2 = alpm_pkg_find(trans->add, name2);
|
sync2 = alpm_pkg_find(trans->add, conflict->package2);
|
||||||
if(!sync1 || !sync2) {
|
if(!sync1 || !sync2) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
_alpm_log(handle, ALPM_LOG_DEBUG, "conflicting packages in the sync list: '%s' <-> '%s'\n",
|
_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 */
|
/* 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 *dep1 = alpm_dep_from_string(conflict->package1);
|
||||||
alpm_depend_t *dep2 = alpm_dep_from_string(name2);
|
alpm_depend_t *dep2 = alpm_dep_from_string(conflict->package2);
|
||||||
if(_alpm_depcmp(sync1, dep2)) {
|
if(_alpm_depcmp(sync1, dep2)) {
|
||||||
rsync = sync2;
|
rsync = sync2;
|
||||||
sync = sync1;
|
sync = sync1;
|
||||||
@@ -561,8 +559,8 @@ int _alpm_sync_prepare(alpm_handle_t *handle, alpm_list_t **data)
|
|||||||
|
|
||||||
/* Prints warning */
|
/* Prints warning */
|
||||||
_alpm_log(handle, ALPM_LOG_WARNING,
|
_alpm_log(handle, ALPM_LOG_WARNING,
|
||||||
_("removing '%s-%s' from target list because it conflicts with '%s-%s'\n"),
|
_("removing '%s' from target list because it conflicts with '%s'\n"),
|
||||||
rsync->name, rsync->version, sync->name, sync->version);
|
rsync->name, sync->name);
|
||||||
trans->add = alpm_list_remove(trans->add, rsync, _alpm_pkg_cmp, NULL);
|
trans->add = alpm_list_remove(trans->add, rsync, _alpm_pkg_cmp, NULL);
|
||||||
/* rsync is not a transaction target anymore */
|
/* rsync is not a transaction target anymore */
|
||||||
trans->unresolvable = alpm_list_add(trans->unresolvable, rsync);
|
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
|
.conflict = i->data
|
||||||
};
|
};
|
||||||
alpm_conflict_t *conflict = i->data;
|
alpm_conflict_t *conflict = i->data;
|
||||||
const char *name1 = conflict->package1->name;
|
|
||||||
const char *name2 = conflict->package2->name;
|
|
||||||
int found = 0;
|
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 */
|
we ask the user */
|
||||||
if(alpm_pkg_find(trans->remove, name2)) {
|
if(alpm_pkg_find(trans->remove, conflict->package2)) {
|
||||||
found = 1;
|
found = 1;
|
||||||
}
|
}
|
||||||
for(j = trans->add; j && !found; j = j->next) {
|
for(j = trans->add; j && !found; j = j->next) {
|
||||||
alpm_pkg_t *spkg = j->data;
|
alpm_pkg_t *spkg = j->data;
|
||||||
if(alpm_pkg_find(spkg->removes, name2)) {
|
if(alpm_pkg_find(spkg->removes, conflict->package2)) {
|
||||||
found = 1;
|
found = 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -602,15 +598,15 @@ int _alpm_sync_prepare(alpm_handle_t *handle, alpm_list_t **data)
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
_alpm_log(handle, ALPM_LOG_DEBUG, "package '%s-%s' conflicts with '%s-%s'\n",
|
_alpm_log(handle, ALPM_LOG_DEBUG, "package '%s' conflicts with '%s'\n",
|
||||||
name1, conflict->package1->version, name2,conflict->package2->version);
|
conflict->package1, conflict->package2);
|
||||||
|
|
||||||
QUESTION(handle, &question);
|
QUESTION(handle, &question);
|
||||||
if(question.remove) {
|
if(question.remove) {
|
||||||
/* append to the removes list */
|
/* append to the removes list */
|
||||||
alpm_pkg_t *sync = alpm_pkg_find(trans->add, name1);
|
alpm_pkg_t *sync = alpm_pkg_find(trans->add, conflict->package1);
|
||||||
alpm_pkg_t *local = _alpm_db_get_pkgfromcache(handle->db_local, name2);
|
alpm_pkg_t *local = _alpm_db_get_pkgfromcache(handle->db_local, conflict->package2);
|
||||||
_alpm_log(handle, ALPM_LOG_DEBUG, "electing '%s' for removal\n", name2);
|
_alpm_log(handle, ALPM_LOG_DEBUG, "electing '%s' for removal\n", conflict->package2);
|
||||||
sync->removes = alpm_list_add(sync->removes, local);
|
sync->removes = alpm_list_add(sync->removes, local);
|
||||||
} else { /* abort */
|
} else { /* abort */
|
||||||
_alpm_log(handle, ALPM_LOG_ERROR, _("unresolvable package conflicts detected\n"));
|
_alpm_log(handle, ALPM_LOG_ERROR, _("unresolvable package conflicts detected\n"));
|
||||||
@@ -767,7 +763,6 @@ static int find_dl_candidates(alpm_handle_t *handle, alpm_list_t **files)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static int download_files(alpm_handle_t *handle)
|
static int download_files(alpm_handle_t *handle)
|
||||||
{
|
{
|
||||||
const char *cachedir;
|
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));
|
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->remote_name, pkg->filename, FREE(payload); GOTO_ERR(handle, ALPM_ERR_MEMORY, finish));
|
||||||
STRDUP(payload->filepath, pkg->filename,
|
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));
|
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->max_size = pkg->size;
|
||||||
payload->cache_servers = pkg->origin_data.db->cache_servers;
|
|
||||||
payload->servers = pkg->origin_data.db->servers;
|
payload->servers = pkg->origin_data.db->servers;
|
||||||
payload->handle = handle;
|
payload->handle = handle;
|
||||||
payload->allow_resume = 1;
|
payload->allow_resume = 1;
|
||||||
@@ -1004,13 +991,6 @@ static int check_validity(alpm_handle_t *handle,
|
|||||||
|
|
||||||
current_bytes += v.pkg->size;
|
current_bytes += v.pkg->size;
|
||||||
v.path = _alpm_filecache_find(handle, v.pkg->filename);
|
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));
|
v.siglevel = alpm_db_get_siglevel(alpm_pkg_get_db(v.pkg));
|
||||||
|
|
||||||
if(_alpm_pkg_validate_internal(handle, v.path, 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;
|
current_bytes += spkg->size;
|
||||||
filepath = _alpm_filecache_find(handle, spkg->filename);
|
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 */
|
/* 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 */
|
/* TODO: alpm_pkg_get_db() will not work on this target anymore */
|
||||||
_alpm_log(handle, ALPM_LOG_DEBUG,
|
_alpm_log(handle, ALPM_LOG_DEBUG,
|
||||||
|
|||||||
@@ -31,7 +31,6 @@
|
|||||||
#include <limits.h>
|
#include <limits.h>
|
||||||
#include <sys/wait.h>
|
#include <sys/wait.h>
|
||||||
#include <sys/socket.h>
|
#include <sys/socket.h>
|
||||||
#include <fcntl.h>
|
|
||||||
#include <fnmatch.h>
|
#include <fnmatch.h>
|
||||||
#include <poll.h>
|
#include <poll.h>
|
||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
@@ -197,23 +196,6 @@ cleanup:
|
|||||||
return ret;
|
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).
|
/** Trim trailing newlines from a string (if any exist).
|
||||||
* @param str a single line of text
|
* @param str a single line of text
|
||||||
* @param len size of str, if known, else 0
|
* @param len size of str, if known, else 0
|
||||||
@@ -572,7 +554,7 @@ static int _alpm_chroot_read_from_child(alpm_handle_t *handle, int fd,
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void _alpm_reset_signals(void)
|
static void _alpm_reset_signals(void)
|
||||||
{
|
{
|
||||||
/* reset POSIX defined signals (see signal.h) */
|
/* reset POSIX defined signals (see signal.h) */
|
||||||
/* there are likely more but there is no easy way
|
/* there are likely more but there is no easy way
|
||||||
@@ -672,9 +654,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 */
|
/* use fprintf instead of _alpm_log to send output through the parent */
|
||||||
/* don't chroot() to "/": this allows running with less caps when the
|
if(chroot(handle->root) != 0) {
|
||||||
* caller puts us in the right root */
|
|
||||||
if(strcmp(handle->root, "/") != 0 && chroot(handle->root) != 0) {
|
|
||||||
fprintf(stderr, _("could not change the root directory (%s)\n"), strerror(errno));
|
fprintf(stderr, _("could not change the root directory (%s)\n"), strerror(errno));
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
@@ -692,7 +672,6 @@ int _alpm_run_chroot(alpm_handle_t *handle, const char *cmd, char *const argv[],
|
|||||||
unsetenv("BASH_ENV");
|
unsetenv("BASH_ENV");
|
||||||
umask(0022);
|
umask(0022);
|
||||||
_alpm_reset_signals();
|
_alpm_reset_signals();
|
||||||
_alpm_handle_free(handle);
|
|
||||||
execv(cmd, argv);
|
execv(cmd, argv);
|
||||||
/* execv only returns if there was an error */
|
/* execv only returns if there was an error */
|
||||||
fprintf(stderr, _("call to execv failed (%s)\n"), strerror(errno));
|
fprintf(stderr, _("call to execv failed (%s)\n"), strerror(errno));
|
||||||
@@ -863,17 +842,10 @@ char *_alpm_filecache_find(alpm_handle_t *handle, const char *filename)
|
|||||||
for(i = handle->cachedirs; i; i = i->next) {
|
for(i = handle->cachedirs; i; i = i->next) {
|
||||||
snprintf(path, PATH_MAX, "%s%s", (char *)i->data,
|
snprintf(path, PATH_MAX, "%s%s", (char *)i->data,
|
||||||
filename);
|
filename);
|
||||||
if(stat(path, &buf) == 0) {
|
if(stat(path, &buf) == 0 && S_ISREG(buf.st_mode)) {
|
||||||
if(S_ISREG(buf.st_mode)) {
|
|
||||||
retpath = strdup(path);
|
retpath = strdup(path);
|
||||||
_alpm_log(handle, ALPM_LOG_DEBUG, "found cached pkg: %s\n", retpath);
|
_alpm_log(handle, ALPM_LOG_DEBUG, "found cached pkg: %s\n", retpath);
|
||||||
return 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));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* package wasn't found in any cachedir */
|
/* package wasn't found in any cachedir */
|
||||||
@@ -1380,11 +1352,6 @@ int _alpm_access(alpm_handle_t *handle, const char *dir, const char *file, int a
|
|||||||
size_t len = 0;
|
size_t len = 0;
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
|
|
||||||
int flag = 0;
|
|
||||||
#ifdef AT_SYMLINK_NOFOLLOW
|
|
||||||
flag |= AT_SYMLINK_NOFOLLOW;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if(dir) {
|
if(dir) {
|
||||||
char *check_path;
|
char *check_path;
|
||||||
|
|
||||||
@@ -1392,11 +1359,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));
|
CALLOC(check_path, len, sizeof(char), RET_ERR(handle, ALPM_ERR_MEMORY, -1));
|
||||||
snprintf(check_path, len, "%s%s", dir, file);
|
snprintf(check_path, len, "%s%s", dir, file);
|
||||||
|
|
||||||
ret = faccessat(AT_FDCWD, check_path, amode, flag);
|
ret = access(check_path, amode);
|
||||||
free(check_path);
|
free(check_path);
|
||||||
} else {
|
} else {
|
||||||
dir = "";
|
dir = "";
|
||||||
ret = faccessat(AT_FDCWD, file, amode, flag);
|
ret = access(file, amode);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(ret != 0) {
|
if(ret != 0) {
|
||||||
|
|||||||
@@ -116,7 +116,6 @@ struct archive_read_buffer {
|
|||||||
int _alpm_makepath(const char *path);
|
int _alpm_makepath(const char *path);
|
||||||
int _alpm_makepath_mode(const char *path, mode_t mode);
|
int _alpm_makepath_mode(const char *path, mode_t mode);
|
||||||
int _alpm_copyfile(const char *src, const char *dest);
|
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);
|
size_t _alpm_strip_newline(char *str, size_t len);
|
||||||
|
|
||||||
int _alpm_open_archive(alpm_handle_t *handle, const char *path,
|
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);
|
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[],
|
int _alpm_run_chroot(alpm_handle_t *handle, const char *cmd, char *const argv[],
|
||||||
_alpm_cb_io in_cb, void *in_ctx);
|
_alpm_cb_io in_cb, void *in_ctx);
|
||||||
int _alpm_ldconfig(alpm_handle_t *handle);
|
int _alpm_ldconfig(alpm_handle_t *handle);
|
||||||
|
|||||||
22
meson.build
22
meson.build
@@ -182,22 +182,7 @@ foreach type : [
|
|||||||
endif
|
endif
|
||||||
endforeach
|
endforeach
|
||||||
|
|
||||||
|
if conf.has('HAVE_STRUCT_STATVFS_F_FLAG')
|
||||||
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')
|
|
||||||
conf.set('FSSTATSTYPE', 'struct statvfs')
|
conf.set('FSSTATSTYPE', 'struct statvfs')
|
||||||
elif conf.has('HAVE_STRUCT_STATFS_F_FLAGS')
|
elif conf.has('HAVE_STRUCT_STATFS_F_FLAGS')
|
||||||
conf.set('FSSTATSTYPE', 'struct statfs')
|
conf.set('FSSTATSTYPE', 'struct statfs')
|
||||||
@@ -233,7 +218,6 @@ if get_option('debug')
|
|||||||
'-Wuninitialized',
|
'-Wuninitialized',
|
||||||
'-Wunused-but-set-parameter',
|
'-Wunused-but-set-parameter',
|
||||||
'-Wunused-parameter',
|
'-Wunused-parameter',
|
||||||
'-Wunused-result',
|
|
||||||
'-Wwrite-strings',
|
'-Wwrite-strings',
|
||||||
]
|
]
|
||||||
add_project_arguments(cc.get_supported_arguments(extra_cflags), language : 'c')
|
add_project_arguments(cc.get_supported_arguments(extra_cflags), language : 'c')
|
||||||
@@ -360,9 +344,7 @@ pkgconfig.generate(
|
|||||||
name : 'libalpm',
|
name : 'libalpm',
|
||||||
description : 'Arch Linux package management library',
|
description : 'Arch Linux package management library',
|
||||||
version : libalpm_version,
|
version : libalpm_version,
|
||||||
url : 'http://archlinux.org/pacman/',
|
url : 'http://archlinux.org/pacman/')
|
||||||
extra_cflags: [ '-D_FILE_OFFSET_BITS=64' ],
|
|
||||||
)
|
|
||||||
|
|
||||||
pacman_bin = executable(
|
pacman_bin = executable(
|
||||||
'pacman',
|
'pacman',
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ changelog=
|
|||||||
source=("$pkgbase-$pkgver.tar.gz"
|
source=("$pkgbase-$pkgver.tar.gz"
|
||||||
"$pkgname-$pkgver.patch")
|
"$pkgname-$pkgver.patch")
|
||||||
noextract=()
|
noextract=()
|
||||||
sha256sums=()
|
md5sums=()
|
||||||
validpgpkeys=()
|
validpgpkeys=()
|
||||||
|
|
||||||
prepare() {
|
prepare() {
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ options=()
|
|||||||
install=
|
install=
|
||||||
source=('FOLDER::VCS+URL#FRAGMENT')
|
source=('FOLDER::VCS+URL#FRAGMENT')
|
||||||
noextract=()
|
noextract=()
|
||||||
sha256sums=('SKIP')
|
md5sums=('SKIP')
|
||||||
|
|
||||||
# Please refer to the 'USING VCS SOURCES' section of the PKGBUILD man page for
|
# Please refer to the 'USING VCS SOURCES' section of the PKGBUILD man page for
|
||||||
# a description of each element in the source array.
|
# a description of each element in the source array.
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ changelog=
|
|||||||
source=("$pkgname-$pkgver.tar.gz"
|
source=("$pkgname-$pkgver.tar.gz"
|
||||||
"$pkgname-$pkgver.patch")
|
"$pkgname-$pkgver.patch")
|
||||||
noextract=()
|
noextract=()
|
||||||
sha256sums=()
|
md5sums=()
|
||||||
validpgpkeys=()
|
validpgpkeys=()
|
||||||
|
|
||||||
prepare() {
|
prepare() {
|
||||||
|
|||||||
@@ -553,7 +553,7 @@ _pacman_conf_directive() {
|
|||||||
|
|
||||||
_pacman_conf_commands=(
|
_pacman_conf_commands=(
|
||||||
{-l,--repo-list}'[List configured repositories]:*: :->repo_list'
|
{-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'
|
{-V,--version}'[Display version and exit]:*: :->complete'
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -564,7 +564,7 @@ _pacman_conf_options=(
|
|||||||
|
|
||||||
_pacman_conf_options_common=(
|
_pacman_conf_options_common=(
|
||||||
'*'{-c,--config=}'[Specify an alternate configuration file]: :_files'
|
'*'{-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() {
|
_pacman_conf() {
|
||||||
|
|||||||
@@ -21,11 +21,11 @@
|
|||||||
[[ -n "$LIBMAKEPKG_AUTODEP_SH" ]] && return
|
[[ -n "$LIBMAKEPKG_AUTODEP_SH" ]] && return
|
||||||
LIBMAKEPKG_AUTODEP_SH=1
|
LIBMAKEPKG_AUTODEP_SH=1
|
||||||
|
|
||||||
MAKEPKG_LIBRARY=${MAKEPKG_LIBRARY:-'@libmakepkgdir@'}
|
LIBRARY=${LIBRARY:-'@libmakepkgdir@'}
|
||||||
|
|
||||||
declare -a autodep_functions
|
declare -a autodep_functions
|
||||||
|
|
||||||
for lib in "$MAKEPKG_LIBRARY/autodep/"*.sh; do
|
for lib in "$LIBRARY/autodep/"*.sh; do
|
||||||
source "$lib"
|
source "$lib"
|
||||||
done
|
done
|
||||||
|
|
||||||
|
|||||||
@@ -21,7 +21,7 @@
|
|||||||
[[ -n "$LIBMAKEPKG_AUTODEP_LIBRARY_DEPENDS_SH" ]] && return
|
[[ -n "$LIBMAKEPKG_AUTODEP_LIBRARY_DEPENDS_SH" ]] && return
|
||||||
LIBMAKEPKG_AUTODEP_LIBRARY_DEPENDS_SH=1
|
LIBMAKEPKG_AUTODEP_LIBRARY_DEPENDS_SH=1
|
||||||
|
|
||||||
MAKEPKG_LIBRARY=${MAKEPKG_LIBRARY:-'@libmakepkgdir@'}
|
LIBRARY=${LIBRARY:-'@libmakepkgdir@'}
|
||||||
|
|
||||||
autodep_functions+=('library_depends')
|
autodep_functions+=('library_depends')
|
||||||
|
|
||||||
|
|||||||
@@ -21,7 +21,7 @@
|
|||||||
[[ -n "$LIBMAKEPKG_AUTODEP_LIBRARY_PROVIDES_SH" ]] && return
|
[[ -n "$LIBMAKEPKG_AUTODEP_LIBRARY_PROVIDES_SH" ]] && return
|
||||||
LIBMAKEPKG_AUTODEP_LIBRARY_PROVIDES_SH=1
|
LIBMAKEPKG_AUTODEP_LIBRARY_PROVIDES_SH=1
|
||||||
|
|
||||||
MAKEPKG_LIBRARY=${MAKEPKG_LIBRARY:-'@libmakepkgdir@'}
|
LIBRARY=${LIBRARY:-'@libmakepkgdir@'}
|
||||||
|
|
||||||
autodep_functions+=('library_provides')
|
autodep_functions+=('library_provides')
|
||||||
|
|
||||||
|
|||||||
@@ -22,12 +22,12 @@
|
|||||||
[[ -n "$LIBMAKEPKG_BUILDENV_SH" ]] && return
|
[[ -n "$LIBMAKEPKG_BUILDENV_SH" ]] && return
|
||||||
LIBMAKEPKG_BUILDENV_SH=1
|
LIBMAKEPKG_BUILDENV_SH=1
|
||||||
|
|
||||||
MAKEPKG_LIBRARY=${MAKEPKG_LIBRARY:-'@libmakepkgdir@'}
|
LIBRARY=${LIBRARY:-'@libmakepkgdir@'}
|
||||||
|
|
||||||
declare -a buildenv_functions build_options
|
declare -a buildenv_functions build_options
|
||||||
buildenv_vars=('CPPFLAGS' 'CFLAGS' 'CXXFLAGS' 'LDFLAGS' 'MAKEFLAGS' 'CHOST')
|
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"
|
source "$lib"
|
||||||
done
|
done
|
||||||
|
|
||||||
|
|||||||
@@ -21,9 +21,9 @@
|
|||||||
[[ -n "$LIBMAKEPKG_BUILDENV_BUILDFLAGS_SH" ]] && return
|
[[ -n "$LIBMAKEPKG_BUILDENV_BUILDFLAGS_SH" ]] && return
|
||||||
LIBMAKEPKG_BUILDENV_BUILDFLAGS_SH=1
|
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')
|
build_options+=('buildflags')
|
||||||
|
|
||||||
|
|||||||
@@ -23,9 +23,9 @@
|
|||||||
[[ -n "$LIBMAKEPKG_BUILDENV_COMPILER_SH" ]] && return
|
[[ -n "$LIBMAKEPKG_BUILDENV_COMPILER_SH" ]] && return
|
||||||
LIBMAKEPKG_BUILDENV_COMPILER_SH=1
|
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')
|
build_options+=('ccache' 'distcc')
|
||||||
buildenv_functions+=('buildenv_ccache' 'buildenv_distcc')
|
buildenv_functions+=('buildenv_ccache' 'buildenv_distcc')
|
||||||
|
|||||||
@@ -22,18 +22,17 @@
|
|||||||
[[ -n "$LIBMAKEPKG_BUILDENV_DEBUGFLAGS_SH" ]] && return
|
[[ -n "$LIBMAKEPKG_BUILDENV_DEBUGFLAGS_SH" ]] && return
|
||||||
LIBMAKEPKG_BUILDENV_DEBUGFLAGS_SH=1
|
LIBMAKEPKG_BUILDENV_DEBUGFLAGS_SH=1
|
||||||
|
|
||||||
MAKEPKG_LIBRARY=${MAKEPKG_LIBRARY:-'@libmakepkgdir@'}
|
LIBRARY=${LIBRARY:-'@libmakepkgdir@'}
|
||||||
|
|
||||||
source "$MAKEPKG_LIBRARY/util/option.sh"
|
source "$LIBRARY/util/option.sh"
|
||||||
source "$MAKEPKG_LIBRARY/util/util.sh"
|
|
||||||
|
|
||||||
buildenv_functions+=('buildenv_debugflags')
|
buildenv_functions+=('buildenv_debugflags')
|
||||||
|
|
||||||
buildenv_debugflags() {
|
buildenv_debugflags() {
|
||||||
if check_option "debug" "y" && ! check_option "buildflags" "n"; then
|
if check_option "debug" "y" && ! check_option "buildflags" "n"; then
|
||||||
append_once DEBUG_CFLAGS "-ffile-prefix-map=$srcdir=${DBGSRCDIR:-/usr/src/debug}/${pkgbase}"
|
DEBUG_CFLAGS+=" -ffile-prefix-map=$srcdir=${DBGSRCDIR:-/usr/src/debug}/${pkgbase}"
|
||||||
append_once DEBUG_CXXFLAGS "-ffile-prefix-map=$srcdir=${DBGSRCDIR:-/usr/src/debug}/${pkgbase}"
|
DEBUG_CXXFLAGS+=" -ffile-prefix-map=$srcdir=${DBGSRCDIR:-/usr/src/debug}/${pkgbase}"
|
||||||
append_once CFLAGS "$DEBUG_CFLAGS"
|
CFLAGS+=" $DEBUG_CFLAGS"
|
||||||
append_once CXXFLAGS "$DEBUG_CXXFLAGS"
|
CXXFLAGS+=" $DEBUG_CXXFLAGS"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -22,18 +22,17 @@
|
|||||||
[[ -n "$LIBMAKEPKG_BUILDENV_LTO_SH" ]] && return
|
[[ -n "$LIBMAKEPKG_BUILDENV_LTO_SH" ]] && return
|
||||||
LIBMAKEPKG_BUILDENV_LTO_SH=1
|
LIBMAKEPKG_BUILDENV_LTO_SH=1
|
||||||
|
|
||||||
MAKEPKG_LIBRARY=${MAKEPKG_LIBRARY:-'@libmakepkgdir@'}
|
LIBRARY=${LIBRARY:-'@libmakepkgdir@'}
|
||||||
|
|
||||||
source "$MAKEPKG_LIBRARY/util/option.sh"
|
source "$LIBRARY/util/option.sh"
|
||||||
source "$MAKEPKG_LIBRARY/util/util.sh"
|
|
||||||
|
|
||||||
build_options+=('lto')
|
build_options+=('lto')
|
||||||
buildenv_functions+=('buildenv_lto')
|
buildenv_functions+=('buildenv_lto')
|
||||||
|
|
||||||
buildenv_lto() {
|
buildenv_lto() {
|
||||||
if check_option "lto" "y" && ! check_option "buildflags" "n"; then
|
if check_option "lto" "y" && ! check_option "buildflags" "n"; then
|
||||||
append_once CFLAGS "${LTOFLAGS:--flto}"
|
CFLAGS+=" ${LTOFLAGS:--flto}"
|
||||||
append_once CXXFLAGS "${LTOFLAGS:--flto}"
|
CXXFLAGS+=" ${LTOFLAGS:--flto}"
|
||||||
append_once LDFLAGS "${LTOFLAGS:--flto}"
|
LDFLAGS+=" ${LTOFLAGS:--flto}"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,9 +21,9 @@
|
|||||||
[[ -n "$LIBMAKEPKG_BUILDENV_MAKEFLAGS_SH" ]] && return
|
[[ -n "$LIBMAKEPKG_BUILDENV_MAKEFLAGS_SH" ]] && return
|
||||||
LIBMAKEPKG_BUILDENV_MAKEFLAGS_SH=1
|
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')
|
build_options+=('makeflags')
|
||||||
buildenv_functions+=('buildenv_makeflags')
|
buildenv_functions+=('buildenv_makeflags')
|
||||||
|
|||||||
@@ -21,17 +21,16 @@
|
|||||||
[[ -n "$LIBMAKEPKG_BUILDENV_RUST_SH" ]] && return
|
[[ -n "$LIBMAKEPKG_BUILDENV_RUST_SH" ]] && return
|
||||||
LIBMAKEPKG_BUILDENV_RUST_SH=1
|
LIBMAKEPKG_BUILDENV_RUST_SH=1
|
||||||
|
|
||||||
MAKEPKG_LIBRARY=${MAKEPKG_LIBRARY:-'@libmakepkgdir@'}
|
LIBRARY=${LIBRARY:-'@libmakepkgdir@'}
|
||||||
|
|
||||||
source "$MAKEPKG_LIBRARY/util/option.sh"
|
source "$LIBRARY/util/option.sh"
|
||||||
source "$MAKEPKG_LIBRARY/util/util.sh"
|
|
||||||
|
|
||||||
buildenv_vars+=('RUSTFLAGS' 'DEBUG_RUSTFLAGS')
|
buildenv_var+=('RUSTFLAGS' 'DEBUG_RUSTFLAGS')
|
||||||
buildenv_functions+=('buildenv_rust')
|
buildenv_functions+=('buildenv_rust')
|
||||||
|
|
||||||
buildenv_rust() {
|
buildenv_rust() {
|
||||||
if check_option "debug" "y" && ! check_option "buildflags" "n"; then
|
if check_option "debug" "y" && ! check_option "buildflags" "n"; then
|
||||||
append_once DEBUG_RUSTFLAGS "--remap-path-prefix=$srcdir=${DBGSRCDIR:-/usr/src/debug}/${pkgbase}"
|
DEBUG_RUSTFLAGS+=" --remap-path-prefix=$srcdir=${DBGSRCDIR:-/usr/src/debug}/${pkgbase}"
|
||||||
append_once RUSTFLAGS "$DEBUG_RUSTFLAGS"
|
RUSTFLAGS+=" $DEBUG_RUSTFLAGS"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
@@ -21,11 +21,11 @@
|
|||||||
[[ -n "$LIBMAKEPKG_EXECUTABLE_SH" ]] && return
|
[[ -n "$LIBMAKEPKG_EXECUTABLE_SH" ]] && return
|
||||||
LIBMAKEPKG_EXECUTABLE_SH=1
|
LIBMAKEPKG_EXECUTABLE_SH=1
|
||||||
|
|
||||||
MAKEPKG_LIBRARY=${MAKEPKG_LIBRARY:-'@libmakepkgdir@'}
|
LIBRARY=${LIBRARY:-'@libmakepkgdir@'}
|
||||||
|
|
||||||
declare -a executable_functions
|
declare -a executable_functions
|
||||||
|
|
||||||
for lib in "$MAKEPKG_LIBRARY/executable/"*.sh; do
|
for lib in "$LIBRARY/executable/"*.sh; do
|
||||||
source "$lib"
|
source "$lib"
|
||||||
done
|
done
|
||||||
|
|
||||||
|
|||||||
@@ -21,10 +21,10 @@
|
|||||||
[[ -n "$LIBMAKEPKG_EXECUTABLE_CCACHE_SH" ]] && return
|
[[ -n "$LIBMAKEPKG_EXECUTABLE_CCACHE_SH" ]] && return
|
||||||
LIBMAKEPKG_EXECUTABLE_CCACHE_SH=1
|
LIBMAKEPKG_EXECUTABLE_CCACHE_SH=1
|
||||||
|
|
||||||
MAKEPKG_LIBRARY=${MAKEPKG_LIBRARY:-'@libmakepkgdir@'}
|
LIBRARY=${LIBRARY:-'@libmakepkgdir@'}
|
||||||
|
|
||||||
source "$MAKEPKG_LIBRARY/util/message.sh"
|
source "$LIBRARY/util/message.sh"
|
||||||
source "$MAKEPKG_LIBRARY/util/option.sh"
|
source "$LIBRARY/util/option.sh"
|
||||||
|
|
||||||
executable_functions+=('executable_ccache')
|
executable_functions+=('executable_ccache')
|
||||||
|
|
||||||
|
|||||||
@@ -21,9 +21,9 @@
|
|||||||
[[ -n "$LIBMAKEPKG_EXECUTABLE_CHECKSUM_SH" ]] && return
|
[[ -n "$LIBMAKEPKG_EXECUTABLE_CHECKSUM_SH" ]] && return
|
||||||
LIBMAKEPKG_EXECUTABLE_CHECKSUM_SH=1
|
LIBMAKEPKG_EXECUTABLE_CHECKSUM_SH=1
|
||||||
|
|
||||||
MAKEPKG_LIBRARY=${MAKEPKG_LIBRARY:-'@libmakepkgdir@'}
|
LIBRARY=${LIBRARY:-'@libmakepkgdir@'}
|
||||||
|
|
||||||
source "$MAKEPKG_LIBRARY/util/message.sh"
|
source "$LIBRARY/util/message.sh"
|
||||||
|
|
||||||
executable_functions+=('executable_checksum')
|
executable_functions+=('executable_checksum')
|
||||||
|
|
||||||
|
|||||||
@@ -21,10 +21,10 @@
|
|||||||
[[ -n "$LIBMAKEPKG_EXECUTABLE_DEBUGEDIT_SH" ]] && return
|
[[ -n "$LIBMAKEPKG_EXECUTABLE_DEBUGEDIT_SH" ]] && return
|
||||||
LIBMAKEPKG_EXECUTABLE_DEBUGEDIT_SH=1
|
LIBMAKEPKG_EXECUTABLE_DEBUGEDIT_SH=1
|
||||||
|
|
||||||
MAKEPKG_LIBRARY=${MAKEPKG_LIBRARY:-'@libmakepkgdir@'}
|
LIBRARY=${LIBRARY:-'@libmakepkgdir@'}
|
||||||
|
|
||||||
source "$MAKEPKG_LIBRARY/util/message.sh"
|
source "$LIBRARY/util/message.sh"
|
||||||
source "$MAKEPKG_LIBRARY/util/option.sh"
|
source "$LIBRARY/util/option.sh"
|
||||||
|
|
||||||
executable_functions+=('executable_debugedit')
|
executable_functions+=('executable_debugedit')
|
||||||
|
|
||||||
|
|||||||
@@ -21,10 +21,10 @@
|
|||||||
[[ -n "$LIBMAKEPKG_EXECUTABLE_DISTCC_SH" ]] && return
|
[[ -n "$LIBMAKEPKG_EXECUTABLE_DISTCC_SH" ]] && return
|
||||||
LIBMAKEPKG_EXECUTABLE_DISTCC_SH=1
|
LIBMAKEPKG_EXECUTABLE_DISTCC_SH=1
|
||||||
|
|
||||||
MAKEPKG_LIBRARY=${MAKEPKG_LIBRARY:-'@libmakepkgdir@'}
|
LIBRARY=${LIBRARY:-'@libmakepkgdir@'}
|
||||||
|
|
||||||
source "$MAKEPKG_LIBRARY/util/message.sh"
|
source "$LIBRARY/util/message.sh"
|
||||||
source "$MAKEPKG_LIBRARY/util/option.sh"
|
source "$LIBRARY/util/option.sh"
|
||||||
|
|
||||||
executable_functions+=('executable_distcc')
|
executable_functions+=('executable_distcc')
|
||||||
|
|
||||||
|
|||||||
@@ -21,9 +21,9 @@
|
|||||||
[[ -n "$LIBMAKEPKG_EXECUTABLE_FAKEROOT_SH" ]] && return
|
[[ -n "$LIBMAKEPKG_EXECUTABLE_FAKEROOT_SH" ]] && return
|
||||||
LIBMAKEPKG_EXECUTABLE_FAKEROOT_SH=1
|
LIBMAKEPKG_EXECUTABLE_FAKEROOT_SH=1
|
||||||
|
|
||||||
MAKEPKG_LIBRARY=${MAKEPKG_LIBRARY:-'@libmakepkgdir@'}
|
LIBRARY=${LIBRARY:-'@libmakepkgdir@'}
|
||||||
|
|
||||||
source "$MAKEPKG_LIBRARY/util/message.sh"
|
source "$LIBRARY/util/message.sh"
|
||||||
|
|
||||||
executable_functions+=('executable_fakeroot')
|
executable_functions+=('executable_fakeroot')
|
||||||
|
|
||||||
|
|||||||
@@ -21,10 +21,10 @@
|
|||||||
[[ -n "$LIBMAKEPKG_EXECUTABLE_GPG_SH" ]] && return
|
[[ -n "$LIBMAKEPKG_EXECUTABLE_GPG_SH" ]] && return
|
||||||
LIBMAKEPKG_EXECUTABLE_GPG_SH=1
|
LIBMAKEPKG_EXECUTABLE_GPG_SH=1
|
||||||
|
|
||||||
MAKEPKG_LIBRARY=${MAKEPKG_LIBRARY:-'@libmakepkgdir@'}
|
LIBRARY=${LIBRARY:-'@libmakepkgdir@'}
|
||||||
|
|
||||||
source "$MAKEPKG_LIBRARY/util/message.sh"
|
source "$LIBRARY/util/message.sh"
|
||||||
source "$MAKEPKG_LIBRARY/util/option.sh"
|
source "$LIBRARY/util/option.sh"
|
||||||
|
|
||||||
executable_functions+=('executable_gpg')
|
executable_functions+=('executable_gpg')
|
||||||
|
|
||||||
|
|||||||
@@ -21,10 +21,10 @@
|
|||||||
[[ -n "$LIBMAKEPKG_EXECUTABLE_GZIP_SH" ]] && return
|
[[ -n "$LIBMAKEPKG_EXECUTABLE_GZIP_SH" ]] && return
|
||||||
LIBMAKEPKG_EXECUTABLE_GZIP_SH=1
|
LIBMAKEPKG_EXECUTABLE_GZIP_SH=1
|
||||||
|
|
||||||
MAKEPKG_LIBRARY=${MAKEPKG_LIBRARY:-'@libmakepkgdir@'}
|
LIBRARY=${LIBRARY:-'@libmakepkgdir@'}
|
||||||
|
|
||||||
source "$MAKEPKG_LIBRARY/util/message.sh"
|
source "$LIBRARY/util/message.sh"
|
||||||
source "$MAKEPKG_LIBRARY/util/option.sh"
|
source "$LIBRARY/util/option.sh"
|
||||||
|
|
||||||
executable_functions+=('executable_gzip')
|
executable_functions+=('executable_gzip')
|
||||||
|
|
||||||
|
|||||||
@@ -21,9 +21,9 @@
|
|||||||
[[ -n "$LIBMAKEPKG_EXECUTABLE_PACMAN_SH" ]] && return
|
[[ -n "$LIBMAKEPKG_EXECUTABLE_PACMAN_SH" ]] && return
|
||||||
LIBMAKEPKG_EXECUTABLE_PACMAN_SH=1
|
LIBMAKEPKG_EXECUTABLE_PACMAN_SH=1
|
||||||
|
|
||||||
MAKEPKG_LIBRARY=${MAKEPKG_LIBRARY:-'@libmakepkgdir@'}
|
LIBRARY=${LIBRARY:-'@libmakepkgdir@'}
|
||||||
|
|
||||||
source "$MAKEPKG_LIBRARY/util/message.sh"
|
source "$LIBRARY/util/message.sh"
|
||||||
|
|
||||||
executable_functions+=('executable_pacman')
|
executable_functions+=('executable_pacman')
|
||||||
|
|
||||||
|
|||||||
@@ -21,10 +21,10 @@
|
|||||||
[[ -n "$LIBMAKEPKG_EXECUTABLE_STRIP_SH" ]] && return
|
[[ -n "$LIBMAKEPKG_EXECUTABLE_STRIP_SH" ]] && return
|
||||||
LIBMAKEPKG_EXECUTABLE_STRIP_SH=1
|
LIBMAKEPKG_EXECUTABLE_STRIP_SH=1
|
||||||
|
|
||||||
MAKEPKG_LIBRARY=${MAKEPKG_LIBRARY:-'@libmakepkgdir@'}
|
LIBRARY=${LIBRARY:-'@libmakepkgdir@'}
|
||||||
|
|
||||||
source "$MAKEPKG_LIBRARY/util/message.sh"
|
source "$LIBRARY/util/message.sh"
|
||||||
source "$MAKEPKG_LIBRARY/util/option.sh"
|
source "$LIBRARY/util/option.sh"
|
||||||
|
|
||||||
executable_functions+=('executable_strip')
|
executable_functions+=('executable_strip')
|
||||||
|
|
||||||
|
|||||||
@@ -21,9 +21,9 @@
|
|||||||
[[ -n "$LIBMAKEPKG_EXECUTABLE_SUDO_SH" ]] && return
|
[[ -n "$LIBMAKEPKG_EXECUTABLE_SUDO_SH" ]] && return
|
||||||
LIBMAKEPKG_EXECUTABLE_SUDO_SH=1
|
LIBMAKEPKG_EXECUTABLE_SUDO_SH=1
|
||||||
|
|
||||||
MAKEPKG_LIBRARY=${MAKEPKG_LIBRARY:-'@libmakepkgdir@'}
|
LIBRARY=${LIBRARY:-'@libmakepkgdir@'}
|
||||||
|
|
||||||
source "$MAKEPKG_LIBRARY/util/message.sh"
|
source "$LIBRARY/util/message.sh"
|
||||||
|
|
||||||
executable_functions+=('executable_sudo')
|
executable_functions+=('executable_sudo')
|
||||||
|
|
||||||
|
|||||||
@@ -21,10 +21,10 @@
|
|||||||
[[ -n "$LIBMAKEPKG_EXECUTABLE_VCS_SH" ]] && return
|
[[ -n "$LIBMAKEPKG_EXECUTABLE_VCS_SH" ]] && return
|
||||||
LIBMAKEPKG_EXECUTABLE_VCS_SH=1
|
LIBMAKEPKG_EXECUTABLE_VCS_SH=1
|
||||||
|
|
||||||
MAKEPKG_LIBRARY=${MAKEPKG_LIBRARY:-'@libmakepkgdir@'}
|
LIBRARY=${LIBRARY:-'@libmakepkgdir@'}
|
||||||
|
|
||||||
source "$MAKEPKG_LIBRARY/util/error.sh"
|
source "$LIBRARY/util/error.sh"
|
||||||
source "$MAKEPKG_LIBRARY/util/message.sh"
|
source "$LIBRARY/util/message.sh"
|
||||||
|
|
||||||
executable_functions+=('executable_vcs')
|
executable_functions+=('executable_vcs')
|
||||||
|
|
||||||
|
|||||||
@@ -21,11 +21,11 @@
|
|||||||
[[ -n "$LIBMAKEPKG_INTEGRITY_SH" ]] && return
|
[[ -n "$LIBMAKEPKG_INTEGRITY_SH" ]] && return
|
||||||
LIBMAKEPKG_INTEGRITY_SH=1
|
LIBMAKEPKG_INTEGRITY_SH=1
|
||||||
|
|
||||||
MAKEPKG_LIBRARY=${MAKEPKG_LIBRARY:-'@libmakepkgdir@'}
|
LIBRARY=${LIBRARY:-'@libmakepkgdir@'}
|
||||||
|
|
||||||
source "$MAKEPKG_LIBRARY/util/message.sh"
|
source "$LIBRARY/util/message.sh"
|
||||||
|
|
||||||
for lib in "$MAKEPKG_LIBRARY/integrity/"*.sh; do
|
for lib in "$LIBRARY/integrity/"*.sh; do
|
||||||
source "$lib"
|
source "$lib"
|
||||||
done
|
done
|
||||||
|
|
||||||
@@ -42,7 +42,4 @@ check_source_integrity() {
|
|||||||
check_checksums "$@"
|
check_checksums "$@"
|
||||||
check_pgpsigs "$@"
|
check_pgpsigs "$@"
|
||||||
fi
|
fi
|
||||||
if (( VERIFYFUNC )); then
|
|
||||||
run_verify
|
|
||||||
fi
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,11 +21,11 @@
|
|||||||
[[ -n "$LIBMAKEPKG_INTEGRITY_GENERATE_CHECKSUM_SH" ]] && return
|
[[ -n "$LIBMAKEPKG_INTEGRITY_GENERATE_CHECKSUM_SH" ]] && return
|
||||||
LIBMAKEPKG_INTEGRITY_GENERATE_CHECKSUM_SH=1
|
LIBMAKEPKG_INTEGRITY_GENERATE_CHECKSUM_SH=1
|
||||||
|
|
||||||
MAKEPKG_LIBRARY=${MAKEPKG_LIBRARY:-'@libmakepkgdir@'}
|
LIBRARY=${LIBRARY:-'@libmakepkgdir@'}
|
||||||
|
|
||||||
source "$MAKEPKG_LIBRARY/util/message.sh"
|
source "$LIBRARY/util/message.sh"
|
||||||
source "$MAKEPKG_LIBRARY/util/pkgbuild.sh"
|
source "$LIBRARY/util/pkgbuild.sh"
|
||||||
source "$MAKEPKG_LIBRARY/util/schema.sh"
|
source "$LIBRARY/util/schema.sh"
|
||||||
|
|
||||||
generate_one_checksum() {
|
generate_one_checksum() {
|
||||||
local integ=$1 arch=$2 sources numsrc indentsz idx
|
local integ=$1 arch=$2 sources numsrc indentsz idx
|
||||||
@@ -54,17 +54,7 @@ generate_one_checksum() {
|
|||||||
|
|
||||||
case $proto in
|
case $proto in
|
||||||
bzr|git|hg|svn)
|
bzr|git|hg|svn)
|
||||||
if declare -f "calc_checksum_$proto" > /dev/null; then
|
|
||||||
if ! sum=$("calc_checksum_$proto" "$netfile" "$integ"); then
|
|
||||||
local name
|
|
||||||
name=$(get_filename "$netfile")
|
|
||||||
error "$(gettext "Failure while calculating %s %s checksum")" "${name}" "${proto}"
|
|
||||||
plainerr "$(gettext "Aborting...")"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
sum="SKIP"
|
sum="SKIP"
|
||||||
fi
|
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
if [[ ${netfile%%::*} != *.@(sig?(n)|asc) ]]; then
|
if [[ ${netfile%%::*} != *.@(sig?(n)|asc) ]]; then
|
||||||
|
|||||||
@@ -21,9 +21,9 @@
|
|||||||
[[ -n "$LIBMAKEPKG_INTEGRITY_GENERATE_SIGNATURE_SH" ]] && return
|
[[ -n "$LIBMAKEPKG_INTEGRITY_GENERATE_SIGNATURE_SH" ]] && return
|
||||||
LIBMAKEPKG_INTEGRITY_GENERATE_SIGNATURE_SH=1
|
LIBMAKEPKG_INTEGRITY_GENERATE_SIGNATURE_SH=1
|
||||||
|
|
||||||
MAKEPKG_LIBRARY=${MAKEPKG_LIBRARY:-'@libmakepkgdir@'}
|
LIBRARY=${LIBRARY:-'@libmakepkgdir@'}
|
||||||
|
|
||||||
source "$MAKEPKG_LIBRARY/util/message.sh"
|
source "$LIBRARY/util/message.sh"
|
||||||
|
|
||||||
create_signature() {
|
create_signature() {
|
||||||
local ret=0
|
local ret=0
|
||||||
|
|||||||
@@ -21,12 +21,11 @@
|
|||||||
[[ -n "$LIBMAKEPKG_INTEGRITY_VERIFY_CHECKSUM_SH" ]] && return
|
[[ -n "$LIBMAKEPKG_INTEGRITY_VERIFY_CHECKSUM_SH" ]] && return
|
||||||
LIBMAKEPKG_INTEGRITY_CHECKSUM_SH=1
|
LIBMAKEPKG_INTEGRITY_CHECKSUM_SH=1
|
||||||
|
|
||||||
MAKEPKG_LIBRARY=${MAKEPKG_LIBRARY:-'@libmakepkgdir@'}
|
LIBRARY=${LIBRARY:-'@libmakepkgdir@'}
|
||||||
|
|
||||||
source "$MAKEPKG_LIBRARY/util/message.sh"
|
source "$LIBRARY/util/message.sh"
|
||||||
source "$MAKEPKG_LIBRARY/util/pkgbuild.sh"
|
source "$LIBRARY/util/pkgbuild.sh"
|
||||||
source "$MAKEPKG_LIBRARY/util/schema.sh"
|
source "$LIBRARY/util/schema.sh"
|
||||||
source "$MAKEPKG_LIBRARY/source.sh"
|
|
||||||
|
|
||||||
check_checksums() {
|
check_checksums() {
|
||||||
local integ a
|
local integ a
|
||||||
@@ -69,9 +68,9 @@ check_checksums() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
verify_integrity_one() {
|
verify_integrity_one() {
|
||||||
local source_name=$1 integ=$2 expectedsum=$3 file proto realsum
|
local source_name=$1 integ=$2 expectedsum=$3
|
||||||
|
|
||||||
file="$(get_filename "$source_name")"
|
local file="$(get_filename "$source_name")"
|
||||||
printf ' %s ... ' "$file" >&2
|
printf ' %s ... ' "$file" >&2
|
||||||
|
|
||||||
if [[ $expectedsum = 'SKIP' ]]; then
|
if [[ $expectedsum = 'SKIP' ]]; then
|
||||||
@@ -79,18 +78,20 @@ verify_integrity_one() {
|
|||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
|
|
||||||
proto="$(get_protocol "$source_name")"
|
if ! file="$(get_filepath "$file")"; then
|
||||||
if declare -f "calc_checksum_${proto}" > /dev/null; then
|
printf '%s\n' "$(gettext "NOT FOUND")" >&2
|
||||||
realsum=$("calc_checksum_${proto}" "$source_name" "$integ") || return 1
|
return 1
|
||||||
else
|
|
||||||
realsum=$(calc_checksum_file "$source_name" "$integ") || return 1
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ ${expectedsum,,} != "$realsum" ]]; then
|
local realsum="$("${integ}sum" "$file")"
|
||||||
|
realsum="${realsum%% *}"
|
||||||
|
if [[ ${expectedsum,,} = "$realsum" ]]; then
|
||||||
|
printf '%s\n' "$(gettext "Passed")" >&2
|
||||||
|
else
|
||||||
printf '%s\n' "$(gettext "FAILED")" >&2
|
printf '%s\n' "$(gettext "FAILED")" >&2
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
printf '%s\n' "$(gettext "Passed")" >&2
|
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -21,16 +21,10 @@
|
|||||||
[[ -n "$LIBMAKEPKG_INTEGRITY_VERIFY_SIGNATURE_SH" ]] && return
|
[[ -n "$LIBMAKEPKG_INTEGRITY_VERIFY_SIGNATURE_SH" ]] && return
|
||||||
LIBMAKEPKG_INTEGRITY_VERIFY_SIGNATURE_SH=1
|
LIBMAKEPKG_INTEGRITY_VERIFY_SIGNATURE_SH=1
|
||||||
|
|
||||||
MAKEPKG_LIBRARY=${MAKEPKG_LIBRARY:-'@libmakepkgdir@'}
|
LIBRARY=${LIBRARY:-'@libmakepkgdir@'}
|
||||||
|
|
||||||
source "$MAKEPKG_LIBRARY/util/message.sh"
|
source "$LIBRARY/util/message.sh"
|
||||||
source "$MAKEPKG_LIBRARY/util/pkgbuild.sh"
|
source "$LIBRARY/util/pkgbuild.sh"
|
||||||
|
|
||||||
# Filter the contents of a GnuPG statusfile to only contain understood terms to narrow the file's scope and circumvent
|
|
||||||
# the use of terms (e.g. NOTATION_DATA) that may contain unescaped binary data
|
|
||||||
filter_gnupg_statusfile() {
|
|
||||||
grep -E "(.*SIG| TRUST_.*)"
|
|
||||||
}
|
|
||||||
|
|
||||||
check_pgpsigs() {
|
check_pgpsigs() {
|
||||||
(( SKIPPGPCHECK )) && return 0
|
(( SKIPPGPCHECK )) && return 0
|
||||||
@@ -41,7 +35,6 @@ check_pgpsigs() {
|
|||||||
local netfile proto pubkey success status fingerprint trusted
|
local netfile proto pubkey success status fingerprint trusted
|
||||||
local warnings=0
|
local warnings=0
|
||||||
local errors=0
|
local errors=0
|
||||||
local statusfile_raw="$(mktemp)"
|
|
||||||
local statusfile=$(mktemp)
|
local statusfile=$(mktemp)
|
||||||
local all_sources
|
local all_sources
|
||||||
|
|
||||||
@@ -110,7 +103,7 @@ check_pgpsigs() {
|
|||||||
printf '\n' >&2
|
printf '\n' >&2
|
||||||
done
|
done
|
||||||
|
|
||||||
rm -f "$statusfile" "$statusfile_raw"
|
rm -f "$statusfile"
|
||||||
|
|
||||||
if (( errors )); then
|
if (( errors )); then
|
||||||
error "$(gettext "One or more PGP signatures could not be verified!")"
|
error "$(gettext "One or more PGP signatures could not be verified!")"
|
||||||
@@ -164,20 +157,7 @@ verify_file_signature() {
|
|||||||
"") decompress="cat" ;;
|
"") decompress="cat" ;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
# verify the signature and write metadata to a status file
|
$decompress < "$sourcefile" | gpg --quiet --batch --status-file "$statusfile" --verify "$file" - 2> /dev/null
|
||||||
if ! $decompress < "$sourcefile" | gpg --quiet --batch --status-file "$statusfile_raw" --verify "$file" - 2> /dev/null; then
|
|
||||||
printf '%s\n' "$(gettext "%s is unable to verify the signature.")" "gpg" >&2
|
|
||||||
errors=1
|
|
||||||
return 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
# create a statusfile that contains only understood terms
|
|
||||||
if ! filter_gnupg_statusfile > "$statusfile" < "$statusfile_raw"; then
|
|
||||||
printf '%s\n' "$(gettext "unable to extract signature metadata.")" >&2
|
|
||||||
errors=1
|
|
||||||
return 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -209,32 +189,17 @@ verify_git_signature() {
|
|||||||
|
|
||||||
printf " %s git repo ... " "${dir##*/}" >&2
|
printf " %s git repo ... " "${dir##*/}" >&2
|
||||||
|
|
||||||
# verify the signature and write metadata to a status file
|
git -C "$dir" verify-$fragtype --raw "$fragval" > "$statusfile" 2>&1
|
||||||
if ! git -C "$dir" verify-$fragtype --raw "$fragval" > "$statusfile_raw" 2>&1; then
|
|
||||||
printf '%s\n' "$(gettext "%s is unable to verify the signature.")" "git" >&2
|
|
||||||
errors=1
|
|
||||||
return 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
# create a statusfile that contains only understood terms
|
|
||||||
if ! filter_gnupg_statusfile > "$statusfile" < "$statusfile_raw"; then
|
|
||||||
printf '%s\n' "$(gettext "unable to extract signature metadata.")" >&2
|
|
||||||
errors=1
|
|
||||||
return 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
return 0
|
|
||||||
}
|
|
||||||
|
|
||||||
parse_gpg_statusfile() {
|
|
||||||
local type arg1 arg6 arg10
|
|
||||||
|
|
||||||
# ensure the NEWSIG keyword is part of the metadata
|
|
||||||
if ! grep -qs NEWSIG "$statusfile"; then
|
if ! grep -qs NEWSIG "$statusfile"; then
|
||||||
printf '%s\n' "$(gettext "SIGNATURE NOT FOUND")" >&2
|
printf '%s\n' "$(gettext "SIGNATURE NOT FOUND")" >&2
|
||||||
errors=1
|
errors=1
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
parse_gpg_statusfile() {
|
||||||
|
local type arg1 arg6 arg10
|
||||||
|
|
||||||
while read -r _ type arg1 _ _ _ _ arg6 _ _ _ arg10 _; do
|
while read -r _ type arg1 _ _ _ _ arg6 _ _ _ arg10 _; do
|
||||||
case "$type" in
|
case "$type" in
|
||||||
|
|||||||
@@ -21,15 +21,15 @@
|
|||||||
[[ -n "$LIBMAKEPKG_LINT_CONFIG_SH" ]] && return
|
[[ -n "$LIBMAKEPKG_LINT_CONFIG_SH" ]] && return
|
||||||
LIBMAKEPKG_LINT_CONFIG_SH=1
|
LIBMAKEPKG_LINT_CONFIG_SH=1
|
||||||
|
|
||||||
MAKEPKG_LIBRARY=${MAKEPKG_LIBRARY:-'/usr/share/makepkg'}
|
LIBRARY=${LIBRARY:-'/usr/share/makepkg'}
|
||||||
|
|
||||||
source "$MAKEPKG_LIBRARY/util/message.sh"
|
source "$LIBRARY/util/message.sh"
|
||||||
source "$MAKEPKG_LIBRARY/util/util.sh"
|
source "$LIBRARY/util/util.sh"
|
||||||
|
|
||||||
|
|
||||||
declare -a lint_config_functions
|
declare -a lint_config_functions
|
||||||
|
|
||||||
for lib in "$MAKEPKG_LIBRARY/lint_config/"*.sh; do
|
for lib in "$LIBRARY/lint_config/"*.sh; do
|
||||||
source "$lib"
|
source "$lib"
|
||||||
done
|
done
|
||||||
|
|
||||||
|
|||||||
@@ -21,9 +21,9 @@
|
|||||||
[[ -n "$LIBMAKEPKG_LINT_CONFIG_EXT_SH" ]] && return
|
[[ -n "$LIBMAKEPKG_LINT_CONFIG_EXT_SH" ]] && return
|
||||||
LIBMAKEPKG_LINT_CONFIG_EXT_SH=1
|
LIBMAKEPKG_LINT_CONFIG_EXT_SH=1
|
||||||
|
|
||||||
MAKEPKG_LIBRARY=${MAKEPKG_LIBRARY:-'@libmakepkgdir@'}
|
LIBRARY=${LIBRARY:-'@libmakepkgdir@'}
|
||||||
|
|
||||||
source "$MAKEPKG_LIBRARY/util/message.sh"
|
source "$LIBRARY/util/message.sh"
|
||||||
|
|
||||||
lint_config_functions+=('lint_ext')
|
lint_config_functions+=('lint_ext')
|
||||||
|
|
||||||
|
|||||||
@@ -21,10 +21,10 @@
|
|||||||
[[ -n "$LIBMAKEPKG_LINT_CONFIG_PATHS_SH" ]] && return
|
[[ -n "$LIBMAKEPKG_LINT_CONFIG_PATHS_SH" ]] && return
|
||||||
LIBMAKEPKG_LINT_CONFIG_PATHS_SH=1
|
LIBMAKEPKG_LINT_CONFIG_PATHS_SH=1
|
||||||
|
|
||||||
MAKEPKG_LIBRARY=${MAKEPKG_LIBRARY:-'@libmakepkgdir@'}
|
LIBRARY=${LIBRARY:-'@libmakepkgdir@'}
|
||||||
|
|
||||||
source "$MAKEPKG_LIBRARY/util/message.sh"
|
source "$LIBRARY/util/message.sh"
|
||||||
source "$MAKEPKG_LIBRARY/util/pkgbuild.sh"
|
source "$LIBRARY/util/pkgbuild.sh"
|
||||||
|
|
||||||
lint_config_functions+=('lint_paths')
|
lint_config_functions+=('lint_paths')
|
||||||
|
|
||||||
|
|||||||
@@ -21,9 +21,9 @@
|
|||||||
[[ -n $LIBMAKEPKG_LINT_CONFIG_SOURCE_DATE_EPOCH_SH ]] && return
|
[[ -n $LIBMAKEPKG_LINT_CONFIG_SOURCE_DATE_EPOCH_SH ]] && return
|
||||||
LIBMAKEPKG_LINT_CONFIG_SOURCE_DATE_EPOCH_SH=1
|
LIBMAKEPKG_LINT_CONFIG_SOURCE_DATE_EPOCH_SH=1
|
||||||
|
|
||||||
MAKEPKG_LIBRARY=${MAKEPKG_LIBRARY:-'@libmakepkgdir@'}
|
LIBRARY=${LIBRARY:-'@libmakepkgdir@'}
|
||||||
|
|
||||||
source "$MAKEPKG_LIBRARY/util/message.sh"
|
source "$LIBRARY/util/message.sh"
|
||||||
|
|
||||||
lint_config_functions+=('lint_source_date_epoch')
|
lint_config_functions+=('lint_source_date_epoch')
|
||||||
|
|
||||||
|
|||||||
@@ -21,9 +21,9 @@
|
|||||||
[[ -n "$LIBMAKEPKG_LINT_CONFIG_VARIABLE_SH" ]] && return
|
[[ -n "$LIBMAKEPKG_LINT_CONFIG_VARIABLE_SH" ]] && return
|
||||||
LIBMAKEPKG_LINT_CONFIG_VARIABLE_SH=1
|
LIBMAKEPKG_LINT_CONFIG_VARIABLE_SH=1
|
||||||
|
|
||||||
MAKEPKG_LIBRARY=${MAKEPKG_LIBRARY:-'@libmakepkgdir@'}
|
LIBRARY=${LIBRARY:-'@libmakepkgdir@'}
|
||||||
|
|
||||||
source "$MAKEPKG_LIBRARY/util/message.sh"
|
source "$LIBRARY/util/message.sh"
|
||||||
|
|
||||||
lint_config_functions+=('lint_config_variables')
|
lint_config_functions+=('lint_config_variables')
|
||||||
|
|
||||||
|
|||||||
@@ -21,15 +21,15 @@
|
|||||||
[[ -n "$LIBMAKEPKG_LINT_PACKAGE_SH" ]] && return
|
[[ -n "$LIBMAKEPKG_LINT_PACKAGE_SH" ]] && return
|
||||||
LIBMAKEPKG_LINT_PACKAGE_SH=1
|
LIBMAKEPKG_LINT_PACKAGE_SH=1
|
||||||
|
|
||||||
MAKEPKG_LIBRARY=${MAKEPKG_LIBRARY:-'@libmakepkgdir@'}
|
LIBRARY=${LIBRARY:-'@libmakepkgdir@'}
|
||||||
|
|
||||||
source "$MAKEPKG_LIBRARY/util/message.sh"
|
source "$LIBRARY/util/message.sh"
|
||||||
source "$MAKEPKG_LIBRARY/util/util.sh"
|
source "$LIBRARY/util/util.sh"
|
||||||
|
|
||||||
|
|
||||||
declare -a lint_package_functions
|
declare -a lint_package_functions
|
||||||
|
|
||||||
for lib in "$MAKEPKG_LIBRARY/lint_package/"*.sh; do
|
for lib in "$LIBRARY/lint_package/"*.sh; do
|
||||||
source "$lib"
|
source "$lib"
|
||||||
done
|
done
|
||||||
|
|
||||||
|
|||||||
@@ -21,9 +21,9 @@
|
|||||||
[[ -n "$LIBMAKEPKG_LINT_PACKAGE_BUILD_REFERENCES_SH" ]] && return
|
[[ -n "$LIBMAKEPKG_LINT_PACKAGE_BUILD_REFERENCES_SH" ]] && return
|
||||||
LIBMAKEPKG_LINT_PACKAGE_BUILD_REFERENCES_SH=1
|
LIBMAKEPKG_LINT_PACKAGE_BUILD_REFERENCES_SH=1
|
||||||
|
|
||||||
MAKEPKG_LIBRARY=${MAKEPKG_LIBRARY:-'@libmakepkgdir@'}
|
LIBRARY=${LIBRARY:-'@libmakepkgdir@'}
|
||||||
|
|
||||||
source "$MAKEPKG_LIBRARY/util/message.sh"
|
source "$LIBRARY/util/message.sh"
|
||||||
|
|
||||||
lint_package_functions+=('warn_build_references')
|
lint_package_functions+=('warn_build_references')
|
||||||
|
|
||||||
|
|||||||
@@ -21,9 +21,9 @@
|
|||||||
[[ -n "$LIBMAKEPKG_LINT_PACKAGE_DOTFILES_SH" ]] && return
|
[[ -n "$LIBMAKEPKG_LINT_PACKAGE_DOTFILES_SH" ]] && return
|
||||||
LIBMAKEPKG_LINT_PACKAGE_DOTFILES_SH=1
|
LIBMAKEPKG_LINT_PACKAGE_DOTFILES_SH=1
|
||||||
|
|
||||||
MAKEPKG_LIBRARY=${MAKEPKG_LIBRARY:-'@libmakepkgdir@'}
|
LIBRARY=${LIBRARY:-'@libmakepkgdir@'}
|
||||||
|
|
||||||
source "$MAKEPKG_LIBRARY/util/message.sh"
|
source "$LIBRARY/util/message.sh"
|
||||||
|
|
||||||
lint_package_functions+=('check_dotfiles')
|
lint_package_functions+=('check_dotfiles')
|
||||||
|
|
||||||
|
|||||||
@@ -21,9 +21,9 @@
|
|||||||
[[ -n "$LIBMAKEPKG_LINT_PACKAGE_FILE_NAMES_SH" ]] && return
|
[[ -n "$LIBMAKEPKG_LINT_PACKAGE_FILE_NAMES_SH" ]] && return
|
||||||
LIBMAKEPKG_LINT_PACKAGE_FILE_NAMES_SH=1
|
LIBMAKEPKG_LINT_PACKAGE_FILE_NAMES_SH=1
|
||||||
|
|
||||||
MAKEPKG_LIBRARY=${MAKEPKG_LIBRARY:-'@libmakepkgdir@'}
|
LIBRARY=${LIBRARY:-'@libmakepkgdir@'}
|
||||||
|
|
||||||
source "$MAKEPKG_LIBRARY/util/message.sh"
|
source "$LIBRARY/util/message.sh"
|
||||||
|
|
||||||
lint_package_functions+=('lint_file_names')
|
lint_package_functions+=('lint_file_names')
|
||||||
|
|
||||||
|
|||||||
@@ -21,9 +21,9 @@
|
|||||||
[[ -n "$LIBMAKEPKG_LINT_PACKAGE_MISSING_BACKUP_SH" ]] && return
|
[[ -n "$LIBMAKEPKG_LINT_PACKAGE_MISSING_BACKUP_SH" ]] && return
|
||||||
LIBMAKEPKG_LINT_PACKAGE_MISSING_BACKUP_SH=1
|
LIBMAKEPKG_LINT_PACKAGE_MISSING_BACKUP_SH=1
|
||||||
|
|
||||||
MAKEPKG_LIBRARY=${MAKEPKG_LIBRARY:-'@libmakepkgdir@'}
|
LIBRARY=${LIBRARY:-'@libmakepkgdir@'}
|
||||||
|
|
||||||
source "$MAKEPKG_LIBRARY/util/message.sh"
|
source "$LIBRARY/util/message.sh"
|
||||||
|
|
||||||
|
|
||||||
lint_package_functions+=('warn_missing_backup')
|
lint_package_functions+=('warn_missing_backup')
|
||||||
|
|||||||
@@ -21,14 +21,14 @@
|
|||||||
[[ -n "$LIBMAKEPKG_LINT_PKGBUILD_SH" ]] && return
|
[[ -n "$LIBMAKEPKG_LINT_PKGBUILD_SH" ]] && return
|
||||||
LIBMAKEPKG_LINT_PKGBUILD_SH=1
|
LIBMAKEPKG_LINT_PKGBUILD_SH=1
|
||||||
|
|
||||||
MAKEPKG_LIBRARY=${MAKEPKG_LIBRARY:-'@libmakepkgdir@'}
|
LIBRARY=${LIBRARY:-'@libmakepkgdir@'}
|
||||||
|
|
||||||
source "$MAKEPKG_LIBRARY/util/message.sh"
|
source "$LIBRARY/util/message.sh"
|
||||||
|
|
||||||
|
|
||||||
declare -a lint_pkgbuild_functions
|
declare -a lint_pkgbuild_functions
|
||||||
|
|
||||||
for lib in "$MAKEPKG_LIBRARY/lint_pkgbuild/"*.sh; do
|
for lib in "$LIBRARY/lint_pkgbuild/"*.sh; do
|
||||||
source "$lib"
|
source "$lib"
|
||||||
done
|
done
|
||||||
|
|
||||||
|
|||||||
@@ -21,10 +21,10 @@
|
|||||||
[[ -n "$LIBMAKEPKG_LINT_PKGBUILD_ARCH_SH" ]] && return
|
[[ -n "$LIBMAKEPKG_LINT_PKGBUILD_ARCH_SH" ]] && return
|
||||||
LIBMAKEPKG_LINT_PKGBUILD_ARCH_SH=1
|
LIBMAKEPKG_LINT_PKGBUILD_ARCH_SH=1
|
||||||
|
|
||||||
MAKEPKG_LIBRARY=${MAKEPKG_LIBRARY:-'@libmakepkgdir@'}
|
LIBRARY=${LIBRARY:-'@libmakepkgdir@'}
|
||||||
|
|
||||||
source "$MAKEPKG_LIBRARY/util/message.sh"
|
source "$LIBRARY/util/message.sh"
|
||||||
source "$MAKEPKG_LIBRARY/util/pkgbuild.sh"
|
source "$LIBRARY/util/pkgbuild.sh"
|
||||||
|
|
||||||
|
|
||||||
lint_pkgbuild_functions+=('lint_arch')
|
lint_pkgbuild_functions+=('lint_arch')
|
||||||
|
|||||||
@@ -21,12 +21,12 @@
|
|||||||
[[ -n "$LIBMAKEPKG_LINT_PKGBUILD_ARCH_SPECIFIC_SH" ]] && return
|
[[ -n "$LIBMAKEPKG_LINT_PKGBUILD_ARCH_SPECIFIC_SH" ]] && return
|
||||||
LIBMAKEPKG_LINT_PKGBUILD_ARCH_SPECIFIC_SH=1
|
LIBMAKEPKG_LINT_PKGBUILD_ARCH_SPECIFIC_SH=1
|
||||||
|
|
||||||
MAKEPKG_LIBRARY=${MAKEPKG_LIBRARY:-'@libmakepkgdir@'}
|
LIBRARY=${LIBRARY:-'@libmakepkgdir@'}
|
||||||
|
|
||||||
source "$MAKEPKG_LIBRARY/util/message.sh"
|
source "$LIBRARY/util/message.sh"
|
||||||
source "$MAKEPKG_LIBRARY/util/pkgbuild.sh"
|
source "$LIBRARY/util/pkgbuild.sh"
|
||||||
source "$MAKEPKG_LIBRARY/util/schema.sh"
|
source "$LIBRARY/util/schema.sh"
|
||||||
source "$MAKEPKG_LIBRARY/util/util.sh"
|
source "$LIBRARY/util/util.sh"
|
||||||
|
|
||||||
|
|
||||||
lint_pkgbuild_functions+=('lint_arch_specific')
|
lint_pkgbuild_functions+=('lint_arch_specific')
|
||||||
|
|||||||
@@ -21,10 +21,10 @@
|
|||||||
[[ -n "$LIBMAKEPKG_LINT_PKGBUILD_BACKUP_SH" ]] && return
|
[[ -n "$LIBMAKEPKG_LINT_PKGBUILD_BACKUP_SH" ]] && return
|
||||||
LIBMAKEPKG_LINT_PKGBUILD_BACKUP_SH=1
|
LIBMAKEPKG_LINT_PKGBUILD_BACKUP_SH=1
|
||||||
|
|
||||||
MAKEPKG_LIBRARY=${MAKEPKG_LIBRARY:-'@libmakepkgdir@'}
|
LIBRARY=${LIBRARY:-'@libmakepkgdir@'}
|
||||||
|
|
||||||
source "$MAKEPKG_LIBRARY/util/message.sh"
|
source "$LIBRARY/util/message.sh"
|
||||||
source "$MAKEPKG_LIBRARY/util/pkgbuild.sh"
|
source "$LIBRARY/util/pkgbuild.sh"
|
||||||
|
|
||||||
|
|
||||||
lint_pkgbuild_functions+=('lint_backup')
|
lint_pkgbuild_functions+=('lint_backup')
|
||||||
|
|||||||
@@ -21,11 +21,11 @@
|
|||||||
[[ -n "$LIBMAKEPKG_LINT_PKGBUILD_CHANGELOG_SH" ]] && return
|
[[ -n "$LIBMAKEPKG_LINT_PKGBUILD_CHANGELOG_SH" ]] && return
|
||||||
LIBMAKEPKG_LINT_PKGBUILD_CHANGELOG_SH=1
|
LIBMAKEPKG_LINT_PKGBUILD_CHANGELOG_SH=1
|
||||||
|
|
||||||
MAKEPKG_LIBRARY=${MAKEPKG_LIBRARY:-'@libmakepkgdir@'}
|
LIBRARY=${LIBRARY:-'@libmakepkgdir@'}
|
||||||
|
|
||||||
source "$MAKEPKG_LIBRARY/util/message.sh"
|
source "$LIBRARY/util/message.sh"
|
||||||
source "$MAKEPKG_LIBRARY/util/pkgbuild.sh"
|
source "$LIBRARY/util/pkgbuild.sh"
|
||||||
source "$MAKEPKG_LIBRARY/lint_pkgbuild/util.sh"
|
source "$LIBRARY/lint_pkgbuild/util.sh"
|
||||||
|
|
||||||
|
|
||||||
lint_pkgbuild_functions+=('lint_changelog')
|
lint_pkgbuild_functions+=('lint_changelog')
|
||||||
|
|||||||
@@ -21,12 +21,12 @@
|
|||||||
[[ -n "$LIBMAKEPKG_LINT_PKGBUILD_CHECKDEPENDS_SH" ]] && return
|
[[ -n "$LIBMAKEPKG_LINT_PKGBUILD_CHECKDEPENDS_SH" ]] && return
|
||||||
LIBMAKEPKG_LINT_PKGBUILD_CHECKDEPENDS_SH=1
|
LIBMAKEPKG_LINT_PKGBUILD_CHECKDEPENDS_SH=1
|
||||||
|
|
||||||
MAKEPKG_LIBRARY=${MAKEPKG_LIBRARY:-'@libmakepkgdir@'}
|
LIBRARY=${LIBRARY:-'@libmakepkgdir@'}
|
||||||
|
|
||||||
source "$MAKEPKG_LIBRARY/lint_pkgbuild/fullpkgver.sh"
|
source "$LIBRARY/lint_pkgbuild/fullpkgver.sh"
|
||||||
source "$MAKEPKG_LIBRARY/lint_pkgbuild/pkgname.sh"
|
source "$LIBRARY/lint_pkgbuild/pkgname.sh"
|
||||||
source "$MAKEPKG_LIBRARY/util/message.sh"
|
source "$LIBRARY/util/message.sh"
|
||||||
source "$MAKEPKG_LIBRARY/util/pkgbuild.sh"
|
source "$LIBRARY/util/pkgbuild.sh"
|
||||||
|
|
||||||
|
|
||||||
lint_pkgbuild_functions+=('lint_checkdepends')
|
lint_pkgbuild_functions+=('lint_checkdepends')
|
||||||
|
|||||||
@@ -21,12 +21,12 @@
|
|||||||
[[ -n "$LIBMAKEPKG_LINT_PKGBUILD_CONFLICTS_SH" ]] && return
|
[[ -n "$LIBMAKEPKG_LINT_PKGBUILD_CONFLICTS_SH" ]] && return
|
||||||
LIBMAKEPKG_LINT_PKGBUILD_CONFLICTS_SH=1
|
LIBMAKEPKG_LINT_PKGBUILD_CONFLICTS_SH=1
|
||||||
|
|
||||||
MAKEPKG_LIBRARY=${MAKEPKG_LIBRARY:-'@libmakepkgdir@'}
|
LIBRARY=${LIBRARY:-'@libmakepkgdir@'}
|
||||||
|
|
||||||
source "$MAKEPKG_LIBRARY/lint_pkgbuild/fullpkgver.sh"
|
source "$LIBRARY/lint_pkgbuild/fullpkgver.sh"
|
||||||
source "$MAKEPKG_LIBRARY/lint_pkgbuild/pkgname.sh"
|
source "$LIBRARY/lint_pkgbuild/pkgname.sh"
|
||||||
source "$MAKEPKG_LIBRARY/util/message.sh"
|
source "$LIBRARY/util/message.sh"
|
||||||
source "$MAKEPKG_LIBRARY/util/pkgbuild.sh"
|
source "$LIBRARY/util/pkgbuild.sh"
|
||||||
|
|
||||||
|
|
||||||
lint_pkgbuild_functions+=('lint_conflicts')
|
lint_pkgbuild_functions+=('lint_conflicts')
|
||||||
|
|||||||
@@ -21,12 +21,12 @@
|
|||||||
[[ -n "$LIBMAKEPKG_LINT_PKGBUILD_DEPENDS_SH" ]] && return
|
[[ -n "$LIBMAKEPKG_LINT_PKGBUILD_DEPENDS_SH" ]] && return
|
||||||
LIBMAKEPKG_LINT_PKGBUILD_DEPENDS_SH=1
|
LIBMAKEPKG_LINT_PKGBUILD_DEPENDS_SH=1
|
||||||
|
|
||||||
MAKEPKG_LIBRARY=${MAKEPKG_LIBRARY:-'@libmakepkgdir@'}
|
LIBRARY=${LIBRARY:-'@libmakepkgdir@'}
|
||||||
|
|
||||||
source "$MAKEPKG_LIBRARY/lint_pkgbuild/fullpkgver.sh"
|
source "$LIBRARY/lint_pkgbuild/fullpkgver.sh"
|
||||||
source "$MAKEPKG_LIBRARY/lint_pkgbuild/pkgname.sh"
|
source "$LIBRARY/lint_pkgbuild/pkgname.sh"
|
||||||
source "$MAKEPKG_LIBRARY/util/message.sh"
|
source "$LIBRARY/util/message.sh"
|
||||||
source "$MAKEPKG_LIBRARY/util/pkgbuild.sh"
|
source "$LIBRARY/util/pkgbuild.sh"
|
||||||
|
|
||||||
|
|
||||||
lint_pkgbuild_functions+=('lint_depends')
|
lint_pkgbuild_functions+=('lint_depends')
|
||||||
|
|||||||
@@ -21,9 +21,9 @@
|
|||||||
[[ -n "$LIBMAKEPKG_LINT_PKGBUILD_EPOCH_SH" ]] && return
|
[[ -n "$LIBMAKEPKG_LINT_PKGBUILD_EPOCH_SH" ]] && return
|
||||||
LIBMAKEPKG_LINT_PKGBUILD_EPOCH_SH=1
|
LIBMAKEPKG_LINT_PKGBUILD_EPOCH_SH=1
|
||||||
|
|
||||||
MAKEPKG_LIBRARY=${MAKEPKG_LIBRARY:-'@libmakepkgdir@'}
|
LIBRARY=${LIBRARY:-'@libmakepkgdir@'}
|
||||||
|
|
||||||
source "$MAKEPKG_LIBRARY/util/message.sh"
|
source "$LIBRARY/util/message.sh"
|
||||||
|
|
||||||
|
|
||||||
lint_pkgbuild_functions+=('lint_epoch')
|
lint_pkgbuild_functions+=('lint_epoch')
|
||||||
|
|||||||
@@ -21,11 +21,11 @@
|
|||||||
[[ -n "$LIBMAKEPKG_LINT_PKGBUILD_FULLPKGVER_SH" ]] && return
|
[[ -n "$LIBMAKEPKG_LINT_PKGBUILD_FULLPKGVER_SH" ]] && return
|
||||||
LIBMAKEPKG_LINT_PKGBUILD_FULLPKGVER_SH=1
|
LIBMAKEPKG_LINT_PKGBUILD_FULLPKGVER_SH=1
|
||||||
|
|
||||||
MAKEPKG_LIBRARY=${MAKEPKG_LIBRARY:-'@libmakepkgdir@'}
|
LIBRARY=${LIBRARY:-'@libmakepkgdir@'}
|
||||||
|
|
||||||
source "$MAKEPKG_LIBRARY/lint_pkgbuild/epoch.sh"
|
source "$LIBRARY/lint_pkgbuild/epoch.sh"
|
||||||
source "$MAKEPKG_LIBRARY/lint_pkgbuild/pkgrel.sh"
|
source "$LIBRARY/lint_pkgbuild/pkgrel.sh"
|
||||||
source "$MAKEPKG_LIBRARY/lint_pkgbuild/pkgver.sh"
|
source "$LIBRARY/lint_pkgbuild/pkgver.sh"
|
||||||
|
|
||||||
|
|
||||||
check_fullpkgver() {
|
check_fullpkgver() {
|
||||||
|
|||||||
@@ -21,11 +21,11 @@
|
|||||||
[[ -n "$LIBMAKEPKG_LINT_PKGBUILD_INSTALL_SH" ]] && return
|
[[ -n "$LIBMAKEPKG_LINT_PKGBUILD_INSTALL_SH" ]] && return
|
||||||
LIBMAKEPKG_LINT_PKGBUILD_INSTALL_SH=1
|
LIBMAKEPKG_LINT_PKGBUILD_INSTALL_SH=1
|
||||||
|
|
||||||
MAKEPKG_LIBRARY=${MAKEPKG_LIBRARY:-'@libmakepkgdir@'}
|
LIBRARY=${LIBRARY:-'@libmakepkgdir@'}
|
||||||
|
|
||||||
source "$MAKEPKG_LIBRARY/util/message.sh"
|
source "$LIBRARY/util/message.sh"
|
||||||
source "$MAKEPKG_LIBRARY/util/pkgbuild.sh"
|
source "$LIBRARY/util/pkgbuild.sh"
|
||||||
source "$MAKEPKG_LIBRARY/lint_pkgbuild/util.sh"
|
source "$LIBRARY/lint_pkgbuild/util.sh"
|
||||||
|
|
||||||
|
|
||||||
lint_pkgbuild_functions+=('lint_install')
|
lint_pkgbuild_functions+=('lint_install')
|
||||||
|
|||||||
@@ -21,12 +21,12 @@
|
|||||||
[[ -n "$LIBMAKEPKG_LINT_PKGBUILD_MAKEDEPENDS_SH" ]] && return
|
[[ -n "$LIBMAKEPKG_LINT_PKGBUILD_MAKEDEPENDS_SH" ]] && return
|
||||||
LIBMAKEPKG_LINT_PKGBUILD_MAKEDEPENDS_SH=1
|
LIBMAKEPKG_LINT_PKGBUILD_MAKEDEPENDS_SH=1
|
||||||
|
|
||||||
MAKEPKG_LIBRARY=${MAKEPKG_LIBRARY:-'@libmakepkgdir@'}
|
LIBRARY=${LIBRARY:-'@libmakepkgdir@'}
|
||||||
|
|
||||||
source "$MAKEPKG_LIBRARY/lint_pkgbuild/fullpkgver.sh"
|
source "$LIBRARY/lint_pkgbuild/fullpkgver.sh"
|
||||||
source "$MAKEPKG_LIBRARY/lint_pkgbuild/pkgname.sh"
|
source "$LIBRARY/lint_pkgbuild/pkgname.sh"
|
||||||
source "$MAKEPKG_LIBRARY/util/message.sh"
|
source "$LIBRARY/util/message.sh"
|
||||||
source "$MAKEPKG_LIBRARY/util/pkgbuild.sh"
|
source "$LIBRARY/util/pkgbuild.sh"
|
||||||
|
|
||||||
|
|
||||||
lint_pkgbuild_functions+=('lint_makedepends')
|
lint_pkgbuild_functions+=('lint_makedepends')
|
||||||
|
|||||||
@@ -21,12 +21,12 @@
|
|||||||
[[ -n "$LIBMAKEPKG_LINT_PKGBUILD_OPTDEPENDS_SH" ]] && return
|
[[ -n "$LIBMAKEPKG_LINT_PKGBUILD_OPTDEPENDS_SH" ]] && return
|
||||||
LIBMAKEPKG_LINT_PKGBUILD_OPTDEPENDS_SH=1
|
LIBMAKEPKG_LINT_PKGBUILD_OPTDEPENDS_SH=1
|
||||||
|
|
||||||
MAKEPKG_LIBRARY=${MAKEPKG_LIBRARY:-'@libmakepkgdir@'}
|
LIBRARY=${LIBRARY:-'@libmakepkgdir@'}
|
||||||
|
|
||||||
source "$MAKEPKG_LIBRARY/lint_pkgbuild/fullpkgver.sh"
|
source "$LIBRARY/lint_pkgbuild/fullpkgver.sh"
|
||||||
source "$MAKEPKG_LIBRARY/lint_pkgbuild/pkgname.sh"
|
source "$LIBRARY/lint_pkgbuild/pkgname.sh"
|
||||||
source "$MAKEPKG_LIBRARY/util/message.sh"
|
source "$LIBRARY/util/message.sh"
|
||||||
source "$MAKEPKG_LIBRARY/util/pkgbuild.sh"
|
source "$LIBRARY/util/pkgbuild.sh"
|
||||||
|
|
||||||
|
|
||||||
lint_pkgbuild_functions+=('lint_optdepends')
|
lint_pkgbuild_functions+=('lint_optdepends')
|
||||||
|
|||||||
@@ -21,10 +21,10 @@
|
|||||||
[[ -n "$LIBMAKEPKG_LINT_PKGBUILD_OPTIONS_SH" ]] && return
|
[[ -n "$LIBMAKEPKG_LINT_PKGBUILD_OPTIONS_SH" ]] && return
|
||||||
LIBMAKEPKG_LINT_PKGBUILD_OPTIONS_SH=1
|
LIBMAKEPKG_LINT_PKGBUILD_OPTIONS_SH=1
|
||||||
|
|
||||||
MAKEPKG_LIBRARY=${MAKEPKG_LIBRARY:-'@libmakepkgdir@'}
|
LIBRARY=${LIBRARY:-'@libmakepkgdir@'}
|
||||||
|
|
||||||
source "$MAKEPKG_LIBRARY/util/message.sh"
|
source "$LIBRARY/util/message.sh"
|
||||||
source "$MAKEPKG_LIBRARY/util/pkgbuild.sh"
|
source "$LIBRARY/util/pkgbuild.sh"
|
||||||
|
|
||||||
|
|
||||||
lint_pkgbuild_functions+=('lint_options')
|
lint_pkgbuild_functions+=('lint_options')
|
||||||
|
|||||||
@@ -21,10 +21,10 @@
|
|||||||
[[ -n "$LIBMAKEPKG_LINT_PKGBUILD_PACKAGE_FUNCTION_SH" ]] && return
|
[[ -n "$LIBMAKEPKG_LINT_PKGBUILD_PACKAGE_FUNCTION_SH" ]] && return
|
||||||
LIBMAKEPKG_LINT_PKGBUILD_PACKAGE_FUNCTION_SH=1
|
LIBMAKEPKG_LINT_PKGBUILD_PACKAGE_FUNCTION_SH=1
|
||||||
|
|
||||||
MAKEPKG_LIBRARY=${MAKEPKG_LIBRARY:-'@libmakepkgdir@'}
|
LIBRARY=${LIBRARY:-'@libmakepkgdir@'}
|
||||||
|
|
||||||
source "$MAKEPKG_LIBRARY/util/message.sh"
|
source "$LIBRARY/util/message.sh"
|
||||||
source "$MAKEPKG_LIBRARY/util/pkgbuild.sh"
|
source "$LIBRARY/util/pkgbuild.sh"
|
||||||
|
|
||||||
|
|
||||||
lint_pkgbuild_functions+=('lint_package_function')
|
lint_pkgbuild_functions+=('lint_package_function')
|
||||||
|
|||||||
@@ -21,12 +21,12 @@
|
|||||||
[[ -n "$LIBMAKEPKG_LINT_PKGBUILD_PACKAGE_FUNCTION_VARIABLE_SH" ]] && return
|
[[ -n "$LIBMAKEPKG_LINT_PKGBUILD_PACKAGE_FUNCTION_VARIABLE_SH" ]] && return
|
||||||
LIBMAKEPKG_LINT_PKGBUILD_PACKAGE_FUNCTION_VARIABLE_SH=1
|
LIBMAKEPKG_LINT_PKGBUILD_PACKAGE_FUNCTION_VARIABLE_SH=1
|
||||||
|
|
||||||
MAKEPKG_LIBRARY=${MAKEPKG_LIBRARY:-'@libmakepkgdir@'}
|
LIBRARY=${LIBRARY:-'@libmakepkgdir@'}
|
||||||
|
|
||||||
source "$MAKEPKG_LIBRARY/util/message.sh"
|
source "$LIBRARY/util/message.sh"
|
||||||
source "$MAKEPKG_LIBRARY/util/pkgbuild.sh"
|
source "$LIBRARY/util/pkgbuild.sh"
|
||||||
source "$MAKEPKG_LIBRARY/util/schema.sh"
|
source "$LIBRARY/util/schema.sh"
|
||||||
source "$MAKEPKG_LIBRARY/util/util.sh"
|
source "$LIBRARY/util/util.sh"
|
||||||
|
|
||||||
|
|
||||||
lint_pkgbuild_functions+=('lint_package_function_variable')
|
lint_pkgbuild_functions+=('lint_package_function_variable')
|
||||||
|
|||||||
@@ -21,10 +21,10 @@
|
|||||||
[[ -n "$LIBMAKEPKG_LINT_PKGBUILD_PKGBASE_SH" ]] && return
|
[[ -n "$LIBMAKEPKG_LINT_PKGBUILD_PKGBASE_SH" ]] && return
|
||||||
LIBMAKEPKG_LINT_PKGBUILD_PKGBASE_SH=1
|
LIBMAKEPKG_LINT_PKGBUILD_PKGBASE_SH=1
|
||||||
|
|
||||||
MAKEPKG_LIBRARY=${MAKEPKG_LIBRARY:-'@libmakepkgdir@'}
|
LIBRARY=${LIBRARY:-'@libmakepkgdir@'}
|
||||||
|
|
||||||
source "$MAKEPKG_LIBRARY/lint_pkgbuild/pkgname.sh"
|
source "$LIBRARY/lint_pkgbuild/pkgname.sh"
|
||||||
source "$MAKEPKG_LIBRARY/util/message.sh"
|
source "$LIBRARY/util/message.sh"
|
||||||
|
|
||||||
|
|
||||||
lint_pkgbuild_functions+=('lint_pkgbase')
|
lint_pkgbuild_functions+=('lint_pkgbase')
|
||||||
|
|||||||
@@ -21,10 +21,10 @@
|
|||||||
[[ -n "$LIBMAKEPKG_LINT_PKGBUILD_PKGLIST_SH" ]] && return
|
[[ -n "$LIBMAKEPKG_LINT_PKGBUILD_PKGLIST_SH" ]] && return
|
||||||
LIBMAKEPKG_LINT_PKGBUILD_PKGLIST_SH=1
|
LIBMAKEPKG_LINT_PKGBUILD_PKGLIST_SH=1
|
||||||
|
|
||||||
MAKEPKG_LIBRARY=${MAKEPKG_LIBRARY:-'@libmakepkgdir@'}
|
LIBRARY=${LIBRARY:-'@libmakepkgdir@'}
|
||||||
|
|
||||||
source "$MAKEPKG_LIBRARY/util/message.sh"
|
source "$LIBRARY/util/message.sh"
|
||||||
source "$MAKEPKG_LIBRARY/util/util.sh"
|
source "$LIBRARY/util/util.sh"
|
||||||
|
|
||||||
|
|
||||||
lint_pkgbuild_functions+=('lint_pkglist')
|
lint_pkgbuild_functions+=('lint_pkglist')
|
||||||
|
|||||||
@@ -21,9 +21,9 @@
|
|||||||
[[ -n "$LIBMAKEPKG_LINT_PKGBUILD_PKGNAME_SH" ]] && return
|
[[ -n "$LIBMAKEPKG_LINT_PKGBUILD_PKGNAME_SH" ]] && return
|
||||||
LIBMAKEPKG_LINT_PKGBUILD_PKGNAME_SH=1
|
LIBMAKEPKG_LINT_PKGBUILD_PKGNAME_SH=1
|
||||||
|
|
||||||
MAKEPKG_LIBRARY=${MAKEPKG_LIBRARY:-'@libmakepkgdir@'}
|
LIBRARY=${LIBRARY:-'@libmakepkgdir@'}
|
||||||
|
|
||||||
source "$MAKEPKG_LIBRARY/util/message.sh"
|
source "$LIBRARY/util/message.sh"
|
||||||
|
|
||||||
|
|
||||||
lint_pkgbuild_functions+=('lint_pkgname')
|
lint_pkgbuild_functions+=('lint_pkgname')
|
||||||
|
|||||||
@@ -21,9 +21,9 @@
|
|||||||
[[ -n "$LIBMAKEPKG_LINT_PKGBUILD_PKGREL_SH" ]] && return
|
[[ -n "$LIBMAKEPKG_LINT_PKGBUILD_PKGREL_SH" ]] && return
|
||||||
LIBMAKEPKG_LINT_PKGBUILD_PKGREL_SH=1
|
LIBMAKEPKG_LINT_PKGBUILD_PKGREL_SH=1
|
||||||
|
|
||||||
MAKEPKG_LIBRARY=${MAKEPKG_LIBRARY:-'@libmakepkgdir@'}
|
LIBRARY=${LIBRARY:-'@libmakepkgdir@'}
|
||||||
|
|
||||||
source "$MAKEPKG_LIBRARY/util/message.sh"
|
source "$LIBRARY/util/message.sh"
|
||||||
|
|
||||||
|
|
||||||
lint_pkgbuild_functions+=('lint_pkgrel')
|
lint_pkgbuild_functions+=('lint_pkgrel')
|
||||||
|
|||||||
@@ -21,9 +21,9 @@
|
|||||||
[[ -n "$LIBMAKEPKG_LINT_PKGBUILD_PKGVER_SH" ]] && return
|
[[ -n "$LIBMAKEPKG_LINT_PKGBUILD_PKGVER_SH" ]] && return
|
||||||
LIBMAKEPKG_LINT_PKGBUILD_PKGVER_SH=1
|
LIBMAKEPKG_LINT_PKGBUILD_PKGVER_SH=1
|
||||||
|
|
||||||
MAKEPKG_LIBRARY=${MAKEPKG_LIBRARY:-'@libmakepkgdir@'}
|
LIBRARY=${LIBRARY:-'@libmakepkgdir@'}
|
||||||
|
|
||||||
source "$MAKEPKG_LIBRARY/util/message.sh"
|
source "$LIBRARY/util/message.sh"
|
||||||
|
|
||||||
|
|
||||||
lint_pkgbuild_functions+=('lint_pkgver')
|
lint_pkgbuild_functions+=('lint_pkgver')
|
||||||
|
|||||||
@@ -21,12 +21,12 @@
|
|||||||
[[ -n "$LIBMAKEPKG_LINT_PKGBUILD_PROVIDES_SH" ]] && return
|
[[ -n "$LIBMAKEPKG_LINT_PKGBUILD_PROVIDES_SH" ]] && return
|
||||||
LIBMAKEPKG_LINT_PKGBUILD_PROVIDES_SH=1
|
LIBMAKEPKG_LINT_PKGBUILD_PROVIDES_SH=1
|
||||||
|
|
||||||
MAKEPKG_LIBRARY=${MAKEPKG_LIBRARY:-'@libmakepkgdir@'}
|
LIBRARY=${LIBRARY:-'@libmakepkgdir@'}
|
||||||
|
|
||||||
source "$MAKEPKG_LIBRARY/lint_pkgbuild/fullpkgver.sh"
|
source "$LIBRARY/lint_pkgbuild/fullpkgver.sh"
|
||||||
source "$MAKEPKG_LIBRARY/lint_pkgbuild/pkgname.sh"
|
source "$LIBRARY/lint_pkgbuild/pkgname.sh"
|
||||||
source "$MAKEPKG_LIBRARY/util/message.sh"
|
source "$LIBRARY/util/message.sh"
|
||||||
source "$MAKEPKG_LIBRARY/util/pkgbuild.sh"
|
source "$LIBRARY/util/pkgbuild.sh"
|
||||||
|
|
||||||
|
|
||||||
lint_pkgbuild_functions+=('lint_provides')
|
lint_pkgbuild_functions+=('lint_provides')
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user