3 # LFS ChangeLog generator for trivial package addition, removal, and update
5 from subprocess
import Popen
, PIPE
6 from urllib
.request
import urlopen
11 if not line
.startswith("<!ENTITY "):
13 quote_pos
= line
.find(' "')
14 key
= line
[len("<!ENTITY "):quote_pos
]
15 value
= line
[quote_pos
+ 2:]
16 value
= value
[:value
.find('"')]
19 def expand_entity(ent
, key
):
29 out
+= expand_entity(ent
, sub_ent
[1:-1])
35 git_diff
= Popen(["git", "diff", "-U999999", "packages.ent"],
38 stdout
, _
= git_diff
.communicate()
40 lines
= stdout
.rstrip().split("\n")
41 ent
= [get_entity(i
) for i
in lines
if i
[0] != '-']
42 ent
= dict(i
for i
in ent
if i
)
52 if key
.endswith('-md5'):
53 pkg
= key
[:-len('-md5')]
59 upd
= add
.intersection(rem
)
60 add
= add
.symmetric_difference(upd
)
61 rem
= rem
.symmetric_difference(upd
)
65 url
= 'https://wiki.linuxfromscratch.org/lfs/report/1?format=tab'
68 fields
= i
.decode().split('\t')
70 pkg
= fields
[1].lower()
75 if len(fields
) >= 3 and fields
[2].startswith("high"):
79 hold_ticket
= {'vim': '4500', 'iana-etc': '5006'}
82 for (s
, act
) in [(upd
, "Update to "), (add
, "Add ")]:
84 pkgver
= i
+ "-" + expand_entity(ent
, i
+ "-version")
87 out
+= ' (#' + ticket
[pkgver
] + ')'
88 elif i
in hold_ticket
:
89 out
+= ' (#' + hold_ticket
[i
] + ')'
92 print("-", "Remove", i
)
94 print("---------------------")
98 for (s
, act
) in [(upd
, "Update to "), (add
, "Add ")]:
101 pkgver
= i
+ "-" + expand_entity(ent
, i
+ "-version")
102 out
= ' <para>[' + name
+ '] - ' + act
+ pkgver
103 if pkgver
in security
:
104 out
+= " (security fix)"
110 pkg_ticket
= ticket
[pkgver
]
111 elif i
in hold_ticket
:
112 out
+= " Addresses\n "
113 pkg_ticket
= hold_ticket
[i
]
116 out
+= "<ulink url='&lfs-ticket-root;" + pkg_ticket
+ "'>#"
117 out
+= pkg_ticket
+ "</ulink>."
120 print(' </listitem>')