Beispiel #1
0
    def run(self):
        for build in self.get_builds():
            artifactlist = self.get_artifact(build)
            if artifactlist:
                if os.path.exists("/opt/www/mirror/jenkins/%s" %
                                  artifactlist[0][0].split("/")[5]):
                    print "Exists, skipping."
                    continue
                for artifactdata in artifactlist:
                    artifact, timestamp = artifactdata
                    full_path = "jenkins/%s/%s" % (artifact.split("/")[5],
                                                   artifact.split("/")[-1])
                    fileobj = File.get_by_fullpath(full_path)
                    if not fileobj:
                        base = "artifacts/%s" % artifact.replace(
                            "http://jenkins.cyanogenmod.com/job/android/", "")
                        build_number = base.split("/")[1]
                        fname = base.split("/")[-1]
                        build_type = "stable"
                        if "NIGHTLY" in artifact:
                            build_type = "nightly"
                        if "SNAPSHOT" in artifact:
                            #build_type = "snapshot"
                            build_type = "nightly"
                        if "EXPERIMENTAL" in artifact:
                            if "-M" in artifact:
                                build_type = "snapshot"
                            else:
                                build_type = "test"
                        if "-RC" in artifact:
                            build_type = "RC"
                        try:
                            os.mkdir("/opt/www/mirror/jenkins/%s" %
                                     build_number)
                        except:
                            pass
                        download_cmd = "wget -O /opt/www/mirror/jenkins/%s/%s %s" % (
                            build_number, fname, artifact)

                        # Only download CHANGES.txt and build.prop locally
                        if not fname.endswith(".zip"):
                            print "Running: %s" % download_cmd
                            os.system(download_cmd)

                        # Download all artifacts to the mirror
                        mirror_cmd = "ssh -p2200 [email protected] \"/root/add.sh /srv/mirror/jenkins/%s %s %s\"" % (
                            build_number, artifact, fname)
                        print "Running: %s" % mirror_cmd
                        os.system(mirror_cmd)

                        # Run the build.prop through getcm.addfile
                        if fname.endswith(".zip"):
                            addfile_cmd = "/usr/local/bin/getcm.addfile --timestamp %s --file /opt/www/mirror/jenkins/%s/%s --fullpath jenkins/%s/%s --type %s --config %s" % (
                                timestamp, build_number, fname, build_number,
                                fname, build_type, self.configPath)
                            print "Running: %s" % addfile_cmd
                            os.system(addfile_cmd)
Beispiel #2
0
 def run(self):
     for build in self.get_builds():
         artifactdata = self.get_artifact(build)
         if artifactdata:
             artifact, timestamp = artifactdata
             full_path = artifact.replace("http://jenkins.cyanogenmod.com/job/android","artifacts")
             fileobj = File.get_by_fullpath(full_path)
             if not fileobj:
                 base = "artifacts/%s" % artifact.replace("http://jenkins.cyanogenmod.com/job/android/", "")
                 cmd = "getcm.addfile --timestamp %s --url %s --fullpath %s --type nightly --config %s" % (timestamp, artifact, base, self.configPath)
                 print "Running: %s" % cmd
                 os.system(cmd)
Beispiel #3
0
    def get(self, request):
        if request.endswith(".zip") and "/" not in request:
            fileobj = File.get_by_filename(request)
        elif request.endswith(".zip") and "/" in request:
            fileobj = File.get_by_fullpath(request)
        else:
            fileobj = File.get_by_base62(request)

        if fileobj is None:
            self.write("404 Not Found")
            return self.set_status(404)

        return self.write("%s  %s" % (fileobj.filename, fileobj.md5sum))
Beispiel #4
0
    def run(self):
        for build in self.get_builds():
            artifactlist = self.get_artifact(build)
            if artifactlist:
                if os.path.exists("/opt/www/mirror/jenkins/%s" % artifactlist[0][0].split("/")[5]):
                    print "Exists, skipping."
                    continue
                for artifactdata in artifactlist:
                    artifact, timestamp = artifactdata
                    full_path = "jenkins/%s/%s" % (artifact.split("/")[5], artifact.split("/")[-1])
                    fileobj = File.get_by_fullpath(full_path)
                    if not fileobj:
                        base = "artifacts/%s" % artifact.replace("http://jenkins.cyanogenmod.com/job/android/", "")
                        build_number = base.split("/")[1]
                        fname = base.split("/")[-1]
                        build_type = "stable"
                        if "NIGHTLY" in artifact:
                            build_type = "nightly"
                        if "SNAPSHOT" in artifact:
                            #build_type = "snapshot"
                            build_type = "nightly"
                        if "EXPERIMENTAL" in artifact:
                            if "-M" in artifact:
                                build_type = "snapshot"
                            else:
                                build_type = "test"
                        if "-RC" in artifact:
                            build_type = "RC"
                        try:
                            os.mkdir("/opt/www/mirror/jenkins/%s" % build_number)
                        except:
                            pass
                        download_cmd = "wget -O /opt/www/mirror/jenkins/%s/%s %s" % (build_number, fname, artifact)

                        # Only download CHANGES.txt and build.prop locally
                        if not fname.endswith(".zip"):
                            print "Running: %s" % download_cmd
                            os.system(download_cmd)

                        # Download all artifacts to the mirror
                        mirror_cmd = "ssh -p22 [email protected] \"/root/add.sh /opt/mirror/jenkins/%s %s %s\"" % (build_number, artifact, fname)
                        print "Running: %s" % mirror_cmd
                        os.system(mirror_cmd)

                        # Run the build.prop through getcm.addfile
                        if fname.endswith(".zip"):
                            addfile_cmd = "/usr/local/bin/getcm.addfile --file /opt/www/mirror/jenkins/%s/%s --fullpath jenkins/%s/%s --type %s --config %s" % (build_number, fname, build_number, fname, build_type, self.configPath)
                            print "Running: %s" % addfile_cmd
                            os.system(addfile_cmd)
Beispiel #5
0
 def run(self):
     for build in self.get_builds():
         artifactlist = self.get_artifact(build)
         if artifactlist:
           for artifactdata in artifactlist:
             artifact, timestamp = artifactdata
             full_path = "jenkins/%s/%s" % (artifact.split("/")[5], artifact.split("/")[-1])
             if os.path.exists("/opt/www/mirror/%s" % full_path):
                 print "Exists, skipping."
                 continue
             fileobj = File.get_by_fullpath(full_path)
             if not fileobj:
                 base = "artifacts/%s" % artifact.replace("http://jenkins.cyanogenmod.com/job/android/", "")
                 build_number = base.split("/")[1]
                 fname = base.split("/")[-1]
                 build_type = "stable"
                 if "NIGHTLY" in artifact:
                     build_type = "nightly"
                 if "SNAPSHOT" in artifact:
                     #build_type = "snapshot"
                     build_type = "nightly"
                 if "EXPERIMENTAL" in artifact:
                     if "-M" in artifact:
                         build_type = "snapshot"
                     else:
                         #build_type = "experimental"
                         build_type = "nightly"
                 if "-RC" in artifact:
                     build_type = "RC"
                 #cmd = "/usr/local/bin/getcm.addfile --timestamp %s --url %s --fullpath %s --type %s --config %s" % (timestamp, artifact, base, build_type, self.configPath)
                 try:
                     os.mkdir("/opt/www/mirror/jenkins/%s" % build_number)
                 except:
                     pass
                 download_cmd = "wget -O /opt/www/mirror/jenkins/%s/%s %s" % (build_number, fname, artifact)
                 print "Running: %s" % download_cmd
                 os.system(download_cmd)
                 if (fname != "CHANGES.txt"):
                     mirror_cmd = "ssh -p2200 [email protected] \"/root/add.sh /srv/mirror/jenkins/%s %s %s\"" % (build_number, artifact, fname)
                     print "Running: %s" % mirror_cmd
                     os.system(mirror_cmd)
                     addfile_cmd = "/usr/local/bin/getcm.addfile --timestamp %s --file /opt/www/mirror/jenkins/%s/%s --fullpath jenkins/%s/%s --type %s --config %s" % (timestamp, build_number, fname, build_number, fname, build_type, self.configPath)
                     print "Running: %s" % addfile_cmd
                     os.system(addfile_cmd)
Beispiel #6
0
    def get(self, request):
        request = request + ".zip"

        if "/" in request:
            fileobj = File.get_by_fullpath(request)
        elif "/" not in request:
            fileobj = File.get_by_filename(request)

        if fileobj is None and "/" not in request:
            self.write("404 Not Found")
            return self.set_status(404)
        elif fileobj is None:
            full_path = request
        else:
            full_path = fileobj.full_path

        url = self.mirrorpool.next() % full_path

        return self.redirect(url)
Beispiel #7
0
    def get(self, request):
        request = request + ".zip"

        if request.endswith("-latest.zip"):
            device = request.replace("-latest.zip", "")
            fileobj = File.get_latest_by_device(device)
        elif "/" in request:
            fileobj = File.get_by_fullpath(request)
        elif "/" not in request:
            fileobj = File.get_by_filename(request)

        if fileobj is None and "/" not in request:
            self.write("404 Not Found")
            return self.set_status(404)
        elif fileobj is None:
            full_path = request
        else:
            full_path = fileobj.full_path

        url = self.mirrorpool.next() % full_path

        return self.redirect(url)