Skip to content

Instantly share code, notes, and snippets.

@jedi4ever
Created March 17, 2011 08:41
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save jedi4ever/874016 to your computer and use it in GitHub Desktop.
Save jedi4ever/874016 to your computer and use it in GitHub Desktop.
homebrew formula to get dpkg working a mac
require 'formula'
class Tar <Formula
url 'http://ftp.gnu.org/gnu/tar/tar-1.26.tar.gz'
homepage 'http://www.gnu.org/software/tar/'
md5 '00d1e769c6af702c542cca54b728920d'
# depends_on 'cmake'
def install
system "./configure", "--disable-debug", "--disable-dependency-tracking",
"--prefix=#{prefix}"
# system "cmake . #{std_cmake_parameters}"
system "make install"
end
end
require 'formula'
class Dpkg <Formula
url 'http://ftp.debian.org/debian/pool/main/d/dpkg/dpkg_1.15.8.10.tar.bz2'
homepage 'http://en.wikipedia.org/wiki/Dpkg'
md5 'bce745c7083ace01da1df6cdcad35f9a'
# depends_on 'cmake'
def patches
#Fixes the PERL_LIBDIR
DATA
end
def install
system "./configure", "--disable-dependency-tracking",
"--prefix=#{prefix}",
"--disable-compiler-warnings",
"--disable-linker-optimisations",
"--disable-compiler-optimisations",
"--without-start-stop-daemon",
"PERL_LIBDIR=/Library/Perl/5.10.0/ "
# system "cmake . #{std_cmake_parameters}"
system "make install"
end
end
__END__
diff --git a/configure b/configure
index a4e8516..de7f226 100755
--- a/configure
+++ b/configure
@@ -8171,9 +8171,7 @@ else
$as_echo "no" >&6; }
fi
-PERL_LIBDIR=$($PERL -MConfig -e 'my $r = $Config{vendorlibexp};
- $r =~ s/$Config{vendorprefixexp}/\$(prefix)/;
- print $r')
+PERL_LIBDIR="/Library/perl/5.10.0"
for ac_prog in pod2man
do
@wangpy
Copy link

wangpy commented Aug 17, 2011

dpkg formula should add a patch to make dpkg-deb use gnutar instead of default tar
following are patch content, which can be just appended after the end of dpkg formula:
diff --git a/build.c b/build.c.new
index 9ca729b..be24e76 100644
--- a/build.c
+++ b/build.c.new
@@ -397,8 +397,8 @@ void do_build(const char *const *argv) {
m_dup2(p1[1],1); close(p1[0]); close(p1[1]);
if (chdir(directory)) ohshite(("failed to chdir to `%.255s'"),directory);
if (chdir(BUILDCONTROLDIR)) ohshite(
("failed to chdir to .../DEBIAN"));

  • execlp(TAR, "tar", "-cf", "-", "--format=gnu", ".", NULL);
  • ohshite(_("failed to exec tar -cf"));
  • execlp(TAR, "gnutar", "-cf", "-", "--format=gnu", ".", NULL);
  • ohshite(_("failed to exec gnutar -cf"));
    }
    close(p1[1]);
    /* Create a temporary file to store the control data in. Immediately unlink
    @@ -419,7 +419,7 @@ void do_build(const char *const *argv) {
    }
    close(p1[0]);
    subproc_wait_check(c2, "gzip -9c", 0);
  • subproc_wait_check(c1, "tar -cf", 0);
  • subproc_wait_check(c1, "gnutar -cf", 0);

if (lseek(gzfd, 0, SEEK_SET))
ohshite(("failed to rewind tmpfile (control)"));
@@ -463,8 +463,8 @@ void do_build(const char *const *argv) {
m_dup2(p1[0],0); close(p1[0]); close(p1[1]);
m_dup2(p2[1],1); close(p2[0]); close(p2[1]);
if (chdir(directory)) ohshite(
("failed to chdir to `%.255s'"),directory);

  • execlp(TAR, "tar", "-cf", "-", "--format=gnu", "--null", "-T", "-", "--no-recursion", NULL);
  • ohshite(_("failed to exec tar -cf"));
  • execlp(TAR, "gnutar", "-cf", "-", "--format=gnu", "--null", "-T", "-", "--no-recursion", NULL);
  • ohshite(_("failed to exec gnutar -cf"));
    }
    close(p1[0]);
    close(p2[1]);
    @@ -499,7 +499,7 @@ void do_build(const char *const *argv) {
    add_to_filist(&symlist, &symlist_end, fi);
    else {
    if (write(p1[1], fi->fn, strlen(fi->fn)+1) ==- 1)
  • ohshite(_("failed to write filename to tar pipe (data)"));
  • ohshite(_("failed to write filename to gnutar pipe (data)"));
    file_info_free(fi);
    }
    close(p3[0]);
    @@ -507,12 +507,12 @@ void do_build(const char *const *argv) {

for (fi= symlist;fi;fi= fi->next)
if (write(p1[1], fi->fn, strlen(fi->fn)+1) == -1)

  •  ohshite(_("failed to write filename to tar pipe (data)"));
    
  •  ohshite(_("failed to write filename to gnutar pipe (data)"));
    
    /* All done, clean up wait for tar and gzip to finish their job */
    close(p1[1]);
    free_filist(symlist);
  • subproc_wait_check(c2, _(" from tar -cf"), 0);
  • subproc_wait_check(c1, "tar -cf", 0);
  • subproc_wait_check(c2, _(" from gnutar -cf"), 0);
  • subproc_wait_check(c1, "gnutar -cf", 0);
    /* Okay, we have data.tar.gz as well now, add it to the ar wrapper */
    if (!oldformatflag) {
    char datamember[16 + 1];
    diff --git a/lib/dpkg/dpkg.h b/lib/dpkg/dpkg.h
    index 3e39ccb..72fd0e1 100644
    --- a/lib/dpkg/dpkg.h
    +++ b/lib/dpkg/dpkg.h
    @@ -97,7 +97,7 @@ DPKG_BEGIN_DECLS
    #define DPKG "dpkg"
    #define DEBSIGVERIFY "/usr/bin/debsig-verify"

-#define TAR "tar"
+#define TAR "gnutar"
#define RM "rm"
#define FIND "find"
#define DIFF "diff"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment