diff options
author | Dominik Riebeling <Dominik.Riebeling@gmail.com> | 2012-02-05 22:00:57 +0100 |
---|---|---|
committer | Dominik Riebeling <Dominik.Riebeling@gmail.com> | 2012-02-05 22:00:57 +0100 |
commit | 001eb3b211cc1954a9678f320d0d31056f45bc25 (patch) | |
tree | 4f789e992bc548d6bd54dd2705ebcaa7ed7e510c /utils/common | |
parent | 909b96fa70fd14a0fc8d59e1e810f484d30039c6 (diff) | |
download | rockbox-001eb3b211cc1954a9678f320d0d31056f45bc25.tar.gz rockbox-001eb3b211cc1954a9678f320d0d31056f45bc25.zip |
Update deployment script for git.
First and rather rough adjustment for git. There are still a lot of places
referring to svn, and various functionality might be broken which needs fixing
later.
Change-Id: Ia628f06e99f527e01f131ce674746fba77d97d23
Diffstat (limited to 'utils/common')
-rwxr-xr-x | utils/common/deploy.py | 61 |
1 files changed, 21 insertions, 40 deletions
diff --git a/utils/common/deploy.py b/utils/common/deploy.py index 6a8b2580da..a01954c42d 100755 --- a/utils/common/deploy.py +++ b/utils/common/deploy.py | |||
@@ -29,7 +29,6 @@ | |||
29 | # If the required Qt installation isn't in PATH use --qmake option. | 29 | # If the required Qt installation isn't in PATH use --qmake option. |
30 | # Tested on Linux and MinGW / W32 | 30 | # Tested on Linux and MinGW / W32 |
31 | # | 31 | # |
32 | # requires pysvn package. | ||
33 | # requires upx.exe in PATH on Windows. | 32 | # requires upx.exe in PATH on Windows. |
34 | # | 33 | # |
35 | 34 | ||
@@ -45,14 +44,9 @@ import time | |||
45 | import hashlib | 44 | import hashlib |
46 | import tempfile | 45 | import tempfile |
47 | import string | 46 | import string |
47 | import gitscraper | ||
48 | 48 | ||
49 | # modules that are not part of python itself. | 49 | # modules that are not part of python itself. |
50 | try: | ||
51 | import pysvn | ||
52 | except ImportError: | ||
53 | print "Fatal: This script requires the pysvn package to run." | ||
54 | print " See http://pysvn.tigris.org/." | ||
55 | sys.exit(-5) | ||
56 | cpus = 1 | 50 | cpus = 1 |
57 | try: | 51 | try: |
58 | import multiprocessing | 52 | import multiprocessing |
@@ -80,6 +74,7 @@ systemdlls = ['advapi32.dll', | |||
80 | 'winspool.drv', | 74 | 'winspool.drv', |
81 | 'ws2_32.dll'] | 75 | 'ws2_32.dll'] |
82 | 76 | ||
77 | gitrepo = os.path.abspath(os.path.join(os.path.dirname(__file__), "../..")) | ||
83 | 78 | ||
84 | # == Functions == | 79 | # == Functions == |
85 | def usage(myself): | 80 | def usage(myself): |
@@ -112,26 +107,9 @@ def which(executable): | |||
112 | return "" | 107 | return "" |
113 | 108 | ||
114 | 109 | ||
115 | def getsources(svnsrv, filelist, dest): | 110 | def getsources(treehash, filelist, dest): |
116 | '''Get the files listed in filelist from svnsrv and put it at dest.''' | 111 | '''Get the files listed in filelist from svnsrv and put it at dest.''' |
117 | client = pysvn.Client() | 112 | gitscraper.scrape_files(gitrepo, treehash, filelist, dest) |
118 | print "Checking out sources from %s, please wait." % svnsrv | ||
119 | |||
120 | for elem in filelist: | ||
121 | url = re.subn('/$', '', svnsrv + elem)[0] | ||
122 | destpath = re.subn('/$', '', dest + elem)[0] | ||
123 | # make sure the destination path does exist | ||
124 | d = os.path.dirname(destpath) | ||
125 | if not os.path.exists(d): | ||
126 | os.makedirs(d) | ||
127 | # get from svn | ||
128 | try: | ||
129 | client.export(url, destpath) | ||
130 | except: | ||
131 | print "SVN client error: %s" % sys.exc_value | ||
132 | print "URL: %s, destination: %s" % (url, destpath) | ||
133 | return -1 | ||
134 | print "Checkout finished." | ||
135 | return 0 | 113 | return 0 |
136 | 114 | ||
137 | 115 | ||
@@ -492,6 +470,7 @@ def deploy(): | |||
492 | cross = "" | 470 | cross = "" |
493 | buildid = None | 471 | buildid = None |
494 | platform = sys.platform | 472 | platform = sys.platform |
473 | treehash = gitscraper.get_refs(gitrepo)['refs/remotes/origin/HEAD'] | ||
495 | if sys.platform != "darwin": | 474 | if sys.platform != "darwin": |
496 | static = True | 475 | static = True |
497 | else: | 476 | else: |
@@ -502,9 +481,6 @@ def deploy(): | |||
502 | if o in ("-p", "--project"): | 481 | if o in ("-p", "--project"): |
503 | proj = a | 482 | proj = a |
504 | cleanup = False | 483 | cleanup = False |
505 | if o in ("-t", "--tag"): | ||
506 | tag = a | ||
507 | svnbase = svnserver + "tags/" + tag + "/" | ||
508 | if o in ("-a", "--add"): | 484 | if o in ("-a", "--add"): |
509 | addfiles.append(a) | 485 | addfiles.append(a) |
510 | if o in ("-n", "--makensis"): | 486 | if o in ("-n", "--makensis"): |
@@ -517,6 +493,8 @@ def deploy(): | |||
517 | static = False | 493 | static = False |
518 | if o in ("-k", "--keep-temp"): | 494 | if o in ("-k", "--keep-temp"): |
519 | keeptemp = True | 495 | keeptemp = True |
496 | if o in ("-t", "--tree"): | ||
497 | treehash = a | ||
520 | if o in ("-x", "--cross") and sys.platform != "win32": | 498 | if o in ("-x", "--cross") and sys.platform != "win32": |
521 | cross = a | 499 | cross = a |
522 | platform = "win32" | 500 | platform = "win32" |
@@ -546,30 +524,33 @@ def deploy(): | |||
546 | # make sure the path doesn't contain backslashes to prevent issues | 524 | # make sure the path doesn't contain backslashes to prevent issues |
547 | # later when running on windows. | 525 | # later when running on windows. |
548 | workfolder = re.sub(r'\\', '/', w) | 526 | workfolder = re.sub(r'\\', '/', w) |
549 | revision = getfolderrev(svnbase) | 527 | revision = gitscraper.describe_treehash(gitrepo, treehash) |
528 | # try to find a version number from describe output. | ||
529 | # WARNING: this is broken and just a temporary workaround! | ||
530 | v = re.findall('([\d\.a-f]+)', revision) | ||
531 | if v: | ||
532 | if v[-1].find('.') >= 0: | ||
533 | revision = "v" + v[-1] | ||
534 | else: | ||
535 | revision = v[-1] | ||
550 | if buildid == None: | 536 | if buildid == None: |
551 | versionextra = "" | 537 | versionextra = "" |
552 | else: | 538 | else: |
553 | versionextra = "-" + buildid | 539 | versionextra = "-" + buildid |
554 | if tag != "": | 540 | sourcefolder = workfolder + "/" + program + "-" + str(revision) + versionextra + "/" |
555 | sourcefolder = workfolder + "/" + tag + "/" | 541 | archivename = program + "-" + str(revision) + versionextra + "-src.tar.bz2" |
556 | archivename = tag + versionextra + "-src.tar.bz2" | 542 | ver = str(revision) |
557 | # get numeric version part from tag | ||
558 | ver = "v" + re.sub('^[^\d]+', '', tag) | ||
559 | else: | ||
560 | sourcefolder = workfolder + "/" + program + "-r" + str(revision) + versionextra + "/" | ||
561 | archivename = program + "-r" + str(revision) + versionextra + "-src.tar.bz2" | ||
562 | ver = "r" + str(revision) | ||
563 | os.mkdir(sourcefolder) | 543 | os.mkdir(sourcefolder) |
564 | else: | 544 | else: |
565 | workfolder = "." | 545 | workfolder = "." |
566 | sourcefolder = "." | 546 | sourcefolder = "." |
567 | archivename = "" | 547 | archivename = "" |
568 | # check if project file explicitly given. If yes, don't get sources from svn | 548 | # check if project file explicitly given. If yes, don't get sources from svn |
549 | print "Version: %s" % revision | ||
569 | if proj == "": | 550 | if proj == "": |
570 | proj = sourcefolder + project | 551 | proj = sourcefolder + project |
571 | # get sources and pack source tarball | 552 | # get sources and pack source tarball |
572 | if not getsources(svnbase, svnpaths, sourcefolder) == 0: | 553 | if not getsources(treehash, svnpaths, sourcefolder) == 0: |
573 | tempclean(workfolder, cleanup and not keeptemp) | 554 | tempclean(workfolder, cleanup and not keeptemp) |
574 | sys.exit(1) | 555 | sys.exit(1) |
575 | 556 | ||