[Blends-commit] [SCM] blends-gsoc branch, master, updated. ccdabc03a2a06ef4d753cd0fc52e3ee6c43a9bcc

Emmanouil Kiagias e.kiagias at gmail.com
Wed Jul 31 21:16:25 UTC 2013


The following commit has been merged in the master branch:
commit 06edb683c7d5a9035d10c59f20bca212692809bb
Author: Emmanouil Kiagias <e.kiagias at gmail.com>
Date:   Wed Jul 31 22:27:42 2013 +0200

    changed Makefile/rules files, changelogentry now works as it is described here: https://lists.debian.org/debian-blends/2013/07/msg00068.html , todo: clean up the changelogentry code

diff --git a/devtools/Makefile b/devtools/Makefile
index dbc6386..9980ef9 100755
--- a/devtools/Makefile
+++ b/devtools/Makefile
@@ -11,12 +11,27 @@
 TARGET_DIST := $(shell head -1 debian/changelog |awk '{print $$3}'|tr -d ';')
 BLEND := $(shell /usr/share/blends-dev/blend-get-names blendname)
 
+VERSION  := $(shell dpkg-parsechangelog -ldebian/changelog | grep Version: | cut -f2 -d' ' | cut -f1 -d- )
+
 ##FIXME custom path for local testing
 GENCONTROL := /home/alamagestest/Projects/blends-gsoc/devtools/blend-gen-control
+TASKSDIFF := /home/alamagestest/Projects/blends-gsoc/tasks_diff
 
 # Verify whether config/control exists, if yes, add it to the depends of debian/control
 CONFIGCONTROL := $(shell if [ -d config -a -e config/control ] ; then echo config/control; fi)
 
