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.
- 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]
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]
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]
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
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.
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.
- 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#265Closes#274
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.
- 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.
Don't set transaction type from inside the revdep check,
if the package is being removed then there is not point
in continueing checking if its breaks.
Referencing #245
Make sure "automatic" bool is initialized to false before
checking its value. This way if xbps_dictionary_get_bool()
fails, "automatic" will be set to false.
Closes#234
This commit implements multiple performance improvements
to the transaction code:
- Don't process xbps_pkg_name() N times each time we access
its package dictionary (via pkgdb or rpool), just do it once
at xbps_pkgdb_init() time. At pkgdb init time, it just creates
a property in pkgdb, "pkgname". At rpool time, each time a
package is accessed, the "pkgname" string property is added.
- The package transaction dictionary contains the "transaction"
object to know what's the pkg type. This has been changed to an
uint8, this simplifies the logic and it's faster than checking
a string object. See xbps_trans_type_t and xbps_transaction_pkg_type().
- Fixed the issue that was marked with XXX in transaction shlibs
checking code. This has been fixed and improved and resources are
now just freed as expected.
- Simplified random code all over the place, avoiding unnecessary
allocations or operations.
- Rename some transaction files to have a better description.
This is my first rototill to the code in 2020.