diff mbox series

[v2] sepolicy/manpage.py: make output deterministic

Message ID 20231025131903.12044-1-cahu@suse.de (mailing list archive)
State Accepted
Commit 84e0884260c5
Delegated to: Petr Lautrbach
Headers show
Series [v2] sepolicy/manpage.py: make output deterministic | expand

Commit Message

Cathy Hu Oct. 25, 2023, 1:18 p.m. UTC
The list entries in the alphabetically grouped dict are
not sorted, which results in non-deterministic output for
index.html.

Sort entries of those lists to make the output deterministic
to be able to have reproducible builds.

See https://reproducible-builds.org/ for reasoning.
This patch was done while working on reproducible builds for openSUSE.

Signed-off-by: Cathy Hu <cahu@suse.de>
---
 python/sepolicy/sepolicy/manpage.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Petr Lautrbach Oct. 31, 2023, 10:11 a.m. UTC | #1
Cathy Hu <cahu@suse.de> writes:

> The list entries in the alphabetically grouped dict are
> not sorted, which results in non-deterministic output for
> index.html.
>
> Sort entries of those lists to make the output deterministic
> to be able to have reproducible builds.
>
> See https://reproducible-builds.org/ for reasoning.
> This patch was done while working on reproducible builds for openSUSE.
>
> Signed-off-by: Cathy Hu <cahu@suse.de>

Acked-by: Petr Lautrbach <lautrbach@redhat.com>

> ---
>  python/sepolicy/sepolicy/manpage.py | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/python/sepolicy/sepolicy/manpage.py b/python/sepolicy/sepolicy/manpage.py
> index a488dcbf..62999019 100755
> --- a/python/sepolicy/sepolicy/manpage.py
> +++ b/python/sepolicy/sepolicy/manpage.py
> @@ -156,7 +156,7 @@ def get_alphabet_manpages(manpage_list):
>              if j.split("/")[-1][0] == i:
>                  temp.append(j.split("/")[-1])
>  
> -        alphabet_manpages[i] = temp
> +        alphabet_manpages[i] = sorted(temp)
>  
>      return alphabet_manpages
>  
> -- 
> 2.42.0
James Carter Nov. 7, 2023, 9:39 p.m. UTC | #2
On Tue, Oct 31, 2023 at 6:12 AM Petr Lautrbach <lautrbach@redhat.com> wrote:
>
> Cathy Hu <cahu@suse.de> writes:
>
> > The list entries in the alphabetically grouped dict are
> > not sorted, which results in non-deterministic output for
> > index.html.
> >
> > Sort entries of those lists to make the output deterministic
> > to be able to have reproducible builds.
> >
> > See https://reproducible-builds.org/ for reasoning.
> > This patch was done while working on reproducible builds for openSUSE.
> >
> > Signed-off-by: Cathy Hu <cahu@suse.de>
>
> Acked-by: Petr Lautrbach <lautrbach@redhat.com>
>

Merged.
Thanks,
Jim

> > ---
> >  python/sepolicy/sepolicy/manpage.py | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/python/sepolicy/sepolicy/manpage.py b/python/sepolicy/sepolicy/manpage.py
> > index a488dcbf..62999019 100755
> > --- a/python/sepolicy/sepolicy/manpage.py
> > +++ b/python/sepolicy/sepolicy/manpage.py
> > @@ -156,7 +156,7 @@ def get_alphabet_manpages(manpage_list):
> >              if j.split("/")[-1][0] == i:
> >                  temp.append(j.split("/")[-1])
> >
> > -        alphabet_manpages[i] = temp
> > +        alphabet_manpages[i] = sorted(temp)
> >
> >      return alphabet_manpages
> >
> > --
> > 2.42.0
>
diff mbox series

Patch

diff --git a/python/sepolicy/sepolicy/manpage.py b/python/sepolicy/sepolicy/manpage.py
index a488dcbf..62999019 100755
--- a/python/sepolicy/sepolicy/manpage.py
+++ b/python/sepolicy/sepolicy/manpage.py
@@ -156,7 +156,7 @@  def get_alphabet_manpages(manpage_list):
             if j.split("/")[-1][0] == i:
                 temp.append(j.split("/")[-1])
 
-        alphabet_manpages[i] = temp
+        alphabet_manpages[i] = sorted(temp)
 
     return alphabet_manpages