-
Notifications
You must be signed in to change notification settings - Fork 0
/
update-source-from-git-label
executable file
·85 lines (69 loc) · 3.77 KB
/
update-source-from-git-label
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
#!/usr/bin/env python
import os
import sys
from time import strftime
LABEL = "v1.0.0"
VERSION = "1.0.0"
base_pkgnames = ["libmate", "libmatecanvas", "libmatecomponent", "libmatecomponentui", "libmatekbd", "libmatekeyring", "libmatenotify", "libmateui", "libmateweather", "mate-backgrounds", "mate-common", "mate-conf", "mate-control-center", "mate-corba", "mate-desktop", "mate-dialogs", "mate-display-manager", "mate-doc-utils", "mate-file-manager", "mate-icon-theme", "mate-keyring", "mate-menus", "mate-mime-data", "mate-notification-daemon", "mate-panel", "mate-polkit", "mate-session-manager", "mate-settings-daemon", "mate-themes", "mate-vfs", "mate-window-manager"]
extra_pkgnames = ["mate-applets", "mate-desktop-environment", "mate-image-viewer", "mate-power-manager", "mate-video-player", "mate-bluetooth", "mate-disk-utility", "mate-indicator-applet", "mate-system-monitor", "music-applet-2.5.1", "xfce4-xfapplet-plugin", "mate-calc", "mate-document-viewer", "mate-media", "mate-system-tools","python-caja", "mate-character-map", "mate-extract", "mate-menu-editor", "mate-terminal", "python-corba", "mate-conf-dbus", "mate-file-manager-open-terminal", "mate-pl-parser", "mate-text-editor", "python-mate", "mate-conf-editor", "mate-file-manager-sendto", "mate-policykit", "mate-utils", "python-mate-desktop"]
base_pkgnames.sort()
extra_pkgnames.sort()
def usage():
print "USAGE: update-source-from-git-latest pkgname"
print "pkgname can be one of the following: "
print " BASE PACKAGES: %s" % ", ".join(base_pkgnames)
print " EXTRA PACKAGES: %s" % ", ".join(extra_pkgnames)
if len(sys.argv) != 2:
print "WRONG NUMBER OF ARGUMENTS!"
usage()
sys.exit(1)
pkgname = sys.argv[1]
if (not pkgname in base_pkgnames) and (not pkgname in extra_pkgnames):
print "INVALID PKGNAME!"
usage()
sys.exit(1)
ROOT_DIR = os.getcwd()
GIT_DIR = os.path.join(ROOT_DIR, "git-source")
SOURCE_BASE_DIR = os.path.join(ROOT_DIR, "git-source/Mate-Desktop-Environment")
SOURCE_EXTRA_DIR = os.path.join(ROOT_DIR, "git-source/Mate-Extra")
if pkgname in base_pkgnames:
SOURCE_DIR = SOURCE_BASE_DIR
elif pkgname in extra_pkgnames:
SOURCE_DIR = SOURCE_EXTRA_DIR
# Get the latest source code
if os.path.exists(SOURCE_DIR):
print "PULLING LATEST SOURCE CODE CHANGES FROM FROM GITHUB..."
os.chdir(SOURCE_DIR)
os.system("git pull")
os.system("git reset --hard %s" % LABEL)
else:
print "CLONING MATE SOURCE CODE FROM GITHUB..."
os.chdir(ROOT_DIR)
os.system("mkdir -p git-source")
os.chdir(GIT_DIR)
if pkgname in base_pkgnames:
os.system("git clone git://github.com/perberos/Mate-Desktop-Environment.git")
elif pkgname in extra_pkgnames:
os.system("git clone git://github.com/perberos/Mate-Extra.git")
os.system("git reset --hard %s" % LABEL)
# Clean up package folder (WARNING: this deletes debian/ files not committed!!!)
print "CLEANING UP %s..." % pkgname
os.chdir(ROOT_DIR)
os.system("sudo git clean -f -x -d %s/" % pkgname)
# Remove any previous orig archive
print "REMOVING PREVIOUS ARCHIVES FOR %s..." % pkgname
os.chdir(ROOT_DIR)
os.system("rm -rf %s*bz2" % pkgname)
# Copy mate-conf
print "COPYING SOURCE CODE INTO PACKAGE FOR %s..." % pkgname
os.chdir(ROOT_DIR)
os.system("cp -R %(SOURCE_DIR)s/%(pkgname)s/* %(pkgname)s/" % {'SOURCE_DIR':SOURCE_DIR, 'pkgname':pkgname})
# Create an orig archive
print "CREATING NEW ORIG.TAR.BZ2 ARCHIVE FOR %s..." % pkgname
archive_filename = "%(pkgname)s_%(version)s.orig.tar" % {'pkgname':pkgname, 'version':VERSION}
os.chdir(SOURCE_DIR)
os.chdir(pkgname)
os.system("tar cf %s *" % archive_filename)
os.system("bzip2 %s" % archive_filename)
os.system("mv %(archive_filename)s.bz2 %(ROOT_DIR)s/" % {'archive_filename':archive_filename, 'ROOT_DIR':ROOT_DIR})
print "FINISHED UPDATING SOURCE FOR %s" % pkgname