Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
linux
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
linux
Commits
22bc9b9b
Commit
22bc9b9b
authored
Feb 05, 2016
by
Andy Whitcroft
Committed by
Tim Gardner
Feb 29, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
UBUNTU: [Debian] git-ubuntu-log -- switch to bug order
Signed-off-by:
Andy Whitcroft
<
apw@canonical.com
>
parent
4f6ea34b
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
91 additions
and
233 deletions
+91
-233
debian/rules.d/1-maintainer.mk
debian/rules.d/1-maintainer.mk
+1
-1
debian/scripts/misc/git-ubuntu-log
debian/scripts/misc/git-ubuntu-log
+90
-232
No files found.
debian/rules.d/1-maintainer.mk
View file @
22bc9b9b
...
@@ -99,7 +99,7 @@ printchanges:
...
@@ -99,7 +99,7 @@ printchanges:
@
baseCommit
=
$$
(
git log
--pretty
=
format:
'%H %s'
|
\
@
baseCommit
=
$$
(
git log
--pretty
=
format:
'%H %s'
|
\
gawk
'/UBUNTU: '
".*Ubuntu-
`
echo
$(prev_fullver)
|
sed
's/+/\\\\+/'
`
"
'$$/ { print $$1; exit }'
)
;
\
gawk
'/UBUNTU: '
".*Ubuntu-
`
echo
$(prev_fullver)
|
sed
's/+/\\\\+/'
`
"
'$$/ { print $$1; exit }'
)
;
\
git log
"
$$
baseCommit"
..HEAD |
\
git log
"
$$
baseCommit"
..HEAD |
\
perl
-w
-f
$(DROOT)
/scripts/misc/git-ubuntu-log
$(ubuntu_log_opts)
$(DROOT)
/scripts/misc/git-ubuntu-log
$(ubuntu_log_opts)
insertchanges
:
insertchanges
:
@
perl
-w
-f
$(DROOT)
/scripts/misc/insert-changes.pl
$(DROOT)
$(DEBIAN)
@
perl
-w
-f
$(DROOT)
/scripts/misc/insert-changes.pl
$(DROOT)
$(DEBIAN)
...
...
debian/scripts/misc/git-ubuntu-log
View file @
22bc9b9b
#!/usr/bin/perl -w
#!/usr/bin/python3
use
strict
;
import
os
use
Text::
Wrap
;
import
sys
my
$kernel_auth
=
"
Upstream Kernel Changes
";
import
urllib.request
import
json
my
(
%
map
,
@reverts
);
my
$pstate
=
1
;
# Suck up the git log output and extract the information we need.
my
$no_kern_log
=
0
;
bugs
=
[]
my
$print_shas
=
0
;
entries
=
[]
my
$first_print
=
1
;
entry
=
None
subject_wait
=
False
while
(
@ARGV
)
{
for
line
in
sys
.
stdin
:
my
$opt
=
$ARGV
[
0
];
if
line
.
startswith
(
'commit '
):
shift
;
if
entry
and
'ignore'
not
in
entry
:
if
(
$opt
eq
"
--no-kern-log
")
{
entries
.
append
(
entry
)
$no_kern_log
=
1
;
entry
=
{}
}
elsif
(
$opt
eq
"
--print-shas
")
{
subject_wait
=
True
$print_shas
=
1
;
}
else
{
elif
line
.
startswith
(
'Author: '
):
print
STDERR
"
Unknown options:
$opt
\n
";
bits
=
line
.
strip
().
split
(
maxsplit
=
1
)
exit
(
1
);
entry
[
'author'
]
=
bits
[
1
]
}
}
elif
subject_wait
and
line
.
startswith
(
' '
):
subject_wait
=
False
sub
check_reverts
($)
{
entry
[
'subject'
]
=
line
.
strip
()
my
(
$entry
)
=
@_
;
my
(
$check
);
elif
line
.
startswith
(
' BugLink: '
)
and
'launchpad.net'
in
line
:
bits
=
line
.
strip
().
split
(
maxsplit
=
1
)
foreach
$check
(
reverse
@reverts
)
{
bits
=
bits
[
1
].
split
(
'/'
)
my
$desc
=
"
Revert
\"
"
.
$entry
->
{'
desc
'}
.
"
\"
";
entry
.
setdefault
(
'bugs'
,
[]).
append
(
bits
[
-
1
])
if
(
$check
->
{'
desc
'}
eq
$desc
)
{
@reverts
=
grep
(
$_
->
{'
desc
'}
ne
$desc
,
@reverts
);
# Accumulate bug numbers.
return
1
;
if
bits
[
-
1
]
not
in
bugs
:
}
bugs
.
append
(
bits
[
-
1
])
}
elif
line
.
startswith
(
' Ignore:'
):
return
0
;
entry
[
'ignore'
]
=
True
}
sub
add_entry
($)
{
entries
.
reverse
()
my
(
$entry
)
=
@_
;
my
$key
=
$entry
->
{'
author
'};
# Go through the entries and clear out authors for upstream commits.
for
entry
in
entries
:
# store description in array, in email->{desc list} map
if
entry
[
'subject'
].
startswith
(
'UBUNTU:'
):
if
(
exists
$map
{
$key
})
{
entry
[
'subject'
]
=
entry
[
'subject'
][
7
:].
strip
()
# grab ref
else
:
my
$obj
=
$map
{
$key
};
del
entry
[
'author'
]
# add desc to array
# Lump everything without a bug at the bottom.
push
(
@$obj
,
$entry
);
bugs
.
append
(
'__packaging__'
)
}
else
{
bugs
.
append
(
'__mainline__'
)
# create new array, containing 1 item
my
@arr
=
(
$entry
);
first
=
True
for
bug
in
bugs
:
# store ref to array
if
not
first
:
$map
{
$key
}
=
\
@arr
;
print
(
''
)
}
first
=
False
}
if
bug
==
'__packaging__'
:
sub
shortlog_entry
($$$$$)
{
title
=
'Miscellaneous Ubuntu changes'
my
(
$name
,
$desc
,
$bug
,
$cve
,
$commit
)
=
@_
;
elif
bug
==
'__mainline__'
:
my
$entry
;
title
=
'Miscellaneous upstream changes'
else
:
$desc
=~
s#/pub/scm/linux/kernel/git/#/.../#g
;
bug_info
=
None
$desc
=~
s#\[PATCH\] ##g
;
#urllib.request.urlcleanup()
$desc
=~
s#^\s*##g
;
request
=
urllib
.
request
.
Request
(
'https://api.launchpad.net/devel/bugs/'
+
bug
)
$desc
=~
s# *UBUNTU: ##g
;
request
.
add_header
(
'Cache-Control'
,
'max-age=0'
)
with
urllib
.
request
.
urlopen
(
request
)
as
response
:
$entry
->
{'
desc
'}
=
$desc
;
data
=
response
.
read
()
if
(
$bug
ne
'')
{
bug_info
=
json
.
loads
(
data
.
decode
(
'utf-8'
))
$entry
->
{'
bugno
'}
=
$bug
;
}
title
=
bug_info
[
'title'
]
$entry
->
{'
cve
'}
=
$cve
;
if
'description'
in
bug_info
:
$entry
->
{'
commit
'}
=
$commit
;
for
line
in
bug_info
[
'description'
].
split
(
'
\
n
'
):
$entry
->
{'
author
'}
=
$name
;
if
line
.
startswith
(
'Kernel-Description:'
):
title
=
line
.
split
(
' '
,
1
)[
1
]
if
(
$desc
=~
/^Revert "/
)
{
push
(
@reverts
,
$entry
);
title
+=
' (LP: #'
+
bug
+
')'
return
;
}
print
(
' * '
+
title
)
return
if
check_reverts
(
$entry
);
for
entry
in
entries
:
if
(
bug
==
'__packaging__'
and
'bugs'
not
in
entry
and
'author'
in
entry
)
or
\
add_entry
(
$entry
);
(
bug
==
'__mainline__'
and
'bugs'
not
in
entry
and
'author'
not
in
entry
)
or
\
}
(
'bugs'
in
entry
and
bug
in
entry
[
'bugs'
]):
print
(
' - '
+
entry
[
'subject'
])
# sort comparison function
sub
by_name
($$)
{
my
(
$a
,
$b
)
=
@_
;
uc
(
$a
)
cmp
uc
(
$b
);
}
sub
shortlog_output
{
my
(
$obj
,
$key
,
$entry
);
foreach
$key
(
sort
by_name
keys
%
map
)
{
next
if
$key
eq
$kernel_auth
and
$no_kern_log
;
print
"
\n
"
unless
$first_print
;
$first_print
=
0
;
# output author
printf
"
[ %s ]
\n\n
",
$key
;
# output author's 1-line summaries
$obj
=
$map
{
$key
};
foreach
$entry
(
reverse
@$obj
)
{
print
wrap
("
*
",
"
",
$entry
->
{'
desc
'})
.
"
\n
";
# For non upstream changes, add other info.
if
(
$key
ne
$kernel_auth
)
{
if
(
$print_shas
)
{
print
"
- GIT-SHA
"
.
$entry
->
{'
commit
'}
.
"
\n
";
}
}
if
(
defined
(
$entry
->
{'
bugno
'}))
{
print
"
- LP: #
"
.
$entry
->
{'
bugno
'}
.
"
\n
";
}
if
(
defined
(
$entry
->
{'
cve
'}))
{
print
"
-
"
.
$entry
->
{'
cve
'}
.
"
\n
";
}
}
}
}
sub
changelog_input
{
my
(
$author
,
$desc
,
$commit
,
$entry
,
$cve
);
while
(
<
STDIN
>
)
{
# get commit
if
(
$pstate
==
1
)
{
next
unless
/^commit (.*)/
;
$commit
=
$1
;
$pstate
++
;
}
# get author and email
elsif
(
$pstate
==
2
)
{
my
(
$email
);
next
unless
/^[Aa]uthor:?\s*(.*?)\s*<(.*)>/
;
$author
=
$1
;
$email
=
$2
;
$desc
=
undef
;
$cve
=
undef
;
# cset author fixups
if
(
!
$author
)
{
$author
=
$email
;
}
$pstate
++
;
}
# skip to blank line
elsif
(
$pstate
==
3
)
{
next
unless
/^\s*$/
;
$pstate
++
;
}
# skip to non-blank line
elsif
(
$pstate
==
4
)
{
next
unless
/^\s*?(.*)/
;
my
$ignore
=
0
;
my
$do_ignore
=
0
;
my
$bug
=
undef
;
my
%
bugz
=
();
my
$k
;
# skip lines that are obviously not
# a 1-line cset description
next
if
/^\s*From: /
;
chomp
;
$desc
=
$1
;
if
(
$desc
=~
/^ *(Revert "|)UBUNTU:/
)
{
$do_ignore
=
1
;
}
else
{
$do_ignore
=
0
;
$author
=
$kernel_auth
;
$ignore
=
1
if
$desc
=~
/Merge /
;
}
while
(
<
STDIN
>
)
{
$ignore
=
1
if
(
$do_ignore
&&
/^ *Ignore: yes/i
);
if
(
/^ *Bug: *(#|)([0-9#,\s]*)\s*$/i
)
{
foreach
$k
(
split
('
(,|
\
s)
\
s*(#|)
',
$2
))
{
$bugz
{
$k
}
=
1
if
((
$k
ne
'')
and
(
$k
=~
/[0-9]+/
));
}
}
elsif
(
/^ *BugLink: *http.*:\/\/.*\/([0-9]+)/i
)
{
$bugz
{
$1
}
=
1
;
}
elsif
(
/^ *(CVE-.*)/
)
{
$cve
=
$1
}
last
if
/^commit /
;
}
$bug
=
join
("
, #
",
sort
keys
(
%
bugz
));
if
(
!
$ignore
)
{
&
shortlog_entry
(
$author
,
$desc
,
$bug
,
$cve
,
$commit
,
0
);
}
$pstate
=
1
;
if
(
$_
&&
/^commit (.*)/
)
{
$commit
=
$1
;
$pstate
++
;
}
}
else
{
die
"
invalid parse state
$pstate
";
}
}
foreach
$entry
(
@reverts
)
{
add_entry
(
$entry
);
}
}
&
changelog_input
;
&
shortlog_output
;
exit
(
0
);
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment