a8419fb546
dpkg-buildpackage now wants a timestamp in the changelog. Also remove --git-revision-file and --git-timestamp-file, which were part of the previous way to build Debian packages. Change-Id: Idbcf418571889ad7588424e6d8ae6e81ec79942b Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/504280 Reviewed-by: Ivan Inozemtsev <iinozemtsev@google.com> Commit-Queue: Ryan Macnak <rmacnak@google.com>
73 lines
2.2 KiB
Python
Executable File
73 lines
2.2 KiB
Python
Executable File
#!/usr/bin/env python3
|
|
#
|
|
# Copyright (c) 2023, the Dart project authors. Please see the AUTHORS file
|
|
# for details. All rights reserved. Use of this source code is governed by a
|
|
# BSD-style license that can be found in the LICENSE file.
|
|
|
|
import optparse
|
|
import os
|
|
import shutil
|
|
import subprocess
|
|
import sys
|
|
from os.path import join, split, abspath, dirname
|
|
|
|
sys.path.append(join(dirname(__file__), '..'))
|
|
import utils
|
|
|
|
DART_DIR = abspath(join(dirname(__file__), '..', '..'))
|
|
|
|
|
|
def BuildOptions():
|
|
result = optparse.OptionParser()
|
|
result.add_option("--version", default=None)
|
|
result.add_option("--timestamp", default=None)
|
|
result.add_option("--arch", default=None)
|
|
result.add_option("--lib_dir", default=None)
|
|
return result
|
|
|
|
|
|
def GenerateCopyright(filename):
|
|
with open(join(DART_DIR, 'LICENSE')) as lf:
|
|
license_lines = lf.readlines()
|
|
|
|
with open(filename, 'w') as f:
|
|
f.write('Name: dart\n')
|
|
f.write('Maintainer: Dart Team <misc@dartlang.org>\n')
|
|
f.write('Source: https://dart.googlesource.com/sdk\n')
|
|
f.write('License:\n')
|
|
for line in license_lines:
|
|
f.write(' %s' % line) # Line already contains trailing \n.
|
|
|
|
|
|
def GenerateChangeLog(filename, version, timestamp):
|
|
with open(filename, 'w') as f:
|
|
f.write('dart (%s-1) UNRELEASED; urgency=low\n' % version)
|
|
f.write('\n')
|
|
f.write(' * Generated file.\n')
|
|
f.write('\n')
|
|
f.write(' -- Dart Team <misc@dartlang.org> %s\n' % timestamp)
|
|
|
|
|
|
def Main():
|
|
parser = BuildOptions()
|
|
(options, args) = parser.parse_args()
|
|
|
|
version = options.version
|
|
timestamp = options.timestamp
|
|
versiondir = 'dart-%s' % version
|
|
shutil.copytree(join(DART_DIR, 'tools', 'debian_package', 'debian'),
|
|
join(versiondir, 'debian'),
|
|
dirs_exist_ok=True)
|
|
GenerateCopyright(join(versiondir, 'debian', 'copyright'))
|
|
GenerateChangeLog(join(versiondir, 'debian', 'changelog'), version,
|
|
timestamp)
|
|
|
|
cmd = ['dpkg-buildpackage', '-B', '-a', options.arch, '-us', '-uc']
|
|
env = os.environ.copy()
|
|
env["LIB_DIR"] = options.lib_dir
|
|
process = subprocess.check_call(cmd, cwd=versiondir, env=env)
|
|
|
|
|
|
if __name__ == '__main__':
|
|
sys.exit(Main())
|