Re: I need some quirks help for print/lout

2011-09-08 Thread Matthias Kilian
On Thu, Sep 08, 2011 at 10:27:14AM +0100, Stuart Henderson wrote:
> > However, the two @unexec lines in the old pkg/PLIST-main don't get
> > fired during update (because they come too early). Trying to update
> > to the new package fails:
> >
> > Collision in lout-3.39p0->lout-3.39p1: the following files already exist
> > /usr/local/lib/lout/data/fontdefs.li (same checksum)
> 
> >
> > I guess this will need a special quirk to remove those files before
> > the actual update happens. We've something like this for texlive,
> > but my perl-foo is low, so I need some help.
> 
> untested diff below, can you give this a go? filename is generic
> (missingreg.pm) as I need something similar for smokeping (in that
> case, @sample'd files in /var/www need moving to real files in a
> subpackage).

[...]
> diff -u -p -r1.60 Quirks.pm
> --- Quirks.pm 20 Jul 2011 07:59:28 -  1.60
> +++ Quirks.pm 8 Sep 2011 09:23:44 -
> @@ -261,6 +261,10 @@ sub is_base_system
>   my ($self, $handle, $state) = @_;
>  
>   my $stem = OpenBSD::PackageName::splitstem($handle->pkgname);
> + if ($stem =~ m/^lout/) {
> + require OpenBSD::Quirks::missingreg;
> + OpenBSD::Quirks::missingreg::addreg($handle, $state);

Thanks.

With the last line above changed to

OpenBSD::Quirks::lout::addreg($handle, $state);

it works (of course after adding missingreg.pm to do-install and
updating the plist).

The only ugliness (in the case of lout) is that i now get a couple
of messages like

File /usr/local/lib/lout/data/standard.li does not exist

because those files are removed by the @unexec lines in the (old)
plist but now added to the internal plist by the quirk. I don't
know wether it's worth "fixing" this.

Ciao,
Kili



Re: I need some quirks help for print/lout

2011-09-08 Thread Stuart Henderson
In gmane.os.openbsd.ports, Kili wrote:
>
> Hi,
>
> after a run of pkg_check(8), i noticed that print/lout creates some
> files not mentioned in the plist, so I tried to clean it up a little
> bit by running lout -x at fake time instead of using the @exec line
> in pkg/PLLIST-main (the files created by that lout -x llne don't
> contain any paths, and there's indeed no binary diff in the created
> files). See diff below.
>
> However, the two @unexec lines in the old pkg/PLIST-main don't get
> fired during update (because they come too early). Trying to update
> to the new package fails:
>
> Collision in lout-3.39p0->lout-3.39p1: the following files already exist
> /usr/local/lib/lout/data/fontdefs.li (same checksum)

>
> I guess this will need a special quirk to remove those files before
> the actual update happens. We've something like this for texlive,
> but my perl-foo is low, so I need some help.

untested diff below, can you give this a go? filename is generic
(missingreg.pm) as I need something similar for smokeping (in that
case, @sample'd files in /var/www need moving to real files in a
subpackage).

Index: Quirks.pm
===
RCS file: /cvs/ports/devel/quirks/files/Quirks.pm,v
retrieving revision 1.60
diff -u -p -r1.60 Quirks.pm
--- Quirks.pm   20 Jul 2011 07:59:28 -  1.60
+++ Quirks.pm   8 Sep 2011 09:23:44 -
@@ -261,6 +261,10 @@ sub is_base_system
my ($self, $handle, $state) = @_;
 
my $stem = OpenBSD::PackageName::splitstem($handle->pkgname);
+   if ($stem =~ m/^lout/) {
+   require OpenBSD::Quirks::missingreg;
+   OpenBSD::Quirks::missingreg::addreg($handle, $state);
+   }
if ($stem =~ m/^texlive_/) {
require OpenBSD::Quirks::texlive;
OpenBSD::Quirks::texlive::unfuck($handle, $state);
Index: Quirks/missingreg.pm
===
RCS file: Quirks/missingreg.pm
diff -N Quirks/missingreg.pm
--- /dev/null   1 Jan 1970 00:00:00 -
+++ Quirks/missingreg.pm8 Sep 2011 09:23:44 -
@@ -0,0 +1,67 @@
+# ex:ts=8 sw=4:
+# $OpenBSD: texlive.pm,v 1.1 2011/07/12 21:25:39 espie Exp $
+#
+# Copyright (c) 2009 Marc Espie 
+#
+# Permission to use, copy, modify, and distribute this software for any
+# purpose with or without fee is hereby granted, provided that the above
+# copyright notice and this permission notice appear in all copies.
+#
+# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+use strict;
+use warnings;
+
+package OpenBSD::Quirks::lout;
+
+sub quick_add
+{
+   my ($plist, $fullname) = @_;
+
+   return unless -f $fullname;
+   my $fname = $fullname;
+   $fname =~ s,^/usr/local/,,;
+   my $o = OpenBSD::PackingElement::File->new($fname);
+   if (-l $fullname) {
+   $o->{symlink} = readlink($fullname);
+   }
+   # avoid checksumming them
+   $o->{nochecksum} = 1;
+   $o->add_object($plist);
+}
+
+sub addreg
+{
+   my ($handle, $state) = @_;
+   my $pkgname = $handle->pkgname;
+   my $plist = OpenBSD::PackingList->from_installation($pkgname);
+   my $changed = 0;
+
+   if ($pkgname =~ m/^lout-3.30/ ||
+   $pkgname eq "lout-3.39p0" ||
+   $pkgname eq "lout-3.39") {
+
+   # we need to alter its packing-list
+   require File::Find;
+   File::Find::find(
+   sub {
+   return unless -f $_;
+   return unless m/\.(li|lp)$/;
+   # quick and dirty pseudo-reg of generated files
+   quick_add($plist, $File::Find::name);
+   },
+   '/usr/local/lib/lout');
+   $changed = 1;
+   }
+
+   if ($changed) {
+   $plist->to_installation;
+   }
+}
+
+1;



I need some quirks help for print/lout

2011-09-06 Thread Matthias Kilian

Hi,

after a run of pkg_check(8), i noticed that print/lout creates some
files not mentioned in the plist, so I tried to clean it up a little
bit by running lout -x at fake time instead of using the @exec line
in pkg/PLLIST-main (the files created by that lout -x llne don't
contain any paths, and there's indeed no binary diff in the created
files). See diff below.

However, the two @unexec lines in the old pkg/PLIST-main don't get
fired during update (because they come too early). Trying to update
to the new package fails:

Collision in lout-3.39p0->lout-3.39p1: the following files already exist
/usr/local/lib/lout/data/fontdefs.li (same checksum)
/usr/local/lib/lout/data/latin2.li (same checksum)
/usr/local/lib/lout/data/loutrefs.li (same checksum)
/usr/local/lib/lout/data/oldrefs.li (same checksum)
/usr/local/lib/lout/data/refstyle.li (same checksum)
/usr/local/lib/lout/data/standard.li (same checksum)
/usr/local/lib/lout/hyph/croatian.lp (same checksum)
/usr/local/lib/lout/hyph/czech.lp (same checksum)
/usr/local/lib/lout/hyph/danish.lp (same checksum)
/usr/local/lib/lout/hyph/dutch.lp (same checksum)
/usr/local/lib/lout/hyph/english.lp (same checksum)
/usr/local/lib/lout/hyph/engluk.lp (same checksum)
/usr/local/lib/lout/hyph/esperanto.lp (same checksum)
/usr/local/lib/lout/hyph/finnish.lp (same checksum)
/usr/local/lib/lout/hyph/french.lp (same checksum)
/usr/local/lib/lout/hyph/german.lp (same checksum)
/usr/local/lib/lout/hyph/italian.lp (same checksum)
/usr/local/lib/lout/hyph/magyar.lp (same checksum)
/usr/local/lib/lout/hyph/norweg.lp (same checksum)
/usr/local/lib/lout/hyph/polish.lp (same checksum)
/usr/local/lib/lout/hyph/portugal.lp (same checksum)
/usr/local/lib/lout/hyph/programming.lp (same checksum)
/usr/local/lib/lout/hyph/russian.lp (same checksum)
/usr/local/lib/lout/hyph/slovak.lp (same checksum)
/usr/local/lib/lout/hyph/slovenia.lp (same checksum)
/usr/local/lib/lout/hyph/spanish.lp (same checksum)
/usr/local/lib/lout/hyph/swedish.lp (same checksum)
/usr/local/lib/lout/hyph/uppersorbian.lp (same checksum)

I guess this will need a special quirk to remove those files before
the actual update happens. We've something like this for texlive,
but my perl-foo is low, so I need some help.

Ciao,
Kili


Index: Makefile
===
RCS file: /cvs/ports/print/lout/Makefile,v
retrieving revision 1.9
diff -u -p -r1.9 Makefile
--- Makefile11 May 2011 07:45:53 -  1.9
+++ Makefile6 Sep 2011 20:09:11 -
@@ -8,7 +8,7 @@ PKGNAME-main=   ${DISTNAME}
 PKGNAME-doc=${DISTNAME:S/-/-doc-/}
 CATEGORIES=print
 
-REVISION-main= 0
+REVISION-main= 1
 
 HOMEPAGE=  http://savannah.nongnu.org/projects/lout/
 MASTER_SITES=   ${MASTER_SITE_SAVANNAH:=lout/}
@@ -31,5 +31,9 @@ MULTI_PACKAGES=   -doc -main
 
 PKG_ARCH-doc=  *
 WANTLIB-doc=
+
+post-install:
+   env LOUTLIB=${PREFIX}/lib/lout \
+   ${PREFIX}/bin/lout -x -s ${PREFIX}/lib/lout/include/init
 
 .include 
Index: pkg/PLIST-doc
===
RCS file: /cvs/ports/print/lout/pkg/PLIST-doc,v
retrieving revision 1.3
diff -u -p -r1.3 PLIST-doc
--- pkg/PLIST-doc   23 Apr 2011 21:49:27 -  1.3
+++ pkg/PLIST-doc   6 Sep 2011 20:09:11 -
@@ -124,6 +124,7 @@ share/doc/lout/slides/outfile.ps
 share/doc/lout/user/
 @comment share/doc/lout/user/.pie_intr.swp
 share/doc/lout/user/README
+@comment share/doc/lout/user/README.orig
 share/doc/lout/user/all
 share/doc/lout/user/ap_byp
 share/doc/lout/user/ap_col
Index: pkg/PLIST-main
===
RCS file: /cvs/ports/print/lout/pkg/PLIST-main,v
retrieving revision 1.3
diff -u -p -r1.3 PLIST-main
--- pkg/PLIST-main  11 May 2011 07:45:53 -  1.3
+++ pkg/PLIST-main  6 Sep 2011 20:09:11 -
@@ -1,7 +1,5 @@
 @comment $OpenBSD: PLIST-main,v 1.3 2011/05/11 07:45:53 ajacoutot Exp $
 @pkgpath print/lout
-@unexec rm -rf %D/lib/lout/data/*.li
-@unexec rm -rf %D/lib/lout/hyph/*.lp
 @bin bin/lout
 @bin bin/prg2lout
 lib/lout/
@@ -10,11 +8,17 @@ lib/lout/data/README
 lib/lout/data/fcvt
 lib/lout/data/fcvt.awk
 lib/lout/data/fontdefs.ld
+lib/lout/data/fontdefs.li
 lib/lout/data/latin2.ld
+lib/lout/data/latin2.li
 lib/lout/data/loutrefs.ld
+lib/lout/data/loutrefs.li
 lib/lout/data/oldrefs.ld
+lib/lout/data/oldrefs.li
 lib/lout/data/refstyle.ld
+lib/lout/data/refstyle.li
 lib/lout/data/standard.ld
+lib/lout/data/standard.li
 lib/lout/font/
 lib/lout/font/00README
 lib/lout/font/AG-Bd
@@ -180,27 +184,49 @@ lib/lout/font/ZD
 lib/lout/hyph/
 lib/lout/hyph/README
 lib/lout/hyph/croatian.lh
+lib/lout/hyph/croatian.lp
 lib/lout/hyph/czech.lh
+lib/lout/hyph/czech.lp
 lib/lout/hyph