Compare commits

...

27 Commits
v25 ... main

Author SHA1 Message Date
Valentin Deniaud a0de07b676 misc: update git-blame-ignore-revs to ignore quote changes (#79788)
gitea/eobuilder/pipeline/head This commit looks good Details
2023-08-16 11:52:32 +02:00
Valentin Deniaud 04e1269061 misc: apply double-quote-string-fixer (#79788) 2023-08-16 11:52:32 +02:00
Valentin Deniaud ec5581eb62 misc: add pre commit hook to force single quotes (#79788) 2023-08-16 11:52:32 +02:00
Frédéric Péters 9e0a88af56 misc: remove deb repository handling (#80288)
gitea/eobuilder/pipeline/head This commit looks good Details
2023-08-05 12:19:27 +02:00
Frédéric Péters a7aa93137e ci: build deb package for bookworm (#78968)
gitea/eobuilder/pipeline/head This commit looks good Details
2023-06-23 17:29:58 +02:00
Frédéric Péters 1869e13923 misc: remove i386 references (#78330)
gitea/eobuilder/pipeline/head This commit looks good Details
2023-06-12 12:34:08 +02:00
Frédéric Péters fa3d05039b add bookworm support (and remove buster) (#78329)
gitea/eobuilder/pipeline/head This commit looks good Details
2023-06-12 09:33:39 +02:00
Frédéric Péters e9f99260f2 change launcher script to get configuration from /etc/ (#74863)
gitea/eobuilder/pipeline/head This commit looks good Details
2023-03-02 10:08:20 +01:00
Agate 29856dc94a Prepare Jenkinsfile for Gitea migration (#74572)
gitea/eobuilder/pipeline/head This commit looks good Details
2023-02-20 15:04:48 +01:00
Frédéric Péters c6b8c7967d ci: only build package for bullseye (#72729) 2022-12-22 17:21:26 +01:00
Frédéric Péters 192f5c4983 misc: defaults to bullseye (#72729) 2022-12-22 17:16:17 +01:00
Thomas NOËL 680bf08f46 trivial: bump black version to 22.3.0 2022-03-31 12:18:07 +02:00
Frédéric Péters e0a191a6e9 trivial: bump black version to 22.1.0 (#62312) 2022-03-01 19:30:34 +01:00
Nicolas Roche b2de21ed47 settings: close local settings file (#61980) 2022-02-25 14:53:02 +01:00
Frédéric Péters 4f93ac5490 changelog: skip failing lines (#60475) 2022-01-10 20:06:10 +01:00
Frédéric Péters d4debeef85 generate Packages.gz event if --no-dput is given (#59604) 2021-12-12 16:02:36 +01:00
Frédéric Péters 26d0ce3d3a debian: use debhelper compat level 12 2021-12-12 11:40:34 +01:00
Frédéric Péters fee146ed91 jenkins: build packages for buster & bullseye 2021-12-12 11:40:13 +01:00
Frédéric Péters 2279cd039d build: bump black version 2021-11-22 22:08:00 +01:00
Frédéric Péters ca7fb97ba0 remove stretch from default repositories/targets 2021-08-15 14:59:33 +02:00
Frédéric Péters a441c38f01 shift versions as bullseye has now been released (#51564) 2021-08-15 14:54:46 +02:00
Paul Marillonnet b49cb75bc9 reduce supported versions to current debian versions (#51564) 2021-08-15 14:54:43 +02:00
Frédéric Péters 1ea1c69c01 misc: change target default to buster only (#51544) 2021-03-01 16:39:16 +01:00
Frédéric Péters 70398ec190 misc: add black files/notes 2021-01-11 19:08:28 +01:00
Frédéric Péters d37357188d trivial: apply black 2021-01-11 19:07:33 +01:00
Frédéric Péters f3ad730d9e pbuilder: add stable entr'ouvert apt repository (#49869) 2021-01-05 09:54:30 +01:00
Frédéric Péters 9533483ed3 build: update to use origin/main 2020-12-26 15:21:16 +01:00
17 changed files with 498 additions and 441 deletions

4
.git-blame-ignore-revs Normal file
View File

@ -0,0 +1,4 @@
# trivial: apply black
d37357188d49b5f7db11bc8e487caf620a666a85
# misc: apply double-quote-string-fixer (#79788)
04e12690619fe48300a50fa77dd145a3ca2da755

12
.pre-commit-config.yaml Normal file
View File

@ -0,0 +1,12 @@
# See https://pre-commit.com for more information
# See https://pre-commit.com/hooks.html for more hooks
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
hooks:
- id: double-quote-string-fixer
- repo: https://github.com/psf/black
rev: 22.3.0
hooks:
- id: black
args: ['--target-version', 'py37', '--skip-string-normalization', '--line-length', '110']

16
Jenkinsfile vendored
View File

@ -1,4 +1,4 @@
@Library('eo-jenkins-lib@master') import eo.Utils
@Library('eo-jenkins-lib@main') import eo.Utils
pipeline {
agent any
@ -6,10 +6,18 @@ pipeline {
stage('Packaging') {
steps {
script {
if (env.JOB_NAME == 'eobuilder' && env.GIT_BRANCH == 'origin/master') {
sh 'sudo -H -u eobuilder /usr/local/bin/eobuilder eobuilder'
env.SHORT_JOB_NAME=sh(
returnStdout: true,
// given JOB_NAME=gitea/project/PR-46, returns project
// given JOB_NAME=project/main, returns project
script: '''
echo "${JOB_NAME}" | sed "s/gitea\\///" | awk -F/ '{print $1}'
'''
).trim()
if (env.GIT_BRANCH == 'main' || env.GIT_BRANCH == 'origin/main') {
sh "sudo -H -u eobuilder /usr/local/bin/eobuilder -d bullseye,bookworm ${SHORT_JOB_NAME}"
} else if (env.GIT_BRANCH.startsWith('hotfix/')) {
sh "sudo -H -u eobuilder /usr/local/bin/eobuilder --branch ${env.GIT_BRANCH} --hotfix eobuilder"
sh "sudo -H -u eobuilder /usr/local/bin/eobuilder -d bullseye,bookworm --branch ${env.GIT_BRANCH} --hotfix ${SHORT_JOB_NAME}"
}
}
}

View File

@ -18,16 +18,16 @@ uninstall:
rm /etc/cron.daily/eobuilder
chroots:
for DIST in wheezy jessie stretch buster; do \
for ARCH in i386 amd64; do \
for DIST in bullseye bookworm; do \
for ARCH in amd64; do \
mkdir -p /var/cache/pbuilder/$$DIST-$$ARCH/base.cow; \
DIST=$$DIST ARCH=$$ARCH cowbuilder --create --configfile ./pbuilderrc --keyring ./entrouvert.gpg; \
done; \
done
chroots-update:
for DIST in wheezy jessie stretch buster; do \
for ARCH in i386 amd64; do \
for DIST in bullseye bookworm; do \
for ARCH in amd64; do \
mkdir -p /var/cache/pbuilder/$$DIST-$$ARCH/base.cow; \
DIST=$$DIST ARCH=$$ARCH cowbuilder --update --configfile ./pbuilderrc --keyring ./entrouvert.gpg; \
done; \

View File

@ -42,6 +42,16 @@ Note that the SSH host key verification will fail unless the proper
known_hosts file has been installed, or created by manually connecting
to the git server.
Code Style
----------
black is used to format the code, using thoses parameters:
black --target-version py37 --skip-string-normalization --line-length 110
There is .pre-commit-config.yaml to use pre-commit to automatically run black
before commits. (execute `pre-commit install` to install the git hook.)
Packaging
---------

1
debian/compat vendored
View File

@ -1 +0,0 @@
10

2
debian/control vendored
View File

@ -2,7 +2,7 @@ Source: eobuilder
Maintainer: Frederic Peters <fpeters@entrouvert.com>
Section: python
Priority: optional
Build-Depends: dh-python, python3-setuptools, python3-all, debhelper (>= 10), dh-exec
Build-Depends: dh-python, python3-setuptools, python3-all, debhelper-compat (= 12), dh-exec
Standards-Version: 3.9.6
Homepage: https://dev.entrouvert.org/projects/eobuilder

42
dput.cf
View File

@ -2,40 +2,14 @@
method = scp
fqdn = deb.entrouvert.org
[squeeze-eobuilder]
incoming = /var/vhosts/deb.entrouvert.org/incoming/squeeze-eobuilder
[bullseye-eobuilder]
incoming = /var/vhosts/deb.entrouvert.org/incoming/bullseye-eobuilder
[wheezy-eobuilder]
method = scp
fqdn = deb.entrouvert.org
incoming = /var/vhosts/deb.entrouvert.org/incoming/wheezy-eobuilder
[bookworm-eobuilder]
incoming = /var/vhosts/deb.entrouvert.org/incoming/bookworm-eobuilder
[jessie-eobuilder]
incoming = /var/vhosts/deb.entrouvert.org/incoming/jessie-eobuilder
[bullseye-hotfix]
incoming = /var/vhosts/deb.entrouvert.org/incoming/bullseye-hotfix
[stretch-eobuilder]
incoming = /var/vhosts/deb.entrouvert.org/incoming/stretch-eobuilder
[buster-eobuilder]
incoming = /var/vhosts/deb.entrouvert.org/incoming/buster-eobuilder
[jessie-hotfix]
incoming = /var/vhosts/deb.entrouvert.org/incoming/jessie-hotfix
[stretch-hotfix]
incoming = /var/vhosts/deb.entrouvert.org/incoming/stretch-hotfix
[buster-hotfix]
incoming = /var/vhosts/deb.entrouvert.org/incoming/buster-hotfix
[wheezy-legacy]
incoming = /var/vhosts/deb.entrouvert.org/incoming/wheezy-legacy
[squeeze-legacy]
incoming = /var/vhosts/deb.entrouvert.org/incoming/squeeze-legacy
[wheezy-wip-alfortville]
incoming = /var/vhosts/deb.entrouvert.org/incoming/wheezy-wip-alfortville
[wheezy-wip-wcs-django]
incoming = /var/vhosts/deb.entrouvert.org/incoming/wheezy-wip-wcs-django
[bookworm-hotfix]
incoming = /var/vhosts/deb.entrouvert.org/incoming/bookworm-hotfix

View File

@ -9,17 +9,26 @@ import time
from eobuilder import settings, init as eobuilder_init
def init():
eobuilder_init()
gitolite_admin_path = os.path.join(settings.GIT_PATH, 'gitolite-admin')
if not os.path.exists(gitolite_admin_path):
p = subprocess.Popen(['git', 'clone', 'git@repos.entrouvert.org:gitolite-admin.git'],
close_fds=True, stdin=subprocess.PIPE, stdout=subprocess.PIPE,
cwd=settings.GIT_PATH)
p = subprocess.Popen(
['git', 'clone', 'git@repos.entrouvert.org:gitolite-admin.git'],
close_fds=True,
stdin=subprocess.PIPE,
stdout=subprocess.PIPE,
cwd=settings.GIT_PATH,
)
else:
p = subprocess.Popen(['git', 'pull'],
close_fds=True, stdin=subprocess.PIPE, stdout=subprocess.PIPE,
cwd=gitolite_admin_path)
p = subprocess.Popen(
['git', 'pull'],
close_fds=True,
stdin=subprocess.PIPE,
stdout=subprocess.PIPE,
cwd=gitolite_admin_path,
)
stdout, stderr = p.communicate()
if p.returncode != 0:
# abort if there's an error in this git call, we could try going on
@ -36,18 +45,17 @@ def get_modules():
modules.append(line.split()[-1])
return modules
def build_module(config, module):
try:
dists = config.get('dists', module)
except (ConfigParser.NoSectionError, ConfigParser.NoOptionError):
dists = 'jessie,stretch,buster'
rc = os.system('/usr/local/bin/eobuilder -d %(dists)s %(module)s' % {
'dists': dists,
'module': module})
dists = 'bullseye'
rc = os.system('/usr/local/bin/eobuilder -d %(dists)s %(module)s' % {'dists': dists, 'module': module})
if rc == 0:
return 'ok'
elif rc % 256 != 0:
return 'fail' # killed by a signal
return 'fail' # killed by a signal
else:
exit_code = rc / 256
if exit_code == 2:
@ -55,6 +63,7 @@ def build_module(config, module):
else:
return 'fail'
if __name__ == '__main__':
init()
cfg_file = os.path.expanduser('~/.config/eobuilder')
@ -77,13 +86,13 @@ if __name__ == '__main__':
if blacklisted:
continue
t0 = time.time()
print('='*60)
print('=' * 60)
print(module)
print('='*60)
print('=' * 60)
sys.stdout.flush()
results[module] = build_module(config, module)
print('\n')
print('(%1.2f seconds)' % (time.time()-t0))
print('(%1.2f seconds)' % (time.time() - t0))
print('\n')
sys.stdout.flush()

View File

@ -20,6 +20,7 @@ from eobuilder.cmdline import parse_cmdline, error, cat, touch, call, output, se
if 'git+ssh' not in urllib.parse.uses_relative:
urllib.parse.uses_relative.append('git+ssh')
def rm_recursive(path):
if os.path.exists(path):
shutil.rmtree(path)
@ -37,35 +38,34 @@ def smart_cleaning(files_path):
for project in project_files.iterkeys():
nb_versions = len(project_files[project])
if nb_versions > settings.MIN_PACKAGE_VERSIONS:
project_files[project] = \
sorted(project_files[project],
key=lambda x: os.stat(x).st_mtime)
project_files[project] = sorted(project_files[project], key=lambda x: os.stat(x).st_mtime)
for filename in project_files[project]:
if nb_versions > settings.MIN_PACKAGE_VERSIONS and \
os.stat(filename).st_mtime < now - settings.MIN_AGE * 86400:
if (
nb_versions > settings.MIN_PACKAGE_VERSIONS
and os.stat(filename).st_mtime < now - settings.MIN_AGE * 86400
):
os.remove(filename)
nb_versions -= 1
def clean(method):
print("+ Cleanning %s" % method)
if method == "all":
print('+ Cleanning %s' % method)
if method == 'all':
shutil.rmtree(settings.ORIGIN_PATH)
shutil.rmtree(settings.PBUILDER_RESULT)
shutil.rmtree(settings.GIT_PATH)
shutil.rmtree(settings.LOCK_PATH)
elif method == "git":
elif method == 'git':
shutil.rmtree(settings.GIT_PATH)
elif method == "deb":
elif method == 'deb':
shutil.rmtree(settings.PBUILDER_RESULT)
elif method == "archives":
elif method == 'archives':
shutil.rmtree(settings.ORIGIN_PATH)
elif method == "locks":
elif method == 'locks':
shutil.rmtree(settings.LOCK_PATH)
elif method == "smart":
elif method == 'smart':
results_files = []
origin_files = [os.path.join(settings.ORIGIN_PATH, f) \
for f in os.listdir(settings.ORIGIN_PATH)]
origin_files = [os.path.join(settings.ORIGIN_PATH, f) for f in os.listdir(settings.ORIGIN_PATH)]
for root, dirs, files in os.walk(settings.PBUILDER_RESULT):
for fname in files:
results_files.append(os.path.join(root, fname))
@ -76,64 +76,56 @@ def clean(method):
for fname in files:
fname = os.path.join(root, fname)
ext = os.path.splitext(fname)
if ext == "build" and \
os.stat(fname).st_mtime < now - 365 * 86400:
if ext == 'build' and os.stat(fname).st_mtime < now - 365 * 86400:
os.remove(fname)
else:
error("Cleanning: unknow '%s' option" % method)
def get_project_infos(git_project_path, cmd_options):
""" return a dict with project informations
"""
"""return a dict with project informations"""
os.chdir(git_project_path)
results = {
'name': '',
'version': '',
'fullname': '',
'ac_version': '',
'build_dir': '',
'build_branch': cmd_options.branch,
'commit_number': '',
'git_path': git_project_path,
}
if os.path.exists("setup.py"):
'name': '',
'version': '',
'fullname': '',
'ac_version': '',
'build_dir': '',
'build_branch': cmd_options.branch,
'commit_number': '',
'git_path': git_project_path,
}
if os.path.exists('setup.py'):
# Hack to support setup_requires
setup_py("--help")
results['name'] = setup_py("--name 2> /dev/null")[:-1]
results['version'] = setup_py("--version 2> /dev/null")[:-1]
results['fullname'] = setup_py("--fullname 2> /dev/null")[:-1]
elif os.path.exists("configure.ac"):
call("./autogen.sh")
setup_py('--help')
results['name'] = setup_py('--name 2> /dev/null')[:-1]
results['version'] = setup_py('--version 2> /dev/null')[:-1]
results['fullname'] = setup_py('--fullname 2> /dev/null')[:-1]
elif os.path.exists('configure.ac'):
call('./autogen.sh')
call('make all')
results['name'] = output(
"./configure --version | head -n1 | sed 's/ configure.*//'"
)[:-1]
results['ac_version'] = output(
"./configure --version | head -n1 | sed 's/.* configure //'"
)[:-1]
results['name'] = output("./configure --version | head -n1 | sed 's/ configure.*//'")[:-1]
results['ac_version'] = output("./configure --version | head -n1 | sed 's/.* configure //'")[:-1]
results['version'] = results['ac_version'].replace('-', '.')
results['fullname'] = results['name']
elif os.path.exists("Makefile"):
results['name'] = output("make name")[:-1]
results['version'] = output("make version")[:-1]
results['fullname'] = output("make fullname")[:-1]
elif os.path.exists('Makefile'):
results['name'] = output('make name')[:-1]
results['version'] = output('make version')[:-1]
results['fullname'] = output('make fullname')[:-1]
else:
error("Unsupported project type", exit_code=2)
error('Unsupported project type', exit_code=2)
results['build_dir'] = os.path.join(
settings.EOBUILDER_TMP, '%s-%d' % (results['name'], random.randint(0, 1000000))
)
settings.EOBUILDER_TMP, '%s-%d' % (results['name'], random.randint(0, 1000000))
)
atexit.register(rm_recursive, results['build_dir'])
results['commit_number'] = output("git rev-parse HEAD")[:-1]
results['lock_path'] = os.path.join(settings.LOCK_PATH,
results['name'])
current_tag = output(
"git describe --abbrev=0 --tags --match=v*",
exit_on_error=False)
results['commit_number'] = output('git rev-parse HEAD')[:-1]
results['lock_path'] = os.path.join(settings.LOCK_PATH, results['name'])
current_tag = output('git describe --abbrev=0 --tags --match=v*', exit_on_error=False)
if current_tag:
results['current_tag'] = current_tag[1:-1]
else:
results['current_tag'] = "0.0"
results['current_tag'] = '0.0'
return results
@ -143,85 +135,78 @@ def prepare_build(dist, project, cmd_options, new):
Create origin archive, update git and Debian changelog
"""
package = {
'repository': settings.DEFAULT_UNSTABLE_REPOSITORIES[dist],
'copy_in_testing': True,
'version': '',
'source_name': '',
'names': []
}
'repository': settings.DEFAULT_UNSTABLE_REPOSITORIES[dist],
'version': '',
'source_name': '',
'names': [],
}
if cmd_options.hotfix:
package['repository'] = settings.HOTFIX_REPOSITORIES[dist]
os.chdir(project['git_path'])
build_branch = cmd_options.branch
if cmd_options.hotfix and not build_branch.startswith('hotfix/'):
return error("Invalid name for hotfix branch (must start with hotfix/)", exit_code=2)
return error('Invalid name for hotfix branch (must start with hotfix/)', exit_code=2)
debian_folder = cmd_options.debian_folder
if os.path.isdir('debian-' + dist) and debian_folder == 'debian':
debian_folder = 'debian-' + dist
debian_branch = None
if not os.path.isdir(debian_folder):
debian_branch = "debian"
debian_folder = "debian"
branches = output("git branch -r -l")
if debian_branch == "debian" and "debian-%s" % dist in branches:
debian_branch = "debian-" + dist
if not 'origin/%s' % debian_branch in output("git branch -r -l"):
debian_branch = 'debian'
debian_folder = 'debian'
branches = output('git branch -r -l')
if debian_branch == 'debian' and 'debian-%s' % dist in branches:
debian_branch = 'debian-' + dist
if not 'origin/%s' % debian_branch in output('git branch -r -l'):
print('!!! WARNING: cannot build for dist %s, no debian directory found' % dist)
return
print("!!! WARNING obsolete: using a branch for debian/ packaging")
print("+ Updating Debian branch for %s" % dist)
call("git checkout --quiet %s" % debian_branch)
call("git pull")
print('!!! WARNING obsolete: using a branch for debian/ packaging')
print('+ Updating Debian branch for %s' % dist)
call('git checkout --quiet %s' % debian_branch)
call('git pull')
else:
print("+ Building from %s debian folder" % debian_folder)
print('+ Building from %s debian folder' % debian_folder)
for r in cmd_options.repositories:
repo = r.split(':')
if repo[0] == dist:
package["repository"] = repo[1]
package["copy_in_testing"] = False
package['repository'] = repo[1]
# get package source name
control_file = os.path.join(debian_folder, 'control')
package['names'] = re.findall(r"Package\s*:\s*(.*?)\n", cat(control_file))
package['source_name'] = re.search(r"^Source\s*:\s*(.*?)\n",
cat(control_file),
re.MULTILINE
).group(1)
package['names'] = re.findall(r'Package\s*:\s*(.*?)\n', cat(control_file))
package['source_name'] = re.search(r'^Source\s*:\s*(.*?)\n', cat(control_file), re.MULTILINE).group(1)
# build tarball
origin_archive = os.path.join(settings.ORIGIN_PATH,
"%s_%s.orig.tar.bz2" % (package['source_name'], project['version']))
origin_archive = os.path.join(
settings.ORIGIN_PATH, '%s_%s.orig.tar.bz2' % (package['source_name'], project['version'])
)
if not os.path.exists(origin_archive):
print("+ Generating origin tarball ...")
print('+ Generating origin tarball ...')
os.chdir(project['git_path'])
call("git checkout --quiet %s" % build_branch)
call('git checkout --quiet %s' % build_branch)
if os.path.exists('setup.py'):
setup_py("clean --all")
setup_py("sdist --formats=bztar")
shutil.move("dist/%s.tar.bz2" % project['fullname'], origin_archive)
setup_py('clean --all')
setup_py('sdist --formats=bztar')
shutil.move('dist/%s.tar.bz2' % project['fullname'], origin_archive)
elif os.path.exists('./configure.ac'):
call("make dist-bzip2")
shutil.move("%s-%s.tar.bz2" % \
(project['name'], project['ac_version']),
origin_archive)
call('make dist-bzip2')
shutil.move('%s-%s.tar.bz2' % (project['name'], project['ac_version']), origin_archive)
elif os.path.exists('Makefile'):
call("make dist-bzip2")
shutil.move("sdist/%s.tar.bz2" % project['fullname'], origin_archive)
call('make dist-bzip2')
shutil.move('sdist/%s.tar.bz2' % project['fullname'], origin_archive)
else:
error('Unsupported project type', project['build_dir'], exit_code=2)
last_version_file = os.path.join(project['lock_path'],
"%s_%s_%s.last_version" % (project['name'],
package['repository'],
build_branch.replace('/', '_'))
)
last_version_file = os.path.join(
project['lock_path'],
'%s_%s_%s.last_version' % (project['name'], package['repository'], build_branch.replace('/', '_')),
)
debian_changelog = os.path.join(debian_folder, 'changelog')
if os.path.exists(last_version_file):
last_debian_package_version = cat(last_version_file)
else:
last_debian_package_version = re.search(r"^Version:\s(.*?)$",
output("dpkg-parsechangelog -l%s" % debian_changelog),
re.MULTILINE).group(1)
last_debian_package_version = re.search(
r'^Version:\s(.*?)$', output('dpkg-parsechangelog -l%s' % debian_changelog), re.MULTILINE
).group(1)
last_version = last_debian_package_version.split('-')[0]
package['version'] = last_debian_package_version
@ -230,28 +215,32 @@ def prepare_build(dist, project, cmd_options, new):
else:
debian_revision_number = '-1'
if last_version == project['version'] and new \
and "~eob" in last_debian_package_version:
if last_version == project['version'] and new and '~eob' in last_debian_package_version:
new_inc = int(last_debian_package_version.rsplit('+', 1)[-1]) + 1
version_suffix = "%s~eob%s+%s" % (debian_revision_number,
settings.DEBIAN_VERSIONS[dist],
new_inc)
version_suffix = '%s~eob%s+%s' % (debian_revision_number, settings.DEBIAN_VERSIONS[dist], new_inc)
else:
version_suffix = "%s~eob%s+1" % (debian_revision_number,
settings.DEBIAN_VERSIONS[dist])
call("git checkout --quiet %s" % build_branch)
changelog = '\n'.join(changelog_from_git(package['source_name'],
version_suffix, project['git_path'], package['repository'],
epoch=cmd_options.epoch))
version_suffix = '%s~eob%s+1' % (debian_revision_number, settings.DEBIAN_VERSIONS[dist])
call('git checkout --quiet %s' % build_branch)
changelog = '\n'.join(
changelog_from_git(
package['source_name'],
version_suffix,
project['git_path'],
package['repository'],
epoch=cmd_options.epoch,
)
)
if changelog:
if not os.path.isdir(debian_folder):
call("git checkout --quiet %s" % debian_branch)
call('git checkout --quiet %s' % debian_branch)
debian_generated_changelog_filename = debian_changelog + '.generated'
with open(debian_generated_changelog_filename, 'w+') as f:
f.write(changelog)
package['version'] = re.search(r"^Version:\s(.*?)$",
output("dpkg-parsechangelog -l%s" % debian_generated_changelog_filename),
re.MULTILINE).group(1)
package['version'] = re.search(
r'^Version:\s(.*?)$',
output('dpkg-parsechangelog -l%s' % debian_generated_changelog_filename),
re.MULTILINE,
).group(1)
os.unlink(debian_generated_changelog_filename)
else:
# changelog couldn't be generated, this happens with checkouts from
@ -269,146 +258,142 @@ def prepare_build(dist, project, cmd_options, new):
# wrong version number, in that case we add an arbitrary new entry
# to the existing changelog
package['version'] = '%s%s' % (project['version'], version_suffix)
call('dch "Eobuilder version" -v %s --distribution %s \
--force-bad-version --force-distribution --changelog %s' % \
('%s:%s' % (cmd_options.epoch, package['version']) if cmd_options.epoch else package['version'],
package["repository"],
debian_changelog))
call(
'dch "Eobuilder version" -v %s --distribution %s \
--force-bad-version --force-distribution --changelog %s'
% (
'%s:%s' % (cmd_options.epoch, package['version'])
if cmd_options.epoch
else package['version'],
package['repository'],
debian_changelog,
)
)
good_changelog_contents = open(debian_changelog).read()
if cmd_options.hotfix:
version_part = build_branch.split('/', 1)[1].lstrip('v')
if not project['version'].startswith(version_part):
return error("Invalid name for hotfix branch (must start with version number)", exit_code=2)
return error('Invalid name for hotfix branch (must start with version number)', exit_code=2)
build_file = os.path.join(project['lock_path'],
"%s_%s_%s_%s.build" % (project['name'],
package['version'],
package['repository'],
build_branch.replace('/', '_'))
)
build_file = os.path.join(
project['lock_path'],
'%s_%s_%s_%s.build'
% (project['name'], package['version'], package['repository'], build_branch.replace('/', '_')),
)
if os.path.exists(build_file):
print("+ Already built for %s !" % dist)
print('+ Already built for %s !' % dist)
return package
print("+ Preparing Debian build (%s %s) ..." % (package['source_name'], package['version']))
print('+ Preparing Debian build (%s %s) ...' % (package['source_name'], package['version']))
if debian_branch:
call("git checkout --quiet %s" % debian_branch)
call('git checkout --quiet %s' % debian_branch)
os.chdir(project['build_dir'])
project_build_path = os.path.join(project['build_dir'],
"%s-%s" % (project['name'], project['version']))
project_build_path = os.path.join(project['build_dir'], '%s-%s' % (project['name'], project['version']))
shutil.copy(origin_archive, project['build_dir'])
tar = tarfile.open('%s_%s.orig.tar.bz2' % \
(package['source_name'], project['version']),
'r:bz2')
tar = tarfile.open('%s_%s.orig.tar.bz2' % (package['source_name'], project['version']), 'r:bz2')
tar.extractall()
tar.close()
if os.path.exists("%s/debian" % project_build_path):
shutil.rmtree("%s/debian" % project_build_path)
if os.path.exists('%s/debian' % project_build_path):
shutil.rmtree('%s/debian' % project_build_path)
shutil.copytree(os.path.join(project['git_path'], debian_folder),
"%s/debian" % project_build_path)
shutil.copytree(os.path.join(project['git_path'], debian_folder), '%s/debian' % project_build_path)
with open(os.path.join(project_build_path, 'debian', 'changelog'), 'w') as f:
f.write(good_changelog_contents)
return package
def build_project(dist, arch, project, package, new):
pbuilder_project_result = os.path.join(settings.PBUILDER_RESULT,
'%s-%s' % (dist, arch))
project_build_path = os.path.join(project['build_dir'],
"%s-%s" % (project['name'], project['version']))
pbuilder_project_result = os.path.join(settings.PBUILDER_RESULT, '%s-%s' % (dist, arch))
project_build_path = os.path.join(project['build_dir'], '%s-%s' % (project['name'], project['version']))
if not os.path.exists(pbuilder_project_result):
os.makedirs(pbuilder_project_result, 0o755)
os.chdir(project['lock_path'])
source_build = os.path.join(project['lock_path'],
"%s_%s_%s_%s_source.build" % (project['name'],
project['version'],
package['repository'],
project['build_branch'].replace('/', '_'))
)
bin_build = os.path.join(project['lock_path'],
"%s_%s_%s_%s_%s.build" % (project['name'],
package['version'],
package['repository'],
project['build_branch'].replace('/', '_'),
arch)
)
source_build = os.path.join(
project['lock_path'],
'%s_%s_%s_%s_source.build'
% (
project['name'],
project['version'],
package['repository'],
project['build_branch'].replace('/', '_'),
),
)
bin_build = os.path.join(
project['lock_path'],
'%s_%s_%s_%s_%s.build'
% (
project['name'],
package['version'],
package['repository'],
project['build_branch'].replace('/', '_'),
arch,
),
)
print('SOURCE_BUILD:', source_build)
if os.path.exists(source_build):
source_opt = '-b'
else:
source_opt = '-sa'
if new == 0 and os.path.exists(bin_build):
print("+ Already build !")
print('+ Already build !')
return
os.chdir(project_build_path)
print("+ Building %s %s %s %s" % \
(project['name'], project['version'], dist, arch))
call('DIST=%s ARCH=%s pdebuild --use-pdebuild-internal --architecture %s --debbuildopts "%s"' % \
(dist, arch, arch, source_opt))
print('+ Building %s %s %s %s' % (project['name'], project['version'], dist, arch))
call(
'DIST=%s ARCH=%s pdebuild --use-pdebuild-internal --architecture %s --debbuildopts "%s"'
% (dist, arch, arch, source_opt)
)
print("+ Lock build")
print('+ Lock build')
touch(bin_build)
if not os.path.exists(source_build):
touch(source_build)
def send_packages(dist, arch, project, package, last_tag):
stamp_file = os.path.join(project['lock_path'], '%s_%s_%s_%s_%s.upload' % (
project['name'], package['version'],
package['repository'], arch, project['build_branch'].replace('/', '_')))
def send_packages(dist, arch, project, package, last_tag, dput=True):
stamp_file = os.path.join(
project['lock_path'],
'%s_%s_%s_%s_%s.upload'
% (
project['name'],
package['version'],
package['repository'],
arch,
project['build_branch'].replace('/', '_'),
),
)
if os.path.exists(stamp_file):
print('+ Already uploaded')
return
pbuilder_project_result = os.path.join(settings.PBUILDER_RESULT,
'%s-%s' % (dist, arch))
pbuilder_project_result = os.path.join(settings.PBUILDER_RESULT, '%s-%s' % (dist, arch))
print("+ Updating local repository...")
subprocess.check_call('apt-ftparchive packages . | gzip > Packages.gz', cwd=pbuilder_project_result, shell=True)
print('+ Updating local repository...')
subprocess.check_call(
'apt-ftparchive packages . | gzip > Packages.gz', cwd=pbuilder_project_result, shell=True
)
print("+ Sending package...")
os.chdir(pbuilder_project_result)
call("dput -u %s %s_%s_%s.changes" % \
(package['repository'],
package['source_name'],
package['version'].split(':', 1)[-1],
arch)
)
print("+ Updating repository ...")
call('ssh root@%s "/etc/cron.hourly/process-incoming"' % \
settings.REPOSITORY_URL)
old_version = tuple(int(d) for d in last_tag.split('.'))
new_version = tuple(int(d) for d in project['current_tag'].split('.'))
if new_version > old_version and \
project['current_tag'] == project['version']:
print("New tag detected : %s" % project['current_tag'])
if package['source_name'] in settings.MANUAL_TESTING_REPOSITORIES:
package_repos = settings.MANUAL_TESTING_REPOSITORIES[package['source_name']]
else:
package_repos = settings.DEFAULT_TESTING_REPOSITORIES
packages = package['names'] + [package['source_name']]
packages = " ".join(packages)
if dist in package_repos and package['copy_in_testing']:
for repo in package_repos[dist]:
print("+ Copy %s packages to %s repository (%s)" % (package['source_name'], repo, dist))
call('ssh root@%s "/usr/bin/reprepro -b /var/vhosts/deb.entrouvert.org copy %s %s %s"'\
% (settings.REPOSITORY_URL, repo,
package['repository'], packages))
call('ssh root@%s /usr/local/bin/update-deb-repo-html' % \
settings.REPOSITORY_URL)
if dput:
print('+ Sending package...')
os.chdir(pbuilder_project_result)
call(
'dput -u %s %s_%s_%s.changes'
% (package['repository'], package['source_name'], package['version'].split(':', 1)[-1], arch)
)
else:
print('+ Package not sent to repository (--no-dput used).')
return
open(stamp_file, 'w').close()
def clean_git_on_exit(git_project_path):
if not os.path.exists(git_project_path):
return
os.chdir(git_project_path)
call("git stash --quiet")
changelog_tmp = os.path.join(
git_project_path,
"debian", "changelog.git"
)
call('git stash --quiet')
changelog_tmp = os.path.join(git_project_path, 'debian', 'changelog.git')
if os.path.exists(changelog_tmp):
os.remove(changelog_tmp)
@ -428,10 +413,12 @@ def get_git_branch_name(project_reference):
git_project_path = get_git_project_path(project_reference)
for branch_name in ('main', 'master'):
try:
subprocess.check_call(['git', 'rev-parse', branch_name],
stdout=subprocess.DEVNULL,
stderr=subprocess.DEVNULL,
cwd=git_project_path)
subprocess.check_call(
['git', 'rev-parse', branch_name],
stdout=subprocess.DEVNULL,
stderr=subprocess.DEVNULL,
cwd=git_project_path,
)
except subprocess.CalledProcessError:
continue
return branch_name
@ -449,10 +436,8 @@ def setup_git_tree(project_reference, options):
branch_name = options.branch or get_git_branch_name(project_reference)
try:
subprocess.check_call(['git', 'fetch'], cwd=git_project_path)
subprocess.check_call(['git', 'checkout', '--quiet', branch_name],
cwd=git_project_path)
subprocess.check_call(['git', 'reset', '--hard', 'origin/%s' % branch_name],
cwd=git_project_path)
subprocess.check_call(['git', 'checkout', '--quiet', branch_name], cwd=git_project_path)
subprocess.check_call(['git', 'reset', '--hard', 'origin/%s' % branch_name], cwd=git_project_path)
except subprocess.CalledProcessError as e:
print(e, file=sys.stderr)
shutil.rmtree(git_project_path)
@ -461,17 +446,16 @@ def setup_git_tree(project_reference, options):
existing_tree = False
os.chdir(settings.GIT_PATH)
if project_reference.startswith('/'):
call("git clone %s" % project_reference)
call('git clone %s' % project_reference)
else:
parsed = urllib.parse.urlparse(project_reference)
if not parsed.netloc:
project_url = urllib.parse.urljoin(settings.GIT_REPOSITORY_URL, project_reference) + '.git'
else:
project_url = project_reference
call("git clone %s" % project_url)
call('git clone %s' % project_url)
if options.branch:
subprocess.check_call(['git', 'checkout', '--quiet', options.branch],
cwd=git_project_path)
subprocess.check_call(['git', 'checkout', '--quiet', options.branch], cwd=git_project_path)
branch_name = get_git_branch_name(project_reference)
if not options.branch:
@ -505,18 +489,17 @@ def main():
atexit.register(clean_git_on_exit, git_project_path)
if options.branch and options.branch.startswith('origin/'):
# normalize without origin/
options.branch = options.branch[len('origin/'):]
options.branch = options.branch[len('origin/') :]
existing_tree = os.path.exists(git_project_path)
if existing_tree:
os.chdir(git_project_path)
last_tag = output("git describe --abbrev=0 --tags --match=v*",
exit_on_error=False)
last_tag = output('git describe --abbrev=0 --tags --match=v*', exit_on_error=False)
if last_tag:
last_tag = last_tag[1:-1]
else:
last_tag = "0.0"
last_tag = '0.0'
else:
last_tag = "0.0"
last_tag = '0.0'
setup_git_tree(project_reference, options)
project = get_project_infos(git_project_path, options)
@ -525,13 +508,11 @@ def main():
# compare revision between last build and now to determine if something is really new
new = 1
current_revision = output("git rev-parse HEAD", True).strip()
current_revision = output('git rev-parse HEAD', True).strip()
branch_name = get_git_branch_name(project_reference)
last_branch_revision_file_path = os.path.join(
project['lock_path'],
"%s_%s.last_revision" % (
project['name'],
branch_name.replace('/', '_')))
project['lock_path'], '%s_%s.last_revision' % (project['name'], branch_name.replace('/', '_'))
)
try:
with open(last_branch_revision_file_path) as f:
last_branch_revision = f.read().strip()
@ -542,33 +523,36 @@ def main():
new = 0
if options.force and not new:
print("+ Warning force a new build")
print('+ Warning force a new build')
new = 1
for dist in options.distrib:
os.chdir(git_project_path)
call("git checkout --quiet %s" % branch_name)
call('git checkout --quiet %s' % branch_name)
package = prepare_build(dist, project, options, new)
if package:
for arch in options.architectures:
build_project(dist, arch, project, package, new)
if options.dput:
send_packages(dist, arch, project, package, last_tag)
else:
print("+ Package not sent to repository (--no-dput used).")
print("+ Add a build file to lock new build for %s" % dist)
touch(os.path.join(project['lock_path'],
"%s_%s_%s_%s.build" % (project['name'],
package['version'],
package['repository'],
branch_name.replace('/', '_'))
))
send_packages(dist, arch, project, package, last_tag, dput=options.dput)
print('+ Add a build file to lock new build for %s' % dist)
touch(
os.path.join(
project['lock_path'],
'%s_%s_%s_%s.build'
% (
project['name'],
package['version'],
package['repository'],
branch_name.replace('/', '_'),
),
)
)
last_version_file = os.path.join(project['lock_path'],
"%s_%s_%s.last_version" % (project['name'],
package['repository'],
branch_name.replace('/', '_'))
)
last_version_file = os.path.join(
project['lock_path'],
'%s_%s_%s.last_version'
% (project['name'], package['repository'], branch_name.replace('/', '_')),
)
with open(last_version_file, 'w+') as f:
f.write(package['version'])
@ -576,6 +560,6 @@ def main():
with open(last_branch_revision_file_path, 'w+') as f:
f.write(current_revision)
if __name__ == "__main__":
main()
if __name__ == '__main__':
main()

View File

@ -11,4 +11,4 @@ if [ "$(whoami)" != "eobuilder" ]; then
fi
fi
eobuilder-ctl $*
EOBUILDER_SETTINGS_FILE=/etc/eobuilder-settings.py eobuilder-ctl $*

View File

@ -2,8 +2,9 @@ import os
VERSION = '7'
def init():
print("+ Init EO Builder")
print('+ Init EO Builder')
if not os.path.exists(settings.GIT_PATH):
os.makedirs(settings.GIT_PATH, 0o755)
if not os.path.exists(settings.ORIGIN_PATH):

View File

@ -13,6 +13,7 @@ from git.objects.commit import Commit
from . import cmdline
def get_commit_from_tag(repo, tag_ref):
ref = repo.tags[tag_ref]
while ref.object.type == 'tag':
@ -35,11 +36,15 @@ def is_pep0440_project(path):
return False
def changelog_from_git(project, version_suffix, path,
repository='eobuilder',
maintainer_name='eobuilder',
maintainer_email='eobuilder@entrouvert.com',
epoch=''):
def changelog_from_git(
project,
version_suffix,
path,
repository='eobuilder',
maintainer_name='eobuilder',
maintainer_email='eobuilder@entrouvert.com',
epoch='',
):
repo = git.repo.Repo(path)
is_pep0440 = is_pep0440_project(path)
@ -56,20 +61,25 @@ def changelog_from_git(project, version_suffix, path,
versions.append((last_tag, get_commit_from_tag(repo, last_tag)))
while True:
try:
last_tag = repo.git.describe(last_tag+'~', abbrev=0)
last_tag = repo.git.describe(last_tag + '~', abbrev=0)
except GitCommandError:
break
else:
versions.append((last_tag, get_commit_from_tag(repo, last_tag)))
try:
versions.append((last_tag, get_commit_from_tag(repo, last_tag)))
except IndexError:
pass
n = len(versions)
for i in range(n):
name, commit = versions[i]
if i == n-1:
if i == n - 1:
logs = [commit] + list(commit.iter_parents())
else:
def encode_hex(value):
return codecs.encode(value, 'hex').decode('ascii')
reflog = '%s..%s' % (encode_hex(versions[i+1][1].binsha), encode_hex(commit.binsha))
reflog = '%s..%s' % (encode_hex(versions[i + 1][1].binsha), encode_hex(commit.binsha))
logs = list(Commit.iter_items(repo, reflog))
if not logs:
continue
@ -89,15 +99,20 @@ def changelog_from_git(project, version_suffix, path,
except LookupError as e:
t = '(%s) %s' % (l.hexsha[:6], e)
lines = textwrap.wrap(t, 80)
for prefix, suffix in zip([' * '] + [' ']*(len(lines)-1), lines):
for prefix, suffix in zip([' * '] + [' '] * (len(lines) - 1), lines):
yield (prefix + suffix)
paris = pytz.timezone('Europe/Paris')
date = datetime.datetime.fromtimestamp(logs[0].committed_date + logs[0].committer_tz_offset).replace(
tzinfo=pytz.UTC).astimezone(paris).strftime('%a, %d %b %Y %H:%M:%S %z')
date = (
datetime.datetime.fromtimestamp(logs[0].committed_date + logs[0].committer_tz_offset)
.replace(tzinfo=pytz.UTC)
.astimezone(paris)
.strftime('%a, %d %b %Y %H:%M:%S %z')
)
yield ''
yield ' -- %s <%s> %s' % (maintainer_name, maintainer_email, date)
yield ''
if __name__ == '__main__':
project = sys.argv[1]
version_suffix = sys.argv[2]

View File

@ -1,4 +1,3 @@
import os
import shutil
import subprocess
@ -7,127 +6,170 @@ import sys
from optparse import OptionParser
from optparse import Option
class MultipleOption(Option):
ACTIONS = Option.ACTIONS + ("extend",)
STORE_ACTIONS = Option.STORE_ACTIONS + ("extend",)
TYPED_ACTIONS = Option.TYPED_ACTIONS + ("extend",)
ALWAYS_TYPED_ACTIONS = Option.ALWAYS_TYPED_ACTIONS + ("extend",)
ACTIONS = Option.ACTIONS + ('extend',)
STORE_ACTIONS = Option.STORE_ACTIONS + ('extend',)
TYPED_ACTIONS = Option.TYPED_ACTIONS + ('extend',)
ALWAYS_TYPED_ACTIONS = Option.ALWAYS_TYPED_ACTIONS + ('extend',)
def take_action(self, action, dest, opt, value, values, parser):
if action == "extend":
if action == 'extend':
values_list = values.ensure_value(dest, [])
for lvalue in value.split(','):
if not lvalue in values_list:
values_list.append(lvalue)
else:
Option.take_action(
self, action, dest, opt, value, values, parser)
Option.take_action(self, action, dest, opt, value, values, parser)
def parse_cmdline():
parser = OptionParser(option_class=MultipleOption,
usage='usage: %prog [OPTIONS] -d [buster|,stretch|,jessie|,wheezy|,squeeze] GIT_REPOSITORY_NAME')
parser.add_option("-a", "--architectures",
action="extend", type="string",
dest="architectures", metavar='ARCHITECTURES',
default=[],
help="ARCHITECTURES: amd64 and / or i368 (Default: amd64)")
parser.add_option("-d", "--distribution",
action="extend", type="string",
dest="distrib", metavar='DISTRIBUTIONS',
default=[],
help="DISTRIBUTIONS: buster, stretch, jessie, wheezy and / or squeeze")
parser.add_option("-f", "--force", action="store_true",
dest="force", default=False,
help="force a new build")
parser.add_option("-n", "--native", action="store_true",
dest="native", default=False,
help="build native package")
parser.add_option("-b", "--branch",
action="store", type="string",
dest="branch", metavar='NAME',
help="branch to build (Default: main, or master)")
parser.add_option("--epoch",
action="store", type="string",
dest="epoch", metavar='EPOCH',
default="",
help="version number epoch (default: none)")
parser.add_option("-D", "--debian-folder",
action="store", type="string",
dest="debian_folder", metavar='NAME',
default="debian",
help="debian folder to use for build (Default: debian-DIST or debian)")
parser.add_option("-c", "--clean",
action="extend", type="string",
dest="cleaning", metavar='CLEANING_METHODS',
default=[],
help="CLEANING_METHODS: git, deb, archives, smart and / or all")
parser.add_option("--hotfix", action="store_true",
dest="hotfix", default=False,
help="upload to hotfix repository")
parser.add_option("-r", "--repository",
action="extend", type="string",
default=[],
dest="repositories", metavar='DISTRIBUTION:REPOSITORY, DISTRIBUTION:REPOSITORY',
help="DISTRIBUTION:REPOSITORY: strech:stretch-eobuilder, jessie:jessie-eobuilder, wheezy:wheezy-eobuilder")
parser.add_option("--no-dput", dest='dput', action="store_false", default=True,
help='do not send package to repository with dput')
parser = OptionParser(
option_class=MultipleOption,
usage='usage: %prog [OPTIONS] -d [bullseye|,bookworm] GIT_REPOSITORY_NAME',
)
parser.add_option(
'-a',
'--architectures',
action='extend',
type='string',
dest='architectures',
metavar='ARCHITECTURES',
default=[],
help='ARCHITECTURES: amd64',
)
parser.add_option(
'-d',
'--distribution',
action='extend',
type='string',
dest='distrib',
metavar='DISTRIBUTIONS',
default=[],
help='DISTRIBUTIONS: bullseye and/or bookworm',
)
parser.add_option(
'-f', '--force', action='store_true', dest='force', default=False, help='force a new build'
)
parser.add_option(
'-n', '--native', action='store_true', dest='native', default=False, help='build native package'
)
parser.add_option(
'-b',
'--branch',
action='store',
type='string',
dest='branch',
metavar='NAME',
help='branch to build (Default: main, or master)',
)
parser.add_option(
'--epoch',
action='store',
type='string',
dest='epoch',
metavar='EPOCH',
default='',
help='version number epoch (default: none)',
)
parser.add_option(
'-D',
'--debian-folder',
action='store',
type='string',
dest='debian_folder',
metavar='NAME',
default='debian',
help='debian folder to use for build (Default: debian-DIST or debian)',
)
parser.add_option(
'-c',
'--clean',
action='extend',
type='string',
dest='cleaning',
metavar='CLEANING_METHODS',
default=[],
help='CLEANING_METHODS: git, deb, archives, smart and / or all',
)
parser.add_option(
'--hotfix', action='store_true', dest='hotfix', default=False, help='upload to hotfix repository'
)
parser.add_option(
'-r',
'--repository',
action='extend',
type='string',
default=[],
dest='repositories',
metavar='DISTRIBUTION:REPOSITORY, DISTRIBUTION:REPOSITORY',
help='DISTRIBUTION:REPOSITORY: bullseye:bullseye-eobuilder, bookworm:bookworm-eobuilder',
)
parser.add_option(
'--no-dput',
dest='dput',
action='store_false',
default=True,
help='do not send package to repository with dput',
)
(options, args) = parser.parse_args()
if len(args) != 1 and not options.cleaning:
parser.error("you should select one GIT_REPOSITORY_NAME")
parser.error('you should select one GIT_REPOSITORY_NAME')
if len(args) and options.cleaning:
parser.error("you shouldn't use argument when cleaning")
if len(args) and not options.distrib:
options.distrib = ['stretch', 'buster']
options.distrib = ['bullseye']
if options.repositories:
for r in options.repositories:
if not ":" in r:
parser.error("you must enter DISTRIBUTION:REPOSITORY in repository option")
if not ':' in r:
parser.error('you must enter DISTRIBUTION:REPOSITORY in repository option')
if not options.architectures:
options.architectures = ["amd64"]
options.architectures = ['amd64']
return options, args
def cat(file_path):
with open(file_path, 'r') as f:
content = f.read()
return content
def touch(fname):
print('TOUCH:', fname)
with open(fname, 'a'):
os.utime(fname, None)
def error(msg, build_dir=None, exit_code=1):
if build_dir and os.path.exists(build_dir):
shutil.rmtree(build_dir)
sys.stderr.write("ERROR: %s\n" % msg)
sys.stderr.write('ERROR: %s\n' % msg)
sys.exit(exit_code)
def call(cmd):
""" cmd: command line
"""
"""cmd: command line"""
print('CALL:', cmd)
rcode = subprocess.call(cmd, shell=True)
if rcode != 0:
error(cmd)
def output(cmd, print_output=False, exit_on_error=True):
""" cmd: command line
"""cmd: command line
print_output: print stdout and stderr
return outputs (stderr + stdout) as byte string
"""
output = None
try:
output = subprocess.check_output(cmd,
stderr=subprocess.STDOUT,
shell=True)
output = subprocess.check_output(cmd, stderr=subprocess.STDOUT, shell=True)
except subprocess.CalledProcessError as e:
if e.output:
sys.stderr.write(e.output.decode('utf-8'))

View File

@ -2,45 +2,41 @@ import os
BASE_DIR = os.path.dirname(os.path.dirname(__file__))
GIT_PATH = "/var/lib/eobuilder/git"
ORIGIN_PATH = "/var/lib/eobuilder/origin"
LOCK_PATH = "/var/lib/eobuilder/lock"
PBUILDER_RESULT = "/var/lib/eobuilder/results"
EOBUILDER_TMP = "/var/tmp/eobuilder"
REPOSITORY_URL = "deb.entrouvert.org"
GIT_REPOSITORY_URL = "git+ssh://git@repos.entrouvert.org"
GIT_PATH = '/var/lib/eobuilder/git'
ORIGIN_PATH = '/var/lib/eobuilder/origin'
LOCK_PATH = '/var/lib/eobuilder/lock'
PBUILDER_RESULT = '/var/lib/eobuilder/results'
EOBUILDER_TMP = '/var/tmp/eobuilder'
GIT_REPOSITORY_URL = 'git+ssh://git@repos.entrouvert.org'
DEBIAN_VERSIONS = {
"buster": "100",
"stretch": "90",
"jessie": "80",
"wheezy": "70",
"squeeze": "60",
"lenny": "50"
'bookworm': '120',
'bullseye': '110',
'buster': '100',
'stretch': '90',
}
DEFAULT_UNSTABLE_REPOSITORIES = {
"buster" : "buster-eobuilder",
"stretch" : "stretch-eobuilder",
"jessie" : "jessie-eobuilder",
"wheezy" : "wheezy-eobuilder",
"squeeze": "squeeze-eobuilder"
}
'bookworm': 'bookworm-eobuilder',
'bullseye': 'bullseye-eobuilder',
'buster': 'buster-eobuilder',
'stretch': 'stretch-eobuilder',
}
# Paste new tag into repositories
# Automatically add new tag in this repositories
DEFAULT_TESTING_REPOSITORIES = {
"buster": ["buster-testing"],
"stretch": ["stretch-testing"],
"jessie": ["jessie-testing"],
"wheezy": ["wheezy-testing"],
"squeeze": ["squeeze-testing"]
}
'bookworm': ['bookworm-testing'],
'bullseye': ['bullseye-testing'],
'buster': ['buster-testing'],
'stretch': ['stretch-testing'],
}
# Hotfix repositories
HOTFIX_REPOSITORIES = {
"buster": "buster-hotfix",
"stretch": "stretch-hotfix",
"jessie": "jessie-hotfix",
'bookworm': 'bookworm-hotfix',
'bullseye': 'bullseye-hotfix',
'buster': 'buster-hotfix',
'stretch': 'stretch-hotfix',
}
# Specify the testing repository by source package name
@ -53,7 +49,9 @@ MIN_PACKAGE_VERSIONS = 10
MIN_AGE = 60
local_settings_file = os.environ.get('EOBUILDER_SETTINGS_FILE',
os.path.join(os.path.dirname(__file__), 'local_settings.py'))
local_settings_file = os.environ.get(
'EOBUILDER_SETTINGS_FILE', os.path.join(os.path.dirname(__file__), 'local_settings.py')
)
if os.path.exists(local_settings_file):
exec(open(local_settings_file).read())
with open(local_settings_file) as f:
exec(f.read())

View File

@ -1,17 +1,16 @@
# Codenames for Debian suites according to their alias. Update these when
# needed.
UNSTABLE_CODENAME="sid"
TESTING_CODENAME="buster"
STABLE_CODENAME="stretch"
OLDSTABLE_CODENAME="jessie"
OLDOLDSTABLE_CODENAME="wheezy"
TESTING_CODENAME="trixie"
STABLE_CODENAME="bookworm"
OLDSTABLE_CODENAME="bullseye"
STABLE_BACKPORTS_SUITE="$STABLE_CODENAME-backports"
# Use cowbuilder
PDEBUILD_PBUILDER="cowbuilder"
# List of Debian suites.
DEBIAN_SUITES=($UNSTABLE_CODENAME $TESTING_CODENAME $STABLE_CODENAME $OLDSTABLE_CODENAME $OLDOLDSTABLE_CODENAME
DEBIAN_SUITES=($UNSTABLE_CODENAME $TESTING_CODENAME $STABLE_CODENAME $OLDSTABLE_CODENAME
"unstable" "testing" "stable" "oldstable")
# Mirrors to use. Update these to your preferred mirror.
@ -68,7 +67,7 @@ BUILDPLACE="/var/cache/pbuilder/build"
BUILDUSERNAME="eobuilder"
OTHERMIRROR="deb http://$DEBIAN_MIRROR/debian $DIST-backports main | deb http://deb.entrouvert.org/ $DIST-eobuilder main"
OTHERMIRROR="deb http://$DEBIAN_MIRROR/debian $DIST-backports main | deb http://deb.entrouvert.org/ $DIST-eobuilder main | deb http://deb.entrouvert.org/ $DIST main"
if $(echo ${DEBIAN_SUITES[@]} | grep -q $DIST); then
# Debian configuration

View File

@ -21,9 +21,9 @@ class eo_sdist(sdist):
def get_version():
'''Use the VERSION, if absent generates a version with git describe, if not
tag exists, take 0.0- and add the length of the commit log.
'''
"""Use the VERSION, if absent generates a version with git describe, if not
tag exists, take 0.0- and add the length of the commit log.
"""
if os.path.exists('VERSION'):
with open('VERSION', 'r') as v:
return v.read()
@ -47,17 +47,19 @@ def get_version():
return '0.0'
setup(name="eobuilder",
version=get_version(),
license="AGPLv3 or later",
description="Entr'ouvert Package Builder",
author="Entr'ouvert",
author_email="info@entrouvert.org",
maintainer="Jerome Schneider",
maintainer_email="info@entrouvert.com",
install_requires=['pytz', 'GitPython'],
include_package_data=True,
url='https://dev.entrouvert.org/projects/eobuilder',
packages=find_packages(),
scripts=('eobuilder-ctl', 'eobuildall'),
cmdclass={'sdist': eo_sdist})
setup(
name='eobuilder',
version=get_version(),
license='AGPLv3 or later',
description="Entr'ouvert Package Builder",
author="Entr'ouvert",
author_email='info@entrouvert.org',
maintainer='Jerome Schneider',
maintainer_email='info@entrouvert.com',
install_requires=['pytz', 'GitPython'],
include_package_data=True,
url='https://dev.entrouvert.org/projects/eobuilder',
packages=find_packages(),
scripts=('eobuilder-ctl', 'eobuildall'),
cmdclass={'sdist': eo_sdist},
)