Files
MSYS2-packages/pacman/0000-pacman-msysize.patch
2017-02-15 13:22:24 +03:00

1742 lines
55 KiB
Diff

diff -Naur pacman-5.0.1-orig/configure.ac pacman-5.0.1/configure.ac
--- pacman-5.0.1-orig/configure.ac 2016-02-23 06:17:34.000000000 +0300
+++ pacman-5.0.1/configure.ac 2016-07-15 09:42:18.760037400 +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 using OpenSSL
AC_ARG_WITH(openssl,
AS_HELP_STRING([--with-openssl], [use OpenSSL crypto implementations instead of internal routines]),
@@ -497,9 +491,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.0.1-orig/contrib/bacman.sh.in pacman-5.0.1/contrib/bacman.sh.in
--- pacman-5.0.1-orig/contrib/bacman.sh.in 2016-01-04 06:27:45.000000000 +0300
+++ pacman-5.0.1/contrib/bacman.sh.in 2016-07-15 09:42:18.772037400 +0300
@@ -80,21 +80,6 @@
fi
#
-# Fakeroot support
-#
-if (( EUID )); then
- if [[ -f /usr/bin/fakeroot ]]; then
- msg "Entering fakeroot environment"
- export INFAKEROOT="1"
- /usr/bin/fakeroot -u -- "$0" "${ARGS[@]}"
- exit $?
- else
- warning "installing fakeroot or running $myname as root is required to"
- plain " preserve the ownership permissions of files in some packages\n"
- fi
-fi
-
-#
# Setting environmental variables
#
if [[ ! -r @sysconfdir@/pacman.conf ]]; then
@@ -205,7 +190,7 @@
esac
ret=0
- bsdtar -cnf - -s'/.pacnew$//' "$local_file" 2> /dev/null | bsdtar -xpf - 2> /dev/null
+ /usr/bin/bsdtar -cnf - -s'/.pacnew$//' "$local_file" 2> /dev/null | /bin/bsdtar -xpf - 2> /dev/null
# Workaround to bsdtar not reporting a missing file as an error
if ! [[ -e $package_file || -L $package_file ]]; then
@@ -231,9 +216,6 @@
#
msg2 "Generating .PKGINFO metadata..."
echo "# Generated by $myname $myver" > .PKGINFO
-if [[ $INFAKEROOT == "1" ]]; then
- echo "# Using $(fakeroot -v)" >> .PKGINFO
-fi
echo "# $(LC_ALL=C date)" >> .PKGINFO
echo "#" >> .PKGINFO
@@ -331,11 +313,11 @@
# TODO: Maybe this can be set globally for robustness
shopt -s -o pipefail
-bsdtar -cf - $comp_files * |
+/usr/bin/bsdtar -cf - $comp_files * |
case "$PKGEXT" in
- *tar.gz) gzip -c -f -n ;;
- *tar.bz2) bzip2 -c -f ;;
- *tar.xz) xz -c -z - ;;
+ *tar.gz) /bin/gzip -c -f -n ;;
+ *tar.bz2) /bin/bzip2 -c -f ;;
+ *tar.xz) /bin/xz -c -z - ;;
*tar.Z) compress -c -f ;;
*tar) cat ;;
*) warning "'%s' is not a valid archive extension." \
diff -Naur pacman-5.0.1-orig/contrib/checkupdates.sh.in pacman-5.0.1/contrib/checkupdates.sh.in
--- pacman-5.0.1-orig/contrib/checkupdates.sh.in 2015-10-18 08:38:28.000000000 +0300
+++ pacman-5.0.1/contrib/checkupdates.sh.in 2016-07-15 09:42:18.779037400 +0300
@@ -35,11 +35,6 @@
exit 0
fi
-if ! type -P fakeroot >/dev/null; then
- error 'Cannot find the fakeroot binary.'
- exit 1
-fi
-
if [[ -z $CHECKUPDATES_DB ]]; then
CHECKUPDATES_DB="${TMPDIR:-/tmp}/checkup-db-${USER}/"
fi
@@ -51,7 +46,7 @@
mkdir -p "$CHECKUPDATES_DB"
ln -s "${DBPath}/local" "$CHECKUPDATES_DB" &> /dev/null
-fakeroot -- pacman -Sy --dbpath "$CHECKUPDATES_DB" --logfile /dev/null &> /dev/null
+pacman -Sy --dbpath "$CHECKUPDATES_DB" --logfile /dev/null &> /dev/null
pacman -Qu --dbpath "$CHECKUPDATES_DB" 2> /dev/null | grep -v '\[.*\]'
exit 0
diff -Naur pacman-5.0.1-orig/contrib/paccache.sh.in pacman-5.0.1/contrib/paccache.sh.in
--- pacman-5.0.1-orig/contrib/paccache.sh.in 2015-03-26 07:43:10.000000000 +0300
+++ pacman-5.0.1/contrib/paccache.sh.in 2016-07-15 09:42:18.787037400 +0300
@@ -24,7 +24,7 @@
declare -r myver='@PACKAGE_VERSION@'
declare -a cachedirs=() candidates=() cmdopts=() whitelist=() blacklist=()
-declare -i delete=0 dryrun=0 filecount=0 move=0 needsroot=0 totalsaved=0 verbose=0
+declare -i delete=0 dryrun=0 filecount=0 move=0 totalsaved=0 verbose=0
declare delim=$'\n' keep=3 movedir= scanarch=
QUIET=0
@@ -123,16 +123,7 @@
m4_include(../scripts/library/size_to_human.sh)
runcmd() {
- if (( needsroot && EUID != 0 )); then
- msg "Privilege escalation required"
- if sudo -v &>/dev/null && sudo -l &>/dev/null; then
- sudo "$@"
- else
- die 'Unable to escalate privileges using sudo'
- fi
- else
- "$@"
- fi
+ "$@"
}
summarize() {
@@ -306,17 +297,12 @@
if (( move || delete )); then
# make it an absolute path since we're about to chdir
[[ $movedir && ${movedir:0:1} != '/' ]] && movedir=$PWD/$movedir
- [[ $movedir && ! -w $movedir ]] && needsroot=1
fi
for cachedir in "${cachedirs[@]}"; do
[[ -d $cachedir ]] ||
die "cachedir '%s' does not exist or is not a directory" "$cachedir"
- if (( move || delete )); then
- [[ ! -w $cachedir ]] && needsroot=1
- fi
-
# unlikely that this will fail, but better make sure
pushd "$cachedir" &>/dev/null || die "failed to chdir to '%s'" "$cachedir"
diff -Naur pacman-5.0.1-orig/contrib/paclist.sh.in pacman-5.0.1/contrib/paclist.sh.in
--- pacman-5.0.1-orig/contrib/paclist.sh.in 2014-12-24 04:16:59.000000000 +0300
+++ pacman-5.0.1/contrib/paclist.sh.in 2016-07-15 09:42:18.796037400 +0300
@@ -59,7 +59,7 @@
exit 0
fi
-printf -v installed '[%s]' "$(gettext installed)"
+printf -v installed '[%s]' "$(/usr/bin/gettext installed)"
pacman -Sl $1 | awk -v i="$installed" '$NF == i { print $2,$3 }'
# exit with pacman's return value, not awk's
diff -Naur pacman-5.0.1-orig/contrib/pacscripts.sh.in pacman-5.0.1/contrib/pacscripts.sh.in
--- pacman-5.0.1-orig/contrib/pacscripts.sh.in 2016-01-04 06:27:45.000000000 +0300
+++ pacman-5.0.1/contrib/pacscripts.sh.in 2016-07-15 09:42:18.804037400 +0300
@@ -42,7 +42,7 @@
error() {
local mesg=$1; shift
- printf "==> $(gettext "ERROR:") ${mesg}\n" "$@" >&2
+ printf "==> $(/usr/bin/gettext "ERROR:") ${mesg}\n" "$@" >&2
}
usage() {
@@ -67,17 +67,7 @@
}
spacman() {
- if [ $EUID -eq 0 ]; then
- pacman "$@"
- else
- if ! type -p sudo; then
- error "Cannot find the sudo binary!"
- error "${myname} requires root privileges. Either install \"sudo\" or run as root."
- exit 1
- else
- sudo pacman "$@"
- fi
- fi
+ pacman "$@"
}
print_db() {
@@ -94,7 +84,7 @@
}
print_pkg() {
- if ! bsdtar -xqOf "$1" .INSTALL 2>/dev/null; then
+ if ! /usr/bin/bsdtar -xqOf "$1" .INSTALL 2>/dev/null; then
error "Package $1 does not include any .INSTALL script"
return 1
fi
@@ -103,7 +93,7 @@
print_scriptlet() {
if [ -f "$1" ]; then
- if bsdtar tf "$1" .PKGINFO &>/dev/null; then
+ if /usr/bin/bsdtar tf "$1" .PKGINFO &>/dev/null; then
print_pkg "$1"
return
fi
diff -Naur pacman-5.0.1-orig/contrib/updpkgsums.sh.in pacman-5.0.1/contrib/updpkgsums.sh.in
--- pacman-5.0.1-orig/contrib/updpkgsums.sh.in 2016-01-04 06:27:45.000000000 +0300
+++ pacman-5.0.1/contrib/updpkgsums.sh.in 2016-07-15 09:42:18.816037400 +0300
@@ -83,7 +83,7 @@
newbuildfile=$(mktemp "${TMPDIR:-/tmp}/updpkgsums.XXXXXX")
trap "rm -rf '$BUILDDIR' '$newbuildfile'" EXIT
-newsums=$(makepkg -g -p "$buildfile") || die 'Failed to generate new checksums'
+newsums=$(MINGW_PACKAGE_PREFIX=mingw-w64-i686 makepkg -g -p "$buildfile") || die 'Failed to generate new checksums'
awk -v newsums="$newsums" '
/^[[:blank:]]*(md|sha)[[:digit:]]+sums(_[^=]+)?=/,/\)[[:blank:]]*(#.*)?$/ {
if (!w) {
diff -Naur pacman-5.0.1-orig/lib/libalpm/add.c pacman-5.0.1/lib/libalpm/add.c
--- pacman-5.0.1-orig/lib/libalpm/add.c 2016-02-23 05:51:26.000000000 +0300
+++ pacman-5.0.1/lib/libalpm/add.c 2016-07-15 09:42:18.848037400 +0300
@@ -247,6 +247,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.
@@ -264,6 +265,7 @@
}
#endif
+#endif
_alpm_log(handle, ALPM_LOG_DEBUG, "extract: skipping dir extraction of %s\n",
filename);
archive_read_data_skip(archive);
@@ -629,7 +631,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;
@@ -652,18 +657,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.0.1-orig/lib/libalpm/alpm.h pacman-5.0.1/lib/libalpm/alpm.h
--- pacman-5.0.1-orig/lib/libalpm/alpm.h 2016-01-04 06:27:45.000000000 +0300
+++ pacman-5.0.1/lib/libalpm/alpm.h 2016-07-15 09:42:18.878037400 +0300
@@ -1538,6 +1538,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.0.1-orig/lib/libalpm/package.c pacman-5.0.1/lib/libalpm/package.c
--- pacman-5.0.1-orig/lib/libalpm/package.c 2016-02-23 05:51:26.000000000 +0300
+++ pacman-5.0.1/lib/libalpm/package.c 2016-07-15 09:42:18.910037400 +0300
@@ -788,4 +788,20 @@
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
+
/* vim: set noet: */
diff -Naur pacman-5.0.1-orig/lib/libalpm/remove.c pacman-5.0.1/lib/libalpm/remove.c
--- pacman-5.0.1-orig/lib/libalpm/remove.c 2016-01-04 06:27:45.000000000 +0300
+++ pacman-5.0.1/lib/libalpm/remove.c 2016-07-15 09:42:18.937037400 +0300
@@ -751,18 +751,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.0.1-orig/lib/libalpm/sync.c pacman-5.0.1/lib/libalpm/sync.c
--- pacman-5.0.1-orig/lib/libalpm/sync.c 2016-02-23 05:51:26.000000000 +0300
+++ pacman-5.0.1/lib/libalpm/sync.c 2016-07-15 09:42:18.983037400 +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.0.1-orig/lib/libalpm/util.c pacman-5.0.1/lib/libalpm/util.c
--- pacman-5.0.1-orig/lib/libalpm/util.c 2016-02-23 05:51:26.000000000 +0300
+++ pacman-5.0.1/lib/libalpm/util.c 2016-07-15 09:42:19.020037400 +0300
@@ -735,6 +735,7 @@
return retval;
}
+#ifndef __MSYS__
/** Run ldconfig in a chroot.
* @param handle the context handle
* @return 0 on success, 1 on error
@@ -758,6 +759,7 @@
return 0;
}
+#endif
/** Helper function for comparing strings using the alpm "compare func"
* signature.
diff -Naur pacman-5.0.1-orig/lib/libalpm/version.c pacman-5.0.1/lib/libalpm/version.c
--- pacman-5.0.1-orig/lib/libalpm/version.c 2016-01-04 06:27:45.000000000 +0300
+++ pacman-5.0.1/lib/libalpm/version.c 2016-07-15 09:42:19.059037400 +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.0.1-orig/Makefile.am pacman-5.0.1/Makefile.am
--- pacman-5.0.1-orig/Makefile.am 2016-01-29 02:50:49.000000000 +0300
+++ pacman-5.0.1/Makefile.am 2016-07-15 09:42:19.094037400 +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.0.1-orig/scripts/libmakepkg/lint_package/build_references.sh.in pacman-5.0.1/scripts/libmakepkg/lint_package/build_references.sh.in
--- pacman-5.0.1-orig/scripts/libmakepkg/lint_package/build_references.sh.in 2016-01-04 06:27:45.000000000 +0300
+++ pacman-5.0.1/scripts/libmakepkg/lint_package/build_references.sh.in 2016-07-15 09:42:19.124037400 +0300
@@ -35,4 +35,12 @@
if find "${pkgdir}" -type f -print0 | xargs -0 grep -q -I "${pkgdirbase}" ; then
warning "$(gettext "Package contains reference to %s")" "\$pkgdir"
fi
+
+ # 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
}
diff -Naur pacman-5.0.1-orig/scripts/libmakepkg/tidy/staticlibs.sh.in pacman-5.0.1/scripts/libmakepkg/tidy/staticlibs.sh.in
--- pacman-5.0.1-orig/scripts/libmakepkg/tidy/staticlibs.sh.in 2016-01-04 06:27:45.000000000 +0300
+++ pacman-5.0.1/scripts/libmakepkg/tidy/staticlibs.sh.in 2016-07-15 09:42:19.170037400 +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.0.1-orig/scripts/libmakepkg/tidy/strip.sh.in pacman-5.0.1/scripts/libmakepkg/tidy/strip.sh.in
--- pacman-5.0.1-orig/scripts/libmakepkg/tidy/strip.sh.in 2016-01-04 06:27:45.000000000 +0300
+++ pacman-5.0.1/scripts/libmakepkg/tidy/strip.sh.in 2016-07-15 09:42:19.206037400 +0300
@@ -31,55 +31,53 @@
tidy_modify+=('tidy_strip')
-build_id() {
- LANG=C readelf -n $1 | sed -n '/Build ID/ { s/.*: //p; q; }'
-}
-
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
-
- 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"
+ 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"
}
-
tidy_strip() {
if check_option "strip" "y"; then
msg2 "$(gettext "Stripping unneeded symbols from binaries and libraries...")"
@@ -88,13 +86,72 @@
[[ -z ${STRIP_STATIC+x} ]] && STRIP_STATIC="-S"
if check_option "debug" "y"; then
- dbgdir="$pkgdir-@DEBUGSUFFIX@/usr/lib/debug"
+ dbgdir="$pkgdir-@DEBUGSUFFIX@"
mkdir -p "$dbgdir"
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
+ # 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.0.1-orig/scripts/libmakepkg/util/pkgbuild.sh.in pacman-5.0.1/scripts/libmakepkg/util/pkgbuild.sh.in
--- pacman-5.0.1-orig/scripts/libmakepkg/util/pkgbuild.sh.in 2016-01-04 06:27:45.000000000 +0300
+++ pacman-5.0.1/scripts/libmakepkg/util/pkgbuild.sh.in 2016-07-15 09:42:19.241037400 +0300
@@ -116,7 +116,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.0.1-orig/scripts/library/utils_fixed_path.sh pacman-5.0.1/scripts/library/utils_fixed_path.sh
--- pacman-5.0.1-orig/scripts/library/utils_fixed_path.sh 1970-01-01 03:00:00.000000000 +0300
+++ pacman-5.0.1/scripts/library/utils_fixed_path.sh 2016-07-15 09:42:19.277037400 +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.0.1-orig/scripts/Makefile.am pacman-5.0.1/scripts/Makefile.am
--- pacman-5.0.1-orig/scripts/Makefile.am 2015-10-18 08:38:28.000000000 +0300
+++ pacman-5.0.1/scripts/Makefile.am 2016-07-15 09:42:19.306037400 +0300
@@ -36,7 +36,8 @@
library/parseopts.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
@@ -158,6 +159,7 @@
$(srcdir)/makepkg.sh.in \
$(srcdir)/makepkg-wrapper.sh.in \
$(srcdir)/library/parseopts.sh \
+ $(srcdir)/library/utils_fixed_path.sh \
$(LIBMAKEPKG_IN)
makepkg-template: \
@@ -170,7 +172,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 \
@@ -179,16 +182,19 @@
pacman-optimize: \
$(srcdir)/pacman-optimize.sh.in \
- $(srcdir)/library/output_format.sh
+ $(srcdir)/library/output_format.sh \
+ $(srcdir)/library/utils_fixed_path.sh
pkgdelta: \
$(srcdir)/pkgdelta.sh.in \
$(srcdir)/library/output_format.sh \
- $(srcdir)/library/parseopts.sh
+ $(srcdir)/library/parseopts.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
@@ -203,6 +209,7 @@
$(srcdir)/makepkg-wrapper.sh.in \
$(srcdir)/makepkg.sh.in \
$(srcdir)/library/parseopts.sh \
+ $(srcdir)/library/utils_fixed_path.sh \
| makepkg
$(AM_V_at)$(MKDIR_P) .lib
$(AM_V_at)mv -f makepkg .lib
diff -Naur pacman-5.0.1-orig/scripts/makepkg.sh.in pacman-5.0.1/scripts/makepkg.sh.in
--- pacman-5.0.1-orig/scripts/makepkg.sh.in 2016-02-23 05:52:34.000000000 +0300
+++ pacman-5.0.1/scripts/makepkg.sh.in 2016-07-15 09:42:19.375037400 +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, openssl, sed, tput (ncurses), xz
# gettext initialization
@@ -67,7 +67,6 @@
GENINTEG=0
HOLDVER=0
IGNOREARCH=0
-INFAKEROOT=0
INSTALL=0
LOGGING=0
NEEDED=0
@@ -91,6 +90,8 @@
shopt -s extglob
+m4_include(library/utils_fixed_path.sh)
+
### SUBROUTINES ###
# Import libmakepkg
@@ -105,10 +106,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
@@ -123,17 +123,12 @@
clean_up() {
local EXIT_CODE=$?
- if (( INFAKEROOT )); then
- # Don't clean up when leaving fakeroot, we're not done yet.
- return
- fi
-
if (( ! EXIT_CODE && 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.
@@ -223,13 +218,7 @@
else
cmd=("$PACMAN_PATH" "$@")
fi
- if [[ $1 != -@(T|Qq|Q) ]]; then
- if type -p sudo >/dev/null; then
- cmd=(sudo "${cmd[@]}")
- else
- cmd=(su root -c "$(printf '%q ' "${cmd[@]}")")
- fi
- fi
+
"${cmd[@]}"
}
@@ -806,6 +795,8 @@
# ensure all necessary build variables are exported
export CPPFLAGS CFLAGS CXXFLAGS LDFLAGS MAKEFLAGS CHOST
+ export MINGW_CHOST MINGW_PREFIX MINGW_PACKAGE_PREFIX
+ export DXSDK_DIR ACLOCAL_PATH PKG_CONFIG_PATH
# save our shell options so pkgfunc() can't override what we need
local shellopts=$(shopt -p)
@@ -889,7 +880,7 @@
sodepends=0;
for d in "${depends[@]}"; do
- if [[ $d = *.so ]]; then
+ if [[ $d = *.dll ]]; then
sodepends=1;
break;
fi
@@ -900,28 +891,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)
@@ -929,7 +925,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")
@@ -954,32 +950,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")
@@ -1115,7 +1102,6 @@
msg2 "$(gettext "Generating %s file...")" ".PKGINFO"
printf "# Generated by makepkg %s\n" "$makepkg_version"
- printf "# using %s\n" "$(fakeroot -v)"
printf "# %s\n" "$(LC_ALL=C date -u)"
printf "pkgname = %s\n" "$pkgname"
@@ -1234,7 +1220,7 @@
case "$PKGEXT" 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} ;;
@@ -1275,9 +1261,8 @@
fi
pkgdir="${pkgdir}-@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
fi
@@ -1517,21 +1502,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
@@ -1683,6 +1653,11 @@
local pkgname_backup=("${pkgname[@]}")
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"
backup_package_variables
run_package $pkgname
@@ -1770,12 +1745,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'
@@ -1809,7 +1788,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 ;;
@@ -1975,19 +1953,6 @@
PACKAGER=${_PACKAGER:-$PACKAGER}
CARCH=${_CARCH:-$CARCH}
-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 1 # $E_USER_ABORT
- fi
-else
- if [[ -z $FAKEROOTKEY ]]; then
- error "$(gettext "Do not use the %s option. This option is only for use by %s.")" "'-F'" "makepkg"
- exit 1 # TODO: error code
- fi
-fi
-
unset pkgname pkgbase pkgver pkgrel epoch pkgdesc url license groups provides
unset md5sums replaces depends conflicts backup source install changelog build
unset makedepends optdepends options noextract validpgpkeys
@@ -2105,33 +2070,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 0 # $E_OK
- fi
-
- chmod 755 "$pkgdirbase"
- if (( ! SPLITPKG )); then
- pkgdir="$pkgdirbase/$pkgname"
- mkdir "$pkgdir"
- if (( PKGFUNC )); then
- run_package
- fi
- tidy_install
- lint_package
- create_package
- create_debug_package
- else
- run_split_packaging
- fi
-
- msg "$(gettext "Leaving %s environment.")" "fakeroot"
- exit 0 # $E_OK
-fi
-
msg "$(gettext "Making package: %s")" "$pkgbase $basever ($(date))"
# if we are creating a source-only package, go no further
@@ -2155,7 +2093,7 @@
check_source_integrity all
cd_safe "$startdir"
- enter_fakeroot
+ create_srcpackage
msg "$(gettext "Source package created: %s")" "$pkgbase ($(date))"
exit 0
@@ -2245,13 +2183,32 @@
cd_safe "$startdir"
fi
- enter_fakeroot
-fi
-
-# if inhibiting archive creation, go no further
-if (( NOARCHIVE )); then
- msg "$(gettext "Package directory is ready.")"
- exit 0
+ # if inhibiting archive creation, go no further
+ if (( NOARCHIVE )); then
+ msg "$(gettext "Package directory is ready.")"
+ exit 0
+ 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
+ create_package
+ create_debug_package
+ else
+ run_split_packaging
+ fi
fi
msg "$(gettext "Finished making: %s")" "$pkgbase $basever ($(date))"
diff -Naur pacman-5.0.1-orig/scripts/makepkg-wrapper.sh.in pacman-5.0.1/scripts/makepkg-wrapper.sh.in
--- pacman-5.0.1-orig/scripts/makepkg-wrapper.sh.in 2016-01-04 06:27:45.000000000 +0300
+++ pacman-5.0.1/scripts/makepkg-wrapper.sh.in 2016-07-15 09:42:19.421037400 +0300
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
#
# makepkg - a wrapper for running the real makepkg in the source tree
#
diff -Naur pacman-5.0.1-orig/scripts/pacman-db-upgrade.sh.in pacman-5.0.1/scripts/pacman-db-upgrade.sh.in
--- pacman-5.0.1-orig/scripts/pacman-db-upgrade.sh.in 2016-01-04 06:27:45.000000000 +0300
+++ pacman-5.0.1/scripts/pacman-db-upgrade.sh.in 2016-07-15 09:42:19.456037400 +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@
@@ -88,9 +88,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
@@ -147,7 +151,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.0.1-orig/scripts/pacman-key.sh.in pacman-5.0.1/scripts/pacman-key.sh.in
--- pacman-5.0.1-orig/scripts/pacman-key.sh.in 2016-01-04 06:27:45.000000000 +0300
+++ pacman-5.0.1/scripts/pacman-key.sh.in 2016-07-15 09:42:19.512037400 +0300
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
#
# pacman-key - manages pacman's keyring
# Based on apt-key, from Debian
@@ -52,6 +52,8 @@
m4_include(library/parseopts.sh)
+m4_include(library/utils_fixed_path.sh)
+
usage() {
printf "pacman-key (pacman) %s\n" ${myver}
echo
@@ -226,7 +228,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"
@@ -379,7 +381,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"
@@ -499,10 +501,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
@@ -560,11 +566,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.0.1-orig/scripts/pacman-optimize.sh.in pacman-5.0.1/scripts/pacman-optimize.sh.in
--- pacman-5.0.1-orig/scripts/pacman-optimize.sh.in 2016-01-04 06:27:45.000000000 +0300
+++ pacman-5.0.1/scripts/pacman-optimize.sh.in 2016-07-15 09:42:19.549037400 +0300
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
#
# pacman-optimize
# @configure_input@
@@ -33,6 +33,8 @@
m4_include(library/output_format.sh)
+m4_include(library/utils_fixed_path.sh)
+
usage() {
printf "pacman-optimize (pacman) %s\n\n" "$myver"
printf -- "$(gettext "Usage: %s [--nocolor] [pacman_db_root]")\n\n" "$0"
@@ -70,9 +72,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() {
+ printf "%s\n" "$@"
+ }
+else
gettext() {
- echo "$@"
+ /usr/bin/gettext "$@"
}
fi
diff -Naur pacman-5.0.1-orig/scripts/pkgdelta.sh.in pacman-5.0.1/scripts/pkgdelta.sh.in
--- pacman-5.0.1-orig/scripts/pkgdelta.sh.in 2015-03-26 07:43:10.000000000 +0300
+++ pacman-5.0.1/scripts/pkgdelta.sh.in 2016-07-15 09:42:19.591037400 +0300
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
#
# pkgdelta - create delta files for use with pacman and repo-add
# @configure_input@
@@ -43,6 +43,7 @@
m4_include(library/parseopts.sh)
m4_include(library/output_format.sh)
+m4_include(library/utils_fixed_path.sh)
# print usage instructions
usage() {
@@ -168,6 +169,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.0.1-orig/scripts/repo-add.sh.in pacman-5.0.1/scripts/repo-add.sh.in
--- pacman-5.0.1-orig/scripts/repo-add.sh.in 2016-02-22 04:26:22.000000000 +0300
+++ pacman-5.0.1/scripts/repo-add.sh.in 2016-07-15 09:42:19.644037400 +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.0.1-orig/src/pacman/callback.c pacman-5.0.1/src/pacman/callback.c
--- pacman-5.0.1-orig/src/pacman/callback.c 2016-02-23 05:56:52.000000000 +0300
+++ pacman-5.0.1/src/pacman/callback.c 2016-07-15 09:42:19.660037400 +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.0.1-orig/src/pacman/check.c pacman-5.0.1/src/pacman/check.c
--- pacman-5.0.1-orig/src/pacman/check.c 2016-01-04 06:27:45.000000000 +0300
+++ pacman-5.0.1/src/pacman/check.c 2016-07-15 09:42:19.685037400 +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.0.1-orig/src/pacman/pacman.c pacman-5.0.1/src/pacman/pacman.c
--- pacman-5.0.1-orig/src/pacman/pacman.c 2016-01-04 06:27:45.000000000 +0300
+++ pacman-5.0.1/src/pacman/pacman.c 2016-07-15 09:42:19.712037400 +0300
@@ -1090,7 +1090,9 @@
{
int ret = 0;
size_t i;
+#ifndef __MSYS__
uid_t myuid = getuid();
+#endif
install_segv_handler();
@@ -1213,11 +1215,13 @@
config->logmask &= ~ALPM_LOG_WARNING;
}
+#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->verbose > 0) {
alpm_list_t *j;
diff -Naur pacman-5.0.1-orig/src/pacman/sighandler.c pacman-5.0.1/src/pacman/sighandler.c
--- pacman-5.0.1-orig/src/pacman/sighandler.c 2016-01-04 06:27:45.000000000 +0300
+++ pacman-5.0.1/src/pacman/sighandler.c 2016-07-15 09:42:19.744037400 +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.0.1-orig/src/pacman/sync.c pacman-5.0.1/src/pacman/sync.c
--- pacman-5.0.1-orig/src/pacman/sync.c 2016-01-04 06:27:45.000000000 +0300
+++ pacman-5.0.1/src/pacman/sync.c 2016-07-15 09:42:19.779037400 +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>
@@ -670,8 +676,74 @@
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"));
+ if((retval = sync_prepare_execute()) == 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;
@@ -694,6 +766,14 @@
}
if(config->op_s_upgrade) {
+#ifdef __MSYS__
+ if(retval = core_update(&found_core_updates)) {
+ return retval;
+ }
+ if(found_core_updates) {
+ return retval;
+ }
+#endif
colon_printf(_("Starting full system upgrade...\n"));
alpm_logaction(config->handle, PACMAN_CALLER_PREFIX,
"starting full system upgrade\n");
diff -Naur pacman-5.0.1-orig/test/pacman/ldconfig.stub pacman-5.0.1/test/pacman/ldconfig.stub
--- pacman-5.0.1-orig/test/pacman/ldconfig.stub 2013-04-30 15:05:45.000000000 +0400
+++ pacman-5.0.1/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.0.1-orig/test/pacman/Makefile.am pacman-5.0.1/test/pacman/Makefile.am
--- pacman-5.0.1-orig/test/pacman/Makefile.am 2014-12-21 09:24:36.000000000 +0300
+++ pacman-5.0.1/test/pacman/Makefile.am 2016-07-15 09:42:19.825037400 +0300
@@ -17,7 +17,6 @@
README \
TODO \
ChangeLog \
- ldconfig.stub \
$(check_SCRIPTS)
# vim:set noet:
diff -Naur pacman-5.0.1-orig/test/pacman/pactest.py pacman-5.0.1/test/pacman/pactest.py
--- pacman-5.0.1-orig/test/pacman/pactest.py 2016-01-04 06:27:45.000000000 +0300
+++ pacman-5.0.1/test/pacman/pactest.py 2016-07-15 09:42:19.850037400 +0300
@@ -68,9 +68,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")
return parser
@@ -103,7 +100,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.0.1-orig/test/pacman/pmtest.py pacman-5.0.1/test/pacman/pmtest.py
--- pacman-5.0.1-orig/test/pacman/pmtest.py 2016-01-04 06:27:45.000000000 +0300
+++ pacman-5.0.1/test/pacman/pmtest.py 2016-07-15 09:42:19.875037400 +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.0.1-orig/test/pacman/tests/ldconfig001.py pacman-5.0.1/test/pacman/tests/ldconfig001.py
--- pacman-5.0.1-orig/test/pacman/tests/ldconfig001.py 2013-04-30 15:05:45.000000000 +0400
+++ pacman-5.0.1/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.0.1-orig/test/pacman/tests/ldconfig002.py pacman-5.0.1/test/pacman/tests/ldconfig002.py
--- pacman-5.0.1-orig/test/pacman/tests/ldconfig002.py 2013-04-30 15:05:45.000000000 +0400
+++ pacman-5.0.1/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.0.1-orig/test/pacman/tests/ldconfig003.py pacman-5.0.1/test/pacman/tests/ldconfig003.py
--- pacman-5.0.1-orig/test/pacman/tests/ldconfig003.py 2013-04-30 15:05:45.000000000 +0400
+++ pacman-5.0.1/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.0.1-orig/test/pacman/tests/TESTS pacman-5.0.1/test/pacman/tests/TESTS
--- pacman-5.0.1-orig/test/pacman/tests/TESTS 2016-02-23 05:51:26.000000000 +0300
+++ pacman-5.0.1/test/pacman/tests/TESTS 2016-07-15 09:42:19.906037400 +0300
@@ -72,9 +72,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