Accepting request 884038 from Base:System

change dump_posttrans mechanism to imply --noposttrans

OBS-URL: https://build.opensuse.org/request/show/884038
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/rpm?expand=0&rev=288
This commit is contained in:
Dominique Leuenberger 2021-04-19 19:05:35 +00:00 committed by Git OBS Bridge
commit 17ca2f91a2
11 changed files with 564 additions and 200 deletions

View File

@ -1,6 +1,8 @@
--- ./build/parseSpec.c.orig 2019-10-02 12:38:51.836127743 +0000 Index: build/parseSpec.c
+++ ./build/parseSpec.c 2019-10-02 12:52:33.818447657 +0000 ===================================================================
@@ -926,7 +926,22 @@ static rpmSpec parseSpec(const char *spe --- build/parseSpec.c.orig
+++ build/parseSpec.c
@@ -942,7 +942,30 @@ static rpmSpec parseSpec(const char *spe
&(spec->buildrequires)); &(spec->buildrequires));
break; break;
case PART_BUILD: case PART_BUILD:
@ -12,11 +14,19 @@
+ } + }
+ spec->build = newStringBuf(); + spec->build = newStringBuf();
+ appendLineStringBuf(spec->build, + appendLineStringBuf(spec->build,
+ "ref=/usr/lib/rpm; testarch=$(uname -m)\n" + "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 s in guess sub; do\n"
+ " for c in $(find -maxdepth 8 -name \"config.$s\"); do\n" + " for c in $(find -maxdepth 8 -name \"config.$s\"); do\n"
+ " grep -q config-patches@ $c || continue\n" + " grep -q config-patches@ $c || continue\n"
+ " grep -q \"$testarch[-: ]\" $c || install -m 755 $ref/config.$s $c\n" + " timestamp=$(sed -n \"/^timestamp=/{s///;s/[-'\\\"]//g;p;q;}\" $c)\n"
+ " test -n \"$timestamp\" || continue\n"
+ " test $timestamp -ge $mints || install -m 755 $ref/config.$s $c\n"
+ " done\n" + " done\n"
+ "done\n" + "done\n"
+ ); + );

View File

@ -5,11 +5,9 @@ a834fccf3c94f78ad6a1b35ae352b1ede183dde4
86408cd826c32229817071bd008d9856cda4aca5 86408cd826c32229817071bd008d9856cda4aca5
0d1003bc723ba30bfe325bb51aeafe7dbfed6a5c 0d1003bc723ba30bfe325bb51aeafe7dbfed6a5c
diff --git a/tools/debugedit.c b/tools/debugedit.c --- ./tools/debugedit.c.orig 2021-03-30 09:34:25.206392109 +0000
index 6bea88551..b0849efd8 100644 +++ ./tools/debugedit.c 2021-03-30 09:34:40.186365656 +0000
--- a/tools/debugedit.c @@ -103,6 +103,8 @@ static bool need_string_replacement = fa
+++ b/tools/debugedit.c
@@ -103,6 +103,8 @@ static bool need_string_replacement = false;
/* Whether we need to do any updates of the string indexes (DW_FORM_strp) /* Whether we need to do any updates of the string indexes (DW_FORM_strp)
in debug_info for string indexes. */ in debug_info for string indexes. */
static bool need_strp_update = false; static bool need_strp_update = false;
@ -106,7 +104,7 @@ index 6bea88551..b0849efd8 100644
{ NULL, NULL, NULL, 0, 0, 0 } { NULL, NULL, NULL, 0, 0, 0 }
}; };
@@ -542,10 +555,11 @@ setup_relbuf (DSO *dso, debug_section *sec, int *reltype) @@ -542,10 +555,11 @@ setup_relbuf (DSO *dso, debug_section *s
/* Relocations against section symbols are uninteresting in REL. */ /* Relocations against section symbols are uninteresting in REL. */
if (dso->shdr[i].sh_type == SHT_REL && sym.st_value == 0) if (dso->shdr[i].sh_type == SHT_REL && sym.st_value == 0)
continue; continue;
@ -152,7 +150,7 @@ index 6bea88551..b0849efd8 100644
t->attr[t->nattr].attr = attr; t->attr[t->nattr].attr = attr;
t->attr[t->nattr++].form = form; t->attr[t->nattr++].form = form;
@@ -1022,17 +1053,20 @@ string_find_entry (struct strings *strings, size_t old_idx) @@ -1022,17 +1053,20 @@ string_find_entry (struct strings *strin
a replacement file string has been recorded for it, otherwise a replacement file string has been recorded for it, otherwise
returns false. */ returns false. */
static bool static bool
@ -177,7 +175,7 @@ index 6bea88551..b0849efd8 100644
const char *file = skip_dir_prefix (old_str, base_dir); const char *file = skip_dir_prefix (old_str, base_dir);
if (file == NULL) if (file == NULL)
{ {
@@ -1076,15 +1110,18 @@ record_file_string_entry_idx (struct strings *strings, size_t old_idx) @@ -1076,15 +1110,18 @@ record_file_string_entry_idx (struct str
base_dir with dest_dir, just records the existing string associated base_dir with dest_dir, just records the existing string associated
with the index. */ with the index. */
static void static void
@ -200,7 +198,7 @@ index 6bea88551..b0849efd8 100644
Strent *strent = strtab_add_len (strings->str_tab, Strent *strent = strtab_add_len (strings->str_tab,
str, strlen (str) + 1); str, strlen (str) + 1);
if (strent == NULL) if (strent == NULL)
@@ -1217,13 +1254,28 @@ get_line_table (DSO *dso, size_t off, struct line_table **table) @@ -1217,13 +1254,28 @@ get_line_table (DSO *dso, size_t off, st
/* version */ /* version */
t->version = read_16 (ptr); t->version = read_16 (ptr);
@ -434,7 +432,7 @@ index 6bea88551..b0849efd8 100644
/* dir table: */ /* dir table: */
value = 1; value = 1;
@@ -1622,6 +1787,296 @@ read_dwarf2_line (DSO *dso, uint32_t off, char *comp_dir) @@ -1622,6 +1787,296 @@ read_dwarf2_line (DSO *dso, uint32_t off
read_uleb128 (ptr); read_uleb128 (ptr);
} }
@ -731,7 +729,7 @@ index 6bea88551..b0849efd8 100644
dso->lines.debug_lines_len += 4 + table->unit_length + table->size_diff; dso->lines.debug_lines_len += 4 + table->unit_length + table->size_diff;
return table->replace_dirs || table->replace_files; return table->replace_dirs || table->replace_files;
} }
@@ -1639,6 +2094,40 @@ find_new_list_offs (struct debug_lines *lines, size_t idx) @@ -1639,6 +2094,40 @@ find_new_list_offs (struct debug_lines *
return table->new_idx; return table->new_idx;
} }
@ -772,7 +770,7 @@ index 6bea88551..b0849efd8 100644
/* This scans the attributes of one DIE described by the given abbrev_tag. /* This scans the attributes of one DIE described by the given abbrev_tag.
PTR points to the data in the debug_info. It will be advanced till all PTR points to the data in the debug_info. It will be advanced till all
abbrev data is consumed. In phase zero data is collected, in phase one abbrev data is consumed. In phase zero data is collected, in phase one
@@ -1657,7 +2146,6 @@ edit_attributes (DSO *dso, unsigned char *ptr, struct abbrev_tag *t, int phase) @@ -1657,7 +2146,6 @@ edit_attributes (DSO *dso, unsigned char
for (i = 0; i < t->nattr; ++i) for (i = 0; i < t->nattr; ++i)
{ {
uint32_t form = t->attr[i].form; uint32_t form = t->attr[i].form;
@ -780,7 +778,7 @@ index 6bea88551..b0849efd8 100644
while (1) while (1)
{ {
/* Whether we already handled a string as file for this /* Whether we already handled a string as file for this
@@ -1743,38 +2231,24 @@ edit_attributes (DSO *dso, unsigned char *ptr, struct abbrev_tag *t, int phase) @@ -1743,38 +2231,24 @@ edit_attributes (DSO *dso, unsigned char
} }
} }
} }
@ -833,7 +831,7 @@ index 6bea88551..b0849efd8 100644
/* DW_AT_name is the primary file for this compile /* DW_AT_name is the primary file for this compile
unit. If starting with / it is a full path name. unit. If starting with / it is a full path name.
Note that we don't handle DW_FORM_string in this Note that we don't handle DW_FORM_string in this
@@ -1784,11 +2258,14 @@ edit_attributes (DSO *dso, unsigned char *ptr, struct abbrev_tag *t, int phase) @@ -1784,11 +2258,14 @@ edit_attributes (DSO *dso, unsigned char
/* In phase zero we will look for a comp_dir to use. */ /* In phase zero we will look for a comp_dir to use. */
if (phase == 0) if (phase == 0)
{ {
@ -852,7 +850,7 @@ index 6bea88551..b0849efd8 100644
if (*name == '/' && comp_dir == NULL) if (*name == '/' && comp_dir == NULL)
{ {
char *enddir = strrchr (name, '/'); char *enddir = strrchr (name, '/');
@@ -1809,107 +2286,37 @@ edit_attributes (DSO *dso, unsigned char *ptr, struct abbrev_tag *t, int phase) @@ -1809,107 +2286,37 @@ edit_attributes (DSO *dso, unsigned char
pass (1) stores it (the new index). */ pass (1) stores it (the new index). */
if (dest_dir && phase == 0) if (dest_dir && phase == 0)
{ {
@ -931,13 +929,10 @@ index 6bea88551..b0849efd8 100644
- do_write_32_relocated (ptr, new_idx); - do_write_32_relocated (ptr, new_idx);
- } - }
- ptr += 4; - ptr += 4;
+ edit_strp (dso, false /* line_strp */, ptr, phase, handled_strp); - break;
break;
- case DW_FORM_string: - case DW_FORM_string:
- ptr = (unsigned char *) strchr ((char *)ptr, '\0') + 1; - ptr = (unsigned char *) strchr ((char *)ptr, '\0') + 1;
+ case DW_FORM_line_strp: - break;
+ edit_strp (dso, true /* line_strp */, ptr, phase, handled_strp);
break;
- case DW_FORM_indirect: - case DW_FORM_indirect:
- form = read_uleb128 (ptr); - form = read_uleb128 (ptr);
- continue; - continue;
@ -947,11 +942,14 @@ index 6bea88551..b0849efd8 100644
- case DW_FORM_block2: - case DW_FORM_block2:
- len = read_16 (ptr); - len = read_16 (ptr);
- form = DW_FORM_block1; - form = DW_FORM_block1;
- break; + edit_strp (dso, false /* line_strp */, ptr, phase, handled_strp);
break;
- case DW_FORM_block4: - case DW_FORM_block4:
- len = read_32 (ptr); - len = read_32 (ptr);
- form = DW_FORM_block1; - form = DW_FORM_block1;
- break; + case DW_FORM_line_strp:
+ edit_strp (dso, true /* line_strp */, ptr, phase, handled_strp);
break;
- case DW_FORM_block: - case DW_FORM_block:
- case DW_FORM_exprloc: - case DW_FORM_exprloc:
- len = read_uleb128 (ptr); - len = read_uleb128 (ptr);
@ -978,11 +976,10 @@ index 6bea88551..b0849efd8 100644
break; break;
} }
} }
@@ -1964,6 +2371,163 @@ line_rel_cmp (const void *a, const void *b) @@ -1965,6 +2372,163 @@ line_rel_cmp (const void *a, const void
return 0;
} }
+static int static int
+edit_info (DSO *dso, int phase, struct debug_section *sec) +edit_info (DSO *dso, int phase, struct debug_section *sec)
+{ +{
+ unsigned char *ptr, *endcu, *endsec; + unsigned char *ptr, *endcu, *endsec;
@ -1139,9 +1136,10 @@ index 6bea88551..b0849efd8 100644
+ strings->str_buf = strdata->d_buf; + strings->str_buf = strdata->d_buf;
+} +}
+ +
static int +static int
edit_dwarf2 (DSO *dso) edit_dwarf2 (DSO *dso)
{ {
Elf_Data *data;
@@ -1995,7 +2559,7 @@ edit_dwarf2 (DSO *dso) @@ -1995,7 +2559,7 @@ edit_dwarf2 (DSO *dso)
struct debug_section *debug_sec = &debug_sections[j]; struct debug_section *debug_sec = &debug_sections[j];
if (debug_sections[j].data) if (debug_sections[j].data)
@ -1221,7 +1219,18 @@ index 6bea88551..b0849efd8 100644
} }
- if (debug_sections[DEBUG_INFO].data != NULL) - if (debug_sections[DEBUG_INFO].data != NULL)
- { + if (debug_sections[DEBUG_INFO].data == NULL)
+ return 0;
+
+ unsigned char *ptr, *endsec;
+ int phase;
+ bool info_rel_updated = false;
+ bool types_rel_updated = false;
+ bool macro_rel_updated = false;
+ bool line_rel_updated = false;
+
+ for (phase = 0; phase < 2; phase++)
{
- unsigned char *ptr, *endcu, *endsec; - unsigned char *ptr, *endcu, *endsec;
- uint32_t value; - uint32_t value;
- htab_t abbrev; - htab_t abbrev;
@ -1229,8 +1238,13 @@ index 6bea88551..b0849efd8 100644
- int phase; - int phase;
- bool info_rel_updated = false; - bool info_rel_updated = false;
- bool macro_rel_updated = false; - bool macro_rel_updated = false;
+ if (debug_sections[DEBUG_INFO].data == NULL) + /* If we don't need to update anyhing, skip phase 1. */
+ return 0; + if (phase == 1
+ && !need_strp_update
+ && !need_line_strp_update
+ && !need_string_replacement
+ && !need_stmt_update)
+ break;
- for (phase = 0; phase < 2; phase++) - for (phase = 0; phase < 2; phase++)
- { - {
@ -1240,12 +1254,9 @@ index 6bea88551..b0849efd8 100644
- && !need_string_replacement - && !need_string_replacement
- && !need_stmt_update) - && !need_stmt_update)
- break; - break;
+ unsigned char *ptr, *endsec; + rel_updated = false;
+ int phase; + if (edit_info (dso, phase, &debug_sections[DEBUG_INFO]))
+ bool info_rel_updated = false; + return 1;
+ bool types_rel_updated = false;
+ bool macro_rel_updated = false;
+ bool line_rel_updated = false;
- ptr = debug_sections[DEBUG_INFO].data; - ptr = debug_sections[DEBUG_INFO].data;
- setup_relbuf(dso, &debug_sections[DEBUG_INFO], &reltype); - setup_relbuf(dso, &debug_sections[DEBUG_INFO], &reltype);
@ -1259,15 +1270,9 @@ index 6bea88551..b0849efd8 100644
- dso->filename); - dso->filename);
- return 1; - return 1;
- } - }
+ for (phase = 0; phase < 2; phase++) + /* Remember whether any .debug_info relocations might need
+ { + to be updated. */
+ /* If we don't need to update anyhing, skip phase 1. */ + info_rel_updated = rel_updated;
+ if (phase == 1
+ && !need_strp_update
+ && !need_line_strp_update
+ && !need_string_replacement
+ && !need_stmt_update)
+ break;
- endcu = ptr + 4; - endcu = ptr + 4;
- endcu += read_32 (ptr); - endcu += read_32 (ptr);
@ -1277,26 +1282,6 @@ index 6bea88551..b0849efd8 100644
- return 1; - return 1;
- } - }
+ rel_updated = false; + rel_updated = false;
+ if (edit_info (dso, phase, &debug_sections[DEBUG_INFO]))
+ return 1;
- if (endcu > endsec)
- {
- error (0, 0, "%s: .debug_info too small", dso->filename);
- return 1;
- }
+ /* Remember whether any .debug_info relocations might need
+ to be updated. */
+ info_rel_updated = rel_updated;
- cu_version = read_16 (ptr);
- if (cu_version != 2 && cu_version != 3 && cu_version != 4)
- {
- error (0, 0, "%s: DWARF version %d unhandled", dso->filename,
- cu_version);
- return 1;
- }
+ rel_updated = false;
+ struct debug_section *types_sec = &debug_sections[DEBUG_TYPES]; + struct debug_section *types_sec = &debug_sections[DEBUG_TYPES];
+ while (types_sec != NULL) + while (types_sec != NULL)
+ { + {
@ -1305,20 +1290,22 @@ index 6bea88551..b0849efd8 100644
+ types_sec = types_sec->next; + types_sec = types_sec->next;
+ } + }
- value = read_32_relocated (ptr); - if (endcu > endsec)
- if (value >= debug_sections[DEBUG_ABBREV].size)
- { - {
- if (debug_sections[DEBUG_ABBREV].data == NULL) - error (0, 0, "%s: .debug_info too small", dso->filename);
- error (0, 0, "%s: .debug_abbrev not present", dso->filename);
- else
- error (0, 0, "%s: DWARF CU abbrev offset too large",
- dso->filename);
- return 1; - return 1;
- } - }
+ /* Remember whether any .debug_types relocations might need + /* Remember whether any .debug_types relocations might need
+ to be updated. */ + to be updated. */
+ types_rel_updated = rel_updated; + types_rel_updated = rel_updated;
+
- cu_version = read_16 (ptr);
- if (cu_version != 2 && cu_version != 3 && cu_version != 4)
- {
- error (0, 0, "%s: DWARF version %d unhandled", dso->filename,
- cu_version);
- return 1;
- }
+ /* We might have to recalculate/rewrite the debug_line + /* We might have to recalculate/rewrite the debug_line
+ section. We need to do that before going into phase one + section. We need to do that before going into phase one
+ so we have all new offsets. We do this separately from + so we have all new offsets. We do this separately from
@ -1329,7 +1316,16 @@ index 6bea88551..b0849efd8 100644
+ { + {
+ edit_dwarf2_line (dso); + edit_dwarf2_line (dso);
- if (ptr_size == 0) - value = read_32_relocated (ptr);
- if (value >= debug_sections[DEBUG_ABBREV].size)
- {
- if (debug_sections[DEBUG_ABBREV].data == NULL)
- error (0, 0, "%s: .debug_abbrev not present", dso->filename);
- else
- error (0, 0, "%s: DWARF CU abbrev offset too large",
- dso->filename);
- return 1;
- }
+ /* The line table programs will be moved + /* The line table programs will be moved
+ forward/backwards a bit in the new data. Update the + forward/backwards a bit in the new data. Update the
+ debug_line relocations to the new offsets. */ + debug_line relocations to the new offsets. */
@ -1345,7 +1341,8 @@ index 6bea88551..b0849efd8 100644
+ if (rbuf == NULL) + if (rbuf == NULL)
+ error (1, errno, "%s: Could not allocate line relocations", + error (1, errno, "%s: Could not allocate line relocations",
+ dso->filename); + dso->filename);
+
- if (ptr_size == 0)
+ /* Sort them by offset into section. */ + /* Sort them by offset into section. */
+ for (size_t i = 0; i < rels; i++) + for (size_t i = 0; i < rels; i++)
{ {
@ -1437,14 +1434,13 @@ index 6bea88551..b0849efd8 100644
- if (rbuf == NULL) - if (rbuf == NULL)
- error (1, errno, "%s: Could not allocate line relocations", - error (1, errno, "%s: Could not allocate line relocations",
- dso->filename); - dso->filename);
-
- /* Sort them by offset into section. */
- for (size_t i = 0; i < rels; i++)
+ /* These relocations only happen in ET_REL files + /* These relocations only happen in ET_REL files
+ and are section offsets. */ + and are section offsets. */
+ GElf_Addr r_offset; + GElf_Addr r_offset;
+ size_t ndx = rbuf[i].ndx; + size_t ndx = rbuf[i].ndx;
+
- /* Sort them by offset into section. */
- for (size_t i = 0; i < rels; i++)
+ GElf_Rel rel; + GElf_Rel rel;
+ GElf_Rela rela; + GElf_Rela rela;
+ if (rtype == SHT_RELA) + if (rtype == SHT_RELA)
@ -1627,12 +1623,22 @@ index 6bea88551..b0849efd8 100644
- -
- offset_len = (macro_flags & 0x01) ? 8 : 4; - offset_len = (macro_flags & 0x01) ? 8 : 4;
- line_offset = (macro_flags & 0x02) ? 1 : 0; - line_offset = (macro_flags & 0x02) ? 1 : 0;
- + macro_version = read_16 (ptr);
+ macro_flags = read_8 (ptr);
+ if (macro_version < 4 || macro_version > 5)
+ error (1, 0, "unhandled .debug_macro version: %d",
+ macro_version);
+ if ((macro_flags & ~2) != 0)
+ error (1, 0, "unhandled .debug_macro flags: 0x%x",
+ macro_flags);
- if (offset_len != 4) - if (offset_len != 4)
- error (0, 1, - error (0, 1,
- "Cannot handle 8 byte macro offsets: %s", - "Cannot handle 8 byte macro offsets: %s",
- dso->filename); - dso->filename);
- + offset_len = (macro_flags & 0x01) ? 8 : 4;
+ line_offset = (macro_flags & 0x02) ? 1 : 0;
- /* Update the line_offset if it is there. */ - /* Update the line_offset if it is there. */
- if (line_offset) - if (line_offset)
- { - {
@ -1648,18 +1654,6 @@ index 6bea88551..b0849efd8 100644
- } - }
- } - }
- } - }
+ macro_version = read_16 (ptr);
+ macro_flags = read_8 (ptr);
+ if (macro_version < 4 || macro_version > 5)
+ error (1, 0, "unhandled .debug_macro version: %d",
+ macro_version);
+ if ((macro_flags & ~2) != 0)
+ error (1, 0, "unhandled .debug_macro flags: 0x%x",
+ macro_flags);
+
+ offset_len = (macro_flags & 0x01) ? 8 : 4;
+ line_offset = (macro_flags & 0x02) ? 1 : 0;
+
+ if (offset_len != 4) + if (offset_len != 4)
+ error (0, 1, + error (0, 1,
+ "Cannot handle 8 byte macro offsets: %s", + "Cannot handle 8 byte macro offsets: %s",
@ -1772,24 +1766,44 @@ index 6bea88551..b0849efd8 100644
- Elf_Data *strdata = debug_sections[DEBUG_STR].elf_data; - Elf_Data *strdata = debug_sections[DEBUG_STR].elf_data;
- int strndx = debug_sections[DEBUG_STR].sec; - int strndx = debug_sections[DEBUG_STR].sec;
- Elf_Scn *strscn = dso->scn[strndx]; - Elf_Scn *strscn = dso->scn[strndx];
- + if (rel_updated)
+ macro_rel_updated = true;
+ macro_sec = macro_sec->next;
+ }
+ }
- /* Out with the old. */ - /* Out with the old. */
- strdata->d_size = 0; - strdata->d_size = 0;
- /* In with the new. */ - /* In with the new. */
- strdata = elf_newdata (strscn); - strdata = elf_newdata (strscn);
-
- /* We really should check whether we had enough memory, - /* We really should check whether we had enough memory,
- but the old ebl version will just abort on out of - but the old ebl version will just abort on out of
- memory... */ - memory... */
- strtab_finalize (strtab, strdata); - strtab_finalize (strtab, strdata);
- debug_sections[DEBUG_STR].size = strdata->d_size; - debug_sections[DEBUG_STR].size = strdata->d_size;
- dso->strings.str_buf = strdata->d_buf; - dso->strings.str_buf = strdata->d_buf;
+ if (rel_updated) - }
+ macro_rel_updated = true; + /* Now handle all the DWARF5 line tables, they contain strp
+ macro_sec = macro_sec->next; + and/or line_strp entries that need to be registered/rewritten. */
} + setup_relbuf(dso, &debug_sections[DEBUG_LINE], &reltype);
- + rel_updated = false;
+ /* edit_dwarf2_line will have set this up, unless there are no
+ moved/resized (DWARF4) lines. In which case we can just use
+ the original section data. new_idx will have been setup
+ correctly, even if it is the same as old_idx. */
+ unsigned char *line_buf = (unsigned char *)dso->lines.line_buf;
+ if (line_buf == NULL)
+ line_buf = debug_sections[DEBUG_LINE].data;
+ for (int ldx = 0; ldx < dso->lines.used; ldx++)
+ {
+ struct line_table *t = &dso->lines.table[ldx];
+ if (t->version >= 5)
+ read_dwarf5_line (dso, line_buf + t->new_idx, t, phase);
} }
+ if (rel_updated)
+ line_rel_updated = true;
- /* After phase 1 we might have rewritten the debug_info with - /* After phase 1 we might have rewritten the debug_info with
- new strp, strings and/or linep offsets. */ - new strp, strings and/or linep offsets. */
@ -1799,38 +1813,6 @@ index 6bea88551..b0849efd8 100644
- dirty_section (DEBUG_MACRO); - dirty_section (DEBUG_MACRO);
- if (need_stmt_update) - if (need_stmt_update)
- dirty_section (DEBUG_LINE); - dirty_section (DEBUG_LINE);
- /* Update any relocations addends we might have touched. */
- if (info_rel_updated)
- update_rela_data (dso, &debug_sections[DEBUG_INFO]);
+ /* Now handle all the DWARF5 line tables, they contain strp
+ and/or line_strp entries that need to be registered/rewritten. */
+ setup_relbuf(dso, &debug_sections[DEBUG_LINE], &reltype);
+ rel_updated = false;
- if (macro_rel_updated)
+ /* edit_dwarf2_line will have set this up, unless there are no
+ moved/resized (DWARF4) lines. In which case we can just use
+ the original section data. new_idx will have been setup
+ correctly, even if it is the same as old_idx. */
+ unsigned char *line_buf = (unsigned char *)dso->lines.line_buf;
+ if (line_buf == NULL)
+ line_buf = debug_sections[DEBUG_LINE].data;
+ for (int ldx = 0; ldx < dso->lines.used; ldx++)
{
- struct debug_section *macro_sec = &debug_sections[DEBUG_MACRO];
- while (macro_sec != NULL)
- {
- update_rela_data (dso, macro_sec);
- macro_sec = macro_sec->next;
- }
+ struct line_table *t = &dso->lines.table[ldx];
+ if (t->version >= 5)
+ read_dwarf5_line (dso, line_buf + t->new_idx, t, phase);
}
+ if (rel_updated)
+ line_rel_updated = true;
+
+ /* Same for the debug_str and debug_line_str sections. + /* Same for the debug_str and debug_line_str sections.
+ Make sure everything is in place for phase 1 updating of debug_info + Make sure everything is in place for phase 1 updating of debug_info
+ references. */ + references. */
@ -1840,8 +1822,11 @@ index 6bea88551..b0849efd8 100644
+ if (phase == 0 && need_line_strp_update) + if (phase == 0 && need_line_strp_update)
+ edit_dwarf2_any_str (dso, &dso->debug_line_str, + edit_dwarf2_any_str (dso, &dso->debug_line_str,
+ &debug_sections[DEBUG_LINE_STR]); + &debug_sections[DEBUG_LINE_STR]);
} + }
- /* Update any relocations addends we might have touched. */
- if (info_rel_updated)
- update_rela_data (dso, &debug_sections[DEBUG_INFO]);
+ /* After phase 1 we might have rewritten the debug_info with + /* After phase 1 we might have rewritten the debug_info with
+ new strp, strings and/or linep offsets. */ + new strp, strings and/or linep offsets. */
+ if (need_strp_update || need_line_strp_update + if (need_strp_update || need_line_strp_update
@ -1854,7 +1839,8 @@ index 6bea88551..b0849efd8 100644
+ dirty_section (DEBUG_MACRO); + dirty_section (DEBUG_MACRO);
+ if (need_stmt_update || need_line_strp_update) + if (need_stmt_update || need_line_strp_update)
+ dirty_section (DEBUG_LINE); + dirty_section (DEBUG_LINE);
+
- if (macro_rel_updated)
+ /* Update any relocations addends we might have touched. */ + /* Update any relocations addends we might have touched. */
+ if (info_rel_updated) + if (info_rel_updated)
+ update_rela_data (dso, &debug_sections[DEBUG_INFO]); + update_rela_data (dso, &debug_sections[DEBUG_INFO]);
@ -1862,12 +1848,18 @@ index 6bea88551..b0849efd8 100644
+ { + {
+ struct debug_section *types_sec = &debug_sections[DEBUG_TYPES]; + struct debug_section *types_sec = &debug_sections[DEBUG_TYPES];
+ while (types_sec != NULL) + while (types_sec != NULL)
+ { {
- struct debug_section *macro_sec = &debug_sections[DEBUG_MACRO];
- while (macro_sec != NULL)
- {
- update_rela_data (dso, macro_sec);
- macro_sec = macro_sec->next;
- }
+ update_rela_data (dso, types_sec); + update_rela_data (dso, types_sec);
+ types_sec = types_sec->next; + types_sec = types_sec->next;
+ } }
+ } }
+
+ if (macro_rel_updated) + if (macro_rel_updated)
+ { + {
+ struct debug_section *macro_sec = &debug_sections[DEBUG_MACRO]; + struct debug_section *macro_sec = &debug_sections[DEBUG_MACRO];
@ -1904,7 +1896,7 @@ index 6bea88551..b0849efd8 100644
destroy_lines (&dso->lines); destroy_lines (&dso->lines);
free (dso); free (dso);
} }
@@ -2863,7 +3378,9 @@ main (int argc, char *argv[]) @@ -2862,7 +3377,9 @@ main (int argc, char *argv[])
in elfutils before 0.169 we will have to update and write out all in elfutils before 0.169 we will have to update and write out all
section data if any data has changed (when ELF_F_LAYOUT was section data if any data has changed (when ELF_F_LAYOUT was
set). https://sourceware.org/bugzilla/show_bug.cgi?id=21199 */ set). https://sourceware.org/bugzilla/show_bug.cgi?id=21199 */
@ -1915,7 +1907,7 @@ index 6bea88551..b0849efd8 100644
#if !_ELFUTILS_PREREQ (0, 169) #if !_ELFUTILS_PREREQ (0, 169)
/* string replacements or build_id updates don't change section size. */ /* string replacements or build_id updates don't change section size. */
@@ -2935,10 +3452,12 @@ main (int argc, char *argv[]) @@ -2934,10 +3451,12 @@ main (int argc, char *argv[])
GElf_Xword sec_size = shdr->sh_size; GElf_Xword sec_size = shdr->sh_size;
/* We might have changed the size (and content) of the /* We might have changed the size (and content) of the
@ -1929,7 +1921,7 @@ index 6bea88551..b0849efd8 100644
if (secnum == debug_sections[DEBUG_LINE].sec) if (secnum == debug_sections[DEBUG_LINE].sec)
sec_size = debug_sections[DEBUG_LINE].size; sec_size = debug_sections[DEBUG_LINE].size;
@@ -3008,7 +3527,8 @@ main (int argc, char *argv[]) @@ -3007,7 +3526,8 @@ main (int argc, char *argv[])
chmod (file, stat_buf.st_mode); chmod (file, stat_buf.st_mode);
free ((char *) dso->filename); free ((char *) dso->filename);
@ -1939,7 +1931,7 @@ index 6bea88551..b0849efd8 100644
destroy_lines (&dso->lines); destroy_lines (&dso->lines);
free (dso); free (dso);
@@ -3023,6 +3543,17 @@ main (int argc, char *argv[]) @@ -3022,6 +3542,17 @@ main (int argc, char *argv[])
macro_sec = next; macro_sec = next;
} }

View File

@ -1,20 +0,0 @@
--- ./lib/backend/dbi.c.orig 2020-11-18 09:37:08.314743771 +0000
+++ ./lib/backend/dbi.c 2020-11-18 09:42:34.025792074 +0000
@@ -77,7 +77,7 @@ dbDetectBackend(rpmdb rdb)
}
}
- if (!cfg) {
+ if (!cfg && (rdb->db_flags & RPMDB_FLAG_REBUILD) != 0) {
rpmlog(RPMLOG_WARNING, _("invalid %%_db_backend: %s\n"), db_backend);
goto exit;
}
@@ -97,7 +97,7 @@ dbDetectBackend(rpmdb rdb)
rpmlog(RPMLOG_WARNING,
_("Converting database from %s to %s backend\n"),
ondisk->name, cfg->name);
- } else {
+ } else if (*db_backend) {
rpmlog(RPMLOG_WARNING,
_("Found %s %s database while attempting %s backend: "
"using %s backend.\n"),

View File

@ -1,25 +0,0 @@
From a20edbb561f74ba608c0aa36be637e7245e596b5 Mon Sep 17 00:00:00 2001
From: ggardet <guillaume.gardet@opensuse.org>
Date: Fri, 9 Oct 2020 13:10:09 +0200
Subject: [PATCH] Do not fail if there is no "$temp"/res.* file
find-debuginfo is multi-threaded and rpm runs
scripts usually with "-e" to abort on error.
If the debug-splitting tool fails, that job will abort.
But if you have X files that are problematic in the tree,
and you have X or less jobs, find-debuginfo will abort
as no single res.$number has been written.
But if you have more than X jobs, the build will succeed,
which makes the whole process random.
This commit remove this randomness.
--- scripts/find-debuginfo.sh.orig
+++ scripts/find-debuginfo.sh
@@ -498,6 +498,7 @@ else
wait
)
for f in "$temp"/res.*; do
+ test -f "$f" || continue
res=$(< "$f")
if [ "$res" != "0" ]; then
exit 1

375
posttrans.diff Normal file
View File

@ -0,0 +1,375 @@
--- ./lib/poptI.c.orig 2021-04-09 11:28:12.359647290 +0000
+++ ./lib/poptI.c 2021-04-09 11:28:15.523640983 +0000
@@ -265,6 +265,10 @@ struct poptOption rpmInstallPoptTable[]
&rpmIArgs.installInterfaceFlags, (INSTALL_REINSTALL|INSTALL_INSTALL),
N_("reinstall 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 2021-04-09 11:28:12.359647290 +0000
+++ ./lib/psm.c 2021-04-09 11:28:15.527640975 +0000
@@ -810,7 +810,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/rpmcli.h.orig 2021-04-09 11:28:12.359647290 +0000
+++ ./lib/rpmcli.h 2021-04-09 11:28:15.527640975 +0000
@@ -304,6 +304,7 @@ enum rpmInstallFlags_e {
INSTALL_ERASE = (1 << 8), /*!< from --erase */
INSTALL_ALLMATCHES = (1 << 9), /*!< from --allmatches */
INSTALL_REINSTALL = (1 << 10), /*!< from --reinstall */
+ INSTALL_RUNPOSTTRANS = (1 << 11), /*!< from --runposttrans */
};
typedef rpmFlags rpmInstallFlags;
@@ -385,6 +386,15 @@ int rpmInstall(rpmts ts, struct rpmInsta
int rpmErase(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;
--- ./lib/rpminstall.c.orig 2021-04-09 11:28:12.363647282 +0000
+++ ./lib/rpminstall.c 2021-04-09 11:28:15.527640975 +0000
@@ -4,6 +4,8 @@
#include "system.h"
+#include <errno.h>
+
#include <rpm/rpmcli.h>
#include <rpm/rpmtag.h>
#include <rpm/rpmlib.h> /* rpmReadPackageFile, vercmp etc */
@@ -772,3 +774,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 2021-04-09 11:28:12.363647282 +0000
+++ ./lib/rpmtriggers.c 2021-04-09 11:31:46.999219563 +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) {
@@ -177,6 +178,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),
@@ -583,6 +592,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 2021-04-09 11:28:12.363647282 +0000
+++ ./lib/rpmtriggers.h 2021-04-09 11:28:15.527640975 +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.h.orig 2021-04-09 11:28:12.363647282 +0000
+++ ./lib/rpmts.h 2021-04-09 11:28:15.527640975 +0000
@@ -229,6 +229,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/rpmts_internal.h.orig 2021-04-09 11:28:12.363647282 +0000
+++ ./lib/rpmts_internal.h 2021-04-09 11:28:15.527640975 +0000
@@ -87,6 +87,7 @@ struct rpmts_s {
rpmtriggers trigs2run; /*!< Transaction file triggers */
int min_writes; /*!< macro minimize_writes used */
+ int dump_posttrans; /*!< macro dump_posttrans used */
};
#ifdef __cplusplus
--- ./lib/transaction.c.orig 2021-04-09 11:28:12.363647282 +0000
+++ ./lib/transaction.c 2021-04-09 11:33:22.247029757 +0000
@@ -1468,6 +1468,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;
}
@@ -1846,22 +1848,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 */
@@ -1884,3 +1890,110 @@ exit:
rpmsqSetAction(SIGPIPE, oact);
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 2021-04-09 11:28:12.363647282 +0000
+++ ./rpm.c 2021-04-09 11:28:15.527640975 +0000
@@ -19,6 +19,7 @@ enum modes {
MODE_INSTALL = (1 << 1),
MODE_ERASE = (1 << 2),
#define MODES_IE (MODE_INSTALL | MODE_ERASE)
+ MODE_RUNPOSTTRANS = (1 << 4),
MODE_UNKNOWN = 0
};
@@ -114,6 +115,11 @@ int main(int argc, char *argv[])
INSTALL_INSTALL|INSTALL_REINSTALL));
int eflags = (ia->installInterfaceFlags & INSTALL_ERASE);
+ if (ia->installInterfaceFlags & INSTALL_RUNPOSTTRANS) {
+ if (iflags || eflags)
+ argerror(_("only one major mode may be specified"));
+ bigMode = MODE_RUNPOSTTRANS;
+ }
if (iflags & eflags)
argerror(_("only one major mode may be specified"));
else if (iflags)
@@ -286,6 +292,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);

View File

@ -1,3 +1,8 @@
-------------------------------------------------------------------
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 Wed Sep 30 14:17:40 CEST 2020 - mls@suse.de

View File

@ -21,7 +21,7 @@
%global with_python 1 %global with_python 1
%{?!python_module:%define python_module() python-%{**} python3-%{**}} %{?!python_module:%define python_module() python-%{**} python3-%{**}}
Name: python-rpm Name: python-rpm
Version: 4.16.0 Version: 4.16.1.3
Release: 0 Release: 0
Summary: Python Bindings for Manipulating RPM Packages Summary: Python Bindings for Manipulating RPM Packages
License: GPL-2.0-or-later License: GPL-2.0-or-later

View File

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:ca5974e9da2939afb422598818ef187385061889ba766166c4a3829c5ef8d411
size 4341683

3
rpm-4.16.1.3.tar.bz2 Normal file
View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:513dc7f972b6e7ccfc9fc7f9c01d5310cc56ee853892e4314fa2cad71478e21d
size 4354652

View File

@ -1,3 +1,31 @@
-------------------------------------------------------------------
Fri Apr 9 13:34:24 CEST 2021 - mls@suse.de
- change dump_posttrans mechanism to imply --noposttrans so that
libzypp can be compatible with older rpm versions
changed patch: posttrans.diff
-------------------------------------------------------------------
Tue Apr 6 08:42:29 UTC 2021 - Andreas Schwab <schwab@suse.de>
- auto-config-update-aarch64-ppc64le.diff: Use timestamp in file instead
of searching for arch name, which cannot handle all cases
-------------------------------------------------------------------
Tue Mar 30 11:15:44 CEST 2021 - mls@suse.de
- update to rpm-4.16.1.3
* security fixes for CVE-2021-3421, CVE-2021-20271, CVE-2021-20266
* fix bdb_ro failing to open database with missing secondary indexes
* dropped: finddebuginfo-check-res-file.patch
* dropped: empty_dbbackend.diff
- require the exact version of librpmbuild in the rpm-build
package [bnc#1180965]
- reformat dwarf5.diff
- add dump_posttrans and --runposttrans options to make it possible
for libzypp to implement file triggers
new patch: posttrans.diff
------------------------------------------------------------------- -------------------------------------------------------------------
Mon Feb 22 12:57:44 UTC 2021 - Martin Liška <mliska@suse.cz> Mon Feb 22 12:57:44 UTC 2021 - Martin Liška <mliska@suse.cz>

View File

@ -59,7 +59,7 @@ Requires: /usr/bin/awk
Summary: The RPM Package Manager Summary: The RPM Package Manager
License: GPL-2.0-or-later License: GPL-2.0-or-later
Group: System/Packages Group: System/Packages
Version: 4.16.0 Version: 4.16.1.3
Release: 0 Release: 0
URL: https://rpm.org/ URL: https://rpm.org/
#Git-Clone: https://github.com/rpm-software-management/rpm #Git-Clone: https://github.com/rpm-software-management/rpm
@ -125,10 +125,9 @@ Patch109: pythondistdeps.diff
Patch117: findsupplements.diff Patch117: findsupplements.diff
Patch122: db_conversion.diff Patch122: db_conversion.diff
Patch123: nextiteratorheaderblob.diff Patch123: nextiteratorheaderblob.diff
Patch127: finddebuginfo-check-res-file.patch
Patch128: empty_dbbackend.diff
Patch129: ndbglue.diff Patch129: ndbglue.diff
Patch130: dwarf5.diff Patch130: dwarf5.diff
Patch131: posttrans.diff
Patch6464: auto-config-update-aarch64-ppc64le.diff Patch6464: auto-config-update-aarch64-ppc64le.diff
BuildRoot: %{_tmppath}/%{name}-%{version}-build BuildRoot: %{_tmppath}/%{name}-%{version}-build
# #
@ -171,6 +170,7 @@ need an intimate knowledge of RPM packages in order to function.
%package build %package build
Summary: Tools and Scripts to create rpm packages Summary: Tools and Scripts to create rpm packages
Group: System/Packages Group: System/Packages
Requires: librpmbuild%{librpmsover} = %{version}
Requires: rpm = %{version} Requires: rpm = %{version}
Provides: rpm:%_bindir/rpmbuild Provides: rpm:%_bindir/rpmbuild
Provides: rpmbuild Provides: rpmbuild
@ -255,8 +255,7 @@ cp build-aux/config.guess build-aux/config.sub db/dist/
%patch -P 93 -P 94 -P 99 %patch -P 93 -P 94 -P 99
%patch -P 100 -P 102 -P 103 %patch -P 100 -P 102 -P 103
%patch -P 109 -P 117 %patch -P 109 -P 117
%patch -P 122 -P 123 -P 127 -P 128 -P 129 %patch -P 122 -P 123 -P 129 -P 130 -P 131
%patch130 -p1
%ifarch aarch64 ppc64le riscv64 %ifarch aarch64 ppc64le riscv64
%patch6464 %patch6464