$(foreach package, $(ALL), $(eval $(call package_hasdate,$(package))))
+### the common header for generated specfiles
+# useful when trying new specfiles manually
+header.spec:
+ (echo -n "# Generated by planetlab build from $($(1)-SPEC) on " ; date) > $@
+ echo "%define distro $(DISTRO)" >> $@
+ echo "%define distrorelease $(RELEASE)" >> $@
+ echo "%define distroname $(DISTRONAME)" >> $@
+ echo "%define pldistro $(PLDISTRO)" >> $@
+ echo "%define plrelease $(PLANETLAB_RELEASE)" >> $@
+
### extract spec file from scm
define target_spec
-$($(1).specpath):
+$($(1).specpath): header.spec
mkdir -p SPECS
- (echo -n "# Generated by planetlab build from $($(1)-SPEC) on " ; date) > $($(1).specpath)
- echo "%define distro $(DISTRO)" >> $($(1).specpath)
- echo "%define distrorelease $(RELEASE)" >> $($(1).specpath)
- echo "%define distroname $(DISTRONAME)" >> $($(1).specpath)
- echo "%define pldistro $(PLDISTRO)" >> $($(1).specpath)
- echo "%define plrelease $(PLANETLAB_RELEASE)" >> $($(1).specpath)
+ cat header.spec > $($(1).specpath)
$(if $($(1).has-date),echo "%define date $(shell date +%Y.%m.%d)" >> $($(1).specpath),)
$(if $($(1)-SPECVARS), \
$(foreach line,$($(1)-SPECVARS), \
echo "%define" $(word 1,$(subst =, ,$(line))) "$(word 2,$(subst =, ,$(line)))" >> $($(1).specpath) ;))
- echo "# included from codebase specfile" >> $($(1).specpath)
+ echo "# included from $($(1)-SPEC)" >> $($(1).specpath)
$(if $($($(1).module)-SVNPATH),\
svn cat $($($(1).module)-SVNPATH)/$($(1)-SPEC) >> $($(1).specpath) || rm $($(1).specpath),\
cvs -d $($($(1).module)-CVSROOT) checkout \
# for parsing module spec name:branch
- matcher_branch_spec=mbq=re.compile("\A(?P<name>\w+):(?P<branch>[\w\.]+)\Z")
- matcher_rpm_define=re.compile("%define\s+(\S+)\s+(\S*)\s*")
+ matcher_branch_spec=re.compile("\A(?P<name>[\w-]+):(?P<branch>[\w\.]+)\Z")
+ matcher_rpm_define=re.compile("%(define|global)\s+(\S+)\s+(\S*)\s*")
def __init__ (self,module_spec,options):
# parse module spec
return glob("%s/*.spec"%self.edge_dir())
def parse_spec (self, specfile, varnames):
- if self.options.debug:
- print 'parse_spec',specfile,
+ if self.options.verbose:
+ print 'Parsing',specfile,
+ for var in varnames:
+ print "[%s]"%var,
+ print ""
result={}
f=open(specfile)
for line in f.readlines():
attempt=Module.matcher_rpm_define.match(line)
if attempt:
- (var,value)=attempt.groups()
+ (define,var,value)=attempt.groups()
if var in varnames:
result[var]=value
f.close()
- if self.options.verbose:
- print 'found',len(result),'keys'
if self.options.debug:
+ print 'found',len(result),'keys'
for (k,v) in result.iteritems():
print k,'=',v
return result
for line in spec.readlines():
attempt=Module.matcher_rpm_define.match(line)
if attempt:
- (var,value)=attempt.groups()
+ (define,var,value)=attempt.groups()
if var in patch_dict.keys():
- new.write('%%define %s %s\n'%(var,patch_dict[var]))
+ new.write('%%%s %s %s\n'%(define,var,patch_dict[var]))
continue
new.write(line)
spec.close()
CoDemux
# 4.2
Mom:2.2
-Mom
MyPLC
+# 4.2
NodeManager:1.7
NodeUpdate
PLCAPI
ulogd
util-python
# using branches/scholz for this module
-# util-vserver
+util-vserver:scholz
util-vserver-pl
vsys
wireless-tools
}
/* export some macros to make */
+ /* note : this relies on pl-specific conventions and might be wrong */
{
- char *macros[] = { "release" , "name" , "version" , "subversion" , NULL } ;
+ char *macros[] = { "release" , "name" , "version" , "taglevel" , NULL } ;
char **nav;
char *macro=malloc(32);
for (nav=macros; *nav; nav++) {