- Timestamp:
- 08/16/15 19:37:38 (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/debbuild
r203 r204 47 47 48 48 sub expandmacros; 49 sub unpackcmd; 49 50 50 51 # User's prefs for dirs, environment, etc,etc,etc. … … 927 928 if ($deftarball) { 928 929 $prepscript .= "cd '$tarballdir'\n" if $changedir; 929 if ($pkgdata{main}{source} =~ /\.zip$/) { 930 # .zip files are not really tarballs 931 $prepscript .= "/usr/bin/unzip". 932 ( $quietunpack ? ' -qq ' : ' ' ). 933 "'$topdir/SOURCES/$pkgdata{main}{source}'"; 934 } else { 935 $prepscript .= 936 ( $pkgdata{main}{source} =~ /\.(?:tgz|tar\.(?:gz|Z))$/ ? "/bin/gzip" : "" ). 937 ( $pkgdata{main}{source} =~ /\.tar\.bz2$/ ? "/bin/bzip2" : "" ). 938 ( $pkgdata{main}{source} =~ /\.tar\.xz$/ ? "/usr/bin/xz" : "" ). 939 " -dc '$topdir/SOURCES/$pkgdata{main}{source}' | /bin/tar -x". 940 ( $quietunpack ? '' : 'vv' )."f - "; 941 } 942 $prepscript .= qq(\nSTATUS=\$?\nif [ \$STATUS -ne 0 ]; then\n exit \$STATUS\nfi\n); 930 $prepscript .= unpackcmd($pkgdata{main}{source},$quietunpack); 943 931 } 944 932 … … 946 934 if ($altsource == 1) { # -a 947 935 $prepscript .= "cd '$tarballdir'\n"; 948 if ($pkgdata{sources}{$snum} =~ /\.zip$/) { 949 # .zip files are not really tarballs 950 $prepscript .= "/usr/bin/unzip". 951 ( $quietunpack ? ' -qq ' : ' ' ). 952 "'$topdir/SOURCES/$pkgdata{sources}{$snum}'"; 953 } else { 954 $prepscript .= 955 ( $pkgdata{sources}{$snum} =~ /\.(?:tgz|tar\.(?:gz|Z))$/ ? "/bin/gzip" : "" ). 956 ( $pkgdata{sources}{$snum} =~ /\.tar\.bz2$/ ? "/bin/bzip2" : "" ). 957 ( $pkgdata{sources}{$snum} =~ /\.tar\.xz$/ ? "/usr/bin/xz" : "" ). 958 " -dc '$topdir/SOURCES/$pkgdata{sources}{$snum}' | /bin/tar -x". 959 ( $quietunpack ? '' : 'vv' )."f -"; 960 } 961 $prepscript .= qq(\nSTATUS=\$?\nif [ \$STATUS -ne 0 ]; then\n exit \$STATUS\nfi\n); 936 $prepscript .= unpackcmd($pkgdata{sources}{$snum},$quietunpack); 962 937 } # $altsource == 1 963 938 964 939 if ($altsource == 2) { # -b 965 if ($pkgdata{sources}{$snum} =~ /\.zip$/) { 966 # .zip files are not really tarballs 967 $prepscript .= "/usr/bin/unzip". 968 ( $quietunpack ? ' -qq ' : ' ' ). 969 "'$topdir/SOURCES/$pkgdata{main}{source}'"; 970 } else { 971 $prepscript .= 972 ( $pkgdata{sources}{$snum} =~ /\.(?:tgz|tar\.(?:gz|Z))$/ ? "/bin/gzip" : "" ). 973 ( $pkgdata{sources}{$snum} =~ /\.tar\.bz2$/ ? "/bin/bzip2" : "" ). 974 ( $pkgdata{sources}{$snum} =~ /\.tar\.xz$/ ? "/usr/bin/xz" : "" ). 975 " -dc '$topdir/SOURCES/$pkgdata{sources}{$snum}' | /bin/tar -x". 976 ( $quietunpack ? '' : 'vv' )."f -"; 977 } 978 $prepscript .= qq(\nSTATUS=\$?\nif [ \$STATUS -ne 0 ]; then\n exit \$STATUS\nfi\n); 940 $prepscript .= unpackcmd($pkgdata{sources}{$snum},$quietunpack); 979 941 $prepscript .= "cd '$tarballdir'\n"; 980 942 } # $altsource == 2 … … 2074 2036 2075 2037 2038 ## unpackcmd() 2039 # Prepare the necessary commands for uncompressing and extracting the content 2040 # of the source drop according to the file extension. 2041 sub unpackcmd { 2042 my ($sourcedrop,$quietunpack) = @_; 2043 my $cmdstring; 2044 2045 if ($sourcedrop =~ /\.zip$/) { 2046 # .zip files are not really tarballs 2047 $cmdstring .= "/usr/bin/unzip". 2048 ( $quietunpack ? ' -qq ' : ' ' ). 2049 "'$topdir/SOURCES/$sourcedrop'"; 2050 } elsif ($sourcedrop =~ /\.tar$/) { 2051 # plain .tar files don't need to be uncompressed 2052 $cmdstring .= "/bin/tar -x". 2053 ( $quietunpack ? '' : 'vv' )."f ". 2054 "'$topdir/SOURCES/$sourcedrop'"; 2055 } else { 2056 # select the decompressor according to the file extension 2057 $cmdstring .= 2058 ( $sourcedrop =~ /\.(?:tgz|tar\.(?:gz|Z))$/ ? "/bin/gzip" : 2059 $sourcedrop =~ /\.tar\.bz2$/ ? "/bin/bzip2" : 2060 $sourcedrop =~ /\.tar\.xz$/ ? "/usr/bin/xz" : 2061 die("Can't handle unknown file type '$sourcedrop'.") ). 2062 " -dc '$topdir/SOURCES/$sourcedrop' | /bin/tar -x". 2063 ( $quietunpack ? '' : 'vv' )."f - "; 2064 } 2065 $cmdstring .= qq(\nSTATUS=\$?\nif [ \$STATUS -ne 0 ]; then\n exit \$STATUS\nfi\n); 2066 2067 return $cmdstring; 2068 } # end unpackcmd() 2069 2076 2070 2077 2071 __END__
Note:
See TracChangeset
for help on using the changeset viewer.