Navigation Menu

Skip to content

Commit

Permalink
[rpm] Backport upstream changes to support newer RPM. JB#28828
Browse files Browse the repository at this point in the history
  • Loading branch information
Andrew Branson committed May 28, 2018
1 parent cdb7b77 commit b201321
Show file tree
Hide file tree
Showing 5 changed files with 1,120 additions and 0 deletions.
121 changes: 121 additions & 0 deletions rpm/0001-Get-pre-posttrans-scripts-from-RpmHeader.patch
@@ -0,0 +1,121 @@
From ec0df2f6360e498e0aa3251a5a926d67d74c5434 Mon, 28 May 2018 15:34:57 +0200
From: Michael Andres <ma@suse.de>
Date: Sat, 25 Jan 2014 17:05:48 +0100
Subject: [PATCH] Get pre/posttrans scripts from RpmHeader


diff --git a/zypp/target/rpm/RpmHeader.cc b/zypp/target/rpm/RpmHeader.cc
index 45e4b90..c638dd7 100644
--- a/zypp/target/rpm/RpmHeader.cc
+++ b/zypp/target/rpm/RpmHeader.cc
@@ -751,59 +751,44 @@
std::string RpmHeader::tag_os() const
{
return string_val( RPMTAG_OS );
+
}

-///////////////////////////////////////////////////////////////////
-//
-//
-// METHOD NAME : RpmHeader::tag_prein
-// METHOD TYPE : std::string
-//
-// DESCRIPTION :
-//
std::string RpmHeader::tag_prein() const
-{
- return string_val( RPMTAG_PREIN );
-}
+{ return string_val( RPMTAG_PREIN ); }

-///////////////////////////////////////////////////////////////////
-//
-//
-// METHOD NAME : RpmHeader::tag_postin
-// METHOD TYPE : std::string
-//
-// DESCRIPTION :
-//
+std::string RpmHeader::tag_preinprog() const
+{ return string_val( RPMTAG_PREINPROG ); }
+
std::string RpmHeader::tag_postin() const
-{
- return string_val( RPMTAG_POSTIN );
-}
+{ return string_val( RPMTAG_POSTIN ); }

-///////////////////////////////////////////////////////////////////
-//
-//
-// METHOD NAME : RpmHeader::tag_preun
-// METHOD TYPE : std::string
-//
-// DESCRIPTION :
-//
+std::string RpmHeader::tag_postinprog() const
+{ return string_val( RPMTAG_POSTINPROG ); }
+
std::string RpmHeader::tag_preun() const
-{
- return string_val( RPMTAG_PREUN );
-}
+{ return string_val( RPMTAG_PREUN ); }

-///////////////////////////////////////////////////////////////////
-//
-//
-// METHOD NAME : RpmHeader::tag_postun
-// METHOD TYPE : std::string
-//
-// DESCRIPTION :
-//
+std::string RpmHeader::tag_preunprog() const
+{ return string_val( RPMTAG_PREUNPROG ); }
+
std::string RpmHeader::tag_postun() const
-{
- return string_val( RPMTAG_POSTUN );
-}
+{ return string_val( RPMTAG_POSTUN ); }
+
+std::string RpmHeader::tag_postunprog() const
+{ return string_val( RPMTAG_POSTUNPROG ); }
+
+std::string RpmHeader::tag_pretrans() const
+{ return string_val( RPMTAG_PRETRANS ); }
+
+std::string RpmHeader::tag_pretransprog() const
+{ return string_val( RPMTAG_PRETRANSPROG ); }
+
+std::string RpmHeader::tag_posttrans() const
+{ return string_val( RPMTAG_POSTTRANS ); }
+
+std::string RpmHeader::tag_posttransprog() const
+{ return string_val( RPMTAG_POSTTRANSPROG ); }

///////////////////////////////////////////////////////////////////
//
diff --git a/zypp/target/rpm/RpmHeader.h b/zypp/target/rpm/RpmHeader.h
index 02dd8d1..eae75ca 100644
--- a/zypp/target/rpm/RpmHeader.h
+++ b/zypp/target/rpm/RpmHeader.h
@@ -145,9 +145,17 @@
std::string tag_url() const;
std::string tag_os() const;
std::string tag_prein() const;
+ std::string tag_preinprog() const;
std::string tag_postin() const;
+ std::string tag_postinprog() const;
std::string tag_preun() const;
+ std::string tag_preunprog() const;
std::string tag_postun() const;
+ std::string tag_postunprog() const;
+ std::string tag_pretrans() const;
+ std::string tag_pretransprog() const;
+ std::string tag_posttrans() const;
+ std::string tag_posttransprog()const;
std::string tag_sourcerpm() const;

/** just the list of names */
131 changes: 131 additions & 0 deletions rpm/0002-adapt-to-new-rpm-weak-dependency-tags.patch
@@ -0,0 +1,131 @@
From 14d33595257bc6f8f31a8b0ed64441a2162e8880 Mon, 28 May 2018 15:07:41 +0200
From: Michael Schroeder <mls@suse.de>
Date: Fri, 21 Feb 2014 13:21:14 +0100
Subject: [PATCH] adapt to new rpm weak dependency tags


diff --git a/zypp/target/rpm/RpmHeader.cc b/zypp/target/rpm/RpmHeader.cc
index c638dd7..e4327e5 100644
--- a/zypp/target/rpm/RpmHeader.cc
+++ b/zypp/target/rpm/RpmHeader.cc
@@ -422,6 +422,32 @@
kindFlags = RPMTAG_CONFLICTFLAGS;
kindVersion = RPMTAG_CONFLICTVERSION;
break;
+#ifdef RPMTAG_OLDSUGGESTS
+ case RPMTAG_OLDENHANCESNAME:
+ kindFlags = RPMTAG_OLDENHANCESFLAGS;
+ kindVersion = RPMTAG_OLDENHANCESVERSION;
+ break;
+ case RPMTAG_OLDSUGGESTSNAME:
+ kindFlags = RPMTAG_OLDSUGGESTSFLAGS;
+ kindVersion = RPMTAG_OLDSUGGESTSVERSION;
+ break;
+ case RPMTAG_RECOMMENDNAME:
+ kindFlags = RPMTAG_RECOMMENDFLAGS;
+ kindVersion = RPMTAG_RECOMMENDVERSION;
+ break;
+ case RPMTAG_SUPPLEMENTNAME:
+ kindFlags = RPMTAG_SUPPLEMENTFLAGS;
+ kindVersion = RPMTAG_SUPPLEMENTVERSION;
+ break;
+ case RPMTAG_SUGGESTNAME:
+ kindFlags = RPMTAG_SUGGESTFLAGS;
+ kindVersion = RPMTAG_SUGGESTVERSION;
+ break;
+ case RPMTAG_ENHANCENAME:
+ kindFlags = RPMTAG_ENHANCEFLAGS;
+ kindVersion = RPMTAG_ENHANCEVERSION;
+ break;
+#else
case RPMTAG_ENHANCESNAME:
kindFlags = RPMTAG_ENHANCESFLAGS;
kindVersion = RPMTAG_ENHANCESVERSION;
@@ -430,6 +456,7 @@
kindFlags = RPMTAG_SUGGESTSFLAGS;
kindVersion = RPMTAG_SUGGESTSVERSION;
break;
+#endif
default:
INT << "Illegal RPMTAG_dependencyNAME " << tag_r << endl;
return ret;
@@ -581,7 +608,11 @@
//
CapabilitySet RpmHeader::tag_enhances( std::set<std::string> * freq_r ) const
{
+#ifdef RPMTAG_OLDSUGGESTS
+ return PkgRelList_val( RPMTAG_ENHANCENAME, false, freq_r );
+#else
return PkgRelList_val( RPMTAG_ENHANCESNAME, false, freq_r );
+#endif
}

