summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGuillaume Seguin <guillaume@segu.in>2008-05-29 01:04:26 +0200
committerGuillaume Seguin <guillaume@segu.in>2008-05-29 01:04:26 +0200
commit3278a7434591864349a7e2d7d5514d1c5597b787 (patch)
tree4aca36abde539457667acb750fa06b63d231ec88
parent68a04ca02a753f67f6319266c2f794a99da132b1 (diff)
downloadfusion-releasekit-3278a7434591864349a7e2d7d5514d1c5597b787.tar.gz
fusion-releasekit-3278a7434591864349a7e2d7d5514d1c5597b787.tar.bz2
* Major update (I know I should have splitted this commit, lazyness...)
-rwxr-xr-xrelease.py180
1 files changed, 139 insertions, 41 deletions
diff --git a/release.py b/release.py
index acb5523..4cf338a 100755
--- a/release.py
+++ b/release.py
@@ -69,6 +69,34 @@ def run (command, return_stdout = False):
process.wait ()
return process.returncode == 0
+def run_error (command, error, return_stdout = False):
+ if not run (command, return_stdout):
+ raise RuntimeError, error
+
+def run_error2 (command, return_stdout = False):
+ run_error (command, "%s failed" % command, return_stdout)
+
+def add_suffix (filename, suffix):
+ if not suffix:
+ return filename
+ else:
+ known_exts = [".tar.gz", ".tar.bz2"]
+ for ext in known_exts:
+ if filename[-len (ext):] == ext:
+ return filename[:-len (ext)] + suffix + ext
+
+def has_suffix (filename, suffix):
+ if not suffix:
+ return True
+ else:
+ known_exts = [".tar.gz", ".tar.bz2"]
+ for ext in known_exts:
+ if filename[-len (ext):] == ext:
+ return filename[:-len (ext)][-len (suffix):] == suffix
+
+def is_bz2 (filename):
+ return filename[-4] == ".bz2"
+
def fix_env ():
TESTS_PREFIX = os.path.abspath ("tests-%s/root" % TODAY)
os.environ["PKG_CONFIG_PATH"] = "%s:%s" % (TESTS_PREFIX,
@@ -94,19 +122,16 @@ def clone (path):
os.chdir (CURDIR)
if not os.path.exists (name):
- if not run ("git clone %s/%s" % (config.baseurl, path)):
- raise RuntimeError, "git clone failed"
+ run_error2 ("git clone %s/%s" % (config.baseurl, path))
else:
os.chdir (name)
- if not run ("git pull"):
- raise RuntimeError, "git pull failed"
+ run_error2 ("git pull")
os.chdir (CURDIR)
if config.branch:
os.chdir (name)
- if not run ("git checkout --track -b %s %s" % (config.version,
- config.branch)):
- raise RuntimeError, "git checkout failed"
+ run_error2 ("git checkout --track -b %s %s" % (config.version,
+ config.branch))
os.chdir (CURDIR)
def find_version (path):
@@ -148,40 +173,83 @@ def tarballize (path):
name = path.split ("/")[-1]
if name in TARBALLIZERS:
- return TARBALLIZERS[name] (path)
+ tarballizer = TARBALLIZERS[name]
+ if callable (tarballizer):
+ return tarballizer (path)
+ else:
+ tarballs = []
+ for suffix in tarballizer:
+ tarballs += tarballizer[suffix] (path, suffix)
+ return tarballs
+ else:
+ return tarballize_default (path, "")
+
+def tarballize_default (path, suffix = None):
+ name = path.split ("/")[-1]
os.chdir (CURDIR)
os.chdir (name)
if os.path.exists ("autogen.sh"):
- if not run ("sh autogen.sh"):
- raise RuntimeError, "autogen failed"
+ run_error2 ("sh autogen.sh")
else:
print info ("autogen.sh not found, skipping this step")
- if not run ("make distcheck"):
- raise RuntimeError, "make distcheck failed"
+ run_error2 ("make distcheck")
tarballs = glob.glob ("*.tar.*")
+ ret_tarballs = []
for file in tarballs:
- os.rename (file, os.path.join (TARBALLS_PATH, file))
+ filename = os.path.basename (file)
+ suffixed = add_suffix (filename, suffix)
+ ret_tarballs.append (suffixed)
+ os.rename (file, os.path.join (TARBALLS_PATH, suffixed))
os.chdir (CURDIR)
- return tarballs
+ return ret_tarballs
-def tarballize_distutils (path):
+def tarballize_distutils (path, suffix = None):
name = path.split ("/")[-1]
os.chdir (CURDIR)
os.chdir (name)
- if not run ("python setup.py sdist"):
- raise RuntimeError, "python setup.py sdist failed"
+ run_error2 ("python setup.py sdist")
tarballs = glob.glob ("dist/*.tar.*")
+ ret_tarballs = []
+ for file in tarballs:
+ filename = os.path.basename (file)
+ suffixed = add_suffix (filename, suffix)
+ ret_tarballs.append (suffixed)
+ os.rename (file, os.path.join (TARBALLS_PATH, suffixed))
+ os.chdir (CURDIR)
+ return ret_tarballs
+
+def tarballize_cmake (path, suffix = None):
+ name = path.split ("/")[-1]
+
+ os.chdir (CURDIR)
+ os.chdir (name)
+ run_error2 ("mkdir -p build")
+ os.chdir ("build")
+ run_error2 ("cmake ../")
+ run_error2 ("make package_source")
+ tarballs = glob.glob ("dist/*.tar.gz")
+ ret_tarballs = []
for file in tarballs:
+ run_error2 ("cp %s %s.bak" % (file, file))
+ run_error2 ("gunzip %s" % file)
+ run_error2 ("bzip2 %s" % file)
+ run_error2 ("mv %s.bak %s" % (file, file))
+ filename = os.path.basename (file)
+ suffixed = add_suffix (filename, suffix)
+ ret_tarballs.append (suffixed)
+ os.rename (file, os.path.join (TARBALLS_PATH, suffixed))
+ file = "%s.bz2" % file[:-3]
filename = os.path.basename (file)
- os.rename (file, os.path.join (TARBALLS_PATH, filename))
+ suffixed = add_suffix (filename, suffix)
+ ret_tarballs.append (suffixed)
+ os.rename (file, os.path.join (TARBALLS_PATH, suffixed))
os.chdir (CURDIR)
- tarballs = map (os.path.basename, tarballs)
- return tarballs
+ return ret_tarballs
-def tarballize_ccs_kconfig (path):
+def tarballize_ccs_kconfig (path, suffix = None):
os.chdir (CURDIR)
if config.branch:
if not run ("./ccs-kconfig-release -av %s -ab %s" % (config.version,
@@ -191,12 +259,14 @@ def tarballize_ccs_kconfig (path):
if not run ("./ccs-kconfig-release -av %s" % config.version):
raise RuntimeError, "make distcheck failed"
tarballs = glob.glob ("build/*.tar.*")
+ ret_tarballs = []
for file in tarballs:
filename = os.path.basename (file)
- os.rename (file, os.path.join (TARBALLS_PATH, filename))
+ suffixed = add_suffix (filename, suffix)
+ ret_tarballs.append (suffixed)
+ os.rename (file, os.path.join (TARBALLS_PATH, suffixed))
os.chdir (CURDIR)
- tarballs = map (os.path.basename, tarballs)
- return tarballs
+ return ret_tarballs
def unpack (file):
bits = file.rsplit (".", 2)
@@ -212,22 +282,18 @@ def unpack (file):
else:
raise RuntimeError, "unknown extension"
- if not run ("tar %s %s" % (flags, path)):
- raise RuntimeError, "failed to unpack tarball"
+ run_error ("tar %s %s" % (flags, path), "failed to unpack tarball")
-def test (file):
+def test_default (file):
name = file.rsplit (".", 2)[0]
os.chdir (TESTS_PATH)
unpack (file)
os.chdir (name)
- if not run ("./configure --prefix=%s" % TESTS_PREFIX):
- raise RuntimeError, "configure failed"
- if not run ("make"):
- raise RuntimeError, "make failed"
- if not run ("make install"):
- raise RuntimeError, "make install failed"
+ run_error2 ("./configure --prefix=%s" % TESTS_PREFIX)
+ run_error2 ("make")
+ run_error2 ("make install")
os.chdir (CURDIR)
@@ -238,19 +304,36 @@ def test_distutils (file):
unpack (file)
os.chdir (name)
- if not run ("python setup.py build --prefix=%s" % TESTS_PREFIX):
- raise RuntimeError, "build failed"
- if not run ("python setup.py install --prefix=%s" % TESTS_PREFIX):
- raise RuntimeError, "install failed"
+ run_error2 ("python setup.py build --prefix=%s" % TESTS_PREFIX)
+ run_error2 ("python setup.py install --prefix=%s" % TESTS_PREFIX)
os.chdir (CURDIR)
+def test_cmake (file):
+ name = file.rsplit (".", 2)[0]
+ os.chdir (TESTS_PATH)
+
+ unpack (file)
+ os.chdir (name)
+ run_error2 ("mkdir -p build")
+ os.chdir ("build")
+ run_error2 ("cmake -DCMAKE_INSTALL_PREFIX=%s ../" % TESTS_PREFIX)
+ run_error2 ("make")
+ run_error2 ("make install")
+
TARBALLIZERS = {
+ "plugins-main": {"-cmake": tarballize_cmake, "": tarballize_default},
+ "plugins-extra": {"-cmake": tarballize_cmake, "": tarballize_default},
+ "plugins-unsupported": {"-cmake": tarballize_cmake,
+ "": tarballize_default},
"ccsm": tarballize_distutils,
"simple-ccsm": tarballize_distutils,
"compizconfig-backend-kconfig": tarballize_ccs_kconfig,
}
TESTERS = {
+ "plugins-main": {"-cmake": test_cmake, "": test_default},
+ "plugins-extra": {"-cmake": test_cmake, "": test_default},
+ "plugins-unsupported": {"-cmake": test_cmake, "": test_default},
"ccsm": test_distutils,
"simple-ccsm": test_distutils,
}
@@ -276,12 +359,27 @@ def release (component):
tarballs = tarballize (component)
print success ("Successfully tarballized %s" % component)
- if len (tarballs):
+ for tarball in tarballs:
+ if not is_bz2 (tarball):
+ continue
if name in TESTERS:
- TESTERS[name] (tarballs[0])
+ tester = TESTERS[name]
+ if callable (tester):
+ tester (tarball)
+ else:
+ found = False
+ for suffix in tester:
+ if not suffix:
+ continue
+ if has_suffix (tarball, suffix):
+ found = True
+ tester[suffix] (tarball)
+ break
+ if not found and "" in tester:
+ tester[""] (tarball)
else:
- test (tarballs[0])
- print success ("Successfully tested %s" % component)
+ test_default (tarballs)
+ print success ("Successfully tested %s" % tarball)
def sum_and_sign ():
print info ("Summing & signing tarballs")