+
+#variables needed for changelogentry
+LINESTART  := $(shell grep "\* start automatically" debian/changelog -n | head -1 | awk '{print $$1}' | tr -d '[:, ]' )
+LINEEND   := $(shell grep "\* end automatically" debian/changelog -n | head -1 | awk '{print $$1}' | tr -d ':')
+
+#get two latest releases
+RELEASES   := $(shell grep '^$(BLEND)' debian/changelog | head -2 | awk '{print $$2}' | tr -d '[(,)]')
+LATEST    := $(shell echo "$(RELEASES)" | cut -d ' ' -f1)
+PREVIOUS   := $(shell echo $(RELEASES) | cut -d ' ' -f2)
+
+CURRENTPARH := $(shell pwd)
+
 all: $(BLEND)-tasks.desc debian/control
 
 debian/control: debian/control.stub debian/changelog tasks/* $(CONFIGCONTROL)
@@ -30,6 +45,15 @@ tasksel: $(BLEND)-tasks.desc
 $(BLEND)-tasks.desc: tasks/* debian/changelog
 	LC_ALL=C $(GENCONTROL) -S -t && mv taskdesc.template $(BLEND)-tasks.desc.template
 
+statusdump: dependency_data/
+	$(TASKSDIFF) --status-dump --tasks .  --output dependency_data/$(BLEND)_$(VERSION).json
+
+#update changelog with dependencies changes
+changelogentry: debian/changelog dependency_data/$(BLEND)_$(LATEST).json dependency_data/$(BLEND)_$(PREVIOUS).json
+	(sed $(LINESTART)q debian/changelog; echo;\
+	 $(TASKSDIFF) --compare $(CURRENTPARH)/dependency_data/$(BLEND)_$(LATEST).json,$(CURRENTPARH)/dependency_data/$(BLEND)_$(PREVIOUS).json | sed 's/^/  /'; \
+	 echo; sed -n '$(LINEEND),$$p' debian/changelog; ) > debian/changelog.new
+
 ##FIXME comment out for the moment
 #packages.txt: tasks/*
 #	$(GENCONTROL) -s $(TARGET_DIST) -a > packages.txt.$$$$ && mv packages.txt.$$$$ packages.txt
@@ -62,5 +86,5 @@ proper: distclean
 	rm -f $(BLEND)-tasks.desc
 
 dist:
-	rm -f $(BLEND)-tasks.desc debian/control
+	rm -f $(BLEND)-tasks.desc debian/control dependency_data/$(BLEND)_$(VERSION).json
 	make -f debian/rules get-orig-source
diff --git a/devtools/rules b/devtools/rules
index 0a05569..44e31ee 100755
--- a/devtools/rules
+++ b/devtools/rules
@@ -38,6 +38,12 @@ $(BLEND)-tasks.desc:
 	grep -vE "\[\!$(DEB_HOST_ARCH)\]|\[\!$(DEB_HOST_ARCH) | \!$(DEB_HOST_ARCH) | \!$(DEB_HOST_ARCH)\]" | \
 	sed 's/\[.*\]//' > $(BLEND)-tasks.desc.$(DEB_HOST_ARCH)
 
+statusdump:
+	$(MAKE) -f $(BLENDMKFILE) statusdump
+
+changelogentry:
+	$(MAKE) -f $(BLENDMKFILE) changelogentry
+
 %:
 	dh $@
 
@@ -76,7 +82,7 @@ override_dh_clean:
 	rm -f debian/$(PREFIX)-*.debhelper.log
 	dh_clean
 
-get-orig-source: $(BLEND)-tasks.desc debian/control
+get-orig-source: $(BLEND)-tasks.desc debian/control statusdump changelogentry
 	if [ ! -f debian/changelog ] ; then \
 	    echo "File debian/changelog is missing. Something is wrong!" ; \
 	    exit -1 ; \
diff --git a/tasks_diff b/tasks_diff
index 584806d..5de88ad 100755
--- a/tasks_diff
+++ b/tasks_diff
@@ -160,22 +160,17 @@ if __name__ == "__main__":
 	blend_dev_dir = "/usr/share/blends-dev/"
 	default_json = "tasks.json"
 
-	parser = argparse.ArgumentParser(epilog="Example: ./tasks_diff.py -t med/tags/1.13/ -s -d;\
-									./tasks_diff.py -t med/tags/1.13.1/ -c -d")
+	##TODO add proper epilog giving example usage
+	parser = argparse.ArgumentParser(epilog="")
 	
 	parser.add_argument("-t", "--tasks", dest="tasks", type=str,
 	                    help="Path to task files", default=".")
 	parser.add_argument("-s", "--status-dump", dest="statusdump", action="store_true",
 						help="Dump dependencies status into a json file")
 	parser.add_argument("-o", "--output", dest="output", type=str, default=default_json,
-						help="Output file where to store the dependencies json file(when -s/--statusdump is provided)")
-	parser.add_argument("-j", "--json-file", dest="jsonfile", type=str, default=default_json,
-						help="Path to json file containing a previous release dependencies. \
-						This json file will be compared with the task files in the provided tasks directory(-t/--tasks argument) \
-						if the -c/--compare argument is provided. Default json file to be used(if no argument is provided): {0}".format(default_json))
-	parser.add_argument("-c", "--compare", dest="compare", action="store_true",
-						help="If this argument is provided will make a comparison(check -j/--json argument)")
-
+						help="Output file where to store the dependencies json file(when -s/--status-dump is provided)")
+	parser.add_argument("-c", "--compare", dest="compare", type=str,
+						help="Provide two comma separated(without spaces)  paths to json files to be compared")
 	parser.add_argument("-d", "--debug", dest="debug", action="store_true", default=False,
 	                    help="Print debug information")
 	#parse the command line arguments
@@ -222,11 +217,22 @@ if __name__ == "__main__":
 		sys.exit(0)
 
 	if args.compare:
-		logger.debug("Comparing task files")
-		logger.debug("Reading json file: {0}".format(args.jsonfile))
-		with open(args.jsonfile, 'r') as json_input:
-			jsontasks = json.load(json_input)
+		if not ',' in args.compare:
+			logger.error("For --compare two comma separated paths to json files should be provided.")
+			sys.exit(-1)
+
+		latest, previous = [ x.strip() for x in args.compare.split(',') ]
+
+		if not os.path.isfile(previous) or not os.path.isfile(latest):
+			logger.error("Please provide existing json files to be compared.")
+			sys.exit(-1)
+
+		logger.debug("Comparing json files:")
+		logger.debug("{0} with {1}".format(latest, previous))
+
+		latest_tasks = json.load(open(latest))
+		previous_tasks = json.load(open(previous))
 
-		logger.debug("Comparing tasks...")
-		compare_tasks(jsontasks, giventasks, taskprefix)
+		logger.debug("Comparing releases...")
+		compare_tasks(latest_tasks, previous_tasks, taskprefix)
 

-- 
Git repository for blends-gsoc code



More information about the Blends-commit mailing list