///////////////////////////////////////////////////////////////////
@@ -594,7 +625,45 @@
//
CapabilitySet RpmHeader::tag_suggests( std::set<std::string> * freq_r ) const
{
+#ifdef RPMTAG_OLDSUGGESTS
+ return PkgRelList_val( RPMTAG_SUGGESTNAME, false, freq_r );
+#else
return PkgRelList_val( RPMTAG_SUGGESTSNAME, false, freq_r );
+#endif
+ }
+
+///////////////////////////////////////////////////////////////////
+//
+//
+// METHOD NAME : RpmHeader::tag_supplements
+// METHOD TYPE : CapabilitySet
+//
+// DESCRIPTION :
+//
+CapabilitySet RpmHeader::tag_supplements( std::set<std::string> * freq_r ) const
+ {
+#ifdef RPMTAG_OLDSUGGESTS
+ return PkgRelList_val( RPMTAG_SUPPLEMENTNAME, false, freq_r );
+#else
+ return CapabilitySet();
+#endif
+ }
+
+///////////////////////////////////////////////////////////////////
+//
+//
+// METHOD NAME : RpmHeader::tag_recommends
+// METHOD TYPE : CapabilitySet
+//
+// DESCRIPTION :
+//
+CapabilitySet RpmHeader::tag_recommends( std::set<std::string> * freq_r ) const
+ {
+#ifdef RPMTAG_OLDSUGGESTS
+ return PkgRelList_val( RPMTAG_RECOMMENDNAME, false, freq_r );
+#else
+ return CapabilitySet();
+#endif
}

///////////////////////////////////////////////////////////////////
diff --git a/zypp/target/rpm/RpmHeader.h b/zypp/target/rpm/RpmHeader.h
index eae75ca..697b2cb 100644
--- a/zypp/target/rpm/RpmHeader.h
+++ b/zypp/target/rpm/RpmHeader.h
@@ -125,11 +125,14 @@
* @see #tag_provides
**/
CapabilitySet tag_suggests( std::set<std::string> * freq_r = 0 ) const;
- /** Unsupported by rpm.
+ /**
* @see #tag_provides
**/
- CapabilitySet tag_supplements( std::set<std::string> * freq_r = 0 ) const
- { return CapabilitySet(); }
+ CapabilitySet tag_supplements( std::set<std::string> * freq_r = 0 ) const;
+ /**
+ * @see #tag_provides
+ **/
+ CapabilitySet tag_recommends( std::set<std::string> * freq_r = 0 ) const;

ByteCount tag_size() const;
ByteCount tag_archivesize() const;
34 changes: 34 additions & 0 deletions rpm/0003-Adapt-to-API-changes-in-rpm412.patch
@@ -0,0 +1,34 @@
From e6982194dd7e7d1521c52dec5508a22e188da257 Mon, 28 May 2018 15:08:37 +0200
From: Michael Andres <ma@suse.de>
Date: Mon, 22 Sep 2014 14:20:47 +0200
Subject: [PATCH] Adapt to API changes in rpm.4.12


diff --git a/zypp/target/rpm/librpm.h b/zypp/target/rpm/librpm.h
index 2d7425d..17e801d 100644
--- a/zypp/target/rpm/librpm.h
+++ b/zypp/target/rpm/librpm.h
@@ -28,6 +28,7 @@
#include <rpm/rpmmacro.h>
#include <rpm/rpmdb.h>
#include <rpm/rpmts.h>
+#include <rpm/rpmfi.h>
#include <fcntl.h>
}

diff --git a/zypp/target/rpm/librpmDb.cc b/zypp/target/rpm/librpmDb.cc
index 3f472f4..cc419dd 100644
--- a/zypp/target/rpm/librpmDb.cc
+++ b/zypp/target/rpm/librpmDb.cc
@@ -679,7 +679,11 @@
if ( ! create( RPMDBI_PACKAGES ) )
return false;
#warning TESTCASE: rpmdbAppendIterator and (non)sequential access?
+#ifdef RPMFILEITERMAX // since rpm.4.12
+ ::rpmdbAppendIterator( _mi, (const unsigned *)&off_r, 1 );
+#else
::rpmdbAppendIterator( _mi, &off_r, 1 );
+#endif
return advance();
}

0 comments on commit b201321

Please sign in to comment.