Skip to content

Instantly share code, notes, and snippets.

@ato
Created August 19, 2012 06:36
Show Gist options
  • Save ato/3392757 to your computer and use it in GitHub Desktop.
Save ato/3392757 to your computer and use it in GitHub Desktop.
clojars data feed scripts
#!/bin/bash
#
# Clojars data feeds. This needs integrating into current master branch.
# See: https://github.com/ato/clojars-web/blob/no-db/src/clojars/feed.clj
#
set -e
cd /home/clojars/repo
find . -name '*.pom' | grep -v '/\.' | sort > all-poms.txt.new
cat all-poms.txt.new | gzip > all-poms.txt.gz.new
python /home/ato/list_artifacts.py < all-poms.txt.new | uniq | tee all-jars.clj.new | gzip > all-jars.clj.gz.new
mkdir -p ../tmp
java -cp ../tmp/c2/src:../bin/clojars2-standalone.jar clojars.feed /home/clojars/repo ../tmp 2> /dev/null
mv all-poms.txt.new all-poms.txt
mv all-poms.txt.gz.new all-poms.txt.gz
mv all-jars.clj.new all-jars.clj
mv all-jars.clj.gz.new all-jars.clj.gz
mv ../tmp/feed.clj.gz .
md5sum feed.clj.gz > feed.clj.gz.md5.new
mv feed.clj.gz.md5{.new,}
sha1sum feed.clj.gz > feed.clj.gz.sha1.new
mv feed.clj.gz.sha1{.new,}
#!/usr/bin/env python
import os, sys
for line in sys.stdin:
line = line.strip()
bits = line.split('/')
version = bits[-2]
jarname = bits[-3]
group = '.'.join(bits[1:-3])
if group != jarname:
print '[' + group + '/' + jarname, '"' + version + '"]'
else:
print '[' + jarname, '"' + version + '"]'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment