Commit Graph

1594 Commits

Author SHA1 Message Date
classabbyamp
6de3c0f1fd lib/repo.c: add user-facing error message when repodata doesn't exist
Instead of just cryptically exiting 0 when opening a non-existant
repodata or stagedata, with the only message existing in the debug
output, show an error to the user on stderr.

mentioned in #519
2023-01-30 15:32:55 +01:00
Duncan Overbruck
a1a0167d80
add XBPS_SYSLOG environment variable to overwrite configuration 2022-12-24 14:29:24 +01:00
Duncan Overbruck
d962eaaf3c
lib: remove xhp argument from xbps_pubkey2fp 2022-12-24 14:29:24 +01:00
Duncan Overbruck
9efba6749f
lib: remove xhp argument from xbps_plist_{array,dictionary}_from_file 2022-12-24 14:29:24 +01:00
Duncan Overbruck
de484e9369
lib: change xbps_dbg_printf to not require xbps_handle
This allows to simplify a lot of code by not having to pass around
the xbps handle everywhere just to print some debug information.
2022-12-24 14:29:23 +01:00
Duncan Overbruck
2deb156beb
lib: only include fetch.h where required
This results in a lot of places where limits.h was missing, so
this diff is larger than necessary.
2022-12-22 16:47:05 +01:00
Duncan Overbruck
d8d284d7c8
lib/fetch: return 0 if buffer len is 0 and buf is NULL
Previously it would return -1 when xbps would download an empty files.
2022-07-19 15:19:01 +02:00
Duncan Overbruck
93186276ee
lib/fetch: don't abort connect(2) attempts on EINVAL 2022-07-19 14:50:29 +02:00
Piotr Wójcik
b5954c80db lib/fetch: reuse http connection
With HTTP 1.1 persistent connection is default and Connection
header is not sent.
Before patch, for every file, including 512b signature, there was
done dns query, tls handshake etc.
2022-07-03 21:41:10 +00:00
Piotr Wójcik
d744b4b238 xbps-install: exclude hold packages from total download size 2022-06-21 13:40:45 +00:00
Duncan Overbruck
3939d9aeb5
lib/plist_fetch.c: don't abort on ARCHIVE_WARN in xbps_archive_fetch_file_into_fd
Prior to this change, xbps-query --cat would abort if the entry file
name would contain non ascii characters as it returns ARCHIVE_WARN
when failing to use iconv to the users character encoding without
having locales initialized.
Other places in xbps already ignore ARCHIVE_WARN.
2021-12-28 15:42:25 +01:00
Duncan Overbruck
fccf3d79f0
lib/transaction_pkg_deps.c: skipping queued removed or held dependencies makes no sense 2021-10-23 16:14:44 +02:00
Duncan Overbruck
d18e7f904a
lib/transaction_pkg_deps.c: don't ignore unsatisfied held dependencies 2021-10-23 16:14:43 +02:00
Duncan Overbruck
0191525d7c
lib: make only manual install mode sticky when replacing packages 2021-10-23 16:09:02 +02:00
Duncan Overbruck
67725a656c
lib: fix setting automatic-install on replaced packages that are updated in the same transaction 2021-10-23 16:09:02 +02:00
Piotr Wójcik
59ea6a5388
lib: tighten repolock
when repolocked package has newer version in other repository and other
package depend on that newer version, repolocked package was updated and
swiched to other repo, while repolock status was left enabled
2021-09-10 14:40:02 +02:00
Duncan Overbruck
1383744603
conf: fix skipping empty lines 2021-09-10 14:31:57 +02:00
Duncan Overbruck
19f3e519fd
lib/transaction_internalize.c: switch out deprecated libarchive function 2021-06-26 19:19:10 +02:00
Duncan Overbruck
9139c4469f
lib/transaction_files.c: document some details 2021-06-26 18:58:55 +02:00
Duncan Overbruck
62962208fd
lib/transaction_files.c: fix leaving behind obsolete directories
Deleting obsolete directories is different from deleting obsolete files,
files need to be deleted by the first package that might change the file
into a different file type.
Directories need to be deleted by the last package that removes files
out of the directory to avoid ENOTEMPTY if another package has a file in
the given directory which is uninstalled later.

This fixes #282.
2021-06-26 18:58:55 +02:00
Duncan Overbruck
2dc22401d5
lib: drop libarchive compat macros and use non deprecated functions 2021-06-26 18:51:15 +02:00
Duncan Overbruck
92a21db4da
lib/transaction_ops.c: do not change the transaction mode of unpacked packages
Those packages are going to be either updated or uninstalled,
changing the transaction type breaks this.
There is no apperent reason to change the type anyways.
2021-06-26 18:46:56 +02:00
Duncan Overbruck
59bcbddcdb
lib/package_script.c: xbps_pkg_exec_script: remove useless copy and free 2021-06-26 18:41:37 +02:00
Duncan Overbruck
1f99a099e8
lib: run all post/purge-remove scripts at the end of the transaction 2021-06-26 18:41:37 +02:00
Duncan Overbruck
02367e3c00
lib: run pre-remove and pre-install scripts before unpacking 2021-06-26 18:41:37 +02:00
Duncan Overbruck
c94648630c
lib/transaction_commit.c: don't configure already unpacked packages early
This makes --unpack-only also skip the configure for currently unpacked
packages and configures unpacked packages together with all other
pckages.
2021-06-26 18:41:37 +02:00
Duncan Overbruck
ab3fb82a7f
lib: add binary package internalization step
- internalize scripts so we can use them before unpacking packages.
- moves some required metadata checks out of the package unpack stage
  so errors do not leave the system in a half unpacked state.

