Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
docker-images
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
infra
packages
docker-images
Commits
a92812a1
Verified
Commit
a92812a1
authored
Nov 25, 2021
by
nd
Browse files
Options
Downloads
Patches
Plain Diff
move ci ultils to own repo
parent
cb56e870
No related branches found
No related tags found
No related merge requests found
Pipeline
#8585
passed
Nov 25, 2021
Stage: build
Changes
2
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
create_debian-changelog-from-git.py
+0
-104
0 additions, 104 deletions
create_debian-changelog-from-git.py
shared-ci.yml
+0
-9
0 additions, 9 deletions
shared-ci.yml
with
0 additions
and
113 deletions
create_debian-changelog-from-git.py
deleted
100755 → 0
+
0
−
104
View file @
cb56e870
#!/usr/bin/python3
import
sys
import
re
import
textwrap
import
datetime
import
email.utils
import
git
package_name
=
'
UNKNOWN
'
alias_names
=
{
}
ignore_commit_regexes
=
[
'
^fixup!
'
,
]
def
print_release
(
tag
=
None
,
commits
=
tuple
(),
last_tag
=
None
):
release_version
=
'
0.0.0
'
release_author
=
git
.
objects
.
util
.
Actor
(
'
None
'
,
'
undefined@example.com
'
)
release_date
=
0
release_status
=
'
UNRELEASED
'
message
=
''
if
tag
:
release_status
=
'
unstable
'
release_version
=
tag
.
name
[
1
:]
# strip leading "v"
if
isinstance
(
tag
.
object
,
git
.
TagObject
):
release_author
=
tag
.
object
.
tagger
release_date
=
tag
.
object
.
tagged_date
message
=
tag
.
object
.
message
.
split
(
'
-----BEGIN PGP SIGNATURE-----
'
)[
0
].
strip
()
else
:
release_author
=
tag
.
object
.
committer
release_date
=
tag
.
object
.
committed_date
elif
commits
:
release_author
=
commits
[
0
].
committer
release_date
=
commits
[
0
].
committed_date
date
=
datetime
.
datetime
.
fromtimestamp
(
release_date
).
strftime
(
'
%Y%m%dT%H%M%S
'
)
last_version
=
'
0.0.0
'
if
last_tag
:
last_version
=
last_tag
.
name
[
1
:]
# strip leading "v"
release_version
=
f
'
{
last_version
}
+git
{
date
}
-
{
commits
[
0
].
hexsha
[
:
8
]
}
'
print
(
f
'
{
package_name
}
(
{
release_version
}
)
{
release_status
}
; urgency=medium
'
)
print
()
if
message
:
print
(
textwrap
.
indent
(
message
,
'
'
))
print
()
commit_authors
=
[]
# list of (key, author), sorted by first commit date
commit_author_emails
=
{}
# author email -> key
commit_author_names
=
{}
# author name -> key
commit_author_commits
=
{}
# key -> list of commits
for
commit
in
commits
:
if
any
(
filter
(
lambda
pattern
:
re
.
match
(
pattern
,
commit
.
summary
),
ignore_commit_regexes
)):
continue
if
len
(
commit
.
parents
)
>
1
:
continue
# Ignore merge commits
author_name
=
alias_names
.
get
(
commit
.
author
.
name
,
commit
.
author
.
name
)
key
=
commit_author_emails
.
get
(
commit
.
author
.
email
)
if
key
is
None
:
key
=
commit_author_names
.
get
(
author_name
)
if
key
is
None
:
key
=
commit
.
author
.
email
commit_authors
.
append
((
key
,
author_name
))
commit_author_emails
[
commit
.
author
.
email
]
=
key
commit_author_names
[
author_name
]
=
key
commit_author_commits
[
key
]
=
commit_author_commits
.
get
(
key
,
[])
+
[
commit
]
commit_authors
.
sort
(
key
=
lambda
args
:
len
(
commit_author_commits
[
args
[
0
]]))
for
key
,
author_name
in
commit_authors
:
print
(
f
'
[
{
author_name
}
]
'
)
for
commit
in
commit_author_commits
[
key
]:
lines
=
'
\n
'
.
join
(
textwrap
.
wrap
(
commit
.
summary
,
90
))
lines
=
'
*
'
+
textwrap
.
indent
(
lines
,
'
'
).
strip
()
print
(
lines
)
print
()
print
(
f
'
--
{
alias_names
.
get
(
release_author
.
name
,
release_author
.
name
)
}
<
{
release_author
.
email
}
>
{
email
.
utils
.
formatdate
(
release_date
)
}
'
)
if
__name__
==
'
__main__
'
:
repo
=
git
.
Repo
(
'
.
'
)
package_name
=
sys
.
argv
[
1
]
version_commits
=
{}
for
tag
in
repo
.
tags
:
if
not
re
.
fullmatch
(
'
v[0-9]+[.][0-9]+[.][0-9]+.*
'
,
tag
.
name
):
continue
if
isinstance
(
tag
.
object
,
git
.
TagObject
):
commit_hexsha
=
tag
.
object
.
object
.
hexsha
else
:
commit_hexsha
=
tag
.
object
.
hexsha
version_commits
[
commit_hexsha
]
=
tag
tag
=
None
commits
=
[]
for
commit
in
repo
.
iter_commits
(
'
HEAD
'
):
if
commit
.
hexsha
in
version_commits
:
prev_tag
=
version_commits
[
commit
.
hexsha
]
if
commits
:
print_release
(
tag
,
commits
,
last_tag
=
prev_tag
)
print
()
tag
=
prev_tag
commits
=
[]
commits
.
append
(
commit
)
print_release
(
tag
,
commits
)
This diff is collapsed.
Click to expand it.
shared-ci.yml
deleted
100644 → 0
+
0
−
9
View file @
cb56e870
variables
:
DEBIAN_FRONTEND
:
noninteractive
GIT_SUBMODULE_STRATEGY
:
recursive
APT_API_URL
:
https://packages.cccv.de
stages
:
-
build
-
package
-
publish
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment