Request 255 was acted upon.
_________________________________________________________________________

         URL: https://rt.openpkg.org/id/255
      Ticket: [OpenPKG #255]
     Subject: [apt] patches for compatibility with openpkg >= 20030913
  Requestors: [EMAIL PROTECTED]
       Queue: openpkg
       Owner: Nobody
      Status: new
 Transaction: Ticket created by [EMAIL PROTECTED]
        Time: Mon Sep 15 01:16:26 2003
_________________________________________________________________________

Hi,

It seems that the re-ordering of the libraries listed by "rpm-config --libs" 
in versions >= 20030913 of the bootstrap package cause troubles when
compiling apt.

Specifically, when compiling on Solaris some symbols from /cw/lib/librpmpopt.a
are not found by the linker. This is despite the fact that -lrpmpopt is
specified in the linking command.

I have made a couple of tweaks to configure.in to cope with this fact. 
Basically, in places where I sloppily inserted the complete output of
"rpm-config --libs" before, I've just replaced the "standard" library name
with the name as bundled in OpenPKG (e.g., 's/-lz/-lrpmz/').

I have tested these under both Sun and FreeBSD, and the linker on each
platform is able to deal with the ordering I've set up.

I'm attaching updated versions of apt.spec and apt.patch. I would have 
included these as patches rather than full files, but somehow the notion
of sending a patch to a patch was a little too recursive for me to think 
about...

--Matt

----
Matt Hoosier
CIS Accounts Manager
Kansas State University
<[EMAIL PROTECTED]>

##
##  apt.spec -- OpenPKG RPM Specification
##  Copyright (c) 2000-2003 The OpenPKG Project <http://www.openpkg.org/>
##  Copyright (c) 2000-2003 Ralf S. Engelschall <[EMAIL PROTECTED]>
##  Copyright (c) 2000-2003 Cable & Wireless <http://www.cw.com/>
##
##  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.
##
##  THIS SOFTWARE IS PROVIDED AS IS'' AND ANY EXPRESSED OR IMPLIED
##  WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
##  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
##  IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
##  CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
##  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
##  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
##  USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
##  ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
##  OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
##  OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
##  SUCH DAMAGE.
##

#   package information
Name:         apt
Summary:      Advanced Packaging Tool
URL:          https://moin.conectiva.com.br/AptRpm
Vendor:       Jason Gunthorpe et al.
Packager:     The OpenPKG Project
Distribution: OpenPKG [EVAL]
Group:        Bootstrapping
License:      GPL
Version:      0.5.5cnc6
Release:      20030914

#   list of sources
Source0:      
http://moin.conectiva.com.br/files/AptRpm/attachments/apt-%{version}.tar.bz2
Source1:      apt.conf
Source2:      rpmpriorities
Patch0:       apt.patch
Patch1:       apt.patch.porting

#   build information
Prefix:       %{l_prefix}
BuildRoot:    %{l_buildroot}
BuildPreReq:  OpenPKG, openpkg >= 20030913, make, gcc, autoconf
PreReq:       OpenPKG, openpkg >= 20030913
AutoReq:      no
AutoReqProv:  no

%description
    This is Connectiva's port of the Debian's Advanced Packaging Tool
    (APT), running on top of the OpenPKG RPM packaging infrastructure.
    APT is an advanced package management utility front-end which allows
    you to easily perform package installation, upgrading and removal.
    Dependencies are automatically handled.

%prep
    %setup -q
    %patch0 -p0

    #   platform specific patching
    l_rpmlibs="-lrpmpopt"
    case "%{l_platform -t}" in
        *sunos* )
            %patch1 -p0
            l_rpmlibs=" -lsocket"
            ;;
    esac

    #   replace hard-coded paths with OpenPKG ones
    find . ! -type d |     xargs %{l_shtool} subst         %{l_value -s l_prefix}      
   -e 's;@l_bindir@;%{l_prefix}/bin;g'         -e 's;@name@;apt;g'         -e 
"s;@dbpath@;%{_dbpath};g"         -e "s;@rpmlibs@;;g"         -e "s;@l_rpmlibs@;;g"

    #   regenerate GNU autoconf based files
    %{l_prefix}/bin/autoconf

%build
    #   configure package
    CC="%{l_cc}"     CPPFLAGS="%{l_cppflags} "     CFLAGS="%{l_cflags} "     
LDFLAGS="%{l_ldflags} "     ./configure         --prefix=%{l_prefix}         
--localstatedir=%{l_prefix}/var/apt         --disable-shared         --enable-static   
      --disable-nls         --disable-docs

    #   disable localization stuff
    %{l_shtool} subst         -e 's;^POFILES =.*$;POFILES =;g'         -e 's;^GMOFILES 
=.*$;GMOFILES =;g'         -e 's;^DUMMYPOFILES =.*$;DUMMYPOFILES =;g'         -e 
's;^CATALOGS =.*$;CATALOGS =;g'         po/Makefile

    #   build package
    %{l_make} %{l_mflags}

%install
    rm -rf 

    #   install package
    %{l_make} %{l_mflags} install DESTDIR=

    #   remove file that conflicts with 'grep' package
    rm -f %{l_prefix}/lib/charset.alias

    #   create directory for local state
    for dir in lib/lists lib/lists/partial cache/archives/partial; do
        %{l_shtool} mkdir -f -p -m 755             %{l_prefix}/var/apt/
    done

    #   install default (blank) configuration files
    %{l_shtool} mkdir -p -m 755         %{l_prefix}/etc/apt
    %{l_shtool} install -c -m 644 %{l_value -s -a}         %{SOURCE apt.conf} %{SOURCE 
rpmpriorities}         %{l_prefix}/etc/apt/

    #   strip down installation
    strip %{l_prefix}/bin/*             >/dev/null 2>&1 || true
    strip %{l_prefix}/lib/apt/methods/* >/dev/null 2>&1 || true

    #   determine installation files
    %{l_rpmtool} files -v -ofiles -r %{l_files_std}

%files -f files

%clean
    rm -rf 

--- apt-pkg/deb/debsystem.cc    2003-06-10 09:13:47.000000000 -0500
+++ apt-pkg/deb/debsystem.cc    2003-09-12 10:24:15.152860000 -0500
@@ -162,7 +162,7 @@
       be the only users of these */
    Cnf.CndSet("Dir::State::userstatus","status.user"); // Defunct
    Cnf.CndSet("Dir::State::status","/var/lib/dpkg/status");
-   Cnf.CndSet("Dir::Bin::dpkg","/usr/bin/dpkg");
+   Cnf.CndSet("Dir::Bin::dpkg","@l_prefix@/bin/dpkg");
    
    return true;
 }
@@ -187,7 +187,7 @@
    signed Score = 0;
    if (FileExists(Cnf.FindFile("Dir::State::status","/var/lib/dpkg/status")) == true)
        Score += 10;
-   if (FileExists(Cnf.FindFile("Dir::Bin::dpkg","/usr/bin/dpkg")) == true)
+   if (FileExists(Cnf.FindFile("Dir::Bin::dpkg","@l_prefix@/bin/dpkg")) == true)
       Score += 10;
    if (FileExists("/etc/debian_version") == true)
       Score += 10;
--- apt-pkg/init.cc     2003-06-10 09:10:21.000000000 -0500
+++ apt-pkg/init.cc     2003-09-12 10:24:15.172832000 -0500
@@ -45,10 +45,10 @@
       Cnf.Set("APT::Architecture",COMMON_OS "-" COMMON_CPU);
    // CNC:2002-09-10
    //Cnf.Set("APT::Build-Essential::", "build-essential");
-   Cnf.Set("Dir","/");
+   Cnf.Set("Dir","@l_prefix@");
    
    // State   
-   Cnf.Set("Dir::State","var/lib/apt/");
+   Cnf.Set("Dir::State","var/@name@/lib/");
    
    /* Just in case something goes horribly wrong, we can fall back to the
       old /var/state paths.. */
@@ -61,13 +61,13 @@
    Cnf.Set("Dir::State::cdroms","cdroms.list");
    
    // Cache
-   Cnf.Set("Dir::Cache","var/cache/apt/");
+   Cnf.Set("Dir::Cache","var/@name@/cache/");
    Cnf.Set("Dir::Cache::archives","archives/");
    Cnf.Set("Dir::Cache::srcpkgcache","srcpkgcache.bin");
    Cnf.Set("Dir::Cache::pkgcache","pkgcache.bin");
    
    // Configuration
-   Cnf.Set("Dir::Etc","etc/apt/");
+   Cnf.Set("Dir::Etc","etc/@name@/");
    Cnf.Set("Dir::Etc::sourcelist","sources.list");
    // CNC:2003-03-03
    Cnf.Set("Dir::Etc::sourceparts","sources.list.d");
@@ -76,7 +76,7 @@
    Cnf.Set("Dir::Etc::main","apt.conf");
    Cnf.Set("Dir::Etc::parts","apt.conf.d");
    Cnf.Set("Dir::Etc::preferences","preferences");
-   Cnf.Set("Dir::Bin::methods","/usr/lib/apt/methods");
+   Cnf.Set("Dir::Bin::methods","@l_prefix@/lib/apt/methods");
              
    bool Res = true;
    
