Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

first pass at a squashfs recipe #8648

Closed
wants to merge 2 commits into from

2 participants

@freeformz

Take #2

Library/Formula/squashfs.rb
@@ -0,0 +1,17 @@
+require 'formula'
+
+class Squashfs < Formula
+ homepage 'http://squashfs.sourceforge.net/'
+ url 'http://sourceforge.net/projects/squashfs/files/squashfs/squashfs4.0/squashfs4.0.tar.gz/download'
+ md5 'a3c23391da4ebab0ac4a75021ddabf96'
+
+ def install
+ system "cd squashfs-tools; sed -i.orig 's/\|FNM_EXTMATCH//' $(grep -l FNM_EXTMATCH *)"
@Sharpie Collaborator
Sharpie added a note

Should use the inreplace function instead of shelling out to sed:

inreplace %w[squashfs-tools/mksquashfs.c squashfs-tools/unsquashfs.c], '|FNM_EXTMATCH', ''
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Library/Formula/squashfs.rb
@@ -0,0 +1,17 @@
+require 'formula'
+
+class Squashfs < Formula
+ homepage 'http://squashfs.sourceforge.net/'
+ url 'http://sourceforge.net/projects/squashfs/files/squashfs/squashfs4.0/squashfs4.0.tar.gz/download'
+ md5 'a3c23391da4ebab0ac4a75021ddabf96'
+
+ def install
+ system "cd squashfs-tools; sed -i.orig 's/\|FNM_EXTMATCH//' $(grep -l FNM_EXTMATCH *)"
+ system "cd squashfs-tools; sed -i.orig $'/#include \"unsquashfs.h\"/{i\\\n#include <sys/sysctl.h>\n}' unsquashfs.c"
@Sharpie Collaborator
Sharpie added a note

This could also be done via inreplace:

