INHERIT_ALL /* "%" matches the entire version string */
};
+static inline
+bool inherited_requirement( const char *field )
+{
+ /* Local helper function to identify a template field which is
+ * specified exactly as "%", and therefore must inherit its value
+ * from the referring package specification.
+ */
+ return ((field != NULL) && (field[0] == '%') && (field[1] == '\0'));
+}
+
static
enum inherit_mode inherited( const char *ver, const char *bld )
{
/* Noting that the "%" wildcard must represent the respective part
* of the version specification in its entirety...
*/
- if( (ver != NULL) && (ver[0] == '%') && (ver[1] == '\0') )
+ if( inherited_requirement( ver ) )
/*
* ...flag a match on the "major.minor.patch" specification.
*/
*/
id.SetSubSystemBuild( dep->GetSubSystemBuild() );
+ /* To establish association between source and binary package names,
+ * we may also need to propagate archive and compression type fields...
+ */
+ if( inherited_requirement( id.GetPackageFormat()) )
+ {
+ id.SetPackageFormat( dep->GetPackageFormat() );
+ if( id.GetCompressionType() == NULL )
+ id.SetCompressionType( dep->GetCompressionType() );
+ }
+ else if( inherited_requirement( id.GetCompressionType()) )
+ id.SetCompressionType( dep->GetCompressionType() );
+
/* Finally, reconstitute the canonical tarname representation of the
* specification, from its decomposed representation; (as a side effect,
* this automatically places the return string on the heap).
return (min_wanted == NULL) ? max_wanted : min_wanted;
}
+EXTERN_C const char *pkgAssociateName( const char *map, const char *from )
+{
+ /* Public function for derivation of the name of an associate package,
+ * such as a source package, from the name of the primary package, based
+ * on the relationship specified by the template passed via "map".
+ */
+ pkgSpecs ref( from );
+ return requirement( map, &ref );
+}
+
/* $RCSfile$: end of file */