예제 #1
0
def main():
    lock_file = shellutils.lockfile(shellutils.mk_lock_filename(), retry=True)

    if lock_file is None:
        if config.DEBUG:
            print("Concurrent script in progress, exiting")
        sys.exit(1)

    subject = recv_mail(sys.stdin.read())

    subject_parts = subject.split()
    if "[review-request]" in subject_parts:
        task_name = subject_parts[subject_parts.index("[review-request]") + 1]
        with open(config.BACKLOGFILE, "a") as fout:
            line = "%s|%s\n" % (task_name, config.TASKS.PENDING)
            fout.write(line)

    shellutils.unlockfile(lock_file)
예제 #2
0
def main():
    lock_file = shellutils.lockfile(shellutils.mk_lock_filename(), retry=True)

    if lock_file is None:
        if config.DEBUG:
            print("Concurrent script in progress, exiting")
        sys.exit(1)

    subject = recv_mail(sys.stdin.read())

    subject_parts = subject.split()
    if "[review-request]" in subject_parts:
        task_name = subject_parts[subject_parts.index("[review-request]") + 1]
        with open(config.BACKLOGFILE, "a") as fout:
            line = "%s|%s\n" % (task_name, config.TASKS.PENDING)
            fout.write(line)

    shellutils.unlockfile(lock_file)
예제 #3
0
def _take_lockfile():
    return shellutils.lockfile(shellutils.mk_lock_filename())
예제 #4
0
# Designed to be run by the email system from a .forward file:
#
# cat .forward
# |[full/path]/recv.py

from __future__ import print_function
import sys, os, config, shellutils
from shellutils import ShellCmdException

from email.parser import Parser

def recv_mail(datastring):
    headers = Parser().parsestr(datastring)
    return headers['subject']


if __name__ == "__main__":
    lf = shellutils.lockfile(shellutils.mk_lock_filename(), retry = True)

    subject = recv_mail(sys.stdin.read())

    subject_parts = subject.split()
    if "[review-request]" in subject_parts:
        task_name = subject_parts[subject_parts.index("[review-request]") + 1]
        with open(os.path.join(os.path.dirname(__file__), config.BACKLOGFILE), "a") as fout:
            line = "%s|%s\n" % (task_name, config.TASKS.PENDING)
            fout.write(line)

    shellutils.unlockfile(lf)

예제 #5
0
def _take_lockfile():
    return shellutils.lockfile(shellutils.mk_lock_filename())
예제 #6
0
파일: recv.py 프로젝트: geggio84/Yocto-Poky
#
# cat .forward
# |[full/path]/recv.py

from __future__ import print_function
import sys, os, config, shellutils
from shellutils import ShellCmdException

from email.parser import Parser


def recv_mail(datastring):
    headers = Parser().parsestr(datastring)
    return headers['subject']


if __name__ == "__main__":
    lf = shellutils.lockfile(shellutils.mk_lock_filename(), retry=True)

    subject = recv_mail(sys.stdin.read())

    subject_parts = subject.split()
    if "[review-request]" in subject_parts:
        task_name = subject_parts[subject_parts.index("[review-request]") + 1]
        with open(os.path.join(os.path.dirname(__file__), config.BACKLOGFILE),
                  "a") as fout:
            line = "%s|%s\n" % (task_name, config.TASKS.PENDING)
            fout.write(line)

    shellutils.unlockfile(lf)