| 1 | #!/usr/local/bin/perl -w | ||||||||||||||||||||||||||||||||||||||||||||||
| 2 | 1 | ▶ | use File::Basename (); | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||
| 3 | 1 | ▶ | use File::Spec; | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||
| 4 | 1 | ▶ | use lib File::Spec->catdir(File::Basename::dirname(File::Spec->rel2abs(__FILE__)),qw( .. lib perl5 )); | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||
| 5 | |||||||||||||||||||||||||||||||||||||||||||||||
| 6 | =head1 NAME | ||||||||||||||||||||||||||||||||||||||||||||||
| 7 | |||||||||||||||||||||||||||||||||||||||||||||||
| 8 | alien - Convert or install an alien binary package | ||||||||||||||||||||||||||||||||||||||||||||||
| 9 | |||||||||||||||||||||||||||||||||||||||||||||||
| 10 | =head1 SYNOPSIS | ||||||||||||||||||||||||||||||||||||||||||||||
| 11 | |||||||||||||||||||||||||||||||||||||||||||||||
| 12 | alien [--to-deb] [--to-rpm] [--to-tgz] [--to-slp] [options] file [...] | ||||||||||||||||||||||||||||||||||||||||||||||
| 13 | |||||||||||||||||||||||||||||||||||||||||||||||
| 14 | =head1 DESCRIPTION | ||||||||||||||||||||||||||||||||||||||||||||||
| 15 | |||||||||||||||||||||||||||||||||||||||||||||||
| 16 | B<alien> is a program that converts between Red Hat rpm, Debian deb, | ||||||||||||||||||||||||||||||||||||||||||||||
| 17 | Stampede slp, Slackware tgz, and Solaris pkg file formats. If you want to | ||||||||||||||||||||||||||||||||||||||||||||||
| 18 | use a package from another linux distribution than the one you have | ||||||||||||||||||||||||||||||||||||||||||||||
| 19 | installed on your system, you can use B<alien> to convert it to your preferred | ||||||||||||||||||||||||||||||||||||||||||||||
| 20 | package format and install it. It also supports LSB packages. | ||||||||||||||||||||||||||||||||||||||||||||||
| 21 | |||||||||||||||||||||||||||||||||||||||||||||||
| 22 | =head1 WARNING | ||||||||||||||||||||||||||||||||||||||||||||||
| 23 | |||||||||||||||||||||||||||||||||||||||||||||||
| 24 | B<alien> should not be used to replace important system packages, like | ||||||||||||||||||||||||||||||||||||||||||||||
| 25 | init, libc, or other things that are essential for the functioning of | ||||||||||||||||||||||||||||||||||||||||||||||
| 26 | your system. Many of these packages are set up differently by the | ||||||||||||||||||||||||||||||||||||||||||||||
| 27 | different distributions, and packages from the different distributions | ||||||||||||||||||||||||||||||||||||||||||||||
| 28 | cannot be used interchangeably. In general, if you can't remove a | ||||||||||||||||||||||||||||||||||||||||||||||
| 29 | package without breaking your system, don't try to replace it with an | ||||||||||||||||||||||||||||||||||||||||||||||
| 30 | alien version. | ||||||||||||||||||||||||||||||||||||||||||||||
| 31 | |||||||||||||||||||||||||||||||||||||||||||||||
| 32 | =head1 PACKAGE FORMAT NOTES | ||||||||||||||||||||||||||||||||||||||||||||||
| 33 | |||||||||||||||||||||||||||||||||||||||||||||||
| 34 | =over 4 | ||||||||||||||||||||||||||||||||||||||||||||||
| 35 | |||||||||||||||||||||||||||||||||||||||||||||||
| 36 | =item rpm | ||||||||||||||||||||||||||||||||||||||||||||||
| 37 | |||||||||||||||||||||||||||||||||||||||||||||||
| 38 | For converting to and from rpm format the Red Hat Package Manager must be | ||||||||||||||||||||||||||||||||||||||||||||||
| 39 | installed. | ||||||||||||||||||||||||||||||||||||||||||||||
| 40 | |||||||||||||||||||||||||||||||||||||||||||||||
| 41 | =item lsb | ||||||||||||||||||||||||||||||||||||||||||||||
| 42 | |||||||||||||||||||||||||||||||||||||||||||||||
| 43 | Unlike the other package formats, B<alien> can handle the depenendencies of | ||||||||||||||||||||||||||||||||||||||||||||||
| 44 | lsb packages if the destination package format supports dependencies. Note | ||||||||||||||||||||||||||||||||||||||||||||||
| 45 | that this means that the package generated from a lsb package will depend on | ||||||||||||||||||||||||||||||||||||||||||||||
| 46 | a package named "lsb" -- your distribution should provide a package by that | ||||||||||||||||||||||||||||||||||||||||||||||
| 47 | name, if it is lsb compliant. The scripts in the lsb package will be converted | ||||||||||||||||||||||||||||||||||||||||||||||
| 48 | by default as well. | ||||||||||||||||||||||||||||||||||||||||||||||
| 49 | |||||||||||||||||||||||||||||||||||||||||||||||
| 50 | To generate lsb packages, the Red Hat Package Manager must be installed, | ||||||||||||||||||||||||||||||||||||||||||||||
| 51 | and B<alien> will use by preference a program named lsb-rpm, if it exists. | ||||||||||||||||||||||||||||||||||||||||||||||
| 52 | No guarantees are made that the generated lsb packages will be fully LSB | ||||||||||||||||||||||||||||||||||||||||||||||
| 53 | compliant, and it's rather unlikely they will unless you build them in the | ||||||||||||||||||||||||||||||||||||||||||||||
| 54 | lsbdev environment. | ||||||||||||||||||||||||||||||||||||||||||||||
| 55 | |||||||||||||||||||||||||||||||||||||||||||||||
| 56 | Note that unlike other package formats, converting an LSB package to | ||||||||||||||||||||||||||||||||||||||||||||||
| 57 | another format will not cause its minor version number to be changed. | ||||||||||||||||||||||||||||||||||||||||||||||
| 58 | |||||||||||||||||||||||||||||||||||||||||||||||
| 59 | =item deb | ||||||||||||||||||||||||||||||||||||||||||||||
| 60 | |||||||||||||||||||||||||||||||||||||||||||||||
| 61 | For converting to (but not from) deb format, the gcc, make, debhelper, | ||||||||||||||||||||||||||||||||||||||||||||||
| 62 | dpkg-dev, and dpkg packages must be installed. | ||||||||||||||||||||||||||||||||||||||||||||||
| 63 | |||||||||||||||||||||||||||||||||||||||||||||||
| 64 | =item tgz | ||||||||||||||||||||||||||||||||||||||||||||||
| 65 | |||||||||||||||||||||||||||||||||||||||||||||||
| 66 | Note that when converting from the tgz format, B<alien> will simply generate an | ||||||||||||||||||||||||||||||||||||||||||||||
| 67 | output package that has the same files in it as are in the tgz file. This | ||||||||||||||||||||||||||||||||||||||||||||||
| 68 | only works well if the tgz file has precompiled binaries in it in a | ||||||||||||||||||||||||||||||||||||||||||||||
| 69 | standard linux directory tree. Do NOT run B<alien> on tar files with source | ||||||||||||||||||||||||||||||||||||||||||||||
| 70 | code in them, unless you want this source code to be installed in your root | ||||||||||||||||||||||||||||||||||||||||||||||
| 71 | directory when you install the package! | ||||||||||||||||||||||||||||||||||||||||||||||
| 72 | |||||||||||||||||||||||||||||||||||||||||||||||
| 73 | When using B<alien> to convert a tgz package, all files in /etc in are assumed | ||||||||||||||||||||||||||||||||||||||||||||||
| 74 | to be configuration files. | ||||||||||||||||||||||||||||||||||||||||||||||
| 75 | |||||||||||||||||||||||||||||||||||||||||||||||
| 76 | =item pkg | ||||||||||||||||||||||||||||||||||||||||||||||
| 77 | |||||||||||||||||||||||||||||||||||||||||||||||
| 78 | To manipulate packages in the Solaris pkg format (which is really the SV | ||||||||||||||||||||||||||||||||||||||||||||||
| 79 | datastream package format), you will need the Solaris pkginfo and pkgtrans | ||||||||||||||||||||||||||||||||||||||||||||||
| 80 | tools. | ||||||||||||||||||||||||||||||||||||||||||||||
| 81 | |||||||||||||||||||||||||||||||||||||||||||||||
| 82 | =back | ||||||||||||||||||||||||||||||||||||||||||||||
| 83 | |||||||||||||||||||||||||||||||||||||||||||||||
| 84 | =head1 OPTIONS | ||||||||||||||||||||||||||||||||||||||||||||||
| 85 | |||||||||||||||||||||||||||||||||||||||||||||||
| 86 | B<alien> will convert all the files you pass into it into all the output types | ||||||||||||||||||||||||||||||||||||||||||||||
| 87 | you specify. If no output type is specified, it defaults to converting to | ||||||||||||||||||||||||||||||||||||||||||||||
| 88 | deb format. | ||||||||||||||||||||||||||||||||||||||||||||||
| 89 | |||||||||||||||||||||||||||||||||||||||||||||||
| 90 | =over 4 | ||||||||||||||||||||||||||||||||||||||||||||||
| 91 | |||||||||||||||||||||||||||||||||||||||||||||||
| 92 | =item file [...] | ||||||||||||||||||||||||||||||||||||||||||||||
| 93 | |||||||||||||||||||||||||||||||||||||||||||||||
| 94 | The list of package files to convert. | ||||||||||||||||||||||||||||||||||||||||||||||
| 95 | |||||||||||||||||||||||||||||||||||||||||||||||
| 96 | =item B<-d>, B<--to-deb> | ||||||||||||||||||||||||||||||||||||||||||||||
| 97 | |||||||||||||||||||||||||||||||||||||||||||||||
| 98 | Make debian packages. This is the default. | ||||||||||||||||||||||||||||||||||||||||||||||
| 99 | |||||||||||||||||||||||||||||||||||||||||||||||
| 100 | =item B<-r>, B<--to-rpm> | ||||||||||||||||||||||||||||||||||||||||||||||
| 101 | |||||||||||||||||||||||||||||||||||||||||||||||
| 102 | Make rpm packages. | ||||||||||||||||||||||||||||||||||||||||||||||
| 103 | |||||||||||||||||||||||||||||||||||||||||||||||
| 104 | =item B<-t>, B<--to-tgz> | ||||||||||||||||||||||||||||||||||||||||||||||
| 105 | |||||||||||||||||||||||||||||||||||||||||||||||
| 106 | Make tgz packages. | ||||||||||||||||||||||||||||||||||||||||||||||
| 107 | |||||||||||||||||||||||||||||||||||||||||||||||
| 108 | =item B<--to-slp> | ||||||||||||||||||||||||||||||||||||||||||||||
| 109 | |||||||||||||||||||||||||||||||||||||||||||||||
| 110 | Make slp packages. | ||||||||||||||||||||||||||||||||||||||||||||||
| 111 | |||||||||||||||||||||||||||||||||||||||||||||||
| 112 | =item B<-p>, B<--to-pkg> | ||||||||||||||||||||||||||||||||||||||||||||||
| 113 | |||||||||||||||||||||||||||||||||||||||||||||||
| 114 | Make Solaris pkg packages. | ||||||||||||||||||||||||||||||||||||||||||||||
| 115 | |||||||||||||||||||||||||||||||||||||||||||||||
| 116 | =item B<-i>, B<--install> | ||||||||||||||||||||||||||||||||||||||||||||||
| 117 | |||||||||||||||||||||||||||||||||||||||||||||||
| 118 | Automatically install each generated package, and remove the package file | ||||||||||||||||||||||||||||||||||||||||||||||
| 119 | after it has been installed. | ||||||||||||||||||||||||||||||||||||||||||||||
| 120 | |||||||||||||||||||||||||||||||||||||||||||||||
| 121 | =item B<-g>, B<--generate> | ||||||||||||||||||||||||||||||||||||||||||||||
| 122 | |||||||||||||||||||||||||||||||||||||||||||||||
| 123 | Generate a temporary directory suitable for building a package from, but do | ||||||||||||||||||||||||||||||||||||||||||||||
| 124 | not actually create the package. This is useful if you want to move files | ||||||||||||||||||||||||||||||||||||||||||||||
| 125 | around in the package before building it. The package can be built from | ||||||||||||||||||||||||||||||||||||||||||||||
| 126 | this temporary directory by running "debian/rules binary", if you were creating | ||||||||||||||||||||||||||||||||||||||||||||||
| 127 | a Debian package, or by running "rpmbuild -bb <packagename>.spec" if you were | ||||||||||||||||||||||||||||||||||||||||||||||
| 128 | creating a Red Hat package. | ||||||||||||||||||||||||||||||||||||||||||||||
| 129 | |||||||||||||||||||||||||||||||||||||||||||||||
| 130 | =item B<-s>, B<--single> | ||||||||||||||||||||||||||||||||||||||||||||||
| 131 | |||||||||||||||||||||||||||||||||||||||||||||||
| 132 | Like B<-g>, but do not generate the packagename.orig directory. This is only | ||||||||||||||||||||||||||||||||||||||||||||||
| 133 | useful when you are very low on disk space and are generating a debian | ||||||||||||||||||||||||||||||||||||||||||||||
| 134 | package. | ||||||||||||||||||||||||||||||||||||||||||||||
| 135 | |||||||||||||||||||||||||||||||||||||||||||||||
| 136 | =item B<-c>, B<--scripts> | ||||||||||||||||||||||||||||||||||||||||||||||
| 137 | |||||||||||||||||||||||||||||||||||||||||||||||
| 138 | Try to convert the scripts that are meant to be run when the | ||||||||||||||||||||||||||||||||||||||||||||||
| 139 | package is installed and removed. Use this with caution, because these | ||||||||||||||||||||||||||||||||||||||||||||||
| 140 | scripts might be designed to work on a system unlike your own, and could | ||||||||||||||||||||||||||||||||||||||||||||||
| 141 | cause problems. It is recommended that you examine the scripts by hand | ||||||||||||||||||||||||||||||||||||||||||||||
| 142 | and check to see what they do before using this option. | ||||||||||||||||||||||||||||||||||||||||||||||
| 143 | |||||||||||||||||||||||||||||||||||||||||||||||
| 144 | This is enabled by default when converting from lsb packages. | ||||||||||||||||||||||||||||||||||||||||||||||
| 145 | |||||||||||||||||||||||||||||||||||||||||||||||
| 146 | =item B<--patch=>I<patch> | ||||||||||||||||||||||||||||||||||||||||||||||
| 147 | |||||||||||||||||||||||||||||||||||||||||||||||
| 148 | Specify the patch to be used instead of automatically looking the patch up | ||||||||||||||||||||||||||||||||||||||||||||||
| 149 | in B</var/lib/alien>. This has no effect unless a debian package is being | ||||||||||||||||||||||||||||||||||||||||||||||
| 150 | built. | ||||||||||||||||||||||||||||||||||||||||||||||
| 151 | |||||||||||||||||||||||||||||||||||||||||||||||
| 152 | =item B<--anypatch> | ||||||||||||||||||||||||||||||||||||||||||||||
| 153 | |||||||||||||||||||||||||||||||||||||||||||||||
| 154 | Be less strict about which patch file is used, perhaps attempting to use a patch | ||||||||||||||||||||||||||||||||||||||||||||||
| 155 | file for an older version of the package. This is not guaranteed to always work; | ||||||||||||||||||||||||||||||||||||||||||||||
| 156 | older patches may not necessarily work with newer packages. | ||||||||||||||||||||||||||||||||||||||||||||||
| 157 | |||||||||||||||||||||||||||||||||||||||||||||||
| 158 | =item B<--nopatch> | ||||||||||||||||||||||||||||||||||||||||||||||
| 159 | |||||||||||||||||||||||||||||||||||||||||||||||
| 160 | Do not use any patch files. | ||||||||||||||||||||||||||||||||||||||||||||||
| 161 | |||||||||||||||||||||||||||||||||||||||||||||||
| 162 | =item B<--description=>I<desc> | ||||||||||||||||||||||||||||||||||||||||||||||
| 163 | |||||||||||||||||||||||||||||||||||||||||||||||
| 164 | Specifiy a description for the package. This only has an effect when | ||||||||||||||||||||||||||||||||||||||||||||||
| 165 | converting from the tgz package format, which lacks descriptions. | ||||||||||||||||||||||||||||||||||||||||||||||
| 166 | |||||||||||||||||||||||||||||||||||||||||||||||
| 167 | =item B<--version=>I<version> | ||||||||||||||||||||||||||||||||||||||||||||||
| 168 | |||||||||||||||||||||||||||||||||||||||||||||||
| 169 | Specifiy a version for the package. This only has an effect when | ||||||||||||||||||||||||||||||||||||||||||||||
| 170 | converting from the tgz package format, which may lack version | ||||||||||||||||||||||||||||||||||||||||||||||
| 171 | information. | ||||||||||||||||||||||||||||||||||||||||||||||
| 172 | |||||||||||||||||||||||||||||||||||||||||||||||
| 173 | Note that without an argument, this displays the version of B<alien> instead. | ||||||||||||||||||||||||||||||||||||||||||||||
| 174 | |||||||||||||||||||||||||||||||||||||||||||||||
| 175 | =item B<-T>, B<--test> | ||||||||||||||||||||||||||||||||||||||||||||||
| 176 | |||||||||||||||||||||||||||||||||||||||||||||||
| 177 | Test the generated packages. Currently this is only supported for debian | ||||||||||||||||||||||||||||||||||||||||||||||
| 178 | packages, which, if lintian is installed, will be tested with lintian and | ||||||||||||||||||||||||||||||||||||||||||||||
| 179 | lintian's output displayed. | ||||||||||||||||||||||||||||||||||||||||||||||
| 180 | |||||||||||||||||||||||||||||||||||||||||||||||
| 181 | =item B<-k>, B<--keep-version> | ||||||||||||||||||||||||||||||||||||||||||||||
| 182 | |||||||||||||||||||||||||||||||||||||||||||||||
| 183 | By default, B<alien> adds one to the minor version number of each package it | ||||||||||||||||||||||||||||||||||||||||||||||
| 184 | converts. If this option is given, B<alien> will not do this. | ||||||||||||||||||||||||||||||||||||||||||||||
| 185 | |||||||||||||||||||||||||||||||||||||||||||||||
| 186 | =item B<--bump=>I<number> | ||||||||||||||||||||||||||||||||||||||||||||||
| 187 | |||||||||||||||||||||||||||||||||||||||||||||||
| 188 | Instead of incrementing the version number of the converted package by 1, | ||||||||||||||||||||||||||||||||||||||||||||||
| 189 | increment it by the given number. | ||||||||||||||||||||||||||||||||||||||||||||||
| 190 | |||||||||||||||||||||||||||||||||||||||||||||||
| 191 | =item B<--fixperms> | ||||||||||||||||||||||||||||||||||||||||||||||
| 192 | |||||||||||||||||||||||||||||||||||||||||||||||
| 193 | Sanitize all file owners and permissions when building a deb. This may be | ||||||||||||||||||||||||||||||||||||||||||||||
| 194 | useful if the original package is a mess. On the other hand, it may break | ||||||||||||||||||||||||||||||||||||||||||||||
| 195 | some things to mess with their permissions and owners to the degree this does, | ||||||||||||||||||||||||||||||||||||||||||||||
| 196 | so it defaults to off. This can only be used when converting to debian | ||||||||||||||||||||||||||||||||||||||||||||||
| 197 | packages. | ||||||||||||||||||||||||||||||||||||||||||||||
| 198 | |||||||||||||||||||||||||||||||||||||||||||||||
| 199 | =item B<--target=>I<architecture> | ||||||||||||||||||||||||||||||||||||||||||||||
| 200 | |||||||||||||||||||||||||||||||||||||||||||||||
| 201 | Force the architecture of the generated package to the given string. | ||||||||||||||||||||||||||||||||||||||||||||||
| 202 | |||||||||||||||||||||||||||||||||||||||||||||||
| 203 | =item B<-v>, B<--verbose> | ||||||||||||||||||||||||||||||||||||||||||||||
| 204 | |||||||||||||||||||||||||||||||||||||||||||||||
| 205 | Be verbose: Display each command B<alien> runs in the process of converting a | ||||||||||||||||||||||||||||||||||||||||||||||
| 206 | package. | ||||||||||||||||||||||||||||||||||||||||||||||
| 207 | |||||||||||||||||||||||||||||||||||||||||||||||
| 208 | =item B<--veryverbose> | ||||||||||||||||||||||||||||||||||||||||||||||
| 209 | |||||||||||||||||||||||||||||||||||||||||||||||
| 210 | Be verbose as with --verbose, but also display the output of each command | ||||||||||||||||||||||||||||||||||||||||||||||
| 211 | run. Some commands may generate a lot of output. | ||||||||||||||||||||||||||||||||||||||||||||||
| 212 | |||||||||||||||||||||||||||||||||||||||||||||||
| 213 | =item B<-h>, B<--help> | ||||||||||||||||||||||||||||||||||||||||||||||
| 214 | |||||||||||||||||||||||||||||||||||||||||||||||
| 215 | Display a short usage summary. | ||||||||||||||||||||||||||||||||||||||||||||||
| 216 | |||||||||||||||||||||||||||||||||||||||||||||||
| 217 | =item B<-V>, B<--version> | ||||||||||||||||||||||||||||||||||||||||||||||
| 218 | |||||||||||||||||||||||||||||||||||||||||||||||
| 219 | Display the version of B<alien>. | ||||||||||||||||||||||||||||||||||||||||||||||
| 220 | |||||||||||||||||||||||||||||||||||||||||||||||
| 221 | =back | ||||||||||||||||||||||||||||||||||||||||||||||
| 222 | |||||||||||||||||||||||||||||||||||||||||||||||
| 223 | =head1 EXAMPLES | ||||||||||||||||||||||||||||||||||||||||||||||
| 224 | |||||||||||||||||||||||||||||||||||||||||||||||
| 225 | Here are some examples of the use of B<alien>: | ||||||||||||||||||||||||||||||||||||||||||||||
| 226 | |||||||||||||||||||||||||||||||||||||||||||||||
| 227 | =over 4 | ||||||||||||||||||||||||||||||||||||||||||||||
| 228 | |||||||||||||||||||||||||||||||||||||||||||||||
| 229 | =item alien --to-deb package.rpm | ||||||||||||||||||||||||||||||||||||||||||||||
| 230 | |||||||||||||||||||||||||||||||||||||||||||||||
| 231 | Convert the package.rpm into a package.deb | ||||||||||||||||||||||||||||||||||||||||||||||
| 232 | |||||||||||||||||||||||||||||||||||||||||||||||
| 233 | =item alien --to-rpm package.deb | ||||||||||||||||||||||||||||||||||||||||||||||
| 234 | |||||||||||||||||||||||||||||||||||||||||||||||
| 235 | Convert the package.deb into a package.rpm | ||||||||||||||||||||||||||||||||||||||||||||||
| 236 | |||||||||||||||||||||||||||||||||||||||||||||||
| 237 | =item alien -i package.rpm | ||||||||||||||||||||||||||||||||||||||||||||||
| 238 | |||||||||||||||||||||||||||||||||||||||||||||||
| 239 | Convert the package.rpm into a package.deb (converting to a .deb package is | ||||||||||||||||||||||||||||||||||||||||||||||
| 240 | default, so you need not specify --to-deb), and install the generated | ||||||||||||||||||||||||||||||||||||||||||||||
| 241 | package. | ||||||||||||||||||||||||||||||||||||||||||||||
| 242 | |||||||||||||||||||||||||||||||||||||||||||||||
| 243 | =item alien --to-deb --to-rpm --to-tgz --to-slp foo.deb bar.rpm baz.tgz | ||||||||||||||||||||||||||||||||||||||||||||||
| 244 | |||||||||||||||||||||||||||||||||||||||||||||||
| 245 | Creates 9 new packages. When it is done, foo bar and baz are available in | ||||||||||||||||||||||||||||||||||||||||||||||
| 246 | all 4 package formats. | ||||||||||||||||||||||||||||||||||||||||||||||
| 247 | |||||||||||||||||||||||||||||||||||||||||||||||
| 248 | =back | ||||||||||||||||||||||||||||||||||||||||||||||
| 249 | |||||||||||||||||||||||||||||||||||||||||||||||
| 250 | =head1 ENVIRONMENT | ||||||||||||||||||||||||||||||||||||||||||||||
| 251 | |||||||||||||||||||||||||||||||||||||||||||||||
| 252 | B<alien> recognizes the following environment variables: | ||||||||||||||||||||||||||||||||||||||||||||||
| 253 | |||||||||||||||||||||||||||||||||||||||||||||||
| 254 | =over 4 | ||||||||||||||||||||||||||||||||||||||||||||||
| 255 | |||||||||||||||||||||||||||||||||||||||||||||||
| 256 | =item RPMBUILDOPT | ||||||||||||||||||||||||||||||||||||||||||||||
| 257 | |||||||||||||||||||||||||||||||||||||||||||||||
| 258 | Options to pass to rpm when it is building a package. | ||||||||||||||||||||||||||||||||||||||||||||||
| 259 | |||||||||||||||||||||||||||||||||||||||||||||||
| 260 | =item RPMINSTALLOPT | ||||||||||||||||||||||||||||||||||||||||||||||
| 261 | |||||||||||||||||||||||||||||||||||||||||||||||
| 262 | Options to pass to rpm when it is installing a package. | ||||||||||||||||||||||||||||||||||||||||||||||
| 263 | |||||||||||||||||||||||||||||||||||||||||||||||
| 264 | =item EMAIL | ||||||||||||||||||||||||||||||||||||||||||||||
| 265 | |||||||||||||||||||||||||||||||||||||||||||||||
| 266 | If set, B<alien> assumes this is your email address. Email addresses are | ||||||||||||||||||||||||||||||||||||||||||||||
| 267 | included in generated debian packages. | ||||||||||||||||||||||||||||||||||||||||||||||
| 268 | |||||||||||||||||||||||||||||||||||||||||||||||
| 269 | =back | ||||||||||||||||||||||||||||||||||||||||||||||
| 270 | |||||||||||||||||||||||||||||||||||||||||||||||
| 271 | =head1 AUTHOR | ||||||||||||||||||||||||||||||||||||||||||||||
| 272 | |||||||||||||||||||||||||||||||||||||||||||||||
| 273 | B<alien> was written by Christoph Lameter, B<<clameter@debian.org>>. | ||||||||||||||||||||||||||||||||||||||||||||||
| 274 | |||||||||||||||||||||||||||||||||||||||||||||||
| 275 | deb to rpm conversion code was taken from the martian program by | ||||||||||||||||||||||||||||||||||||||||||||||
| 276 | Randolph Chung, B<<tausq@debian.org>>. | ||||||||||||||||||||||||||||||||||||||||||||||
| 277 | |||||||||||||||||||||||||||||||||||||||||||||||
| 278 | The Solaris pkg code was written by Mark A. Hershberger B<<mah@everybody.org>>. | ||||||||||||||||||||||||||||||||||||||||||||||
| 279 | |||||||||||||||||||||||||||||||||||||||||||||||
| 280 | alien has been extensively rewritten (3 times) and is now maintained by | ||||||||||||||||||||||||||||||||||||||||||||||
| 281 | Joey Hess, B<<joeyh@debian.org>>. | ||||||||||||||||||||||||||||||||||||||||||||||
| 282 | |||||||||||||||||||||||||||||||||||||||||||||||
| 283 | =head1 COPYRIGHT | ||||||||||||||||||||||||||||||||||||||||||||||
| 284 | |||||||||||||||||||||||||||||||||||||||||||||||
| 285 | alien may be copied and modified under the terms of the GNU General Public | ||||||||||||||||||||||||||||||||||||||||||||||
| 286 | License. | ||||||||||||||||||||||||||||||||||||||||||||||
| 287 | |||||||||||||||||||||||||||||||||||||||||||||||
| 288 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||
| 289 | |||||||||||||||||||||||||||||||||||||||||||||||
| 290 | package Alien; | ||||||||||||||||||||||||||||||||||||||||||||||
| 291 | 1 | our $Version="8.95"; | |||||||||||||||||||||||||||||||||||||||||||||
| 292 | |||||||||||||||||||||||||||||||||||||||||||||||
| 293 | 1 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||
| 294 | 1 | ▶ | use Getopt::Long; | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||
| 295 | 1 | ▶ | use Alien::Package::Deb; | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||
| 296 | 1 | ▶ | use Alien::Package::Rpm; | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||
| 297 | 1 | ▶ | use Alien::Package::Tgz; | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||
| 298 | 1 | ▶ | use Alien::Package::Slp; | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||
| 299 | 1 | ▶ | use Alien::Package::Pkg; | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||
| 300 | 1 | ▶ | use Alien::Package::Lsb; | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||
| 301 | |||||||||||||||||||||||||||||||||||||||||||||||
| 302 | # Display alien's version number. | ||||||||||||||||||||||||||||||||||||||||||||||
| 303 | 1 | ▶ | sub version { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
version: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||
| 304 | 1 | print "alien version $Alien::Version\n"; | |||||||||||||||||||||||||||||||||||||||||||||
| 305 | 1 | exit; | |||||||||||||||||||||||||||||||||||||||||||||
| 306 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 307 | |||||||||||||||||||||||||||||||||||||||||||||||
| 308 | # Returns a list of directories to search for patches. | ||||||||||||||||||||||||||||||||||||||||||||||
| 309 | 0 | ▶ | sub patchdirs { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
patchdirs: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||
| 310 | 0 | return '/var/lib/alien',"/usr/share/alien/patches"; | |||||||||||||||||||||||||||||||||||||||||||||
| 311 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 312 | |||||||||||||||||||||||||||||||||||||||||||||||
| 313 | # Display usage help. | ||||||||||||||||||||||||||||||||||||||||||||||
| 314 | 0 | ▶ | sub usage { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
usage: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||
| 315 | 0 | print STDERR <<EOF; | |||||||||||||||||||||||||||||||||||||||||||||
| 316 | Usage: alien [options] file [...] | ||||||||||||||||||||||||||||||||||||||||||||||
| 317 | file [...] Package file or files to convert. | ||||||||||||||||||||||||||||||||||||||||||||||
| 318 | -d, --to-deb Generate a Debian deb package (default). | ||||||||||||||||||||||||||||||||||||||||||||||
| 319 | Enables these options: | ||||||||||||||||||||||||||||||||||||||||||||||
| 320 | --patch=<patch> Specify patch file to use instead of automatically | ||||||||||||||||||||||||||||||||||||||||||||||
| 321 | looking for patch in /var/lib/alien. | ||||||||||||||||||||||||||||||||||||||||||||||
| 322 | --nopatch Do not use patches. | ||||||||||||||||||||||||||||||||||||||||||||||
| 323 | --anypatch Use even old version os patches. | ||||||||||||||||||||||||||||||||||||||||||||||
| 324 | -s, --single Like --generate, but do not create .orig | ||||||||||||||||||||||||||||||||||||||||||||||
| 325 | directory. | ||||||||||||||||||||||||||||||||||||||||||||||
| 326 | --fixperms Munge/fix permissions and owners. | ||||||||||||||||||||||||||||||||||||||||||||||
| 327 | --test Test generated packages with lintian. | ||||||||||||||||||||||||||||||||||||||||||||||
| 328 | -r, --to-rpm Generate a Red Hat rpm package. | ||||||||||||||||||||||||||||||||||||||||||||||
| 329 | --to-slp Generate a Stampede slp package. | ||||||||||||||||||||||||||||||||||||||||||||||
| 330 | -l, --to-lsb Generate a LSB package. | ||||||||||||||||||||||||||||||||||||||||||||||
| 331 | -t, --to-tgz Generate a Slackware tgz package. | ||||||||||||||||||||||||||||||||||||||||||||||
| 332 | Enables these options: | ||||||||||||||||||||||||||||||||||||||||||||||
| 333 | --description=<desc> Specify package description. | ||||||||||||||||||||||||||||||||||||||||||||||
| 334 | --version=<version> Specify package version. | ||||||||||||||||||||||||||||||||||||||||||||||
| 335 | -p, --to-pkg Generate a Solaris pkg package. | ||||||||||||||||||||||||||||||||||||||||||||||
| 336 | -i, --install Install generated package. | ||||||||||||||||||||||||||||||||||||||||||||||
| 337 | -g, --generate Generate build tree, but do not build package. | ||||||||||||||||||||||||||||||||||||||||||||||
| 338 | -c, --scripts Include scripts in package. | ||||||||||||||||||||||||||||||||||||||||||||||
| 339 | --target=<arch> Set architecture of the generated package. | ||||||||||||||||||||||||||||||||||||||||||||||
| 340 | -v, --verbose Display each command alien runs. | ||||||||||||||||||||||||||||||||||||||||||||||
| 341 | --veryverbose Be verbose, and also display output of run commands. | ||||||||||||||||||||||||||||||||||||||||||||||
| 342 | -k, --keep-version Do not change version of generated package. | ||||||||||||||||||||||||||||||||||||||||||||||
| 343 | --bump=number Increment package version by this number. | ||||||||||||||||||||||||||||||||||||||||||||||
| 344 | -h, --help Display this help message. | ||||||||||||||||||||||||||||||||||||||||||||||
| 345 | -V, --version Display alien's version number. | ||||||||||||||||||||||||||||||||||||||||||||||
| 346 | |||||||||||||||||||||||||||||||||||||||||||||||
| 347 | EOF | ||||||||||||||||||||||||||||||||||||||||||||||
| 348 | 0 | exit 1; | |||||||||||||||||||||||||||||||||||||||||||||
| 349 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 350 | |||||||||||||||||||||||||||||||||||||||||||||||
| 351 | # Start by processing the parameters. | ||||||||||||||||||||||||||||||||||||||||||||||
| 352 | 1 | my (%destformats, $generate, $install, $single, $scripts, $patchfile, | |||||||||||||||||||||||||||||||||||||||||||||
| 353 | $nopatch, $tgzdescription, $tgzversion, $keepversion, $fixperms, | ||||||||||||||||||||||||||||||||||||||||||||||
| 354 | $test, $anypatch, $target); | ||||||||||||||||||||||||||||||||||||||||||||||
| 355 | 1 | my $versionbump=1; | |||||||||||||||||||||||||||||||||||||||||||||
| 356 | |||||||||||||||||||||||||||||||||||||||||||||||
| 357 | # Bundling is nice anyway, and it is required or Getopt::Long will confuse | ||||||||||||||||||||||||||||||||||||||||||||||
| 358 | # -T and -t. | ||||||||||||||||||||||||||||||||||||||||||||||
| 359 | 1 | Getopt::Long::Configure("bundling"); | |||||||||||||||||||||||||||||||||||||||||||||
| 360 | |||||||||||||||||||||||||||||||||||||||||||||||
| 361 | GetOptions( | ||||||||||||||||||||||||||||||||||||||||||||||
| 362 | 0 | ▶ | "to-deb|d" => sub { $destformats{deb}=1 }, | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||
| 363 | 0 | ▶ | "to-rpm|r" => sub { $destformats{rpm}=1 }, | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||
| 364 | 0 | ▶ | "to-lsb|l" => sub { $destformats{lsb}=1 }, | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||
| 365 | 0 | ▶ | "to-tgz|t" => sub { $destformats{tgz}=1 }, | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||
| 366 | 0 | ▶ | "to-slp" => sub { $destformats{slp}=1 }, | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||
| 367 | 0 | ▶ | "to-pkg|p" => sub { $destformats{pkg}=1 }, | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||
| 368 | "test|T" => \$test, | ||||||||||||||||||||||||||||||||||||||||||||||
| 369 | "generate|g" => \$generate, | ||||||||||||||||||||||||||||||||||||||||||||||
| 370 | "install|i" => \$install, | ||||||||||||||||||||||||||||||||||||||||||||||
| 371 | 0 | ▶ | "single|s" => sub { $single=1; $generate=1 }, | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||
| 372 | "scripts|c" => \$scripts, | ||||||||||||||||||||||||||||||||||||||||||||||
| 373 | "patch=s" => \$patchfile, | ||||||||||||||||||||||||||||||||||||||||||||||
| 374 | "nopatch" => \$nopatch, | ||||||||||||||||||||||||||||||||||||||||||||||
| 375 | "anypatch" => \$anypatch, | ||||||||||||||||||||||||||||||||||||||||||||||
| 376 | "target=s" => \$target, | ||||||||||||||||||||||||||||||||||||||||||||||
| 377 | "description=s" => \$tgzdescription, | ||||||||||||||||||||||||||||||||||||||||||||||
| 378 | "V" => \&version, | ||||||||||||||||||||||||||||||||||||||||||||||
| 379 | 1 | ▶ | "version:s" => sub { length $_[1] ? $tgzversion=$_[1] : version() }, | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=2 SCAR=7.6
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 380 | "verbose|v" => \$Alien::Package::verbose, | ||||||||||||||||||||||||||||||||||||||||||||||
| 381 | 0 | ▶ | "veryverbose" => sub { $Alien::Package::verbose=2 }, | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||
| 382 | 1 | ▶ | "keep-version|k" => \$keepversion, | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 383 | "bump=s" => \$versionbump, | ||||||||||||||||||||||||||||||||||||||||||||||
| 384 | "fixperms" => \$fixperms, | ||||||||||||||||||||||||||||||||||||||||||||||
| 385 | "help|h" => \&usage, | ||||||||||||||||||||||||||||||||||||||||||||||
| 386 | ) || usage(); | ||||||||||||||||||||||||||||||||||||||||||||||
| 387 | |||||||||||||||||||||||||||||||||||||||||||||||
| 388 | # Default to deb conversion. | ||||||||||||||||||||||||||||||||||||||||||||||
| 389 | 0 | ▶ | if (! %destformats) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 390 | 0 | $destformats{deb}=1; | |||||||||||||||||||||||||||||||||||||||||||||
| 391 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 392 | |||||||||||||||||||||||||||||||||||||||||||||||
| 393 | # A few sanity checks. | ||||||||||||||||||||||||||||||||||||||||||||||
| 394 | 0 | ▶ | if (($generate || $single) && $install) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/6
$generate || $single and $install
$generate or $single
MC/DC0%0/3
$generate || $single and $install
$generate
$single
$install
Truth table0%0/5
A or B and C
A= $generateB= $singleC= $install
| |||||||||||||||||||||||||||||||||||||||||||||||
| 395 | 0 | die "You can not use --generate or --single with --install.\n"; | |||||||||||||||||||||||||||||||||||||||||||||
| 396 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 397 | 0 | ▶ | if (($generate || $single) && keys %destformats > 1) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/6
$generate || $single and keys %destformats > 1
$generate or $single
MC/DC0%0/3
$generate || $single and keys %destformats > 1
$generate
$single
keys %destformats > 1
Truth table0%0/5
A or B and C
A= $generateB= $singleC= keys %destformats > 1
| |||||||||||||||||||||||||||||||||||||||||||||||
| 398 | 0 | die "--generate and --single may only be used when converting to a single format.\n"; | |||||||||||||||||||||||||||||||||||||||||||||
| 399 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 400 | 0 | ▶ | if ($patchfile && ! -f $patchfile) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$patchfile and not -f $patchfile
MC/DC0%0/2
$patchfile and not -f $patchfile
$patchfile
not -f $patchfile
Truth table0%0/3
A and not(B)
A= $patchfileB= not -f $patchfile
| |||||||||||||||||||||||||||||||||||||||||||||||
| 401 | 0 | die "Specified patch file, \"$patchfile\" cannot be found.\n"; | |||||||||||||||||||||||||||||||||||||||||||||
| 402 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 403 | 0 | ▶ | if ($patchfile && $nopatch) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$patchfile and $nopatch
MC/DC0%0/2
$patchfile and $nopatch
$patchfile
$nopatch
Truth table0%0/3
A and B
A= $patchfileB= $nopatch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 404 | 0 | die "The options --nopatch and --patchfile cannot be used together.\n"; | |||||||||||||||||||||||||||||||||||||||||||||
| 405 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 406 | 0 | ▶ | unless (@ARGV) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 407 | 0 | print STDERR "You must specify a file to convert.\n\n"; | |||||||||||||||||||||||||||||||||||||||||||||
| 408 | 0 | usage(); | |||||||||||||||||||||||||||||||||||||||||||||
| 409 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 410 | |||||||||||||||||||||||||||||||||||||||||||||||
| 411 | # Check alien's working anvironment. | ||||||||||||||||||||||||||||||||||||||||||||||
| 412 | 0 | ▶ | if (! -w '.') { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 413 | 0 | die("Cannot write to current directory. Try moving to /tmp and re-running alien.\n"); | |||||||||||||||||||||||||||||||||||||||||||||
| 414 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 415 | 0 | ▶ | if ($> != 0) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 416 | 0 | ▶ | if ($destformats{deb} && ! $generate && ! $single) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/6
$destformats{"deb"} and not $generate and not $single
$destformats{"deb"} and not $generate
MC/DC0%0/3
$destformats{"deb"} and not $generate and not $single
$destformats{"deb"}
not $generate
not $single
Truth table0%0/4
A and not(B) and not(C)
A= $destformats{"deb"}B= not $generateC= not $single
| |||||||||||||||||||||||||||||||||||||||||||||||
| 417 | 0 | die "Must run as root to convert to deb format (or you may use fakeroot).\n"; | |||||||||||||||||||||||||||||||||||||||||||||
| 418 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 419 | 0 | print STDERR "Warning: alien is not running as root!\n"; | |||||||||||||||||||||||||||||||||||||||||||||
| 420 | 0 | print STDERR "Warning: Ownerships of files in the generated packages will probably be wrong.\n"; | |||||||||||||||||||||||||||||||||||||||||||||
| 421 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 422 | |||||||||||||||||||||||||||||||||||||||||||||||
| 423 | 0 | foreach my $file (@ARGV) { | |||||||||||||||||||||||||||||||||||||||||||||
| 424 | 0 | ▶ | if (! -e $file) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 425 | 0 | die "File \"$file\" not found.\n"; | |||||||||||||||||||||||||||||||||||||||||||||
| 426 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 427 | |||||||||||||||||||||||||||||||||||||||||||||||
| 428 | # Figure out what kind of file this is. | ||||||||||||||||||||||||||||||||||||||||||||||
| 429 | 0 | my $package; | |||||||||||||||||||||||||||||||||||||||||||||
| 430 | |||||||||||||||||||||||||||||||||||||||||||||||
| 431 | # Check lsb before rpm, since lsb packages are really just | ||||||||||||||||||||||||||||||||||||||||||||||
| 432 | # glorified rpms. | ||||||||||||||||||||||||||||||||||||||||||||||
| 433 | 0 | ▶ | if (Alien::Package::Lsb->checkfile($file)) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 6 branches
| |||||||||||||||||||||||||||||||||||||||||||||||
| 434 | 0 | $package=Alien::Package::Lsb->new(filename => $file); | |||||||||||||||||||||||||||||||||||||||||||||
| 435 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 436 | elsif (Alien::Package::Rpm->checkfile($file)) { | ||||||||||||||||||||||||||||||||||||||||||||||
| 437 | 0 | $package=Alien::Package::Rpm->new(filename => $file); | |||||||||||||||||||||||||||||||||||||||||||||
| 438 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 439 | elsif (Alien::Package::Deb->checkfile($file)) { | ||||||||||||||||||||||||||||||||||||||||||||||
| 440 | 0 | $package=Alien::Package::Deb->new(filename => $file); | |||||||||||||||||||||||||||||||||||||||||||||
| 441 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 442 | elsif (Alien::Package::Tgz->checkfile($file)) { | ||||||||||||||||||||||||||||||||||||||||||||||
| 443 | 0 | $package=Alien::Package::Tgz->new(filename => $file); | |||||||||||||||||||||||||||||||||||||||||||||
| 444 | 0 | ▶ | $package->description($tgzdescription) if defined $tgzdescription; | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 445 | 0 | ▶ | $package->version($tgzversion) if defined $tgzversion; | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 446 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 447 | elsif (Alien::Package::Slp->checkfile($file)) { | ||||||||||||||||||||||||||||||||||||||||||||||
| 448 | 0 | $package=Alien::Package::Slp->new(filename => $file); | |||||||||||||||||||||||||||||||||||||||||||||
| 449 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 450 | elsif (Alien::Package::Pkg->checkfile($file)) { | ||||||||||||||||||||||||||||||||||||||||||||||
| 451 | 0 | $package=Alien::Package::Pkg->new(filename => $file); | |||||||||||||||||||||||||||||||||||||||||||||
| 452 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 453 | else { | ||||||||||||||||||||||||||||||||||||||||||||||
| 454 | 0 | die "Unknown type of package, $file.\n"; | |||||||||||||||||||||||||||||||||||||||||||||
| 455 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 456 | |||||||||||||||||||||||||||||||||||||||||||||||
| 457 | 0 | ▶ | if ($target) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 458 | 0 | $package->arch($target); | |||||||||||||||||||||||||||||||||||||||||||||
| 459 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 460 | |||||||||||||||||||||||||||||||||||||||||||||||
| 461 | 0 | ▶ | if (! $package->usescripts && $package->scripts) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
not $package->usescripts and $package->scripts
MC/DC0%0/2
not $package->usescripts and $package->scripts
not $package->usescripts
$package->scripts
Truth table0%0/3
not(A) and B
A= not $package->usescriptsB= $package->scripts
| |||||||||||||||||||||||||||||||||||||||||||||||
| 462 | 0 | $package->usescripts($scripts); | |||||||||||||||||||||||||||||||||||||||||||||
| 463 | 0 | ▶ | if (! $scripts) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 464 | 0 | print STDERR "Warning: Skipping conversion of scripts in package ".$package->name.": ".join(" ", $package->scripts)."\n"; | |||||||||||||||||||||||||||||||||||||||||||||
| 465 | 0 | print STDERR "Warning: Use the --scripts parameter to include the scripts.\n"; | |||||||||||||||||||||||||||||||||||||||||||||
| 466 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 467 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 468 | |||||||||||||||||||||||||||||||||||||||||||||||
| 469 | # Increment release. | ||||||||||||||||||||||||||||||||||||||||||||||
| 470 | 0 | ▶ | unless (defined $keepversion) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 471 | 0 | $package->incrementrelease($versionbump); | |||||||||||||||||||||||||||||||||||||||||||||
| 472 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 473 | |||||||||||||||||||||||||||||||||||||||||||||||
| 474 | 0 | foreach my $format (keys %destformats) { | |||||||||||||||||||||||||||||||||||||||||||||
| 475 | # Skip conversion if package is already the correct format. | ||||||||||||||||||||||||||||||||||||||||||||||
| 476 | # Howver, generate build tree even if the format is | ||||||||||||||||||||||||||||||||||||||||||||||
| 477 | # unchanged. | ||||||||||||||||||||||||||||||||||||||||||||||
| 478 | 0 | ▶ | if ($package->origformat ne $format || $generate) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition0%0/3
$package->origformat ne $format or $generate
MC/DC0%0/2
$package->origformat ne $format or $generate
$package->origformat ne $format
$generate
Truth table0%0/3
A or B
A= $package->origformat ne $formatB= $generate
| |||||||||||||||||||||||||||||||||||||||||||||||
| 479 | # Only unpack once. | ||||||||||||||||||||||||||||||||||||||||||||||
| 480 | 0 | ▶ | if ($package->unpacked_tree) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 481 | 0 | $package->cleantree; | |||||||||||||||||||||||||||||||||||||||||||||
| 482 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 483 | else { | ||||||||||||||||||||||||||||||||||||||||||||||
| 484 | 0 | $package->unpack; | |||||||||||||||||||||||||||||||||||||||||||||
| 485 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 486 | |||||||||||||||||||||||||||||||||||||||||||||||
| 487 | # Mutate package into desired format. | ||||||||||||||||||||||||||||||||||||||||||||||
| 488 | 0 | bless($package, "Alien::Package::".ucfirst($format)); | |||||||||||||||||||||||||||||||||||||||||||||
| 489 | |||||||||||||||||||||||||||||||||||||||||||||||
| 490 | # Make .orig.tar.gz directory? | ||||||||||||||||||||||||||||||||||||||||||||||
| 491 | 0 | ▶ | if ($format eq 'deb' && ! $single && $generate) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/6
$format eq "deb" and not $single and $generate
$format eq "deb" and not $single
MC/DC0%0/3
$format eq "deb" and not $single and $generate
$format eq "deb"
not $single
$generate
Truth table0%0/4
A and not(B) and C
A= $format eq "deb"B= not $singleC= $generate
| |||||||||||||||||||||||||||||||||||||||||||||||
| 492 | # Make .orig.tar.gz directory. | ||||||||||||||||||||||||||||||||||||||||||||||
| 493 | 0 | ▶ | Alien::Package->do("cp", "-fa", "--", $package->unpacked_tree, $package->unpacked_tree.".orig") | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 494 | or die "cp -fa failed"; | ||||||||||||||||||||||||||||||||||||||||||||||
| 495 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 496 | |||||||||||||||||||||||||||||||||||||||||||||||
| 497 | # See if a patch file should be used. | ||||||||||||||||||||||||||||||||||||||||||||||
| 498 | 0 | ▶ | if ($format eq 'deb' && ! $nopatch) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$format eq "deb" and not $nopatch
MC/DC0%0/2
$format eq "deb" and not $nopatch
$format eq "deb"
not $nopatch
Truth table0%0/3
A and not(B)
A= $format eq "deb"B= not $nopatch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 499 | 0 | ▶ | if (defined $patchfile) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 500 | 0 | $package->patchfile($patchfile) | |||||||||||||||||||||||||||||||||||||||||||||
| 501 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 502 | else { | ||||||||||||||||||||||||||||||||||||||||||||||
| 503 | 0 | $package->patchfile($package->getpatch($anypatch, patchdirs())); | |||||||||||||||||||||||||||||||||||||||||||||
| 504 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 505 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 506 | |||||||||||||||||||||||||||||||||||||||||||||||
| 507 | 0 | $package->fixperms($fixperms); | |||||||||||||||||||||||||||||||||||||||||||||
| 508 | |||||||||||||||||||||||||||||||||||||||||||||||
| 509 | 0 | $package->prep; | |||||||||||||||||||||||||||||||||||||||||||||
| 510 | |||||||||||||||||||||||||||||||||||||||||||||||
| 511 | # If generating build tree only, stop here | ||||||||||||||||||||||||||||||||||||||||||||||
| 512 | # with message. | ||||||||||||||||||||||||||||||||||||||||||||||
| 513 | 0 | ▶ | if ($generate) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 514 | 0 | ▶ | if ($format eq 'deb' && ! $single) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$format eq "deb" and not $single
MC/DC0%0/2
$format eq "deb" and not $single
$format eq "deb"
not $single
Truth table0%0/3
A and not(B)
A= $format eq "deb"B= not $single
| |||||||||||||||||||||||||||||||||||||||||||||||
| 515 | 0 | print "Directories ".$package->unpacked_tree." and ".$package->unpacked_tree.".orig prepared.\n" | |||||||||||||||||||||||||||||||||||||||||||||
| 516 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 517 | else { | ||||||||||||||||||||||||||||||||||||||||||||||
| 518 | 0 | print "Directory ".$package->unpacked_tree." prepared.\n"; | |||||||||||||||||||||||||||||||||||||||||||||
| 519 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 520 | # Make sure $package does not wipe out the | ||||||||||||||||||||||||||||||||||||||||||||||
| 521 | # directory when it is destroyed. | ||||||||||||||||||||||||||||||||||||||||||||||
| 522 | 0 | $package->unpacked_tree(''); | |||||||||||||||||||||||||||||||||||||||||||||
| 523 | 0 | next; | |||||||||||||||||||||||||||||||||||||||||||||
| 524 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 525 | |||||||||||||||||||||||||||||||||||||||||||||||
| 526 | 0 | my $newfile=$package->build; | |||||||||||||||||||||||||||||||||||||||||||||
| 527 | 0 | ▶ | if ($test) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 528 | 0 | my @results = $package->test($newfile); | |||||||||||||||||||||||||||||||||||||||||||||
| 529 | 0 | ▶ | if (@results) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 530 | 0 | print "Test results:\n"; | |||||||||||||||||||||||||||||||||||||||||||||
| 531 | 0 | print "\t$_\n" foreach @results; | |||||||||||||||||||||||||||||||||||||||||||||
| 532 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 533 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 534 | 0 | ▶ | if ($install) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 535 | 0 | $package->install($newfile); | |||||||||||||||||||||||||||||||||||||||||||||
| 536 | 0 | unlink $newfile; | |||||||||||||||||||||||||||||||||||||||||||||
| 537 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 538 | else { | ||||||||||||||||||||||||||||||||||||||||||||||
| 539 | # Tell them where the package ended up. | ||||||||||||||||||||||||||||||||||||||||||||||
| 540 | 0 | print "$newfile generated\n"; | |||||||||||||||||||||||||||||||||||||||||||||
| 541 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 542 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 543 | elsif ($install) { | ||||||||||||||||||||||||||||||||||||||||||||||
| 544 | # Don't convert the package, but do install it. | ||||||||||||||||||||||||||||||||||||||||||||||
| 545 | 0 | $package->install($file); | |||||||||||||||||||||||||||||||||||||||||||||
| 546 | # Note I don't unlink it. I figure that might annoy | ||||||||||||||||||||||||||||||||||||||||||||||
| 547 | # people, since it was an input file. | ||||||||||||||||||||||||||||||||||||||||||||||
| 548 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 549 | |||||||||||||||||||||||||||||||||||||||||||||||
| 550 | 0 | $package->revert; | |||||||||||||||||||||||||||||||||||||||||||||
| 551 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 552 | } | ||||||||||||||||||||||||||||||||||||||||||||||