All of lore.kernel.org
 help / color / mirror / Atom feed
* [opkg-utils PATCH] opkg.py: Remove reformatting of description field
@ 2017-10-05 14:05 Jeffrey Pautler
  2017-10-06 17:14 ` [opkg-devel] " Alejandro del Castillo
  0 siblings, 1 reply; 2+ messages in thread
From: Jeffrey Pautler @ 2017-10-05 14:05 UTC (permalink / raw)
  To: opkg-devel, yocto

[-- Attachment #1: Type: text/plain, Size: 2197 bytes --]

The Debian Policy Manual describes the format of the description field.
This includes information about how lines might be wrapped by programs
displaying this information, how to mark lines to not be wrapped, how
to mark a line as blank, and how leading spaces on a multi-line
description might be deleted.

By reformatting the description field in opkg.py, we are breaking many
of these behaviors and taking control of formatting away from the
author of the control file. Instead, we should simply copy the
description field with no reformatting.

Signed-off-by: Jeffrey Pautler <jeffrey.pautler@ni.com>
---
opkg.py | 8 ++------
1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/opkg.py b/opkg.py
index 9131755..c0cdcd5 100644
--- a/opkg.py
+++ b/opkg.py
@@ -230,7 +230,7 @@ class Package(object):
                 name = lineparts.group(1).lower()
                 value = lineparts.group(2)
                 while 1:
-                    line = control.readline()
+                    line = control.readline().rstrip()
                     if not line: break
                     if line[0] != ' ': break
                     value = value + '\n' + line
@@ -480,11 +480,7 @@ class Package(object):
         if self.installed_size: out = out + "InstalledSize: %d\n" % int(self.installed_size)
         if self.filename: out = out + "Filename: %s\n" % (self.filename)
         if self.source: out = out + "Source: %s\n" % (self.source)
-        if self.description:
-            printable_description = textwrap.dedent(self.description).strip()
-            summary = printable_description.split('\n', 1)[0]
-            printable_description = printable_description.split('\n', 1)[-1].strip()
-            out = out + "Description: %s\n%s\n" % (summary, textwrap.fill(printable_description, width=74, initial_indent=' ', subsequent_indent=' '))
+        if self.description: out = out + "Description: %s\n" % (self.description)
         if self.oe: out = out + "OE: %s\n" % (self.oe)
         if self.homepage: out = out + "HomePage: %s\n" % (self.homepage)
         if self.license: out = out + "License: %s\n" % (self.license)
--
2.7.4

[-- Attachment #2: Type: text/html, Size: 10141 bytes --]

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [opkg-devel] [opkg-utils PATCH] opkg.py: Remove reformatting of description field
  2017-10-05 14:05 [opkg-utils PATCH] opkg.py: Remove reformatting of description field Jeffrey Pautler
@ 2017-10-06 17:14 ` Alejandro del Castillo
  0 siblings, 0 replies; 2+ messages in thread
From: Alejandro del Castillo @ 2017-10-06 17:14 UTC (permalink / raw)
  To: opkg-devel, Jeffrey Pautler, yocto

Agreed, opkg-make-index spould not be formatting control files. 
Description should be treated as any other field.

merged

On 10/05/2017 09:05 AM, Jeffrey Pautler wrote:
> The Debian Policy Manual describes the format of the description field.
> 
> This includes information about how lines might be wrapped by programs
> 
> displaying this information, how to mark lines to not be wrapped, how
> 
> to mark a line as blank, and how leading spaces on a multi-line
> 
> description might be deleted.
> 
> By reformatting the description field in opkg.py, we are breaking many
> 
> of these behaviors and taking control of formatting away from the
> 
> author of the control file. Instead, we should simply copy the
> 
> description field with no reformatting.
> 
> Signed-off-by: Jeffrey Pautler <jeffrey.pautler@ni.com>
> 
> ---
> 
> opkg.py | 8 ++------
> 
> 1 file changed, 2 insertions(+), 6 deletions(-)
> 
> diff --git a/opkg.py b/opkg.py
> 
> index 9131755..c0cdcd5 100644
> 
> --- a/opkg.py
> 
> +++ b/opkg.py
> 
> @@ -230,7 +230,7 @@ class Package(object):
> 
>                   name = lineparts.group(1).lower()
> 
>                   value = lineparts.group(2)
> 
>                   while 1:
> 
> -                    line = control.readline()
> 
> +                    line = control.readline().rstrip()
> 
>                       if not line: break
> 
>                       if line[0] != ' ': break
> 
>                       value = value + '\n' + line
> 
> @@ -480,11 +480,7 @@ class Package(object):
> 
>           if self.installed_size: out = out + "InstalledSize: %d\n" % 
> int(self.installed_size)
> 
>           if self.filename: out = out + "Filename: %s\n" % (self.filename)
> 
>           if self.source: out = out + "Source: %s\n" % (self.source)
> 
> -        if self.description:
> 
> -            printable_description = 
> textwrap.dedent(self.description).strip()
> 
> -            summary = printable_description.split('\n', 1)[0]
> 
> -            printable_description = printable_description.split('\n', 
> 1)[-1].strip()
> 
> -            out = out + "Description: %s\n%s\n" % (summary, 
> textwrap.fill(printable_description, width=74, initial_indent=' ', 
> subsequent_indent=' '))
> 
> +        if self.description: out = out + "Description: %s\n" % 
> (self.description)
> 
>           if self.oe: out = out + "OE: %s\n" % (self.oe)
> 
>           if self.homepage: out = out + "HomePage: %s\n" % (self.homepage)
> 
>           if self.license: out = out + "License: %s\n" % (self.license)
> 
> -- 
> 
> 2.7.4
> 
> -- 
> You received this message because you are subscribed to the Google 
> Groups "opkg-devel" group.
> To unsubscribe from this group and stop receiving emails from it, send 
> an email to opkg-devel+unsubscribe@googlegroups.com 
> <mailto:opkg-devel+unsubscribe@googlegroups.com>.
> For more options, visit https://groups.google.com/d/optout 
> <https://urldefense.proofpoint.com/v2/url?u=https-3A__groups.google.com_d_optout&d=DwMFaQ&c=I_0YwoKy7z5LMTVdyO6YCiE2uzI1jjZZuIPelcSjixA&r=wNcrL2akRn6jfxhHaKavUrJB_C9JAMXtynjLd8ZzgXQ&m=SjrJd3411AwLD4Dn6cj5fJxIrZ4Fet4b54t4bmitpWM&s=boq46c76IPvFqTwi4dlGOI7VtCn4aV7kqsCa_BXdMI0&e=>.

-- 
Cheers,

Alejandro


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2017-10-06 17:30 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-10-05 14:05 [opkg-utils PATCH] opkg.py: Remove reformatting of description field Jeffrey Pautler
2017-10-06 17:14 ` [opkg-devel] " Alejandro del Castillo

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.