void TargetImpl::createAnonymousId() const
{
+ // bsc#1024741: Omit creating a new uid for chrooted systems (if it already has one, fine)
+ if ( root() != "/" )
+ return;
- // create the anonymous unique id
- // this value is used for statistics
+ // Create the anonymous unique id, used for download statistics
Pathname idpath( home() / "AnonymousUniqueId");
try
if ( ! policy_r.dryRun() || policy_r.downloadMode() == DownloadOnly )
{
// Prepare the package cache. Pass all items requiring download.
- CommitPackageCache packageCache( root() );
+ CommitPackageCache packageCache;
packageCache.setCommitList( steps.begin(), steps.end() );
bool miss = false;
ManagedFile localfile;
try
{
- // TODO: unify packageCache.get for Package and SrcPackage
- if ( pi->isKind<Package>() )
- {
- localfile = packageCache.get( pi );
- }
- else if ( pi->isKind<SrcPackage>() )
- {
- repo::RepoMediaAccess access;
- repo::SrcPackageProvider prov( access );
- localfile = prov.provideSrcPackage( pi->asKind<SrcPackage>() );
- }
- else
- {
- INT << "Don't know howto cache: Neither Package nor SrcPackage: " << pi << endl;
- continue;
- }
+ localfile = packageCache.get( pi );
localfile.resetDispose(); // keep the package file in the cache
}
catch ( const AbortRequestException & exp )
}
return std::string();
}
- } // namescpace
+ } // namespace
///////////////////////////////////////////////////////////////////
Product::constPtr TargetImpl::baseProduct() const
return RequestedLocalesFile( home(needroot) / "RequestedLocales" ).locales();
}
+ void TargetImpl::updateAutoInstalled()
+ {
+ MIL << "updateAutoInstalled if changed..." << endl;
+ SolvIdentFile::Data newdata;
+ for ( auto id : sat::Pool::instance().autoInstalled() )
+ newdata.insert( IdString(id) ); // explicit ctor!
+ _autoInstalledFile.setData( std::move(newdata) );
+ }
+
std::string TargetImpl::targetDistribution() const
{ return baseproductdata( _root ).registerTarget(); }
// static version:
}
///////////////////////////////////////////////////////////////////
+ namespace
+ {
+ std::string guessAnonymousUniqueId( const Pathname & root_r )
+ {
+ // bsc#1024741: Omit creating a new uid for chrooted systems (if it already has one, fine)
+ std::string ret( firstNonEmptyLineIn( root_r / "/var/lib/zypp/AnonymousUniqueId" ) );
+ if ( ret.empty() && root_r != "/" )
+ {
+ // if it has nonoe, use the outer systems one
+ ret = firstNonEmptyLineIn( "/var/lib/zypp/AnonymousUniqueId" );
+ }
+ return ret;
+ }
+ }
std::string TargetImpl::anonymousUniqueId() const
{
- return firstNonEmptyLineIn( home() / "AnonymousUniqueId" );
+ return guessAnonymousUniqueId( root() );
}
// static version:
std::string TargetImpl::anonymousUniqueId( const Pathname & root_r )
{
- return firstNonEmptyLineIn( staticGuessRoot(root_r) / "/var/lib/zypp/AnonymousUniqueId" );
+ return guessAnonymousUniqueId( staticGuessRoot(root_r) );
}
///////////////////////////////////////////////////////////////////