Commit Graph

137 Commits

Author SHA1 Message Date
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
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
be7d8cfaf1
Use shared LICENSE file for all xbps code. 2020-04-24 11:44:19 +02:00
Juan RP
460515bf41
lib/util.c: add assertions everywhere. 2020-02-08 20:00:56 +01:00
Juan RP
6010a24de6 libxbps: ABI/API break due to xbps_pkg{,pattern}_name changes.
The funcs xbps_pkg_name() and xbps_pkgpattern_name() were
using malloc(3) to return the result, until now.

They now have been changed to not allocate the result
via malloc, the caller is responsible to provide a buffer
at least of XBPS_NAME_SIZE (64).

If for whatever reason the pkgname can't be guessed,
returns false. This should avoid lots of small allocs
around libxbps.

New functions have the following prototype:

bool xbps_pkg_name(char *dst, size_t len, const char *pkg)
bool xbps_pkgpattern_name(char *dst, size_t len, const char *pkg)

as suggested by @duncaen.
2020-02-08 19:49:57 +01:00
Duncan Overbruck
6794077efd
Add noextract configuration option
Closes #208
Fixes #165
2020-01-18 15:51:13 +01:00
Piotr Wójcik
26d853751e lib/util.c: relax revision check to match existing data 2019-12-14 12:07:12 +01:00
Duncaen
62c1102cc4 lib/util.c: xbps_remote_binpkg_exists to check if signature and binpkg are cached 2019-10-25 23:38:01 +02:00
Piotr Wójcik
699b2bdd3b lib/util.c: verify revision in xbps_pkg_{version,revision,name} 2019-10-25 23:37:23 +02:00
Juan RP
0677678387 Added LTO support and fix warnings (maybe-uninitialized). 2019-06-27 18:09:26 +02:00
Juan RP
87f7766c5f xbps_symlink_target: fix two memleaks found by clang-analyzer. 2019-06-18 18:49:29 +02:00
Duncaen
45fc07260c xbps_binpkg_exists: fix access() on remote packages and avoid malloc 2019-06-14 23:21:06 +02:00
Juan RP
dd3dc2ddec xbps_symlink_target: always canonicalize rootdir.
... otherwise we might end up with a relative rootdir that will
give unexpected results.

dtrt when rootdir != /
2019-06-07 20:13:24 +02:00
Juan RP
9e2c00ee8b libxbps: remove dangling symlinks properly.
This fixes removal of packages that contain multiple levels
of dangling symlinks, i.e faenza-icon-theme and probably others.

Close #23
2019-06-07 20:13:24 +02:00
Juan RP
cf78b7272f lib/util: musl needs _{GNU,BSD}_SOURCE for strlc{at,py}(). 2019-04-22 15:31:07 +02:00
Duncaen
d1667fd931 Add the ability to ignore packages
The previous idea was to use virtual packages in the users configuration
to satisfy dependencies by mapping them to existing installed packages.
Using virtual packages for it doesn't work as expected and trying to make
it work would break other functionalities of virtual packages, like the
version satisfaction checks for `provides` and the ability to replace
virtual packages with real packages. The virtual package functionality
should be used exclusively for virtual packages.

This allows users to specify packages packages that should be ignored.
Ignored packages in dependencies are always satisfied without installing
the package, while updating or installing a package that depends on an
ignored package.

This does NOT ignore the shlib checks, ignoring a package that provides
required shared libraries will abort the transaction as if there was no
package that provides the required shared library.
2019-04-19 23:07:59 +02:00
human
8d594727cc lib/util.c: improve error handling in xbps_binpkg_{arch,pkgver}
they no longer assert or segfault on malformed strings

Closes: #48 [via git-merge-pr]
2019-04-14 15:01:18 +02:00
Juan RP
91067c0547 xbps_symlink_target: fix bug introduced in b81b9ab. 2016-02-04 09:55:46 +01:00
Juan RP
1e733f4daa lib/util: fix a memleak detected by clang-analyzer. 2016-02-03 11:52:07 +01:00
Juan RP
f5f25a5ff4 xbps_symlink_target: fix a double free. 2016-02-02 11:51:26 +01:00
Juan RP
b81b9ab379 xbps_symlink_target: fix bb977c7 (v3). 2016-02-02 11:08:05 +01:00
Juan RP
d984eeeb47 xbps_symlink_target: fix bb977c7 (v2). 2015-12-21 17:50:13 +01:00
Juan RP
4c655fd56a xbps_symlink_target: fix bb977c7 2015-12-21 17:20:34 +01:00
Juan RP
bb977c73e4 xbps_symlink_target: fix a meamleak reported by clang-analyzer. 2015-12-21 16:55:53 +01:00
Juan RP
090464e4b2 xbps_sanitize_path: fix an out-of-bounds access (CID #98686). 2015-07-26 08:01:29 +02:00
Juan RP
7e21f1ee1a xbps_symlink_target: rename var to avoid shadowing a global var. 2015-02-19 11:44:10 +01:00
Juan RP
9083191e4b xbps_symlink_target: double free in rootdir == '/' case. 2015-02-19 11:39:59 +01:00
Juan RP
6d65e76f91 xbps_symlink_target: fix a memleak. 2015-02-19 11:36:09 +01:00
Juan RP
a05e039cce Revert "Stop converting relative symlinks to absolute."
This reverts commit 9ae3638429.

This change is ok, but cannot be used right now because all existing
binpkgs were created with an old xbps-create(8).
2015-02-19 11:11:58 +01:00
Juan RP
9ae3638429 Stop converting relative symlinks to absolute.
There's no reason to make them absolute, simply store in the metadata
the target file as is. This vastly simplifies the code and makes all
test pass correctly.
2015-02-19 11:04:34 +01:00
Juan RP
67eba7d912 Improve detection of target file in relative symlinks.
If xbps-create(8) did not guess the target file of relative symlinks for
some reason, just compare the current symlink and what's stored as is,
without converting it to absolute.

This might happen with dangling relative symlinks or existing binary
packages that were not created with a newer xbps-create(8).
2015-02-19 10:24:24 +01:00
Juan RP
05f879ec09 Introduce xbps_symlink_target() and use it in two places.
This code is now shared by xbps-pkgdb and libxbps/xbps-remove.
2015-02-19 09:47:09 +01:00
Juan RP
1722635e08 Introduce xbps_sanitize_path() to fix #78 properly.
This removes multiple slashes of a path and returns you a buffer with
the sanitized string.
2015-02-18 15:12:39 +01:00
Juan RP
eb90fcc50c xbps_binpkg_{arch,pkgver}: return a buffer of matched string instead.
... otherwise will pass an invalid pointer to free(3) later on.
2014-11-19 11:56:16 +01:00
Juan RP
b2bc7af66e Fix #68 (xbps_binpkg_arch() asserts if arch contains a dash) 2014-11-19 11:14:37 +01:00
Juan RP
c549252223 xbps_pkg_version: minor optimization. 2014-11-18 16:11:43 +01:00
Juan RP
3afb9d709d Get rid of repodata index-files; the archive is now 8x smaller.
See the NEWS file for more information.
2014-11-13 17:09:43 +01:00
Juan RP
5b522109f7 Replaced config/system {repo,preserve,virtualpkg}.d with a single directory.
See the NEWS file for more information.
2014-11-06 09:58:04 +01:00
Juan RP
fe87bc1a88 lib/util.c: CID 62710 (dead code) 2014-10-07 08:16:45 +02:00
Juan RP
97045960f9 xbps_pkg_reverts: style. 2014-09-27 11:28:29 +02:00
Enno Boland
b5a169b65c xbps_pkg_reverts: this function can do more than just return false! 2014-09-23 21:18:47 +02:00
Enno Boland
a421bf7db5 xbps_pkg_reverts: return bool instead of int. 2014-09-23 20:50:34 +02:00
Enno Boland
dbab3f2cfc xbps_pkg_reverts: use version instead of pkgname-version to find reverts 2014-09-23 18:22:57 +02:00
Enno Boland
50fb6c1605 rename xbps_pkgver_is_reverted to xbps_pkg_reverts 2014-09-23 13:54:06 +02:00
Enno Boland
18204aeac1 lib/util.c: add function which tests if a given pkgver is reverted by a given pkg. 2014-09-23 13:54:06 +02:00
Juan RP
5863ec17fe libxbps: two new functions to get the pkgver and arch components in a filename.
- xbps_binpkg_pkgver() returns a heap allocated string with the pkgver component.
- xbps_binpkg_arch() returns a heap allocated string with the architecture component.

A basename, full path or relative path is supported, i.e:

	/path/to/foo-1.0_1.x86_64.xbps
	../../foo/blah-0.1_1.x86_64.xbps
	baz-0.1_1.x86_64.xbps
2014-09-05 20:59:00 +02:00
Juan RP
5a1919e520 xbps_pkg_is_installed(): a pkg in "unpacked" state is now accepted as installed too.
The reason is that even if the pkg was not configured, it should still be accepted
as installed. If installing packages via XBPS_TARGET_ARCH, pkgs are never configured,
so this must be taken into account.

Will be cherry-picked to 0.37 meanwhile.
2014-08-23 15:54:24 +02:00
Juan RP
79fe312302 Gather proper transaction stats (take into account binpkgs in cachedir, and "preserved" pkgs). 2014-07-13 09:56:06 +02:00
Juan RP
2fa0d56658 Fixed a xbps_pkgpattern_name() crash and a test to reproduce it (found by Gottox). 2014-02-15 01:26:42 +01:00