Ticket #39018: dpkg_1.18.3.patch

File dpkg_1.18.3.patch, 21.2 KB (added by xeron (Ivan Larionov), 8 years ago)
  • sysutils/dpkg/Portfile

    diff --git a/sysutils/dpkg/Portfile b/sysutils/dpkg/Portfile
    index c6f72ca..dd47dc7 100644
    a b  
    1 # $Id: Portfile 105815 2013-05-06 14:52:20Z landonf@macports.org $
    2 
    3 PortSystem 1.0
    4 
    5 name                    dpkg
    6 version                 1.14.29
    7 revision                4
    8 platforms               darwin freebsd
    9 categories              sysutils archivers
    10 license                 GPL-2+
    11 maintainers             nomaintainer
    12 description             Debian package maintenance system
    13 long_description ${description}
    14 homepage                http://wiki.debian.org/Teams/Dpkg
    15 
    16 master_sites    debian:d/dpkg/
    17 checksums               md5 4326172a959b5b6484b4bc126e9f628d \
    18                         sha1 15a35dd96dac6a99f24844b2eff85f8fad37ab06
     1# -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:ft=tcl:et:sw=4:ts=4:sts=4
     2# $Id$
     3
     4PortSystem          1.0
     5PortGroup           perl5 1.0
     6
     7name                dpkg
     8version             1.18.3
     9platforms           darwin
     10categories          sysutils archivers
     11license             GPL-2+
     12maintainers         gwmail.gwu.edu:egall openmaintainer
     13description         Debian package maintenance system
     14long_description    ${name} is the basis of the ${description}.
     15
     16homepage            http://wiki.debian.org/Teams/Dpkg
     17master_sites        debian:d/${name}/
     18distname            ${name}_${version}
     19worksrcdir          ${name}-${version}
     20
     21use_xz              yes
     22extract.asroot      yes
     23
     24checksums           rmd160  baffcdf3bb72ad535d6aacbcee88202488e4612a \
     25                    sha256  a40ffe38d7f36d858a752189a306433cfc52c7d15d7b98f61d9f9dd49e0e4807
     26
     27depends_build-append \
     28                    port:pkgconfig \
     29                    port:flex \
     30                    port:gnutar \
     31                    port:perl${perl5.major} \
     32                    bin:lzma:xz
    1933
    2034# Use MacPorts versions explicitly
    21 depends_lib             port:gettext \
    22                         port:libiconv \
    23                         port:perl5 \
    24                         port:coreutils \
    25                         port:bzip2 \
    26                         port:zlib
    27 
    28 depends_run             bin:gnutar:gnutar \
    29                         bin:lzma:xz
    30 
    31 
    32 distname                ${name}_${version}
    33 worksrcdir              ${name}-${version}
    34 
    35 patchfiles              patch-lib_tarfn.c \
    36                         patch-main_remove.c \
    37                         patch-main_archives.c \
    38                         patch-scripts-Makefile \
    39                         patch-lib_dpkg.h \
    40                         ncurses.diff
    41 
    42 configure.env           PERL=${prefix}/bin/perl5
    43 configure.args          --without-sgml-doc --with-libintl-prefix=${prefix} \
    44                         --with-libiconv-prefix=${prefix} --with-admindir=${prefix}/var/db/dpkg \
    45                         --mandir=${prefix}/share/man \
    46                         --with-zlib --with-bz2 \
    47                         --disable-linker-optimisations
    48 
    49 build.type              gnu
    50 
    51 set vardpkg ${destroot}${prefix}/var/db/dpkg
    52 destroot.keepdirs ${vardpkg} ${vardpkg}/updates ${vardpkg}/info
    53 
    54 post-patch {
    55         set scripts ${worksrcpath}/scripts
    56         reinplace s|/etc/dpkg/|${prefix}/etc/dpkg/| \
    57                         ${scripts}/dpkg-shlibdeps.pl \
    58                         ${scripts}/dpkg-source.pl
    59 
    60         reinplace s|/etc/alternatives|${prefix}/etc/alternatives|g \
    61                         ${scripts}/update-alternatives.pl
    62 }
     35depends_lib-append  port:gettext \
     36                    port:libiconv \
     37                    port:perl${perl5.major} \
     38                    port:coreutils \
     39                    port:bzip2 \
     40                    port:gzip \
     41                    port:zlib \
     42                    port:ncurses \
     43                    port:gnutar \
     44                    path:lib/pkgconfig/liblzma.pc:xz
     45
     46depends_run-append  port:gnutar \
     47                    port:gzip \
     48                    port:debianutils \
     49                    bin:perl5:perl${perl5.major} \
     50                    bin:lzma:xz
     51
     52configure.perl      ${prefix}/bin/perl5
     53configure.pkg_config ${prefix}/bin/pkg-config
     54configure.env-append TAR=${prefix}/bin/gnutar
     55configure.args-append \
     56                    --with-libintl-prefix=${prefix} \
     57                    --with-libiconv-prefix=${prefix} \
     58                    --with-admindir=${prefix}/var/db/${name} \
     59                    --with-logdir=${prefix}/var/log \
     60                    --mandir=${prefix}/share/man \
     61                    --with-zlib \
     62                    --with-bz2 \
     63                    --with-liblzma \
     64                    --disable-linker-optimisations \
     65                    --disable-silent-rules \
     66                    --disable-start-stop-daemon
     67
     68compiler.blacklist-append cc gcc-3.3 gcc-4.0 apple-gcc-4.0
     69
     70build.type          gnu
     71
     72set vardpkg ${destroot}${prefix}/var/db/${name}
     73destroot.keepdirs-append \
     74                    ${vardpkg} \
     75                    ${vardpkg}/updates \
     76                    ${vardpkg}/info \
     77                    ${destroot}${prefix}/var/log \
     78                    ${destroot}${prefix}/etc/${name}
     79
     80patchfiles-append   patch-scripts_Dpkg_Source_Archive.pm.diff
     81
     82use_autoreconf      yes
     83autoreconf.args     -fvi --warnings=all
    6384
    6485pre-destroot {
    65         file mkdir ${destroot}${prefix}/share/doc/dpkg
     86    file mkdir ${destroot}${prefix}/share/doc/${name}
    6687}
    6788
    6889post-destroot {
    69         file mkdir ${vardpkg}
    70         file mkdir ${vardpkg}/updates
    71         file mkdir ${vardpkg}/info
    72         system "touch ${vardpkg}/available ${vardpkg}/status"
     90    file mkdir ${vardpkg}
     91    file mkdir ${vardpkg}/updates
     92    file mkdir ${vardpkg}/info
     93    system "touch ${vardpkg}/available ${vardpkg}/status"
    7394}
    7495
    75 platform darwin {
    76         depends_build-append    bin:gnumake:gmake
    77         patchfiles-append patch-utils_start-stop-daemon.c bsd/patch-main_help.c
     96# This variant sometimes hangs while building...
     97variant docs description "Build documentation (warning: building documentation takes a long time)" {
     98    depends_build-append    port:doxygen \
     99                            path:bin/dot:graphviz \
     100                            port:fontconfig \
     101                            port:freefont-ttf
     102    set docdir ${prefix}/share/doc/${name}
     103    configure.args-append   --docdir=${docdir} \
     104                            --htmldir=${docdir}/html \
     105                            --dvidir=${docdir}/dvi \
     106                            --pdfdir=${docdir}/pdf \
     107                            --psdir=${docdir}/ps
     108    build.target-append     doc
     109    pre-build {
     110        elevateToRoot "doxygen"
     111        system -W ${worksrcpath}/doc "${prefix}/bin/doxygen -u"
     112    }
     113    post-build {
     114        system -W ${worksrcpath}/doc "${prefix}/bin/doxygen"
     115        dropPrivileges
     116        set destroot_docdir ${destroot}${prefix}/share/doc/${name}
     117        xinstall -d ${destroot_docdir}
     118        copy ${worksrcpath}/doc/doc ${destroot_docdir}
     119        copy ${worksrcpath}/doc/html ${destroot_docdir}
     120        foreach docfile {coding-style.txt triggers.txt README.feature-removal-schedule frontend.txt README.api} {
     121            xinstall -m 644 ${worksrcpath}/doc/${docfile} ${destroot_docdir}
     122        }
     123    }
    78124}
    79125
    80 platform freebsd {
    81         depends_build-append    bin:gmake:gmake
    82         patchfiles-append patch-utils_start-stop-daemon.c bsd/patch-main_help.c
     126# Tests currently fail, this needs to be fixed eventually:
     127test.run            yes
     128test.target         check
     129
     130pre-test {
     131    elevateToRoot "test"
     132}
     133post-test {
     134    dropPrivileges
    83135}
    84136
    85 livecheck.type          regex
    86 livecheck.url           http://ftp.debian.org/debian/pool/main/d/dpkg/
    87 livecheck.regex         "${name}_(\\d+\\.\\d+(\\.\\d+)*)"
     137livecheck.type      regex
     138livecheck.url       http://ftp.debian.org/debian/pool/main/d/${name}/
     139livecheck.regex     "${name}_(\\d+\\.\\d+(\\.\\d+)*)"
  • deleted file sysutils/dpkg/files/bsd/patch-main_help.c

    diff --git a/sysutils/dpkg/files/bsd/patch-main_help.c b/sysutils/dpkg/files/bsd/patch-main_help.c
    deleted file mode 100644
    index e4f4b89..0000000
    + -  
    1 --- src/help.c.old      Thu Dec  9 16:35:16 2004
    2 +++ src/help.c  Thu Dec  9 16:35:38 2004
    3 @@ -77,12 +77,11 @@
    4  
    5  void checkpath(void) {
    6  /* Verify that some programs can be found in the PATH. */
    7 -  static const char *const checklist[]= { "ldconfig",
    8 +  static const char *const checklist[]= {
    9  #if WITH_START_STOP_DAEMON
    10      "start-stop-daemon",
    11  #endif   
    12      "install-info",
    13 -    "update-rc.d",
    14      NULL
    15    };
    16  
  • deleted file sysutils/dpkg/files/ncurses.diff

    diff --git a/sysutils/dpkg/files/ncurses.diff b/sysutils/dpkg/files/ncurses.diff
    deleted file mode 100644
    index 4e49161..0000000
    + -  
    1 --- dselect/Makefile.in.orig    2010-03-09 07:32:20.000000000 +1100
    2 +++ dselect/Makefile.in 2011-03-11 12:01:25.000000000 +1100
    3 @@ -640,7 +640,7 @@
    4  
    5  curkeys.$(OBJEXT): curkeys.h
    6  curkeys.h: $(srcdir)/keyoverride $(srcdir)/mkcurkeys.pl
    7 -       cursesfile=`echo '#include <ncursesw/curses.h>' | \
    8 +       cursesfile=`echo '#include <curses.h>' | \
    9                 $(CC) -E - | grep 'curses.h' | head -n 1 | \
    10                 sed -e 's/^[^"]*"//; s/".*$$//'`; \
    11         if [ "$$cursesfile" = "" ]; then \
    12 --- dselect/dselect.h.orig      2010-03-09 07:27:35.000000000 +1100
    13 +++ dselect/dselect.h   2011-03-11 12:01:43.000000000 +1100
    14 @@ -28,7 +28,7 @@
    15  
    16  #include <signal.h>
    17  #undef ERR
    18 -#include <ncursesw/curses.h>
    19 +#include <curses.h>
    20  
    21  struct helpmenuentry {
    22    char key;
    23 --- dselect/main.cc.orig        2010-03-09 07:27:35.000000000 +1100
    24 +++ dselect/main.cc     2011-03-11 12:01:36.000000000 +1100
    25 @@ -37,7 +37,7 @@ extern "C" {
    26  #include <ctype.h>
    27  #include <assert.h>
    28  
    29 -#include <ncursesw/term.h>
    30 +#include <term.h>
    31  
    32  extern "C" {
    33  #include <dpkg.h>
  • deleted file sysutils/dpkg/files/patch-lib_dpkg.h

    diff --git a/sysutils/dpkg/files/patch-lib_dpkg.h b/sysutils/dpkg/files/patch-lib_dpkg.h
    deleted file mode 100644
    index f683a0c..0000000
    + -  
    1 --- ./lib/dpkg.h.orig   2010-03-08 21:27:35.000000000 +0100
    2 +++ ./lib/dpkg.h        2011-04-07 09:51:21.000000000 +0200
    3 @@ -147,7 +147,7 @@
    4  #define DPKG           "dpkg"
    5  #define DEBSIGVERIFY   "/usr/bin/debsig-verify"
    6  
    7 -#define TAR            "tar"
    8 +#define TAR            "gnutar"
    9  #define GZIP           "gzip"
    10  #define BZIP2          "bzip2"
    11  #define LZMA           "lzma"
  • deleted file sysutils/dpkg/files/patch-lib_tarfn.c

    diff --git a/sysutils/dpkg/files/patch-lib_tarfn.c b/sysutils/dpkg/files/patch-lib_tarfn.c
    deleted file mode 100644
    index 1365bb8..0000000
    + -  
    1 --- lib/tarfn.c.orig    Wed Jan 26 18:31:15 2005
    2 +++ lib/tarfn.c Wed Jan 26 19:26:19 2005
    3 @@ -18,6 +18,9 @@
    4  
    5  #include "strnlen.h"
    6  
    7 +static const char ustarMagic[] = { 'u', 's', 't', 'a', 'r', '\0', '0', '0', '\0' };
    8 +static const char gnutarMagic[] = { 'u', 's', 't', 'a', 'r', ' ', ' ', '\0' };
    9 +
    10  struct TarHeader {
    11         char Name[100];
    12         char Mode[8];
    13 @@ -28,11 +31,12 @@
    14         char Checksum[8];
    15         char LinkFlag;
    16         char LinkName[100];
    17 -       char MagicNumber[8];
    18 +       char MagicNumber[8]; /* POSIX: "ustar\000", GNU: "ustar  \0" (blank blank null) */
    19         char UserName[32];
    20         char GroupName[32];
    21         char MajorDevice[8];
    22         char MinorDevice[8];
    23 +       char Prefix[155]; /* POSIX ustar header */
    24  };
    25  typedef struct TarHeader       TarHeader;
    26  
    27 @@ -78,6 +82,10 @@
    28         struct passwd *         passwd = NULL;
    29         struct group *          group = NULL;
    30         unsigned int            i;
    31 +       char                    *prefix, *name, *file;
    32 +       size_t                  prefixLen;
    33 +       size_t                  nameLen;
    34 +       size_t                  fileLen;
    35         long                    sum;
    36         long                    checksum;
    37  
    38 @@ -86,7 +94,35 @@
    39         if ( *h->GroupName )
    40                 group = getgrnam(h->GroupName);
    41  
    42 -       d->Name = StoC(h->Name, sizeof(h->Name));
    43 +       /*
    44 +        * Is this a ustar archive entry?
    45 +        * Is Prefix in use?
    46 +        */
    47 +       if ((memcmp(h->MagicNumber, ustarMagic, sizeof(h->MagicNumber)) == 0) &&  h->Prefix[0]) {
    48 +               prefixLen = strnlen(h->Prefix, sizeof(h->Prefix));
    49 +
    50 +               prefix = StoC(h->Prefix, prefixLen);
    51 +               if (h->Prefix[prefixLen - 1] != '/') {
    52 +                       prefixLen++; /* Space for '/' */
    53 +                        /* The rest of the code doesn't care if malloc fails, so we won't either */
    54 +                       prefix = realloc(prefix, prefixLen + 1); /* prefix + \0 */
    55 +                       prefix[prefixLen - 1] = '/';
    56 +                       prefix[prefixLen] = '\0';
    57 +               }
    58 +
    59 +               nameLen = strnlen(h->Name, sizeof(h->Name));
    60 +               name = StoC(h->Name, nameLen);
    61 +
    62 +               file = realloc(prefix, prefixLen + nameLen + 1); /* prefix + name + \0 */
    63 +               strcat(file, name);
    64 +
    65 +               free(name);
    66 +
    67 +               d->Name = file;
    68 +       } else {
    69 +               d->Name = StoC(h->Name, sizeof(h->Name));
    70 +       }
    71 +
    72         d->LinkName = StoC(h->LinkName, sizeof(h->LinkName));
    73         d->Mode = (mode_t)OtoL(h->Mode, sizeof(h->Mode));
    74         d->Size = (size_t)OtoL(h->Size, sizeof(h->Size));
  • deleted file sysutils/dpkg/files/patch-main_archives.c

    diff --git a/sysutils/dpkg/files/patch-main_archives.c b/sysutils/dpkg/files/patch-main_archives.c
    deleted file mode 100644
    index 35dbe56..0000000
    + -  
    1 --- src/archives.c.orig Thu Nov 11 20:10:03 2004
    2 +++ src/archives.c      Fri Dec 17 17:34:55 2004
    3 @@ -373,6 +373,7 @@
    4    static struct varbuf conffderefn, hardlinkfn, symlinkfn;
    5    static int fd;
    6    const char *usename;
    7 +  char *s = NULL;
    8  
    9    struct conffile *conff;
    10    struct tarcontext *tc= (struct tarcontext*)ti->UserData;
    11 @@ -423,7 +424,15 @@
    12      }
    13    }
    14  
    15 -  usename= namenodetouse(nifd->namenode,tc->pkg)->name + 1; /* Skip the leading `/' */
    16 +  usename= namenodetouse(nifd->namenode,tc->pkg)->name; /* Skip the leading `/' */
    17 +  if (*usename == '.' && *usename + 1 == '/') {
    18 +       usename += 1; /* Skip the leading `.' */
    19 +  } else if (*usename != '/') {
    20 +       s = malloc(strlen(usename) + 2); /* 1 for NULL, one for `/' we're going to add */
    21 +       strcpy(s + 1, usename);
    22 +       *s = '/';
    23 +       usename = s;
    24 +  }
    25  
    26    if (nifd->namenode->flags & fnnf_new_conff) {
    27      /* If it's a conffile we have to extract it next to the installed
    28 @@ -435,6 +444,10 @@
    29    }
    30    
    31    setupfnamevbs(usename);
    32 +
    33 +  if (s != NULL) {
    34 +       free(s);
    35 +  }
    36  
    37    statr= lstat(fnamevb.buf,&stab);
    38    if (statr) {
  • deleted file sysutils/dpkg/files/patch-main_remove.c

    diff --git a/sysutils/dpkg/files/patch-main_remove.c b/sysutils/dpkg/files/patch-main_remove.c
    deleted file mode 100644
    index d9fe787..0000000
    + -  
    1 --- src/remove.c.orig   Fri Dec 10 15:48:16 2004
    2 +++ src/remove.c        Fri Dec 10 15:51:29 2004
    3 @@ -266,7 +266,18 @@
    4          push_leftover(&leftover,namenode);
    5          continue;
    6        }
    7 -      if (errno != ENOTDIR) ohshite(_("cannot remove `%.250s'"),fnvb.buf);
    8 +      if (errno != ENOTDIR) {
    9 +       /* XXX Hack:
    10 +        * dpkg includes /. in the packing list.
    11 +        * rmdir("/.") will return EINVAL. dpkg will
    12 +        * only attempt to remove /. when uninstalling
    13 +        * the last package on the system, which is why
    14 +        * Debian has never run into this issue. */
    15 +       if (errno == EINVAL && strcmp(fnvb.buf, "/.") == 0)
    16 +             continue;
    17 +       else
    18 +             ohshite(_("cannot remove `%.250s'"),fnvb.buf);
    19 +      }
    20        debug(dbg_eachfiledetail, "removal_bulk unlinking `%s'", fnvb.buf);
    21        {
    22          /*
    23 @@ -383,7 +394,18 @@
    24        push_leftover(&leftover,namenode);
    25        continue;
    26      }
    27 -    if (errno != ENOTDIR) ohshite(_("cannot remove `%.250s'"),fnvb.buf);
    28 +    if (errno != ENOTDIR) {
    29 +       /* XXX Hack:
    30 +        * dpkg includes /. in the packing list.
    31 +        * rmdir("/.") will return EINVAL. dpkg will
    32 +        * only attempt to remove /. when uninstalling
    33 +        * the last package on the system, which is why
    34 +        * Debian has never run into this issue. */
    35 +       if (errno == EINVAL && strcmp(fnvb.buf, "/.") == 0)
    36 +             continue;
    37 +       else
    38 +             ohshite(_("cannot remove `%.250s'"),fnvb.buf);
    39 +    }
    40  
    41      push_leftover(&leftover,namenode);
    42      continue;
  • deleted file sysutils/dpkg/files/patch-scripts-Makefile

    diff --git a/sysutils/dpkg/files/patch-scripts-Makefile b/sysutils/dpkg/files/patch-scripts-Makefile
    deleted file mode 100644
    index 823c12a..0000000
    + -  
    1 --- scripts/Makefile.am.orig    2010-03-08 21:27:35.000000000 +0100
    2 +++ scripts/Makefile.am 2011-01-03 10:15:37.000000000 +0100
    3 @@ -123,7 +123,7 @@ nobase_dist_perllib_DATA = \
    4         Dpkg/Source/Patch.pm \
    5         Dpkg.pm
    6  
    7 -do_perl_subst = sed -e "s:^\#![:space:]*/usr/bin/perl:\#!$(PERL):" \
    8 +do_perl_subst = sed -e "s:^\#![[:space:]]*/usr/bin/perl:\#!$(PERL):" \
    9                     -e "s:\$$dpkglibdir[[:space:]]*=[[:space:]]*['\"][^'\"]*['\"]:\$$dpkglibdir=\"$(pkglibdir)\":" \
    10                     -e "s:\$$pkgdatadir[[:space:]]*=[[:space:]]*['\"][^'\"]*['\"]:\$$pkgdatadir=\"$(pkgdatadir)\":" \
    11                     -e "s:\$$admindir[[:space:]]*=[[:space:]]*['\"][^'\"]*['\"]:\$$admindir=\"$(admindir)\":" \
    12 --- scripts/Makefile.in.orig    2010-03-08 21:32:20.000000000 +0100
    13 +++ scripts/Makefile.in 2011-01-03 10:15:50.000000000 +0100
    14 @@ -330,7 +330,7 @@ nobase_dist_perllib_DATA = \
    15         Dpkg/Source/Patch.pm \
    16         Dpkg.pm
    17  
    18 -do_perl_subst = sed -e "s:^\#![:space:]*/usr/bin/perl:\#!$(PERL):" \
    19 +do_perl_subst = sed -e "s:^\#![[:space:]]*/usr/bin/perl:\#!$(PERL):" \
    20                     -e "s:\$$dpkglibdir[[:space:]]*=[[:space:]]*['\"][^'\"]*['\"]:\$$dpkglibdir=\"$(pkglibdir)\":" \
    21                     -e "s:\$$pkgdatadir[[:space:]]*=[[:space:]]*['\"][^'\"]*['\"]:\$$pkgdatadir=\"$(pkgdatadir)\":" \
    22                     -e "s:\$$admindir[[:space:]]*=[[:space:]]*['\"][^'\"]*['\"]:\$$admindir=\"$(admindir)\":" \
  • new file sysutils/dpkg/files/patch-scripts_Dpkg_Source_Archive.pm.diff

    diff --git a/sysutils/dpkg/files/patch-scripts_Dpkg_Source_Archive.pm.diff b/sysutils/dpkg/files/patch-scripts_Dpkg_Source_Archive.pm.diff
    new file mode 100644
    index 0000000..b6d391d
    - +  
     1--- scripts/Dpkg/Source/Archive.pm.orig 2015-11-19 21:10:57.000000000 -0800
     2+++ scripts/Dpkg/Source/Archive.pm      2015-11-19 21:18:41.000000000 -0800
     3@@ -48,7 +48,7 @@
     4     $spawn_opts{from_pipe} = \*$self->{tar_input};
     5     # Call tar creation process
     6     $spawn_opts{delete_env} = [ 'TAR_OPTIONS' ];
     7-    $spawn_opts{exec} = [ 'tar', '-cf', '-', '--format=gnu', '--null',
     8+    $spawn_opts{exec} = [ 'gnutar', '-cf', '-', '--format=gnu', '--null',
     9                           '--numeric-owner', '--owner=0', '--group=0',
     10                           @{$opts{options}}, '-T', '-' ];
     11     *$self->{pid} = spawn(%spawn_opts);
     12@@ -90,7 +90,7 @@
     13     my $self = shift;
     14 
     15     close(*$self->{tar_input}) or syserr(g_('close on tar input'));
     16-    wait_child(*$self->{pid}, cmdline => 'tar -cf -');
     17+    wait_child(*$self->{pid}, cmdline => 'gnutar -cf -');
     18     delete *$self->{pid};
     19     delete *$self->{tar_input};
     20     delete *$self->{cwd};
     21@@ -126,7 +126,7 @@
     22 
     23     # Call tar extraction process
     24     $spawn_opts{delete_env} = [ 'TAR_OPTIONS' ];
     25-    $spawn_opts{exec} = [ 'tar', '-xf', '-', '--no-same-permissions',
     26+    $spawn_opts{exec} = [ 'gnutar', '-xf', '-', '--no-same-permissions',
     27                           '--no-same-owner', @{$opts{options}} ];
     28     spawn(%spawn_opts);
     29     $self->close();
  • deleted file sysutils/dpkg/files/patch-utils_start-stop-daemon.c

    diff --git a/sysutils/dpkg/files/patch-utils_start-stop-daemon.c b/sysutils/dpkg/files/patch-utils_start-stop-daemon.c
    deleted file mode 100644
    index 608cb53..0000000
    + -  
    1 --- utils/start-stop-daemon.c.orig      Thu Nov 11 12:10:04 2004
    2 +++ utils/start-stop-daemon.c   Mon Dec 13 16:02:18 2004
    3 @@ -38,6 +38,8 @@
    4  #  define OSFreeBSD
    5  #elif defined(__NetBSD__)
    6  #  define OSNetBSD
    7 +#elif defined(__APPLE__)
    8 +#  define OSDarwin
    9  #else
    10  #  error Unknown architecture - cannot build start-stop-daemon
    11  #endif
    12 @@ -49,7 +51,8 @@
    13  #include <ps.h>
    14  #endif
    15  
    16 -#if defined(OSOpenBSD) || defined(OSFreeBSD) || defined(OSNetBSD)
    17 +#if defined(OSOpenBSD) || defined(OSFreeBSD) || defined(OSNetBSD) || defined(OSDarwin)
    18 +#include <sys/time.h>
    19  #include <sys/param.h>
    20  #include <sys/proc.h>
    21  #include <sys/stat.h>
    22 @@ -804,7 +807,7 @@
    23  #if defined(OSLinux) || defined(OShpux)
    24         if (execname && !pid_is_exec(pid, &exec_stat))
    25                 return;
    26 -#elif defined(OSHURD) || defined(OSFreeBSD) || defined(OSNetBSD)
    27 +#elif defined(OSHURD) || defined(OSFreeBSD) || defined(OSNetBSD) || defined(OSDarwin)
    28         /* Let's try this to see if it works */
    29         if (execname && !pid_is_cmd(pid, execname))
    30                 return;
    31 @@ -882,6 +882,7 @@
    32  }
    33  #endif /* OSHURD */
    34  
    35 +#if defined(OSOpenBSD) || defined(OSFreeBSD) || defined(OSNetBSD)
    36  #ifdef HAVE_KVM_H
    37  static int
    38  pid_is_cmd(pid_t pid, const char *name)
    39 @@ -974,6 +975,7 @@
    40  {
    41         /* Nothing to do */
    42  }
    43 +#endif
    44  #endif /* OSOpenBSD */
    45  
    46  #if defined(OShpux)
    47 @@ -975,6 +954,80 @@
    48         /* Nothing to do */
    49  }
    50  #endif /* OSOpenBSD */
    51 +
    52 +#if defined(OSDarwin)
    53 +#include <sys/sysctl.h>
    54 +int
    55 +pid_is_user(pid_t pid, uid_t uid)
    56 +{
    57 +       int mib[4];
    58 +       size_t size;
    59 +       struct kinfo_proc ki;
    60 +
    61 +       size = sizeof(ki);
    62 +       mib[0] = CTL_KERN;
    63 +       mib[1] = KERN_PROC;
    64 +       mib[2] = KERN_PROC_PID;
    65 +       mib[3] = pid;
    66 +       if (sysctl(mib, 4, &ki, &size, NULL, 0) < 0)
    67 +               errx(1, "%s", "Failure calling sysctl");
    68 +       return (uid == ki.kp_eproc.e_pcred.p_ruid);
    69 +}
    70 +
    71 +static int
    72 +pid_is_cmd(pid_t pid, const char *name)
    73 +{
    74 +       int mib[4];
    75 +       size_t size;
    76 +       struct kinfo_proc ki;
    77 +
    78 +       size = sizeof(ki);
    79 +       mib[0] = CTL_KERN;
    80 +       mib[1] = KERN_PROC;
    81 +       mib[2] = KERN_PROC_PID;
    82 +       mib[3] = pid;
    83 +       if (sysctl(mib, 4, &ki, &size, NULL, 0) < 0)
    84 +               errx(1, "%s", "Failure calling sysctl");
    85 +       return (!strncmp(name, ki.kp_proc.p_comm, MAXCOMLEN));
    86 +}
    87 +
    88 +static void
    89 +do_procinit(void)
    90 +{
    91 +       int mib[3];
    92 +       size_t size;
    93 +       int nprocs, ret, i;
    94 +       struct kinfo_proc *procs = NULL, *newprocs;
    95 +       
    96 +       mib[0] = CTL_KERN;
    97 +       mib[1] = KERN_PROC;
    98 +       mib[2] = KERN_PROC_ALL;
    99 +       ret = sysctl(mib, 3, NULL, &size, NULL, 0);
    100 +       /* Allocate enough memory for entire process table */
    101 +       do {
    102 +               size += size / 10;
    103 +               newprocs = realloc(procs, size);
    104 +               if (newprocs == NULL) {
    105 +                       if (procs)
    106 +                               free(procs);
    107 +                       errx(1, "%s", "Could not reallocate memory");
    108 +               }
    109 +               procs = newprocs;
    110 +               ret = sysctl(mib, 3, procs, &size, NULL, 0);
    111 +       } while (ret >= 0 && errno == ENOMEM);
    112 +
    113 +       if (ret < 0)
    114 +               errx(1, "%s", "Failure calling sysctl");
    115 +
    116 +       /* Verify size of proc structure */
    117 +       if (size % sizeof(struct kinfo_proc) != 0)
    118 +               errx(1, "%s", "proc size mismatch, userland out of sync with kernel");
    119 +       nprocs = size / sizeof(struct kinfo_proc);
    120 +       for (i = 0; i < nprocs; i++) {
    121 +               check(procs[i].kp_proc.p_pid);
    122 +       }
    123 +}
    124 +#endif /* OSDarwin */
    125  
    126  #if defined(OShpux)
    127  static int