Compare commits
3 commits
allan/requ
...
master
Author | SHA1 | Date | |
---|---|---|---|
![]() |
fe6e678e59 | ||
![]() |
48a784dde8 | ||
![]() |
67e3a7be36 |
7 changed files with 49 additions and 76 deletions
|
@ -318,12 +318,12 @@ When to Check::
|
||||||
*Never*;;
|
*Never*;;
|
||||||
All signature checking is suppressed, even if signatures are present.
|
All signature checking is suppressed, even if signatures are present.
|
||||||
|
|
||||||
*Optional*;;
|
*Optional* (default);;
|
||||||
Signatures are checked if present; absence of a signature is not an
|
Signatures are checked if present; absence of a signature is not an
|
||||||
error. An invalid signature is a fatal error, as is a signature from a
|
error. An invalid signature is a fatal error, as is a signature from a
|
||||||
key not in the keyring.
|
key not in the keyring.
|
||||||
|
|
||||||
*Required* (default);;
|
*Required*;;
|
||||||
Signatures are required; absence of a signature or an invalid signature
|
Signatures are required; absence of a signature or an invalid signature
|
||||||
is a fatal error, as is a signature from a key not in the keyring.
|
is a fatal error, as is a signature from a key not in the keyring.
|
||||||
|
|
||||||
|
@ -349,7 +349,7 @@ level signatures for packages.
|
||||||
The built-in default is the following:
|
The built-in default is the following:
|
||||||
|
|
||||||
--------
|
--------
|
||||||
SigLevel = Required TrustedOnly
|
SigLevel = Optional TrustedOnly
|
||||||
--------
|
--------
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1118,31 +1118,34 @@ static int finalize_download_locations(alpm_list_t *payloads, const char *localp
|
||||||
filename = payload->tempfile_name;
|
filename = payload->tempfile_name;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* if neither file exists then the download failed and logged an error for us */
|
if(filename) {
|
||||||
if(!filename) {
|
|
||||||
returnvalue = -1;
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
int ret = move_file(filename, localpath);
|
int ret = move_file(filename, localpath);
|
||||||
|
|
||||||
if(ret == -1) {
|
if(ret == -1) {
|
||||||
/* ignore error if the file already existed - only signature file was downloaded */
|
|
||||||
if(payload->mtime_existing_file == 0) {
|
if(payload->mtime_existing_file == 0) {
|
||||||
_alpm_log(payload->handle, ALPM_LOG_ERROR, _("could not move %s into %s (%s)\n"),
|
_alpm_log(payload->handle, ALPM_LOG_ERROR, _("could not move %s into %s (%s)\n"),
|
||||||
filename, localpath, strerror(errno));
|
filename, localpath, strerror(errno));
|
||||||
returnvalue = -1;
|
returnvalue = -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (payload->download_signature) {
|
if (payload->download_signature) {
|
||||||
const char sig_suffix[] = ".sig";
|
char *sig_filename;
|
||||||
char *sig_filename = NULL;
|
int ret;
|
||||||
size_t sig_filename_len = strlen(filename) + sizeof(sig_suffix);
|
|
||||||
MALLOC(sig_filename, sig_filename_len, continue);
|
filename = payload->destfile_name ? payload->destfile_name : payload->tempfile_name;
|
||||||
snprintf(sig_filename, sig_filename_len, "%s%s", filename, sig_suffix);
|
sig_filename = _alpm_get_fullpath("", filename, ".sig");
|
||||||
|
ASSERT(sig_filename, RET_ERR(payload->handle, ALPM_ERR_MEMORY, -1));
|
||||||
|
ret = move_file(sig_filename, localpath);
|
||||||
|
free(sig_filename);
|
||||||
|
|
||||||
|
if(ret == -1) {
|
||||||
|
sig_filename = _alpm_get_fullpath("", filename, ".sig.part");
|
||||||
|
ASSERT(sig_filename, RET_ERR(payload->handle, ALPM_ERR_MEMORY, -1));
|
||||||
move_file(sig_filename, localpath);
|
move_file(sig_filename, localpath);
|
||||||
FREE(sig_filename);
|
free(sig_filename);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return returnvalue;
|
return returnvalue;
|
||||||
|
@ -1296,7 +1299,7 @@ download_signature:
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static char *filecache_find_url(alpm_handle_t *handle, const char *url)
|
static const char *url_basename(const char *url)
|
||||||
{
|
{
|
||||||
const char *filebase = strrchr(url, '/');
|
const char *filebase = strrchr(url, '/');
|
||||||
|
|
||||||
|
@ -1309,7 +1312,7 @@ static char *filecache_find_url(alpm_handle_t *handle, const char *url)
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
return _alpm_filecache_find(handle, filebase);
|
return filebase;
|
||||||
}
|
}
|
||||||
|
|
||||||
int SYMEXPORT alpm_fetch_pkgurl(alpm_handle_t *handle, const alpm_list_t *urls,
|
int SYMEXPORT alpm_fetch_pkgurl(alpm_handle_t *handle, const alpm_list_t *urls,
|
||||||
|
@ -1331,9 +1334,26 @@ int SYMEXPORT alpm_fetch_pkgurl(alpm_handle_t *handle, const alpm_list_t *urls,
|
||||||
|
|
||||||
for(i = urls; i; i = i->next) {
|
for(i = urls; i; i = i->next) {
|
||||||
char *url = i->data;
|
char *url = i->data;
|
||||||
|
char *filepath = NULL;
|
||||||
|
const char *urlbase = url_basename(url);
|
||||||
|
|
||||||
|
if(urlbase) {
|
||||||
/* attempt to find the file in our pkgcache */
|
/* attempt to find the file in our pkgcache */
|
||||||
char *filepath = filecache_find_url(handle, url);
|
filepath = _alpm_filecache_find(handle, urlbase);
|
||||||
|
|
||||||
|
if(filepath && (handle->siglevel & ALPM_SIG_PACKAGE)) {
|
||||||
|
char *sig_filename = _alpm_get_fullpath("", urlbase, ".sig");
|
||||||
|
|
||||||
|
/* if there's no .sig file then forget about the pkg file and go for download */
|
||||||
|
if(!_alpm_filecache_exists(handle, sig_filename)) {
|
||||||
|
free(filepath);
|
||||||
|
filepath = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
free(sig_filename);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if(filepath) {
|
if(filepath) {
|
||||||
/* the file is locally cached so add it to the output right away */
|
/* the file is locally cached so add it to the output right away */
|
||||||
alpm_list_append(fetched, filepath);
|
alpm_list_append(fetched, filepath);
|
||||||
|
|
|
@ -17,7 +17,6 @@ sources = [
|
||||||
'package_function.sh.in',
|
'package_function.sh.in',
|
||||||
'package_function_variable.sh.in',
|
'package_function_variable.sh.in',
|
||||||
'pkgbase.sh.in',
|
'pkgbase.sh.in',
|
||||||
'pkglist.sh.in',
|
|
||||||
'pkgname.sh.in',
|
'pkgname.sh.in',
|
||||||
'pkgrel.sh.in',
|
'pkgrel.sh.in',
|
||||||
'pkgver.sh.in',
|
'pkgver.sh.in',
|
||||||
|
|
|
@ -1,44 +0,0 @@
|
||||||
#!/bin/bash
|
|
||||||
#
|
|
||||||
# pkglist.sh - Check the packages selected to build exist.
|
|
||||||
#
|
|
||||||
# Copyright (c) 2014-2025 Pacman Development Team <pacman-dev@lists.archlinux.org>
|
|
||||||
#
|
|
||||||
# This program is free software; you can redistribute it and/or modify
|
|
||||||
# it under the terms of the GNU General Public License as published by
|
|
||||||
# the Free Software Foundation; either version 2 of the License, or
|
|
||||||
# (at your option) any later version.
|
|
||||||
#
|
|
||||||
# This program is distributed in the hope that it will be useful,
|
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
# GNU General Public License for more details.
|
|
||||||
#
|
|
||||||
# You should have received a copy of the GNU General Public License
|
|
||||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
#
|
|
||||||
|
|
||||||
[[ -n "$LIBMAKEPKG_LINT_PKGBUILD_PKGLIST_SH" ]] && return
|
|
||||||
LIBMAKEPKG_LINT_PKGBUILD_PKGLIST_SH=1
|
|
||||||
|
|
||||||
MAKEPKG_LIBRARY=${MAKEPKG_LIBRARY:-'@libmakepkgdir@'}
|
|
||||||
|
|
||||||
source "$MAKEPKG_LIBRARY/util/message.sh"
|
|
||||||
source "$MAKEPKG_LIBRARY/util/util.sh"
|
|
||||||
|
|
||||||
|
|
||||||
lint_pkgbuild_functions+=('lint_pkglist')
|
|
||||||
|
|
||||||
|
|
||||||
lint_pkglist() {
|
|
||||||
local i ret=0
|
|
||||||
|
|
||||||
for i in "${PKGLIST[@]}"; do
|
|
||||||
if ! in_array "$i" "${pkgname[@]}"; then
|
|
||||||
error "$(gettext "Requested package %s is not provided in %s")" "$i" "$BUILDFILE"
|
|
||||||
ret=1
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
|
|
||||||
return $ret
|
|
||||||
}
|
|
|
@ -109,7 +109,8 @@ config_t *config_new(void)
|
||||||
newconfig->logmask = ALPM_LOG_ERROR | ALPM_LOG_WARNING;
|
newconfig->logmask = ALPM_LOG_ERROR | ALPM_LOG_WARNING;
|
||||||
newconfig->configfile = strdup(CONFFILE);
|
newconfig->configfile = strdup(CONFFILE);
|
||||||
if(alpm_capabilities() & ALPM_CAPABILITY_SIGNATURES) {
|
if(alpm_capabilities() & ALPM_CAPABILITY_SIGNATURES) {
|
||||||
newconfig->siglevel = ALPM_SIG_PACKAGE | ALPM_SIG_DATABASE;
|
newconfig->siglevel = ALPM_SIG_PACKAGE | ALPM_SIG_PACKAGE_OPTIONAL |
|
||||||
|
ALPM_SIG_DATABASE | ALPM_SIG_DATABASE_OPTIONAL;
|
||||||
newconfig->localfilesiglevel = ALPM_SIG_USE_DEFAULT;
|
newconfig->localfilesiglevel = ALPM_SIG_USE_DEFAULT;
|
||||||
newconfig->remotefilesiglevel = ALPM_SIG_USE_DEFAULT;
|
newconfig->remotefilesiglevel = ALPM_SIG_USE_DEFAULT;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
self.description = 'download remote packages with -U with a URL filename'
|
self.description = 'download remote packages with -U with a URL filename'
|
||||||
self.require_capability("gpg")
|
self.require_capability("gpg")
|
||||||
self.require_capability("curl")
|
self.require_capability("curl")
|
||||||
self.option['SigLevel'] = ['Required']
|
|
||||||
|
|
||||||
url = self.add_simple_http_server({
|
url = self.add_simple_http_server({
|
||||||
# simple
|
# simple
|
||||||
|
|
|
@ -115,8 +115,6 @@ def mkcfgfile(filename, root, option, db):
|
||||||
data = ["[options]"]
|
data = ["[options]"]
|
||||||
for key, value in option.items():
|
for key, value in option.items():
|
||||||
data.extend(["%s = %s" % (key, j) for j in value])
|
data.extend(["%s = %s" % (key, j) for j in value])
|
||||||
if "SigLevel" not in option:
|
|
||||||
data.append("SigLevel = Never\n")
|
|
||||||
|
|
||||||
# Repositories
|
# Repositories
|
||||||
# sort by repo name so tests can predict repo order, rather than be
|
# sort by repo name so tests can predict repo order, rather than be
|
||||||
|
|
Loading…
Add table
Reference in a new issue