Skip to content

Instantly share code, notes, and snippets.

@ithayer
Created February 21, 2012 08:02
Show Gist options
  • Save ithayer/1875031 to your computer and use it in GitHub Desktop.
Save ithayer/1875031 to your computer and use it in GitHub Desktop.
s3-package python scripts: easily manage large binary files in a git repo
#!/usr/bin/env python
#
# This script reads packages from .s3.
# Given a directory, will pull all .s3 packages in it recursively.
# Or, if you specify a .s3 file, it will pull just that package.
#
# Copyright (C) 2010-2012 ReadyForZero (ReadyForZero.com)
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
#!/usr/bin/env python
#
# Given a file, will md5 it, and upload it to s3. It will also generate a .s3 package file in the current dir.
# If the specified name is a directory, it will tar it and gzip it, and store it so that it will be untarred.
#
# Usage: push-s3-package myfile.tar.gz
# push-s3-package mydir/
# Naming convention for the resulting files is .s3:<md5>:<filename> OR .s3:dir:<md5>:<tarred filename>
# The md5 in the second case is the md5 of the tar file.
#
# Copyright (C) 2010-2012 ReadyForZero (ReadyForZero.com)
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment