Fork me on GitHub
#clojars
<
2018-03-16
>
xtreak2905:03:06

@danielcompton Thanks, the wiki was helpful. I used the above rsync command to download only the pom files of around 1GB of data. I am parsing them up to write to database. I could see multiple duplicate poms that result in duplicate data. Is there a reason for that? Does clojars have redundant copies for some reason?

➜  my-wonderful-copy-of-clojars $ diff aleph/aleph/0.1.0-SNAPSHOT/aleph-0.1.0-20100502.112537-10.pom aleph/aleph/0.1.0-SNAPSHOT/aleph-0.1.0-20100502.112537-11.pom
No difference in the above as from the diff command.

xtreak2905:03:31

If there is already a database present with this info it will save me a lot of time.

danielcompton06:03:05

Those are SNAPSHOT versions, they’re work in progress versions that people can publish. They probably have changed in source files but not necessarily in POM

danielcompton06:03:16

You can probably ignore them TbH

xtreak2906:03:06

Makes sense thanks. Is there a database already present with the info because some of the projects have some unicode symbols which break the XML parsing. E.g. file : my-wonderful-copy-of-clojars/speclj/speclj/2.1.3/speclj-2.1.3.pom content : <comments>Copyright \251 2011 Micah Martin All Rights Reserved.</comments> Exception :

Unhandled java.lang.IllegalAccessException
   class clojure.lang.Reflector cannot access class
   com.sun.org.apache.xerces.internal.impl.io.MalformedByteSequenceException (in module java.xml) be$
   java.xml does not export  to unnamed module @3629b018

tcrawley12:03:02

@xtreak29 be aware that just parsing the pom files will give you the direct dependencies, not the transitive dependencies the direct ones have. In order to get the full dependency tree, you’ll need to use a maven resolver to walk the tree

tcrawley12:03:59

one hacky (but somewhat straightforward) way to do that is with Maven: mvn -f /path/to/pom dependency:tree

xtreak2912:03:00

Yes, that is a good catch. Also I could see some of the libraries using the dependencies as part of code and not as part of project.clj .

tcrawley12:03:33

right, those would be dependencies brought in transitively

tcrawley12:03:58

with dependency:tree, you’ll have to regex parse the output, but it’s regular at least

xtreak2912:03:04

Looks like the above command downloads jars

xtreak2912:03:41

➜  ~ mvn -f my-wonderful-copy-of-clojars/speclj/speclj/2.6.1/speclj-2.6.1.pom dependency:tree
[INFO] Scanning for projects...
Downloading: 
Downloaded:  (6 KB at 2.9 KB/sec)

tcrawley12:03:42

yes, it will resolve all the dependencies in order to process their pom files, unfortunately

tcrawley12:03:59

it will also download jars it needs to run dependency:tree

xtreak2912:03:08

Got it. That will be a network heavy task for me. Since doing a full dependency detection of clojars in a tiny DigitalOcean droplet will kill it 🙂

xtreak2912:03:53

Right now I have parsed the pom and inserted into MongoDB and using a query to see which libraries use dependencies that cannot run on Clojure 1.9 to file issues.

> db.clojars.distinct("url", {dependencies: {$elemMatch : {artifactId: "core.async"}}, "version": {$lt: "0.3.442"}}, {url: 1, '_id': false})
[
	"",
	"",
	"",
]
# More output

xtreak2912:03:47

Problem is that there I parse every pom file and there are cases where the older maven file will tell me that there is an outdated dependency but it's fixed in the new one. Need to do something to get the latest pom in the directory to avoid false positives.

xtreak2912:03:13

@tcrawley Do you know of any database that has all the info as a structured output, I am assuming that clojars uses a DB backend to construct the pages.

tcrawley12:03:06

Clojars does store the direct dependencies in the db, but not the transitive ones

xtreak2912:03:36

Is the db available for download somewhere in public ?

xtreak2912:03:47

Assuming there is a dump of db or tables without any sensitive info I can use that instead of trying my own efforts.

tcrawley12:03:46

No, there’s currently no way to get that db. We could possibly expose the dependencies via an api call, but that still wouldn’t give you the full tree

tcrawley12:03:10

and you’d be lacking any custom repos defined in the poms to resolve the transitive tree for those dependencies

xtreak2912:03:05

Got it. Thanks a lot for your help on this 🙂

tcrawley12:03:36

My pleasure