Sync from SUSE:ALP:Source:Standard:1.0 rpm revision 0fba2a0dd71a42316083bcbdabf043ac

This commit is contained in:
Adrian Schröter 2023-08-16 16:48:39 +02:00
commit dd10ba1e79
59 changed files with 8702 additions and 0 deletions

23
.gitattributes vendored Normal file
View File

@ -0,0 +1,23 @@
## Default LFS
*.7z filter=lfs diff=lfs merge=lfs -text
*.bsp filter=lfs diff=lfs merge=lfs -text
*.bz2 filter=lfs diff=lfs merge=lfs -text
*.gem filter=lfs diff=lfs merge=lfs -text
*.gz filter=lfs diff=lfs merge=lfs -text
*.jar filter=lfs diff=lfs merge=lfs -text
*.lz filter=lfs diff=lfs merge=lfs -text
*.lzma filter=lfs diff=lfs merge=lfs -text
*.obscpio filter=lfs diff=lfs merge=lfs -text
*.oxt filter=lfs diff=lfs merge=lfs -text
*.pdf filter=lfs diff=lfs merge=lfs -text
*.png filter=lfs diff=lfs merge=lfs -text
*.rpm filter=lfs diff=lfs merge=lfs -text
*.tbz filter=lfs diff=lfs merge=lfs -text
*.tbz2 filter=lfs diff=lfs merge=lfs -text
*.tgz filter=lfs diff=lfs merge=lfs -text
*.ttf filter=lfs diff=lfs merge=lfs -text
*.txz filter=lfs diff=lfs merge=lfs -text
*.whl filter=lfs diff=lfs merge=lfs -text
*.xz filter=lfs diff=lfs merge=lfs -text
*.zip filter=lfs diff=lfs merge=lfs -text
*.zst filter=lfs diff=lfs merge=lfs -text

3
_multibuild Normal file
View File

@ -0,0 +1,3 @@
<multibuild>
<flavor>python-rpm</flavor>
</multibuild>

27
assumeexec.diff Normal file
View File

@ -0,0 +1,27 @@
--- tools/elfdeps.c.orig 2014-06-26 06:51:55.768815677 +0000
+++ tools/elfdeps.c 2014-08-04 13:02:16.981081591 +0000
@@ -17,6 +17,7 @@ int soname_only = 0;
int fake_soname = 1;
int filter_soname = 1;
int require_interp = 0;
+int assume_exec = 0;
typedef struct elfInfo_s {
Elf *elf;
@@ -299,7 +300,7 @@ static int processFile(const char *fn, i
if (ehdr->e_type == ET_DYN || ehdr->e_type == ET_EXEC) {
ei->marker = mkmarker(ehdr);
ei->isDSO = (ehdr->e_type == ET_DYN);
- ei->isExec = (st.st_mode & (S_IXUSR|S_IXGRP|S_IXOTH));
+ ei->isExec = assume_exec || (st.st_mode & (S_IXUSR|S_IXGRP|S_IXOTH));
processProgHeaders(ei, ehdr);
processSections(ei);
@@ -364,6 +365,7 @@ int main(int argc, char *argv[])
{ "no-fake-soname", 0, POPT_ARG_VAL, &fake_soname, 0, NULL, NULL },
{ "no-filter-soname", 0, POPT_ARG_VAL, &filter_soname, 0, NULL, NULL },
{ "require-interp", 0, POPT_ARG_VAL, &require_interp, -1, NULL, NULL },
+ { "assume-exec", 0, POPT_ARG_VAL, &assume_exec, -1, NULL, NULL },
POPT_AUTOHELP
POPT_TABLEEND
};

View File

@ -0,0 +1,36 @@
Index: build/parseSpec.c
===================================================================
--- build/parseSpec.c.orig
+++ build/parseSpec.c
@@ -942,7 +942,30 @@ static rpmSpec parseSpec(const char *spe
&(spec->buildrequires));
break;
case PART_BUILD:
- parsePart = parseSimpleScript(spec, "%build", &(spec->build));
+ if (spec->build) {
+ rpmlog(RPMLOG_ERR, _("line %d: second %s\n"), spec->lineNum, "%build");
+ parsePart = PART_ERROR;
+ break;
+ }
+ spec->build = newStringBuf();
+ appendLineStringBuf(spec->build,
+ "ref=/usr/lib/rpm\n"
+ "mints=0\n"
+ "case $(uname -m) in\n"
+ " aarch64) mints=20120610;;\n"
+ " ppc64le) mints=20130610;;\n"
+ " riscv64) mints=20160911;;\n"
+ "esac\n"
+ "for s in guess sub; do\n"
+ " for c in $(find -maxdepth 8 -name \"config.$s\"); do\n"
+ " grep -q config-patches@ $c || continue\n"
+ " timestamp=$(sed -n \"/^timestamp=/{s///;s/[-'\\\"]//g;p;q;}\" $c)\n"
+ " test -n \"$timestamp\" || timestamp=0\n"
+ " test $timestamp -ge $mints || install -m 755 $ref/config.$s $c\n"
+ " done\n"
+ "done\n"
+ );
+ parsePart = parseLines(spec, STRIP_NOTHING, NULL, &(spec->build));
break;
case PART_INSTALL:
parsePart = parseSimpleScript(spec, "%install", &(spec->install));

3
baselibs.conf Normal file
View File

@ -0,0 +1,3 @@
rpm
arch ppc package rpm-devel
arch sparcv9 package rpm-devel

11
brp-compress-no-img.patch Normal file
View File

@ -0,0 +1,11 @@
--- scripts/brp-compress.orig 2022-12-02 13:18:54.498881077 +0000
+++ scripts/brp-compress 2022-12-02 13:20:00.038727777 +0000
@@ -52,6 +52,8 @@ do
while IFS= read -r -d '' f; do
[ -f "$f" ] || continue
+ case $(file "$f") in *"image data"*) continue;; esac
+
case "$f" in
*.gz|*.Z) gunzip -f "$f"; check_for_hard_link $d "$f"; b=`echo "$f" | sed -e 's/\.\(gz\|Z\)$//'`;;
*.bz2) bunzip2 -f "$f"; check_for_hard_link $d "$f"; b=`echo "$f" | sed -e 's/\.bz2$//'`;;

19
brp.diff Normal file
View File

@ -0,0 +1,19 @@
--- scripts/brp-strip-comment-note.orig 2022-04-07 11:13:19.072518377 +0000
+++ scripts/brp-strip-comment-note 2022-12-02 13:07:03.700394762 +0000
@@ -15,7 +15,7 @@ esac
# Strip .comment and .note sections (the latter only if it is not allocated)
# for already stripped elf files in the build root
-for f in `find "$RPM_BUILD_ROOT" -type f \( -perm -0100 -or -perm -0010 -or -perm -0001 \) -print0 | xargs -0 -r -P$NCPUS -n32 sh -c "file \"\\$@\" | grep -v \"^${RPM_BUILD_ROOT}/\?usr/lib/debug\" | sed -n -e 's/^\(.*\):[ ]*ELF.*, stripped.*/\1/p'" ARG0`; do
+for f in `find "$RPM_BUILD_ROOT" -type f \( -perm -0100 -or -perm -0010 -or -perm -0001 \) -print0 | xargs -0 -r -P$NCPUS -n32 sh -c "file \"\\$@\" | grep -v \"^${RPM_BUILD_ROOT}/\?usr/lib/debug\" | grep -v ' shared object,' | grep -v '/lib/modules/' | sed -n -e 's/^\(.*\):[ ]*ELF.*, stripped.*/\1/p'" ARG0`; do
note="-R .note"
if $OBJDUMP -h $f | grep '^[ ]*[0-9]*[ ]*.note[ ]' -A 1 | \
grep ALLOC >/dev/null; then
--- scripts/brp-strip.orig 2022-04-07 11:13:19.072518377 +0000
+++ scripts/brp-strip 2022-12-02 13:04:21.392758270 +0000
@@ -14,4 +14,4 @@ esac
# Strip ELF binaries
find "$RPM_BUILD_ROOT" -type f \! -regex "${RPM_BUILD_ROOT}/*usr/lib/debug.*" \! -name "*.go" -print0 | \
- xargs -0 -r -P$NCPUS -n32 sh -c "file \"\$@\" | sed -n -e 's/^\(.*\):[ ]*ELF.*, not stripped.*/\1/p' | grep -v 'no machine' | xargs -I\{\} $STRIP -g \{\}" ARG0
+ xargs -0 -r -P$NCPUS -n32 sh -c "file \"\$@\" | grep -v ' shared object,' | grep -v '/lib/modules/ | sed -n -e 's/^\(.*\):[ ]*ELF.*, not stripped.*/\1/p' | grep -v 'no machine' | xargs -I\{\} $STRIP -g \{\}" ARG0

80
brpcompress.diff Normal file
View File

@ -0,0 +1,80 @@
--- scripts/brp-compress.orig 2022-04-07 11:13:19.072518377 +0000
+++ scripts/brp-compress 2022-12-02 13:12:31.239774558 +0000
@@ -5,6 +5,9 @@ if [ -z "$RPM_BUILD_ROOT" ] || [ "$RPM_B
exit 0
fi
+LC_ALL=
+LANG=
+LC_TIME=POSIX
PREFIX=${1:-/usr}
cd "$RPM_BUILD_ROOT"
@@ -13,6 +16,30 @@ cd "$RPM_BUILD_ROOT"
COMPRESS=${COMPRESS:-gzip -9 -n}
COMPRESS_EXT=${COMPRESS_EXT:-.gz}
+check_for_hard_link()
+{
+ dir=$1
+ b=$2
+
+ inode=`ls -i $b | awk '{ print $1 }'`
+ others=`find $dir -type f -inum $inode`
+ for afile in $others ; do
+ [ "$afile" != "$b" ] && rm -f "$afile"
+ done
+
+ case $b in
+ *.Z|*.gz) gunzip $b ;;
+ *.bz2) bunzip2 $b ;;
+ *.xz|*.lzma) unxz $b ;;
+ *.zst|*.zstd) unzstd --rm $b ;;
+ esac
+
+ type=${b##*.}
+ for afile in $others ; do
+ [ "${afile%.$type}" != "${b%.$type}" ] && ln ${b%.$type} ${afile%.$type}
+ done
+}
+
for d in .${PREFIX}/man/man* .${PREFIX}/man/*/man* .${PREFIX}/info \
.${PREFIX}/share/man/man* .${PREFIX}/share/man/*/man* \
.${PREFIX}/share/info .${PREFIX}/kerberos/man \
@@ -26,10 +53,10 @@ do
[ -f "$f" ] || continue
case "$f" in
- *.gz|*.Z) gunzip -f "$f"; b=`echo "$f" | sed -e 's/\.\(gz\|Z\)$//'`;;
- *.bz2) bunzip2 -f "$f"; b=`echo "$f" | sed -e 's/\.bz2$//'`;;
- *.xz|*.lzma) unxz -f "$f"; b=`echo "$f" | sed -e 's/\.\(xz\|lzma\)$//'`;;
- *.zst|*.zstd) unzstd -f --rm $f; b=`echo "$f" | sed -e 's/\.\(zst\|zstd\)$//'`;;
+ *.gz|*.Z) gunzip -f "$f"; check_for_hard_link $d "$f"; b=`echo "$f" | sed -e 's/\.\(gz\|Z\)$//'`;;
+ *.bz2) bunzip2 -f "$f"; check_for_hard_link $d "$f"; b=`echo "$f" | sed -e 's/\.bz2$//'`;;
+ *.xz|*.lzma) unxz -f "$f"; check_for_hard_link $d "$f"; b=`echo "$f" | sed -e 's/\.\(xz\|lzma\)$//'`;;
+ *.zst|*.zstd) unzstd -f --rm $f; check_for_hard_link $d "$f"; b=`echo "$f" | sed -e 's/\.\(zst\|zstd\)$//'`;;
*) b="$f";;
esac
@@ -38,7 +65,7 @@ do
others="`find $d -type f -inum $inode`"
if [ -n "$others" ]; then
for afile in $others ; do
- [ "$afile" != "$b" ] && rm -f $afile
+ [ "$afile" != "$b" ] && rm -f "$afile"
done
$COMPRESS -f "$b"
for afile in $others ; do
@@ -52,9 +79,9 @@ do
find $d -type l -print0 |
while IFS= read -r -d '' f; do
- l=`ls -l $f | sed -e 's/.* -> //' -e 's/\.\(gz\|Z\|bz2\|xz\|lzma\|zst\|zstd\)$//'`
- rm -f $f
- b=`echo $f | sed -e 's/\.\(gz\|Z\|bz2\|xz\|lzma\|zst\|zstd\)$//'`
+ l=`ls -l "$f" | sed -e 's/.* -> //' -e 's/\.\(gz\|Z\|bz2\|xz\|lzma\|zst\|zstd\)$//'`
+ rm -f "$f"
+ b=`echo "$f" | sed -e 's/\.\(gz\|Z\|bz2\|xz\|lzma\|zst\|zstd\)$//'`
ln -sf "$l$COMPRESS_EXT" "$b$COMPRESS_EXT"
done
done

14
build.diff Normal file
View File

@ -0,0 +1,14 @@
--- installplatform
+++ installplatform
@@ -118,6 +118,11 @@
PPD="${DESTDIR}/${platformdir}/${ARCH}-${OS}"
[ -d $PPD ] || mkdir -p $PPD
+ if [ "$VENDOR" = suse ] ; then
+ # suse doesn't do colors
+ CANONCOLOR=0
+ fi
+
cat $PLATFORM \
| sed -e "s,@RPMRC_OPTFLAGS@,$RPMRC_OPTFLAGS," \
-e "s,@RPMCANONARCH@,$CANONARCH,g" \

12
checkfilesnoinfodir.diff Normal file
View File

@ -0,0 +1,12 @@
Exclude /usr/share/info/dir from check-files. Probably only
interesting for SUSE.
--- scripts/check-files.orig 2020-09-30 12:36:56.398762048 +0000
+++ scripts/check-files 2020-09-30 12:41:15.294176572 +0000
@@ -28,5 +28,5 @@ trap "rm -f \"${FILES_DISK}\"" 0 2 3 5 1
# Find non-directory files in the build root and compare to the manifest.
# TODO: regex chars in last sed(1) expression should be escaped
find "${RPM_BUILD_ROOT}" -type f -o -type l | LC_ALL=C sort > "${FILES_DISK}"
-LC_ALL=C sort | diff -d "${FILES_DISK}" - | sed -n 's!^\(-\|< \)'"${RPM_BUILD_ROOT}"'\(.*\)$! \2!gp'
+LC_ALL=C sort | diff -d "${FILES_DISK}" - | sed -n -e 's!^\(-\|< \)'"${RPM_BUILD_ROOT}"'/usr/share/info/dir$!!' -e 's!^\(-\|< \)'"${RPM_BUILD_ROOT}"'\(.*\)$! \2!gp'

68
checksepwarn.diff Normal file
View File

@ -0,0 +1,68 @@
--- build/parseReqs.c.orig 2019-06-26 14:17:31.396985719 +0000
+++ build/parseReqs.c 2019-10-02 12:10:51.879570016 +0000
@@ -42,7 +42,7 @@ static rpmRC checkEpoch(const char *s, c
return RPMRC_OK;
}
-static rpmRC checkDep(rpmSpec spec, char *N, char *EVR, char **emsg)
+static rpmRC checkDep(rpmSpec spec, rpmsenseFlags tagflags, char *N, char *EVR, char **emsg)
{
/*
* Tokens must begin with alphanumeric, _, or /, but we don't know
@@ -65,6 +65,11 @@ static rpmRC checkDep(rpmSpec spec, char
if (rpmExpandNumeric("%{?_wrong_version_format_terminate_build}"))
return RPMRC_FAIL;
+ if (tagflags & (RPMSENSE_FIND_REQUIRES|RPMSENSE_FIND_PROVIDES))
+ rpmlog(RPMLOG_WARNING, "%s\n", *emsg);
+ else
+ rpmlog(RPMLOG_WARNING, _("line %d: %s: %s\n"), spec->lineNum, *emsg, spec->line);
+ *emsg = _free(*emsg);
}
}
return RPMRC_OK;
@@ -72,6 +77,7 @@ static rpmRC checkDep(rpmSpec spec, char
struct parseRCPOTRichData {
rpmSpec spec;
+ rpmsenseFlags tagflags;
StringBuf sb;
};
@@ -109,7 +115,7 @@ static rpmRC parseRCPOTRichCB(void *cbda
appendStringBuf(sb, rel);
appendStringBuf(sb, EVR);
}
- rc = checkDep(data->spec, N, EVR, emsg);
+ rc = checkDep(data->spec, data->tagflags, N, EVR, emsg);
_free(N);
_free(EVR);
} else if (type == RPMRICH_PARSE_OP) {
@@ -223,6 +229,7 @@ rpmRC parseRCPOT(rpmSpec spec, Package p
goto exit;
}
data.spec = spec;
+ data.tagflags = tagflags;
data.sb = newStringBuf();
if (rpmrichParseForTag(&r, &emsg, parseRCPOTRichCB, &data, nametag) != RPMRC_OK) {
freeStringBuf(data.sb);
@@ -274,7 +281,7 @@ rpmRC parseRCPOT(rpmSpec spec, Package p
}
/* check that dependency is well-formed */
- if (checkDep(spec, N, EVR, &emsg))
+ if (checkDep(spec, tagflags, N, EVR, &emsg))
goto exit;
if (nametag == RPMTAG_OBSOLETENAME) {
--- macros.in.orig 2019-10-02 12:10:45.431583601 +0000
+++ macros.in 2019-10-02 12:10:51.879570016 +0000
@@ -452,7 +452,7 @@ package or when debugging this package.\
%_invalid_encoding_terminates_build 1
# Should invalid version format in requires, provides, ... terminate a build?
-%_wrong_version_format_terminate_build 1
+%_wrong_version_format_terminate_build 0
#
# Should rpm try to download missing sources at build-time?

48
cpuid_lzcnt.patch Normal file
View File

@ -0,0 +1,48 @@
From 6b7c58474df3b416b1acb8b58e73b7edf73b8c43 Mon Sep 17 00:00:00 2001
From: Fabian Vogt <fvogt@suse.de>
Date: Mon, 6 Mar 2023 17:50:42 +0100
Subject: [PATCH] The bit for LZCNT is in CPUID 0x80000001, not 1
The GCC headers put bit_LZCNT into the list for CPUID 1 %ecx values, but that
corresponds to VMX. LZCNT is actually advertised in CPUID 0x80000001 %ecx,
which is also referred to as "ABM" by AMD and some other places.
---
lib/rpmrc.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git lib/rpmrc.c lib/rpmrc.c
index fc2ed5fe2..66ce947ae 100644
--- lib/rpmrc.c
+++ lib/rpmrc.c
@@ -747,7 +747,6 @@ static inline void cpuid(uint32_t op, uint32_t op2, uint32_t *eax, uint32_t *ebx
/* Features (%eax == 1) */
/* %ecx */
#define bit_SSE3 (1 << 0)
-#define bit_LZCNT (1 << 5)
#define bit_SSSE3 (1 << 9)
#define bit_FMA (1 << 12)
#define bit_CMPXCHG16B (1 << 13)
@@ -762,6 +761,7 @@ static inline void cpuid(uint32_t op, uint32_t op2, uint32_t *eax, uint32_t *ebx
/* Extended Features (%eax == 0x80000001) */
/* %ecx */
#define bit_LAHF_LM (1 << 0)
+#define bit_LZCNT (1 << 5)
/* Extended Features (%eax == 7) */
/* %ebx */
@@ -787,9 +787,10 @@ static int get_x86_64_level(void)
if ((op_1_ecx & op_1_ecx_lv2) == op_1_ecx_lv2 && (op_80000001_ecx & bit_LAHF_LM))
level = 2;
- const unsigned int op_1_ecx_lv3 = bit_LZCNT | bit_FMA | bit_MOVBE | bit_OSXSAVE | bit_AVX | bit_F16C;
+ const unsigned int op_1_ecx_lv3 = bit_FMA | bit_MOVBE | bit_OSXSAVE | bit_AVX | bit_F16C;
const unsigned int op_7_ebx_lv3 = bit_BMI | bit_AVX2 | bit_BMI2;
- if (level == 2 && (op_1_ecx & op_1_ecx_lv3) == op_1_ecx_lv3 && (op_7_ebx & op_7_ebx_lv3) == op_7_ebx_lv3)
+ if (level == 2 && (op_1_ecx & op_1_ecx_lv3) == op_1_ecx_lv3 && (op_7_ebx & op_7_ebx_lv3) == op_7_ebx_lv3
+ && (op_80000001_ecx & bit_LZCNT))
level = 3;
const unsigned int op_7_ebx_lv4 = bit_AVX512F | bit_AVX512DQ | bit_AVX512CD | bit_AVX512BW | bit_AVX512VL;
--
2.39.2

169
db_conversion.diff Normal file
View File

@ -0,0 +1,169 @@
--- lib/backend/bdb_ro.c.orig 2022-04-07 11:13:18.994517848 +0000
+++ lib/backend/bdb_ro.c 2022-12-02 13:22:16.726408071 +0000
@@ -793,6 +793,7 @@ static unsigned int bdbro_pkgdbKey(dbiIn
struct rpmdbOps_s bdbro_dbops = {
.name = "bdb_ro",
.path = "Packages",
+ .readonly = 1,
.open = bdbro_Open,
.close = bdbro_Close,
--- lib/backend/dbi.c.orig 2022-04-07 11:13:18.994517848 +0000
+++ lib/backend/dbi.c 2022-12-02 13:22:16.726408071 +0000
@@ -138,11 +138,20 @@ exit:
}
rdb->db_descr = rdb->db_ops->name;
+ rdb->db_ops_config = cfg;
if (db_backend)
free(db_backend);
}
+int dbiNeedConversion(rpmdb rdb)
+{
+ if (!rdb->db_ops)
+ dbDetectBackend(rdb);
+ return rdb->db_ops->readonly && rdb->db_ops_config
+ && rdb->db_ops_config->path && !rdb->db_ops_config->readonly;
+}
+
const char * dbiName(dbiIndex dbi)
{
return dbi->dbi_file;
--- lib/backend/dbi.h.orig 2022-04-07 11:13:18.994517848 +0000
+++ lib/backend/dbi.h 2022-12-02 13:22:16.726408071 +0000
@@ -13,6 +13,7 @@ enum rpmdbFlags {
RPMDB_FLAG_REBUILD = (1 << 1),
RPMDB_FLAG_VERIFYONLY = (1 << 2),
RPMDB_FLAG_SALVAGE = (1 << 3),
+ RPMDB_FLAG_CONVERT = (1 << 4),
};
typedef enum dbCtrlOp_e {
@@ -53,6 +54,7 @@ struct rpmdb_s {
int db_buildindex; /*!< Index rebuild indicator */
const struct rpmdbOps_s * db_ops; /*!< backend ops */
+ const struct rpmdbOps_s * db_ops_config; /*!< configured backend ops */
/* dbenv and related parameters */
void * db_dbenv; /*!< Backend private handle */
@@ -197,6 +199,14 @@ RPM_GNUC_INTERNAL
const char * dbiName(dbiIndex dbi);
/** \ingroup dbi
+ * Check if the database needs to be converted to a different format
+ * @param db rpm database
+ * @return boolean
+ */
+RPM_GNUC_INTERNAL
+int dbiNeedConversion(rpmdb rdb);
+
+/** \ingroup dbi
* Open a database cursor.
* @param dbi index database handle
* @param flags DBC_WRITE if writing, or 0 (DBC_READ) for reading
@@ -240,6 +250,7 @@ const void * idxdbKey(dbiIndex dbi, dbiC
struct rpmdbOps_s {
const char *name; /* backend name */
const char *path; /* main database name */
+ int readonly; /* cannot modify database */
int (*open)(rpmdb rdb, rpmDbiTagVal rpmtag, dbiIndex * dbip, int flags);
int (*close)(dbiIndex dbi, unsigned int flags);
--- lib/backend/ndb/rpmpkg.c.orig 2022-04-07 11:13:18.997517869 +0000
+++ lib/backend/ndb/rpmpkg.c 2022-12-02 13:22:16.726408071 +0000
@@ -1116,11 +1116,12 @@ static int rpmpkgPutInternal(rpmpkgdb pk
if (rpmpkgWriteBlob(pkgdb, pkgidx, blkoff, blkcnt, blob, blobl, pkgdb->generation)) {
return RPMRC_FAIL;
}
+ /* update nextpkgidx if needed */
+ if (pkgidx >= pkgdb->nextpkgidx) {
+ pkgdb->nextpkgidx = pkgidx + 1;
+ }
/* write slot */
slotno = oldslot ? oldslot->slotno : pkgdb->freeslot;
- if (!slotno) {
- return RPMRC_FAIL;
- }
if (rpmpkgWriteslot(pkgdb, slotno, pkgidx, blkoff, blkcnt)) {
free(pkgdb->slots);
pkgdb->slots = 0;
--- lib/rpmdb.c.orig 2022-09-20 12:08:27.197920294 +0000
+++ lib/rpmdb.c 2022-12-02 13:24:02.830159868 +0000
@@ -469,7 +469,12 @@ static int openDatabase(const char * pre
/* Open just bare minimum when rebuilding a potentially damaged db */
int justPkgs = (db->db_flags & RPMDB_FLAG_REBUILD) &&
((db->db_mode & O_ACCMODE) == O_RDONLY);
- rc = doOpen(db, justPkgs);
+ if (!db->db_pkgs && !justCheck && (mode & O_ACCMODE) == O_RDWR && dbiNeedConversion(db)) {
+ rc = rpmdbRebuild(prefix, NULL, NULL, RPMDB_REBUILD_FLAG_CONVERT);
+ db->db_ops = NULL; /* force re-detection of backend */
+ }
+ if (!rc)
+ rc = doOpen(db, justPkgs);
if (!db->db_descr)
db->db_descr = "unknown db";
@@ -2228,6 +2233,15 @@ int rpmdbAdd(rpmdb db, Header h)
if (db == NULL)
return 0;
+ if ((db->db_flags & RPMDB_FLAG_CONVERT) != 0) {
+ /* keep old instance numbers when converting */
+ hdrNum = headerGetInstance(h);
+ if (hdrNum == 0) {
+ ret = -1;
+ goto exit;
+ }
+ }
+
hdrBlob = headerExport(h, &hdrLen);
if (hdrBlob == NULL || hdrLen == 0) {
ret = -1;
@@ -2423,7 +2437,22 @@ int rpmdbRebuild(const char * prefix, rp
}
rootdbpath = rpmGetPath(prefix, dbpath, NULL);
- newdbpath = rpmGetPath("%{?_dbpath_rebuild}", NULL);
+ if ((rebuildflags & RPMDB_REBUILD_FLAG_CONVERT) != 0) {
+ char lbuf[PATH_MAX];
+ ssize_t s = readlink(rootdbpath, lbuf, PATH_MAX);
+ if (s > 0 && s < PATH_MAX) {
+ lbuf[s] = 0;
+ free(dbpath);
+ if (lbuf[0] == '/')
+ dbpath = strdup(lbuf);
+ else
+ dbpath = rpmGetPath("%{?_dbpath}", "/../", lbuf, NULL);
+ free(rootdbpath);
+ rootdbpath = rpmGetPath(prefix, dbpath, NULL);
+ }
+ newdbpath = strdup("");
+ } else
+ newdbpath = rpmGetPath("%{?_dbpath_rebuild}", NULL);
if (rstreq(newdbpath, "") || rstreq(newdbpath, dbpath)) {
newdbpath = _free(newdbpath);
rasprintf(&newdbpath, "%srebuilddb.%d", dbpath, (int) getpid());
@@ -2449,7 +2478,9 @@ int rpmdbRebuild(const char * prefix, rp
goto exit;
}
if (openDatabase(prefix, newdbpath, &newdb,
- (O_RDWR | O_CREAT), 0644, RPMDB_FLAG_REBUILD)) {
+ (O_RDWR | O_CREAT), 0644, RPMDB_FLAG_REBUILD |
+ (rebuildflags & RPMDB_REBUILD_FLAG_CONVERT ?
+ RPMDB_FLAG_CONVERT : 0))) {
rc = 1;
goto exit;
}
--- lib/rpmdb_internal.h.orig 2022-04-07 11:13:19.014517984 +0000
+++ lib/rpmdb_internal.h 2022-12-02 13:22:16.726408071 +0000
@@ -25,6 +25,7 @@ extern "C" {
enum rpmdbRebuildFlags_e {
RPMDB_REBUILD_FLAG_SALVAGE = (1 << 0),
+ RPMDB_REBUILD_FLAG_CONVERT = (1 << 1),
};
/** \ingroup rpmdb

11
emptymanifest.diff Normal file
View File

@ -0,0 +1,11 @@
--- macros.in.orig 2017-01-20 10:15:12.677868723 +0000
+++ macros.in 2017-01-20 10:15:30.385819715 +0000
@@ -403,7 +403,7 @@ package or when debugging this package.\
# Should empty %files manifest file terminate a build?
#
# Note: The default value should be 0 for legacy compatibility.
-%_empty_manifest_terminate_build 1
+%_empty_manifest_terminate_build 0
#
# Should binaries in noarch packages terminate a build?

View File

@ -0,0 +1,34 @@
--- lib/rpmscript.c
+++ lib/rpmscript.c
@@ -390,7 +390,7 @@ rpmRC rpmScriptRun(rpmScript script, int
if (script == NULL) return RPMRC_OK;
ARGV_t args = NULL;
- rpmlogLvl lvl = (script->flags & RPMSCRIPT_FLAG_CRITICAL) ?
+ rpmlogLvl lvl = (rpmScriptFlags(script) & RPMSCRIPT_FLAG_CRITICAL) ?
RPMLOG_ERR : RPMLOG_WARNING;
rpmRC rc;
int script_type = RPMSCRIPTLET_FORK | RPMSCRIPTLET_EXEC;
@@ -637,5 +637,8 @@ rpmscriptTypes rpmScriptType(rpmScript s
rpmscriptFlags rpmScriptFlags(rpmScript script)
{
- return (script != NULL) ? script->flags : 0;
+ rpmscriptFlags flags = (script != NULL) ? script->flags : 0;
+ if (script && script->tag == RPMTAG_POSTIN && rpmExpandNumeric("%{_fail_on_postinstall_errors}"))
+ flags |= RPMSCRIPT_FLAG_CRITICAL;
+ return flags;
}
--- macros.in
+++ macros.in
@@ -1293,5 +1293,10 @@ end
%{expand:%__scm_setup_%{__scm} %{!-v:-q}}\
%{!-N:%autopatch %{-v} %{-p:-p%{-p*}}}
+# Should errors in %post scriptlet be propagated as errors?
+#
+# Note: set to 1 for legacy compatibility.
+%_fail_on_postinstall_errors 0
+
# \endverbatim
#*/

25
fileattrs.diff Normal file
View File

@ -0,0 +1,25 @@
--- fileattrs/elf.attr.orig 2021-09-23 19:29:51.474079693 +0000
+++ fileattrs/elf.attr 2021-09-23 19:35:43.413332593 +0000
@@ -1,3 +1,4 @@
%__elf_provides %{_rpmconfigdir}/elfdeps --provides
%__elf_requires %{_rpmconfigdir}/elfdeps --requires
%__elf_magic ^(setuid,? )?(setgid,? )?(sticky )?ELF (32|64)-bit.*$
+%__elf_exclude_path ^/usr/lib/debug/
--- fileattrs/perl.attr.orig 2021-06-21 12:00:44.587611741 +0000
+++ fileattrs/perl.attr 2021-09-23 19:29:51.474079693 +0000
@@ -1,3 +1,4 @@
-%__perl_requires %{_rpmconfigdir}/perl.req
+# disabled for now
+#%__perl_requires %{_rpmconfigdir}/perl.req
%__perl_magic ^.*[Pp]erl .*$
%__perl_flags exeonly
--- fileattrs/perllib.attr.orig 2021-06-21 12:00:44.587611741 +0000
+++ fileattrs/perllib.attr 2021-09-23 19:29:51.478079685 +0000
@@ -1,5 +1,6 @@
%__perllib_provides %{_rpmconfigdir}/perl.prov
-%__perllib_requires %{_rpmconfigdir}/perl.req
+#disabled for now
+#%__perllib_requires %{_rpmconfigdir}/perl.req
%__perllib_magic ^Perl[[:digit:]] module source.*
%__perllib_path \\.pm$
%__perllib_flags magic_and_path

13
find-lang-qt-qm.patch Normal file
View File

@ -0,0 +1,13 @@
--- scripts/find-lang.sh.orig 2021-09-23 19:57:49.046595975 +0000
+++ scripts/find-lang.sh 2021-09-23 19:59:36.182374732 +0000
@@ -305,7 +305,9 @@ s:%lang(C) ::
find "$TOP_DIR" -type f -o -type l|sed '
s:'"$TOP_DIR"'::
-'"$NO_ALL_NAME$QT"'s:\(.*/'"$NAME"'_\([a-zA-Z]\+\([_@].*\)\?\)\.qm$\):%lang(\2) \1:
+'"$ALL_NAME$QT"'s:\(.*/locale/\)\([^/]\+\)\(/.\+/\)\([^/]\+_qt\.qm$\):%lang(\2) \1\2\3\4:
+'"$NO_ALL_NAME$QT"'s:\(.*/locale/\)\([^/]\+\)\(/.\+/\)\('"$NAME"'_qt\.qm$\):%lang(\2) \1\2\3\4:
+'"$NO_ALL_NAME$QT"'s:^\([^%].*/'"$NAME"'_\([a-zA-Z]\+\([_@].*\)\?\)\.qm$\):%lang(\2) \1:
'"$ALL_NAME$QT"'s:^\([^%].*/\([a-zA-Z]\+[_@].*\)\.qm$\):%lang(\2) \1:
'"$ALL_NAME$QT"'s:^\([^%].*/\([a-zA-Z]\+\)\.qm$\):%lang(\2) \1:
'"$ALL_NAME$QT"'s:^\([^%].*/[^/_]\+_\([a-zA-Z]\+[_@].*\)\.qm$\):%lang(\2) \1:

214
findlang.diff Normal file
View File

@ -0,0 +1,214 @@
--- scripts/find-lang.sh.orig 2021-06-21 12:00:44.650612737 +0000
+++ scripts/find-lang.sh 2021-09-23 19:12:01.428275661 +0000
@@ -37,11 +37,11 @@ the top of the tree containing the files
PACKAGE_NAME is the %{name} of the package. This should also be
the basename of the .mo files. the output is written to
PACKAGE_NAME.lang unless \$3 is given in which case output is written
-to \$3.
+to \$3 (note that \$3 is appended to if given).
Additional options:
- --with-gnome find GNOME help files
+ --without-gnome do not find GNOME help files
--with-mate find MATE help files
- --with-kde find KDE help files
+ --without-kde do not find KDE help files
--with-qt find Qt translation files
--with-html find HTML files
--with-man find localized man pages
@@ -65,9 +65,9 @@ else NAMES[0]=$1
fi
shift
-GNOME=#
+GNOME=
MATE=#
-KDE=#
+KDE=
QT=#
MAN=#
HTML=#
@@ -89,6 +89,14 @@ while test $# -gt 0 ; do
KDE=
shift
;;
+ --without-gnome )
+ GNOME=#
+ shift
+ ;;
+ --without-kde )
+ KDE=#
+ shift
+ ;;
--with-qt )
QT=
shift
@@ -118,11 +126,13 @@ while test $# -gt 0 ; do
shift
;;
esac
-done
+done
-if [ -f $MO_NAME ]; then
- rm $MO_NAME
+if ! test -s $MO_NAME ; then
+ echo "%defattr (644, root, root, 755)" > $MO_NAME
fi
+MO_NAME_NEW=$MO_NAME.tmp.$$
+rm -f $MO_NAME_NEW
for NAME in ${NAMES[@]}; do
@@ -132,7 +142,7 @@ s:'"$TOP_DIR"'::
'"$NO_ALL_NAME$MO"'s:\(.*/locale/\)\([^/_]\+\)\(.*/'"$NAME"'\.mo$\):%lang(\2) \1\2\3:
s:^\([^%].*\)::
s:%lang(C) ::
-/^$/d' >> $MO_NAME
+/^$/d' >> $MO_NAME_NEW
find "$TOP_DIR" -type d|sed '
s:'"$TOP_DIR"'::
@@ -140,27 +150,27 @@ s:'"$TOP_DIR"'::
'"$ALL_NAME$GNOME"'s:\(.*/share/help/\)\([^/_]\+\)\([^/]*\)\(/[a-zA-Z0-9.\_\-]\+\)$:%lang(\2) %doc \1\2\3\4/:
s:^\([^%].*\)::
s:%lang(C) ::
-/^$/d' >> $MO_NAME
+/^$/d' >> $MO_NAME_NEW
find "$TOP_DIR" -type d|sed '
s:'"$TOP_DIR"'::
-'"$NO_ALL_NAME$GNOME"'s:\(.*/gnome/help/'"$NAME"'$\):%dir \1:
+'"$NO_ALL_NAME$GNOME"'s:\(.*/gnome/help/'"$NAME"'$\):%dir %doc \1:
'"$NO_ALL_NAME$GNOME"'s:\(.*/gnome/help/'"$NAME"'/[a-zA-Z0-9.\_\-]/.\+\)::
-'"$NO_ALL_NAME$GNOME"'s:\(.*/gnome/help/'"$NAME"'\/\)\([^/_]\+\):%lang(\2) \1\2:
-'"$ALL_NAME$GNOME"'s:\(.*/gnome/help/[a-zA-Z0-9.\_\-]\+$\):%dir \1:
+'"$NO_ALL_NAME$GNOME"'s:\(.*/gnome/help/'"$NAME"'\/\)\([^/_]\+\):%lang(\2) %doc \1\2:
+'"$ALL_NAME$GNOME"'s:\(.*/gnome/help/[a-zA-Z0-9.\_\-]\+$\):%dir %doc \1:
'"$ALL_NAME$GNOME"'s:\(.*/gnome/help/[a-zA-Z0-9.\_\-]\+/[a-zA-Z0-9.\_\-]/.\+\)::
-'"$ALL_NAME$GNOME"'s:\(.*/gnome/help/[a-zA-Z0-9.\_\-]\+\/\)\([^/_]\+\):%lang(\2) \1\2:
+'"$ALL_NAME$GNOME"'s:\(.*/gnome/help/[a-zA-Z0-9.\_\-]\+\/\)\([^/_]\+\):%lang(\2) %doc \1\2:
s:%lang(.*) .*/gnome/help/[a-zA-Z0-9.\_\-]\+/[a-zA-Z0-9.\_\-]\+/.*::
s:^\([^%].*\)::
s:%lang(C) ::
-/^$/d' >> $MO_NAME
+/^$/d' >> $MO_NAME_NEW
find "$TOP_DIR" -type d|sed '
s:'"$TOP_DIR"'::
'"$NO_ALL_NAME$GNOME"'s:\(.*/omf/'"$NAME"'$\):%dir \1:
'"$ALL_NAME$GNOME"'s:\(.*/omf/[a-zA-Z0-9.\_\-]\+$\):%dir \1:
s:^\([^%].*\)::
-/^$/d' >> $MO_NAME
+/^$/d' >> $MO_NAME_NEW
find "$TOP_DIR" -type f|sed '
s:'"$TOP_DIR"'::
@@ -168,7 +178,7 @@ s:'"$TOP_DIR"'::
'"$ALL_NAME$GNOME"'s:\(.*/omf/[a-zA-Z0-9.\_\-]\+/[a-zA-Z0-9.\_\-]\+-\([^/.]\+\)\.omf\):%lang(\2) \1:
s:^[^%].*::
s:%lang(C) ::
-/^$/d' >> $MO_NAME
+/^$/d' >> $MO_NAME_NEW
find $TOP_DIR -type d|sed '
s:'"$TOP_DIR"'::
@@ -181,14 +191,14 @@ s:'"$TOP_DIR"'::
s:%lang(.*) .*/mate/help/[a-zA-Z0-9.\_\-]\+/[a-zA-Z0-9.\_\-]\+/.*::
s:^\([^%].*\)::
s:%lang(C) ::
-/^$/d' >> $MO_NAME
+/^$/d' >> $MO_NAME_NEW
find "$TOP_DIR" -type d|sed '
s:'"$TOP_DIR"'::
'"$NO_ALL_NAME$MATE"'s:\(.*/omf/'"$NAME"'$\):%dir \1:
'"$ALL_NAME$MATE"'s:\(.*/omf/[a-zA-Z0-9.\_\-]\+$\):%dir \1:
s:^\([^%].*\)::
-/^$/d' >> $MO_NAME
+/^$/d' >> $MO_NAME_NEW
find "$TOP_DIR" -type f|sed '
s:'"$TOP_DIR"'::
@@ -196,7 +206,7 @@ s:'"$TOP_DIR"'::
'"$ALL_NAME$MATE"'s:\(.*/omf/[a-zA-Z0-9.\_\-]\+/[a-zA-Z0-9.\_\-]\+-\([^/.]\+\)\.omf\):%lang(\2) \1:
s:^[^%].*::
s:%lang(C) ::
-/^$/d' >> $MO_NAME
+/^$/d' >> $MO_NAME_NEW
KDE3_HTML=`kde-config --expandvars --install html 2>/dev/null`
if [ x"$KDE3_HTML" != x ] && [ -d "$TOP_DIR$KDE3_HTML" ]; then
@@ -208,7 +218,7 @@ s:'"$TOP_DIR"'::
'"$ALL_NAME$KDE"'s:\(.*/HTML/\)\([^/_]\+\)\(.*/[a-zA-Z0-9.\_\-]\+$\):%lang(\2) \1\2\3:
s:^\([^%].*\)::
s:%lang(C) ::
-/^$/d' >> $MO_NAME
+/^$/d' >> $MO_NAME_NEW
fi
KDE4_HTML=`kde4-config --expandvars --install html 2>/dev/null`
@@ -221,7 +231,7 @@ s:'"$TOP_DIR"'::
'"$ALL_NAME$KDE"'s:\(.*/HTML/\)\([^/_]\+\)\(.*/[a-zA-Z0-9.\_\-]\+$\):%lang(\2) \1\2\3:
s:^\([^%].*\)::
s:%lang(C) ::
-/^$/d' >> $MO_NAME
+/^$/d' >> $MO_NAME_NEW
fi
KF5_HTML=`kf5-config --expandvars --install html 2>/dev/null`
@@ -234,7 +244,7 @@ s:'"$TOP_DIR"'::
'"$ALL_NAME$KDE"'s:\(.*/HTML/\)\([^/_]\+\)\(.*/[a-zA-Z0-9.\_\-]\+$\):%lang(\2) \1\2\3:
s:^\([^%].*\)::
s:%lang(C) ::
-/^$/d' >> $MO_NAME
+/^$/d' >> $MO_NAME_NEW
fi
find "$TOP_DIR" -type d|sed '
@@ -245,7 +255,7 @@ s:'"$TOP_DIR"'::
'"$ALL_NAME$HTML"'s:\(.*/doc/HTML/\)\([^/_]\+\)\(.*/[a-zA-Z0-9.\_\-]\+$\):%lang(\2) \1\2\3:
s:^\([^%].*\)::
s:%lang(C) ::
-/^$/d' >> $MO_NAME
+/^$/d' >> $MO_NAME_NEW
find "$TOP_DIR" -type f -o -type l|sed '
s:'"$TOP_DIR"'::
@@ -258,7 +268,7 @@ s:'"$TOP_DIR"'::
'"$ALL_NAME$QT"'s:^\([^%].*/[^/]\+_\([a-zA-Z]\+\)\.qm$\):%lang(\2) \1:
s:^[^%].*::
s:%lang(C) ::
-/^$/d' >> $MO_NAME
+/^$/d' >> $MO_NAME_NEW
find "$TOP_DIR" -type d|sed '
s:'"$TOP_DIR"'::
@@ -266,19 +276,24 @@ s:'"$TOP_DIR"'::
'"$ALL_NAME$MAN"'s:\(.*/man/\([^/_]\+\).*/man[a-z0-9]\+$\):%lang(\2) \1*:
s:^\([^%].*\)::
s:%lang(C) ::
-/^$/d' >> $MO_NAME
+/^$/d' >> $MO_NAME_NEW
find "$TOP_DIR" -type f -o -type l|sed -r 's/\.(bz2|gz|xz|lzma|Z)$//g' | sed '
s:'"$TOP_DIR"'::
'"$NO_ALL_NAME$MAN"'s:\(.*/man/\([^/_]\+\).*/man[a-z0-9]\+/'"$NAME"'\.[a-z0-9].*\):%lang(\2) \1*:
s:^\([^%].*\)::
s:%lang(C) ::
-/^$/d' >> $MO_NAME
+/^$/d' >> $MO_NAME_NEW
done # for NAME in ${NAMES[@]}
-if ! grep -q / $MO_NAME; then
- echo "No translations found for ${NAME} in ${TOP_DIR}"
+if ! grep -q / $MO_NAME_NEW; then
+ echo "No translations found for ${NAMES[*]} in ${TOP_DIR}"
+ rm -f $MO_NAME_NEW
exit 1
fi
+
+sort -u $MO_NAME_NEW >> $MO_NAME
+rm -f $MO_NAME_NEW
+
exit 0

26
findsupplements.diff Normal file
View File

@ -0,0 +1,26 @@
--- scripts/Makefile.am.orig 2022-04-07 11:13:19.072518377 +0000
+++ scripts/Makefile.am 2022-12-02 13:21:08.886566747 +0000
@@ -18,7 +18,7 @@ EXTRA_DIST = \
rpm.daily rpm.log rpm.supp rpm2cpio.sh \
rpm_macros_provides.sh \
tgpg vpkg-provides.sh \
- find-requires find-provides \
+ find-requires find-provides find-supplements \
ocamldeps.sh \
pkgconfigdeps.sh \
fontconfig.prov script.req
@@ -30,7 +30,7 @@ rpmconfig_SCRIPTS = \
brp-remove-la-files \
check-files check-prereqs \
check-buildroot check-rpaths check-rpaths-worker \
- find-lang.sh find-requires find-provides \
+ find-lang.sh find-requires find-provides find-supplements \
perl.prov perl.req \
pkgconfigdeps.sh \
ocamldeps.sh \
--- scripts/find-supplements.orig 2022-12-02 13:21:08.886566747 +0000
+++ scripts/find-supplements 2022-12-02 13:21:08.886566747 +0000
@@ -0,0 +1,3 @@
+#!/bin/sh
+
+/usr/lib/rpm/rpmdeps --define="_use_internal_dependency_generator 1" --supplements

55
headeradddb.diff Normal file
View File

@ -0,0 +1,55 @@
Add rpmtsHeaderAddDB and rpmtsHeaderRemoveDB so that
convertdb1 will build again.
--- lib/rpmts.c.orig 2011-05-12 13:21:03.000000000 +0000
+++ lib/rpmts.c 2011-05-12 13:26:25.000000000 +0000
@@ -159,6 +159,24 @@ int rpmtsVerifyDB(rpmts ts)
return rc;
}
+int rpmtsHeaderAddDB(rpmts ts, Header h)
+{
+ if (rpmtsOpenDB(ts, (O_RDWR|O_CREAT)))
+ return RPMRC_FAIL;
+ if (rpmdbAdd(rpmtsGetRdb(ts), h) != 0)
+ return RPMRC_FAIL;
+ return RPMRC_OK;
+}
+
+int rpmtsHeaderRemoveDB(rpmts ts, unsigned int hdrNum)
+{
+ if (rpmtsOpenDB(ts, (O_RDWR|O_CREAT)))
+ return RPMRC_FAIL;
+ if (rpmdbRemove(rpmtsGetRdb(ts), hdrNum) != 0)
+ return RPMRC_FAIL;
+ return RPMRC_OK;
+}
+
/* keyp might no be defined. */
rpmdbMatchIterator rpmtsInitIterator(const rpmts ts, rpmDbiTagVal rpmtag,
const void * keyp, size_t keylen)
--- include/rpm/lib/rpmts.h.orig 2011-05-12 13:21:11.000000000 +0000
+++ include/rpm/rpmts.h 2011-05-12 13:28:32.000000000 +0000
@@ -264,6 +264,22 @@ int rpmtsRebuildDB(rpmts ts);
int rpmtsVerifyDB(rpmts ts);
/** \ingroup rpmts
+ * Add a header to the database used by the transaction.
+ * @param ts transaction set
+ * @param h header to add
+ * @return 0 on success
+ */
+int rpmtsHeaderAddDB(rpmts ts, Header h);
+
+/** \ingroup rpmts
+ * Remove a header from the database used by the transaction.
+ * @param ts transaction set
+ * @param hdrNum index of header to remove
+ * @return 0 on success
+ */
+int rpmtsHeaderRemoveDB(rpmts ts, unsigned int hdrNum);
+
+/** \ingroup rpmts
* Return transaction database iterator.
* @param ts transaction set
* @param rpmtag database index tag

12
headerchk2.diff Normal file
View File

@ -0,0 +1,12 @@
--- lib/header.c.orig 2017-12-01 15:54:04.254399473 +0000
+++ lib/header.c 2017-12-01 15:55:36.389131237 +0000
@@ -929,7 +929,8 @@ rpmRC hdrblobImport(hdrblob blob, int fa
rdlen += REGION_TAG_COUNT;
- if (rdlen != blob->dl)
+ /* should be equality test, but can be off if entries are not perfectly aligned */
+ if (rdlen > blob->dl)
goto errxit;
}

33
ignore-auxv.diff Normal file
View File

@ -0,0 +1,33 @@
--- lib/rpmrc.c.orig 2020-09-30 07:48:01.215567727 +0000
+++ lib/rpmrc.c 2020-09-30 12:22:46.612692258 +0000
@@ -78,10 +78,12 @@ struct rpmOption {
int localize;
};
+#if defined(__linux__) && (defined(__powerpc__) || defined(__sparc__) || (defined(__arm__) && defined(__ARM_PCS_VFP)))
static struct rpmat_s {
const char *platform;
uint64_t hwcap;
} rpmat;
+#endif
typedef struct defaultEntry_s {
char * name;
@@ -948,7 +950,7 @@ static int is_geode(void)
#endif
-#if defined(__linux__)
+#if defined(__linux__) && (defined(__powerpc__) || defined(__sparc__) || (defined(__arm__) && defined(__ARM_PCS_VFP)))
/**
* Populate rpmat structure with auxv values
*/
@@ -1004,7 +1006,7 @@ static void defaultMachine(rpmrcCtx ctx,
canonEntry canon;
int rc;
-#if defined(__linux__)
+#if defined(__linux__) && (defined(__powerpc__) || defined(__sparc__) || (defined(__arm__) && defined(__ARM_PCS_VFP)))
/* Populate rpmat struct with hw info */
read_auxv();
#endif

125
langnoc.diff Normal file
View File

@ -0,0 +1,125 @@
--- macros.in.orig 2021-09-23 19:54:19.515028659 +0000
+++ macros.in 2021-09-23 19:54:25.495016311 +0000
@@ -1150,6 +1150,7 @@ package or when debugging this package.\
# %files -f %{name}.lang
#
%find_lang %{_rpmconfigdir}/find-lang.sh %{buildroot}
+%no_lang_C --without-C
# Commands + opts to use for retrieving remote files
# Proxy opts can be set through --httpproxy/--httpport popt aliases,
--- scripts/find-lang.sh.orig 2021-09-23 19:54:19.507028675 +0000
+++ scripts/find-lang.sh 2021-09-23 19:54:25.495016311 +0000
@@ -75,6 +75,8 @@ MO=
MO_NAME=${NAMES[0]}.lang
ALL_NAME=#
NO_ALL_NAME=
+ONLY_C=#
+NO_C=#
while test $# -gt 0 ; do
case "${1}" in
--with-gnome )
@@ -118,6 +120,14 @@ while test $# -gt 0 ; do
NO_ALL_NAME=#
shift
;;
+ --with-only-C )
+ ONLY_C=
+ shift
+ ;;
+ --without-C )
+ NO_C=
+ shift
+ ;;
* )
if [ $MO_NAME != ${NAMES[$#]}.lang ]; then
NAMES[${#NAMES[@]}]=$MO_NAME
@@ -158,6 +168,8 @@ s:'"$TOP_DIR"'::
'"$ALL_NAME$MO"'s:\(.*/locale/\)\([^/_]\+\)\(.*\.mo$\):%lang(\2) \1\2\3:
'"$NO_ALL_NAME$MO"'s:\(.*/locale/\)\([^/_]\+\)\(.*/'"$NAME"'\.mo$\):%lang(\2) \1\2\3:
s:^\([^%].*\)::
+'"$ONLY_C"'/%lang(C)/!d
+'"$NO_C"'/%lang(C)/d
s:%lang(C) ::
/^$/d' >> $MO_NAME_NEW
@@ -166,19 +178,23 @@ s:'"$TOP_DIR"'::
'"$NO_ALL_NAME$GNOME"'s:\(.*/share/help/\)\([^/_]\+\)\([^/]*\)\(/'"$NAME"'\)$:%lang(\2) %doc \1\2\3\4/:
'"$ALL_NAME$GNOME"'s:\(.*/share/help/\)\([^/_]\+\)\([^/]*\)\(/[a-zA-Z0-9.\_\-]\+\)$:%lang(\2) %doc \1\2\3\4/:
s:^\([^%].*\)::
+'"$ONLY_C"'/%lang(C)/!d
+'"$NO_C"'/%lang(C)/d
s:%lang(C) ::
/^$/d' >> $MO_NAME_NEW
find "$TOP_DIR" -type d|sed '
s:'"$TOP_DIR"'::
-'"$NO_ALL_NAME$GNOME"'s:\(.*/gnome/help/'"$NAME"'$\):%dir %doc \1:
+'"$NO_ALL_NAME$GNOME"'s:\(.*/gnome/help/'"$NAME"'$\):%lang(C) %dir %doc \1:
'"$NO_ALL_NAME$GNOME"'s:\(.*/gnome/help/'"$NAME"'/[a-zA-Z0-9.\_\-]/.\+\)::
'"$NO_ALL_NAME$GNOME"'s:\(.*/gnome/help/'"$NAME"'\/\)\([^/_]\+\):%lang(\2) %doc \1\2:
-'"$ALL_NAME$GNOME"'s:\(.*/gnome/help/[a-zA-Z0-9.\_\-]\+$\):%dir %doc \1:
+'"$ALL_NAME$GNOME"'s:\(.*/gnome/help/[a-zA-Z0-9.\_\-]\+$\):%lang(C) %dir %doc \1:
'"$ALL_NAME$GNOME"'s:\(.*/gnome/help/[a-zA-Z0-9.\_\-]\+/[a-zA-Z0-9.\_\-]/.\+\)::
'"$ALL_NAME$GNOME"'s:\(.*/gnome/help/[a-zA-Z0-9.\_\-]\+\/\)\([^/_]\+\):%lang(\2) %doc \1\2:
s:%lang(.*) .*/gnome/help/[a-zA-Z0-9.\_\-]\+/[a-zA-Z0-9.\_\-]\+/.*::
s:^\([^%].*\)::
+'"$ONLY_C"'/%lang(C)/!d
+'"$NO_C"'/%lang(C)/d
s:%lang(C) ::
/^$/d' >> $MO_NAME_NEW
@@ -194,6 +210,8 @@ s:'"$TOP_DIR"'::
'"$NO_ALL_NAME$GNOME"'s:\(.*/omf/'"$NAME"'/'"$NAME"'-\([^/.]\+\)\.omf\):%lang(\2) \1:
'"$ALL_NAME$GNOME"'s:\(.*/omf/[a-zA-Z0-9.\_\-]\+/[a-zA-Z0-9.\_\-]\+-\([^/.]\+\)\.omf\):%lang(\2) \1:
s:^[^%].*::
+'"$ONLY_C"'/%lang(C)/!d
+'"$NO_C"'/%lang(C)/d
s:%lang(C) ::
/^$/d' >> $MO_NAME_NEW
@@ -234,6 +252,8 @@ s:'"$TOP_DIR"'::
'"$ALL_NAME$KDE"'s:\(.*/HTML/\)\([^/_]\+\)\(.*/[a-zA-Z0-9.\_\-]\+/\)::
'"$ALL_NAME$KDE"'s:\(.*/HTML/\)\([^/_]\+\)\(.*/[a-zA-Z0-9.\_\-]\+$\):%lang(\2) \1\2\3:
s:^\([^%].*\)::
+'"$ONLY_C"'/%lang(C)/!d
+'"$NO_C"'/%lang(C)/d
s:%lang(C) ::
/^$/d' >> $MO_NAME_NEW
fi
@@ -247,6 +267,8 @@ s:'"$TOP_DIR"'::
'"$ALL_NAME$KDE"'s:\(.*/HTML/\)\([^/_]\+\)\(.*/[a-zA-Z0-9.\_\-]\+/\)::
'"$ALL_NAME$KDE"'s:\(.*/HTML/\)\([^/_]\+\)\(.*/[a-zA-Z0-9.\_\-]\+$\):%lang(\2) \1\2\3:
s:^\([^%].*\)::
+'"$ONLY_C"'/%lang(C)/!d
+'"$NO_C"'/%lang(C)/d
s:%lang(C) ::
/^$/d' >> $MO_NAME_NEW
fi
@@ -284,6 +306,8 @@ s:'"$TOP_DIR"'::
'"$ALL_NAME$QT"'s:^\([^%].*/[^/]\+_\([a-zA-Z]\+[_@].*\)\.qm$\):%lang(\2) \1:
'"$ALL_NAME$QT"'s:^\([^%].*/[^/]\+_\([a-zA-Z]\+\)\.qm$\):%lang(\2) \1:
s:^[^%].*::
+'"$ONLY_C"'/%lang(C)/!d
+'"$NO_C"'/%lang(C)/d
s:%lang(C) ::
/^$/d' >> $MO_NAME_NEW
@@ -292,6 +316,8 @@ s:'"$TOP_DIR"'::
'"$ALL_NAME$MAN"'s:\(.*/man/\([^/_]\+\).*/man[a-z0-9]\+/\)::
'"$ALL_NAME$MAN"'s:\(.*/man/\([^/_]\+\).*/man[a-z0-9]\+$\):%lang(\2) \1*:
s:^\([^%].*\)::
+'"$ONLY_C"'/%lang(C)/!d
+'"$NO_C"'/%lang(C)/d
s:%lang(C) ::
/^$/d' >> $MO_NAME_NEW
@@ -299,6 +325,8 @@ find "$TOP_DIR" -type f -o -type l|sed -
s:'"$TOP_DIR"'::
'"$NO_ALL_NAME$MAN"'s:\(.*/man/\([^/_]\+\).*/man[a-z0-9]\+/'"$NAME"'\.[a-z0-9].*\):%lang(\2) \1*:
s:^\([^%].*\)::
+'"$ONLY_C"'/%lang(C)/!d
+'"$NO_C"'/%lang(C)/d
s:%lang(C) ::
/^$/d' >> $MO_NAME_NEW

29
libmagic-exceptions.patch Normal file
View File

@ -0,0 +1,29 @@
From 4e244280db8d780ac90313785598487f888b8924 Mon Sep 17 00:00:00 2001
From: Martin Liska <mliska@suse.cz>
Date: Wed, 15 Mar 2023 19:15:00 +0100
Subject: [PATCH] add more libmagic exceptions for HTML, SVG and PNG
I noticed there are ~150K .html files in all libreoffice rpm files
and the detection is significantly delaying package build. Thus, I
introduce more exceptions for commonly used file formats.
---
build/rpmfc.c | 3 +++
1 file changed, 3 insertions(+)
diff --git build/rpmfc.c build/rpmfc.c
index 763a68603..cd9e64348 100644
--- build/rpmfc.c
+++ build/rpmfc.c
@@ -1181,6 +1181,9 @@ static const struct skipped_extension_s skipped_extensions[] = {
{ ".h", "C Header", "text/x-c" },
{ ".la", "libtool library file", "text/plain" },
{ ".pc", "pkgconfig file", "text/plain" },
+ { ".html", "HTML document", "text/html" },
+ { ".png", "PNG image data", "image/png" },
+ { ".svg", "SVG Scalable Vector Graphics image", "image/svg+xml" },
{ NULL, NULL, NULL }
};
--
2.39.2

196
localetag.diff Normal file
View File

@ -0,0 +1,196 @@
Convert output to the current locale. Assumes utf8 input if the
decoding works, otherwise iso-8859-1.
--- lib/tagexts.c.orig 2021-06-21 12:00:44.615612184 +0000
+++ lib/tagexts.c 2021-09-23 18:58:58.461872258 +0000
@@ -2,6 +2,7 @@
* \file lib/formats.c
*/
+#include <wchar.h>
#include "system.h"
#include <rpm/rpmtypes.h>
@@ -197,6 +198,114 @@ typedef enum tMode_e {
TRANSFILETRIGGER = 2,
} tMode;
+static char * strtolocale(char *str)
+{
+ wchar_t *wstr, *wp;
+ const unsigned char *cp;
+ char *cc;
+ int state = 0;
+ int c;
+ int ccl, cca, mb_cur_max;
+ size_t l;
+ mbstate_t ps;
+ int strisutf8 = 1;
+ int locisutf8 = 1;
+
+ if (!str)
+ return 0;
+ if (!*str)
+ return str;
+ wstr = (wchar_t *)xmalloc((strlen(str) + 1) * sizeof(*wstr));
+ wp = wstr;
+ cp = (const unsigned char *)str;
+ while ((c = *cp++) != 0) {
+ if (state) {
+ if ((c & 0xc0) != 0x80) {
+ /* encoding error */
+ break;
+ }
+ c = (c & 0x3f) | (state << 6);
+ if (!(state & 0x40000000)) {
+ /* check for overlong sequences */
+ if ((c & 0x820823e0) == 0x80000000)
+ c = 0xfdffffff;
+ else if ((c & 0x020821f0) == 0x02000000)
+ c = 0xfff7ffff;
+ else if ((c & 0x000820f8) == 0x00080000)
+ c = 0xffffd000;
+ else if ((c & 0x0000207c) == 0x00002000)
+ c = 0xffffff70;
+ }
+ } else {
+ /* new sequence */
+ if (c >= 0xfe)
+ c = 0xfffd;
+ else if (c >= 0xfc)
+ c = (c & 0x01) | 0xbffffffc; /* 5 bytes to follow */
+ else if (c >= 0xf8)
+ c = (c & 0x03) | 0xbfffff00; /* 4 */
+ else if (c >= 0xf0)
+ c = (c & 0x07) | 0xbfffc000; /* 3 */
+ else if (c >= 0xe0)
+ c = (c & 0x0f) | 0xbff00000; /* 2 */
+ else if (c >= 0xc2)
+ c = (c & 0x1f) | 0xfc000000; /* 1 */
+ else if (c >= 0xc0)
+ c = 0xfdffffff; /* overlong */
+ else if (c >= 0x80)
+ c = 0xfffd;
+ }
+ state = (c & 0x80000000) ? c : 0;
+ if (state)
+ continue;
+ *wp++ = (wchar_t)c;
+ }
+ if (state) {
+ /* encoding error, assume latin1 */
+ strisutf8 = 0;
+ cp = (const unsigned char *)str;
+ wp = wstr;
+ while ((c = *cp++) != 0) {
+ *wp++ = (wchar_t)c;
+ }
+ }
+ *wp = 0;
+ mb_cur_max = MB_CUR_MAX;
+ memset(&ps, 0, sizeof(ps));
+ cc = xmalloc(mb_cur_max);
+ /* test locale encoding */
+ if (wcrtomb(cc, 0x20ac, &ps) != 3 || memcmp(cc, "\342\202\254", 3))
+ locisutf8 = 0;
+ if (locisutf8 == strisutf8) {
+ wstr = _free(wstr);
+ return str;
+ }
+ str = _free((char *)str);
+ memset(&ps, 0, sizeof(ps));
+ ccl = cca = 0;
+ for (wp = wstr; ; wp++) {
+ l = wcrtomb(cc + ccl, *wp, &ps);
+ if (*wp == 0)
+ break;
+ if (l == (size_t)-1) {
+ if (*wp < (wchar_t)256 && mbsinit(&ps)) {
+ cc[ccl] = *wp;
+ l = 1;
+ } else
+ l = wcrtomb(cc + ccl, (wchar_t)'?', &ps);
+ }
+ if (l == 0 || l == (size_t)-1)
+ continue;
+ ccl += l;
+ if (ccl > cca) {
+ cca = ccl + 16;
+ cc = xrealloc(cc, cca + mb_cur_max);
+ }
+ }
+ wstr = _free(wstr);
+ return (char *)cc;
+}
+
/**
* Retrieve trigger info.
* @param mode type of trigger (see tMode_e)
@@ -607,10 +716,41 @@ static int i18nTag(Header h, rpmTag tag,
#endif
rc = headerGet(h, tag, td, HEADERGET_ALLOC);
+ if (rc && td->data) {
+ td->data = strtolocale(td->data);
+ }
return rc;
}
/**
+ * Retrieve text and convert to locale.
+ */
+static int localeTag(Header h, rpmTag tag, rpmtd td)
+{
+ int rc;
+ rc = headerGet(h, tag, td, HEADERGET_ALLOC);
+ if (!rc)
+ return 0;
+ if (td->type == RPM_STRING_TYPE) {
+ td->data = strtolocale(td->data);
+ td->count = 1;
+ } else if (td->type == RPM_STRING_ARRAY_TYPE) {
+ char **arr;
+ int i;
+ arr = xmalloc(td->count * sizeof(*arr));
+ for (i = 0; i < td->count; i++) {
+ arr[i] = xstrdup(((char **)td->data)[i]);
+ arr[i] = strtolocale(arr[i]);
+ }
+ _free(td->data);
+ td->data = arr;
+ td->flags = RPMTD_ALLOCED | RPMTD_PTR_ALLOCED;
+ }
+ return rc;
+}
+
+
+/**
* Retrieve summary text.
* @param h header
* @param[out] td tag data container
@@ -634,6 +774,16 @@ static int descriptionTag(Header h, rpmt
return i18nTag(h, RPMTAG_DESCRIPTION, td, hgflags);
}
+static int changelognameTag(Header h, rpmtd td)
+{
+ return localeTag(h, RPMTAG_CHANGELOGNAME, td);
+}
+
+static int changelogtextTag(Header h, rpmtd td)
+{
+ return localeTag(h, RPMTAG_CHANGELOGTEXT, td);
+}
+
/**
* Retrieve group text.
* @param h header
@@ -971,6 +1121,8 @@ static const struct headerTagFunc_s rpmH
{ RPMTAG_LONGARCHIVESIZE, longarchivesizeTag },
{ RPMTAG_LONGSIZE, longsizeTag },
{ RPMTAG_LONGSIGSIZE, longsigsizeTag },
+ { RPMTAG_CHANGELOGNAME, changelognameTag },
+ { RPMTAG_CHANGELOGTEXT, changelogtextTag },
{ RPMTAG_DBINSTANCE, dbinstanceTag },
{ RPMTAG_EVR, evrTag },
{ RPMTAG_NVR, nvrTag },

140
macrosin.diff Normal file
View File

@ -0,0 +1,140 @@
Index: macros.in
===================================================================
--- macros.in.orig
+++ macros.in
@@ -148,6 +148,7 @@
%{?_unique_debug_names:--unique-debug-suffix "-%{VERSION}-%{RELEASE}.%{_arch}"} \\\
%{?_unique_debug_srcs:--unique-debug-src-base "%{name}-%{VERSION}-%{RELEASE}.%{_arch}"} \\\
%{?_find_debuginfo_dwz_opts} \\\
+ %{lua:if posix.access(rpm.expand("%_sourcedir/baselibs.conf"), "r") then print("--dwz-single-file-mode") end} \\\
%{?_find_debuginfo_opts} \\\
%{?_debugsource_packages:-S debugsourcefiles.list} \\\
"%{_builddir}/%{?buildsubdir}"\
@@ -187,7 +188,8 @@ package or when debugging this package.\
%endif\
%{nil}
-%_defaultdocdir %{_datadir}/doc
+%_defaultdocdir %{_datadir}/doc/packages
+%_docdir_fmt %%{NAME}
%_defaultlicensedir %{_datadir}/licenses
# Following macros for filtering auto deps must not be used in spec files.
@@ -247,7 +249,8 @@ package or when debugging this package.\
%_tmppath %{_var}/tmp
# Path to top of build area.
-%_topdir %{getenv:HOME}/rpmbuild
+%_topdir %{expand:%%global _topdir %{lua:if posix.access(rpm.expand("%{_usrsrc}/packages"), "w") then print "%{_usrsrc}/packages" else print "%{getenv:HOME}/rpmbuild" end} \
+}%_topdir
#==============================================================================
# ---- Optional rpmrc macros.
@@ -349,7 +352,7 @@ package or when debugging this package.\
# "w.ufdio" uncompressed
#
#%_source_payload w9.gzdio
-#%_binary_payload w9.gzdio
+%_binary_payload w19.zstdio
# Algorithm to use for generating file checksum digests on build.
# If not specified or 0, MD5 is used.
@@ -459,6 +462,19 @@ package or when debugging this package.\
#
#%_include_minidebuginfo 1
+# Number of debugging information entries (DIEs) above which
+# dwz will stop considering file for multifile optimizations
+# and enter a low memory mode, in which it will optimize
+# in about half the memory needed otherwise.
+%_dwz_low_mem_die_limit 10000000
+# Number of DIEs above which dwz will stop processing
+# a file altogether.
+%_dwz_max_die_limit 50000000
+
+%_find_debuginfo_dwz_opts --run-dwz\\\
+ --dwz-low-mem-die-limit %{_dwz_low_mem_die_limit}\\\
+ --dwz-max-die-limit %{_dwz_max_die_limit}
+
#
# Include a .gdb_index section in the .debug files.
# Requires _enable_debug_packages and gdb-add-index installed.
@@ -491,39 +507,39 @@ package or when debugging this package.\
# Same as for "separate" but if the __debug_package global is set then
# the -debuginfo package will have a compatibility link for the main
# ELF /usr/lib/debug/.build-id/xx/yyy -> /usr/lib/.build-id/xx/yyy
-%_build_id_links compat
+%_build_id_links alldebug
# Whether build-ids should be made unique between package version/releases
# when generating debuginfo packages. If set to 1 this will pass
# --build-id-seed "%{VERSION}-%{RELEASE}" to find-debuginfo.sh which will
# pass it onto debugedit --build-id-seed to be used to prime the build-id
# note hash.
-%_unique_build_ids 1
+#%_unique_build_ids 1
# Do not recompute build-ids but keep whatever is in the ELF file already.
# Cannot be used together with _unique_build_ids (which forces recomputation).
# Defaults to undefined (unset).
-#%_no_recompute_build_ids 1
+%_no_recompute_build_ids 1
# Whether .debug files should be made unique between package version,
# release and architecture. If set to 1 this will pass
# --unique-debug-suffix "-%{VERSION}-%{RELEASE}.%{_arch} find-debuginfo.sh
# to create debuginfo files which end in -<ver>-<rel>.<arch>.debug
# Requires _unique_build_ids.
-%_unique_debug_names 1
+#%_unique_debug_names 1
# Whether the /usr/debug/src/<package> directories should be unique between
# package version, release and architecture. If set to 1 this will pass
# --unique-debug-src-base "%{name}-%{VERSION}-%{RELEASE}.%{_arch}" to
# find-debuginfo.sh to name the directory under /usr/debug/src as
# <name>-<ver>-<rel>.<arch>.
-%_unique_debug_srcs 1
+#%_unique_debug_srcs 1
# Whether rpm should put debug source files into its own subpackage
-#%_debugsource_packages 1
+%_debugsource_packages 1
# Whether rpm should create extra debuginfo packages for each subpackage
-#%_debuginfo_subpackages 1
+%_debuginfo_subpackages 1
#
# Use internal dependency generator rather than external helpers?
@@ -542,6 +558,7 @@ package or when debugging this package.\
%__find_requires %{_rpmconfigdir}/find-requires
#%__find_conflicts ???
#%__find_obsoletes ???
+%__find_supplements %{_rpmconfigdir}/find-supplements
#
# Path to file attribute classifications for automatic dependency
@@ -926,7 +943,7 @@ package or when debugging this package.\
%_build_vendor %{_host_vendor}
%_build_os %{_host_os}
%_host @host@
-%_host_alias @host_alias@%{nil}
+%_host_alias @host@%{nil}
%_host_cpu @host_cpu@
%_host_vendor @host_vendor@
%_host_os @host_os@
@@ -1045,11 +1062,13 @@ package or when debugging this package.\
#------------------------------------------------------------------------------
# arch macro for all supported 32-bit ARM processors
-%arm32 armv3l armv4b armv4l armv4tl armv5tl armv5tel armv5tejl armv6l armv6hl armv7l armv7hl armv7hnl armv8l armv8hl armv8hnl armv8hcnl
+%arm32 armv3l armv4b armv4l armv4tl armv5b armv5l armv5teb armv5tel armv5tejl armv6l armv6hl armv7l armv7hl armv7hnl armv8l armv8hl armv8hnl armv8hcnl
#------------------------------------------------------------------------------
# arch macro for all supported 32-bit ARM processors (legacy, use %%arm32 instead)
%arm %{arm32}
+%arml armv3l armv4l armv5l armv5tel armv6l armv6hl armv7l armv7hl armv7hnl armv8l armv8hl armv8hnl armv8hcnl
+%armb armv4b armv5b armv5teb
#------------------------------------------------------------------------------
# arch macro for all supported 64-bit ARM processors

View File

@ -0,0 +1,68 @@
--- lib/rpmdb.c.orig 2020-11-27 13:09:17.968992873 +0000
+++ lib/rpmdb.c 2020-11-27 13:14:21.524165780 +0000
@@ -2679,6 +2679,48 @@ int rpmdbCtrl(rpmdb db, rpmdbCtrlOp ctrl
return dbctrl ? dbCtrl(db, dbctrl) : 1;
}
+const unsigned char *rpmdbNextIteratorHeaderBlob(rpmdbMatchIterator mi, unsigned int *size)
+{
+ dbiIndex dbi = NULL;
+ unsigned char * uh;
+ unsigned int uhlen;
+ int rc;
+ if (mi == NULL || mi->mi_re != NULL)
+ return NULL;
+ if (pkgdbOpen(mi->mi_db, 0, &dbi))
+ return NULL;
+ if (mi->mi_dbc == NULL)
+ mi->mi_dbc = dbiCursorInit(dbi, mi->mi_cflags);
+ miFreeHeader(mi, dbi);
+ uh = NULL;
+ uhlen = 0;
+ do {
+ if (mi->mi_set) {
+ if (!(mi->mi_setx < mi->mi_set->count))
+ return NULL;
+ mi->mi_offset = dbiIndexRecordOffset(mi->mi_set, mi->mi_setx);
+ mi->mi_filenum = dbiIndexRecordFileNumber(mi->mi_set, mi->mi_setx);
+ } else {
+ rc = pkgdbGet(dbi, mi->mi_dbc, 0, &uh, &uhlen);
+ if (rc == 0)
+ mi->mi_offset = pkgdbKey(dbi, mi->mi_dbc);
+
+ /* Terminate on error or end of keys */
+ if (rc || (mi->mi_setx && mi->mi_offset == 0))
+ return NULL;
+ }
+ mi->mi_setx++;
+ } while (mi->mi_offset == 0);
+ if (uh == NULL) {
+ rc = pkgdbGet(dbi, mi->mi_dbc, mi->mi_offset, &uh, &uhlen);
+ if (rc || uh == NULL)
+ return NULL;
+ }
+ if (size)
+ *size = uhlen;
+ return uh;
+}
+
char *rpmdbCookie(rpmdb db)
{
void *cookie = NULL;
--- include/rpm/rpmdb.h.orig 2020-11-27 13:09:17.968992873 +0000
+++ include/rpm/rpmdb.h 2020-11-27 13:09:36.352942782 +0000
@@ -253,6 +253,14 @@ int rpmdbStat(const char *prefix, struct
*/
int rpmdbFStat(rpmdb db, struct stat *statbuf);
+/** \ingroup rpmdb
+ * Return next unverified package header blob from iteration.
+ * @param mi rpm database iterator
+ * @retval size header blob size in bytes
+ * @return NULL on end of iteration.
+ */
+const unsigned char *rpmdbNextIteratorHeaderBlob(rpmdbMatchIterator mi, unsigned int *size);
+
#ifdef __cplusplus
}
#endif

14
nobuildcolor.diff Normal file
View File

@ -0,0 +1,14 @@
Disable file coloring for SUSE systems
--- build/rpmfc.c.orig 2020-09-30 13:06:07.502865543 +0000
+++ build/rpmfc.c 2020-09-30 13:07:08.530734545 +0000
@@ -1607,7 +1607,8 @@ rpmRC rpmfcGenerateDepends(const rpmSpec
goto exit;
/* Add per-file colors(#files) */
- headerPutUint32(pkg->header, RPMTAG_FILECOLORS, fc->fcolor, fc->nfiles);
+ if (rpmExpandNumeric("%{?_transaction_color}") != 0)
+ headerPutUint32(pkg->header, RPMTAG_FILECOLORS, fc->fcolor, fc->nfiles);
/* Add classes(#classes) */
for (rpmsid id = 1; id <= rpmstrPoolNumStr(fc->cdict); id++) {

13
nomagiccheck.diff Normal file
View File

@ -0,0 +1,13 @@
Don't let rpm complain about a missing /etc/magic.mgc file
--- build/rpmfc.c.orig 2020-09-30 13:08:18.770584384 +0000
+++ build/rpmfc.c 2020-09-30 13:08:54.306508417 +0000
@@ -1159,7 +1159,7 @@ static uint32_t getElfColor(const char *
rpmRC rpmfcClassify(rpmfc fc, ARGV_t argv, rpm_mode_t * fmode)
{
- int msflags = MAGIC_CHECK | MAGIC_COMPRESS | MAGIC_NO_CHECK_TOKENS | MAGIC_ERROR;
+ int msflags = MAGIC_COMPRESS | MAGIC_NO_CHECK_TOKENS | MAGIC_ERROR;
int mimeflags = msflags | MAGIC_MIME_TYPE;
int nerrors = 0;
rpmRC rc = RPMRC_FAIL;

20
noprereqdeprec.diff Normal file
View File

@ -0,0 +1,20 @@
--- build/parsePreamble.c.orig 2019-10-02 11:38:15.807736662 +0000
+++ build/parsePreamble.c 2019-10-02 11:39:12.495617575 +0000
@@ -1032,7 +1032,7 @@ static struct PreambleRec_s const preamb
{RPMTAG_SUGGESTNAME, 0, 0, 0, LEN_AND_STR("suggests")},
{RPMTAG_SUPPLEMENTNAME, 0, 0, 0, LEN_AND_STR("supplements")},
{RPMTAG_ENHANCENAME, 0, 0, 0, LEN_AND_STR("enhances")},
- {RPMTAG_PREREQ, 2, 1, 0, LEN_AND_STR("prereq")},
+ {RPMTAG_PREREQ, 2, 0, 0, LEN_AND_STR("prereq")},
{RPMTAG_CONFLICTNAME, 0, 0, 0, LEN_AND_STR("conflicts")},
{RPMTAG_OBSOLETENAME, 0, 0, 0, LEN_AND_STR("obsoletes")},
{RPMTAG_PREFIXES, 0, 0, 1, LEN_AND_STR("prefixes")},
@@ -1041,7 +1041,7 @@ static struct PreambleRec_s const preamb
{RPMTAG_BUILDARCHS, 0, 0, 0, LEN_AND_STR("buildarchitectures")},
{RPMTAG_BUILDARCHS, 0, 0, 0, LEN_AND_STR("buildarch")},
{RPMTAG_BUILDCONFLICTS, 0, 0, 0, LEN_AND_STR("buildconflicts")},
- {RPMTAG_BUILDPREREQ, 0, 1, 0, LEN_AND_STR("buildprereq")},
+ {RPMTAG_BUILDPREREQ, 0, 0, 0, LEN_AND_STR("buildprereq")},
{RPMTAG_BUILDREQUIRES, 0, 0, 0, LEN_AND_STR("buildrequires")},
{RPMTAG_AUTOREQPROV, 0, 0, 0, LEN_AND_STR("autoreqprov")},
{RPMTAG_AUTOREQ, 0, 0, 0, LEN_AND_STR("autoreq")},

33
platformin.diff Normal file
View File

@ -0,0 +1,33 @@
--- platform.in.orig 2014-06-26 06:51:54.822818260 +0000
+++ platform.in 2014-08-04 12:38:55.389245494 +0000
@@ -41,7 +41,7 @@
%_oldincludedir @oldincludedir@
%_infodir @infodir@
%_mandir @mandir@
-%_initddir %{_sysconfdir}/rc.d/init.d
+%_initddir %{_sysconfdir}/init.d
# Deprecated misspelling, present for backwards compatibility.
%_initrddir %{_initddir}
%_rundir @RUNDIR@
@@ -83,3 +83,21 @@
@apple@#
@apple@%_use_internal_dependency_generator 0
@apple@%__so dylib
+@suse@#---------------------------------------------------------------------
+@suse@# Expanded at end of %prep
+@suse@#
+@suse@%__id_u %{__id} -u
+@suse@%__chown_Rhf %{__chown} -Rhf
+@suse@%__chgrp_Rhf %{__chgrp} -Rhf
+@suse@%_fixowner [ `%{__id_u}` = '0' ] && %{__chown_Rhf} root
+@suse@%_fixgroup [ `%{__id_u}` = '0' ] && %{__chgrp_Rhf} root
+@suse@%_fixperms %{__chmod} -Rf a+rX,u+w,g-w,o-w
+@suse@
+@suse@#---------------------------------------------------------------------
+@suse@# Expanded at start of %build
+@suse@#
+@suse@%__spec_build_pre %{___build_pre}\
+@suse@%{?buildroot: %__rm -rf "$RPM_BUILD_ROOT"\
+@suse@ %__mkdir_p `dirname "$RPM_BUILD_ROOT"`\
+@suse@ %__mkdir "$RPM_BUILD_ROOT"\
+@suse@}

376
posttrans.diff Normal file
View File

@ -0,0 +1,376 @@
--- include/rpm/rpmcli.h.orig 2022-04-07 11:13:18.983517774 +0000
+++ include/rpm/rpmcli.h 2022-12-02 13:43:44.899359176 +0000
@@ -306,6 +306,7 @@ enum rpmInstallFlags_e {
INSTALL_ALLMATCHES = (1 << 9), /*!< from --allmatches */
INSTALL_REINSTALL = (1 << 10), /*!< from --reinstall */
INSTALL_RESTORE = (1 << 11), /*!< from --restore */
+ INSTALL_RUNPOSTTRANS = (1 << 12), /*!< from --runposttrans */
};
typedef rpmFlags rpmInstallFlags;
@@ -396,6 +397,15 @@ int rpmErase(rpmts ts, struct rpmInstall
int rpmRestore(rpmts ts, struct rpmInstallArguments_s * ia, ARGV_const_t argv);
/** \ingroup rpmcli
+ * Run posttrans scriptlets
+ * @param ts transaction set
+ * @param ia control args/bits
+ * @param argv array of trigger manifest file names (NULL terminated)
+ * @return 0 on success
+ */
+int rpmRunPostTrans(rpmts ts, struct rpmInstallArguments_s * ia, ARGV_const_t argv);
+
+/** \ingroup rpmcli
*/
extern struct rpmInstallArguments_s rpmIArgs;
--- include/rpm/rpmts.h.orig 2022-12-02 13:27:05.109729552 +0000
+++ include/rpm/rpmts.h 2022-12-02 13:27:08.881720646 +0000
@@ -249,6 +249,15 @@ int rpmtsOrder(rpmts ts);
int rpmtsRun(rpmts ts, rpmps okProbs, rpmprobFilterFlags ignoreSet);
/** \ingroup rpmts
+ * Run all posttrans scriptlets described in the manifest data.
+ *
+ * @param ts transaction set
+ * @param manifest the manifest data
+ * @return 0 on success, -1 on error
+ */
+int rpmtsRunPostTrans(rpmts ts, ARGV_const_t manifest);
+
+/** \ingroup rpmts
* Reference a transaction set instance.
* @param ts transaction set
* @return new transaction set reference
--- lib/poptI.c.orig 2022-04-07 11:13:19.010517957 +0000
+++ lib/poptI.c 2022-12-02 13:27:08.877720656 +0000
@@ -273,6 +273,10 @@ struct poptOption rpmInstallPoptTable[]
&rpmIArgs.installInterfaceFlags, (INSTALL_RESTORE),
N_("restore package(s)"),
N_("<packagefile>+") },
+ { "runposttrans", '\0', POPT_BIT_SET,
+ &rpmIArgs.installInterfaceFlags, INSTALL_RUNPOSTTRANS,
+ N_("run posttrans scriptlet"),
+ N_("<posttransmanifest>") },
POPT_TABLEEND
};
--- lib/psm.c.orig 2022-12-02 13:27:05.093729590 +0000
+++ lib/psm.c 2022-12-02 13:27:08.877720656 +0000
@@ -826,7 +826,7 @@ static rpmRC rpmPackageErase(rpmts ts, r
}
if (rc) break;
- if (!(rpmtsFlags(ts) & (RPMTRANS_FLAG_NOPOSTTRANS|RPMTRANS_FLAG_NOTRIGGERPOSTUN))) {
+ if (ts->dump_posttrans || !(rpmtsFlags(ts) & (RPMTRANS_FLAG_NOPOSTTRANS|RPMTRANS_FLAG_NOTRIGGERPOSTUN))) {
/* Prepare post transaction uninstall triggers */
rpmtriggersPrepPostUnTransFileTrigs(psm->ts, psm->te);
}
--- lib/rpminstall.c.orig 2022-09-02 05:48:29.712846716 +0000
+++ lib/rpminstall.c 2022-12-02 13:27:08.877720656 +0000
@@ -6,6 +6,8 @@
#include <string.h>
+#include <errno.h>
+
#include <rpm/rpmcli.h>
#include <rpm/rpmtag.h>
#include <rpm/rpmlib.h> /* rpmReadPackageFile, vercmp etc */
@@ -812,3 +814,32 @@ int rpmInstallSource(rpmts ts, const cha
return rc;
}
+int rpmRunPostTrans(rpmts ts, struct rpmInstallArguments_s * ia, ARGV_const_t fileArgv)
+{
+ ARGV_t manifest = NULL;
+ FILE *f;
+ char line[BUFSIZ], *s, *p;
+ int rc = 1;
+
+ if (fileArgv == NULL) return 0;
+ if (!fileArgv[0] || fileArgv[1] != NULL) {
+ rpmlog(RPMLOG_ERR, _("runposttrans needs exactly one manifest file\n"));
+ goto exit;
+ }
+ if (!(f = fopen(fileArgv[0], "r"))) {
+ rpmlog(RPMLOG_ERR, _("cannot open %s: %s\n"), fileArgv[0], strerror(errno));
+ goto exit;
+ }
+ while ((s = fgets(line, sizeof(line) - 1, f)) != 0) {
+ if (p = strrchr(s, '\n'))
+ *p = 0;
+ argvAdd(&manifest, s);
+ }
+ fclose(f);
+ rpmlog(RPMLOG_DEBUG, "running posttrans scriptlets\n");
+ rpmtsClean(ts);
+ rc = rpmtsRunPostTrans(ts, manifest);
+exit:
+ argvFree(manifest);
+ return rc;
+}
--- lib/rpmtriggers.c.orig 2022-04-07 11:13:19.020518024 +0000
+++ lib/rpmtriggers.c 2022-12-02 13:27:08.877720656 +0000
@@ -1,5 +1,6 @@
#include "system.h"
+#include <rpm/rpmlog.h>
#include <rpm/rpmts.h>
#include <rpm/rpmdb.h>
#include <rpm/rpmds.h>
@@ -34,7 +35,7 @@ rpmtriggers rpmtriggersFree(rpmtriggers
return NULL;
}
-static void rpmtriggersAdd(rpmtriggers trigs, unsigned int hdrNum,
+void rpmtriggersAdd(rpmtriggers trigs, unsigned int hdrNum,
unsigned int tix, unsigned int priority)
{
if (trigs->count == trigs->alloced) {
@@ -178,6 +179,14 @@ int runPostUnTransFileTrigs(rpmts ts)
if (trigH == NULL)
continue;
+ if (ts->dump_posttrans) {
+ char *trigNEVRA = headerGetAsString(trigH, RPMTAG_NEVRA);
+ rpmlog(RPMLOG_NOTICE, "dump_posttrans: transfiletriggerpostun %u %u %s\n", trigs->triggerInfo[i].tix, trigs->triggerInfo[i].hdrNum, trigNEVRA);
+ free(trigNEVRA);
+ headerFree(trigH);
+ continue;
+ }
+
/* Prepare and run script */
script = rpmScriptFromTriggerTag(trigH,
triggertag(RPMSENSE_TRIGGERPOSTUN),
@@ -587,6 +596,16 @@ rpmRC runImmedFileTriggers(rpmts ts, rpm
rpmTagVal priorityTag;
rpmtriggers triggers;
+ if (sense == RPMSENSE_TRIGGERIN && tm == RPMSCRIPT_TRANSFILETRIGGER && ts->dump_posttrans) {
+ unsigned int hdrNum = headerGetInstance(trigH);
+ if (hdrNum) {
+ char *trigNEVRA = headerGetAsString(trigH, RPMTAG_NEVRA);
+ rpmlog(RPMLOG_NOTICE, "dump_posttrans: install %u %s\n", hdrNum, trigNEVRA);
+ free(trigNEVRA);
+ }
+ headerFree(trigH);
+ return RPMRC_OK;
+ }
if (tm == RPMSCRIPT_FILETRIGGER) {
priorityTag = RPMTAG_FILETRIGGERPRIORITIES;
} else {
--- lib/rpmtriggers.h.orig 2022-04-07 11:13:19.020518024 +0000
+++ lib/rpmtriggers.h 2022-12-02 13:27:08.881720646 +0000
@@ -27,6 +27,10 @@ rpmtriggers rpmtriggersCreate(unsigned i
RPM_GNUC_INTERNAL
rpmtriggers rpmtriggersFree(rpmtriggers triggers);
+RPM_GNUC_INTERNAL
+void rpmtriggersAdd(rpmtriggers trigs, unsigned int hdrNum,
+ unsigned int tix, unsigned int priority);
+
/*
* Prepare post trans uninstall file triggers. After transcation uninstalled
* files are not saved anywhere. So we need during uninstalation of every
--- lib/rpmts_internal.h.orig 2022-04-07 11:13:19.021518031 +0000
+++ lib/rpmts_internal.h 2022-12-02 13:44:39.803225928 +0000
@@ -94,6 +94,8 @@ struct rpmts_s {
int min_writes; /*!< macro minimize_writes used */
time_t overrideTime; /*!< Time value used when overriding system clock. */
+
+ int dump_posttrans; /*!< macro dump_posttrans used */
};
#ifdef __cplusplus
--- lib/transaction.c.orig 2022-08-30 11:42:23.784853830 +0000
+++ lib/transaction.c 2022-12-02 13:27:08.881720646 +0000
@@ -1478,6 +1478,8 @@ static int rpmtsSetup(rpmts ts, rpmprobF
/* Get available space on mounted file systems. */
(void) rpmtsInitDSI(ts);
+ /* Initialize the dump_posttrans flag */
+ ts->dump_posttrans = (rpmExpandNumeric("%{?_dump_posttrans}") > 0);
return 0;
}
@@ -1856,22 +1858,26 @@ int rpmtsRun(rpmts ts, rpmps okProbs, rp
/* Actually install and remove packages */
nfailed = rpmtsProcess(ts);
+ if (ts->dump_posttrans) {
+ rpmlog(RPMLOG_NOTICE, "dump_posttrans: enabled\n");
+ }
+
/* Run %posttrans scripts unless disabled */
- if (!(rpmtsFlags(ts) & (RPMTRANS_FLAG_NOPOSTTRANS))) {
+ if (!ts->dump_posttrans && !(rpmtsFlags(ts) & (RPMTRANS_FLAG_NOPOSTTRANS))) {
rpmlog(RPMLOG_DEBUG, "running post-transaction scripts\n");
runTransScripts(ts, PKG_POSTTRANS);
}
/* Run %transfiletriggerpostun scripts unless disabled */
- if (!(rpmtsFlags(ts) & (RPMTRANS_FLAG_NOPOSTTRANS|RPMTRANS_FLAG_NOTRIGGERIN))) {
+ if (!ts->dump_posttrans && !(rpmtsFlags(ts) & (RPMTRANS_FLAG_NOPOSTTRANS|RPMTRANS_FLAG_NOTRIGGERIN))) {
runFileTriggers(ts, NULL, RPMSENSE_TRIGGERIN, RPMSCRIPT_TRANSFILETRIGGER, 0);
}
- if (!(rpmtsFlags(ts) & (RPMTRANS_FLAG_NOPOSTTRANS|RPMTRANS_FLAG_NOTRIGGERPOSTUN))) {
+ if (ts->dump_posttrans || !(rpmtsFlags(ts) & (RPMTRANS_FLAG_NOPOSTTRANS|RPMTRANS_FLAG_NOTRIGGERPOSTUN))) {
runPostUnTransFileTrigs(ts);
}
/* Run %transfiletriggerin scripts unless disabled */
- if (!(rpmtsFlags(ts) & (RPMTRANS_FLAG_NOPOSTTRANS|RPMTRANS_FLAG_NOTRIGGERIN))) {
+ if (ts->dump_posttrans || !(rpmtsFlags(ts) & (RPMTRANS_FLAG_NOPOSTTRANS|RPMTRANS_FLAG_NOTRIGGERIN))) {
runTransScripts(ts, PKG_TRANSFILETRIGGERIN);
}
/* Final exit code */
@@ -1894,3 +1900,110 @@ exit:
sigaction(SIGPIPE, &oact, NULL);
return rc;
}
+
+static unsigned int runPostTransFindPkgNum(const char **lpp)
+{
+ const char *lp = *lpp;
+ unsigned int num = strtoul(lp, 0, 10);
+ while (*lp >= '0' && *lp <= '9')
+ lp++;
+ while (*lp == ' ')
+ lp++;
+ *lpp = lp;
+ return num;
+}
+
+static Header runPostTransFindPkg(rpmts ts, const char *lp)
+{
+ rpmdbMatchIterator mi;
+ Header h = NULL;
+ unsigned int hdrnum = runPostTransFindPkgNum(&lp);
+ if (!*lp)
+ return NULL;
+ if (hdrnum) {
+ mi = rpmtsInitIterator(ts, RPMDBI_PACKAGES, &hdrnum, sizeof(hdrnum));
+ h = headerLink(rpmdbNextIterator(mi));
+ rpmdbFreeIterator(mi);
+ }
+ if (h) {
+ char *NEVRA = headerGetAsString(h, RPMTAG_NEVRA);
+ if (!NEVRA || strcmp(NEVRA, lp) != 0)
+ h = headerFree(h);
+ _free(NEVRA);
+ }
+ if (!h) {
+ mi = rpmtsInitIterator(ts, RPMDBI_LABEL, lp, strlen(lp));
+ h = headerLink(rpmdbNextIterator(mi));
+ rpmdbFreeIterator(mi);
+ }
+ if (!h)
+ rpmlog(RPMLOG_WARNING, "package %s is not installed\n", lp);
+ return h;
+}
+
+int rpmtsRunPostTrans(rpmts ts, ARGV_const_t manifest)
+{
+ int rc = -1; /* assume failure */
+ /* setup */
+ tsMembers tsmem = rpmtsMembers(ts);
+ rpmtxn txn = NULL;
+ /* Ignore SIGPIPE for the duration of transaction */
+ rpmsqAction_t oact = rpmsqSetAction(SIGPIPE, RPMSQ_IGN);
+ /* Force default 022 umask during transaction for consistent results */
+ mode_t oldmask = umask(022);
+
+ if (tsmem->orderCount)
+ goto exit;
+ char *line;
+ while ((line = *manifest++) != 0) {
+ if (!strncmp(line, "dump_posttrans: install ", 24)) {
+ const char *lp = line + 24;
+ Header h = runPostTransFindPkg(ts, lp);
+ if (!h)
+ continue;
+ rpmte p = rpmteNew(ts, h, TR_ADDED, line + 45, NULL, RPMTE_INSTALL);
+ if (tsmem->orderCount >= tsmem->orderAlloced) {
+ tsmem->orderAlloced += (tsmem->orderCount - tsmem->orderAlloced) + tsmem->delta;
+ tsmem->order = xrealloc(tsmem->order, tsmem->orderAlloced * sizeof(*tsmem->order));
+ }
+ tsmem->order[tsmem->orderCount++] = p;
+
+ if (tsmem->addedPackages == NULL)
+ tsmem->addedPackages = rpmalCreate(ts, 5);
+ rpmalAdd(tsmem->addedPackages, p);
+ packageHashAddEntry(tsmem->installedPackages, headerGetInstance(h), p);
+ } else if (!strncmp(line, "dump_posttrans: transfiletriggerpostun ", 39)) {
+ const char *lp = line + 39;
+ unsigned int tix = runPostTransFindPkgNum(&lp);
+ Header h = runPostTransFindPkg(ts, lp);
+ struct rpmtd_s priorities;
+ if (!h)
+ continue;
+ headerGet(h, RPMTAG_TRANSFILETRIGGERPRIORITIES, &priorities, HEADERGET_MINMEM);
+ if (rpmtdSetIndex(&priorities, tix) >= 0)
+ rpmtriggersAdd(ts->trigs2run, headerGetInstance(h), tix, *rpmtdGetUint32(&priorities));
+ headerFree(h);
+ }
+ }
+
+ if (!(txn = rpmtxnBegin(ts, RPMTXN_WRITE)))
+ goto exit;
+
+ /* run posttrans scripts */
+ rpmlog(RPMLOG_DEBUG, "running post-transaction scripts\n");
+ runTransScripts(ts, PKG_POSTTRANS);
+ /* run %transfiletriggerin scripts */
+ runFileTriggers(ts, NULL, RPMSENSE_TRIGGERIN, RPMSCRIPT_TRANSFILETRIGGER, 0);
+ /* run %transfiletriggerpostun scrips */
+ runPostUnTransFileTrigs(ts);
+ /* Run immed %transfiletriggerin scripts */
+ runTransScripts(ts, PKG_TRANSFILETRIGGERIN);
+ rc = 0;
+
+exit:
+ (void) umask(oldmask);
+ rpmtxnEnd(txn);
+ rpmsqSetAction(SIGPIPE, oact);
+ rpmtsEmpty(ts);
+ return rc;
+}
--- rpm.c.orig 2022-04-07 11:13:19.067518343 +0000
+++ rpm.c 2022-12-02 13:55:52.969592594 +0000
@@ -21,6 +21,7 @@ enum modes {
MODE_ERASE = (1 << 2),
MODE_RESTORE = (1 << 4),
#define MODES_IE (MODE_INSTALL | MODE_ERASE)
+ MODE_RUNPOSTTRANS = (1 << 5),
MODE_UNKNOWN = 0
};
@@ -115,6 +116,11 @@ int main(int argc, char *argv[])
int eflags = (ia->installInterfaceFlags & INSTALL_ERASE);
int rflags = (ia->installInterfaceFlags & INSTALL_RESTORE);
+ if (ia->installInterfaceFlags & INSTALL_RUNPOSTTRANS) {
+ if (iflags || eflags || rflags)
+ argerror(_("only one major mode may be specified"));
+ bigMode = MODE_RUNPOSTTRANS;
+ }
if (iflags & eflags & rflags)
argerror(_("only one major mode may be specified"));
else if (iflags)
@@ -293,6 +299,14 @@ int main(int argc, char *argv[])
ec = rpmcliVerify(ts, qva, (ARGV_const_t) poptGetArgs(optCon));
} break;
+ case MODE_RUNPOSTTRANS:
+ if (!poptPeekArg(optCon)) {
+ argerror(_("need posttrans manifest for --runposttrans"));
+ } else {
+ ec += rpmRunPostTrans(ts, ia, (ARGV_const_t) poptGetArgs(optCon));
+ }
+ break;
+
case MODE_UNKNOWN:
if (poptPeekArg(optCon) != NULL || argc <= 1) {
printUsage(optCon, stderr, 0);

211
python-rpm.changes Normal file
View File

@ -0,0 +1,211 @@
-------------------------------------------------------------------
Tue May 30 09:07:28 UTC 2023 - Jiri Srain <jsrain@suse.com>
- add _multibuild for multiple .spec-files
-------------------------------------------------------------------
Fri Dec 2 15:09:55 CET 2022 - mls@suse.de
- update to rpm-4.18.0
------------------------------------------------------------------
Thu Jul 21 16:11:22 CEST 2022 - mls@suse.de
- update to rpm-4.17.1
-------------------------------------------------------------------
Thu Sep 23 20:57:45 CEST 2021 - mls@suse.de
- update to rpm-4.17.0
-------------------------------------------------------------------
Tue Mar 30 11:15:44 CEST 2021 - mls@suse.de
- update to rpm-4.16.1.3
-------------------------------------------------------------------
Wed Sep 30 14:17:40 CEST 2020 - mls@suse.de
- update to rpm-4.16.0
-------------------------------------------------------------------
Tue Nov 19 11:09:08 CET 2019 - mls@suse.de
- update to rpm-4.15.1
-------------------------------------------------------------------
Wed Oct 2 14:53:19 CEST 2019 - mls@suse.de
- update to rpm-4.15.0
-------------------------------------------------------------------
Thu Nov 22 09:50:36 UTC 2018 - asmorodskyi@suse.com
- Fix python-module compatibility with older distros
-------------------------------------------------------------------
Fri Apr 6 14:11:01 CEST 2018 - mls@suse.de
- remove rpmlint-Factory buildignore
-------------------------------------------------------------------
Tue Mar 20 13:59:45 UTC 2018 - tchvatal@suse.com
- Switch really to singlespec thus allowing us to build without
python2-devel present in the distribution
-------------------------------------------------------------------
Wed Jan 31 14:45:33 CET 2018 - mls@suse.de
- update to rpm-4.14.1
-------------------------------------------------------------------
Tue Dec 19 09:39:25 UTC 2017 - jengelh@inai.de
- Update RPM groups
-------------------------------------------------------------------
Sat Oct 28 12:19:34 UTC 2017 - ngompa13@gmail.com
- Add a comment to note that prep and build stages come from rpm.spec
-------------------------------------------------------------------
Mon Oct 16 13:49:18 UTC 2017 - ngompa13@gmail.com
- Properly quote the conditional for Obsoletes+Provides
-------------------------------------------------------------------
Sun Oct 15 04:03:00 UTC 2017 - ngompa13@gmail.com
- Unify rpm-python and python3-rpm into singlespec
- Switch the build to use setuptools-based build, so that
the Python module is properly built with all its metadata
-------------------------------------------------------------------
Wed Nov 20 14:41:34 CET 2013 - mls@suse.de
- adapt to python-3.3, which no longer looks at XXXmodule.so
-------------------------------------------------------------------
Fri Jul 12 15:36:43 CEST 2013 - mls@suse.de
- update to rpm-4.11.1
-------------------------------------------------------------------
Wed Jan 2 14:25:20 UTC 2013 - dmueller@suse.com
- Update to 4.10.2
-------------------------------------------------------------------
Mon Apr 23 11:16:26 CEST 2012 - mls@suse.de
- modified capsule api diff to match rpm upstream
-------------------------------------------------------------------
Wed Apr 11 16:54:02 UTC 2012 - klaussfreire@gmail.com
- Fix usage of deprecated AsVoidPtr Python/C API,
replaced by Capsule API
-------------------------------------------------------------------
Tue Jan 17 10:28:42 UTC 2012 - saschpe@suse.de
- Spec file cleanup:
* Don't rm -rf %{buildroot}
* Removed %clean section
* Removed authors from description
-------------------------------------------------------------------
Sun Dec 11 09:28:28 UTC 2011 - coolo@suse.com
- add libtool as explicit buildrequire
-------------------------------------------------------------------
Wed Feb 23 14:01:41 CET 2011 - mls@suse.de
- drop standard python directories from filelist [bnc#229189]
-------------------------------------------------------------------
Fri Oct 22 15:52:32 UTC 2010 - coolo@novell.com
- adapt second spec file to changes done to rpm.spec
-------------------------------------------------------------------
Mon Oct 18 11:03:53 CEST 2010 - dmueller@suse.de
- adapt buildrequires
-------------------------------------------------------------------
Thu Feb 12 16:52:26 CET 2009 - ro@suse.de
- adapt buildrequires
-------------------------------------------------------------------
Wed Oct 8 11:24:22 CEST 2008 - cthiel@suse.de
- added libelf-devel to BuildRequires to fix build
-------------------------------------------------------------------
Thu Sep 11 15:33:52 CEST 2008 - mls@suse.de
- update to 4.4.2.3 to get rid of >50 patches
-------------------------------------------------------------------
Sat Aug 30 21:23:38 CEST 2008 - cthiel@suse.de
- add libselinux-devel to BuildRequires
-------------------------------------------------------------------
Thu Aug 7 16:05:51 CEST 2008 - dmueller@suse.de
- fix build against python 2.6
-------------------------------------------------------------------
Thu Mar 27 14:47:18 CET 2008 - coolo@suse.de
- fix buildrequires
-------------------------------------------------------------------
Fri May 25 16:20:53 CEST 2007 - mls@suse.de
- fix unicode queries
-------------------------------------------------------------------
Fri Mar 30 15:06:28 CEST 2007 - rguenther@suse.de
- add ncurses-devel and zlib-devel BuildRequires.
-------------------------------------------------------------------
Wed Oct 18 22:59:02 CEST 2006 - mls@suse.de
- use rpm.spec for building instead of duplication everything
- delete superfluous .a and .la files [#202604]
- create .pyc and .pyo files [#205711]
-------------------------------------------------------------------
Sun Oct 15 23:41:37 CEST 2006 - schwab@suse.de
- Make sure config.rpath is present.
-------------------------------------------------------------------
Fri Sep 22 08:58:57 CEST 2006 - aj@suse.de
- Fix for python2.5.
-------------------------------------------------------------------
Thu Sep 21 11:41:04 CEST 2006 - lnussel@suse.de
- do not package beecrypt python bindings as libbeecrypt is not
packaged either
- fix literal %{version} in Requires tag
-------------------------------------------------------------------
Thu Sep 21 10:58:42 CEST 2006 - lnussel@suse.de
- fix build with python 2.5 by overriding autodetection
-------------------------------------------------------------------
Tue Sep 19 13:48:27 CEST 2006 - rguenther@suse.de
- split from rpm package

81
python-rpm.spec Normal file
View File

@ -0,0 +1,81 @@
#
# spec file for package python-rpm
#
# Copyright (c) 2023 SUSE LLC
# Copyright (c) 2017 Neal Gompa <ngompa13@gmail.com>.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
# Please submit bugfixes or comments via https://bugs.opensuse.org/
#
# Enable Python build sourced from rpm spec
%global with_python 1
%{?!python_module:%define python_module() python-%{**} python3-%{**}}
Name: python-rpm
Version: 4.18.0
Release: 0
Summary: Python Bindings for Manipulating RPM Packages
License: GPL-2.0-or-later
Group: Development/Libraries/Python
URL: https://rpm.org/
#Git-Clone: https://github.com/rpm-software-management/rpm
BuildRequires: %{python_module devel}
BuildRequires: file-devel
BuildRequires: libacl-devel
BuildRequires: libbz2-devel
BuildRequires: libcap-devel
BuildRequires: libelf-devel
BuildRequires: libgcrypt-devel
BuildRequires: libselinux-devel
BuildRequires: libsemanage-devel
BuildRequires: libtool
BuildRequires: lua-devel
BuildRequires: ncurses-devel
BuildRequires: popt-devel
BuildRequires: python-rpm-macros
BuildRequires: xz-devel
BuildRequires: zlib-devel
BuildRequires: pkgconfig(libzstd)
Requires: rpm = %{version}
%{expand:%(sed -n -e '/^Source:/,/^BuildRoot:/p' <%{_sourcedir}/rpm.spec)}
Source99: rpm.spec
%if "%{python_flavor}" == "python2"
Obsoletes: rpm-python < %{version}-%{release}
Provides: rpm-python = %{version}-%{release}
%endif
%python_subpackages
%description
This package contains a module that permits applications written in
the Python programming language to use the interface supplied by
RPM Package Manager libraries.
This package should be installed if you want to develop Python programs
that will manipulate RPM packages and databases.
%prep
%{expand:%(sed -n -e '/^%%prep/,/^%%install/p' <%{_sourcedir}/rpm.spec | sed -e '1d' -e '$d')}
# The build stage is already declared and pulled in from rpm.spec
pushd python
%python_build
popd
%install
pushd python
%python_install
popd
%files %{python_files}
%{python_sitearch}/rpm*
%changelog

16
refreshtestarch.diff Normal file
View File

@ -0,0 +1,16 @@
Also test architecture in "refresh" test when not colored. This allows
updates to different architectures.
--- lib/psm.c.orig 2019-10-02 09:54:56.180565818 +0000
+++ lib/psm.c 2019-10-02 09:55:02.700552941 +0000
@@ -518,9 +518,9 @@ static void markReplacedInstance(rpmts t
rpmdbSetIteratorRE(mi, RPMTAG_EPOCH, RPMMIRE_STRCMP, rpmteE(te));
rpmdbSetIteratorRE(mi, RPMTAG_VERSION, RPMMIRE_STRCMP, rpmteV(te));
rpmdbSetIteratorRE(mi, RPMTAG_RELEASE, RPMMIRE_STRCMP, rpmteR(te));
+ rpmdbSetIteratorRE(mi, RPMTAG_ARCH, RPMMIRE_STRCMP, rpmteA(te));
/* XXX shouldn't we also do this on colorless transactions? */
if (rpmtsColor(ts)) {
- rpmdbSetIteratorRE(mi, RPMTAG_ARCH, RPMMIRE_STRCMP, rpmteA(te));
rpmdbSetIteratorRE(mi, RPMTAG_OS, RPMMIRE_STRCMP, rpmteO(te));
}

View File

@ -0,0 +1,27 @@
From 224095542246e762617d38e2096fdeba13d266e3 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Dirk=20M=C3=BCller?= <dirk@dmllr.de>
Date: Tue, 8 Aug 2023 13:53:38 +0200
Subject: [PATCH] Rewrite --last to just use sed for formatting
This is the only dependency on awk in the runtime commandline part of
rpm, which is bloating minimal container images a bit. We can rewrite
that into a single sed statement. We love you anyway, awk.
---
rpmpopt.in | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/rpmpopt.in b/rpmpopt.in
index 8022b0f54a..1223e1a862 100644
--- ./rpmpopt.in
+++ ./rpmpopt.in
@@ -133,8 +133,8 @@ rpm alias --filetriggerscripts --qf '\
rpm alias --filetriggers --filetriggerscripts \
--POPTdesc=$"list filetrigger scriptlets from package(s)"
-rpm alias --last --qf '%|INSTALLTIME?{%{INSTALLTIME}}:{000000000}| %{NVRA} %|INSTALLTIME?{%{INSTALLTIME:date}}:{(not installed)}|\n' \
- --pipe "LC_NUMERIC=C sort -r -n | sed 's,^[0-9]\+ ,,' | awk '{printf(\"%-45s %-s\n\", $1, substr($0,length($1)+2))}' " \
+rpm alias --last --qf '%|INSTALLTIME?{%{INSTALLTIME}}:{000000000}| %-45{NVRA} %|INSTALLTIME?{%{INSTALLTIME:date}}:{(not installed)}|\n' \
+ --pipe "LC_NUMERIC=C sort -r -n | sed 's,^[0-9]\+ ,,' " \
--POPTdesc=$"list package(s) by install time, most recent first"
rpm alias --dupes --qf '%|SOURCERPM?{%{name}.%{arch}}:{%|ARCH?{%{name}}:{%{name}-%{version}}|}|\n' --pipe "sort | uniq -d" \

16
remove-brp-strips.diff Normal file
View File

@ -0,0 +1,16 @@
Subject: remove references to removed brp scripts
Some brp-scripts are not used in openSUSE, remove references
to it
--- platform.in.orig 2021-09-23 19:23:57.822814696 +0000
+++ platform.in 2021-09-23 19:24:31.534745951 +0000
@@ -96,8 +96,6 @@
%{?__brp_compress} \
%{?__brp_elfperms} \
%{?__brp_strip} \
- %{?__brp_strip_static_archive} \
- %{?__brp_strip_comment_note} \
%{?__brp_remove_la_files} \
%{nil}

28
remove-translations.diff Normal file
View File

@ -0,0 +1,28 @@
Index: scripts/find-lang.sh
===================================================================
--- scripts/find-lang.sh.orig
+++ scripts/find-lang.sh
@@ -134,6 +134,23 @@ fi
MO_NAME_NEW=$MO_NAME.tmp.$$
rm -f $MO_NAME_NEW
+# remove languages we do not yet support - but give out statistics
+test -d "$TOP_DIR/usr/share/locale/" && find "$TOP_DIR/usr/share/locale/" -maxdepth 1 -type d | sed 's:'"$TOP_DIR"/usr/share/locale/'::; /^$/d' | while read dir; do
+ if ! rpm -ql filesystem | grep -E -q "/usr/share/locale/$dir"$; then
+ find $TOP_DIR/usr/share/locale/$dir -name *.mo | sed 's:'"$TOP_DIR"'::' | while read file; do
+ echo -n "removing translation $file: "
+ msgunfmt "$TOP_DIR/$file" | msgfmt --statistics -o /dev/null -
+ done
+ rm -rf $TOP_DIR/usr/share/locale/$dir
+ fi
+done
+test -d "$TOP_DIR/usr/share/help/" && find $TOP_DIR/usr/share/help/ -maxdepth 1 -type d | sed 's:'"$TOP_DIR"/usr/share/help/'::; /^$/d' | while read dir; do
+ if ! rpm -ql filesystem | grep -E -q "/usr/share/help/$dir"$; then
+ echo "removing help translation /usr/share/help/$dir"
+ rm -rf $TOP_DIR/usr/share/help/$dir
+ fi
+done
+
for NAME in ${NAMES[@]}; do
find "$TOP_DIR" -type f -o -type l|sed '

BIN
rpm-4.18.0.tar.bz2 (Stored with Git LFS) Normal file

Binary file not shown.

View File

@ -0,0 +1,55 @@
--- scripts/find-lang.sh.orig 2018-01-31 13:37:22.810352621 +0000
+++ scripts/find-lang.sh 2018-01-31 13:39:38.117990971 +0000
@@ -32,6 +32,7 @@ Additional options:
--with-man find localized man pages
--all-name match all package/domain names
--without-mo do not find locale files
+ --metainfo create a metainfo.xml file for AppStream
EOF
exit 1
}
@@ -62,6 +63,7 @@ ALL_NAME=#
NO_ALL_NAME=
ONLY_C=#
NO_C=#
+METAINFO=#
while test $# -gt 0 ; do
case "${1}" in
--with-gnome )
@@ -113,6 +115,11 @@ while test $# -gt 0 ; do
NO_C=
shift
;;
+ --metainfo )
+ METAINFO=
+ METADESKID=${2}
+ shift 2
+ ;;
* )
if [ $MO_NAME != ${NAMES[$#]}.lang ]; then
NAMES[${#NAMES[@]}]=$MO_NAME
@@ -323,6 +330,24 @@ if ! grep -q / $MO_NAME_NEW; then
exit 1
fi
+if [ -z "${METAINFO}" ] ; then
+ # create a metainfo.xml file for METADESKID
+ mkdir -p ${TOP_DIR}/usr/share/appdata
+ cat > ${TOP_DIR}/usr/share/appdata/${METADESKID}-lang.metainfo.xml <<EOF
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- Copyright 2016 openSUSE - file is auto-generated -->
+<component type="addon">
+ <id>${METADESKID}-lang</id>
+ <extends>${METADESKID}.desktop</extends>
+ <name>Translations</name>
+ <summary>Translate the user interface</summary>
+ <metadata_license>CC0-1.0</metadata_license>
+ <updatecontact>https://bugzilla.opensuse.org</updatecontact>
+</component>
+EOF
+ echo /usr/share/appdata/${METADESKID}-lang.metainfo.xml >> $MO_NAME_NEW
+fi
+
sort -u $MO_NAME_NEW >> $MO_NAME
rm -f $MO_NAME_NEW

100
rpm-shorten-changelog.diff Normal file
View File

@ -0,0 +1,100 @@
--- build/pack.c.orig
+++ build/pack.c
@@ -683,6 +683,71 @@
return rc;
}
+static void trimChangelog(Header h)
+{
+ static int oneshot;
+ static int cuttime, minnum, maxnum;
+ rpm_count_t i, keep;
+ struct rpmtd_s timestd, namestd, textstd;
+ rpm_count_t count;
+
+ if (!oneshot) {
+ char *binarychangelogtrim = rpmExpand("%{?_binarychangelogtrim}", NULL);
+ oneshot = 1;
+ if (binarychangelogtrim && *binarychangelogtrim) {
+ maxnum = atoi(binarychangelogtrim);
+ binarychangelogtrim = strchr(binarychangelogtrim, ',');
+ if (binarychangelogtrim)
+ binarychangelogtrim++;
+ }
+ if (binarychangelogtrim && *binarychangelogtrim) {
+ cuttime = atoi(binarychangelogtrim);
+ binarychangelogtrim = strchr(binarychangelogtrim, ',');
+ if (binarychangelogtrim)
+ binarychangelogtrim++;
+ }
+ if (binarychangelogtrim && *binarychangelogtrim) {
+ minnum = atoi(binarychangelogtrim);
+ binarychangelogtrim = strchr(binarychangelogtrim, ',');
+ }
+ }
+ if (!cuttime && !minnum && !maxnum) {
+ return;
+ }
+
+ if (!headerGet(h, RPMTAG_CHANGELOGTIME, &timestd, HEADERGET_MINMEM))
+ return;
+ count = rpmtdCount(&timestd);
+ if ((!cuttime || count <= minnum) && (!maxnum || count <= maxnum)) {
+ rpmtdFreeData(&timestd);
+ return;
+ }
+ keep = count;
+ if (maxnum && keep > maxnum)
+ keep = maxnum;
+ if (cuttime) {
+ for (i = 0; i < keep; i++) {
+ uint32_t *tp = rpmtdNextUint32(&timestd);
+ if (i >= minnum && tp && *tp < cuttime)
+ break;
+ }
+ keep = i;
+ }
+ if (keep >= count) {
+ rpmtdFreeData(&timestd);
+ return;
+ }
+ headerGet(h, RPMTAG_CHANGELOGNAME, &namestd, HEADERGET_MINMEM);
+ headerGet(h, RPMTAG_CHANGELOGTEXT, &textstd, HEADERGET_MINMEM);
+ timestd.count = namestd.count = textstd.count = keep;
+ headerMod(h, &timestd);
+ headerMod(h, &namestd);
+ headerMod(h, &textstd);
+ rpmtdFreeData(&textstd);
+ rpmtdFreeData(&namestd);
+ rpmtdFreeData(&timestd);
+}
+
static rpmRC packageBinary(rpmSpec spec, Package pkg, const char *cookie, int cheating, char** filename)
{
rpmRC rc = RPMRC_OK;
@@ -699,7 +764,10 @@
/* Copy changelog from src rpm */
#pragma omp critical
- headerCopyTags(spec->sourcePackage->header, pkg->header, copyTags);
+ {
+ headerCopyTags(spec->sourcePackage->header, pkg->header, copyTags);
+ trimChangelog(pkg->header);
+ }
headerPutString(pkg->header, RPMTAG_RPMVERSION, VERSION);
headerPutString(pkg->header, RPMTAG_BUILDHOST, spec->buildHost);
--- build/parseChangelog.c.orig
+++ build/parseChangelog.c
@@ -267,6 +267,11 @@
goto exit;
}
+ /* workaround old suse oddity */
+ if (*s == '-' && s[1] == ' ') {
+ s += 2;
+ }
+
/* name */
name = s;
while (*s != '\0') s++;

4720
rpm.changes Normal file

File diff suppressed because it is too large Load Diff

483
rpm.spec Normal file
View File

@ -0,0 +1,483 @@
#
# spec file for package rpm
#
# Copyright (c) 2023 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
# Please submit bugfixes or comments via https://bugs.opensuse.org/
#
#Compat macro for new _fillupdir macro introduced in Nov 2017
%{?!_fillupdir:%define _fillupdir /var/adm/fillup-templates}
%global librpmsover 9
Name: rpm
BuildRequires: binutils
BuildRequires: bzip2
BuildRequires: file-devel
BuildRequires: findutils
BuildRequires: gcc
BuildRequires: gettext-devel
BuildRequires: glibc-devel
BuildRequires: gzip
BuildRequires: libacl-devel
BuildRequires: libbz2-devel
BuildRequires: libcap-devel
BuildRequires: libdw-devel
BuildRequires: libelf-devel
BuildRequires: libgcrypt-devel
BuildRequires: libselinux-devel
BuildRequires: libsemanage-devel
BuildRequires: libtool
BuildRequires: lua-devel
BuildRequires: make
BuildRequires: ncurses-devel
BuildRequires: patch
BuildRequires: perl-base
BuildRequires: popt-devel
BuildRequires: rpm-build
BuildRequires: xz-devel
BuildRequires: pkgconfig(libzstd)
BuildRequires: pkgconfig(zlib)
#!BuildIgnore: rpmlint-Factory
Provides: rpminst
Requires(post): %fillup_prereq
Requires: rpm-config-SUSE
Summary: The RPM Package Manager
License: GPL-2.0-or-later
Group: System/Packages
Version: 4.18.0
Release: 0
URL: https://rpm.org/
#Git-Clone: https://github.com/rpm-software-management/rpm
Source: http://ftp.rpm.org/releases/rpm-4.17.x/rpm-%{version}.tar.bz2
Source5: rpmsort
Source8: rpmconfigcheck
Source9: sysconfig.services-rpm
Source12: baselibs.conf
Source13: rpmconfigcheck.service
# quilt patches start here
Patch5: usr-lib-sysimage-rpm.patch
Patch13: ignore-auxv.diff
Patch12: localetag.diff
Patch18: refreshtestarch.diff
Patch24: brp.diff
Patch25: brpcompress.diff
Patch26: checkfilesnoinfodir.diff
Patch29: findlang.diff
Patch30: macrosin.diff
Patch32: platformin.diff
Patch33: rpmpopt.diff
Patch34: rpmrc.diff
Patch36: rpmqpack.diff
Patch38: build.diff
Patch43: rpm-shorten-changelog.diff
Patch46: remove-brp-strips.diff
Patch51: specfilemacro.diff
Patch60: safeugid.diff
Patch61: noprereqdeprec.diff
Patch66: remove-translations.diff
Patch67: headeradddb.diff
Patch69: nobuildcolor.diff
Patch70: fileattrs.diff
Patch71: nomagiccheck.diff
Patch73: assumeexec.diff
Patch77: langnoc.diff
Patch78: headerchk2.diff
Patch85: brp-compress-no-img.patch
Patch93: weakdepscompat.diff
Patch94: checksepwarn.diff
Patch99: enable-postin-scripts-error.diff
Patch100: rpm-findlang-inject-metainfo.patch
Patch102: emptymanifest.diff
Patch103: find-lang-qt-qm.patch
Patch117: findsupplements.diff
Patch122: db_conversion.diff
Patch123: nextiteratorheaderblob.diff
Patch131: posttrans.diff
Patch133: zstdpool.diff
Patch134: zstdthreaded.diff
Patch135: selinux_transactional_update.patch
Patch136: x86_64-microarchitectures.patch
Patch137: cpuid_lzcnt.patch
Patch138: libmagic-exceptions.patch
Patch139: remove-awk-dependency.patch
# touches a generated file
Patch180: whatrequires-doc.diff
Patch6464: auto-config-update-aarch64-ppc64le.diff
BuildRoot: %{_tmppath}/%{name}-%{version}-build
#
# avoid bootstrapping problem
%define _binary_payload w9.bzdio
%description
RPM Package Manager is the main tool for managing the software packages
of the SUSE Linux distribution.
RPM can be used to install and remove software packages. With rpm, it
is easy to update packages. RPM keeps track of all these manipulations
in a central database. This way it is possible to get an overview of
all installed packages. RPM also supports database queries.
%package -n librpmbuild%{librpmsover}
Summary: Library for building RPM packages
# Was part of rpm before
Group: System/Libraries
Conflicts: rpm < %{version}
%description -n librpmbuild%{librpmsover}
Thie package contains a library with functions for building RPM packages.
%package devel
Summary: Development files for librpm
Group: Development/Libraries/C and C++
Requires: rpm = %{version}
# for people confusing the one with the other
Recommends: rpm-build = %{version}
Requires: popt-devel
%description devel
This package contains the RPM C library and header files. These
development files will simplify the process of writing programs which
manipulate RPM packages and databases and are intended to make it
easier to create graphical package managers or any other tools that
need an intimate knowledge of RPM packages in order to function.
%package build
Summary: Tools and Scripts to create rpm packages
Group: System/Packages
Requires: librpmbuild%{librpmsover} = %{version}
Requires: rpm = %{version}
Provides: rpm:%_bindir/rpmbuild
Provides: rpmbuild
# SUSE's build essentials
Requires: binutils
Requires: bzip2
Requires: coreutils
Requires: diffutils
Requires: dwz
Requires: file
Requires: findutils
Requires: gawk
Requires: gcc
#Requires: gcc-PIE
Requires: /usr/bin/gzip
Requires: gettext-tools
Requires: glibc-devel
Requires: glibc-locale-base
Requires: grep
Requires: make
Requires: patch
Requires: sed
Requires: systemd-rpm-macros
Requires: tar
Requires: util-linux
Requires: which
Requires: xz
# needed for debuginfo generation
Requires: debugedit = 5.0
# drop candidates
Requires: cpio
Requires: file
# Mandatory generators
Requires: (%{name}-build-perl if perl-base)
Requires: (%{name}-build-python if python3-base)
# The point of the split
Conflicts: rpm < 4.15.0
%description build
If you want to build a rpm, you need this package. It provides rpmbuild
and requires some packages that are usually required.
%package build-perl
Summary: RPM dependency generator for Perl
Group: Development/Languages/Perl
Requires: perl-base
%description build-perl
Provides and requires generator for .pl files and modules.
%prep
%setup -q -n rpm-%{version}
rm -rf sqlite
%patch -P 5 -P 12 -P 13 -P 18
%patch -P 24 -P 25 -P 26 -P 29
%patch -P 30 -P 32 -P 33 -P 34 -P 36 -P 38
%patch -P 43 -P 46
%patch -P 51
%patch -P 60 -P 61 -P 66 -P 67 -P 69
%patch -P 70 -P 71 -P 73 -P 77 -P 78
%patch -P 85
%patch -P 93 -P 94 -P 99
%patch -P 100 -P 102 -P 103
%patch -P 117
%patch -P 122 -P 123
%patch -P 131 -P 133 -P 134 -P 135 -P 136 -P 137 -P 138 -P 139
%patch -P 180
%ifarch aarch64 ppc64le riscv64
%patch6464
%endif
rm -f m4/libtool.m4
rm -f m4/lt*.m4
%build
export CFLAGS="%{optflags} -ffunction-sections"
export LDFLAGS="-Wl,-Bsymbolic-functions -ffunction-sections"
%ifarch alpha
export CFLAGS="-g -O0 -fno-strict-aliasing -ffunction-sections"
%endif
%ifarch %arm
BUILDTARGET="--build=%{_target_cpu}-suse-linux-gnueabi"
%elifarch x86_64 %x86_64
BUILDTARGET="--build=x86_64-suse-linux"
%else
BUILDTARGET="--build=%{_target_cpu}-suse-linux"
%endif
export __FIND_DEBUGINFO=/usr/lib/rpm/find-debuginfo
autoreconf -fi
./configure --disable-dependency-tracking --prefix=%{_prefix} --mandir=%{_mandir} --infodir=%{_infodir} \
--libdir=%{_libdir} --sysconfdir=/etc --localstatedir=/var --sharedstatedir=/var/lib \
--with-lua \
--with-vendor=suse \
--with-rundir=/run \
--without-archive \
--with-selinux \
--with-crypto=libgcrypt \
--with-acl \
--with-cap \
--enable-shared \
--enable-ndb \
--enable-bdb-ro \
--enable-zstd \
--enable-sqlite=no \
%{?with_python: --enable-python} \
$BUILDTARGET
rm po/de.gmo
make %{?_smp_mflags}
%install
mkdir -p %{buildroot}/usr/lib
mkdir -p %{buildroot}/usr/share/locale
ln -s ../share/locale %{buildroot}/usr/lib/locale
%make_install
mkdir -p %{buildroot}/bin
%if 0%{?suse_version} < 1550
ln -s /usr/bin/rpm %{buildroot}/bin/rpm
%endif
# remove .la file and the static variant of libpopt
# have to remove the dependency from other .la files as well
for f in %{buildroot}/%{_libdir}/*.la; do
sed -i -e "s,/%_lib/libpopt.la,-lpopt,g" $f
done
mkdir -p %{buildroot}/usr/sbin
install -m 755 %{SOURCE8} %{buildroot}/usr/sbin
mkdir -p %{buildroot}/usr/lib/systemd/system
install -m 644 %{SOURCE13} %{buildroot}/usr/lib/systemd/system/
mkdir -p %{buildroot}/usr/lib/rpm/macros.d
mkdir -p %{buildroot}/usr/lib/rpm/suse
for d in BUILD RPMS SOURCES SPECS SRPMS BUILDROOT ; do
mkdir -p %{buildroot}/usr/src/packages/$d
chmod 755 %{buildroot}/usr/src/packages/$d
done
for d in %{buildroot}/usr/lib/rpm/platform/*-linux/macros ; do
dd=${d%%-linux/macros}
dd=${dd##*/}
mkdir %{buildroot}/usr/src/packages/RPMS/$dd
chmod 755 %{buildroot}/usr/src/packages/RPMS/$dd
done
mkdir -p %{buildroot}/usr/lib/sysimage/rpm
gzip -9 %{buildroot}/%{_mandir}/man[18]/*.[18]
export RPM_BUILD_ROOT
%ifarch s390x
[ -f scripts/brp-%_arch-linux ] && sh scripts/brp-%_arch-linux
%endif
rm -f %{buildroot}/usr/lib/rpmpopt
rm -rf %{buildroot}%{_mandir}/{fr,ja,ko,pl,ru,sk}
rm -f %{buildroot}%{_prefix}/share/locale/de/LC_MESSAGES/rpm.mo
mkdir -p %{buildroot}%{_fillupdir}
install -c -m0644 %{SOURCE9} %{buildroot}%{_fillupdir}/
rm -f %{buildroot}/usr/lib/rpm/cpanflute %{buildroot}/usr/lib/rpm/cpanflute2
install -m 755 %{SOURCE5} %{buildroot}/usr/lib/rpm
rm -f %{buildroot}/usr/lib/locale %{buildroot}/usr/lib/rpmrc
mkdir -p %{buildroot}/etc/rpm
chmod 755 %{buildroot}/etc/rpm
# remove some nonsense or non-working scripts
pushd %{buildroot}/usr/lib/rpm/
for f in rpm2cpio.sh rpm.daily rpmdiff* rpm.log rpm.xinetd freshen.sh u_pkg.sh \
ocaml-find-provides.sh ocaml-find-requires.sh fileattrs/ocaml.attr \
magic magic.mgc magic.mime* rpmfile *.pl javadeps brp-redhat \
brp-strip-static-archive vpkg-provides*.sh http.req sql.req tcl.req \
brp-sparc64-linux brp-strip-comment-note brp-java-gcjcompile
do
rm -f $f
done
for i in /usr/share/automake-*/*; do
if test -f "$i" && test -f "${i##*/}"; then
rm -f "${i##*/}"
fi
done
popd
%ifarch aarch64 ppc64le riscv64
install -m 755 build-aux/config.guess %{buildroot}/usr/lib/rpm
install -m 755 build-aux/config.sub %{buildroot}/usr/lib/rpm
%endif
rm -rf %{buildroot}/%{_libdir}/python%{py_ver}
rm -f %{buildroot}%{_libdir}/*.la
rm -f %{buildroot}%{_libdir}/rpm-plugins/*.la
bash %{buildroot}/usr/lib/rpm/find-lang.sh %{buildroot} rpm
# On arm the kernel architecture is ignored. Not the best idea, but lets stay compatible with other distros
%ifarch armv7hl armv6hl
# rpm is using the host_cpu as default for the platform, but armv6/7hl is not known by the kernel.
# so we need to enforce the platform here.
echo -n "%{_target_cpu}-suse-linux-gnueabi" > %{buildroot}/etc/rpm/platform
%endif
# make ndb the default database backend
echo "setting the default database backend to 'ndb'"
sed -i -e '/_db_backend/s/sqlite/ndb/' %{buildroot}/usr/lib/rpm/macros
%post
%{fillup_only -an services}
# var/lib/rpm migration: set forwards compatible symlink for /usr/lib/sysimage/rpm so scriptlets in same transaction will still work
if test ! -L var/lib/rpm -a ! -f usr/lib/sysimage/rpm/Packages -a ! -f usr/lib/sysimage/rpm/Packages.db ; then
if test -f var/lib/rpm/Packages -o -f var/lib/rpm/Packages.db ; then
rmdir usr/lib/sysimage/rpm
ln -s ../../../var/lib/rpm usr/lib/sysimage/rpm
fi
fi
test -f usr/lib/sysimage/rpm/Packages -o -f usr/lib/sysimage/rpm/Packages.db || rpmdb --initdb
test -e var/lib/rpm || ln -s ../../usr/lib/sysimage/rpm var/lib/rpm
%posttrans
# var/lib/rpm migration
if test ! -L var/lib/rpm ; then
# delete no longer maintained databases
rm -f var/lib/rpm/Filemd5s var/lib/rpm/Filedigests var/lib/rpm/Requireversion var/lib/rpm/Provideversion
if test -f var/lib/rpm/Packages -o -f var/lib/rpm/Packages.db ; then
echo "migrating rpmdb from /var/lib/rpm to /usr/lib/sysimage/rpm..."
# remove forwards compatible symlink
if test -L usr/lib/sysimage/rpm ; then
rm -f usr/lib/sysimage/rpm
mkdir -p usr/lib/sysimage/rpm
fi
mv -f var/lib/rpm/.[!.]* usr/lib/sysimage/rpm/
mv -f var/lib/rpm/* usr/lib/sysimage/rpm/
fi
test -d var/lib/rpm && rmdir var/lib/rpm
test -e var/lib/rpm || ln -s ../../usr/lib/sysimage/rpm var/lib/rpm
fi
%files -f rpm.lang
%defattr(-,root,root)
%license COPYING
%doc docs/manual
/etc/rpm
%if 0%{?suse_version} < 1550
/bin/rpm
%endif
%{_bindir}/gendiff
%{_bindir}/rpm
%{_bindir}/rpm2cpio
%{_bindir}/rpmdb
%{_bindir}/rpmgraph
%{_bindir}/rpmkeys
%{_bindir}/rpmlua
%{_bindir}/rpmqpack
%{_bindir}/rpmquery
%{_bindir}/rpmsign
%{_bindir}/rpmverify
/usr/sbin/rpmconfigcheck
/usr/lib/systemd/system/rpmconfigcheck.service
%dir /usr/lib/rpm
/usr/lib/rpm/macros
/usr/lib/rpm/macros.d/
/usr/lib/rpm/platform/
/usr/lib/rpm/rpm.supp
/usr/lib/rpm/rpmdb_*
/usr/lib/rpm/rpmpopt-*
/usr/lib/rpm/rpmrc
/usr/lib/rpm/rpmsort
/usr/lib/rpm/rpmuncompress
/usr/lib/rpm/rpm_macros_provides.sh
/usr/lib/rpm/suse
/usr/lib/rpm/tgpg
%{_libdir}/rpm-plugins
%{_libdir}/librpm.so.*
%{_libdir}/librpmio.so.*
%{_libdir}/librpmsign.so.*
%doc %{_mandir}/man[18]/*.[18]*
%dir /usr/lib/sysimage
%dir /usr/lib/sysimage/rpm
%ghost /var/lib/rpm
%dir %attr(755,root,root) /usr/src/packages/BUILD
%dir %attr(755,root,root) /usr/src/packages/SPECS
%dir %attr(755,root,root) /usr/src/packages/SOURCES
%dir %attr(755,root,root) /usr/src/packages/SRPMS
%dir %attr(755,root,root) /usr/src/packages/RPMS
%dir %attr(755,root,root) /usr/src/packages/BUILDROOT
%dir %attr(755,root,root) /usr/src/packages/RPMS/*
%{_fillupdir}/sysconfig.services-rpm
%files -n librpmbuild%{librpmsover}
%{_libdir}/librpmbuild.so.%{librpmsover}
%{_libdir}/librpmbuild.so.%{librpmsover}.*
%files build
%defattr(-,root,root)
/usr/bin/rpmbuild
/usr/lib/rpm/pkgconfigdeps.sh
/usr/lib/rpm/ocamldeps.sh
/usr/lib/rpm/elfdeps
/usr/lib/rpm/rpmdeps
/usr/bin/rpmspec
/usr/lib/rpm/brp-*
/usr/lib/rpm/check-*
/usr/lib/rpm/*find*
/usr/lib/rpm/fileattrs/
%exclude /usr/lib/rpm/fileattrs/perl*.attr
/usr/lib/rpm/*.prov
%exclude /usr/lib/rpm/perl.prov
/usr/lib/rpm/*.req
%exclude /usr/lib/rpm/perl.req
%ifarch aarch64 ppc64le riscv64
/usr/lib/rpm/config.guess
/usr/lib/rpm/config.sub
%endif
%files build-perl
%defattr(-,root,root)
/usr/lib/rpm/fileattrs/perl*.attr
/usr/lib/rpm/perl.prov
/usr/lib/rpm/perl.req
%files devel
%defattr(644,root,root,755)
/usr/include/rpm
%{_libdir}/librpm.so
%{_libdir}/librpmbuild.so
%{_libdir}/librpmio.so
%{_libdir}/librpmsign.so
%{_libdir}/pkgconfig/rpm.pc
%changelog

49
rpmconfigcheck Normal file
View File

@ -0,0 +1,49 @@
#! /bin/sh
# Copyright (c) 2002 SUSE GmbH Nuernberg, Germany.
#
# Author: Michael Schroeder <feedback@suse.de>
#
# Script to scan for unresolved .rpmnew, .rpmorig, and .rpmsave files
#
configcheckfile=/var/adm/rpmconfigcheck
packages=/var/lib/rpm/Packages.db
if test -s $packages -a \( ! -e $configcheckfile -o -s $configcheckfile -o ! $packages -ot $configcheckfile \) ; then
echo "Searching for unresolved configuration files"
if test ! -e $configcheckfile -o ! $packages -ot $configcheckfile ; then
test -e $configcheckfile && mv -f $configcheckfile $configcheckfile.old
rpm -qalc | sort | while read line; do
for suffix in new orig save; do
[ -e "${line}.rpm${suffix}" ] && echo "${line}.rpm${suffix}"
done
done > $configcheckfile
else
mv -f $configcheckfile $configcheckfile.old
while read l; do
test -e $l && echo $l
done < $configcheckfile.old > $configcheckfile
fi
if test -s $configcheckfile; then
echo "Please check the following files (see /var/adm/rpmconfigcheck):"
sed -e 's/^/ /' < $configcheckfile
touch $configcheckfile.old
cat $configcheckfile $configcheckfile.old | sort | uniq -d > $configcheckfile.dup
cat $configcheckfile $configcheckfile.dup | sort | uniq -u > $configcheckfile.new
if test -s $configcheckfile.new ; then
(
echo "----------------------------------------------------------------------"
echo "----------------------------------------------------------------------"
echo "rpmconfigcheck"
date
echo "----------------------------------------"
echo "This is a warning message."
echo "rpmconfigcheck has found the following new unresolved config files"
echo "(all files are listed in /var/adm/rpmconfigcheck):"
cat $configcheckfile.new
echo "----------------------------------------"
) >> /var/log/update-messages
fi
fi
rm -f $configcheckfile.old $configcheckfile.dup $configcheckfile.new
fi

10
rpmconfigcheck.service Normal file
View File

@ -0,0 +1,10 @@
[Unit]
Description=Scan for unresolved .rpmnew, .rpmorig, and .rpmsave files
After=local-fs.target
[Service]
Type=oneshot
ExecStart=/usr/sbin/rpmconfigcheck
[Install]
WantedBy=default.target

12
rpmpopt.diff Normal file
View File

@ -0,0 +1,12 @@
--- rpmpopt.in.orig 2017-12-01 14:58:11.404041985 +0000
+++ rpmpopt.in 2017-12-01 14:59:06.275882759 +0000
@@ -101,7 +101,8 @@ Relocations : %|PREFIXES?{[%{PREFIXES} ]
%|URL?{URL : %{URL}\n}|\
%|BUGURL?{Bug URL : %{BUGURL}\n}|\
Summary : %{SUMMARY}\n\
-Description :\n%{DESCRIPTION}\n' \
+Description :\n%{DESCRIPTION}\n\
+Distribution: %{DISTRIBUTION}\n' \
--POPTdesc=$"list descriptive information from package(s)"
rpm alias --changelog --qf '[* %{CHANGELOGTIME:day} %{CHANGELOGNAME}\n%{CHANGELOGTEXT}\n\n]' \

115
rpmqpack.diff Normal file
View File

@ -0,0 +1,115 @@
--- Makefile.am.orig 2022-08-30 11:42:23.754853580 +0000
+++ Makefile.am 2022-12-02 13:15:01.631426573 +0000
@@ -186,6 +186,10 @@ rpmgraph_LDADD = lib/librpm.la rpmio/lib
dist_bin_SCRIPTS = scripts/gendiff
+bin_PROGRAMS += rpmqpack
+rpmqpack_SOURCES = rpmqpack.c
+rpmqpack_LDADD = lib/librpm.la
+
rpmconfig_DATA = rpmrc
rpmrc: $(top_srcdir)/rpmrc.in
@$(SED) \
--- docs/man/Makefile.am.orig 2022-04-07 11:13:18.958517604 +0000
+++ docs/man/Makefile.am 2022-12-02 13:16:00.071289072 +0000
@@ -9,7 +9,7 @@ EXTRA_DIST += gendiff.1.md
man_man8dir = $(mandir)/man8
man_man8_DATA = rpm.8 rpm-misc.8 rpmbuild.8 rpmdeps.8 rpmgraph.8 rpm2cpio.8
-man_man8_DATA += rpmdb.8 rpmkeys.8 rpmsign.8 rpmspec.8 rpmlua.8
+man_man8_DATA += rpmdb.8 rpmkeys.8 rpmsign.8 rpmspec.8 rpmlua.8 rpmqpack.8
EXTRA_DIST += rpm.8.md rpm-misc.8.md rpmbuild.8.md rpmdeps.8.md rpmgraph.8.md
EXTRA_DIST += rpm2cpio.8.md rpmdb.8.md rpmkeys.8.md rpmsign.8.md rpmspec.8.md
--- docs/man/rpmqpack.8.orig 2022-12-02 13:15:01.635426563 +0000
+++ docs/man/rpmqpack.8 2022-12-02 13:15:01.635426563 +0000
@@ -0,0 +1,25 @@
+.TH RPMQPACK 8 "Mar 2002"
+.SH NAME
+rpmqpack \- check for installed rpm packages
+
+.SH SYNOPSIS
+.B rpmqpack
+.RI [ pack1 "] [" pack2 ]...
+
+.SH DESCRIPTION
+rpmqpack checks if packages given as arguments are installed in
+the system. It prints each installed package to stdout.
+If no arguments are given all installed packages are printed.
+
+.SH EXIT STATUS
+rpmqpack returns 0 if all given packages are installed, otherwise
+1.
+
+.SH SEE ALSO
+.BR rpm (1)
+
+.SH COPYRIGHT
+2002 SUSE Linux AG Nuernberg, Germany.
+
+.SH AUTHOR
+Michael Schroeder <mls@suse.de>
--- rpmqpack.c.orig 2022-12-02 13:15:01.635426563 +0000
+++ rpmqpack.c 2022-12-02 13:15:01.635426563 +0000
@@ -0,0 +1,60 @@
+#include <sys/types.h>
+#include <limits.h>
+#include <fcntl.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include <rpm/rpmts.h>
+#include <rpm/rpmdb.h>
+#include <rpm/rpmmacro.h>
+
+int
+main(int argc, char **argv)
+{
+ int ret = 0;
+ rpmts ts;
+
+ rpmDefineMacro(NULL, "_dbpath /var/lib/rpm", 0);
+ ts = rpmtsCreate();
+ if (!ts)
+ {
+ fprintf(stderr, "rpmtsCreate failed\n");
+ exit(1);
+ }
+ if (rpmtsOpenDB(ts, O_RDONLY))
+ {
+ perror("rpmtsOpenDB");
+ exit(1);
+ }
+ if (argc <= 1)
+ {
+ rpmdbIndexIterator ii;
+ ii = rpmdbIndexIteratorInit(rpmtsGetRdb(ts), RPMDBI_NAME);
+ if (ii)
+ {
+ const void *key = 0;
+ size_t keylen = 0;
+ while ((rpmdbIndexIteratorNext(ii, &key, &keylen)) == 0)
+ printf("%*.*s\n", (int)keylen, (int)keylen, (char *)key);
+ }
+ rpmdbIndexIteratorFree(ii);
+ }
+ else
+ {
+ argc--;
+ while (argc--)
+ {
+ rpmdbMatchIterator mi;
+ argv++;
+ mi = rpmdbInitIterator(rpmtsGetRdb(ts), RPMDBI_NAME, (void *)*argv, strlen(*argv));
+ if (mi && rpmdbGetIteratorCount(mi))
+ printf("%s\n", *argv);
+ else
+ ret = 1;
+ rpmdbFreeIterator(mi);
+ }
+ }
+ rpmtsFree(ts);
+ return ret;
+}

172
rpmrc.diff Normal file
View File

@ -0,0 +1,172 @@
--- rpmrc.in.orig 2022-04-07 11:13:19.072518377 +0000
+++ rpmrc.in 2022-12-02 13:14:27.719506789 +0000
@@ -12,16 +12,16 @@
# "fat" binary with both archs, for Darwin
optflags: fat -O2 -g -arch i386 -arch ppc
-optflags: i386 -O2 -g -march=i386 -mtune=i686
-optflags: i486 -O2 -g -march=i486
-optflags: i586 -O2 -g -march=i586
-optflags: i686 -O2 -g -march=i686
-optflags: pentium3 -O2 -g -march=pentium3
-optflags: pentium4 -O2 -g -march=pentium4
-optflags: athlon -O2 -g -march=athlon
+optflags: i386 -O2 -g -m32 -march=i486 -fmessage-length=0 -D_FORTIFY_SOURCE=2 -fstack-protector -funwind-tables -fasynchronous-unwind-tables
+optflags: i486 -O2 -g -m32 -march=i486 -fmessage-length=0 -D_FORTIFY_SOURCE=2 -fstack-protector -funwind-tables -fasynchronous-unwind-tables
+optflags: i586 -O2 -g -m32 -march=i586 -mtune=i686 -fmessage-length=0 -D_FORTIFY_SOURCE=2 -fstack-protector -funwind-tables -fasynchronous-unwind-tables
+optflags: i686 -O2 -g -m32 -march=i686 -mtune=i686 -fmessage-length=0 -D_FORTIFY_SOURCE=2 -fstack-protector -funwind-tables -fasynchronous-unwind-tables
+optflags: pentium3 -O2 -g -m32 -march=pentium3
+optflags: pentium4 -O2 -g -m32 -march=pentium4
+optflags: athlon -O2 -g -m32 -march=athlon
optflags: geode -Os -g -m32 -march=geode
-optflags: ia64 -O2 -g
-optflags: x86_64 -O2 -g
+optflags: ia64 -O2 -g -fmessage-length=0 -D_FORTIFY_SOURCE=2 -fstack-protector -funwind-tables -fasynchronous-unwind-tables
+optflags: x86_64 -O2 -g -m64 -fmessage-length=0 -D_FORTIFY_SOURCE=2 -fstack-protector -funwind-tables -fasynchronous-unwind-tables
optflags: amd64 -O2 -g
optflags: ia32e -O2 -g
@@ -41,17 +41,18 @@ optflags: sparc64v -O2 -g -m64 -mtune=ni
optflags: m68k -O2 -g -fomit-frame-pointer
-optflags: ppc -O2 -g
-optflags: ppc8260 -O2 -g
-optflags: ppc8560 -O2 -g
-optflags: ppc32dy4 -O2 -g
-optflags: ppciseries -O2 -g
-optflags: ppcpseries -O2 -g
-optflags: ppc64 -O2 -g
-optflags: ppc64le -O2 -g
-optflags: ppc64p7 -O3 -mtune=power7 -mcpu=power7 -g
+optflags: ppc -O2 -g -m32 -fmessage-length=0 -D_FORTIFY_SOURCE=2 -fstack-protector -funwind-tables -fasynchronous-unwind-tables
+optflags: ppc8260 -O2 -g -m32
+optflags: ppc8560 -O2 -g -m32
+optflags: ppc32dy4 -O2 -g -m32
+optflags: ppciseries -O2 -g -m32
+optflags: ppcpseries -O2 -g -m32
+optflags: ppc64 -O2 -g -fmessage-length=0 -D_FORTIFY_SOURCE=2 -fstack-protector -funwind-tables -fasynchronous-unwind-tables
+optflags: ppc64le -O2 -g -fmessage-length=0 -D_FORTIFY_SOURCE=2 -fstack-protector -funwind-tables -fasynchronous-unwind-tables
+optflags: ppc64p7 -O3 -mtune=power7 -mcpu=power7 -g -fmessage-length=0 -D_FORTIFY_SOURCE=2 -fstack-protector -funwind-tables -fasynchronous-unwind-tables
optflags: parisc -O2 -g -mpa-risc-1-0
+optflags: hppa -O2 -g -mpa-risc-1-0
optflags: hppa1.0 -O2 -g -mpa-risc-1-0
optflags: hppa1.1 -O2 -g -mpa-risc-1-0
optflags: hppa1.2 -O2 -g -mpa-risc-1-0
@@ -75,10 +76,10 @@ optflags: armv5tl -O2 -g -march=armv5t
optflags: armv5tel -O2 -g -march=armv5te
optflags: armv5tejl -O2 -g -march=armv5te
optflags: armv6l -O2 -g -march=armv6
-optflags: armv6hl -O2 -g -march=armv6 -mfloat-abi=hard -mfpu=vfp
+optflags: armv6hl -O2 -g -march=armv6 -mfloat-abi=hard -mabi=aapcs-linux
optflags: armv7l -O2 -g -march=armv7
-optflags: armv7hl -O2 -g -march=armv7-a -mfloat-abi=hard -mfpu=vfpv3-d16
+optflags: armv7hl -O2 -g -march=armv7-a -mfloat-abi=hard -mthumb -mabi=aapcs-linux
optflags: armv7hnl -O2 -g -march=armv7-a -mfloat-abi=hard -mfpu=neon
optflags: armv8l -O2 -g -march=armv8-a
optflags: armv8hl -O2 -g -march=armv8-a -mfloat-abi=hard -mfpu=vfpv4
@@ -93,8 +94,8 @@ optflags: atariclone -O2 -g -fomit-frame
optflags: milan -O2 -g -fomit-frame-pointer
optflags: hades -O2 -g -fomit-frame-pointer
-optflags: s390 -O2 -g
-optflags: s390x -O2 -g
+optflags: s390 -O2 -g -m31 -fmessage-length=0 -D_FORTIFY_SOURCE=2 -fstack-protector -funwind-tables -fasynchronous-unwind-tables
+optflags: s390x -O2 -g -m64 -fmessage-length=0 -D_FORTIFY_SOURCE=2 -fstack-protector -funwind-tables -fasynchronous-unwind-tables
optflags: sh3 -O2 -g
optflags: sh4 -O2 -g -mieee
@@ -300,17 +301,17 @@ os_canon: MacOSX: macosx 21
#############################################################
# For a given uname().machine, the default build arch
-buildarchtranslate: osfmach3_i686: i386
-buildarchtranslate: osfmach3_i586: i386
+buildarchtranslate: osfmach3_i686: i586
+buildarchtranslate: osfmach3_i586: i586
buildarchtranslate: osfmach3_i486: i386
buildarchtranslate: osfmach3_i386: i386
-buildarchtranslate: athlon: i386
-buildarchtranslate: geode: i386
-buildarchtranslate: pentium4: i386
-buildarchtranslate: pentium3: i386
-buildarchtranslate: i686: i386
-buildarchtranslate: i586: i386
+buildarchtranslate: athlon: i586
+buildarchtranslate: geode: i586
+buildarchtranslate: pentium4: i586
+buildarchtranslate: pentium3: i586
+buildarchtranslate: i686: i586
+buildarchtranslate: i586: i586
buildarchtranslate: i486: i386
buildarchtranslate: i386: i386
@@ -332,6 +333,7 @@ buildarchtranslate: sparc64v: sparc64
buildarchtranslate: osfmach3_ppc: ppc
buildarchtranslate: powerpc: ppc
buildarchtranslate: powerppc: ppc
+buildarchtranslate: powerpc64: ppc64
buildarchtranslate: ppc8260: ppc
buildarchtranslate: ppc8560: ppc
buildarchtranslate: ppc32dy4: ppc
@@ -397,6 +399,15 @@ buildarchtranslate: riscv64: riscv64
buildarchtranslate: loongarch64: loongarch64
+buildarchtranslate: parisc: hppa
+buildarchtranslate: hppa2.0: hppa
+buildarchtranslate: hppa64: hppa
+
+buildarchtranslate: armv5l: armv4l
+buildarchtranslate: armv5tel: armv4l
+buildarchtranslate: armv5b: armv4b
+buildarchtranslate: armv5teb: armv4b
+
#############################################################
# Architecture compatibility
@@ -461,16 +472,20 @@ arch_compat: mips64r6el: mipsr6el
arch_compat: hppa2.0: hppa1.2
arch_compat: hppa1.2: hppa1.1
arch_compat: hppa1.1: hppa1.0
-arch_compat: hppa1.0: parisc
+arch_compat: hppa1.0: hppa
+arch_compat: hppa: parisc
arch_compat: parisc: noarch
+arch_compat: armv5teb: armv5b
+arch_compat: armv5b: armv4b
arch_compat: armv4b: noarch
arch_compat: armv8l: armv7l
arch_compat: armv7l: armv6l
arch_compat: armv6l: armv5tejl
arch_compat: armv5tejl: armv5tel
arch_compat: armv5tel: armv5tl
-arch_compat: armv5tl: armv4tl
+arch_compat: armv5tl: armv5l
+arch_compat: armv5l: armv4tl
arch_compat: armv4tl: armv4l
arch_compat: armv4l: armv3l
arch_compat: armv3l: noarch
@@ -493,7 +508,7 @@ arch_compat: i370: noarch
arch_compat: s390: noarch
arch_compat: s390x: s390 noarch
-arch_compat: ia64: noarch
+arch_compat: ia64: i686 noarch
arch_compat: x86_64: amd64 em64t athlon noarch
arch_compat: amd64: x86_64 em64t athlon noarch
@@ -619,7 +634,8 @@ buildarch_compat: armv6hl: noarch
buildarch_compat: hppa2.0: hppa1.2
buildarch_compat: hppa1.2: hppa1.1
buildarch_compat: hppa1.1: hppa1.0
-buildarch_compat: hppa1.0: parisc
+buildarch_compat: hppa1.0: hppa
+buildarch_compat: hppa: parisc
buildarch_compat: parisc: noarch
buildarch_compat: atarist: m68kmint noarch

76
rpmsort Normal file
View File

@ -0,0 +1,76 @@
#!/bin/sh
# rpmsort implemented mostly in Lua
# Copyright (c) 2020 SUSE LLC
# SPDX-License-Identifier: GPL-2.0-or-later
# Author: fvogt@suse.de
# Enhanced by: mwilck@suse.com
rpmsort() {
direction=$1
script='
function parse(ver)
local epoch, version, release = 0, ver, 0
_, eend, e = ver:find("^(%d+):")
if eend then
ver = ver:sub(eend + 1)
version = ver
epoch = e
end
_, _, v, r = ver:find("(.+)%-(.+)$")
if v then
version = v
release = r
end
return epoch, version, release
end
function pkgvercmp(a, b)
local ae, av, ar = parse(a)
local be, bv, br = parse(b)
local ecmp = rpm.vercmp(ae, be)
if ecmp ~= 0 then return ecmp end
local vcmp = rpm.vercmp(av, bv)
if vcmp ~= 0 then return vcmp end
return rpm.vercmp(ar, br)
end
vers = {}
for line in io.stdin:lines() do
table.insert(vers, line)
end
table.sort(vers, function(a, b) return pkgvercmp(a, b) == '"$direction"' end)
print(table.concat(vers, "\n"))
'
rpm --eval "%{lua: ${script}}"
}
usage() {
cat >&2 <<EOF
$0 - sort input according to rpm version sorting conventions
Expects rpm package versions separated by newlines as input and outputs
them sorted according to rpm version sorting conventions, with old versions
at the top.
Options:
-r|--reverse sort backwards
-h|--help print this help
EOF
exit 0
}
DIRECTION=-1
while [ $# -gt 0 ]; do
case $1 in
-r|--reverse) DIRECTION=1;;
-h|--help) usage;;
*) echo "$0: invalid parameter $1 ignored" >&2;;
esac
shift
done
rpmsort "$DIRECTION"

214
safeugid.diff Normal file
View File

@ -0,0 +1,214 @@
--- ../safeugid.diff 2019-10-02 13:37:13.191868203 +0200
+++ P 2019-10-02 13:36:09.036002978 +0200
@@ -0,0 +1,211 @@
+--- lib/rpmchroot.c.orig 2019-06-26 14:17:31.411985696 +0000
++++ lib/rpmchroot.c 2019-10-02 11:35:58.788024507 +0000
+@@ -126,6 +126,7 @@ int rpmChrootIn(void)
+
+ if (chdir("/") == 0 && chroot(rootState.rootDir) == 0) {
+ rootState.chrootDone = 1;
++ rpmugChroot(1);
+ } else {
+ rpmlog(RPMLOG_ERR, _("Unable to change root directory: %m\n"));
+ rc = -1;
+@@ -151,6 +152,7 @@ int rpmChrootOut(void)
+ } else if (rootState.chrootDone == 1) {
+ if (chroot(".") == 0 && fchdir(rootState.cwd) == 0) {
+ rootState.chrootDone = 0;
++ rpmugChroot(0);
+ } else {
+ rpmlog(RPMLOG_ERR, _("Unable to restore root directory: %m\n"));
+ rc = -1;
+--- lib/rpmug.c.orig 2019-06-26 14:17:31.418985685 +0000
++++ lib/rpmug.c 2019-10-02 11:35:58.788024507 +0000
+@@ -11,6 +11,47 @@
+ #include "lib/rpmug.h"
+ #include "debug.h"
+
++#if defined(__GLIBC__)
++
++static int inchroot;
++
++/*
++ * Unfortunatelly glibc caches nss/nscd data and there is no
++ * good way to flush those caches when we did a chroot(). Thus
++ * we need to parse /etc/passwd and /etc/group ourselfs.
++ */
++static int safe_lookup(const char * file, const char * name)
++{
++ FILE *fp;
++ int l;
++ char buf[4096], *p;
++
++ if (!name || !*name)
++ return -1;
++ l = strlen(name);
++ if ((fp = fopen(file, "r")) == 0)
++ return -1;
++ while ((p = fgets(buf, sizeof(buf), fp)) != 0) {
++ if (*p == '#')
++ continue;
++ while (*p && (*p == ' ' || *p == '\t'))
++ p++;
++ if (strncmp(p, name, l) != 0 || p[l] != ':')
++ continue;
++ p = strchr(p + l + 1, ':');
++ if (!p)
++ continue;
++ fclose(fp);
++ p++;
++ while (*p && (*p == ' ' || *p == '\t'))
++ p++;
++ return atoi(p);
++ }
++ fclose(fp);
++ return -1;
++}
++#endif
++
+ /*
+ * These really ought to use hash tables. I just made the
+ * guess that most files would be owned by root or the same person/group
+@@ -44,17 +85,28 @@ int rpmugUid(const char * thisUname, uid
+ lastUnameAlloced = thisUnameLen + 10;
+ lastUname = xrealloc(lastUname, lastUnameAlloced); /* XXX memory leak */
+ }
+- strcpy(lastUname, thisUname);
+
+- pwent = getpwnam(thisUname);
+- if (pwent == NULL) {
+- /* FIX: shrug */
+- endpwent();
++#if defined(__GLIBC__)
++ if (inchroot) {
++ int uid = safe_lookup("/etc/passwd", thisUname);
++ if (uid < 0)
++ return -1;
++ lastUid = uid;
++ } else
++#endif
++ {
+ pwent = getpwnam(thisUname);
+- if (pwent == NULL) return -1;
++ if (pwent == NULL) {
++ /* FIX: shrug */
++ endpwent();
++ pwent = getpwnam(thisUname);
++ if (pwent == NULL) return -1;
++ }
++ lastUid = pwent->pw_uid;
+ }
+
+- lastUid = pwent->pw_uid;
++ strcpy(lastUname, thisUname);
++ lastUnameLen = thisUnameLen;
+ }
+
+ *uid = lastUid;
+@@ -87,18 +139,29 @@ int rpmugGid(const char * thisGname, gid
+ lastGnameAlloced = thisGnameLen + 10;
+ lastGname = xrealloc(lastGname, lastGnameAlloced); /* XXX memory leak */
+ }
+- strcpy(lastGname, thisGname);
+
+- grent = getgrnam(thisGname);
+- if (grent == NULL) {
+- /* FIX: shrug */
+- endgrent();
++#if defined(__GLIBC__)
++ if (inchroot) {
++ int gid = safe_lookup("/etc/group", thisGname);
++ if (gid < 0)
++ return -1;
++ lastGid = gid;
++ } else
++#endif
++ {
+ grent = getgrnam(thisGname);
+ if (grent == NULL) {
+- return -1;
++ /* FIX: shrug */
++ endgrent();
++ grent = getgrnam(thisGname);
++ if (grent == NULL) {
++ return -1;
++ }
+ }
++ lastGid = grent->gr_gid;
+ }
+- lastGid = grent->gr_gid;
++ strcpy(lastGname, thisGname);
++ lastGnameLen = thisGnameLen;
+ }
+
+ *gid = lastGid;
+@@ -110,7 +173,7 @@ const char * rpmugUname(uid_t uid)
+ {
+ static uid_t lastUid = (uid_t) -1;
+ static char * lastUname = NULL;
+- static size_t lastUnameLen = 0;
++ static size_t lastUnameAlloced = 0;
+
+ if (uid == (uid_t) -1) {
+ lastUid = (uid_t) -1;
+@@ -127,9 +190,9 @@ const char * rpmugUname(uid_t uid)
+
+ lastUid = uid;
+ len = strlen(pwent->pw_name);
+- if (lastUnameLen < len + 1) {
+- lastUnameLen = len + 20;
+- lastUname = xrealloc(lastUname, lastUnameLen);
++ if (lastUnameAlloced < len + 1) {
++ lastUnameAlloced = len + 20;
++ lastUname = xrealloc(lastUname, lastUnameAlloced);
+ }
+ strcpy(lastUname, pwent->pw_name);
+
+@@ -141,7 +204,7 @@ const char * rpmugGname(gid_t gid)
+ {
+ static gid_t lastGid = (gid_t) -1;
+ static char * lastGname = NULL;
+- static size_t lastGnameLen = 0;
++ static size_t lastGnameAlloced = 0;
+
+ if (gid == (gid_t) -1) {
+ lastGid = (gid_t) -1;
+@@ -158,9 +221,9 @@ const char * rpmugGname(gid_t gid)
+
+ lastGid = gid;
+ len = strlen(grent->gr_name);
+- if (lastGnameLen < len + 1) {
+- lastGnameLen = len + 20;
+- lastGname = xrealloc(lastGname, lastGnameLen);
++ if (lastGnameAlloced < len + 1) {
++ lastGnameAlloced = len + 20;
++ lastGname = xrealloc(lastGname, lastGnameAlloced);
+ }
+ strcpy(lastGname, grent->gr_name);
+
+@@ -192,3 +255,16 @@ void rpmugFree(void)
+ rpmugUname(-1);
+ rpmugGname(-1);
+ }
++
++void rpmugChroot(int in)
++{
++ /* tell libc to drop caches / file descriptors */
++ endpwent();
++ endgrent();
++ /* drop our own caches */
++ rpmugUid(NULL, NULL);
++ rpmugGid(NULL, NULL);
++#if defined(__GLIBC__)
++ inchroot = in;
++#endif
++}
+--- lib/rpmug.h.orig 2019-06-26 14:17:31.418985685 +0000
++++ lib/rpmug.h 2019-10-02 11:35:58.788024507 +0000
+@@ -15,4 +15,6 @@ int rpmugInit(void);
+
+ void rpmugFree(void);
+
++void rpmugChroot(int in);
++
+ #endif /* _RPMUG_H */

View File

@ -0,0 +1,24 @@
--- plugins/selinux.c.orig 2022-04-07 11:13:19.027518072 +0000
+++ plugins/selinux.c 2022-12-02 13:59:42.185032111 +0000
@@ -8,6 +8,7 @@
#include <rpm/rpmlog.h>
#include <rpm/rpmts.h>
#include "lib/rpmplugin.h"
+#include <stdlib.h>
#include "debug.h"
@@ -173,6 +174,13 @@ static rpmRC selinux_fsm_file_prepare(rp
if (conrc == 0 || (conrc < 0 && errno == EOPNOTSUPP))
rc = RPMRC_OK;
+ else {
+ char *tup = getenv("TRANSACTIONAL_UPDATE");
+ if (tup != NULL && !strncmp(tup, "true", 4)) {
+ rpmlog(RPMLOG_DEBUG, "lsetfilecon failed, will be healed upon reboot (transactional update): (%s, %s)\n", path, scon);
+ rc = RPMRC_OK;
+ }
+ }
rpmlog(loglvl(rc != RPMRC_OK), "lsetfilecon: (%d %s, %s) %s\n",
fd, path, scon, (conrc < 0 ? strerror(errno) : ""));

10
specfilemacro.diff Normal file
View File

@ -0,0 +1,10 @@
--- build/parseSpec.c.orig 2013-06-10 15:55:10.000000000 +0000
+++ build/parseSpec.c 2013-07-12 12:04:11.000000000 +0000
@@ -561,6 +561,7 @@ static rpmSpec parseSpec(const char *spe
spec = newSpec();
spec->specFile = rpmGetPath(specFile, NULL);
+ addMacro(spec->macros, "_specfile", NULL, spec->specFile, RMIL_SPEC);
pushOFI(spec, spec->specFile);
/* If buildRoot not specified, use default %{buildroot} */
if (buildRoot) {

17
sysconfig.services-rpm Normal file
View File

@ -0,0 +1,17 @@
## Path: System/Services
## Type: yesno
## Default: no
#
# Do you want to disable the automatic restart of services when
# a new version gets installed?
#
DISABLE_RESTART_ON_UPDATE="no"
## Type: yesno
## Default: no
#
# Do you want to disable the automatic shutdown of services when
# the corresponding package gets erased?
#
DISABLE_STOP_ON_REMOVAL="no"

View File

@ -0,0 +1,11 @@
--- macros.in.orig 2021-08-20 08:44:56.264259007 +0000
+++ macros.in 2021-09-23 18:57:26.654059458 +0000
@@ -140,7 +140,7 @@
%_buildshell /bin/sh
# The location of the rpm database file(s).
-%_dbpath %{_var}/lib/rpm
+%_dbpath %{_usr}/lib/sysimage/rpm
# The location of the rpm database file(s) after "rpm --rebuilddb".
%_dbpath_rebuild %{_dbpath}

10
weakdepscompat.diff Normal file
View File

@ -0,0 +1,10 @@
--- build/parsePreamble.c.orig 2014-08-04 13:10:07.530953406 +0000
+++ build/parsePreamble.c 2014-08-04 13:10:12.852929355 +0000
@@ -343,6 +343,7 @@ static struct tokenBits_s const installS
{ "verify", RPMSENSE_SCRIPT_VERIFY },
{ "pretrans", RPMSENSE_PRETRANS },
{ "posttrans", RPMSENSE_POSTTRANS },
+ { "hint", RPMSENSE_MISSINGOK },
{ NULL, 0 }
};

14
whatrequires-doc.diff Normal file
View File

@ -0,0 +1,14 @@
--- docs/man/rpm.8.orig 2021-09-23 19:20:46.991203867 +0000
+++ docs/man/rpm.8 2021-09-23 19:22:45.918961340 +0000
@@ -601,6 +601,11 @@ Query all packages that provide the \f[I
\f[B]--whatrequires \f[R]\f[I]CAPABILITY\f[R]
Query all packages that require \f[I]CAPABILITY\f[R] for proper
functioning.
+.br
+Note that this does not return what requires a given package.
+A package usually provides multiple capabilities and file-names on which
+other packages may depend. To see the complete dependencies
+for a package, use \f[B]-e --test \f[R]\f[I]PACKAGE_NAME\f[R]
.TP
\f[B]--whatconflicts \f[R]\f[I]CAPABILITY\f[R]
Query all packages that conflict with \f[I]CAPABILITY\f[R].

View File

@ -0,0 +1,196 @@
From 282f75e33f93e46854345598f576d052d5cfe390 Mon Sep 17 00:00:00 2001
From: Fabian Vogt <fvogt@suse.de>
Date: Thu, 8 Dec 2022 12:50:12 +0100
Subject: [PATCH] Add x86-64 architecture levels (v2-v4) as architectures
The x86_64 SysV psABI defines four levels of x86_64 with certain CPU features
required for each level. Those definitions are meant to be generically useful
and recognized as such by glibc and gcc as well.
For backward-compatibility and to avoid surprises, default to building x86_64
even on v2+ capable machines.
---
installplatform | 2 +-
lib/rpmrc.c | 75 +++++++++++++++++++++++++++++++++++++++++++++++++
macros.in | 4 +++
rpmrc.in | 18 ++++++++++++
4 files changed, 98 insertions(+), 1 deletion(-)
--- installplatform
+++ installplatform
@@ -78,7 +78,7 @@ for ARCH in noarch `grep ^arch_canon $RP
CANONARCH=i386
CANONCOLOR=0
;;
- x86_64|amd64|ia32e)
+ x86_64*|amd64|ia32e)
ISANAME=x86
ISABITS=64
CANONARCH=x86_64
--- lib/rpmrc.c
+++ lib/rpmrc.c
@@ -735,6 +735,71 @@ exit:
return rc;
}
+# if defined(__linux__) && defined(__x86_64__)
+static inline void cpuid(uint32_t op, uint32_t op2, uint32_t *eax, uint32_t *ebx, uint32_t *ecx, uint32_t *edx)
+{
+ asm volatile (
+ "cpuid\n"
+ : "=a" (*eax), "=b" (*ebx), "=c" (*ecx), "=d" (*edx)
+ : "a" (op), "c" (op2));
+}
+
+/* From gcc's gcc/config/i386/cpuid.h */
+/* Features (%eax == 1) */
+/* %ecx */
+#define bit_SSE3 (1 << 0)
+#define bit_LZCNT (1 << 5)
+#define bit_SSSE3 (1 << 9)
+#define bit_FMA (1 << 12)
+#define bit_CMPXCHG16B (1 << 13)
+#define bit_SSE4_1 (1 << 19)
+#define bit_SSE4_2 (1 << 20)
+#define bit_MOVBE (1 << 22)
+#define bit_POPCNT (1 << 23)
+#define bit_OSXSAVE (1 << 27)
+#define bit_AVX (1 << 28)
+#define bit_F16C (1 << 29)
+
+/* Extended Features (%eax == 0x80000001) */
+/* %ecx */
+#define bit_LAHF_LM (1 << 0)
+
+/* Extended Features (%eax == 7) */
+/* %ebx */
+#define bit_BMI (1 << 3)
+#define bit_AVX2 (1 << 5)
+#define bit_BMI2 (1 << 8)
+#define bit_AVX512F (1 << 16)
+#define bit_AVX512DQ (1 << 17)
+#define bit_AVX512CD (1 << 28)
+#define bit_AVX512BW (1 << 30)
+#define bit_AVX512VL (1u << 31)
+
+static int get_x86_64_level(void)
+{
+ int level = 1;
+
+ unsigned int op_1_ecx = 0, op_80000001_ecx = 0, op_7_ebx = 0, unused;
+ cpuid(1, 0, &unused, &unused, &op_1_ecx, &unused);
+ cpuid(0x80000001, 0, &unused, &unused, &op_80000001_ecx, &unused);
+ cpuid(7, 0, &unused, &op_7_ebx, &unused, &unused);
+
+ const unsigned int op_1_ecx_lv2 = bit_SSE3 | bit_SSSE3 | bit_CMPXCHG16B | bit_SSE4_1 | bit_SSE4_2 | bit_POPCNT;
+ if ((op_1_ecx & op_1_ecx_lv2) == op_1_ecx_lv2 && (op_80000001_ecx & bit_LAHF_LM))
+ level = 2;
+
+ const unsigned int op_1_ecx_lv3 = bit_LZCNT | bit_FMA | bit_MOVBE | bit_OSXSAVE | bit_AVX | bit_F16C;
+ const unsigned int op_7_ebx_lv3 = bit_BMI | bit_AVX2 | bit_BMI2;
+ if (level == 2 && (op_1_ecx & op_1_ecx_lv3) == op_1_ecx_lv3 && (op_7_ebx & op_7_ebx_lv3) == op_7_ebx_lv3)
+ level = 3;
+
+ const unsigned int op_7_ebx_lv4 = bit_AVX512F | bit_AVX512DQ | bit_AVX512CD | bit_AVX512BW | bit_AVX512VL;
+ if (level == 3 && (op_7_ebx & op_7_ebx_lv4) == op_7_ebx_lv4)
+ level = 4;
+
+ return level;
+}
+# endif
# if defined(__linux__) && defined(__i386__)
#include <setjmp.h>
@@ -1287,6 +1352,16 @@ static void defaultMachine(rpmrcCtx ctx,
}
# endif
+# if defined(__linux__) && defined(__x86_64__)
+ {
+ int x86_64_level = get_x86_64_level();
+ if (x86_64_level > 1) {
+ strcpy(un.machine, "x86_64_vX");
+ un.machine[8] = '0' + x86_64_level;
+ }
+ }
+#endif
+
/* the uname() result goes through the arch_canon table */
canon = lookupInCanonTable(un.machine,
ctx->tables[RPM_MACHTABLE_INSTARCH].canons,
--- macros.in
+++ macros.in
@@ -1064,6 +1064,10 @@ package or when debugging this package.\
%ix86 i386 i486 i586 i686 pentium3 pentium4 athlon geode
#------------------------------------------------------------------------------
+# arch macro for all supported x86_64 processors
+%x86_64 x86_64 x86_64_v2 x86_64_v3 x86_64_v4 amd64 em64t
+
+#------------------------------------------------------------------------------
# arch macro for all supported 32-bit ARM processors
%arm32 armv3l armv4b armv4l armv4tl armv5b armv5l armv5teb armv5tel armv5tejl armv6l armv6hl armv7l armv7hl armv7hnl armv8l armv8hl armv8hnl armv8hcnl
--- rpmrc.in
+++ rpmrc.in
@@ -22,6 +22,10 @@ optflags: athlon -O2 -g -m32 -march=athl
optflags: geode -Os -g -m32 -march=geode
optflags: ia64 -O2 -g -fmessage-length=0 -D_FORTIFY_SOURCE=2 -fstack-protector -funwind-tables -fasynchronous-unwind-tables
optflags: x86_64 -O2 -g -m64 -fmessage-length=0 -D_FORTIFY_SOURCE=2 -fstack-protector -funwind-tables -fasynchronous-unwind-tables
+optflags: x86_64_v2 -O2 -g -march=x86-64-v2 -m64 -fmessage-length=0 -D_FORTIFY_SOURCE=2 -fstack-protector -funwind-tables -fasynchronous-unwind-tables
+optflags: x86_64_v3 -O2 -g -march=x86-64-v3 -m64 -fmessage-length=0 -D_FORTIFY_SOURCE=2 -fstack-protector -funwind-tables -fasynchronous-unwind-tables
+optflags: x86_64_v4 -O2 -g -march=x86-64-v4 -m64 -fmessage-length=0 -D_FORTIFY_SOURCE=2 -fstack-protector -funwind-tables -fasynchronous-unwind-tables
+
optflags: amd64 -O2 -g
optflags: ia32e -O2 -g
@@ -148,6 +152,9 @@ archcolor: s390x 2
archcolor: ia64 2
archcolor: x86_64 2
+archcolor: x86_64_v2 2
+archcolor: x86_64_v3 2
+archcolor: x86_64_v4 2
archcolor: sh3 1
archcolor: sh4 1
@@ -168,6 +175,9 @@ arch_canon: i586: i586 1
arch_canon: i486: i486 1
arch_canon: i386: i386 1
arch_canon: x86_64: x86_64 1
+arch_canon: x86_64_v2: x86_64_v2 1
+arch_canon: x86_64_v3: x86_64_v3 1
+arch_canon: x86_64_v4: x86_64_v4 1
arch_canon: amd64: amd64 1
arch_canon: ia32e: ia32e 1
arch_canon: em64t: em64t 1
@@ -378,6 +388,9 @@ buildarchtranslate: s390x: s390x
buildarchtranslate: ia64: ia64
buildarchtranslate: x86_64: x86_64
+buildarchtranslate: x86_64_v2: x86_64
+buildarchtranslate: x86_64_v3: x86_64
+buildarchtranslate: x86_64_v4: x86_64
buildarchtranslate: amd64: x86_64
buildarchtranslate: ia32e: x86_64
@@ -504,6 +517,9 @@ arch_compat: ia64: i686 noarch
arch_compat: x86_64: amd64 em64t athlon noarch
arch_compat: amd64: x86_64 em64t athlon noarch
arch_compat: ia32e: x86_64 em64t athlon noarch
+arch_compat: x86_64_v2: x86_64 amd64 em64t athlon noarch
+arch_compat: x86_64_v3: x86_64_v2 x86_64 amd64 em64t athlon noarch
+arch_compat: x86_64_v4: x86_64_v3 x86_64_v2 x86_64 amd64 em64t athlon noarch
arch_compat: sh3: noarch
arch_compat: sh4: noarch
@@ -640,6 +656,9 @@ buildarch_compat: s390x: noarch
buildarch_compat: ia64: noarch
+buildarch_compat: x86_64_v4: x86_64_v3
+buildarch_compat: x86_64_v3: x86_64_v2
+buildarch_compat: x86_64_v2: x86_64
buildarch_compat: x86_64: noarch
buildarch_compat: amd64: x86_64
buildarch_compat: ia32e: x86_64

68
zstdpool.diff Normal file
View File

@ -0,0 +1,68 @@
--- rpmio/rpmio.c.orig 2021-06-21 12:00:44.648612706 +0000
+++ rpmio/rpmio.c 2022-04-13 13:48:55.224954032 +0000
@@ -8,6 +8,7 @@
#include <ctype.h>
#include <dirent.h>
#include <fcntl.h>
+#include <pthread.h>
#if defined(__linux__)
#include <sys/personality.h>
#endif
@@ -1034,6 +1035,7 @@ static const FDIO_t lzdio = &lzdio_s;
/* Support for ZSTD library. */
#ifdef HAVE_ZSTD
+#define ZSTD_STATIC_LINKING_ONLY
#include <zstd.h>
typedef struct rpmzstd_s {
@@ -1048,6 +1050,29 @@ typedef struct rpmzstd_s {
ZSTD_outBuffer zob; /*!< ZSTD_outBuffer */
} * rpmzstd;
+#if ZSTD_VERSION_NUMBER >= 10407
+
+static pthread_once_t zstdThreadPoolCreated = PTHREAD_ONCE_INIT;
+static ZSTD_threadPool *zstdThreadPool;
+static int zstdThreadPoolThreads;
+
+static void zstdCreateThreadPool(void)
+{
+ int numthreads = rpmExpandNumeric("%{?_zstd_pool_threads}%{?!_zstd_pool_threads:-1}");
+ if (numthreads >= 0)
+ numthreads = get_compression_threads(numthreads > 0 ? numthreads : -1);
+ if (numthreads > 0) {
+ zstdThreadPoolThreads = numthreads;
+ zstdThreadPool = ZSTD_createThreadPool(numthreads);
+ if (!zstdThreadPool)
+ rpmlog(RPMLOG_WARNING, "Could not create zstd thread pool for %d threads\n", numthreads);
+ else
+ rpmlog(RPMLOG_DEBUG, "Created zstd thread pool for %d threads\n", numthreads);
+ }
+}
+
+#endif
+
static rpmzstd rpmzstdNew(int fdno, const char *fmode)
{
int flags = 0;
@@ -1133,8 +1158,18 @@ static rpmzstd rpmzstdNew(int fdno, cons
threads = get_compression_threads(threads);
if (threads > 0) {
- if (ZSTD_isError (ZSTD_CCtx_setParameter(_stream, ZSTD_c_nbWorkers, threads)))
+ if (ZSTD_isError (ZSTD_CCtx_setParameter(_stream, ZSTD_c_nbWorkers, threads))) {
rpmlog(RPMLOG_DEBUG, "zstd library does not support multi-threading\n");
+ } else {
+#if ZSTD_VERSION_NUMBER >= 10407
+ pthread_once(&zstdThreadPoolCreated, zstdCreateThreadPool);
+ if (zstdThreadPool) {
+ if (threads > zstdThreadPoolThreads)
+ ZSTD_CCtx_setParameter(_stream, ZSTD_c_nbWorkers, zstdThreadPoolThreads);
+ ZSTD_CCtx_refThreadPool(_stream, zstdThreadPool);
+ }
+#endif
+ }
}
nb = ZSTD_CStreamOutSize();

14
zstdthreaded.diff Normal file
View File

@ -0,0 +1,14 @@
--- macros.in.orig 2021-10-15 07:40:15.601628187 +0000
+++ macros.in 2021-10-15 07:42:23.557282503 +0000
@@ -374,7 +374,10 @@ package or when debugging this package.\
# "w.ufdio" uncompressed
#
#%_source_payload w9.gzdio
-%_binary_payload w19.zstdio
+%_binary_payload w19T0.zstdio
+
+# use a pool with 8 threads for threaded zstd compression
+%_zstd_pool_threads 8
# Algorithm to use for generating file checksum digests on build.
# If not specified or 0, MD5 is used.