--- apt-pkg/luaiface.cc 2003-06-10 09:10:10.000000000 -0500
+++ apt-pkg/luaiface.cc 2003-09-12 10:24:15.190908000 -0500
@@ -59,7 +59,7 @@
 Lua::Lua()
       : DepCache(0), Cache(0), Fix(0), DontFix(0)
 {
-   _config->CndSet("Dir::Bin::scripts", "/usr/lib/apt/scripts");
+   _config->CndSet("Dir::Bin::scripts", "@l_prefix@/lib/apt/scripts");
 
    const luaL_reg lualibs[] = {
       {"base", luaopen_base},
--- apt-pkg/rpm/rpmhandler.cc   2003-06-10 09:12:44.000000000 -0500
+++ apt-pkg/rpm/rpmhandler.cc   2003-09-12 10:24:15.220455000 -0500
@@ -383,9 +383,9 @@
       File = "Packages";       
 #endif
    if (DirectoryOnly == true)
-       return _config->Find("RPM::RootDir")+"/var/lib/rpm";
+       return _config->Find("RPM::RootDir")+"@dbpath@";
    else
-       return _config->Find("RPM::RootDir")+"/var/lib/rpm/"+File;
+       return _config->Find("RPM::RootDir")+"@dbpath@/"+File;
 }
 
 bool RPMDBHandler::Skip()
--- apt-pkg/rpm/rpmhandler.h    2003-06-10 09:12:36.000000000 -0500
+++ apt-pkg/rpm/rpmhandler.h    2003-09-12 10:28:48.228417000 -0500
@@ -12,6 +12,7 @@
 
 #include <apt-pkg/fileutl.h>
 
+#include <rpm/glob.h>
 #include <rpm/rpmlib.h>
 #include <rpm/rpmmacro.h>
 
--- apt-pkg/rpm/rpmpackagedata.cc       2003-06-10 09:12:34.000000000 -0500
+++ apt-pkg/rpm/rpmpackagedata.cc       2003-09-12 10:31:37.552481000 -0500
@@ -12,6 +12,7 @@
 
 #include <apti18n.h>
 
+#include <rpm/glob.h>
 #include <rpm/rpmlib.h>
 
 RPMPackageData::RPMPackageData()
--- apt-pkg/rpm/rpmpm.cc        2003-06-10 09:12:46.000000000 -0500
+++ apt-pkg/rpm/rpmpm.cc        2003-09-12 10:32:29.231349000 -0500
@@ -34,6 +34,7 @@
 #include <iostream>
 
 
+#include <rpm/glob.h>
 #include <rpm/rpmlib.h>
                                                                        /*}}}*/
 
--- apt-pkg/rpm/rpmrecords.h    2003-06-10 09:12:18.000000000 -0500
+++ apt-pkg/rpm/rpmrecords.h    2003-09-12 10:33:05.832241000 -0500
@@ -21,6 +21,7 @@
 
 #include <apt-pkg/pkgrecords.h>
 #include <apt-pkg/fileutl.h>
+#include <rpm/glob.h>
 #include <rpm/rpmlib.h>
 
   
--- apt-pkg/rpm/rpmsrcrecords.h 2003-06-10 09:12:46.000000000 -0500
+++ apt-pkg/rpm/rpmsrcrecords.h 2003-09-12 10:36:00.104583000 -0500
@@ -17,6 +17,7 @@
 
 #include <apt-pkg/srcrecords.h>
 #include <apt-pkg/fileutl.h>
+#include <rpm/glob.h>
 #include <rpm/rpmlib.h>
 
   
--- apt-pkg/rpm/rpmsystem.cc    2003-06-10 09:12:35.000000000 -0500
+++ apt-pkg/rpm/rpmsystem.cc    2003-09-12 10:24:15.244358000 -0500
@@ -120,12 +120,12 @@
 /* These are the rpm specific configuration variables.. */
 bool rpmSystem::Initialize(Configuration &Cnf)
 {
-   Cnf.CndSet("Dir::Bin::rpm","/bin/rpm");
+   Cnf.CndSet("Dir::Bin::rpm","@l_bindir@/rpm");
    Cnf.CndSet("Dir::Etc::rpmpriorities", "rpmpriorities");
    Cnf.CndSet("Dir::Etc::translatelist", "translate.list");
    Cnf.CndSet("Dir::Etc::translateparts", "translate.list.d");
    Cnf.CndSet("Dir::State::prefetch", "prefetch");
-   Cnf.CndSet("Dir::Locale","/usr/share/locale");
+   Cnf.CndSet("Dir::Locale","@l_prefix@/share/locale");
    Cnf.CndSet("Acquire::DistroID","Conectiva"); // hee hee
    Cnf.CndSet("Acquire::CDROM::Mount", "/mnt/cdrom");
    Cnf.CndSet("Acquire::CDROM::Copy-All", "true");
@@ -197,7 +197,7 @@
 
    if (FileExists(RPMDBHandler::DataPath(false)))
       Score += 10;
-   if (FileExists(Cnf.FindFile("Dir::Bin::rpm","/bin/rpm")) == true)
+   if (FileExists(Cnf.FindFile("Dir::Bin::rpm","@l_bindir@/rpm")) == true)
       Score += 10;
 
    return Score;
--- apt-pkg/rpm/rpmversion.cc   2003-06-10 09:12:33.000000000 -0500
+++ apt-pkg/rpm/rpmversion.cc   2003-09-12 10:38:49.691754000 -0500
@@ -22,6 +22,7 @@
 #include <apt-pkg/rpmversion.h>
 #include <apt-pkg/pkgcache.h>
 
+#include <rpm/glob.h>
 #include <rpm/rpmlib.h>
 #include <rpm/misc.h>
 
--- configure.in        2003-06-10 09:04:02.000000000 -0500
+++ configure.in        2003-09-12 13:08:37.264445000 -0500
@@ -48,14 +48,14 @@
 AC_CHECK_HEADER(rpm/rpmlib.h,
 [
    AC_CHECK_LIB(rpmdb,rpmdbOpen,
-     [RPMDBLIBS="-lrpmdb"],
+     [RPMDBLIBS="-lrpmdb"],
      [RPMDBLIBS="-ldb-3.1"],
-     [-lrpm -lrpmio -lz -lbz2 -lpopt])
+     [-lrpm -lrpmio -lrpmz -lrpmbz2 -lrpmbeecrypt @[EMAIL PROTECTED])
 
    AC_CHECK_LIB(rpm,rpmdbGetIteratorOffset,
      [AC_DEFINE_UNQUOTED(HAVE_RPM, 1)
       AC_DEFINE_UNQUOTED(HAVE_RPM4, 1)
-      RPMLIBS="-lrpm  -lrpmio -lz -lbz2 -lpopt"
+      RPMLIBS="-lrpm  -lrpmio -lrpmz -lrpmbz2 -lrpmpopt -lrpmbeecrypt @l_rpmlibs@"
       AC_CHECK_LIB(rpm, rpmtsUpdateDSI,
              [AC_DEFINE_UNQUOTED(HAVE_RPM41, 1)
               rpm_version="4.1"],
@@ -64,11 +64,11 @@
      ],
      [AC_CHECK_LIB(rpm,rpmdbFirstRecNum,
               [AC_DEFINE_UNQUOTED(HAVE_RPM, 1) 
-               RPMLIBS="-lrpm -ldb1 -lz -lbz2 -lpopt"
+               RPMLIBS="-lrpm -lrpmdb -lrpmz -lrpmbz2 -lrpmpopt -lrpmbeecrypt"
                rpm_version="3"],,
-             [-ldb1 -lz -lbz2 -lpopt])
+             [-lrpmdb -lrpmz -lrpmbz2 -lrpmopt -lrpmbeecrypt])
      ],
-     [ -lrpmio -lz -lbz2 -lpopt])
+     [ -lrpmio -lrpmz -lrpmbz2 -lrpmpopt -lrpmbeecrypt @[EMAIL PROTECTED])
 
    AC_SUBST(RPMLIBS)
 ])
--- methods/gpg.cc      2003-06-10 09:14:06.000000000 -0500
+++ methods/gpg.cc      2003-09-12 10:24:15.270075000 -0500
@@ -195,7 +195,7 @@
       return "could not spawn new process";
    else if (pid == 0) 
    {
-      string path = _config->Find("Dir::Bin::gpg", "/usr/bin/gpg");
+      string path = _config->Find("Dir::Bin::gpg", "@l_prefix@/bin/gpg");
       string pubring = "";
       const char *argv[16];
       int argc = 0;
--- test/scratch.cc     2003-06-10 09:20:33.000000000 -0500
+++ test/scratch.cc     2003-09-12 10:24:15.304800000 -0500
@@ -49,7 +49,7 @@
    
 /*   Db.GetFLCache().BeginDiverLoad();
    pkgFLCache::PkgIterator Pkg(Db.GetFLCache(),0);
-   if 
(Db.GetFLCache().AddDiversion(Pkg,"/usr/include/linux/kerneld.h","/usr/bin/nslookup") 
== false)
+   if 
(Db.GetFLCache().AddDiversion(Pkg,"/usr/include/linux/kerneld.h","@l_prefix@/bin/nslookup")
 == false)
       cerr << "Error!" << endl;
 
    const char *Tmp = "/usr/include/linux/kerneld.h";
--- tools/cached_md5.cc 2003-06-10 09:14:45.000000000 -0500
+++ tools/cached_md5.cc 2003-09-12 13:27:32.586894000 -0500
@@ -6,6 +6,7 @@
 #include <dirent.h>
 #include <errno.h>
 #include <fcntl.h>
+#include <rpm/glob.h>
 #include <rpm/rpmlib.h>
 #include <stdlib.h>
 #include <string.h>
--- tools/genpkglist.cc 2003-06-10 09:14:47.000000000 -0500
+++ tools/genpkglist.cc 2003-09-12 13:24:43.717633000 -0500
@@ -6,6 +6,7 @@
 #include <dirent.h>
 #include <errno.h>
 #include <fcntl.h>
+#include <rpm/glob.h>
 #include <rpm/rpmlib.h>
 #include <stdlib.h>
 #include <string.h>
@@ -368,7 +369,7 @@
 }
 
 int scandir(const char * dir, struct dirent *** namelist, 
-        int (* select)(struct dirent *), 
+        int (* select)(const struct dirent *), 
         int (* cmp)(const void *, const void *))
 
 {
--- tools/gensrclist.cc 2003-06-10 09:14:44.000000000 -0500
+++ tools/gensrclist.cc 2003-09-12 13:28:59.653936000 -0500
@@ -6,6 +6,7 @@
 #include <dirent.h>
 #include <errno.h>
 #include <fcntl.h>
+#include <rpm/glob.h>
 #include <rpm/rpmlib.h>
 #include <stdlib.h>
 #include <string.h>
@@ -133,6 +134,89 @@
 }
 #endif
 
+#ifndef HAVE_SCANDIR
+// from glibc 1.09.1  mod'd by jmik, ins'd by asm, fix'd by sbi
+int alphasort(const void * a, const void * b)
+{
+  return strcmp ((*(struct dirent **) a)->d_name,
+                 (*(struct dirent **) b)->d_name);
+}
+
+int scandir(const char * dir, struct dirent *** namelist, 
+        int (* select)(const struct dirent *), 
+        int (* cmp)(const void *, const void *))
+
+{
+  DIR *dp = opendir (dir);
+  struct dirent **v = NULL;
+  size_t vsize = 0, i;
+  struct dirent *d;
+  int save;
+
+  if (dp == NULL)
+    return -1;
+
+  save = errno;
+  errno = 0;
+
+  i = 0;
+  while ((d = readdir (dp)) != NULL)
+    {
+    if (select == NULL || (*select) (d))
+      {
+        if (i == vsize)
+          {
+            struct dirent **newv;
+            if (vsize == 0)
+              vsize = 10;
+            else
+              vsize *= 2;
+            newv = (struct dirent **) realloc (v, vsize * sizeof (*v));
+            if (newv == NULL)
+              {
+              lose:
+                errno = ENOMEM;
+                break;
+              }
+            v = newv;
+          }
+
+        v[i] = (struct dirent *) malloc (d->d_reclen);
+        if (v[i] == NULL)
+          goto lose;
+
+        // *v[i++] = *d;
+       memcpy(v[i], d, d->d_reclen);
+       i++;
+      }
+    }
+
+  v[i] = NULL;
+
+  if (errno != 0)
+    {
+      save = errno;
+      (void) closedir (dp);
+      while (i > 0)
+        free (v[--i]);
+      free (v);
+      errno = save;
+      return -1;
+    }
+
+  (void) closedir (dp);
+  errno = save;
+
+  /* Sort the list if we have a comparison function to sort with.  */
+  if (cmp != NULL)
+    qsort (v, i, sizeof (struct dirent *), cmp);
+
+  *namelist = v;
+  return i;
+}
+// end of new stuff from glibc
+#endif
+
 int main(int argc, char ** argv) 
 {
    char buf[300];
--- tools/cached_md5.cc.orig    2003-09-13 20:46:01.000000000 +0200
+++ tools/cached_md5.cc 2003-09-13 20:50:59.000000000 +0200
@@ -1,7 +1,6 @@
 /*
  * : cached_md5.cc,v 1.4 2003/01/29 13:47:31 niemeyer Exp $
  */
-#include <alloca.h>
 #include <ctype.h>
 #include <dirent.h>
 #include <errno.h>
--- tools/genpkglist.cc.orig    2003-09-13 20:46:01.000000000 +0200
+++ tools/genpkglist.cc 2003-09-13 20:50:44.000000000 +0200
@@ -1,7 +1,6 @@
 /*
  * : genpkglist.cc,v 1.7 2003/01/30 17:18:21 niemeyer Exp $
  */
-#include <alloca.h>
 #include <ctype.h>
 #include <dirent.h>
 #include <errno.h>
--- tools/gensrclist.cc.orig    2003-09-13 20:46:01.000000000 +0200
+++ tools/gensrclist.cc 2003-09-13 20:51:13.000000000 +0200
@@ -1,7 +1,6 @@
 /*
  * : gensrclist.cc,v 1.8 2003/01/30 17:18:21 niemeyer Exp $
  */
-#include <alloca.h>
 #include <ctype.h>
 #include <dirent.h>
 #include <errno.h>

Reply via email to