return ! licenseTgz.empty() && PathInfo(licenseTgz).isFile();
}
+ bool RepoInfo::needToAcceptLicense() const
+ {
+ static const std::string noAcceptanceFile = "no-acceptance-needed\n";
+ bool accept = true;
+
+ Pathname licenseTgz( _pimpl->licenseTgz() );
+ if ( licenseTgz.empty() || ! PathInfo( licenseTgz ).isFile() )
+ return false; // no licenses at all
+
+ ExternalProgram::Arguments cmd;
+ cmd.push_back( "tar" );
+ cmd.push_back( "-t" );
+ cmd.push_back( "-z" );
+ cmd.push_back( "-f" );
+ cmd.push_back( licenseTgz.asString() );
+
+ ExternalProgram prog( cmd, ExternalProgram::Stderr_To_Stdout );
+ for ( std::string output( prog.receiveLine() ); output.length(); output = prog.receiveLine() )
+ {
+ if ( output == noAcceptanceFile )
+ {
+ accept = false;
+ }
+ }
+ MIL << "License for " << this->name() << " has to be accepted: " << (accept?"true":"false" ) << endl;
+ return accept;
+ }
+
std::string RepoInfo::getLicense( const Locale & lang_r )
{
LocaleSet avlocales( getLicenseLocales() );
else
ret.insert( Locale( std::string( output.c_str()+license.size(), output.size()- license.size() - dotTxt.size() ) ) );
}
- else
- {
- WAR << " " << output;
- }
}
prog.close();
return ret;
/** Whether there is a license associated with the repo. */
bool hasLicense() const;
+ /** Whether the repo license has to be accepted, e.g. there is no
+ * no acceptance needed for openSUSE.
+ */
+ bool needToAcceptLicense() const;
+
/** Return the best license for the current (or a specified) locale. */
std::string getLicense( const Locale & lang_r = Locale() );
return ret;
}
+ bool ResObject::needToAcceptLicense() const
+ {
+ if ( isKind<Product>() )
+ return repoInfo().needToAcceptLicense( );
+ return true;
+ }
+
std::string ResObject::distribution() const
{ return lookupStrAttribute( sat::SolvAttr::distribution ); }
*/
std::string licenseToConfirm( const Locale & lang_r = Locale() ) const;
+ /**
+ * \short Acceptance of Product License needed?
+ *
+ * Returns whether a product license has to be accepted
+ * (no acceptance is needed for openSUSE)
+ */
+ bool needToAcceptLicense() const;
+
/**
* \short Vendor
*