xbps_transaction_files will be changed later to use the loaded
files.plist instead of opening each binary package on its own again.
2021-06-26 18:41:37 +02:00
Duncan Overbruck
c00fe9f3e1
lib/util.c: make is_revision match the code style 2021-06-26 17:14:23 +02:00
Juan RP
46b7057d91
Fix signed vs unsigned char issues found by NetBSD. 2021-06-26 17:13:01 +02:00
Duncan Overbruck
248ca4b152
lib/conf.c: cleanup a bit 2021-06-26 17:02:26 +02:00
eater
453595a822
lib/conf.c: strip whitespace after value in config
Closes: #407 [via git-merge-pr]
2021-06-26 17:02:26 +02:00
Piotr Wójcik
9f5a029a3f
dewey.c: convert to UTF-8
Closes: #396 [via git-merge-pr]
2021-06-26 16:57:04 +02:00
Duncan Overbruck
e9411eda81
lib: remove mtime updating on unchanged files 2021-06-26 16:55:11 +02:00
Érico Nogueira
08ad0c2a9b
lib/package_msg: don't roundtrip data with fmemopen
Using fmemopen here wasn't necessary, since memcpy could have been used
with way lower overhead. We don't use a dedicated function, because
turning a data field into a string is an inefficient operation and
shouldn't be encouraged.

Also don't initialize data when it's declared, it isn't necessary.
2021-06-26 16:06:55 +02:00
Érico Rolim
01180f9cb6
lib/repo: change some error handling in repo_open_local.
- use less intermediate variables
- assert that archive_read_new managed to allocate memory for itself:
  not ideal, but if we ever want to move from assertions it shows us
  where we need to change things
- use libarchive's archive_error_string for better error messages

Closes: #345 [via git-merge-pr]
2021-02-04 23:54:07 +01:00
Duncan Overbruck
9a30f13300
lib/initend.c: only use uname(3) if native_arch was not set
if the configuration file or the env variable is used
we can skip uname(3).
2021-02-04 23:38:32 +01:00
Duncan Overbruck
c6aaafb123
lib/initend.c: allow XBPS{,_TARGET}_ARCH variables to overwrite config 2021-02-04 23:27:11 +01:00
gt7-void
167289d590
Avoid file descriptor leakes (fix #303)
HTTP connections are cached for performance, but they end up being
leaked when running configure scripts. To avoid this, close the
connection cache after all downloads are finished.

Closes: #326 [via git-merge-pr]
2021-02-04 23:16:27 +01:00
Érico Rolim
a95f3d56c8
lib/Makefile: fix linking for libxbps.so.
Both CFLAGS and LDFLAGS need to be passed during linkage as CFLAGS may
contain things that influence linkage (e.g. ssp_nonshared may be
necessary to link when using strong stack protector).

Pointed out by q66.

Closes: #330 [via git-merge-pr]
2021-02-04 23:15:11 +01:00
Érico Rolim
9c5443d134
fetch/http: add missing case when treating status code.
The HTTP_REDIRECT() macro already included this case, but the
switch-case with the return value of http_get_reply(conn) didn't. This
made it so that a server returning HTTP_TEMP_REDIRECT (307) would
generate a failure, unless libfetch was used in verbose mode, in which
case the headers would be parsed (in order to report errors), then the
'Location' header would be found and a new connection would be made.

Fixes #348
2021-02-04 23:14:34 +01:00
Érico Rolim
456f07c218
proplib_wrapper: remove return from void functions.
Spotted while trying to build XBPS with cproc.
2021-02-04 23:09:35 +01:00
Érico Rolim
dc8c8c3868
lib/Makefile: guard -fvisibility=hidden flag. 2021-02-04 23:09:35 +01:00
Érico Rolim
0b23de1bec
__UNCONST: use uintptr_t instead of unsigned long.
The width of unsigned long matching the width of a pointer isn't
guaranteed by any standard, though it is a requirement of the Linux
syscall API. Using uintptr_t directly is always correct.
2021-02-04 23:04:59 +01:00
Érico Rolim
47df729bcc
tree-wide: remove unnecessary __UNCONST usage. 2021-02-04 23:02:39 +01:00
Duncan Overbruck
51b39002e5
Revert "Move all external code to lib/external."
This reverts commit 9effec0c4e.
2021-02-04 22:42:57 +01:00
Duncan Overbruck
93410bee7f
Revert "xbps_init: autodetect musl libc variant at compile time."
This reverts commit 7f75fd840a.
2021-02-04 22:41:21 +01:00
Duncan Overbruck
44cd938115
Revert "Use shared LICENSE file for all xbps code."
This reverts commit be7d8cfaf1.

This commit missed some previous copyrights mentioned,
in general I think its better to have this per-file to
follow who wrote what and when.
2020-04-29 14:12:10 +02:00
Juan RP
9effec0c4e
Move all external code to lib/external. 2020-04-24 12:32:09 +02:00
Juan RP
be7d8cfaf1
Use shared LICENSE file for all xbps code. 2020-04-24 11:44:19 +02:00
Juan RP
530e79c7ee
Fix warnings detected by LTO. 2020-04-23 08:32:54 +02:00