Commit Graph

1578 Commits

Author SHA1 Message Date
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
Juan RP 7d8247ae56 Multiple changes to pkgs on hold mode.
- Added transaction stats for pkgs on hold.

- Always add packages on hold to the transaction dictionary,
  its type will be set to XBPS_TRANS_HOLD.

- Changed xbps_transaction_update_pkg() to have a new "force"
  bool argument to force an update with a pkg on hold.

- As discussed in #274 with @Duncaen the only way to update a
  pkg on hold is by using `-f`, i.e `xbps-install -f foo`.

Closes #265
Closes #274
2020-04-23 06:03:56 +02:00
Juan RP 6b6b394686 lib: keep pkgdb props on updates in the proper place.
Improve f906f5a83d
2020-04-22 12:20:38 +02:00
Juan RP f906f5a83d xbps_register_pkg: keep stored props in pkgdb on updates.
I noticed that while updating a pkg that is on hold
or in repolock mode, does not keep those properties.

Always set those props in the new pkg dictionary to respect
this behaviour. If there's a pkg on hold and you update it,
you want to keep it in this state unless you tell it to change.

Added new test case to verify.
2020-04-22 12:00:26 +02:00
Juan RP d5251a9c23 xbps_init: fix typo in debug output.
For #264
2020-04-20 20:20:29 +02:00
Juan RP e155ba6d20 lib/package_alternatives.c: revert back to orig order.
my mistake, I somehow confused it.
2020-04-20 10:32:14 +02:00
Juan RP 35ae128826 lib/fetch: fix CID 284966 in a different way.
Hopefully this fixes it for real.
2020-04-20 10:31:13 +02:00
Juan RP 8663c3bd75 lib/fetch/common.c: fix CID 284959 (NULL returns).
Also fix previous CID.
2020-04-19 11:53:28 +02:00
Juan RP 359721baa6 lib/fetch/common.c: fix CID 284966 (Resource leak). 2020-04-19 11:43:54 +02:00
Juan RP 7b623783c8 lib/package_alternatives.c: fix CID 284970 (Resource leak).
Also fix calloc args order.
2020-04-19 11:38:09 +02:00
Juan RP c5904cc6ef lib/conf.c: fix CID 284952 (Identical branches). 2020-04-19 11:22:17 +02:00
Juan RP 96acc6d8ef lib/portableproplib/prop_object.c: fix CID 284969 (Double free). 2020-04-19 11:17:39 +02:00
Juan RP 83d87ce05b lib/transaction_files.c: fix CID 284958 (Resource leak). 2020-04-19 11:17:02 +02:00
Juan RP debfcf1273 Use xbps_repo_release() where applicable. 2020-04-19 11:09:05 +02:00
Juan RP 4990a2dd91 lib/Makefile: bump LIBXBPS_MICRO. 2020-04-14 20:27:54 +02:00
Juan RP 70efe5c63a repo: introduce xbps_repo_release(), misc changes.
- xbps_repo_release(): new function to release all resources
  associated with a repository object.

- xbps_repo_close(): this now just closes the file descriptor
  associated with the archive and associated resources.

- repo_open_local: after getting the repository dictionaries,
  use xbps_repo_close() to release archive resources.

Bump XBPS_API_VERSION.
2020-04-14 20:27:54 +02:00
Juan RP bd707acfee repo: fix a double free with invalid repodata.
Fixes #248

Added new test case to verify.
2020-03-31 18:36:04 +02:00