From 8a44a8967411999ea43973ef3efe8954a172b107 Mon Sep 17 00:00:00 2001 From: Audris Mockus Date: Fri, 19 Oct 2018 15:03:21 -0400 Subject: [PATCH 1/5] Update README.md --- README.md | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 0d96cfd..cd9a1e8 100644 --- a/README.md +++ b/README.md @@ -15,7 +15,10 @@ where XX is between 0 and 33: to find your number look at the list below. ``` zcat /data/NPMvulnerabilities/NPMpkglist/NPMpkglist_XX.gz | python3 readNpm.py ``` -1. Identify the packages that have GH repos (based on the stored info) +Please keep in mind that /data/NPMvulnerabilities/ is not on gcloud, only +on da2, so please run it on da2 or copy NPMpkglist_XX.gz to gcloud. + +2. Identify the packages that have GH repos (based on the stored info) ``` import pymongo, json, sys client = pymongo.MongoClient () @@ -33,17 +36,18 @@ for r in coll.find(): r = r['url'] print (r) ``` -Suppose the above code is in extrNpm.py. To output the urls: +The above code is in extrNpm.py. To output the urls: ``` python3 extrNpm.py > myurls ``` -2. For each such package, get a list of all releases. Example file is readGit.py (you can use it with the snippet above to get releases). It reads from standard input and populates +3. For each such package, get a list of all releases. Example file is readGit.py (you can use it with the snippet above to get releases). It reads from standard input and populates releases_yourutkid collection. Reference to Github API: ``` https://developer.github.com/v3/repos/releases/ ``` -3. Extract releases from mongodb + +4. Extract releases from mongodb ``` import pymongo, json, sys client = pymongo.MongoClient (host="da1") @@ -57,13 +61,13 @@ for r in coll.find(): if 'tag_name' in v: print (n+';'+v['tag_name']) ``` -Suppose the above code is in extrRels.py. To output the urls: +The above code is in extrRels.py. To output the urls: ``` cat myurls | python3 extrRels.py > myrels ``` -4. Find no. of commits between the latest and other releases. +5. Find no. of commits between the latest and other releases. For example: E.g. https://api.github.com/repos/webpack-contrib/html-loader/compare/v0.5.4...master or https://api.github.com/repos/git/git/compare/v2.2.0-rc1...v2.2.0-rc2 From 2c8a408f1c929a82ca8bb575876ac6ea0e026cd3 Mon Sep 17 00:00:00 2001 From: EvanEzell Date: Tue, 23 Oct 2018 16:27:47 -0400 Subject: [PATCH 2/5] Fix case when there is no common ancestor between commits There are few cases where the api will return that there is no common ancestor between commits. In my list of releases it was the following: https://api.github.com/repos/Onegini/cordova-plugin-onegini/compare/2.1.0...1.8.7 The propose change will print an error message to standard error when that is the case --- compareRels.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/compareRels.py b/compareRels.py index bef6838..279f47a 100644 --- a/compareRels.py +++ b/compareRels.py @@ -59,7 +59,10 @@ def cmp_rel (url): v = get (url) except Exception as e: sys.stderr.write ("Could not get:" + url + ". Exception:" + str(e) + "\n") - print (url+';'+str(v['ahead_by'])+';'+str(v['behind_by'])) + if 'ahead_by' in v and 'behind_by' in v: + print (url+';'+str(v['ahead_by'])+';'+str(v['behind_by'])) + else: + sys.stderr.write ("Could not compare releases for: " + url + "; There exists no common ancestor between the two versions." + "\n") p2r = {} From d725d16e96bdf3e18ba38aa444b1fb9c533a01c7 Mon Sep 17 00:00:00 2001 From: Audris Mockus Date: Mon, 29 Oct 2018 15:08:15 -0400 Subject: [PATCH 3/5] Update README.md --- README.md | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index cd9a1e8..6a63391 100644 --- a/README.md +++ b/README.md @@ -44,9 +44,8 @@ python3 extrNpm.py > myurls 3. For each such package, get a list of all releases. Example file is readGit.py (you can use it with the snippet above to get releases). It reads from standard input and populates releases_yourutkid collection. Reference to Github API: ``` -https://developer.github.com/v3/repos/releases/ +cat myurls | python3 readGit.py ``` - 4. Extract releases from mongodb ``` import pymongo, json, sys @@ -63,7 +62,7 @@ for r in coll.find(): ``` The above code is in extrRels.py. To output the urls: ``` -cat myurls | python3 extrRels.py > myrels +python3 extrRels.py > myrels ``` From b540b8f1e7b9c1c26e3259db7a5c7b4d1b0305eb Mon Sep 17 00:00:00 2001 From: Audris Mockus Date: Mon, 29 Oct 2018 15:09:22 -0400 Subject: [PATCH 4/5] Update README.md --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 6a63391..54f90dd 100644 --- a/README.md +++ b/README.md @@ -45,6 +45,8 @@ python3 extrNpm.py > myurls releases_yourutkid collection. Reference to Github API: ``` cat myurls | python3 readGit.py +#or +python3 readGit.py < myurls ``` 4. Extract releases from mongodb ``` From 88fa5f1bcdbe4d45c501b983e37fdb7037418afe Mon Sep 17 00:00:00 2001 From: Audris Mockus Date: Mon, 29 Oct 2018 15:13:51 -0400 Subject: [PATCH 5/5] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 54f90dd..b2a4c07 100644 --- a/README.md +++ b/README.md @@ -82,7 +82,7 @@ For example: ``` For example ``` -cat myrels | python3 compareRels.py +cat myrels | python3 compareRels.py > myrels.cmp ``` | number | GitHub Username | NetID | Name |