{"id":2525,"date":"2017-12-08T13:05:59","date_gmt":"2017-12-08T13:05:59","guid":{"rendered":"http:\/\/www.scmgalaxy.com\/tutorials\/?p=2525"},"modified":"2025-02-01T22:39:34","modified_gmt":"2025-02-01T22:39:34","slug":"perforce-python-script-collection","status":"publish","type":"post","link":"https:\/\/www.devopsschool.com\/blog\/perforce-python-script-collection\/","title":{"rendered":"Perforce Python Script Collection."},"content":{"rendered":"<p><strong>rajeshkumar created the topic: Perforce Python Script Collection.<\/strong><\/p>\n<p>Implement a script that will do following:<\/p>\n<p>1. Read config file. This file will contain following settings:<br \/>\na. For mail delivery (SMTP)<br \/>\nb. For access to perforce server<br \/>\n2. Get from perforce a list of changes made since last script run time and get all updated files<br \/>\n3. Invoke script that will \u2018build\u2019 the changes \u2013 it will be located in the working folder of the<br \/>\nscript(build.bat\/build.sh). Script itself should come from perforce as well during step 2.<br \/>\n4. If running of build script is successful, add\/update contents of folder named \u2018bin\u2019 in the perforce<br \/>\nrepository (it is expected that build script will put there a product of its work)<br \/>\n5. In case of error of invocation, send out an email with the list of changes retrieved in p.2 and all outputs of<br \/>\nbuild script (both stdout\/stderr), in which case contents of \u2018bin\u2019 folder should not be updated to perforce<\/p>\n<p>Solution<br \/>\nScript details:<br \/>\nmaster.py \u2013 This file is the main file which should be excuted to get the all desired output as per the task<br \/>\nbuild.bat \u2013 This is a Build file which will be executing during compilation phase in master.py. config.ini: Following key should be modified as the environment specification<\/p>\n<p>Sender<br \/>\nReceivers<br \/>\nMessage<br \/>\nHost<br \/>\np4port<br \/>\np4user<br \/>\np4client<br \/>\np4passwd<br \/>\nScenario to create fail Build:<br \/>\nRemove comment line from \u201cREM mkdir raj\u201d in build.bat<\/p>\n<p>How to use?<br \/>\nChange the config.ini file appropriately and fire master.py script. If you find any issues, please follow the log error message accordingly.<\/p>\n<p>File is as attached<\/p>\n<p>File Attachment:<br \/>\nFile Name:\tbuild.bat.txt<br \/>\nFile Size:0 KB<\/p>\n<p>File Attachment:<br \/>\nFile Name:\tconfig.ini.txt<br \/>\nFile Size:0 KB<\/p>\n<p>File Attachment:<br \/>\nFile Name:\tIndex.txt<br \/>\nFile Size:0 KB<\/p>\n<p>File Attachment:<br \/>\nFile Name:\tmaster.txt<br \/>\nFile Size:4 KB<br \/>\nRegards,<br \/>\nRajesh Kumar<br \/>\nTwitt me @ <a href=\"http:\/\/twitter.com\/RajeshKumarIn\" target=\"_blank\" rel=\"noopener\">twitter.com\/RajeshKumarIn<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>rajeshkumar created the topic: Perforce Python Script Collection. Implement a script that will do following: 1. Read config file. This file will contain following settings: a. For mail delivery (SMTP)&#8230; <\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_joinchat":[],"footnotes":""},"categories":[370],"tags":[176],"class_list":["post-2525","post","type-post","status-publish","format-standard","hentry","category-perforce","tag-python"],"_links":{"self":[{"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/posts\/2525","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/comments?post=2525"}],"version-history":[{"count":1,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/posts\/2525\/revisions"}],"predecessor-version":[{"id":2526,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/posts\/2525\/revisions\/2526"}],"wp:attachment":[{"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/media?parent=2525"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/categories?post=2525"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/tags?post=2525"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}