summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorUoti Urpala <uau@glyph.nonexistent.invalid>2011-02-15 17:53:00 +0200
committerUoti Urpala <uau@glyph.nonexistent.invalid>2011-02-15 21:22:41 +0200
commit2e4afb70ea95c26efaaaa7a1fe3abd8f84ada9b8 (patch)
tree0318cbaa276e571bbcd0ab9b8275375c04751aa4
parent8f3226a8916796afbd49a984dbc08e91c7bab68b (diff)
downloadmplayer2-build-2e4afb70ea95c26efaaaa7a1fe3abd8f84ada9b8.tar.gz
mplayer2-build-2e4afb70ea95c26efaaaa7a1fe3abd8f84ada9b8.tar.bz2
mplayer2-build-2e4afb70ea95c26efaaaa7a1fe3abd8f84ada9b8.zip
script/export: add new script to export content for tarballs
-rwxr-xr-xinit6
-rwxr-xr-xscript/export61
2 files changed, 66 insertions, 1 deletions
diff --git a/init b/init
index 0df958d..b33f89a 100755
--- a/init
+++ b/init
@@ -48,7 +48,9 @@ def main():
parser = OptionParser(usage=usage)
parser.add_option('-s', '--shallow', action='store_true',
help='only shallow git clone (uses less bandwidth)')
- parser.set_defaults(shallow=False)
+ parser.add_option('--init-optionfiles-only', action='store_true',
+ help='do nothing but create initial option files')
+ parser.set_defaults(shallow=False, init_optionfiles_only=False)
opts, args = parser.parse_args()
if args:
parser.print_help()
@@ -57,6 +59,8 @@ def main():
create_helpfile('mplayer_options', mplayer_options)
create_helpfile('ffmpeg_options', ffmpeg_options)
create_helpfile('common_options', common_options)
+ if opts.init_optionfiles_only:
+ return
# If this looks like a new install enable FFmpeg-mt by default.
# The ffmpeg/.git check is to catch updates from old versions with no
diff --git a/script/export b/script/export
new file mode 100755
index 0000000..2f5f3a4
--- /dev/null
+++ b/script/export
@@ -0,0 +1,61 @@
+#!/usr/bin/env python
+
+import os
+from helpers import run_command
+from optparse import OptionParser
+
+def write(local_path, path, revision, outdir):
+ if os.system("(cd %s && git archive --format=tar --prefix=%s/ %s | (cd %s && tar xf -))" % (local_path, path, revision, outdir)) != 0:
+ raise OSError
+
+def subrev(revision, name):
+ return run_command(("git", "ls-tree", revision, name)).split()[2]
+
+def export(revision, outdir, mt):
+ os.mkdir(outdir)
+ if mt:
+ ffmpeg = "ffmpeg-mt"
+ open(outdir + '/ffmpeg-mt-enabled', 'w').close()
+ else:
+ ffmpeg = "ffmpeg"
+ open(outdir + '/ffmpeg-mt-disabled', 'w').close()
+ if os.path.exists('ffmpeg-mt-enabled'):
+ local_ffmpeg = 'ffmpeg-mt'
+ else:
+ local_ffmpeg = 'ffmpeg'
+ mplayer_rev = subrev(revision, "mplayer")
+ libass_rev = subrev(revision, "libass")
+ ffmpeg_rev = subrev(revision, ffmpeg)
+ os.chdir(local_ffmpeg)
+ swscale_rev = subrev(ffmpeg_rev, "libswscale")
+ os.chdir('..')
+ os.chdir('mplayer')
+ version = run_command('git describe --always ' + mplayer_rev).strip() + '-snapshot'
+ os.chdir('..')
+ write('.', '.', revision, outdir)
+ os.putenv('PYTHONDONTWRITEBYTECODE', '1')
+ os.system("cd %s && ./init --init-optionfiles-only" % outdir)
+ for name in 'clean disable-mt enable-mt init update'.split():
+ os.remove(outdir + '/' + name)
+ write('mplayer', "mplayer", mplayer_rev, outdir)
+ f = open(outdir + '/mplayer/snapshot_version', 'w')
+ f.write(version)
+ f.close()
+ write('libass', "libass", libass_rev, outdir)
+ write(local_ffmpeg, ffmpeg, ffmpeg_rev, outdir)
+ write(local_ffmpeg + '/libswscale', ffmpeg + '/libswscale', swscale_rev,
+ outdir)
+
+
+def main():
+ usage = "usage: [options] revision outdir"
+ parser = OptionParser(usage=usage)
+ parser.add_option('--disable-mt', action='store_false', dest="mt",
+ help='use non-mt FFmpeg')
+ parser.set_defaults(mt=True)
+ options, args = parser.parse_args()
+ if len(args) != 2:
+ parser.error("incorrect number of arguments")
+ export(args[0], args[1], options.mt)
+
+main()