Hi As i got a bit annoyed by accumulating duplicate and non applicable patches or rather the need to manually weed them out of patchwork ive yesterday quickly written the attached script
Does something like this already exist ? or is this usefull and it would make sense to throw this on some public git repo (like github/michaelni) ? currently it will download all patches (they are cached so wont be downloaded twice) and will * Detect patches that are actual fate failures (fate failure command line output is syntactically a patch) * Find superseeded patches based on subject and author * It will list the found cases and provide a single line command to update their status but not execute it automatically (i intend to automate this but i need to make more sure it makes no big mistakes first) Example output from today: pwbot.py loading: 1, 2, 3, 4, 6, 5, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 21, 20, 17, 19, 18, 22, 23, 24, 25, 28, 29, 31, 30, 26, 27, 32, 33, 35, 34, 36, 37, 38, 39, 40, 41, 43, 42, 44, 46, 45, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 63, 64, 58, 62, 65, 60, 59, 66, 57, 61, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 82, 81, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 102, 101, 103, 104, 105, 106, 107, 108, 109, 110, 112, 111, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 127, 125, 126, 128, 129, 131, 130, 138, 136, 132, 135, 137, 134, 133, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 170, 169, 172, 171, 174, 173, 176, 175, 177, 180, 178, 179, 181, 182, 183, 184, 185, 186, 187, 188, 194, 189, 193, 191, 192, 190, 195, 196, 197, 198, 199, 201, 200, 204, 202, 203, 205, 206, 207, 208, 209, 210, 211, 218, 214, 217, 215, 216, 212, 213, 219, 220, 221, 222, 224, 223, 226, 225, 227, 228, 229, 230, 231, 234, 232, 233, 235, 236, 237, 240, 238, 239, 241, 271, 242, 243, 244, 249, 245, 246, 248, 259, 251, 262, 247, 265, 257, 258, 261, 253, 263, 256, 250, 255, 264, 252, 254, 260, 266, 267, 268, 269, 270, 272, 273, 274, 275, 276, 277, 278, 279, DUP: 276 New 2016-08-24 09:17:05 liu jc <jc...@outlook.com> [FFmpeg-devel] workaround for IOS9 getaddrinfo in IPv6 only network use hardcode IPv4 address can not resolve port number. DUP: 277 New 2016-08-24 09:33:42 liu jc <jc...@outlook.com> [FFmpeg-devel] workaround for IOS9 getaddrinfo in IPv6 only network use hardcode IPv4 address can not resolve port number. DUP: 278 New 2016-08-24 09:56:07 liu jc <jc...@outlook.com> [FFmpeg-devel] workaround for IOS9 getaddrinfo in IPv6 only network use hardcode IPv4 address can not resolve port number. ./pwclient update 276 277 278 -s 'Superseded' PS: cleanup of the script is welcome btw if someone cares about that -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB Old school: Use the lowest level language in which you can solve the problem conveniently. New school: Use the highest level language in which the latest supercomputer can solve the problem without the user falling asleep waiting.
#!/usr/bin/python #Michael Niedermayer #GPL 2+ import os import pickle import subprocess import sys # This may be needed to be applied to pwclient for it to not crash #@@ -165,7 +172,7 @@ # # naive way to strip < and > from message-id # val = string.strip(str(patch["msgid"]), "<>") # else: #+ val = unicode(patch[fieldname]).encode('utf-8') #- val = str(patch[fieldname]) # # return val pwclient = "./pwclient" def cached_call( command ): if not command in cache : cache[command] = os.popen(command).read() return cache[command] def isint(value): try: int(value) return True except: return False id_list = [] status_list = [] subject_list = [] date_list = [] delegate_list = [] submitter_list = [] patch_list = [] def get_patch_list( ): proc = subprocess.Popen([pwclient, 'list', '-f', '%{id}@#SEP%{state}@#SEP%{name}@#SEP%{date}@#SEP%{delegate}@#SEP%{submitter}'],stdout=subprocess.PIPE) sys.stderr.write("loading: ") for line in proc.stdout: tmp = line.strip().split('@#SEP') if isint(tmp[0]) : id_list .append(tmp[0]) status_list .append(tmp[1]) subject_list .append(tmp[2]) date_list .append(tmp[3]) delegate_list .append(tmp[4]) submitter_list .append(tmp[5]) sys.stderr.write(tmp[0] + ", ") patch_list .append(cached_call(pwclient +' view ' + tmp[0])) sys.stderr.write("\n") return True cache = {} try : f = open("patchbot.cache", 'rb') cache = pickle.load(f) f.close() except : IOError get_patch_list() # Find non applicable (fate failure type patches) which havnt been marked correctly ids = "" for i, item in enumerate(patch_list): if item.find("+++ tests/data/fate/") >= 0 and status_list[i] != "Not Applicable": sys.stderr.write("Fate patch: " + id_list[i] + " " + status_list[i] + " " + date_list[i] + " " + submitter_list[i] + " " + subject_list[i] + "\n") ids += " " + id_list[i] if ids != "" : sys.stderr.write(pwclient + " update " + ids + " -s 'Not Applicable'\n") #Find superseeded patches by subject and submitter ids = "" subject_index = sorted((e,i) for i,e in enumerate(subject_list)) last_index = -1 for i, item in enumerate(subject_index): j = item[1] if last_index >= 0 and subject_list[last_index] == subject_list[j] and submitter_list[last_index] == submitter_list[j] : older = last_index if int(id_list[j]) < int(id_list[last_index]) : older = j if status_list[older] == "New": sys.stderr.write("DUP: " + id_list[older] + " " + status_list[older] + " " + date_list[older] + " " + submitter_list[older] + " " + subject_list[older] + "\n") ids += " " + id_list[older] last_index = j if ids != "" : sys.stderr.write(pwclient + " update " + ids + " -s 'Superseded'\n") f = open("patchbot.cache", 'wb') pickle.dump(cache, f) f.close()
signature.asc
Description: Digital signature
_______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel