#
SET(LIBZYPP_MAJOR "3")
-SET(LIBZYPP_MINOR "23")
-SET(LIBZYPP_COMPATMINOR "23")
-SET(LIBZYPP_PATCH "2")
+SET(LIBZYPP_MINOR "24")
+SET(LIBZYPP_COMPATMINOR "24")
+SET(LIBZYPP_PATCH "0")
const Edition & ed_r,
const Arch & arch_r )
{
- INT << name_r << "-" << ed_r << "." << arch_r << endl;
+ if ( ed_r == Edition::noedition )
+ return true;
+ if ( name_r == "kernel-default" && ed_r == Edition("2.6.22.5-10") )
+ return true;
+ if ( name_r == "update-test-affects-package-manager" && ed_r == Edition("1.1-6") )
+ return true;
+
return false;
}
+
ManagedFile repoProvidePackage( const PoolItem & pi )
{
ResPool _pool( getZYpp()->pool() );
repoManager.cleanCache( nrepo );
}
SEC << "refreshMetadata" << endl;
- repoManager.refreshMetadata( nrepo, RepoManager::RefreshForced );
+ //repoManager.refreshMetadata( nrepo, RepoManager::RefreshForced );
+ repoManager.refreshMetadata( nrepo );
SEC << "buildCache" << endl;
repoManager.buildCache( nrepo );
}
USR << "pool: " << pool << endl;
SEC << pool.knownRepositoriesSize() << endl;
- if ( 1 )
+ if ( 0 )
{
{
zypp::base::LogControl::TmpLineWriter shutUp;
DBG << "patch: " << deltas.patchRpms(0).size() << " " << deltas.patchRpms(0) << endl;
DBG << "delta: " << deltas.deltaRpms(0).size() << " " << deltas.deltaRpms(0) << endl;
+ PoolItem pi( getPi<Package>( "kernel-default", Edition("2.6.22.5-12") ) );
+ USR << pi << endl;
+ USR << repoProvidePackage( pi ) << endl;
- PoolItem pi( getPi<Package>( "kernel-default" ) );
+ pi = getPi<Package>( "update-test-affects-package-manager", Edition("99-99") );
USR << pi << endl;
+ USR << repoProvidePackage( pi ) << endl;
+
///////////////////////////////////////////////////////////////////
INT << "===[END]============================================" << endl << endl;
-------------------------------------------------------------------
+Fri Sep 14 22:57:54 CEST 2007 - ma@suse.de
+
+- Enable using patch and delta rpms. (#309124)
+- version 3.24.0
+
+-------------------------------------------------------------------
Thu Sep 13 17:59:55 CEST 2007 - ma@suse.de
- On update do not delete unmaintained non-SuSE packages.
// 22 packages and 6 patches
BOOST_CHECK_EQUAL( repositoryImpl->resolvables().size(), 42 );
// 19 patch rpms
- BOOST_CHECK_EQUAL( repositoryImpl->patchRpms().size(), 19 );
+ // but only 13 are compatible with x86_64_
+ BOOST_CHECK_EQUAL( repositoryImpl->patchRpms().size(), 13 );
//check_tables_clean(tmpdir);
}
count_shared_cmd.reset( new sqlite3_command( con, "select count(id) from resolvables where shared_id=:rid;" ));
insert_patchrpm_cmd.reset( new sqlite3_command (con,
- "insert into patch_packages (repository_id, media_nr, location, checksum, checksum_type, download_size, build_time) "
- "values (:repository_id, :media_nr, :location, :checksum, :checksum_type, :download_size, :build_time);" ));
+ "insert into patch_packages (repository_id, name, version, release, epoch, arch, media_nr, location, checksum, checksum_type, download_size, build_time) "
+ "values (:repository_id, :name, :version, :release, :epoch, :arch, :media_nr, :location, :checksum, :checksum_type, :download_size, :build_time);" ));
insert_deltarpm_cmd.reset( new sqlite3_command (con,
- "insert into delta_packages (repository_id, media_nr, location, checksum, checksum_type, download_size, build_time, "
+ "insert into delta_packages (repository_id, name, version, release, epoch, arch, media_nr, location, checksum, checksum_type, download_size, build_time, "
"baseversion_version, baseversion_release, baseversion_epoch, baseversion_checksum, "
"baseversion_build_time, baseversion_sequence_info) "
- "values (:repository_id, :media_nr, :location, :checksum, :checksum_type, :download_size, :build_time, "
+ "values (:repository_id, :name, :version, :release, :epoch, :arch, :media_nr, :location, :checksum, :checksum_type, :download_size, :build_time, "
":baseversion_version, :baseversion_release, :baseversion_epoch, :baseversion_checksum, "
":baseversion_build_time, :baseversion_sequence_info);" ));
append_patch_baseversion_cmd.reset( new sqlite3_command (con,
{
RecordId id;
- //! \todo what's this? _pimpl->insert_patchrpm_cmd->bind(":media_nr", ???);
_pimpl->insert_patchrpm_cmd->bind(":repository_id", repository_id);
+
+ _pimpl->insert_patchrpm_cmd->bind(":name", prpm->name);
+ _pimpl->insert_patchrpm_cmd->bind(":version", prpm->edition.version());
+ _pimpl->insert_patchrpm_cmd->bind(":release", prpm->edition.release());
+ _pimpl->insert_patchrpm_cmd->bind(":epoch", (int) prpm->edition.epoch());
+ _pimpl->insert_patchrpm_cmd->bind(":arch", lookupOrAppendType("arch", prpm->arch.asString()));
+
+ _pimpl->insert_patchrpm_cmd->bind(":media_nr", (int) prpm->location.medianr());
_pimpl->insert_patchrpm_cmd->bind(":location", prpm->location.filename().asString());
_pimpl->insert_patchrpm_cmd->bind(":checksum", prpm->location.checksum().checksum());
_pimpl->insert_patchrpm_cmd->bind(":checksum_type", prpm->location.checksum().type());
- //! \todo checksum type
_pimpl->insert_patchrpm_cmd->bind(":download_size", static_cast<ByteCount::SizeType>(prpm->location.downloadSize()));
_pimpl->insert_patchrpm_cmd->bind(":build_time", prpm->buildTime.asSeconds());
_pimpl->insert_patchrpm_cmd->executenonquery();
{
RecordId id;
- //! \todo what's this? _pimpl->insert_deltarpm_cmd->bind(":media_nr", ???);
_pimpl->insert_deltarpm_cmd->bind(":repository_id", repository_id);
+
+ _pimpl->insert_deltarpm_cmd->bind(":name", drpm->name);
+ _pimpl->insert_deltarpm_cmd->bind(":version", drpm->edition.version());
+ _pimpl->insert_deltarpm_cmd->bind(":release", drpm->edition.release());
+ _pimpl->insert_deltarpm_cmd->bind(":epoch", (int) drpm->edition.epoch());
+ _pimpl->insert_deltarpm_cmd->bind(":arch", lookupOrAppendType("arch", drpm->arch.asString()));
+
+ _pimpl->insert_deltarpm_cmd->bind(":media_nr", (int) drpm->location.medianr());
_pimpl->insert_deltarpm_cmd->bind(":location", drpm->location.filename().asString());
_pimpl->insert_deltarpm_cmd->bind(":checksum", drpm->location.checksum().checksum());
_pimpl->insert_deltarpm_cmd->bind(":checksum", drpm->location.checksum().checksum());
_pimpl->insert_deltarpm_cmd->bind(":checksum_type", drpm->location.checksum().type());
- //! \todo checksum type
_pimpl->insert_deltarpm_cmd->bind(":download_size", static_cast<ByteCount::SizeType>(drpm->location.downloadSize()));
_pimpl->insert_deltarpm_cmd->bind(":build_time", drpm->buildTime.asSeconds());
CREATE TABLE delta_packages (
id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL
+ , name TEXT
+ , version TEXT
+ , release TEXT
+ , epoch INTEGER
+ , arch INTEGER REFERENCES types(id)
, media_nr INTEGER
, location TEXT
, checksum TEXT
CREATE TABLE patch_packages (
id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL
+ , name TEXT
+ , version TEXT
+ , release TEXT
+ , epoch INTEGER
+ , arch INTEGER REFERENCES types(id)
, media_nr INTEGER
, location TEXT
, checksum TEXT
DELETE FROM file_capabilities WHERE resolvable_id = old.id;
DELETE FROM split_capabilities WHERE resolvable_id = old.id;
DELETE FROM other_capabilities WHERE resolvable_id = old.id;
-
+
DELETE FROM text_attributes WHERE weak_resolvable_id = old.id;
DELETE FROM numeric_attributes WHERE weak_resolvable_id = old.id;
DELETE FROM resolvable_disk_usage WHERE resolvable_id = old.id;
// << " enhances:" << endl << enhances << endl
}
+
+std::ostream & RpmBase::dumpOn( std::ostream & str ) const
+{
+ str << "Patch/Delta[ " << name << " " << edition << " " << arch << " ]";
+ return str;
+}
+
} // namespace cache
} // namespace zypp
{
// Base <patchrpm>/<deltarpm> element attributes
- Arch attr_arch;
- std::string attr_filename;
- std::string attr_md5sum;
- ByteCount attr_downloadSize;
- Date attr_buildTime;
-
- // Shared RPM data
-
+ std::string name; // target rpm name
+ Edition edition; // target rpm edition
+ Arch arch; // target rpm architecture
OnMediaLocation location;
- Date buildTime;
- Date fileTime;
- ByteCount archiveSize; // ??
+ Date buildTime;
+ Date fileTime;
+ ByteCount archiveSize; // ??
+ protected:
+ /** Overload to realize std::ostream & operator\<\<. */
+ virtual std::ostream & dumpOn( std::ostream & str ) const;
};
DEFINE_PTR_TYPE(PatchRpm);
#include "zypp/parser/yum/PatchFileReader.h"
#include "zypp/parser/yum/FileReaderBaseImpl.h"
+#include "zypp/ZConfig.h"
#undef ZYPP_BASE_LOGGER_LOGGROUP
#define ZYPP_BASE_LOGGER_LOGGROUP "parser::yum"
data::PatchRpm_Ptr tmp;
tmp.swap(_patchrpm);
data::PackageAtom_Ptr patom_ptr = zypp::dynamic_pointer_cast<data::PackageAtom>(_tmpResObj);
- if (patom_ptr)
+ if (patom_ptr && patom_ptr->arch.compatibleWith( ZConfig::instance().systemArchitecture() ))
+ {
+ // Patch and delta rpms are standalone objects.
+ // We must store the target packages NVRA.
+ // We don't store incompatible archs.
+ tmp->name = patom_ptr->name;
+ tmp->edition = patom_ptr->edition;
+ tmp->arch = patom_ptr->arch;
patom_ptr->patchRpms.insert(tmp);
+ }
toParentTag();
return true;
}
data::DeltaRpm_Ptr tmp;
tmp.swap(_deltarpm);
data::PackageAtom_Ptr patom_ptr = zypp::dynamic_pointer_cast<data::PackageAtom>(_tmpResObj);
- if (patom_ptr)
+ if (patom_ptr && patom_ptr->arch.compatibleWith( ZConfig::instance().systemArchitecture() ))
+ {
+ // Patch and delta rpms are standalone objects.
+ // We must store the target packages NVRA.
+ // We don't store incompatible archs.
+ tmp->name = patom_ptr->name;
+ tmp->edition = patom_ptr->edition;
+ tmp->arch = patom_ptr->arch;
patom_ptr->deltaRpms.insert(tmp);
+ }
toParentTag();
return true;
}
{
public:
-
+
Impl( const std::list<Repository> & repos )
: repos(repos)
{
-
+
}
friend Impl * rwcowClone<Impl>( const Impl * rhs );
/** clone for RWCOW_pointer */
Impl * clone() const
{ return new Impl( *this ); }
-
+
std::list<Repository> repos;
};
///////////////////////////////////////////////////////////////////
std::list<PatchRpm> DeltaCandidates::patchRpms(const Package::constPtr & package ) const
{
std::list<PatchRpm> candidates;
-
+
// query all repos
for ( std::list<Repository>::const_iterator it = _pimpl->repos.begin();
it != _pimpl->repos.end();
dit != candidates_in_repo.end();
++dit )
{
- PatchRpm delta(*dit);
- candidates.push_back(delta);
+ if ( ! package
+ || ( package->name() == dit->name()
+ && package->edition() == dit->edition()
+ && package->arch() == dit->arch() ) )
+ {
+ candidates.push_back( *dit );
+ }
}
}
return candidates;
}
-
+
std::list<DeltaRpm> DeltaCandidates::deltaRpms(const Package::constPtr & package) const
{
std::list<DeltaRpm> candidates;
-
+
// query all repos
for ( std::list<Repository>::const_iterator it = _pimpl->repos.begin();
it != _pimpl->repos.end();
dit != candidates_in_repo.end();
++dit )
{
- DeltaRpm delta(*dit);
- candidates.push_back(delta);
+ if ( ! package
+ || ( package->name() == dit->name()
+ && package->edition() == dit->edition()
+ && package->arch() == dit->arch() ) )
+ {
+ candidates.push_back( *dit );
+ }
}
}
return candidates;
}
-
+
std::ostream & operator<<( std::ostream & str, const DeltaCandidates & obj )
{
return str << *obj._pimpl;
std::ostream & operator<<( std::ostream & str, const PatchRpm & obj )
{
str
- << "PatchRpm(" << obj.location()
+ << "PatchRpm[" << obj.name() << "-" << obj.edition() << "." << obj.arch()
+ << "](" << obj.location()
<< '|' << obj.buildtime()
<< '|';
return dumpRangeLine( str, obj.baseversions().begin(), obj.baseversions().end() )
std::ostream & operator<<( std::ostream & str, const DeltaRpm & obj )
{
return str
- << "DeltaRpm(" << obj.location()
+ << "DeltaRpm[" << obj.name() << "-" << obj.edition() << "." << obj.arch()
+ << "](" << obj.location()
<< '|' << obj.buildtime()
<< '|' << obj.baseversion().edition()
<< ',' << obj.baseversion().buildtime()
#include "zypp/OnMediaLocation.h"
#include "zypp/Edition.h"
+#include "zypp/Arch.h"
#include "zypp/Date.h"
///////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////
+ /** \todo cheap copy! (switch to RWCOW) */
class PatchRpm
{
public:
{}
public:
+ /** \name Target package ident. */
+ //@{
+ const std::string & name() const { return _name; }
+ const Edition & edition() const { return _edition; }
+ const Arch & arch() const { return _arch; }
+ //@}
const OnMediaLocation & location() const { return _location; }
const BaseVersions & baseversions() const { return _baseversions; }
const Date & buildtime() const { return _buildtime;}
public:
+ PatchRpm & setName( const std::string & val_r ) { _name = val_r; return *this; }
+ PatchRpm & setEdition( const Edition & val_r ) { _edition = val_r; return *this; }
+ PatchRpm & setArch( const Arch & val_r ) { _arch = val_r; return *this; }
PatchRpm & setLocation( const OnMediaLocation & val_r ) { _location = val_r; return *this; }
PatchRpm & setBaseversions( const BaseVersions & val_r ){ _baseversions = val_r; return *this; }
PatchRpm & addBaseversion( const BaseVersion & val_r ) { _baseversions.push_back( val_r ); return *this; }
PatchRpm & setBuildtime( const Date & val_r ) { _buildtime = val_r; return *this; }
private:
+ std::string _name;
+ Edition _edition;
+ Arch _arch;
OnMediaLocation _location;
BaseVersions _baseversions;
Date _buildtime;
///////////////////////////////////////////////////////////////////
+ /** \todo cheap copy! (switch to RWCOW) */
class DeltaRpm
{
public:
{}
public:
+ /** \name Target package ident. */
+ //@{
+ const std::string & name() const { return _name; }
+ const Edition & edition() const { return _edition; }
+ const Arch & arch() const { return _arch; }
+ //@}
const OnMediaLocation & location() const { return _location; }
const BaseVersion & baseversion() const { return _baseversion; }
const Date & buildtime() const { return _buildtime;}
public:
+ DeltaRpm & setName( const std::string & val_r ) { _name = val_r; return *this; }
+ DeltaRpm & setEdition( const Edition & val_r ) { _edition = val_r; return *this; }
+ DeltaRpm & setArch( const Arch & val_r ) { _arch = val_r; return *this; }
DeltaRpm & setLocation( const OnMediaLocation & val_r ) { _location = val_r; return *this; }
DeltaRpm & setBaseversion( const BaseVersion & val_r ) { _baseversion = val_r; return *this; }
DeltaRpm & setBuildtime( const Date & val_r ) { _buildtime = val_r; return *this; }
private:
+ std::string _name;
+ Edition _edition;
+ Arch _arch;
OnMediaLocation _location;
BaseVersion _baseversion;
Date _buildtime;
con.executenonquery("PRAGMA cache_size=8000;");
con.executenonquery("BEGIN;");
- string pp_query =
- // 0 1 2 3 4 5
- "SELECT id, media_nr, location, checksum, checksum_type, download_size, build_time "
- "FROM patch_packages WHERE repository_id=:repository_id;";
-
- string pp_bv_query =
- "SELECT version, release, epoch "
- "FROM patch_packages_baseversions WHERE patch_package_id = :patch_package_id";
-
- string delta_query =
- // 0 1 2 3 4 5 6 7 8 9 10 11
- "SELECT id, media_nr, location, checksum, checksum_type, download_size, build_time, baseversion_version, baseversion_release, baseversion_epoch, baseversion_checksum, baseversion_checksum_type, baseversion_build_time "
- // 11
- ", baseversion_sequence_info "
- "FROM delta_packages WHERE repository_id=:repository_id;";
-
+ // Refer to the enum when retrieving the data from reader.
+
+ enum pp_query_val { pp_id, pp_name, pp_version, pp_release, pp_epoch, pp_arch, pp_media_nr, pp_location, pp_checksum, pp_checksum_type, pp_download_size, pp_build_time };
+ string pp_query = "SELECT id, name, version, release, epoch, arch, media_nr, location, checksum, checksum_type, download_size, build_time "
+
+ "FROM patch_packages WHERE repository_id=:repository_id;";
+
+ enum pp_bv_query_val { pp_bv_version, pp_bv_release, pp_bv_epoch };
+ string pp_bv_query = "SELECT version, release, epoch "
+
+ "FROM patch_packages_baseversions WHERE patch_package_id = :patch_package_id";
+
+ enum dp_query_val { dp_id, dp_name, dp_version, dp_release, dp_epoch, dp_arch, dp_media_nr, dp_location, dp_checksum, dp_checksum_type, dp_download_size, dp_build_time, dp_baseversion_version, dp_baseversion_release, dp_baseversion_epoch, dp_baseversion_checksum, dp_baseversion_checksum_type, dp_baseversion_build_time, dp_baseversion_sequence_info };
+ string dp_query = "SELECT id, name, version, release, epoch, arch, media_nr, location, checksum, checksum_type, download_size, build_time, baseversion_version, baseversion_release, baseversion_epoch, baseversion_checksum, baseversion_checksum_type, baseversion_build_time, baseversion_sequence_info "
+
+ "FROM delta_packages WHERE repository_id=:repository_id;";
+
{
// bind the master repo id to the query
- sqlite3_command deltas_cmd( con, delta_query);
+ sqlite3_command deltas_cmd( con, dp_query);
deltas_cmd.bind(":repository_id", _options.repository_id);
sqlite3_reader reader = deltas_cmd.executereader();
while ( reader.read() )
{
- zypp::OnMediaLocation on_media( reader.getstring(2), reader.getint(1) );
-
- string checksum_string(reader.getstring(3));
- CheckSum checksum(reader.getstring(4), reader.getstring(3));
+ zypp::OnMediaLocation on_media( reader.getstring(dp_location), reader.getint(dp_media_nr) );
+
+ CheckSum checksum(reader.getstring(dp_checksum_type), reader.getstring(dp_checksum));
if ( checksum.empty() )
{
ERR << "Wrong checksum for delta, skipping..." << endl;
continue;
}
on_media.setChecksum(checksum);
- on_media.setDownloadSize(reader.getint(5));
-
+ on_media.setDownloadSize(reader.getint(dp_download_size));
+
packagedelta::DeltaRpm::BaseVersion baseversion;
- baseversion.setEdition( Edition(reader.getstring(7), reader.getstring(8), reader.getstring(9) ) );
-
- checksum = CheckSum(reader.getstring(11), reader.getstring(10));
+ baseversion.setEdition( Edition(reader.getstring(dp_baseversion_version), reader.getstring(dp_baseversion_release), reader.getstring(dp_baseversion_epoch) ) );
+
+ checksum = CheckSum(reader.getstring(dp_baseversion_checksum_type), reader.getstring(dp_baseversion_checksum));
if ( checksum.empty() )
{
ERR << "Wrong checksum for delta, skipping..." << endl;
continue;
}
baseversion.setChecksum(checksum);
- baseversion.setBuildtime(reader.getint(12));
- baseversion.setSequenceinfo(reader.getstring(13));
-
+ baseversion.setBuildtime(reader.getint(dp_baseversion_build_time));
+ baseversion.setSequenceinfo(reader.getstring(dp_baseversion_sequence_info));
+
zypp::packagedelta::DeltaRpm delta;
+ delta.setName ( reader.getstring(dp_name) );
+ delta.setEdition( Edition( reader.getstring(dp_version), reader.getstring(dp_release), reader.getint(dp_epoch) ) );
+ delta.setArch ( _type_cache.archFor( reader.getint(dp_arch) ) );
delta.setLocation( on_media );
delta.setBaseversion( baseversion );
- delta.setBuildtime(reader.getint(6));
-
+ delta.setBuildtime(reader.getint(dp_build_time));
+
_deltaRpms.push_back(delta);
}
reader.close();
sqlite3_command pp_bv_cmd( con, pp_bv_query);
pp_cmd.bind(":repository_id", _options.repository_id);
sqlite3_reader reader = pp_cmd.executereader();
-
+
while ( reader.read() )
{
//MIL << "Addining patch rpm " << endl;
- long long patch_package_id = reader.getint64(0);
-
- zypp::OnMediaLocation on_media( reader.getstring(2), reader.getint(1) );
-
- CheckSum checksum(reader.getstring(4), reader.getstring(3));
+ long long patch_package_id = reader.getint64(pp_id);
+
+ zypp::OnMediaLocation on_media( reader.getstring(pp_location), reader.getint(pp_media_nr) );
+
+ CheckSum checksum(reader.getstring(pp_checksum_type), reader.getstring(pp_checksum));
if ( checksum.empty() )
{
ERR << "Wrong checksum for delta, skipping..." << endl;
continue;
}
on_media.setChecksum(checksum);
- on_media.setDownloadSize(reader.getint(5));
-
+ on_media.setDownloadSize(reader.getint(pp_download_size));
+
zypp::packagedelta::PatchRpm patch;
+ patch.setName ( reader.getstring(pp_name) );
+ patch.setEdition( Edition( reader.getstring(pp_version), reader.getstring(pp_release), reader.getint(pp_epoch) ) );
+ patch.setArch ( _type_cache.archFor( reader.getint(pp_arch) ) );
patch.setLocation( on_media );
- patch.setBuildtime(reader.getint(6));
-
+ patch.setBuildtime(reader.getint(pp_build_time));
+
pp_bv_cmd.bind( ":patch_package_id", patch_package_id );
-
+
sqlite3_reader bv_reader = pp_bv_cmd.executereader();
while (bv_reader.read())
{
//MIL << " * Adding baseversion " << endl;
- packagedelta::PatchRpm::BaseVersion baseversion = packagedelta::PatchRpm::BaseVersion( bv_reader.getstring(0) , bv_reader.getstring(1), bv_reader.getint(2) );
+ packagedelta::PatchRpm::BaseVersion baseversion = packagedelta::PatchRpm::BaseVersion( bv_reader.getstring(pp_bv_version) ,
+ bv_reader.getstring(pp_bv_release),
+ bv_reader.getint(pp_bv_epoch) );
patch.addBaseversion(baseversion);
}
-
+
bv_reader.close();
-
- _patchRpms.push_back(patch);
+
+ _patchRpms.push_back(patch);
}
reader.close();
MIL << _patchRpms.size() << " patch rpms read." << endl;