Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update to v6.1.0 #45

Merged
merged 27 commits into from
May 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
263408f
makepkg: clean up more things
lazka Feb 28, 2023
9300953
makepkg: build env export
lazka Feb 28, 2023
7429136
fill_progress
lazka Feb 28, 2023
369fbad
test fixes
lazka Feb 28, 2023
a7bc88c
Remove everything related to sudo/fakeroot/file permissions
lazka Feb 28, 2023
c25dbd1
change shebang
lazka Feb 28, 2023
47fb6fb
Set fixed paths for various tools
lazka Feb 28, 2023
b5f583d
makepkg: port staticlibs to Windows
lazka Feb 27, 2023
48411ee
makepkg: port strip/debug to Windows
lazka Feb 27, 2023
04fe09f
makepkg: lint_package: Warn on package files referencing absolute Win…
lazka Feb 27, 2023
d27305d
Core update
lazka May 21, 2021
ff554d9
Remove ldconfig
lazka May 21, 2021
9bbf5bd
Change the epoch separator
lazka May 21, 2021
40a0e29
makepkg: avoid creating .tar files with extended attributes
dscho Jun 29, 2017
3f56dd2
pacman/libalpm: ignore file conflicts for foo.exe -> foo renames
lazka May 21, 2021
73ca7af
Change default answer of all queries to yes
Ede123 Feb 10, 2018
4dfb0ee
Use pipe instead of socket
lazka May 21, 2021
3c17347
pacman: make file list comparisons between packages case insensitive
lazka May 21, 2021
36980af
Workaround compressing packages with bsdtar under Active Directory ac…
lazka May 21, 2021
5b73927
Fix asciidoc argparse
lazka May 21, 2021
c19fd98
Export CC and CXX variables explicitly
lazka May 23, 2021
ee219d0
pacman.c: handle cr on stdin as well
1480c1 Aug 18, 2021
21c03c0
Add a CI job
lazka Jun 3, 2021
64311bb
Fix building staticlibs with LTO
MehdiChinoune Nov 13, 2021
65f028b
Make lint_pkgbuild opt-in via MAKEPKG_LINT_PKGBUILD=1
lazka Sep 10, 2022
036f176
pacman-key: pass --allow-weak-key-signatures during import
lazka Dec 8, 2023
9a49cdf
Disable autodep scripts
lazka May 5, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
55 changes: 55 additions & 0 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
name: build

on: [push, pull_request]

jobs:
build:
runs-on: windows-latest

steps:
- name: Checkout code
uses: actions/checkout@v2

- name: setup-msys2
uses: msys2/setup-msys2@v2
with:
msystem: MSYS
update: true
install: >-
msys2-devel
base-devel
asciidoc
doxygen
git
meson
ninja
gettext-devel
heimdal-devel
libarchive-devel
libcurl-devel
libgpgme-devel
libsqlite-devel
libunistring-devel

- name: Build
shell: msys2 {0}
run: |
meson _build \
--auto-features=enabled \
--default-library=static \
-Dbuildstatic=true \
-Ddoxygen=enabled \
-Dfile-seccomp=disabled

meson compile -C _build

- name: Install
shell: msys2 {0}
run: |
DESTDIR="$(pwd)"/_dest meson install -C _build

- name: Upload
uses: actions/upload-artifact@v2
with:
name: install
path: _dest/
2 changes: 1 addition & 1 deletion doc/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ foreach page : manpages
'-f', 'manpage',
'--xsltproc-opts', '-param man.endnotes.list.enabled 0 -param man.endnotes.are.numbered 0',
'-D', '@OUTDIR@',
'--asciidoc-opts', ' '.join(asciidoc_opts),
'--asciidoc-opts=' + ' '.join(asciidoc_opts),
'@INPUT@',
],
input : input,
Expand Down
11 changes: 10 additions & 1 deletion lib/libalpm/add.c
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,7 @@ static int extract_single_file(alpm_handle_t *handle, struct archive *archive,
"filesystem: %o package: %o\n", filename, lsbuf.st_mode & mask,
entrymode & mask);
}
#ifndef __MSYS__

#if 0
/* Disable this warning until our user management in packages has improved.
Expand All @@ -283,6 +284,7 @@ static int extract_single_file(alpm_handle_t *handle, struct archive *archive,
}
#endif

#endif
_alpm_log(handle, ALPM_LOG_DEBUG, "extract: skipping dir extraction of %s\n",
filename);
archive_read_data_skip(archive);
Expand Down Expand Up @@ -655,7 +657,10 @@ static int commit_single_pkg(alpm_handle_t *handle, alpm_pkg_t *newpkg,
int _alpm_upgrade_packages(alpm_handle_t *handle)
{
size_t pkg_count, pkg_current;
int skip_ldconfig = 0, ret = 0;
#ifndef __MSYS__
int skip_ldconfig = 0;
#endif
int ret = 0;
alpm_list_t *targ;
alpm_trans_t *trans = handle->trans;

Expand All @@ -678,18 +683,22 @@ int _alpm_upgrade_packages(alpm_handle_t *handle)
/* something screwed up on the commit, abort the trans */
trans->state = STATE_INTERRUPTED;
handle->pm_errno = ALPM_ERR_TRANS_ABORT;
#ifndef __MSYS__
/* running ldconfig at this point could possibly screw system */
skip_ldconfig = 1;
#endif
ret = -1;
}

