Loading aurbot +39 −23 Original line number Diff line number Diff line Loading @@ -133,38 +133,54 @@ class LocalPackage(dict): lastmodified = property(lambda x: LocalPackage.getlastX(x, "lastmodified"), lambda x, y: LocalPackage.setlastX(x, "lastmodified", y)) def build(build_cmd, commit_cmd, localpkg, aurpkg): info("Getting last AUR version") def build(config, localpkg, aurpkg): ''' Build and commit a package Notify if succeeded ''' # find build dir build_dir = TemporaryDirectory() debug("Build dir is %s" % build_dir.name) # extract tarball debug("Extracting aur tarball") aurpkg.extract(build_dir.name) # timestamping now = time() # log files fp = join(localpkg.logdir, strftime("build-%Y-%m-%d-%H-%M-%S.log", localtime(time()))) debug("Build log file path: %s" % fp) fd = open(fp, "w") cwd = getcwd() with open(fp, "w") as fd: try: cwd = getcwd() chdir("%s/%s" % (build_dir.name, aurpkg.name)) # build info("Starting build command") check_call(build_cmd, stdin=DEVNULL, stdout=fd, stderr=fd, shell=True, close_fds=True) start_time = time() try: check_call(config["build_cmd"], stdin=DEVNULL, stdout=fd, stderr=fd, shell=True, close_fds=True) except Exception as exp: error("Build command failure: %s" % exp) raise info("Build duration: %ss" % (time() - start_time)) if commit_cmd is not None: # commit if "commit_cmd" in config: info("Starting commit command") check_call(commit_cmd, stdin=DEVNULL, stdout=fd, stderr=fd, shell=True, close_fds=True) start_time = time() try: check_call(config["commit_cmd"], stdin=DEVNULL, stdout=fd, stderr=fd, shell=True, close_fds=True) except Exception as exp: error("Commit command failure: %s" % exp) raise info("Commit duration: %ss" % (time() - start_time)) localpkg.lastbuild = now # register success localpkg.lastbuild = time() localpkg.lastmodified = aurpkg.lastmodified except Exception as exp: error("Build failure: %s" % exp) finally: chdir(cwd) fd.close() def event_loop(packages, timeout): ''' Loading @@ -176,7 +192,7 @@ def event_loop(packages, timeout): continue info("[%s]" % name) if "build_cmd" not in config: error("Build_cmd is missing in config file") error("build_cmd is missing in config file") continue try: aur = AURPackage(name) Loading @@ -198,7 +214,7 @@ def event_loop(packages, timeout): # build new aur version if aur.lastmodified > local.lastmodified: info("New version available: %s" % aur.version) build(config["build_cmd"], config.get("commit_cmd"), local, aur) build(config, local, aur) # re-build package when force time is passed elif "force" in config: if config["force"].isdigit() is False: Loading @@ -211,7 +227,7 @@ def event_loop(packages, timeout): debug("Force at: %ss, currently: %ss" % (force, now - local.lastbuild)) if local.lastbuild + force <= now: info("Forced update") build(config["build_cmd"], config.get("commit_cmd"), local, aur) build(config, local, aur) else: info("Nothing to do") # night is coming, save cache Loading packages2.conf +4 −3 Original line number Diff line number Diff line [DEFAULT] build_cmd = makepkg notify = seblu@seblu.net [python-sjrpc] maintainer = seblu [virtualbox-ext-oracle] maintainer = seblu Loading @@ -7,6 +11,3 @@ maintainer = seblu [python-i3-git] maintainer = Alad force = 2592000 #30days [python-sjrpc] maintainer = seblu Loading
aurbot +39 −23 Original line number Diff line number Diff line Loading @@ -133,38 +133,54 @@ class LocalPackage(dict): lastmodified = property(lambda x: LocalPackage.getlastX(x, "lastmodified"), lambda x, y: LocalPackage.setlastX(x, "lastmodified", y)) def build(build_cmd, commit_cmd, localpkg, aurpkg): info("Getting last AUR version") def build(config, localpkg, aurpkg): ''' Build and commit a package Notify if succeeded ''' # find build dir build_dir = TemporaryDirectory() debug("Build dir is %s" % build_dir.name) # extract tarball debug("Extracting aur tarball") aurpkg.extract(build_dir.name) # timestamping now = time() # log files fp = join(localpkg.logdir, strftime("build-%Y-%m-%d-%H-%M-%S.log", localtime(time()))) debug("Build log file path: %s" % fp) fd = open(fp, "w") cwd = getcwd() with open(fp, "w") as fd: try: cwd = getcwd() chdir("%s/%s" % (build_dir.name, aurpkg.name)) # build info("Starting build command") check_call(build_cmd, stdin=DEVNULL, stdout=fd, stderr=fd, shell=True, close_fds=True) start_time = time() try: check_call(config["build_cmd"], stdin=DEVNULL, stdout=fd, stderr=fd, shell=True, close_fds=True) except Exception as exp: error("Build command failure: %s" % exp) raise info("Build duration: %ss" % (time() - start_time)) if commit_cmd is not None: # commit if "commit_cmd" in config: info("Starting commit command") check_call(commit_cmd, stdin=DEVNULL, stdout=fd, stderr=fd, shell=True, close_fds=True) start_time = time() try: check_call(config["commit_cmd"], stdin=DEVNULL, stdout=fd, stderr=fd, shell=True, close_fds=True) except Exception as exp: error("Commit command failure: %s" % exp) raise info("Commit duration: %ss" % (time() - start_time)) localpkg.lastbuild = now # register success localpkg.lastbuild = time() localpkg.lastmodified = aurpkg.lastmodified except Exception as exp: error("Build failure: %s" % exp) finally: chdir(cwd) fd.close() def event_loop(packages, timeout): ''' Loading @@ -176,7 +192,7 @@ def event_loop(packages, timeout): continue info("[%s]" % name) if "build_cmd" not in config: error("Build_cmd is missing in config file") error("build_cmd is missing in config file") continue try: aur = AURPackage(name) Loading @@ -198,7 +214,7 @@ def event_loop(packages, timeout): # build new aur version if aur.lastmodified > local.lastmodified: info("New version available: %s" % aur.version) build(config["build_cmd"], config.get("commit_cmd"), local, aur) build(config, local, aur) # re-build package when force time is passed elif "force" in config: if config["force"].isdigit() is False: Loading @@ -211,7 +227,7 @@ def event_loop(packages, timeout): debug("Force at: %ss, currently: %ss" % (force, now - local.lastbuild)) if local.lastbuild + force <= now: info("Forced update") build(config["build_cmd"], config.get("commit_cmd"), local, aur) build(config, local, aur) else: info("Nothing to do") # night is coming, save cache Loading
packages2.conf +4 −3 Original line number Diff line number Diff line [DEFAULT] build_cmd = makepkg notify = seblu@seblu.net [python-sjrpc] maintainer = seblu [virtualbox-ext-oracle] maintainer = seblu Loading @@ -7,6 +11,3 @@ maintainer = seblu [python-i3-git] maintainer = Alad force = 2592000 #30days [python-sjrpc] maintainer = seblu