You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@drat.apache.org by GitBox <gi...@apache.org> on 2018/08/12 04:38:34 UTC

[GitHub] chrismattmann closed pull request #151: Fix for commandline drat

chrismattmann closed pull request #151: Fix for commandline drat
URL: https://github.com/apache/drat/pull/151
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/crawler/src/main/resources/bin/dump_repo_details.py b/crawler/src/main/resources/bin/dump_repo_details.py
new file mode 100644
index 00000000..efaf64e3
--- /dev/null
+++ b/crawler/src/main/resources/bin/dump_repo_details.py
@@ -0,0 +1,33 @@
+import sys
+import os
+import json
+
+def main(argv=None):
+	if len(argv) == 0:
+		print "No Repo details to dump"
+		sys.exit()
+
+	if os.getenv("DRAT_HOME")==None:
+		print "Please add DRAT_HOME environment variable and try again";
+		sys.exit()
+	
+	default_repo_file_url = os.getenv("DRAT_HOME") + "/conf/repo.default.txt"
+	with open(default_repo_file_url,'rb')as repoFile:
+		data = ''
+		for line in repoFile:
+			data+=line
+	rep = eval(data)
+
+	reponame = os.path.basename(os.path.normpath(argv[0]))
+	rep["repo"] = os.path.normpath(argv[0])
+	rep["name"] = reponame
+
+	outputfile = os.getenv("DRAT_HOME") + "/data/repo"
+	file = open(outputfile,"w")
+	file.write(json.dumps(rep))
+	file.close()
+
+	print rep
+
+if __name__ == "__main__":
+	main(sys.argv[1:])
diff --git a/distribution/src/main/resources/bin/drat b/distribution/src/main/resources/bin/drat
index 00e79548..b3fe9d4a 100755
--- a/distribution/src/main/resources/bin/drat
+++ b/distribution/src/main/resources/bin/drat
@@ -59,7 +59,10 @@ function crawl {
 	PRODUCT_PATH=$1
     fi
     pushd $DRAT_HOME/crawler/bin >> $DRAT_HOME/logs/drat.log 2>&1
-    
+   
+    python dump_repo_details.py $PRODUCT_PATH
+
+
    ./crawler_launcher --operation --metPC --metExtractorConfig \
    $DRAT_HOME/extractors/code/default.cpr.conf --metExtractor org.apache.oodt.cas.metadata.extractors.CopyAndRewriteExtractor \
    --filemgrUrl $FILEMGR_URL --clientTransferer org.apache.oodt.cas.filemgr.datatransfer.InPlaceDataTransferFactory \
diff --git a/distribution/src/main/resources/conf/repo.default.txt b/distribution/src/main/resources/conf/repo.default.txt
new file mode 100644
index 00000000..341d53d1
--- /dev/null
+++ b/distribution/src/main/resources/conf/repo.default.txt
@@ -0,0 +1 @@
+{"id":"http://drat.apache.org/#","repo":"","name":"","loc_url":"http://drat.apache.org/#","description":"DRAT : Command line","type":"project"}


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services