pkg_current++;
}

#ifndef __MSYS__
if(!skip_ldconfig) {
/* run ldconfig if it exists */
_alpm_ldconfig(handle);
}
#endif

return ret;
}
9 changes: 9 additions & 0 deletions lib/libalpm/alpm.h
Original file line number Diff line number Diff line change
Expand Up @@ -2852,6 +2852,15 @@ int alpm_trans_release(alpm_handle_t *handle);
* @return 0 on success, -1 on error (pm_errno is set accordingly)
*/
int alpm_sync_sysupgrade(alpm_handle_t *handle, int enable_downgrade);
#ifdef __MSYS__
int alpm_sync_sysupgrade_core(alpm_handle_t *handle, int enable_downgrade);

/** Informs whether a package is a core package.
* @param pkg the package to check
* @return non-zero if this is a core package, zero otherwise
*/
int alpm_pkg_is_core_package(const alpm_pkg_t *pkg);
#endif

/** Add a package to the transaction.
* If the package was loaded by alpm_pkg_load(), it will be freed upon
Expand Down
26 changes: 26 additions & 0 deletions lib/libalpm/conflict.c
Original file line number Diff line number Diff line change
Expand Up @@ -518,6 +518,32 @@ alpm_list_t *_alpm_db_find_fileconflicts(alpm_handle_t *handle,

_alpm_log(handle, ALPM_LOG_DEBUG, "checking possible conflict: %s\n", path);

#ifdef __MSYS__
/* In case a file "foo.exe" gets renamed to "foo" the msys2 .exe
* interpolation makes pacman think an untracker file is replaced.
* In case foo and foo.exe are the same file and foo.exe existed
* in the old package version we can be sure it's handled by the
* old package and ignore the conflict */
if(dbpkg) {
char path_exe[PATH_MAX];
struct stat lsbuf2;

strncpy(path_exe, path, sizeof(path_exe) - 4);
strcat(path_exe, ".exe");
if(llstat(path, &lsbuf) == 0 && llstat(path_exe, &lsbuf2) == 0) {
int old_contains_exe = (alpm_filelist_contains(alpm_pkg_get_files(dbpkg), path_exe + rootlen) != NULL);
int same_file = (lsbuf.st_dev == lsbuf2.st_dev && lsbuf.st_ino == lsbuf2.st_ino);

if(same_file && old_contains_exe) {
_alpm_log(handle, ALPM_LOG_DEBUG,
"MSYS2 special case: Found %s which is the same file and included in the old package\n",
path_exe);
continue;
}
}
}
#endif

pfile_isdir = path[pathlen - 1] == '/';
if(pfile_isdir) {
if(S_ISDIR(lsbuf.st_mode)) {
Expand Down
47 changes: 42 additions & 5 deletions lib/libalpm/filelist.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,43 @@
#include "filelist.h"
#include "util.h"

#ifdef __MSYS__

#define TOLOWER(c) (((c) >= 'A' && (c) <= 'Z') ? (c) - 'A' + 'a' : (c))

static int _cmppath(const char *s1, const char *s2)
{
int c1, c2;

while(*s1 && *s2)
{
c1 = TOLOWER(*s1);
c2 = TOLOWER(*s2);
if(c1 != c2)
return c1 - c2;
s1++;
s2++;
}

return *s1 - *s2;
}

static int _cmpchar(char c1, char c2)
{
return TOLOWER(c1) - TOLOWER(c2);
}
#else
static int _cmppath(const char *s1, const char *s2)
{
return strcmp(s1, s2);
}

static int _cmpchar(char c1, char c2)
{
return c1 - c2;
}
#endif

/* Returns the difference of the provided two lists of files.
* Pre-condition: both lists are sorted!
* When done, free the list but NOT the contained data.
Expand All @@ -39,7 +76,7 @@ alpm_list_t *_alpm_filelist_difference(alpm_filelist_t *filesA,
char *strA = filesA->files[ctrA].name;
char *strB = filesB->files[ctrB].name;

int cmp = strcmp(strA, strB);
int cmp = _cmppath(strA, strB);
if(cmp < 0) {
/* item only in filesA, qualifies as a difference */
ret = alpm_list_add(ret, strA);
Expand All @@ -63,7 +100,7 @@ alpm_list_t *_alpm_filelist_difference(alpm_filelist_t *filesA,

static int _alpm_filelist_pathcmp(const char *p1, const char *p2)
{
while(*p1 && *p1 == *p2) {
while(*p1 && _cmpchar(*p1, *p2) == 0) {
p1++;
p2++;
}
Expand All @@ -75,7 +112,7 @@ static int _alpm_filelist_pathcmp(const char *p1, const char *p2)
p1++;
}

return *p1 - *p2;
return _cmpchar(*p1, *p2);
}

/* Returns the intersection of the provided two lists of files.
Expand Down Expand Up @@ -115,7 +152,7 @@ static int _alpm_files_cmp(const void *f1, const void *f2)
{
const alpm_file_t *file1 = f1;
const alpm_file_t *file2 = f2;
return strcmp(file1->name, file2->name);
return _cmppath(file1->name, file2->name);
}

alpm_file_t SYMEXPORT *alpm_filelist_contains(const alpm_filelist_t *filelist,
Expand All @@ -137,7 +174,7 @@ void _alpm_filelist_sort(alpm_filelist_t *filelist)
{
size_t i;
for(i = 1; i < filelist->count; i++) {
if(strcmp(filelist->files[i - 1].name, filelist->files[i].name) > 0) {
if(_cmppath(filelist->files[i - 1].name, filelist->files[i].name) > 0) {
/* filelist is not pre-sorted */
qsort(filelist->files, filelist->count,
sizeof(alpm_file_t), _alpm_files_cmp);
Expand Down
18 changes: 18 additions & 0 deletions lib/libalpm/package.c
Original file line number Diff line number Diff line change
Expand Up @@ -900,3 +900,21 @@ int _alpm_pkg_check_meta(alpm_pkg_t *pkg)

return error_found;
}

#ifdef __MSYS__
int SYMEXPORT alpm_pkg_is_core_package(const alpm_pkg_t *pkg)
{
if (pkg == NULL)
return 0;
return
strcmp(pkg->name, "bash") == 0 ||
strcmp(pkg->name, "filesystem") == 0 ||
strcmp(pkg->name, "mintty") == 0 ||
strcmp(pkg->name, "msys2-runtime") == 0 ||
strcmp(pkg->name, "msys2-runtime-devel") == 0 ||
strncmp(pkg->name, "msys2-runtime-",
strlen("msys2-runtime-")) == 0 ||
strcmp(pkg->name, "pacman") == 0 ||
strcmp(pkg->name, "pacman-mirrors") == 0;
}
#endif
4 changes: 4 additions & 0 deletions lib/libalpm/remove.c
Original file line number Diff line number Diff line change
Expand Up @@ -767,18 +767,22 @@ int _alpm_remove_packages(alpm_handle_t *handle, int run_ldconfig)
if(_alpm_remove_single_package(handle, pkg, NULL,
targ_count, pkg_count) == -1) {
handle->pm_errno = ALPM_ERR_TRANS_ABORT;
#ifndef __MSYS__
/* running ldconfig at this point could possibly screw system */
run_ldconfig = 0;
#endif
ret = -1;
}

targ_count++;
}

#ifndef __MSYS__
if(run_ldconfig) {
/* run ldconfig if it exists */
_alpm_ldconfig(handle);
}
#endif

return ret;
}
25 changes: 25 additions & 0 deletions lib/libalpm/sync.c
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,13 @@ static alpm_list_t *check_replacers(alpm_handle_t *handle, alpm_pkg_t *lpkg,
return replacers;
}

/** Search for packages to upgrade and add them to the transaction. */
#ifdef __MSYS__
static
int SYMEXPORT do_alpm_sync_sysupgrade(alpm_handle_t *handle, int enable_downgrade, int core_update)
#else
int SYMEXPORT alpm_sync_sysupgrade(alpm_handle_t *handle, int enable_downgrade)
#endif
{
alpm_list_t *i, *j;
alpm_trans_t *trans;
Expand All @@ -211,6 +217,13 @@ int SYMEXPORT alpm_sync_sysupgrade(alpm_handle_t *handle, int enable_downgrade)
for(i = _alpm_db_get_pkgcache(handle->db_local); i; i = i->next) {
alpm_pkg_t *lpkg = i->data;

#ifdef __MSYS__
/* Skip regular packages in core update, and core packages in regular update */
if(core_update != alpm_pkg_is_core_package(lpkg)) {
continue;
}
#endif

if(alpm_pkg_find(trans->remove, lpkg->name)) {
_alpm_log(handle, ALPM_LOG_DEBUG, "%s is marked for removal -- skipping\n", lpkg->name);
continue;
Expand Down Expand Up @@ -252,6 +265,18 @@ int SYMEXPORT alpm_sync_sysupgrade(alpm_handle_t *handle, int enable_downgrade)
return 0;
}

#ifdef __MSYS__
int SYMEXPORT alpm_sync_sysupgrade(alpm_handle_t *handle, int enable_downgrade)
{
return do_alpm_sync_sysupgrade(handle, enable_downgrade, 0);
}

int SYMEXPORT alpm_sync_sysupgrade_core(alpm_handle_t *handle, int enable_downgrade)
{
return do_alpm_sync_sysupgrade(handle, enable_downgrade, 1);
}
#endif

alpm_list_t SYMEXPORT *alpm_find_group_pkgs(alpm_list_t *dbs,
const char *name)
{
Expand Down
Loading
Loading