Author: ivucica
Date: Mon Apr  7 03:20:27 2014
New Revision: 37789

URL: http://svn.gna.org/viewcvs/gnustep?rev=37789&view=rev
Log:
Just slight improvements over work-in-progress Debian package builder.

* variable substitution in .spec files
* abort reading %description in .spec files after running into %
* now .tar.gz is built less often (meaning 'make distclean' is called less 
often)

Still, only gnustep-make can be built, unfortunately.


Modified:
    tools/make/trunk/Master/deb.make
    tools/make/trunk/bake_debian_files.sh

Modified: tools/make/trunk/Master/deb.make
URL: 
http://svn.gna.org/viewcvs/gnustep/tools/make/trunk/Master/deb.make?rev=37789&r1=37788&r2=37789&view=diff
==============================================================================
--- tools/make/trunk/Master/deb.make    (original)
+++ tools/make/trunk/Master/deb.make    Mon Apr  7 03:20:27 2014
@@ -66,25 +66,26 @@
 ifeq ($(DEB_BUILD_DEPENDS), )
 DEB_BUILD_DEPENDS=gnustep-make (=$(GNUSTEP_MAKE_VERSION))
 else
-DEB_BUILD_DEPENDS=$(DEB_BUILD_DEPENDS), gnustep-make (=$(GNUSTEP_MAKE_VERSION))
+DEB_BUILD_DEPENDS+=, gnustep-make (=$(GNUSTEP_MAKE_VERSION))
 endif
 
 .PHONY: deb
 
 ifeq ($(_DEB_SHOULD_EXPORT), )
-../$(PACKAGE_NAME)-$(PACKAGE_VERSION).tar.gz: dist
-deb: ../$(PACKAGE_NAME)-$(PACKAGE_VERSION).tar.gz
-       _DEB_SHOULD_EXPORT=1 make deb
-else
-# Export all variables, but only in explicit invocation of 'make deb'
-export
+
 deb:
+       if [ ! -e ../$(PACKAGE_NAME)-$(PACKAGE_VERSION).tar.gz ] ; then make 
dist ; else echo "Source file already exists; NOT rebuilding. Please manually 
remove if desired." ; fi
        $(ECHO_NOTHING)echo "Generating the deb package..."$(END_ECHO)
        -rm -rf $(_ABS_OBJ_DIR)/debian_dist
        mkdir -p $(_ABS_OBJ_DIR)/debian_dist
        cp ../$(PACKAGE_NAME)-$(PACKAGE_VERSION).tar.gz 
$(_ABS_OBJ_DIR)/debian_dist/$(_DEB_ORIGTARNAME).orig.tar.gz
        cd $(_ABS_OBJ_DIR)/debian_dist && tar xfz 
$(_DEB_ORIGTARNAME).orig.tar.gz
-       /bin/bash $(GNUSTEP_MAKEFILES)/bake_debian_files.sh 
$(_ABS_OBJ_DIR)/debian_dist/$(PACKAGE_NAME)-$(PACKAGE_VERSION)/
+       _DEB_SHOULD_EXPORT=1 make _debfiles
        printf "\noverride_dh_auto_configure:\n\tdh_auto_configure -- 
$(DEB_CONFIGURE_FLAGS)\noverride_dh_auto_build:\n\tmake\n\tdh_auto_build\nbuild::\n\tmake"
 >> $(_ABS_OBJ_DIR)/debian_dist/$(PACKAGE_NAME)-$(PACKAGE_VERSION)/debian/rules
        cd $(_ABS_OBJ_DIR)/debian_dist/$(PACKAGE_NAME)-$(PACKAGE_VERSION)/ && 
debuild -us -uc
+else
+# Export all variables, but only if we explicitly are working with 
bake_debian_files.sh
+export
+_debfiles:
+       /bin/bash $(GNUSTEP_MAKEFILES)/bake_debian_files.sh 
$(_ABS_OBJ_DIR)/debian_dist/$(PACKAGE_NAME)-$(PACKAGE_VERSION)/
 endif

Modified: tools/make/trunk/bake_debian_files.sh
URL: 
http://svn.gna.org/viewcvs/gnustep/tools/make/trunk/bake_debian_files.sh?rev=37789&r1=37788&r2=37789&view=diff
==============================================================================
--- tools/make/trunk/bake_debian_files.sh       (original)
+++ tools/make/trunk/bake_debian_files.sh       Mon Apr  7 03:20:27 2014
@@ -66,22 +66,31 @@
 if which python > /dev/null ; then
 FN=$(python - << _EOF
 
-# TODO: This code does not perform substitution of variables in .spec.in files.
-
 import tempfile
 import sys
 
 def process_specfile(specfilename):
   description_mode=False
-  with tempfile.NamedTemporaryFile(delete=False) as tf:
-    with open(specfilename) as specfile:
+  with open(specfilename) as specfile:
+    with tempfile.NamedTemporaryFile(delete=False) as tf:
+
       print tf.name
+      vars={}
+
       for line in specfile.readlines():
         line=line.rstrip()
+        for var in vars:
+          line.replace('%{%s}' % var, vars[var])
+
         if description_mode:
           if len(line.lstrip()) > 0 and line.lstrip()[0] == '#':
             continue
+          if len(line.lstrip()) > 0 and line.lstrip()[0] == '%':
+            description_mode=False
+            continue
           tf.write("RPM_DESCRIPTION=\"\${RPM_DESCRIPTION}%s\\n\"\n" % 
line.replace('\\'', '\\\\\\'').replace('\\"', '\\\\\\"').replace('(', 
'\\(').replace(')', '\\)'))
+          continue
+
         if not len(line):
           continue
         components=line.split(':')
@@ -142,6 +151,11 @@
         else:
           if line == "%description":
             description_mode = True
+          elif line.startswith('%define'):
+            segs=line[len('%define')+1].lstrip().split(' ')
+            segs=[seg.rstrip().lstrip() for seg in segs]
+            vars[segs[0]] = ' '.segs[1:].join()
+            
 
 try:
   process_specfile('${DEB_PACKAGE}.spec')
@@ -260,7 +274,7 @@
 
 echo "${DEB_SOURCE} (${DEB_VERSION}) ${DEB_DISTRIBUTION}; urgency=low" >> 
"${destination}"/changelog
 echo "" >> "${destination}"/changelog
-echo "  * New build." >> "${destination}"/changelog
+echo "   * New build." >> "${destination}"/changelog
 echo "" >> "${destination}"/changelog
 echo "" >> "${destination}"/changelog
 echo " -- ${DEB_PACKAGE_BUILDER}  $(date -R)" >> "${destination}"/changelog


_______________________________________________
Gnustep-cvs mailing list
[email protected]
https://mail.gna.org/listinfo/gnustep-cvs

Reply via email to