inreplace 'squashfs-tools/unsquashfs.c', /(#include "unsquashfs.h")/, "#include <sys/sysctl.h>\n\\1"

Although, at this point it is probably best to use a commented patch. This is easier on future maintainers who don't know sed or regular expressions that well and provides some insight into why the changes are needed. The Pyside formula has a good example of a bundled patch:

https://github.com/mxcl/homebrew/blob/master/Library/Formula/pyside.rb#L52-72

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Library/Formula/squashfs.rb
@@ -0,0 +1,17 @@
+require 'formula'
+
+class Squashfs < Formula
+ homepage 'http://squashfs.sourceforge.net/'
+ url 'http://sourceforge.net/projects/squashfs/files/squashfs/squashfs4.0/squashfs4.0.tar.gz/download'
+ md5 'a3c23391da4ebab0ac4a75021ddabf96'
+
+ def install
+ system "cd squashfs-tools; sed -i.orig 's/\|FNM_EXTMATCH//' $(grep -l FNM_EXTMATCH *)"
+ system "cd squashfs-tools; sed -i.orig $'/#include \"unsquashfs.h\"/{i\\\n#include <sys/sysctl.h>\n}' unsquashfs.c"
+ system "cd squashfs-tools; make"
+
+ bin.install ["squashfs-tools/mksquashfs", "squashfs-tools/unsquashfs"]
@Sharpie Collaborator
Sharpie added a note

Since most of this action is happening in squashfs-tools, you could just wrap everything in a Dir.chdir block:

Dir.chdir 'squashfs-tools' do

   # Everything in here does not need `cd squashfs-tools` or a `squashfs-tools/` prefix

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

That's pretty much all done now.

@Sharpie Sharpie closed this pull request from a commit
@freeformz freeformz New Formula: squashfs
Closes #8648.

Signed-off-by: Charlie Sharpsteen <source@sharpsteen.net>
c9e3530
@Sharpie Sharpie closed this in c9e3530
@Sharpie
Collaborator

Looks good. Pulled.

@jerjanssen jerjanssen referenced this pull request from a commit
Commit has since been removed from the repository and is no longer available.
@mrjbq7 mrjbq7 referenced this pull request from a commit
Commit has since been removed from the repository and is no longer available.
@kyohsuke kyohsuke referenced this pull request from a commit
Commit has since been removed from the repository and is no longer available.
@mzsanford mzsanford referenced this pull request from a commit
Commit has since been removed from the repository and is no longer available.
@dvj dvj referenced this pull request from a commit
Commit has since been removed from the repository and is no longer available.
@dvj dvj referenced this pull request from a commit
Commit has since been removed from the repository and is no longer available.
@Sharpie Sharpie referenced this pull request from a commit in Sharpie/homebrew
@freeformz freeformz New Formula: squashfs
Closes #8648.

Signed-off-by: Charlie Sharpsteen <source@sharpsteen.net>
c6e1004
@snakeyroc3 snakeyroc3 referenced this pull request from a commit in snakeyroc3/homebrew
@freeformz freeformz New Formula: squashfs
Closes #8648.

Signed-off-by: Charlie Sharpsteen <source@sharpsteen.net>
046a781
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Nov 17, 2011
  1. @freeformz
Commits on Nov 18, 2011
  1. @freeformz

    Make it better

    freeformz authored
This page is out of date. Refresh to see the latest.
Showing with 60 additions and 0 deletions.
  1. +60 −0 Library/Formula/squashfs.rb
View
60 Library/Formula/squashfs.rb
@@ -0,0 +1,60 @@
+require 'formula'
+
+class Squashfs < Formula
+ homepage 'http://squashfs.sourceforge.net/'
+ url 'http://sourceforge.net/projects/squashfs/files/squashfs/squashfs4.0/squashfs4.0.tar.gz/download'
+ md5 'a3c23391da4ebab0ac4a75021ddabf96'
+
+ def patches
+ { :p0 => DATA }
+ end
+
+ def install
+ Dir.chdir 'squashfs-tools' do
+ system "make"
+ bin.install %w{mksquashfs unsquashfs}
+ end
+
+ doc.install %w{ACKNOWLEDGEMENTS CHANGES COPYING INSTALL OLD-READMEs PERFORMANCE.README README README-4.0}
+ end
+end
+
+__END__
+
+Originally from some internal notes:
+ "cd squashfs-tools; sed -i.orig 's/\|FNM_EXTMATCH//' $(grep -l FNM_EXTMATCH *)"
+ "cd squashfs-tools; sed -i.orig $'/#include \"unsquashfs.h\"/{i\\\n#include <sys/sysctl.h>\n}' unsquashfs.c"
+
+diff -u squashfs-tools.orig/mksquashfs.c squashfs-tools/mksquashfs.c
+--- squashfs-tools.orig/mksquashfs.c 2009-04-05 14:22:48.000000000 -0700
++++ squashfs-tools/mksquashfs.c 2011-11-17 17:51:31.000000000 -0800
+@@ -3975,7 +3975,7 @@
+ regexec(path->name[i].preg, name, (size_t) 0,
+ NULL, 0) == 0 :
+ fnmatch(path->name[i].name, name,
+- FNM_PATHNAME|FNM_PERIOD|FNM_EXTMATCH) ==
++ FNM_PATHNAME|FNM_PERIOD) ==
+ 0;
+
+ if(match && path->name[i].paths == NULL) {
+Only in squashfs-tools: mksquashfs.c.orig
+diff -u squashfs-tools.orig/unsquashfs.c squashfs-tools/unsquashfs.c
+--- squashfs-tools.orig/unsquashfs.c 2009-04-05 14:23:06.000000000 -0700
++++ squashfs-tools/unsquashfs.c 2011-11-17 17:51:44.000000000 -0800
+@@ -21,6 +21,7 @@
+ * unsquashfs.c
+ */
+
++#include <sys/sysctl.h>
+ #include "unsquashfs.h"
+ #include "squashfs_swap.h"
+ #include "squashfs_compat.h"
+@@ -1195,7 +1196,7 @@
+ int match = use_regex ?
+ regexec(path->name[i].preg, name, (size_t) 0,
+ NULL, 0) == 0 : fnmatch(path->name[i].name,
+- name, FNM_PATHNAME|FNM_PERIOD|FNM_EXTMATCH) ==
++ name, FNM_PATHNAME|FNM_PERIOD) ==
+ 0;
+ if(match && path->name[i].paths == NULL)
+ /*
Something went wrong with that request. Please try again.