From 6ba11111889a39a5b34ea7f9ed597ca60ea5b2441a19becfacd6723106f43768 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20Schr=C3=B6der?= Date: Wed, 14 Feb 2018 09:41:06 +0000 Subject: [PATCH 1/9] Accepting request 574311 from home:michals - Use ksym-provides tool (bsc#1077692). OBS-URL: https://build.opensuse.org/request/show/574311 OBS-URL: https://build.opensuse.org/package/show/Base:System/rpm?expand=0&rev=438 --- find-provides.ksyms | 81 ++++++++++++++++++++++++++++++++++++++ find-requires.ksyms | 29 ++++++++++++++ findksyms.diff | 95 --------------------------------------------- rpm.changes | 5 +++ rpm.spec | 6 ++- 5 files changed, 120 insertions(+), 96 deletions(-) create mode 100644 find-provides.ksyms create mode 100644 find-requires.ksyms diff --git a/find-provides.ksyms b/find-provides.ksyms new file mode 100644 index 0000000..5de8984 --- /dev/null +++ b/find-provides.ksyms @@ -0,0 +1,81 @@ +#! /bin/bash + +IFS=$'\n' + +is_opensuse=false + +if test "$1" = "--opensuse"; then + if test "$2" -gt 0; then + is_opensuse=true + fi + shift 2 +fi + +if ! $is_opensuse; then + trap 'rm -f "$tmp"' EXIT + tmp=$(mktemp) +fi + + +while read f; do + test -e "$f" || continue + is_module="" + case "$f" in + *.debug) + continue + ;; + */boot/vmlinu[xz]-*) + flavor=${f##*/vmlinu[xz]-} + flavor=${flavor%.gz} + echo "kernel-uname-r = $flavor" + version=${flavor} + flavor=${flavor##*-} + ;; + */lib/modules/*/*.ko | */lib/modules/*/*.ko.gz | */boot/vmlinu[xz]*) + is_module="1" + ;; + *) + continue + esac + if $is_opensuse; then + continue + fi + unzip=false + case "$f" in + *.gz | */boot/vmlinuz*) + unzip=true + esac + if $unzip && gzip -cd "$f" >"$tmp"; then + f=$tmp + fi + if test -z "$flavor" -a -n "$is_module" ; then + flavor=$(/sbin/modinfo -F vermagic "$f") + flavor=${flavor%% *} + version=${flavor} + flavor=${flavor##*-} + fi + if test -z "$flavor"; then + echo "warning: cannot determine kernel flavor from $(/sbin/modinfo -F vermagic "$f" 2>&1)" >&2 + continue + fi + objdir=$(readlink /lib/modules/$version/build) + objdir_build=$RPM_BUILD_ROOT$(readlink $RPM_BUILD_ROOT/lib/modules/$version/build) + for i in $objdir_build $objdir ; do + ksym_provides=$i/scripts/mod/ksym-provides + [ -x $ksym_provides ] && break + done + if [ -x $ksym_provides ] ; then + $ksym_provides $flavor $f + else + major=${version%%.*} + sub=${version#*.} + sub=${sub%%.*} + if [ "$major" -ge 4 -a "$sub" -ge 10 ] ; then + echo "error: cannot determine ksym provides of $f - missing ksym-povides tool." >&2 + else + nm "$f" \ + | sed -r -ne "s/^0*([0-9a-f]+) A __crc_(.+)/ksym($flavor:\\2) = \\1/p" + fi + fi +done \ +| sort -u diff --git a/find-requires.ksyms b/find-requires.ksyms new file mode 100644 index 0000000..ebb87be --- /dev/null +++ b/find-requires.ksyms @@ -0,0 +1,29 @@ +#! /bin/bash + +IFS=$'\n' + +is_opensuse=false + +if test "$1" = "--opensuse"; then + if test "$2" -gt 0; then + is_opensuse=true + fi + shift 2 +fi + +if ! $is_opensuse && ! test -e /sbin/modprobe; then + cat > /dev/null + exit 0 +fi + +for f in $(grep -E '/lib/modules/.+\.ko$' | grep -v '/lib/modules/[^/]*/kernel/'); do + flavor=${f#*/lib/modules/} + flavor=${flavor%%/*} + if $is_opensuse; then + echo "kernel-uname-r = $flavor" + continue + fi + flavor=${flavor##*-} + /sbin/modprobe --dump-modversions "$f" \ + | sed -r -ne "s/^0x0*([0-9a-f]+)[[:blank:]]+(.+)/ksym($flavor:\\2) = \\1/p" +done | sort -u diff --git a/findksyms.diff b/findksyms.diff index 891a35f..3f9ce7f 100644 --- a/findksyms.diff +++ b/findksyms.diff @@ -16,98 +16,3 @@ metainfo.prov \ mono-find-requires mono-find-provides \ pkgconfigdeps.sh libtooldeps.sh \ ---- ./scripts/find-provides.ksyms.orig 2018-01-31 13:08:40.820934977 +0000 -+++ ./scripts/find-provides.ksyms 2018-01-31 13:08:40.820934977 +0000 -@@ -0,0 +1,60 @@ -+#! /bin/bash -+ -+IFS=$'\n' -+ -+is_opensuse=false -+ -+if test "$1" = "--opensuse"; then -+ if test "$2" -gt 0; then -+ is_opensuse=true -+ fi -+ shift 2 -+fi -+ -+if ! $is_opensuse; then -+ trap 'rm -f "$tmp"' EXIT -+ tmp=$(mktemp) -+fi -+ -+ -+while read f; do -+ test -e "$f" || continue -+ case "$f" in -+ *.debug) -+ continue -+ ;; -+ */boot/vmlinu[xz]-*) -+ flavor=${f##*/vmlinu[xz]-} -+ flavor=${flavor%.gz} -+ echo "kernel-uname-r = $flavor" -+ flavor=${flavor##*-} -+ ;; -+ */lib/modules/*/*.ko | */lib/modules/*/*.ko.gz | */boot/vmlinu[xz]*) -+ ;; -+ *) -+ continue -+ esac -+ if $is_opensuse; then -+ continue -+ fi -+ unzip=false -+ case "$f" in -+ *.gz | */boot/vmlinuz*) -+ unzip=true -+ esac -+ if $unzip && gzip -cd "$f" >"$tmp"; then -+ f=$tmp -+ fi -+ if test -z "$flavor"; then -+ flavor=$(/sbin/modinfo -F vermagic "$f") -+ flavor=${flavor%% *} -+ flavor=${flavor##*-} -+ fi -+ if test -z "$flavor"; then -+ echo "warning: cannot determine kernel flavor from $(/sbin/modinfo -F vermagic "$f" 2>&1)" >&2 -+ continue -+ fi -+ nm "$f" \ -+ | sed -r -ne "s/^0*([0-9a-f]+) A __crc_(.+)/ksym($flavor:\\2) = \\1/p" -+done \ -+| sort -u ---- ./scripts/find-requires.ksyms.orig 2018-01-31 13:08:40.821934974 +0000 -+++ ./scripts/find-requires.ksyms 2018-01-31 13:08:40.820934977 +0000 -@@ -0,0 +1,29 @@ -+#! /bin/bash -+ -+IFS=$'\n' -+ -+is_opensuse=false -+ -+if test "$1" = "--opensuse"; then -+ if test "$2" -gt 0; then -+ is_opensuse=true -+ fi -+ shift 2 -+fi -+ -+if ! $is_opensuse && ! test -e /sbin/modprobe; then -+ cat > /dev/null -+ exit 0 -+fi -+ -+for f in $(grep -E '/lib/modules/.+\.ko$' | grep -v '/lib/modules/[^/]*/kernel/'); do -+ flavor=${f#*/lib/modules/} -+ flavor=${flavor%%/*} -+ if $is_opensuse; then -+ echo "kernel-uname-r = $flavor" -+ continue -+ fi -+ flavor=${flavor##*-} -+ /sbin/modprobe --dump-modversions "$f" \ -+ | sed -r -ne "s/^0x0*([0-9a-f]+)[[:blank:]]+(.+)/ksym($flavor:\\2) = \\1/p" -+done | sort -u diff --git a/rpm.changes b/rpm.changes index e3b532b..750d653 100644 --- a/rpm.changes +++ b/rpm.changes @@ -1,3 +1,8 @@ +------------------------------------------------------------------- +Wed Feb 7 17:23:48 UTC 2018 - msuchanek@suse.com + +- Use ksym-provides tool (bsc#1077692). + ------------------------------------------------------------------- Wed Feb 7 09:13:41 UTC 2018 - dimstar@opensuse.org diff --git a/rpm.spec b/rpm.spec index d5b86e9..1d0796f 100644 --- a/rpm.spec +++ b/rpm.spec @@ -63,6 +63,8 @@ Source10: beecrypt-4.1.2.tar.bz2 Source11: db-4.8.30.tar.bz2 Source12: baselibs.conf Source13: rpmconfigcheck.service +Source14: find-provides.ksyms +Source15: find-requires.ksyms Patch1: beecrypt-4.1.2.diff Patch2: db.diff Patch3: rpm-4.12.0.1-fix-bashisms.patch @@ -232,10 +234,12 @@ rm -f rpmdb/db.h %patch6464 %endif +cp %{SOURCE14} %{SOURCE15} scripts + cp config.guess config.sub db/dist/ cp config.guess config.sub beecrypt/ #chmod 755 scripts/find-supplements{,.ksyms} -#chmod 755 scripts/find-provides.ksyms scripts/find-requires.ksyms +chmod 755 scripts/find-provides.ksyms scripts/find-requires.ksyms #chmod 755 scripts/firmware.prov #chmod 755 scripts/debuginfo.prov tar -xjvf %{SOURCE1} From 87becdafd641002f760e9671aa16cb1d1fd56fd6cd50526f8e8e30ecd2f2cb68 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20Schr=C3=B6der?= Date: Wed, 14 Feb 2018 09:47:53 +0000 Subject: [PATCH 2/9] - change disk usage handling to take hardlinks into account [bnc#720150] OBS-URL: https://build.opensuse.org/package/show/Base:System/rpm?expand=0&rev=439 --- find-provides.ksyms | 81 ------------------------------ find-requires.ksyms | 29 ----------- findksyms.diff | 120 +++++++++++++++++++++++++++++++++++++++++++- hardlinks.diff | 60 ++++++++++++++++++++++ rpm.changes | 6 +++ rpm.spec | 9 ++-- 6 files changed, 187 insertions(+), 118 deletions(-) delete mode 100644 find-provides.ksyms delete mode 100644 find-requires.ksyms create mode 100644 hardlinks.diff diff --git a/find-provides.ksyms b/find-provides.ksyms deleted file mode 100644 index 5de8984..0000000 --- a/find-provides.ksyms +++ /dev/null @@ -1,81 +0,0 @@ -#! /bin/bash - -IFS=$'\n' - -is_opensuse=false - -if test "$1" = "--opensuse"; then - if test "$2" -gt 0; then - is_opensuse=true - fi - shift 2 -fi - -if ! $is_opensuse; then - trap 'rm -f "$tmp"' EXIT - tmp=$(mktemp) -fi - - -while read f; do - test -e "$f" || continue - is_module="" - case "$f" in - *.debug) - continue - ;; - */boot/vmlinu[xz]-*) - flavor=${f##*/vmlinu[xz]-} - flavor=${flavor%.gz} - echo "kernel-uname-r = $flavor" - version=${flavor} - flavor=${flavor##*-} - ;; - */lib/modules/*/*.ko | */lib/modules/*/*.ko.gz | */boot/vmlinu[xz]*) - is_module="1" - ;; - *) - continue - esac - if $is_opensuse; then - continue - fi - unzip=false - case "$f" in - *.gz | */boot/vmlinuz*) - unzip=true - esac - if $unzip && gzip -cd "$f" >"$tmp"; then - f=$tmp - fi - if test -z "$flavor" -a -n "$is_module" ; then - flavor=$(/sbin/modinfo -F vermagic "$f") - flavor=${flavor%% *} - version=${flavor} - flavor=${flavor##*-} - fi - if test -z "$flavor"; then - echo "warning: cannot determine kernel flavor from $(/sbin/modinfo -F vermagic "$f" 2>&1)" >&2 - continue - fi - objdir=$(readlink /lib/modules/$version/build) - objdir_build=$RPM_BUILD_ROOT$(readlink $RPM_BUILD_ROOT/lib/modules/$version/build) - for i in $objdir_build $objdir ; do - ksym_provides=$i/scripts/mod/ksym-provides - [ -x $ksym_provides ] && break - done - if [ -x $ksym_provides ] ; then - $ksym_provides $flavor $f - else - major=${version%%.*} - sub=${version#*.} - sub=${sub%%.*} - if [ "$major" -ge 4 -a "$sub" -ge 10 ] ; then - echo "error: cannot determine ksym provides of $f - missing ksym-povides tool." >&2 - else - nm "$f" \ - | sed -r -ne "s/^0*([0-9a-f]+) A __crc_(.+)/ksym($flavor:\\2) = \\1/p" - fi - fi -done \ -| sort -u diff --git a/find-requires.ksyms b/find-requires.ksyms deleted file mode 100644 index ebb87be..0000000 --- a/find-requires.ksyms +++ /dev/null @@ -1,29 +0,0 @@ -#! /bin/bash - -IFS=$'\n' - -is_opensuse=false - -if test "$1" = "--opensuse"; then - if test "$2" -gt 0; then - is_opensuse=true - fi - shift 2 -fi - -if ! $is_opensuse && ! test -e /sbin/modprobe; then - cat > /dev/null - exit 0 -fi - -for f in $(grep -E '/lib/modules/.+\.ko$' | grep -v '/lib/modules/[^/]*/kernel/'); do - flavor=${f#*/lib/modules/} - flavor=${flavor%%/*} - if $is_opensuse; then - echo "kernel-uname-r = $flavor" - continue - fi - flavor=${flavor##*-} - /sbin/modprobe --dump-modversions "$f" \ - | sed -r -ne "s/^0x0*([0-9a-f]+)[[:blank:]]+(.+)/ksym($flavor:\\2) = \\1/p" -done | sort -u diff --git a/findksyms.diff b/findksyms.diff index 3f9ce7f..2472f7d 100644 --- a/findksyms.diff +++ b/findksyms.diff @@ -1,5 +1,5 @@ ---- ./scripts/Makefile.am.orig 2018-01-31 13:08:32.644956731 +0000 -+++ ./scripts/Makefile.am 2018-01-31 13:09:24.081819852 +0000 +--- ./scripts/Makefile.am.orig 2018-02-14 09:42:12.958726157 +0000 ++++ ./scripts/Makefile.am 2018-02-14 09:43:26.605515718 +0000 @@ -19,6 +19,7 @@ EXTRA_DIST = \ tgpg vpkg-provides.sh \ find-requires find-provides \ @@ -16,3 +16,119 @@ metainfo.prov \ mono-find-requires mono-find-provides \ pkgconfigdeps.sh libtooldeps.sh \ +--- ./scripts/find-provides.ksyms.orig 2018-02-14 09:42:54.757606752 +0000 ++++ ./scripts/find-provides.ksyms 2018-02-14 09:42:39.165651303 +0000 +@@ -0,0 +1,81 @@ ++#! /bin/bash ++ ++IFS=$'\n' ++ ++is_opensuse=false ++ ++if test "$1" = "--opensuse"; then ++ if test "$2" -gt 0; then ++ is_opensuse=true ++ fi ++ shift 2 ++fi ++ ++if ! $is_opensuse; then ++ trap 'rm -f "$tmp"' EXIT ++ tmp=$(mktemp) ++fi ++ ++ ++while read f; do ++ test -e "$f" || continue ++ is_module="" ++ case "$f" in ++ *.debug) ++ continue ++ ;; ++ */boot/vmlinu[xz]-*) ++ flavor=${f##*/vmlinu[xz]-} ++ flavor=${flavor%.gz} ++ echo "kernel-uname-r = $flavor" ++ version=${flavor} ++ flavor=${flavor##*-} ++ ;; ++ */lib/modules/*/*.ko | */lib/modules/*/*.ko.gz | */boot/vmlinu[xz]*) ++ is_module="1" ++ ;; ++ *) ++ continue ++ esac ++ if $is_opensuse; then ++ continue ++ fi ++ unzip=false ++ case "$f" in ++ *.gz | */boot/vmlinuz*) ++ unzip=true ++ esac ++ if $unzip && gzip -cd "$f" >"$tmp"; then ++ f=$tmp ++ fi ++ if test -z "$flavor" -a -n "$is_module" ; then ++ flavor=$(/sbin/modinfo -F vermagic "$f") ++ flavor=${flavor%% *} ++ version=${flavor} ++ flavor=${flavor##*-} ++ fi ++ if test -z "$flavor"; then ++ echo "warning: cannot determine kernel flavor from $(/sbin/modinfo -F vermagic "$f" 2>&1)" >&2 ++ continue ++ fi ++ objdir=$(readlink /lib/modules/$version/build) ++ objdir_build=$RPM_BUILD_ROOT$(readlink $RPM_BUILD_ROOT/lib/modules/$version/build) ++ for i in $objdir_build $objdir ; do ++ ksym_provides=$i/scripts/mod/ksym-provides ++ [ -x $ksym_provides ] && break ++ done ++ if [ -x $ksym_provides ] ; then ++ $ksym_provides $flavor $f ++ else ++ major=${version%%.*} ++ sub=${version#*.} ++ sub=${sub%%.*} ++ if [ "$major" -ge 4 -a "$sub" -ge 10 ] ; then ++ echo "error: cannot determine ksym provides of $f - missing ksym-povides tool." >&2 ++ else ++ nm "$f" \ ++ | sed -r -ne "s/^0*([0-9a-f]+) A __crc_(.+)/ksym($flavor:\\2) = \\1/p" ++ fi ++ fi ++done \ ++| sort -u +--- ./scripts/find-requires.ksyms.orig 2018-02-14 09:43:00.437590470 +0000 ++++ ./scripts/find-requires.ksyms 2018-02-14 09:42:45.621632854 +0000 +@@ -0,0 +1,29 @@ ++#! /bin/bash ++ ++IFS=$'\n' ++ ++is_opensuse=false ++ ++if test "$1" = "--opensuse"; then ++ if test "$2" -gt 0; then ++ is_opensuse=true ++ fi ++ shift 2 ++fi ++ ++if ! $is_opensuse && ! test -e /sbin/modprobe; then ++ cat > /dev/null ++ exit 0 ++fi ++ ++for f in $(grep -E '/lib/modules/.+\.ko$' | grep -v '/lib/modules/[^/]*/kernel/'); do ++ flavor=${f#*/lib/modules/} ++ flavor=${flavor%%/*} ++ if $is_opensuse; then ++ echo "kernel-uname-r = $flavor" ++ continue ++ fi ++ flavor=${flavor##*-} ++ /sbin/modprobe --dump-modversions "$f" \ ++ | sed -r -ne "s/^0x0*([0-9a-f]+)[[:blank:]]+(.+)/ksym($flavor:\\2) = \\1/p" ++done | sort -u diff --git a/hardlinks.diff b/hardlinks.diff new file mode 100644 index 0000000..2013116 --- /dev/null +++ b/hardlinks.diff @@ -0,0 +1,60 @@ +--- lib/rpmfiles.h.orig ++++ lib/rpmfiles.h +@@ -156,7 +156,7 @@ typedef rpmFlags rpmfiFlags; + + #define RPMFI_FLAGS_ERASE \ + (RPMFI_NOFILECLASS | RPMFI_NOFILELANGS | \ +- RPMFI_NOFILEMTIMES | RPMFI_NOFILERDEVS | RPMFI_NOFILEINODES | \ ++ RPMFI_NOFILEMTIMES | RPMFI_NOFILERDEVS | \ + RPMFI_NOFILEVERIFYFLAGS) + + #define RPMFI_FLAGS_INSTALL \ +--- lib/transaction.c.orig ++++ lib/transaction.c +@@ -412,6 +412,8 @@ static void handleInstInstalledFile(const rpmts ts, rpmte p, rpmfiles fi, int fx + { + rpmfs fs = rpmteGetFileStates(p); + int isCfgFile = ((rpmfilesFFlags(otherFi, ofx) | rpmfilesFFlags(fi, fx)) & RPMFILE_CONFIG); ++ int nlink; ++ const int *links; + + if (XFA_SKIPPING(rpmfsGetAction(fs, fx))) + return; +@@ -481,7 +483,10 @@ static void handleInstInstalledFile(const rpmts ts, rpmte p, rpmfiles fi, int fx + } + } + +- rpmfilesSetFReplacedSize(fi, fx, rpmfilesFSize(otherFi, ofx)); ++ /* Only account for the last file of a hardlink set */ ++ nlink = rpmfilesFLinks(otherFi, ofx, &links); ++ if (nlink <= 1 || links[nlink - 1] == ofx) ++ rpmfilesSetFReplacedSize(fi, fx, rpmfilesFSize(otherFi, ofx)); + } + + /** +@@ -491,6 +496,7 @@ static void handleInstInstalledFile(const rpmts ts, rpmte p, rpmfiles fi, int fx + static void handleOverlappedFiles(rpmts ts, fingerPrintCache fpc, rpmte p, rpmfiles fi) + { + rpm_loff_t fixupSize = 0; ++ rpm_loff_t fileSize = 0; + int i, j; + rpmfs fs = rpmteGetFileStates(p); + rpmfs otherFs; +@@ -675,9 +681,16 @@ assert(otherFi != NULL); + } + rpmfilesFree(otherFi); + ++ fileSize = rpmfilesFSize(fi, i); ++ nlink = rpmfilesFLinks(fi, i, &links); ++ if (nlink > 1 && links[nlink - 1] != i) { ++ /* Only account for the last file of a hardlink set */ ++ fileSize = 0; ++ fixupSize = 0; ++ } + /* Update disk space info for a file. */ + rpmtsUpdateDSI(ts, fpEntryDev(fpc, fiFps), fpEntryDir(fpc, fiFps), +- rpmfilesFSize(fi, i), rpmfilesFReplacedSize(fi, i), ++ fileSize, rpmfilesFReplacedSize(fi, i), + fixupSize, rpmfsGetAction(fs, i)); + + } diff --git a/rpm.changes b/rpm.changes index 750d653..83618db 100644 --- a/rpm.changes +++ b/rpm.changes @@ -1,3 +1,9 @@ +------------------------------------------------------------------- +Wed Feb 14 10:45:25 CET 2018 - mls@suse.de + +- change disk usage handling to take hardlinks into account + [bnc#720150] + ------------------------------------------------------------------- Wed Feb 7 17:23:48 UTC 2018 - msuchanek@suse.com diff --git a/rpm.spec b/rpm.spec index 1d0796f..b074fba 100644 --- a/rpm.spec +++ b/rpm.spec @@ -63,8 +63,6 @@ Source10: beecrypt-4.1.2.tar.bz2 Source11: db-4.8.30.tar.bz2 Source12: baselibs.conf Source13: rpmconfigcheck.service -Source14: find-provides.ksyms -Source15: find-requires.ksyms Patch1: beecrypt-4.1.2.diff Patch2: db.diff Patch3: rpm-4.12.0.1-fix-bashisms.patch @@ -132,6 +130,7 @@ Patch103: find-lang-qt-qm.patch Patch108: debugedit-macro.diff Patch109: pythondistdeps.diff Patch111: debugedit-bnc1076819.diff +Patch112: hardlinks.diff Patch6464: auto-config-update-aarch64-ppc64le.diff BuildRoot: %{_tmppath}/%{name}-%{version}-build # @@ -228,18 +227,16 @@ rm -f rpmdb/db.h %patch -P 85 %patch -P 93 -P 94 -P 99 %patch -P 100 -P 102 -P 103 -P 108 -%patch -P 109 -P 111 +%patch -P 109 -P 111 -P 112 %ifarch aarch64 ppc64le %patch6464 %endif -cp %{SOURCE14} %{SOURCE15} scripts - cp config.guess config.sub db/dist/ cp config.guess config.sub beecrypt/ #chmod 755 scripts/find-supplements{,.ksyms} -chmod 755 scripts/find-provides.ksyms scripts/find-requires.ksyms +#chmod 755 scripts/find-provides.ksyms scripts/find-requires.ksyms #chmod 755 scripts/firmware.prov #chmod 755 scripts/debuginfo.prov tar -xjvf %{SOURCE1} From 766d882a560f8b6152e90b9b379d519dd031742cb1541d0c64092c11cc77c8f3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20Schr=C3=B6der?= Date: Wed, 14 Feb 2018 10:55:30 +0000 Subject: [PATCH 3/9] ... OBS-URL: https://build.opensuse.org/package/show/Base:System/rpm?expand=0&rev=440 --- hardlinks.diff | 44 +++++++++++++++++++++++++++++++++++++------- 1 file changed, 37 insertions(+), 7 deletions(-) diff --git a/hardlinks.diff b/hardlinks.diff index 2013116..2a33a8e 100644 --- a/hardlinks.diff +++ b/hardlinks.diff @@ -11,28 +11,48 @@ #define RPMFI_FLAGS_INSTALL \ --- lib/transaction.c.orig +++ lib/transaction.c -@@ -412,6 +412,8 @@ static void handleInstInstalledFile(const rpmts ts, rpmte p, rpmfiles fi, int fx +@@ -231,11 +231,11 @@ static void rpmtsUpdateDSI(const rpmts ts, dev_t dev, const char *dirName, + dsi->bneeded += bneeded; + dsi->ineeded++; + if (prevSize) { +- dsi->bdelta += BLOCK_ROUND(prevSize, dsi->bsize); ++ dsi->bdelta += BLOCK_ROUND(prevSize - 1, dsi->bsize); + dsi->idelta++; + } + if (fixupSize) { +- dsi->bdelta += BLOCK_ROUND(fixupSize, dsi->bsize); ++ dsi->bdelta += BLOCK_ROUND(fixupSize - 1, dsi->bsize); + dsi->idelta++; + } + +@@ -412,6 +412,9 @@ static void handleInstInstalledFile(const rpmts ts, rpmte p, rpmfiles fi, int fx { rpmfs fs = rpmteGetFileStates(p); int isCfgFile = ((rpmfilesFFlags(otherFi, ofx) | rpmfilesFFlags(fi, fx)) & RPMFILE_CONFIG); ++ rpm_loff_t otherFileSize + int nlink; + const int *links; if (XFA_SKIPPING(rpmfsGetAction(fs, fx))) return; -@@ -481,7 +483,10 @@ static void handleInstInstalledFile(const rpmts ts, rpmte p, rpmfiles fi, int fx +@@ -481,7 +484,15 @@ static void handleInstInstalledFile(const rpmts ts, rpmte p, rpmfiles fi, int fx } } - rpmfilesSetFReplacedSize(fi, fx, rpmfilesFSize(otherFi, ofx)); ++ otherFileSize = rpmfilesFSize(otherFi, ofx); ++ + /* Only account for the last file of a hardlink set */ + nlink = rpmfilesFLinks(otherFi, ofx, &links); -+ if (nlink <= 1 || links[nlink - 1] == ofx) -+ rpmfilesSetFReplacedSize(fi, fx, rpmfilesFSize(otherFi, ofx)); ++ if (nlink > 1 && links[nlink - 1] != ofx) ++ otherFileSize = 0; ++ ++ /* Add one to make sure the size is not zero */ ++ rpmfilesSetFReplacedSize(fi, fx, otherFileSize + 1); } /** -@@ -491,6 +496,7 @@ static void handleInstInstalledFile(const rpmts ts, rpmte p, rpmfiles fi, int fx +@@ -491,6 +502,7 @@ static void handleInstInstalledFile(const rpmts ts, rpmte p, rpmfiles fi, int fx static void handleOverlappedFiles(rpmts ts, fingerPrintCache fpc, rpmte p, rpmfiles fi) { rpm_loff_t fixupSize = 0; @@ -40,7 +60,17 @@ int i, j; rpmfs fs = rpmteGetFileStates(p); rpmfs otherFs; -@@ -675,9 +681,16 @@ assert(otherFi != NULL); +@@ -628,7 +640,8 @@ assert(otherFi != NULL); + break; + + /* Try to get the disk accounting correct even if a conflict. */ +- fixupSize = rpmfilesFSize(otherFi, otherFileNum); ++ /* Add one to make sure the size is not zero */ ++ fixupSize = rpmfilesFSize(otherFi, otherFileNum) + 1; + + if (rpmfilesConfigConflict(fi, i)) { + /* Here is an overlapped pre-existing config file. */ +@@ -675,9 +688,16 @@ assert(otherFi != NULL); } rpmfilesFree(otherFi); @@ -49,7 +79,7 @@ + if (nlink > 1 && links[nlink - 1] != i) { + /* Only account for the last file of a hardlink set */ + fileSize = 0; -+ fixupSize = 0; ++ fixupSize = fixupSize ? 1 : 0; + } /* Update disk space info for a file. */ rpmtsUpdateDSI(ts, fpEntryDev(fpc, fiFps), fpEntryDir(fpc, fiFps), From cd3cd0fd3b49f123292b4a40a24e00005da8596fabb31f9ec17ef8b1b28710d6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20Schr=C3=B6der?= Date: Wed, 14 Feb 2018 11:58:15 +0000 Subject: [PATCH 4/9] ... OBS-URL: https://build.opensuse.org/package/show/Base:System/rpm?expand=0&rev=441 --- hardlinks.diff | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hardlinks.diff b/hardlinks.diff index 2a33a8e..f69a1d0 100644 --- a/hardlinks.diff +++ b/hardlinks.diff @@ -29,7 +29,7 @@ { rpmfs fs = rpmteGetFileStates(p); int isCfgFile = ((rpmfilesFFlags(otherFi, ofx) | rpmfilesFFlags(fi, fx)) & RPMFILE_CONFIG); -+ rpm_loff_t otherFileSize ++ rpm_loff_t otherFileSize; + int nlink; + const int *links; From e4f80724ecef30e4e0d28d71a45e93831b6b2d92fe4d2010e4697c6ec7e82ccc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20Schr=C3=B6der?= Date: Wed, 14 Feb 2018 12:11:32 +0000 Subject: [PATCH 5/9] update OBS-URL: https://build.opensuse.org/package/show/Base:System/rpm?expand=0&rev=442 --- hardlinks.diff | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/hardlinks.diff b/hardlinks.diff index f69a1d0..dba3a6b 100644 --- a/hardlinks.diff +++ b/hardlinks.diff @@ -52,15 +52,17 @@ } /** -@@ -491,6 +502,7 @@ static void handleInstInstalledFile(const rpmts ts, rpmte p, rpmfiles fi, int fx - static void handleOverlappedFiles(rpmts ts, fingerPrintCache fpc, rpmte p, rpmfiles fi) - { - rpm_loff_t fixupSize = 0; -+ rpm_loff_t fileSize = 0; - int i, j; - rpmfs fs = rpmteGetFileStates(p); - rpmfs otherFs; -@@ -628,7 +640,8 @@ assert(otherFi != NULL); +@@ -506,6 +517,9 @@ static void handleOverlappedFiles(rpmts ts, fingerPrintCache fpc, rpmte p, rpmfi + rpmfileAttrs FFlags; + struct rpmffi_s * recs; + int numRecs; ++ rpm_loff_t fileSize; ++ int nlink; ++ const int *links; + + if (XFA_SKIPPING(rpmfsGetAction(fs, i))) + continue; +@@ -628,7 +642,8 @@ assert(otherFi != NULL); break; /* Try to get the disk accounting correct even if a conflict. */ @@ -70,7 +72,7 @@ if (rpmfilesConfigConflict(fi, i)) { /* Here is an overlapped pre-existing config file. */ -@@ -675,9 +688,16 @@ assert(otherFi != NULL); +@@ -675,9 +690,16 @@ assert(otherFi != NULL); } rpmfilesFree(otherFi); From 63d6cf985518636cdb3f7ceaa5e15a65703f942689f81bb25f931463d03be2db Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20Schr=C3=B6der?= Date: Thu, 15 Feb 2018 09:52:17 +0000 Subject: [PATCH 6/9] change OBS-URL: https://build.opensuse.org/package/show/Base:System/rpm?expand=0&rev=443 --- rpm.changes | 1 + 1 file changed, 1 insertion(+) diff --git a/rpm.changes b/rpm.changes index 83618db..ecda162 100644 --- a/rpm.changes +++ b/rpm.changes @@ -3,6 +3,7 @@ Wed Feb 14 10:45:25 CET 2018 - mls@suse.de - change disk usage handling to take hardlinks into account [bnc#720150] + new patch: hardlinks.diff ------------------------------------------------------------------- Wed Feb 7 17:23:48 UTC 2018 - msuchanek@suse.com From 69e0ecaa4ff488dd906ac7bee652624bd4758ce541115bfbb4b10838bf5135c0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20Schr=C3=B6der?= Date: Thu, 15 Feb 2018 12:14:27 +0000 Subject: [PATCH 7/9] Accepting request 576971 from home:Andreas_Schwab:Factory - auto-config-update-aarch64-ppc64le.diff: Update for riscv64 and enable it there OBS-URL: https://build.opensuse.org/request/show/576971 OBS-URL: https://build.opensuse.org/package/show/Base:System/rpm?expand=0&rev=444 --- auto-config-update-aarch64-ppc64le.diff | 3 ++- python-rpm.spec | 2 +- rpm.changes | 6 ++++++ rpm.spec | 6 +++--- 4 files changed, 12 insertions(+), 5 deletions(-) diff --git a/auto-config-update-aarch64-ppc64le.diff b/auto-config-update-aarch64-ppc64le.diff index ee68fc3..f7ab7f5 100644 --- a/auto-config-update-aarch64-ppc64le.diff +++ b/auto-config-update-aarch64-ppc64le.diff @@ -2,7 +2,7 @@ Index: build/parseBuildInstallClean.c =================================================================== --- build/parseBuildInstallClean.c.orig +++ build/parseBuildInstallClean.c -@@ -46,7 +46,22 @@ int parseBuildInstallClean(rpmSpec spec, +@@ -46,7 +46,23 @@ int parseBuildInstallClean(rpmSpec spec, } else if (rc < 0) { goto exit; } @@ -16,6 +16,7 @@ Index: build/parseBuildInstallClean.c + " grep -q config-patches@ $c || continue\n" + " grep -q aarch64 $c || install -m 755 $ref/config.$s $c\n" + " grep -q ppc64le $c || install -m 755 $ref/config.$s $c\n" ++ " grep -q 'riscv64[-:]' $c || install -m 755 $ref/config.$s $c\n" + " done\n" + "done\n" + ); diff --git a/python-rpm.spec b/python-rpm.spec index 2915945..d361560 100644 --- a/python-rpm.spec +++ b/python-rpm.spec @@ -22,7 +22,7 @@ Version: 4.14.1 Release: 0 #!BuildIgnore: rpmlint-Factory Summary: Python Bindings for Manipulating RPM Packages -License: GPL-2.0+ +License: GPL-2.0-or-later Group: Development/Libraries/Python Source99: rpm.spec BuildRequires: file-devel diff --git a/rpm.changes b/rpm.changes index ecda162..6bb725f 100644 --- a/rpm.changes +++ b/rpm.changes @@ -1,3 +1,9 @@ +------------------------------------------------------------------- +Thu Feb 15 11:11:21 UTC 2018 - schwab@suse.de + +- auto-config-update-aarch64-ppc64le.diff: Update for riscv64 and enable + it there + ------------------------------------------------------------------- Wed Feb 14 10:45:25 CET 2018 - mls@suse.de diff --git a/rpm.spec b/rpm.spec index b074fba..ad940ea 100644 --- a/rpm.spec +++ b/rpm.spec @@ -49,7 +49,7 @@ BuildRequires: zlib-devel Provides: rpminst Requires(post): %fillup_prereq Summary: The RPM Package Manager -License: GPL-2.0+ +License: GPL-2.0-or-later Group: System/Packages Version: 4.14.1 Release: 0 @@ -229,7 +229,7 @@ rm -f rpmdb/db.h %patch -P 100 -P 102 -P 103 -P 108 %patch -P 109 -P 111 -P 112 -%ifarch aarch64 ppc64le +%ifarch aarch64 ppc64le riscv64 %patch6464 %endif @@ -352,7 +352,7 @@ for i in /usr/share/automake-*/*; do fi done popd -%ifarch aarch64 ppc64le +%ifarch aarch64 ppc64le riscv64 install -m 755 config.guess %{buildroot}/usr/lib/rpm install -m 755 config.sub %{buildroot}/usr/lib/rpm %endif From 81a8eb752e44641595ed91fd199274f17365ea66e19e29c89e15a11495aa5a5e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20Schr=C3=B6der?= Date: Thu, 15 Feb 2018 12:15:18 +0000 Subject: [PATCH 8/9] Change license back OBS-URL: https://build.opensuse.org/package/show/Base:System/rpm?expand=0&rev=445 --- python-rpm.spec | 2 +- rpm.spec | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/python-rpm.spec b/python-rpm.spec index d361560..2915945 100644 --- a/python-rpm.spec +++ b/python-rpm.spec @@ -22,7 +22,7 @@ Version: 4.14.1 Release: 0 #!BuildIgnore: rpmlint-Factory Summary: Python Bindings for Manipulating RPM Packages -License: GPL-2.0-or-later +License: GPL-2.0+ Group: Development/Libraries/Python Source99: rpm.spec BuildRequires: file-devel diff --git a/rpm.spec b/rpm.spec index ad940ea..a3dbe5d 100644 --- a/rpm.spec +++ b/rpm.spec @@ -49,7 +49,7 @@ BuildRequires: zlib-devel Provides: rpminst Requires(post): %fillup_prereq Summary: The RPM Package Manager -License: GPL-2.0-or-later +License: GPL-2.0+ Group: System/Packages Version: 4.14.1 Release: 0 From e94a89bda175f6271d6d5cd5d581a0c43b4fcb02eb2a2ad10db033526dc8a582 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20Schr=C3=B6der?= Date: Thu, 22 Feb 2018 10:17:19 +0000 Subject: [PATCH 9/9] - split riscv64 part from auto-config-update-aarch64-ppc64le.diff OBS-URL: https://build.opensuse.org/package/show/Base:System/rpm?expand=0&rev=446 --- auto-config-update-aarch64-ppc64le.diff | 3 +-- auto-config-update-riscv64.diff | 10 ++++++++++ rpm.changes | 7 +++++++ rpm.spec | 4 ++++ 4 files changed, 22 insertions(+), 2 deletions(-) create mode 100644 auto-config-update-riscv64.diff diff --git a/auto-config-update-aarch64-ppc64le.diff b/auto-config-update-aarch64-ppc64le.diff index f7ab7f5..ee68fc3 100644 --- a/auto-config-update-aarch64-ppc64le.diff +++ b/auto-config-update-aarch64-ppc64le.diff @@ -2,7 +2,7 @@ Index: build/parseBuildInstallClean.c =================================================================== --- build/parseBuildInstallClean.c.orig +++ build/parseBuildInstallClean.c -@@ -46,7 +46,23 @@ int parseBuildInstallClean(rpmSpec spec, +@@ -46,7 +46,22 @@ int parseBuildInstallClean(rpmSpec spec, } else if (rc < 0) { goto exit; } @@ -16,7 +16,6 @@ Index: build/parseBuildInstallClean.c + " grep -q config-patches@ $c || continue\n" + " grep -q aarch64 $c || install -m 755 $ref/config.$s $c\n" + " grep -q ppc64le $c || install -m 755 $ref/config.$s $c\n" -+ " grep -q 'riscv64[-:]' $c || install -m 755 $ref/config.$s $c\n" + " done\n" + "done\n" + ); diff --git a/auto-config-update-riscv64.diff b/auto-config-update-riscv64.diff new file mode 100644 index 0000000..38f9940 --- /dev/null +++ b/auto-config-update-riscv64.diff @@ -0,0 +1,10 @@ +--- ./build/parseBuildInstallClean.c.orig 2018-02-22 10:11:50.088160024 +0000 ++++ ./build/parseBuildInstallClean.c 2018-02-22 10:11:37.592198130 +0000 +@@ -55,6 +55,7 @@ int parseBuildInstallClean(rpmSpec spec, + " grep -q config-patches@ $c || continue\n" + " grep -q aarch64 $c || install -m 755 $ref/config.$s $c\n" + " grep -q ppc64le $c || install -m 755 $ref/config.$s $c\n" ++ " grep -q 'riscv64[-:]' $c || install -m 755 $ref/config.$s $c\n" + " done\n" + "done\n" + ); diff --git a/rpm.changes b/rpm.changes index 6bb725f..d54aec8 100644 --- a/rpm.changes +++ b/rpm.changes @@ -1,3 +1,10 @@ +------------------------------------------------------------------- +Thu Feb 22 11:14:38 CET 2018 - mls@suse.de + +- split riscv64 part from auto-config-update-aarch64-ppc64le.diff + to make the change rust-proof. + new patch: auto-config-update-riscv64.diff + ------------------------------------------------------------------- Thu Feb 15 11:11:21 UTC 2018 - schwab@suse.de diff --git a/rpm.spec b/rpm.spec index a3dbe5d..eb4f96a 100644 --- a/rpm.spec +++ b/rpm.spec @@ -132,6 +132,7 @@ Patch109: pythondistdeps.diff Patch111: debugedit-bnc1076819.diff Patch112: hardlinks.diff Patch6464: auto-config-update-aarch64-ppc64le.diff +Patch6465: auto-config-update-riscv64.diff BuildRoot: %{_tmppath}/%{name}-%{version}-build # # avoid bootstrapping problem @@ -232,6 +233,9 @@ rm -f rpmdb/db.h %ifarch aarch64 ppc64le riscv64 %patch6464 %endif +%ifarch riscv64 +%patch6465 +%endif cp config.guess config.sub db/dist/ cp config.guess config.sub beecrypt/