Files
MSYS2-packages/pacman/0000-pacman-msysize.patch
2018-07-27 08:36:12 +03:00

1534 lines
49 KiB
Diff

diff -Naur pacman-5.1.0-orig/configure.ac pacman-5.1.0/configure.ac
--- pacman-5.1.0-orig/configure.ac 2018-05-28 02:30:55.000000000 +0300
+++ pacman-5.1.0/configure.ac 2018-06-21 12:55:30.712184800 +0300
@@ -114,12 +114,6 @@
[set the full path to the shell used to run install scriptlets]),
[SCRIPTLET_SHELL=$withval], [SCRIPTLET_SHELL=/bin/sh])
-# Help line for ldconfig path
-AC_ARG_WITH(ldconfig,
- AS_HELP_STRING([--with-ldconfig=path],
- [set the full path to ldconfig]),
- [LDCONFIG=$withval], [LDCONFIG=/sbin/ldconfig])
-
# Help line for selecting a crypto library
AC_ARG_WITH(crypto,
AS_HELP_STRING([--with-crypto={openssl|nettle}],
@@ -520,9 +514,6 @@
# Set shell used by install scriptlets
AC_SUBST(SCRIPTLET_SHELL)
AC_DEFINE_UNQUOTED([SCRIPTLET_SHELL], "$SCRIPTLET_SHELL", [The full path of the shell used to run install scriptlets])
-# Set ldconfig path
-AC_SUBST(LDCONFIG)
-AC_DEFINE_UNQUOTED([LDCONFIG], "$LDCONFIG", [The full path to ldconfig])
# Configuration files
diff -Naur pacman-5.1.0-orig/lib/libalpm/add.c pacman-5.1.0/lib/libalpm/add.c
--- pacman-5.1.0-orig/lib/libalpm/add.c 2018-05-14 03:02:18.000000000 +0300
+++ pacman-5.1.0/lib/libalpm/add.c 2018-06-21 12:53:58.832056200 +0300
@@ -261,6 +261,7 @@
"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.
@@ -278,6 +279,7 @@
}
#endif
+#endif
_alpm_log(handle, ALPM_LOG_DEBUG, "extract: skipping dir extraction of %s\n",
filename);
archive_read_data_skip(archive);
@@ -656,7 +658,10 @@
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;
@@ -679,18 +684,22 @@
/* 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;
}
diff -Naur pacman-5.1.0-orig/lib/libalpm/alpm.h pacman-5.1.0/lib/libalpm/alpm.h
--- pacman-5.1.0-orig/lib/libalpm/alpm.h 2018-05-14 03:02:18.000000000 +0300
+++ pacman-5.1.0/lib/libalpm/alpm.h 2018-06-21 12:53:58.842056200 +0300
@@ -1558,6 +1558,15 @@
* @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
diff -Naur pacman-5.1.0-orig/lib/libalpm/package.c pacman-5.1.0/lib/libalpm/package.c
--- pacman-5.1.0-orig/lib/libalpm/package.c 2018-05-14 03:02:18.000000000 +0300
+++ pacman-5.1.0/lib/libalpm/package.c 2018-06-21 12:59:13.842497200 +0300
@@ -805,3 +805,19 @@
return 0;
}
+
+#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 ||
+ strcmp(pkg->name, "pacman") == 0 ||
+ strcmp(pkg->name, "pacman-mirrors") == 0;
+}
+#endif
diff -Naur pacman-5.1.0-orig/lib/libalpm/remove.c pacman-5.1.0/lib/libalpm/remove.c
--- pacman-5.1.0-orig/lib/libalpm/remove.c 2018-05-14 03:02:18.000000000 +0300
+++ pacman-5.1.0/lib/libalpm/remove.c 2018-06-21 12:53:58.852056200 +0300
@@ -772,18 +772,22 @@
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;
}
diff -Naur pacman-5.1.0-orig/lib/libalpm/sync.c pacman-5.1.0/lib/libalpm/sync.c
--- pacman-5.1.0-orig/lib/libalpm/sync.c 2018-05-14 03:02:18.000000000 +0300
+++ pacman-5.1.0/lib/libalpm/sync.c 2018-06-21 12:53:58.852056200 +0300
@@ -200,7 +200,12 @@
}
/** 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;
@@ -214,6 +219,13 @@
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;
@@ -255,6 +267,18 @@
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
+
/** Find group members across a list of databases.
* If a member exists in several databases, only the first database is used.
* IgnorePkg is also handled.
diff -Naur pacman-5.1.0-orig/lib/libalpm/util.c pacman-5.1.0/lib/libalpm/util.c
--- pacman-5.1.0-orig/lib/libalpm/util.c 2018-05-14 03:02:18.000000000 +0300
+++ pacman-5.1.0/lib/libalpm/util.c 2018-06-21 12:53:58.852056200 +0300
@@ -743,6 +743,7 @@
return retval;
}
+#ifndef __MSYS__
/** Run ldconfig in a chroot.
* @param handle the context handle
* @return 0 on success, 1 on error
@@ -766,6 +767,7 @@
return 0;
}
+#endif
/** Helper function for comparing strings using the alpm "compare func"
* signature.
diff -Naur pacman-5.1.0-orig/lib/libalpm/version.c pacman-5.1.0/lib/libalpm/version.c
--- pacman-5.1.0-orig/lib/libalpm/version.c 2018-05-14 03:02:18.000000000 +0300
+++ pacman-5.1.0/lib/libalpm/version.c 2018-06-21 12:53:58.862056200 +0300
@@ -50,7 +50,11 @@
/* se points to version terminator */
se = strrchr(s, '-');
+#ifdef __MSYS__
+ if(*s == '~') {
+#else
if(*s == ':') {
+#endif
epoch = evr;
*s++ = '\0';
version = s;
@@ -250,7 +254,7 @@
return 0;
}
- /* Parse both versions into [epoch:]version[-release] triplets. We probably
+ /* Parse both versions into [epoch:|~]version[-release] triplets. We probably
* don't need epoch and release to support all the same magic, but it is
* easier to just run it all through the same code. */
full1 = strdup(a);
diff -Naur pacman-5.1.0-orig/Makefile.am pacman-5.1.0/Makefile.am
--- pacman-5.1.0-orig/Makefile.am 2018-05-14 03:02:18.000000000 +0300
+++ pacman-5.1.0/Makefile.am 2018-06-21 12:53:58.862056200 +0300
@@ -47,7 +47,6 @@
PY_LOG_COMPILER = $(PYTHON) $(top_srcdir)/test/pacman/pactest.py
AM_PY_LOG_FLAGS = \
--scriptlet-shell $(SCRIPTLET_SHELL) \
- --ldconfig $(LDCONFIG) \
--bindir $(top_builddir)/src/pacman \
--bindir $(top_builddir)/scripts
diff -Naur pacman-5.1.0-orig/scripts/libmakepkg/lint_package/build_references.sh.in pacman-5.1.0/scripts/libmakepkg/lint_package/build_references.sh.in
--- pacman-5.1.0-orig/scripts/libmakepkg/lint_package/build_references.sh.in 2018-03-18 05:51:17.000000000 +0300
+++ pacman-5.1.0/scripts/libmakepkg/lint_package/build_references.sh.in 2018-06-21 13:23:05.248501400 +0300
@@ -37,5 +37,13 @@
printf '%s\n' "${refs[@]#"$pkgdir/"}" >&2
fi
done
+
+ # Check for Windows-style MSYS2 root path
+ if find "${pkgdir}" -type f -print0 | xargs -0 grep -iFqI "$(cygpath -m /)" ; then
+ warning "$(gettext "Package contains reference to %s")" "\$(cygpath -m /)"
+ fi
+ if find "${pkgdir}" -type f -print0 | xargs -0 grep -iFqI "$(cygpath -w /)" ; then
+ warning "$(gettext "Package contains reference to %s")" "\$(cygpath -w /)"
+ fi
return 0
}
diff -Naur pacman-5.1.0-orig/scripts/libmakepkg/tidy/staticlibs.sh.in pacman-5.1.0/scripts/libmakepkg/tidy/staticlibs.sh.in
--- pacman-5.1.0-orig/scripts/libmakepkg/tidy/staticlibs.sh.in 2018-03-18 05:51:17.000000000 +0300
+++ pacman-5.1.0/scripts/libmakepkg/tidy/staticlibs.sh.in 2018-06-21 12:53:58.862056200 +0300
@@ -35,9 +35,9 @@
msg2 "$(gettext "Removing static library files...")"
local l
while read -rd '' l; do
- if [[ -f "${l%.a}.so" || -h "${l%.a}.so" ]]; then
+ if [[ -f "${l%.a}.dll.a" || -h "${l%.a}.dll.a" ]]; then
rm "$l"
fi
- done < <(find . ! -type d -name "*.a" -print0)
+ done < <(find . ! -type d \( -name "*.a" ! -name "*.dll.a" \) -print0)
fi
}
diff -Naur pacman-5.1.0-orig/scripts/libmakepkg/tidy/strip.sh.in pacman-5.1.0/scripts/libmakepkg/tidy/strip.sh.in
--- pacman-5.1.0-orig/scripts/libmakepkg/tidy/strip.sh.in 2018-05-12 16:15:04.000000000 +0300
+++ pacman-5.1.0/scripts/libmakepkg/tidy/strip.sh.in 2018-06-21 13:31:44.509228300 +0300
@@ -31,10 +31,6 @@
tidy_modify+=('tidy_strip')
-build_id() {
- LANG=C readelf -n "$1" | sed -n '/Build ID/ { s/.*: //p; q; }'
-}
-
source_files() {
LANG=C readelf "$1" --debug-dump | \
awk '/DW_AT_name +:/{name=$8}/DW_AT_comp_dir +:/{print $8 "/" name}'
@@ -43,52 +39,54 @@
strip_file() {
local binary=$1; shift
- if check_option "debug" "y"; then
- local bid=$(build_id "$binary")
-
- # has this file already been stripped
- if [[ -n "$bid" ]]; then
- if [[ -f "$dbgdir/.build-id/${bid:0:2}/${bid:2}.debug" ]]; then
+ case "$(file -bi "$binary")" in
+ *application/x-dosexec*)
+ if check_option "debug" "y"; then
+ if [[ -f "$dbgdir/$binary.debug" ]]; then
return
fi
- elif [[ -f "$dbgdir/$binary.debug" ]]; then
- return
- fi
-
- # copy source files to debug directory
- local f t
- while read -r t; do
- f=${t/${dbgsrcdir}/"$srcdir"}
- mkdir -p "${dbgsrc/"$dbgsrcdir"/}${t%/*}"
- cp -- "$f" "${dbgsrc/"$dbgsrcdir"/}$t"
- done < <(source_files "$binary")
-
- # copy debug symbols to debug directory
- mkdir -p "$dbgdir/${binary%/*}"
- objcopy --only-keep-debug "$binary" "$dbgdir/$binary.debug"
- objcopy --add-gnu-debuglink="$dbgdir/${binary#/}.debug" "$binary"
-
- # create any needed hardlinks
- while read -rd '' file ; do
- if [[ "${binary}" -ef "${file}" && ! -f "$dbgdir/${file}.debug" ]]; then
- mkdir -p "$dbgdir/${file%/*}"
- ln "$dbgdir/${binary}.debug" "$dbgdir/${file}.debug"
- fi
- done < <(find . -type f -perm -u+w -print0 2>/dev/null)
-
- if [[ -n "$bid" ]]; then
- local target
- mkdir -p "$dbgdir/.build-id/${bid:0:2}"
-
- target="../../../../../${binary#./}"
- target="${target/..\/..\/usr\/lib\/}"
- target="${target/..\/usr\/}"
- ln -s "$target" "$dbgdir/.build-id/${bid:0:2}/${bid:2}"
- target="../../${binary#./}.debug"
- ln -s "$target" "$dbgdir/.build-id/${bid:0:2}/${bid:2}.debug"
+ # copy source files to debug directory
+ local f t
+ while read -r t; do
+ f=${t/${dbgsrcdir}/"$srcdir"}
+ mkdir -p "${dbgsrc/"$dbgsrcdir"/}${t%/*}"
+ cp -- "$f" "${dbgsrc/"$dbgsrcdir"/}$t"
+ done < <(source_files "$binary")
+
+ # copy debug symbols to debug directory
+ mkdir -p "$dbgdir/${binary%/*}"
+ msg2 "Separating debug info from $binary into $dbgdir/$binary.debug"
+ # create a dbg file with proper debug info:
+ objcopy --only-keep-debug "$binary" "$dbgdir/$binary.debug"
+
+ msg2 "Creating a debuginfo link to $dbgdir/$binary.debug in $binary"
+ objcopy --add-gnu-debuglink="$dbgdir/${binary#/}.debug" "$binary"
+
+ msg2 "Separating (again) debug info from $binary into $dbgdir/$binary.debug"
+ objcopy --only-keep-debug "$binary" "$dbgdir/$binary.debug"
+
+ msg2 "Removing old .gnu_debuglink section from $binary"
+ objcopy --remove-section=.gnu_debuglink "$binary"
+
+ # strip debug-info from the original file
+ objcopy --strip-debug "$binary"
+ msg2 "Creating (again) a debuginfo link to $dbgdir/$binary.debug in $binary"
+ objcopy --add-gnu-debuglink="$dbgdir/${binary#/}.debug" "$binary"
+ # This way dbg file gets a .gnu_debuglink section (doesn't matter where
+ # it's pointing), and its contents pass the CRC32 check
+
+ # create any needed hardlinks
+ while read -rd '' file ; do
+ if [[ "${binary}" -ef "${file}" && ! -f "$dbgdir/${file}.debug" ]]; then
+ mkdir -p "$dbgdir/${file%/*}"
+ ln "$dbgdir/${binary}.debug" "$dbgdir/${file}.debug"
+ fi
+ done < <(find . -type f -perm -u+w -print0 2>/dev/null)
+
fi
- fi
+ ;;
+ esac
strip $@ "$binary"
}
@@ -103,15 +101,84 @@
if check_option "debug" "y"; then
- dbgdir="$pkgdirbase/$pkgbase-@DEBUGSUFFIX@/usr/lib/debug"
+ dbgdir="$pkgdirbase/$pkgbase-@DEBUGSUFFIX@"
dbgsrcdir="${DBGSRCDIR:-/usr/src/debug}"
dbgsrc="$pkgdirbase/$pkgbase-@DEBUGSUFFIX@$dbgsrcdir"
mkdir -p "$dbgdir" "$dbgsrc"
fi
local binary strip_flags
- find . -type f -perm -u+w -print0 2>/dev/null | while read -rd '' binary ; do
+ # *.so: Apache2 modules, OCaml stublibs, Ruby modules
+ # *.oct: Octave modules
+ # *.cmxs: OCaml natdynlink modules: http://gallium.inria.fr/~frisch/ndl.txt
+ find * -type f ! -name '*.dll.a' ! -name '*.lib' \
+ -a \( -name '*.a' -o -name '*.dll' -o -name '*.exe' -o -name '*.so' -o -name '*.so.*' -o -name '*.oct' -o -name '*.cmxs' \) -print0 \
+ -o -type f -executable ! -name '*.dll' ! -name '*.exe' ! -name '*.so' ! -name '*.so.[0-9]*' ! -name '*.oct' ! -name '*.cmxs' ! -name '*.a' ! -name '*.la' ! -name '*.lib' ! -name '*.exe.manifest' ! -name '*.exe.config' ! -name '*.dll.config' ! -name '*.mdb' ! -name '*-config' ! -name '*.csh' ! -name '*.sh' ! -name '*.pl' ! -name '*.pm' ! -name '*.py' ! -name '*.rb' ! -name '*.tcl' -print0 | \
+ while read -d $'\0' binary
+ do
+ # Skip thin archives from stripping
+ case "${binary##*/}" in
+ *.a)
+ if [ "$(head -c 7 "${binary}")" = '!<thin>' ]
+ then
+ continue
+ fi
+ ;;
+ esac
+
+ # assure this is actually a binary object
+ if [ "$(head -c 2 "${binary}")" = '#!' ]
+ then
+ # sometimes .exe will be appended where it does not belong
+ case "${exe}" in
+ usr/lib/hevea/*.exe) ;;
+ *.exe) mv "${binary}" "${binary%.exe}" ;;
+ esac
+ continue
+ fi
+
+ # OCaml bytecode must not be stripped
+ # Magic number is at end of file:
+ # http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=256900#74
+ # http://cygwin.com/ml/cygwin-apps/2010-10/msg00057.html
+ #
+ # Perl Archive (PAR) binaries must not be stripped
+ # https://rt.cpan.org/Public/Bug/Display.html?id=18536
+ # http://cygwin.com/ml/cygwin-apps/2012-07/msg00088.html
+ case $(tail -c 12 "${binary}" | tr '\012\0' '%') in
+ %PAR\.pm%) continue ;;
+ Caml1999X0[0-9][0-9]) continue ;;
+ esac
+
+ # Mono assemblies must not be stripped, but remove .mdb debug symbols,
+ # and make them non-executable so they're not launched by MS .NET
+ if LC_ALL=C file -b "${binary}" 2>&1 | grep -q "Mono/\.Net assembly"
+ then
+ chmod 0644 "${binary}"
+ rm -f "${binary}.mdb"
+ continue
+ fi
+
+ # check for .exe from non-automake Makefile which install(1) didn't fix
+ # strip(1) used to take care of this, but not anymore
+ case ${CHOST} in
+ *-*-cygwin*|*-*-mingw*|*-*-msys*)
+ case "${binary##*/}" in
+ *.dll|*.exe|*.sfx|*.so|*.so.[0-9]*|*.oct|*.cmxs) ;;
+ # make sure this isn't some oddly named DLL
+ *) if LANG=en_US.UTF-8 LC_ALL=C objdump -f "${binary}" | grep -Eq '^start address 0x(0000000[01])?00401[0-9a-e][0-9a-e]0'
+ then
+ mv "${binary}" "${binary}.exe"
+ binary+=.exe
+ fi ;;
+ esac
+ ;;
+ esac
+ chmod 0755 "${binary}";
+
case "$(file -bi "$binary")" in
+ *application/x-dosexec*) # Windows executables and dlls
+ strip_flags="$STRIP_SHARED";;
*application/x-sharedlib*) # Libraries (.so)
strip_flags="$STRIP_SHARED";;
*application/x-archive*) # Libraries (.a)
diff -Naur pacman-5.1.0-orig/scripts/libmakepkg/util/compress.sh.in pacman-5.1.0/scripts/libmakepkg/util/compress.sh.in
--- pacman-5.1.0-orig/scripts/libmakepkg/util/compress.sh.in 2018-03-18 05:51:17.000000000 +0300
+++ pacman-5.1.0/scripts/libmakepkg/util/compress.sh.in 2018-06-21 13:37:44.296861300 +0300
@@ -36,7 +36,7 @@
case "$filename" in
*tar.gz) ${COMPRESSGZ[@]:-gzip -c -f -n} ;;
*tar.bz2) ${COMPRESSBZ2[@]:-bzip2 -c -f} ;;
- *tar.xz) ${COMPRESSXZ[@]:-xz -c -z -} ;;
+ *tar.xz) ${COMPRESSXZ[@]:-xz -c -z -T0 -} ;;
*tar.lrz) ${COMPRESSLRZ[@]:-lrzip -q} ;;
*tar.lzo) ${COMPRESSLZO[@]:-lzop -q} ;;
*tar.Z) ${COMPRESSZ[@]:-compress -c -f} ;;
diff -Naur pacman-5.1.0-orig/scripts/libmakepkg/util/pkgbuild.sh.in pacman-5.1.0/scripts/libmakepkg/util/pkgbuild.sh.in
--- pacman-5.1.0-orig/scripts/libmakepkg/util/pkgbuild.sh.in 2018-05-12 16:15:04.000000000 +0300
+++ pacman-5.1.0/scripts/libmakepkg/util/pkgbuild.sh.in 2018-06-21 12:53:58.872056200 +0300
@@ -149,7 +149,11 @@
##
get_full_version() {
if (( epoch > 0 )); then
- printf "%s\n" "$epoch:$pkgver-$pkgrel"
+ if [[ -n $MSYSTEM ]]; then
+ printf "%s\n" "${epoch}~${pkgver}-${pkgrel}"
+ else
+ printf "%s\n" "$epoch:$pkgver-$pkgrel"
+ fi
else
printf "%s\n" "$pkgver-$pkgrel"
fi
diff -Naur pacman-5.1.0-orig/scripts/library/utils_fixed_path.sh pacman-5.1.0/scripts/library/utils_fixed_path.sh
--- pacman-5.1.0-orig/scripts/library/utils_fixed_path.sh 1970-01-01 03:00:00.000000000 +0300
+++ pacman-5.1.0/scripts/library/utils_fixed_path.sh 2018-06-21 12:53:58.872056200 +0300
@@ -0,0 +1,34 @@
+if [[ -n "$MSYSTEM" ]]; then
+ readonly -a UTILS_NAME=('bsdtar'
+ 'bzip2'
+ 'bzr'
+ 'cat'
+ 'ccache'
+ 'distcc'
+ 'git'
+ 'gpg'
+ 'gzip'
+ 'hg'
+ 'lzip'
+ 'lzop'
+ 'openssl'
+ 'svn'
+ 'tput'
+ 'uncompress'
+ 'upx'
+ 'xargs'
+ 'xz'
+ )
+
+ for wrapper in ${UTILS_NAME[@]}; do
+ eval "
+ ${wrapper}"'() {
+ local UTILS_PATH="/usr/bin/"
+ if ! type -p ${UTILS_PATH}${FUNCNAME[0]} >/dev/null; then
+ error "$(gettext "Cannot find the %s binary required for makepkg.")" "${UTILS_PATH}${FUNCNAME[0]}"
+ exit 1
+ fi
+ ${UTILS_PATH}${FUNCNAME[0]} "$@"
+ }'
+ done
+fi
diff -Naur pacman-5.1.0-orig/scripts/Makefile.am pacman-5.1.0/scripts/Makefile.am
--- pacman-5.1.0-orig/scripts/Makefile.am 2018-05-14 03:02:18.000000000 +0300
+++ pacman-5.1.0/scripts/Makefile.am 2018-06-21 13:03:17.873838900 +0300
@@ -38,7 +38,8 @@
library/output_format.sh \
library/human_to_size.sh \
library/size_to_human.sh \
- library/term_colors.sh
+ library/term_colors.sh \
+ library/utils_fixed_path.sh
libmakepkgdir = $(datarootdir)/makepkg
@@ -196,6 +197,7 @@
makepkg: \
$(srcdir)/makepkg.sh.in \
$(srcdir)/wrapper.sh.in \
+ $(srcdir)/library/utils_fixed_path.sh \
$(LIBMAKEPKG_IN)
makepkg-template: \
@@ -208,7 +210,8 @@
pacman-db-upgrade: \
$(srcdir)/pacman-db-upgrade.sh.in \
- $(srcdir)/library/output_format.sh
+ $(srcdir)/library/output_format.sh \
+ $(srcdir)/library/utils_fixed_path.sh
pacman-key: \
$(srcdir)/pacman-key.sh.in \
@@ -216,11 +219,13 @@
pkgdelta: \
$(srcdir)/pkgdelta.sh.in \
- $(srcdir)/library/output_format.sh
+ $(srcdir)/library/output_format.sh \
+ $(srcdir)/library/utils_fixed_path.sh
repo-add: \
$(srcdir)/repo-add.sh.in \
- $(srcdir)/library/output_format.sh
+ $(srcdir)/library/output_format.sh \
+ $(srcdir)/library/utils_fixed_path.sh
repo-remove: $(srcdir)/repo-add.sh.in
$(AM_V_at)$(RM) repo-remove
diff -Naur pacman-5.1.0-orig/scripts/makepkg.sh.in pacman-5.1.0/scripts/makepkg.sh.in
--- pacman-5.1.0-orig/scripts/makepkg.sh.in 2018-05-23 08:27:19.000000000 +0300
+++ pacman-5.1.0/scripts/makepkg.sh.in 2018-06-21 13:21:37.158378000 +0300
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
#
# makepkg - make packages compatible for use with pacman
# @configure_input@
@@ -27,7 +27,7 @@
# makepkg uses quite a few external programs during its execution. You
# need to have at least the following installed for makepkg to function:
-# awk, bsdtar (libarchive), bzip2, coreutils, fakeroot, file, find (findutils),
+# awk, bsdtar (libarchive), bzip2, coreutils, file, find (findutils),
# gettext, gpg, grep, gzip, sed, tput (ncurses), xz
# gettext initialization
@@ -67,7 +67,6 @@
GENINTEG=0
HOLDVER=0
IGNOREARCH=0
-INFAKEROOT=0
INSTALL=0
LOGGING=0
NEEDED=0
@@ -99,6 +98,8 @@
shopt -s extglob
+m4_include(library/utils_fixed_path.sh)
+
### SUBROUTINES ###
# Import libmakepkg
@@ -113,10 +114,9 @@
trap_exit() {
local signal=$1; shift
- if (( ! INFAKEROOT )); then
- echo
- error "$@"
- fi
+ echo
+ error "$@"
+
[[ -n $srclinks ]] && rm -rf "$srclinks"
# unset the trap for this signal, and then call the default handler
@@ -131,17 +131,12 @@
clean_up() {
local EXIT_CODE=$?
- if (( INFAKEROOT )); then
- # Don't clean up when leaving fakeroot, we're not done yet.
- return 0
- fi
-
if (( (EXIT_CODE == E_OK || EXIT_CODE == E_INSTALL_FAILED) && CLEANUP )); then
local pkg file
# If it's a clean exit and -c/--clean has been passed...
msg "$(gettext "Cleaning up...")"
- rm -rf "$pkgdirbase" "$srcdir"
+ rm -rf "$pkgdirbase" "$srcdir" "$destdir"
if [[ -n $pkgbase ]]; then
local fullver=$(get_full_version)
# Can't do this unless the BUILDSCRIPT has been sourced.
@@ -179,11 +174,6 @@
remove_deps
}
-enter_fakeroot() {
- msg "$(gettext "Entering %s environment...")" "fakeroot"
- fakeroot -- $0 -F "${ARGLIST[@]}" || exit $?
-}
-
# Automatically update pkgver variable if a pkgver() function is provided
# Re-sources the PKGBUILD afterwards to allow for other variables that use $pkgver
update_pkgver() {
@@ -249,13 +249,6 @@
else
cmd=("$PACMAN_PATH" "$@")
fi
- if [[ $1 != -@(T|Q)*([[:alpha:]]) ]]; then
- if type -p sudo >/dev/null; then
- cmd=(sudo "${cmd[@]}")
- else
- cmd=(su root -c "$(printf '%q ' "${cmd[@]}")")
- fi
- fi
"${cmd[@]}"
}
@@ -510,7 +502,7 @@
sodepends=0;
for d in "${depends[@]}"; do
- if [[ $d = *.so ]]; then
+ if [[ $d = *.dll ]]; then
sodepends=1;
break;
fi
@@ -521,28 +513,33 @@
return;
fi
- local libdeps filename soarch sofile soname soversion;
+ local libdeps filename soarch sofile soname;
declare -A libdeps;
while read -r filename; do
- # get architecture of the file; if soarch is empty it's not an ELF binary
- soarch=$(LC_ALL=C readelf -h "$filename" 2>/dev/null | sed -n 's/.*Class.*ELF\(32\|64\)/\1/p')
+ # get architecture of the file; if soarch is empty it's not an binary
+ soarch=$(LANG=en_US.UTF-8 LC_ALL=C objdump -a "$filename" | sed -n 's/.*file format.*pei-\(i386\|x86-64\)/\1/p')
[[ -n "$soarch" ]] || continue
+ case "$soarch" in
+ i386)
+ soarch=i686
+ ;;
+ x86-64)
+ soarch=x86_64
+ ;;
+ esac
# process all libraries needed by the binary
- for sofile in $(LC_ALL=C readelf -d "$filename" 2>/dev/null | sed -nr 's/.*Shared library: \[(.*)\].*/\1/p')
+ for sofile in $(LC_ALL=C objdump -x "$filename" 2>/dev/null | sed -nr 's/.*DLL Name: (.*).*/\1/p')
do
- # extract the library name: libfoo.so
- soname="${sofile%.so?(+(.+([0-9])))}".so
- # extract the major version: 1
- soversion="${sofile##*\.so\.}"
+ soname=${sofile}
if [[ ${libdeps[$soname]} ]]; then
- if [[ ${libdeps[$soname]} != *${soversion}-${soarch}* ]]; then
- libdeps[$soname]+=" ${soversion}-${soarch}"
+ if [[ ${libdeps[$soname]} != *${soarch}* ]]; then
+ libdeps[$soname]+=" ${soarch}"
fi
else
- libdeps[$soname]="${soversion}-${soarch}"
+ libdeps[$soname]="${soarch}"
fi
done
done < <(find "$pkgdir" -type f -perm -u+x)
@@ -550,7 +547,7 @@
local libdepends v
for d in "${depends[@]}"; do
case "$d" in
- *.so)
+ *.dll)
if [[ ${libdeps[$d]} ]]; then
for v in ${libdeps[$d]}; do
libdepends+=("$d=$v")
@@ -575,32 +572,23 @@
for p in "${provides[@]}"; do
missing=0
case "$p" in
- *.so)
- mapfile -t filename < <(find "$pkgdir" -type f -name $p\*)
+ *.dll)
+ mapfile -t filename < <(find "$pkgdir" -type f -name $p)
if [[ $filename ]]; then
# packages may provide multiple versions of the same library
for fn in "${filename[@]}"; do
- # check if we really have a shared object
- if LC_ALL=C readelf -h "$fn" 2>/dev/null | grep -q '.*Type:.*DYN (Shared object file).*'; then
- # get the string binaries link to (e.g. libfoo.so.1.2 -> libfoo.so.1)
- local sofile=$(LC_ALL=C readelf -d "$fn" 2>/dev/null | sed -n 's/.*Library soname: \[\(.*\)\].*/\1/p')
- if [[ -z "$sofile" ]]; then
- warning "$(gettext "Library listed in %s is not versioned: %s")" "'provides'" "$p"
- libprovides+=("$p")
- continue
- fi
-
- # get the library architecture (32 or 64 bit)
- local soarch=$(LC_ALL=C readelf -h "$fn" | sed -n 's/.*Class.*ELF\(32\|64\)/\1/p')
-
- # extract the library major version
- local soversion="${sofile##*\.so\.}"
-
- libprovides+=("${p}=${soversion}-${soarch}")
- else
- warning "$(gettext "Library listed in %s is not a shared object: %s")" "'provides'" "$p"
- libprovides+=("$p")
- fi
+ # get the library architecture (32 or 64 bit)
+ local soarch=$(LC_ALL=C objdump -a "$fn" | sed -n 's/.*file format.*pei-\(i386\|x86-64\)/\1/p')
+ case "$soarch" in
+ i386)
+ soarch=i686
+ ;;
+ x86-64)
+ soarch=x86_64
+ ;;
+ esac
+
+ libprovides+=("${p}=${soarch}")
done
else
libprovides+=("$p")
@@ -641,7 +629,6 @@
msg2 "$(gettext "Generating %s file...")" ".PKGINFO"
printf "# Generated by makepkg %s\n" "$makepkg_version"
- printf "# using %s\n" "$(fakeroot -v)"
write_kv_pair "pkgname" "$pkgname"
write_kv_pair "pkgbase" "$pkgbase"
@@ -789,7 +776,7 @@
pkgdir="$pkgdirbase/$pkgbase-@DEBUGSUFFIX@"
# check if we have any debug symbols to package
- if dir_is_empty "$pkgdir/usr/lib/debug"; then
+ if dir_is_empty "$pkgdir"; then
return 0
fi
@@ -989,21 +976,6 @@
fi
fi
- # check for sudo if we will need it during makepkg execution
- if (( DEP_BIN || RMDEPS || INSTALL )); then
- if ! type -p sudo >/dev/null; then
- warning "$(gettext "Cannot find the %s binary. Will use %s to acquire root privileges.")" "sudo" "su"
- fi
- fi
-
- # fakeroot - correct package file permissions
- if check_buildenv "fakeroot" "y" && (( EUID > 0 )); then
- if ! type -p fakeroot >/dev/null; then
- error "$(gettext "Cannot find the %s binary.")" "fakeroot"
- ret=1
- fi
- fi
-
# gpg - package signing
if [[ $SIGNPKG == 'y' ]] || { [[ -z $SIGNPKG ]] && check_buildenv "sign" "y"; }; then
if ! type -p gpg >/dev/null; then
@@ -1133,6 +1105,11 @@
local restore_package_variables
for pkgname in ${pkgname_backup[@]}; do
pkgdir="$pkgdirbase/$pkgname"
+ # clean existing pkg directory
+ if [[ -d $pkgdir ]]; then
+ msg "$(gettext "Removing existing %s directory...")" "\$pkgdir/"
+ rm -rf "$pkgdir"
+ fi
mkdir "$pkgdir"
restore_package_variables="$(backup_package_variables)"
run_package $pkgname
@@ -1218,12 +1195,16 @@
gettext() {
printf "%s\n" "$@"
}
+else
+ gettext() {
+ /usr/bin/gettext "$@"
+ }
fi
ARGLIST=("$@")
# Parse Command Line Options.
-OPT_SHORT="AcCdefFghiLmop:rRsSV"
+OPT_SHORT="AcCdefghiLmop:rRsSV"
OPT_LONG=('allsource' 'check' 'clean' 'cleanbuild' 'config:' 'force' 'geninteg'
'help' 'holdver' 'ignorearch' 'install' 'key:' 'log' 'noarchive' 'nobuild'
'nocolor' 'nocheck' 'nodeps' 'noextract' 'noprepare' 'nosign' 'packagelist'
@@ -1257,7 +1238,6 @@
-d|--nodeps) NODEPS=1 ;;
-e|--noextract) NOEXTRACT=1 ;;
-f|--force) FORCE=1 ;;
- -F) INFAKEROOT=1 ;;
# generating integrity checks does not depend on architecture
-g|--geninteg) GENINTEG=1 IGNOREARCH=1;;
--holdver) HOLDVER=1 ;;
@@ -1399,19 +1379,6 @@
exit $E_FS_PERMISSIONS
fi
-if (( ! INFAKEROOT )); then
- if (( EUID == 0 )); then
- error "$(gettext "Running %s as root is not allowed as it can cause permanent,\n\
-catastrophic damage to your system.")" "makepkg"
- exit $E_ROOT
- fi
-else
- if [[ -z $FAKEROOTKEY ]]; then
- error "$(gettext "Do not use the %s option. This option is only for internal use by %s.")" "'-F'" "makepkg"
- exit $E_INVALID_OPTION
- fi
-fi
-
unset pkgname pkgbase pkgver pkgrel epoch pkgdesc url license groups provides
unset md5sums replaces depends conflicts backup source install changelog build
unset sha{1,224,256,384,512}sums makedepends optdepends options noextract validpgpkeys
@@ -1534,35 +1501,6 @@
check_build_status
fi
-# Run the bare minimum in fakeroot
-if (( INFAKEROOT )); then
- if (( SOURCEONLY )); then
- create_srcpackage
- msg "$(gettext "Leaving %s environment.")" "fakeroot"
- exit $E_OK
- fi
-
- prepare_buildenv
-
- chmod 755 "$pkgdirbase"
- if (( ! SPLITPKG )); then
- pkgdir="$pkgdirbase/$pkgname"
- mkdir "$pkgdir"
- if (( PKGFUNC )); then
- run_package
- fi
- tidy_install
- lint_package || exit $E_PACKAGE_FAILED
- create_package
- create_debug_package
- else
- run_split_packaging
- fi
-
- msg "$(gettext "Leaving %s environment.")" "fakeroot"
- exit $E_OK
-fi
-
msg "$(gettext "Making package: %s")" "$pkgbase $basever ($(date +%c))"
# if we are creating a source-only package, go no further
@@ -1586,7 +1524,7 @@
check_source_integrity all
cd_safe "$startdir"
- enter_fakeroot
+ create_srcpackage
if [[ $SIGNPKG = 'y' ]]; then
msg "$(gettext "Signing package...")"
@@ -1602,6 +1602,9 @@
mkdir -p "$srcdir"
chmod a-s "$srcdir"
cd_safe "$srcdir"
+
+ export MINGW_CHOST MINGW_PREFIX MINGW_PACKAGE_PREFIX
+ export DXSDK_DIR ACLOCAL_PATH PKG_CONFIG_PATH
if (( !REPKG )); then
if (( NOEXTRACT && ! VERIFYSOURCE )); then
@@ -1688,17 +1626,36 @@
cd_safe "$startdir"
fi
- enter_fakeroot
+ # if inhibiting archive creation, go no further
+ if (( NOARCHIVE )); then
+ msg "$(gettext "Package directory is ready.")"
+ exit $E_OK
+ fi
+ mkdir -p "$pkgdirbase"
+ chmod a-srwx "$pkgdirbase"
+ chmod 755 "$pkgdirbase"
+ if (( ! SPLITPKG )); then
+ pkgdir="$pkgdirbase/$pkgname"
+ # clean existing pkg directory
+ if [[ -d $pkgdir ]]; then
+ msg "$(gettext "Removing existing %s directory...")" "\$pkgdir/"
+ rm -rf "$pkgdir"
+ fi
+ mkdir "$pkgdir"
+ if (( PKGFUNC )); then
+ run_package
+ fi
+ tidy_install
+ lint_package || exit $E_PACKAGE_FAILED
+ create_package
+ create_debug_package
+ else
+ run_split_packaging
+ fi
create_package_signatures
fi
-# if inhibiting archive creation, go no further
-if (( NOARCHIVE )); then
- msg "$(gettext "Package directory is ready.")"
- exit $E_OK
-fi
-
msg "$(gettext "Finished making: %s")" "$pkgbase $basever ($(date +%c))"
install_package && exit $E_OK || exit $E_INSTALL_FAILED
diff -Naur pacman-5.1.0-orig/scripts/pacman-db-upgrade.sh.in pacman-5.1.0/scripts/pacman-db-upgrade.sh.in
--- pacman-5.1.0-orig/scripts/pacman-db-upgrade.sh.in 2018-05-14 03:02:18.000000000 +0300
+++ pacman-5.1.0/scripts/pacman-db-upgrade.sh.in 2018-06-21 12:53:58.892056200 +0300
@@ -1,4 +1,4 @@
-#!/bin/bash -e
+#!/usr/bin/env bash
#
# pacman-db-upgrade - upgrade the local pacman db to a newer format
# @configure_input@
@@ -79,9 +79,13 @@
# PROGRAM START
# determine whether we have gettext; make it a no-op if we do not
-if ! type gettext &>/dev/null; then
+if ! type -p gettext >/dev/null; then
gettext() {
- echo "$@"
+ printf "%s\n" "$@"
+ }
+else
+ gettext() {
+ /usr/bin/gettext "$@"
}
fi
@@ -133,7 +137,7 @@
# make sure pacman isn't running
if [[ -f $lockfile ]]; then
- die "$(gettext "Pacman lock file was found. Cannot run while pacman is running.")"
+ die "$(/bin/gettext "Pacman lock file was found. Cannot run while pacman is running.")"
fi
# do not let pacman run while we do this
touch "$lockfile"
diff -Naur pacman-5.1.0-orig/scripts/pacman-key.sh.in pacman-5.1.0/scripts/pacman-key.sh.in
--- pacman-5.1.0-orig/scripts/pacman-key.sh.in 2018-05-14 03:02:18.000000000 +0300
+++ pacman-5.1.0/scripts/pacman-key.sh.in 2018-06-21 12:53:58.902056300 +0300
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
#
# pacman-key - manages pacman's keyring
# Based on apt-key, from Debian
@@ -53,6 +53,8 @@
m4_include(library/output_format.sh)
+m4_include(library/utils_fixed_path.sh)
+
usage() {
printf "pacman-key (pacman) %s\n" ${myver}
echo
@@ -231,7 +233,7 @@
exit 1
fi
- if (( (EXPORT || FINGER || LIST || VERIFY) && EUID != 0 )); then
+ if (( EXPORT || FINGER || LIST || VERIFY )); then
if ! grep -q "^[[:space:]]*lock-never[[:space:]]*$" ${PACMAN_KEYRING_DIR}/gpg.conf &>/dev/null; then
error "$(gettext "You do not have sufficient permissions to run this command.")"
msg "$(gettext "Use '%s' to correct the keyring permissions.")" "pacman-key --init"
@@ -384,7 +386,7 @@
local ret=0
for importdir in "$@"; do
if [[ -f "${importdir}/trustdb.gpg" ]]; then
- gpg --homedir "${importdir}" --export-ownertrust | \
+ /bin/gpg --homedir "${importdir}" --export-ownertrust | \
"${GPG_PACMAN[@]}" --import-ownertrust -
if (( PIPESTATUS )); then
error "$(gettext "%s could not be imported.")" "${importdir}/trustdb.gpg"
@@ -508,10 +510,14 @@
fi
}
-# PROGRAM START
-if ! type gettext &>/dev/null; then
+# determine whether we have gettext; make it a no-op if we do not
+if ! type -p gettext >/dev/null; then
+ gettext() {
+ printf "%s\n" "$@"
+ }
+else
gettext() {
- echo "$@"
+ /usr/bin/gettext "$@"
}
fi
@@ -569,11 +575,6 @@
exit 1
fi
-if (( (ADD || DELETE || EDITKEY || IMPORT || IMPORT_TRUSTDB || INIT || LSIGNKEY || POPULATE || RECEIVE || REFRESH || UPDATEDB) && EUID != 0 )); then
- error "$(gettext "%s needs to be run as root for this operation.")" "pacman-key"
- exit 1
-fi
-
CONFIG=${CONFIG:-@sysconfdir@/pacman.conf}
if [[ ! -r "${CONFIG}" ]]; then
error "$(gettext "%s configuration file '%s' not found.")" "pacman" "$CONFIG"
diff -Naur pacman-5.1.0-orig/scripts/pkgdelta.sh.in pacman-5.1.0/scripts/pkgdelta.sh.in
--- pacman-5.1.0-orig/scripts/pkgdelta.sh.in 2018-05-14 03:02:18.000000000 +0300
+++ pacman-5.1.0/scripts/pkgdelta.sh.in 2018-06-21 12:53:58.902056300 +0300
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
#
# pkgdelta - create delta files for use with pacman and repo-add
# @configure_input@
@@ -48,6 +48,7 @@
umask 0022
m4_include(library/output_format.sh)
+m4_include(library/utils_fixed_path.sh)
# print usage instructions
usage() {
@@ -173,6 +174,17 @@
set -- "${OPTRET[@]}"
unset OPT_SHORT OPT_LONG OPTRET
+# determine whether we have gettext; make it a no-op if we do not
+if ! type -p gettext >/dev/null; then
+ gettext() {
+ printf "%s\n" "$@"
+ }
+else
+ gettext() {
+ /usr/bin/gettext "$@"
+ }
+fi
+
# parse arguments
while :; do
case $1 in
diff -Naur pacman-5.1.0-orig/scripts/repo-add.sh.in pacman-5.1.0/scripts/repo-add.sh.in
--- pacman-5.1.0-orig/scripts/repo-add.sh.in 2018-05-14 03:02:18.000000000 +0300
+++ pacman-5.1.0/scripts/repo-add.sh.in 2018-06-21 12:53:58.902056300 +0300
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
#
# repo-add - add a package to a given repo database file
# repo-remove - remove a package entry from a given repo database file
@@ -46,6 +46,7 @@
umask 0022
m4_include(library/output_format.sh)
+m4_include(library/utils_fixed_path.sh)
# print usage instructions
usage() {
@@ -707,9 +708,13 @@
# PROGRAM START
# determine whether we have gettext; make it a no-op if we do not
-if ! type gettext &>/dev/null; then
+if ! type -p gettext &>/dev/null; then
gettext() {
- echo "$@"
+ printf "%s\n" "$@"
+ }
+else
+ gettext() {
+ /usr/bin/gettext "$@"
}
fi
diff -Naur pacman-5.1.0-orig/scripts/wrapper.sh.in pacman-5.1.0/scripts/wrapper.sh.in
--- pacman-5.1.0-orig/scripts/wrapper.sh.in 2018-03-18 05:51:17.000000000 +0300
+++ pacman-5.1.0/scripts/wrapper.sh.in 2018-06-21 13:33:09.509347300 +0300
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
#
# @PROGNAME@ - a wrapper for running the real @PROGNAME@ in the source tree
#
diff -Naur pacman-5.1.0-orig/src/pacman/callback.c pacman-5.1.0/src/pacman/callback.c
--- pacman-5.1.0-orig/src/pacman/callback.c 2018-05-14 03:02:18.000000000 +0300
+++ pacman-5.1.0/src/pacman/callback.c 2018-06-21 12:53:58.912056300 +0300
@@ -98,8 +98,11 @@
static void fill_progress(const int bar_percent, const int disp_percent,
const int proglen)
{
- /* 8 = 1 space + 1 [ + 1 ] + 5 for percent */
- const int hashlen = proglen > 8 ? proglen - 8 : 0;
+ /* 9 = 1 space + 1 [ + 1 ] + 5 for percent + 1 blank */
+ /* Without the single blank at the end, carriage return wouldn't
+ * work properly on most windows terminals.
+ */
+ const int hashlen = proglen > 9 ? proglen - 9 : 0;
const int hash = bar_percent * hashlen / 100;
static int lasthash = 0, mouth = 0;
int i;
diff -Naur pacman-5.1.0-orig/src/pacman/check.c pacman-5.1.0/src/pacman/check.c
--- pacman-5.1.0-orig/src/pacman/check.c 2018-05-14 03:02:18.000000000 +0300
+++ pacman-5.1.0/src/pacman/check.c 2018-06-21 12:53:58.912056300 +0300
@@ -75,6 +75,7 @@
int errors = 0;
mode_t fsmode;
+#ifndef __MSYS__
/* uid */
if(st->st_uid != archive_entry_uid(entry)) {
errors++;
@@ -92,6 +93,7 @@
pkgname, filepath);
}
}
+#endif
/* mode */
fsmode = st->st_mode & (S_ISUID | S_ISGID | S_ISVTX | S_IRWXU | S_IRWXG | S_IRWXO);
diff -Naur pacman-5.1.0-orig/src/pacman/pacman.c pacman-5.1.0/src/pacman/pacman.c
--- pacman-5.1.0-orig/src/pacman/pacman.c 2018-05-14 03:02:18.000000000 +0300
+++ pacman-5.1.0/src/pacman/pacman.c 2018-06-21 13:34:11.939434700 +0300
@@ -1119,7 +1119,9 @@
int main(int argc, char *argv[])
{
int ret = 0;
+#ifndef __MSYS__
uid_t myuid = getuid();
+#endif
install_segv_handler();
@@ -1162,11 +1164,13 @@
cleanup(ret);
}
+#ifndef __MSYS__
/* check if we have sufficient permission for the requested operation */
if(myuid > 0 && needs_root()) {
pm_printf(ALPM_LOG_ERROR, _("you cannot perform this operation unless you are root.\n"));
cleanup(EXIT_FAILURE);
}
+#endif
if(config->sysroot && (chroot(config->sysroot) != 0 || chdir("/") != 0)) {
pm_printf(ALPM_LOG_ERROR,
diff -Naur pacman-5.1.0-orig/src/pacman/sighandler.c pacman-5.1.0/src/pacman/sighandler.c
--- pacman-5.1.0-orig/src/pacman/sighandler.c 2018-05-14 03:02:18.000000000 +0300
+++ pacman-5.1.0/src/pacman/sighandler.c 2018-06-21 12:53:58.922056300 +0300
@@ -21,6 +21,10 @@
#include <signal.h>
#include <unistd.h>
+#ifdef __MSYS__
+#include <termios.h>
+#endif
+
#include <alpm.h>
#include "conf.h"
@@ -44,6 +48,9 @@
*/
static void soft_interrupt_handler(int signum)
{
+#ifdef __MSYS__
+ struct termios term;
+#endif
if(signum == SIGINT) {
const char msg[] = "\nInterrupt signal received\n";
xwrite(STDERR_FILENO, msg, ARRAYSIZE(msg) - 1);
@@ -56,6 +63,13 @@
return;
}
alpm_unlock(config->handle);
+#ifdef __MSYS__
+ /* restore input printing possibly disabled by core update */
+ if(tcgetattr(STDIN_FILENO, &term) == 0) {
+ term.c_lflag |= ECHO;
+ tcsetattr(STDIN_FILENO, TCSAFLUSH, &term);
+ }
+#endif
/* output a newline to be sure we clear any line we may be on */
xwrite(STDOUT_FILENO, "\n", 1);
_Exit(128 + signum);
diff -Naur pacman-5.1.0-orig/src/pacman/sync.c pacman-5.1.0/src/pacman/sync.c
--- pacman-5.1.0-orig/src/pacman/sync.c 2018-05-14 03:02:18.000000000 +0300
+++ pacman-5.1.0/src/pacman/sync.c 2018-06-21 13:35:38.316684900 +0300
@@ -28,6 +28,12 @@
#include <sys/stat.h>
#include <fnmatch.h>
+#ifdef __MSYS__
+#include <termios.h>
+#include <handle.h>
+#include <trans.h>
+#endif
+
#include <alpm.h>
#include <alpm_list.h>
@@ -671,8 +677,75 @@
return ret;
}
+#ifdef __MSYS__
+static int wait_indefinitely(void)
+{
+ struct termios term;
+
+ /* disable input printing */
+ if(tcgetattr(STDIN_FILENO, &term) == 0) {
+ term.c_lflag &= ~ECHO;
+ tcsetattr(STDIN_FILENO, TCSAFLUSH, &term);
+ }
+
+ while (1) {
+ getchar();
+ }
+}
+
+static int core_update(int *needed)
+{
+ int retval;
+ alpm_list_t *i;
+ alpm_list_t *core = NULL;
+
+ colon_printf(_("Starting core system upgrade...\n"));
+ alpm_logaction(config->handle, PACMAN_CALLER_PREFIX,
+ "starting core system upgrade\n");
+
+ if(alpm_sync_sysupgrade_core(config->handle, config->op_s_upgrade >= 2) == -1) {
+ pm_printf(ALPM_LOG_ERROR, "%s\n", alpm_strerror(alpm_errno(config->handle)));
+ trans_release();
+ return 1;
+ }
+
+ *needed = 0;
+ for(i = alpm_trans_get_add(config->handle); i; i = i->next) {
+ alpm_pkg_t *pkg = i->data;
+ if (alpm_pkg_is_core_package(pkg)) {
+ core = alpm_list_add(core, pkg);
+ *needed = 1;
+ }
+ }
+
+ if(!(*needed)) {
+ if (!config->print) {
+ printf(_(" there is nothing to do\n"));
+ }
+ return 0;
+ }
+
+ config->handle->trans->add = core;
+ pm_printf(ALPM_LOG_WARNING, _("terminate other MSYS2 programs before proceeding\n"));
+ retval = sync_prepare_execute();
+ if(retval == 0) {
+ pm_printf(ALPM_LOG_WARNING, _("terminate MSYS2 without returning to shell and check for updates again\n"));
+ pm_printf(ALPM_LOG_WARNING, _("for example close your terminal window instead of calling exit"));
+ if(config->noconfirm) {
+ fprintf(stdout, "\n");
+ return 0;
+ }
+ wait_indefinitely();
+ }
+ return retval;
+}
+#endif
+
static int sync_trans(alpm_list_t *targets)
{
+#ifdef __MSYS__
+ int found_core_updates = 0;
+#endif
int retval = 0;
alpm_list_t *i;
@@ -695,6 +767,14 @@
}
if(config->op_s_upgrade) {
+#ifdef __MSYS__
+ if(retval = core_update(&found_core_updates)) {
+ return retval;
+ }
+ if(found_core_updates) {
+ return retval;
+ }
+#endif
if(!config->print) {
colon_printf(_("Starting full system upgrade...\n"));
alpm_logaction(config->handle, PACMAN_CALLER_PREFIX,
diff -Naur pacman-5.1.0-orig/test/pacman/ldconfig.stub pacman-5.1.0/test/pacman/ldconfig.stub
--- pacman-5.1.0-orig/test/pacman/ldconfig.stub 2017-12-13 13:47:39.000000000 +0300
+++ pacman-5.1.0/test/pacman/ldconfig.stub 1970-01-01 03:00:00.000000000 +0300
@@ -1,4 +0,0 @@
-#!/bin/sh
-# A simple stub to copy into the chroot to fake ldconfig.
-# Simply appends a line to /etc/ld.so.cache if called.
-echo "ldconfig called" >> /etc/ld.so.cache
diff -Naur pacman-5.1.0-orig/test/pacman/Makefile.am pacman-5.1.0/test/pacman/Makefile.am
--- pacman-5.1.0-orig/test/pacman/Makefile.am 2018-05-14 03:02:18.000000000 +0300
+++ pacman-5.1.0/test/pacman/Makefile.am 2018-06-21 12:53:58.932056300 +0300
@@ -17,5 +17,4 @@
README \
TODO \
ChangeLog \
- ldconfig.stub \
$(check_SCRIPTS)
diff -Naur pacman-5.1.0-orig/test/pacman/pactest.py pacman-5.1.0/test/pacman/pactest.py
--- pacman-5.1.0-orig/test/pacman/pactest.py 2018-05-14 03:02:18.000000000 +0300
+++ pacman-5.1.0/test/pacman/pactest.py 2018-06-21 13:36:21.136744900 +0300
@@ -94,9 +94,6 @@
parser.add_option("--scriptlet-shell", type = "string",
dest = "scriptletshell", default = "/bin/sh",
help = "specify path to shell used for install scriptlets")
- parser.add_option("--ldconfig", type = "string",
- dest = "ldconfig", default = "/sbin/ldconfig",
- help = "specify path to ldconfig")
parser.add_option("--review", action = "store_true",
dest = "review", default = False,
help = "review test files, test output, and saved logs")
@@ -135,7 +132,6 @@
env.pacman["valgrind"] = opts.valgrind
env.pacman["manual-confirm"] = opts.manualconfirm
env.pacman["scriptlet-shell"] = opts.scriptletshell
- env.pacman["ldconfig"] = opts.ldconfig
try:
for i in args:
diff -Naur pacman-5.1.0-orig/test/pacman/pmtest.py pacman-5.1.0/test/pacman/pmtest.py
--- pacman-5.1.0-orig/test/pacman/pmtest.py 2018-05-14 03:02:18.000000000 +0300
+++ pacman-5.1.0/test/pacman/pmtest.py 2018-06-21 12:53:58.942056300 +0300
@@ -127,12 +127,10 @@
logdir = os.path.join(self.root, os.path.dirname(util.LOGFILE))
etcdir = os.path.join(self.root, os.path.dirname(util.PACCONF))
bindir = os.path.join(self.root, "bin")
- ldconfig = os.path.basename(pacman["ldconfig"])
- ldconfigdir = os.path.join(self.root, os.path.dirname(pacman["ldconfig"][1:]))
shell = pacman["scriptlet-shell"][1:]
shelldir = os.path.join(self.root, os.path.dirname(shell))
sys_dirs = [dbdir, cachedir, syncdir, tmpdir, logdir, etcdir, bindir,
- ldconfigdir, shelldir]
+ shelldir]
for sys_dir in sys_dirs:
if not os.path.isdir(sys_dir):
vprint("\t%s" % sys_dir[len(self.root)+1:])
@@ -141,10 +139,6 @@
shutil.copy("/bin/sh", bindir)
if shell != "bin/sh":
shutil.copy("/bin/sh", os.path.join(self.root, shell))
- shutil.copy(os.path.join(util.SELFPATH, "ldconfig.stub"),
- os.path.join(ldconfigdir, ldconfig))
- ld_so_conf = open(os.path.join(etcdir, "ld.so.conf"), "w")
- ld_so_conf.close()
# Configuration file
vprint(" Creating configuration file")
@@ -228,19 +222,6 @@
vprint("\tpacman %s" % self.args)
cmd = []
- if os.geteuid() != 0:
- fakeroot = util.which("fakeroot")
- if not fakeroot:
- tap.diag("WARNING: fakeroot not found!")
- else:
- cmd.append("fakeroot")
-
- fakechroot = util.which("fakechroot")
- if not fakechroot:
- tap.diag("WARNING: fakechroot not found!")
- else:
- cmd.append("fakechroot")
-
if pacman["gdb"]:
cmd.extend(["libtool", "execute", "gdb", "--args"])
if pacman["valgrind"]:
@@ -281,8 +262,9 @@
# Change to the tmp dir before running pacman, so that local package
# archives are made available more easily.
time_start = time.time()
- self.retcode = subprocess.call(cmd, stdout=output, stderr=output,
- cwd=os.path.join(self.root, util.TMPDIR), env={'LC_ALL': 'C'})
+ self.retcode = subprocess.call(cmd,
+ cwd=os.path.join(self.root, util.TMPDIR),
+ env={'LC_ALL': 'C', 'PATH': os.environ['PATH']})
time_end = time.time()
vprint("\ttime elapsed: %.2fs" % (time_end - time_start))
diff -Naur pacman-5.1.0-orig/test/pacman/tests/ldconfig001.py pacman-5.1.0/test/pacman/tests/ldconfig001.py
--- pacman-5.1.0-orig/test/pacman/tests/ldconfig001.py 2017-12-13 13:47:39.000000000 +0300
+++ pacman-5.1.0/test/pacman/tests/ldconfig001.py 1970-01-01 03:00:00.000000000 +0300
@@ -1,9 +0,0 @@
-self.description = "Make sure ldconfig runs on an upgrade operation"
-
-p = pmpkg("dummy")
-self.addpkg(p)
-
-self.args = "-U %s" % p.filename()
-
-self.addrule("PACMAN_RETCODE=0")
-self.addrule("FILE_EXIST=etc/ld.so.cache")
diff -Naur pacman-5.1.0-orig/test/pacman/tests/ldconfig002.py pacman-5.1.0/test/pacman/tests/ldconfig002.py
--- pacman-5.1.0-orig/test/pacman/tests/ldconfig002.py 2017-12-13 13:47:39.000000000 +0300
+++ pacman-5.1.0/test/pacman/tests/ldconfig002.py 1970-01-01 03:00:00.000000000 +0300
@@ -1,13 +0,0 @@
-self.description = "Make sure ldconfig runs on an upgrade operation"
-
-lp = pmpkg("dummy")
-self.addpkg2db("local", lp)
-
-p = pmpkg("dummy", "1.0-2")
-self.addpkg(p)
-
-self.args = "-U %s" % p.filename()
-
-self.addrule("PACMAN_RETCODE=0")
-self.addrule("PKG_VERSION=dummy|1.0-2")
-self.addrule("FILE_EXIST=etc/ld.so.cache")
diff -Naur pacman-5.1.0-orig/test/pacman/tests/ldconfig003.py pacman-5.1.0/test/pacman/tests/ldconfig003.py
--- pacman-5.1.0-orig/test/pacman/tests/ldconfig003.py 2017-12-13 13:47:39.000000000 +0300
+++ pacman-5.1.0/test/pacman/tests/ldconfig003.py 1970-01-01 03:00:00.000000000 +0300
@@ -1,9 +0,0 @@
-self.description = "Make sure ldconfig runs on a sync operation"
-
-sp = pmpkg("dummy")
-self.addpkg2db("sync", sp)
-
-self.args = "-S %s" % sp.name
-
-self.addrule("PACMAN_RETCODE=0")
-self.addrule("FILE_EXIST=etc/ld.so.cache")
diff -Naur pacman-5.1.0-orig/test/pacman/tests/TESTS pacman-5.1.0/test/pacman/tests/TESTS
--- pacman-5.1.0-orig/test/pacman/tests/TESTS 2018-03-18 05:51:17.000000000 +0300
+++ pacman-5.1.0/test/pacman/tests/TESTS 2018-06-21 12:53:58.942056300 +0300
@@ -78,9 +78,6 @@
TESTS += test/pacman/tests/ignore006.py
TESTS += test/pacman/tests/ignore007.py
TESTS += test/pacman/tests/ignore008.py
-TESTS += test/pacman/tests/ldconfig001.py
-TESTS += test/pacman/tests/ldconfig002.py
-TESTS += test/pacman/tests/ldconfig003.py
TESTS += test/pacman/tests/mode001.py
TESTS += test/pacman/tests/mode002.py
TESTS += test/pacman/tests/mode003.py