Compare commits
2 commits
master
...
allan/linu
Author | SHA1 | Date | |
---|---|---|---|
![]() |
11075f6736 | ||
![]() |
7cd8010d65 |
5 changed files with 97 additions and 46 deletions
|
@ -1118,34 +1118,31 @@ static int finalize_download_locations(alpm_list_t *payloads, const char *localp
|
||||||
filename = payload->tempfile_name;
|
filename = payload->tempfile_name;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(filename) {
|
/* if neither file exists then the download failed and logged an error for us */
|
||||||
int ret = move_file(filename, localpath);
|
if(!filename) {
|
||||||
|
returnvalue = -1;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
if(ret == -1) {
|
int ret = move_file(filename, localpath);
|
||||||
if(payload->mtime_existing_file == 0) {
|
|
||||||
_alpm_log(payload->handle, ALPM_LOG_ERROR, _("could not move %s into %s (%s)\n"),
|
if(ret == -1) {
|
||||||
filename, localpath, strerror(errno));
|
/* ignore error if the file already existed - only signature file was downloaded */
|
||||||
returnvalue = -1;
|
if(payload->mtime_existing_file == 0) {
|
||||||
}
|
_alpm_log(payload->handle, ALPM_LOG_ERROR, _("could not move %s into %s (%s)\n"),
|
||||||
|
filename, localpath, strerror(errno));
|
||||||
|
returnvalue = -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (payload->download_signature) {
|
if (payload->download_signature) {
|
||||||
char *sig_filename;
|
const char sig_suffix[] = ".sig";
|
||||||
int ret;
|
char *sig_filename = NULL;
|
||||||
|
size_t sig_filename_len = strlen(filename) + sizeof(sig_suffix);
|
||||||
filename = payload->destfile_name ? payload->destfile_name : payload->tempfile_name;
|
MALLOC(sig_filename, sig_filename_len, continue);
|
||||||
sig_filename = _alpm_get_fullpath("", filename, ".sig");
|
snprintf(sig_filename, sig_filename_len, "%s%s", filename, sig_suffix);
|
||||||
ASSERT(sig_filename, RET_ERR(payload->handle, ALPM_ERR_MEMORY, -1));
|
move_file(sig_filename, localpath);
|
||||||
ret = move_file(sig_filename, localpath);
|
FREE(sig_filename);
|
||||||
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);
|
|
||||||
free(sig_filename);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return returnvalue;
|
return returnvalue;
|
||||||
|
@ -1299,7 +1296,7 @@ download_signature:
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static const char *url_basename(const char *url)
|
static char *filecache_find_url(alpm_handle_t *handle, const char *url)
|
||||||
{
|
{
|
||||||
const char *filebase = strrchr(url, '/');
|
const char *filebase = strrchr(url, '/');
|
||||||
|
|
||||||
|
@ -1312,7 +1309,7 @@ static const char *url_basename(const char *url)
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
return filebase;
|
return _alpm_filecache_find(handle, 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,
|
||||||
|
@ -1334,26 +1331,9 @@ 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 */
|
|
||||||
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);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
/* attempt to find the file in our pkgcache */
|
||||||
|
char *filepath = filecache_find_url(handle, url);
|
||||||
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,6 +17,7 @@ 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',
|
||||||
|
|
44
scripts/libmakepkg/lint_pkgbuild/pkglist.sh.in
Normal file
44
scripts/libmakepkg/lint_pkgbuild/pkglist.sh.in
Normal file
|
@ -0,0 +1,44 @@
|
||||||
|
#!/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
|
||||||
|
}
|
|
@ -84,7 +84,7 @@ static int sync_cleandb(const char *dbpath)
|
||||||
|
|
||||||
/* build the full path */
|
/* build the full path */
|
||||||
len = snprintf(path, PATH_MAX, "%s%s", dbpath, dname);
|
len = snprintf(path, PATH_MAX, "%s%s", dbpath, dname);
|
||||||
if(len > PATH_MAX) {
|
if(len >= PATH_MAX) {
|
||||||
pm_printf(ALPM_LOG_ERROR, _("could not remove %s%s: path exceeds PATH_MAX\n"),
|
pm_printf(ALPM_LOG_ERROR, _("could not remove %s%s: path exceeds PATH_MAX\n"),
|
||||||
dbpath, dname);
|
dbpath, dname);
|
||||||
}
|
}
|
||||||
|
@ -245,7 +245,7 @@ static int sync_cleancache(int level)
|
||||||
|
|
||||||
/* build the full filepath */
|
/* build the full filepath */
|
||||||
len=snprintf(path, PATH_MAX, "%s%s", cachedir, ent->d_name);
|
len=snprintf(path, PATH_MAX, "%s%s", cachedir, ent->d_name);
|
||||||
if(len > PATH_MAX) {
|
if(len >= PATH_MAX) {
|
||||||
pm_printf(ALPM_LOG_ERROR, _("skipping %s%s: path exceeds PATH_MAX\n"),
|
pm_printf(ALPM_LOG_ERROR, _("skipping %s%s: path exceeds PATH_MAX\n"),
|
||||||
cachedir, ent->d_name);
|
cachedir, ent->d_name);
|
||||||
continue;
|
continue;
|
||||||
|
|
|
@ -0,0 +1,26 @@
|
||||||
|
self.description = "directory replaced by symlink in another package (linux-firmware issue)"
|
||||||
|
|
||||||
|
lp = pmpkg("p", "1-1")
|
||||||
|
lp.files = ["d1/file",
|
||||||
|
"d2/file"]
|
||||||
|
self.addpkg2db("local", lp)
|
||||||
|
|
||||||
|
p1 = pmpkg("d")
|
||||||
|
p1.files = ["d1/file",
|
||||||
|
"d2 -> d1"]
|
||||||
|
self.addpkg2db("sync", p1)
|
||||||
|
|
||||||
|
p2 = pmpkg("p", "2-1")
|
||||||
|
p2.depends = ["d"]
|
||||||
|
self.addpkg2db("sync", p2)
|
||||||
|
|
||||||
|
self.args = "-Syu"
|
||||||
|
|
||||||
|
self.addrule("PACMAN_RETCODE=0")
|
||||||
|
self.addrule("PKG_EXIST=p")
|
||||||
|
self.addrule("PKG_EXIST=d")
|
||||||
|
self.addrule("FILE_TYPE=d1|dir")
|
||||||
|
self.addrule("FILE_TYPE=d2|link")
|
||||||
|
|
||||||
|
self.expectfailure = True
|
||||||
|
|
Loading…
Add table
Reference in a new issue