- this consists only of some quick hacky bash, written in one night
- each night the upstream code will be compared
- only snapshots of HEAD will be imported, not every single commit
- the following steps currently should work (05/10/17) for comparison, without having to pull 1G+ each night
-
check free disk space, should be minimum 3G at least, since the base checkout will be about almost 1.5G already
-
get a list of all repositories
curl -s https://git.proxmox.com/?a=project_index | awk {'print $1'} | sort
- create all repos via the github api
curl -u <user> https://api.github.com/user/repos -d '{ "name": "<reponame>", "description": "<description>" }
This is done locally, so passwords won't end up on the server.
All the following will be done on the server which will have the cronjobs to run this every night.
-
get list of all filenames to compare in the future, see below
-
clone all repositories, where the snapshots will be extracted into, so changes can be committed later
Make sure these are properly named. (With just the repo name.)
-
initial download of all projects' snapshots
-
extract files into the cloned projects' folder
-
do mass add / commit for all those
-
initial pushes
-
rename 'CURRENT' to
date --date='yesterday' +%F
-
create all repos from all filenames (so they can actually be compared with the projects upstream)
-
get list of all snapshot links, write to file
grep snapshot <(while read LINE; do curl -s https://git.proxmox.com/?p=$LINE\;a=tree; done < <(curl -s https://git.proxmox.com/?a=project_index | awk {'print $1'} | sort) ) | sed -e 's,.*"/?p=,?p=,' -e 's/".*//'
Output:
?p=aab.git;a=snapshot;h=HEAD;sf=tgz
?p=apt.git;a=snapshot;h=HEAD;sf=tgz
?p=arch-pacman.git;a=snapshot;h=HEAD;sf=tgz
?p=ceph.git;a=snapshot;h=HEAD;sf=tgz
...
- get all current filenames from the Content-Disposition HTTP header, write list to file 'CURRENT'
curl -vsI 'https://git.proxmox.com/?p=aab.git;a=snapshot;h=HEAD;sf=tgz' |& grep ^Content-disposition | sed -e 's/.*filename="//' -e 's/"//'
Output:
aab-HEAD-0cff4ef.tar.gz
-
diff files named
date --date='yesterday' +%F
and zzz_01_CURRENT, create show changes in file 'zzz_02_DIFF' -
For all the lines in diff, get the real reponame, save to file 'zzz_03_TO_DL'
-
loop over contents in zzz_03_TO_DL and download snapshots with changes
-
extract everything into local repository
-
get all reponames with changes, save to file 'zzz_04_CHANGES'
-
git add all changes
-
push all repositories
This was created and implemented in one session and was just designed to work at all. Improvements welcome! ;)