[2] | 1 | #!/usr/bin/perl
|
---|
| 2 | # debbuild script
|
---|
| 3 | # Shamlessly steals intreface from rpm's "rpmbuild" to create
|
---|
| 4 | # Debian packages. Please note that such packages are highly
|
---|
| 5 | # unlikely to conform to "Debian Policy".
|
---|
| 6 | ###
|
---|
| 7 | # SVN revision info
|
---|
| 8 | # $Date: 2006-04-07 21:51:06 +0000 (Fri, 07 Apr 2006) $
|
---|
| 9 | # SVN revision $Rev: 52 $
|
---|
| 10 | # Last update by $Author: kdeugau $
|
---|
| 11 | ###
|
---|
| 12 |
|
---|
[5] | 13 | use strict;
|
---|
[6] | 14 | use warnings;
|
---|
[7] | 15 | use Fcntl; # for sysopen flags
|
---|
[36] | 16 | use Cwd 'abs_path'; # for finding where files really are
|
---|
[5] | 17 |
|
---|
[10] | 18 | # regex debugger
|
---|
| 19 | #use re "debug";
|
---|
| 20 |
|
---|
[3] | 21 | # Program flow:
|
---|
| 22 | # -> Parse/execute "system" config/macros (if any - should be rare)
|
---|
| 23 | # -> Parse/execute "user" config/macros (if any - *my* requirement is %_topdir)
|
---|
| 24 | # -> Parse command line for options, spec file/tarball/.src.deb (NB - also accept .src.rpm)
|
---|
| 25 |
|
---|
[30] | 26 | sub expandmacros;
|
---|
| 27 |
|
---|
[2] | 28 | # User's prefs for dirs, environment, etc,etc,etc.
|
---|
| 29 | # config file ~/.debmacros
|
---|
| 30 | # Default ordered search paths for config/macros:
|
---|
| 31 | # /usr/lib/rpm/rpmrc /usr/lib/rpm/redhat/rpmrc /etc/rpmrc ~/.rpmrc
|
---|
| 32 | # /usr/lib/rpm/macros /usr/lib/rpm/redhat/macros /etc/rpm/macros ~/.rpmmacros
|
---|
| 33 | # **NOTE: May be possible to (ab)use bits of debhelper
|
---|
| 34 |
|
---|
| 35 | # Build tree
|
---|
| 36 | # default is /usr/src/debian/{BUILD,SOURCES,SPECS,DEBS,SDEBS}
|
---|
| 37 |
|
---|
[3] | 38 | # Globals
|
---|
| 39 | my $specfile;
|
---|
| 40 | my $tarball;
|
---|
| 41 | my $srcpkg;
|
---|
[7] | 42 | my $cmdbuildroot;
|
---|
| 43 | my $tarballdir; # This should really be initialized, but the coding makes it, um, ugly.
|
---|
[23] | 44 | my %specglobals; # For %define's in specfile, among other things.
|
---|
[6] | 45 |
|
---|
| 46 | # Initialized globals
|
---|
[3] | 47 | my $verbosity = 0;
|
---|
[4] | 48 | my %cmdopts = (type => '',
|
---|
| 49 | stage => 'a',
|
---|
| 50 | short => 'n'
|
---|
| 51 | );
|
---|
[6] | 52 | my $topdir = "/usr/src/debian";
|
---|
[13] | 53 | my $buildroot = "%{_tmppath}/%{name}-%{version}-%{release}.root".int(rand(99998)+1);
|
---|
[6] | 54 |
|
---|
| 55 | # "Constants"
|
---|
[4] | 56 | my %targets = ('p' => 'Prep',
|
---|
| 57 | 'c' => 'Compile',
|
---|
| 58 | 'i' => 'Install',
|
---|
| 59 | 'l' => 'Verify %files',
|
---|
| 60 | 'a' => 'Build binary and source',
|
---|
| 61 | 'b' => 'Build binary',
|
---|
| 62 | 's' => 'Build source'
|
---|
| 63 | );
|
---|
[6] | 64 | my $scriptletbase =
|
---|
| 65 | q(#!/bin/sh
|
---|
[3] | 66 |
|
---|
[6] | 67 | RPM_SOURCE_DIR="%{_topdir}/SOURCES"
|
---|
| 68 | RPM_BUILD_DIR="%{_topdir}/BUILD"
|
---|
| 69 | RPM_OPT_FLAGS="-O2 -g -march=i386 -mcpu=i686"
|
---|
| 70 | RPM_ARCH="i386"
|
---|
| 71 | RPM_OS="linux"
|
---|
| 72 | export RPM_SOURCE_DIR RPM_BUILD_DIR RPM_OPT_FLAGS RPM_ARCH RPM_OS
|
---|
| 73 | RPM_DOC_DIR="/usr/share/doc"
|
---|
| 74 | export RPM_DOC_DIR
|
---|
| 75 | RPM_PACKAGE_NAME="%{name}"
|
---|
| 76 | RPM_PACKAGE_VERSION="%{version}"
|
---|
| 77 | RPM_PACKAGE_RELEASE="%{release}"
|
---|
| 78 | export RPM_PACKAGE_NAME RPM_PACKAGE_VERSION RPM_PACKAGE_RELEASE
|
---|
| 79 | RPM_BUILD_ROOT="%{buildroot}"
|
---|
| 80 | export RPM_BUILD_ROOT
|
---|
[10] | 81 | );
|
---|
| 82 | foreach (`dpkg-architecture`) {
|
---|
| 83 | s/=(.+)/="$1"/;
|
---|
| 84 | $scriptletbase .= " $_";
|
---|
| 85 | }
|
---|
| 86 | $scriptletbase .=
|
---|
| 87 | q(
|
---|
[6] | 88 | set -x
|
---|
| 89 | umask 022
|
---|
| 90 | cd %{_topdir}/BUILD
|
---|
| 91 | );
|
---|
| 92 |
|
---|
[5] | 93 | # Package data
|
---|
| 94 | # This is the form of $pkgdata{pkgname}{meta}
|
---|
| 95 | # meta includes Summary, Name, Version, Release, Group, Copyright,
|
---|
[38] | 96 | # Source, URL, Packager, BuildRoot, Description, BuildReq(uires),
|
---|
| 97 | # Requires, Provides
|
---|
[6] | 98 | # 10/31/2005 Maybe this should be flatter? -kgd
|
---|
[5] | 99 | my %pkgdata;
|
---|
[27] | 100 | my @pkglist = ('main'); #sigh
|
---|
[23] | 101 | # Files listing. Embedding this in %pkgdata would be, um, messy.
|
---|
| 102 | my %filelist;
|
---|
[40] | 103 | my $buildreq = '';
|
---|
[5] | 104 |
|
---|
[6] | 105 | # Scriptlets
|
---|
[48] | 106 | my $prepscript = '';
|
---|
| 107 | my $buildscript = '';
|
---|
[23] | 108 | # %install doesn't need the full treatment from %clean; just an empty place to install to.
|
---|
| 109 | # NB - rpm doesn't do this; is it really necessary?
|
---|
| 110 | my $installscript = '[ "$RPM_BUILD_ROOT" != "/" ] && rm -rf $RPM_BUILD_ROOT'."\n";
|
---|
[48] | 111 | my $cleanscript = '';
|
---|
[16] | 112 | # pre/post (un)install scripts. Note that these will likely barf as-is. :/
|
---|
| 113 | my $preinstscript = '';
|
---|
| 114 | my $postinstscript = '';
|
---|
| 115 | my $preuninstscript = '';
|
---|
| 116 | my $postuninstscript = '';
|
---|
[6] | 117 |
|
---|
[5] | 118 | die "Not enough arguments\n" if #$argv == 0;
|
---|
| 119 |
|
---|
[13] | 120 | # Snag some environment data
|
---|
| 121 | my $tmpdir;
|
---|
| 122 | if (defined $ENV{TMP} && $ENV{TMP} =~ /^(\/var)?\/tmp$/) {
|
---|
| 123 | $tmpdir = $ENV{TMP};
|
---|
| 124 | } else {
|
---|
| 125 | $tmpdir = "/var/tmp";
|
---|
| 126 | }
|
---|
| 127 |
|
---|
[7] | 128 | ##main
|
---|
| 129 |
|
---|
[4] | 130 | load_userconfig();
|
---|
[3] | 131 | parse_cmd();
|
---|
| 132 |
|
---|
[50] | 133 | if ($cmdopts{install}) {
|
---|
| 134 | install_sdeb();
|
---|
| 135 | exit 0;
|
---|
| 136 | }
|
---|
| 137 |
|
---|
| 138 | # Stick --rebuild handling in here - basically install_sdeb()
|
---|
| 139 | # followed by tweaking options to run with -ba
|
---|
| 140 |
|
---|
[7] | 141 | if ($cmdopts{type} eq 'b') {
|
---|
| 142 | # Need to read the spec file to find the tarball. Note that
|
---|
| 143 | # this also generates most of the shell script required.
|
---|
| 144 | parse_spec();
|
---|
[38] | 145 | die "Can't build $pkgdata{main}{name}: build requirements not met.\n"
|
---|
| 146 | if !checkbuildreq();
|
---|
[7] | 147 | }
|
---|
| 148 |
|
---|
[35] | 149 | # -> srcpkg if -.s
|
---|
| 150 | if ($cmdopts{stage} eq 's') {
|
---|
| 151 | srcpackage();
|
---|
| 152 | exit 0;
|
---|
| 153 | }
|
---|
| 154 |
|
---|
[4] | 155 | # Hokay. Need to:
|
---|
[14] | 156 | # -> prep if -.p OR (-.[cilabs] AND !--short-circuit)
|
---|
[7] | 157 | if ($cmdopts{stage} eq 'p' || ($cmdopts{stage} =~ /[cilabs]/ && $cmdopts{short} ne 'y')) {
|
---|
| 158 | prep();
|
---|
| 159 | }
|
---|
[14] | 160 | # -> build if -.c OR (-.[ilabs] AND !--short-circuit)
|
---|
[7] | 161 | if ($cmdopts{stage} eq 'c' || ($cmdopts{stage} =~ /[ilabs]/ && $cmdopts{short} ne 'y')) {
|
---|
| 162 | build();
|
---|
| 163 | }
|
---|
[14] | 164 | # -> install if -.[ilabs]
|
---|
[28] | 165 | #if ($cmdopts{stage} eq 'i' || ($cmdopts{stage} =~ /[labs]/ && $cmdopts{short} ne 'y')) {
|
---|
| 166 | if ($cmdopts{stage} =~ /[ilabs]/) {
|
---|
[7] | 167 | install();
|
---|
[30] | 168 | #foreach my $pkg (@pkglist) {
|
---|
| 169 | # print "files in $pkg:\n ".$filelist{$pkg}."\n";
|
---|
| 170 | #}
|
---|
| 171 |
|
---|
[7] | 172 | }
|
---|
[14] | 173 | # -> binpkg and srcpkg if -.a
|
---|
[7] | 174 | if ($cmdopts{stage} eq 'a') {
|
---|
[4] | 175 | binpackage();
|
---|
[7] | 176 | srcpackage();
|
---|
[4] | 177 | }
|
---|
[14] | 178 | # -> binpkg if -.b
|
---|
[7] | 179 | if ($cmdopts{stage} eq 'b') {
|
---|
| 180 | binpackage();
|
---|
| 181 | }
|
---|
[4] | 182 |
|
---|
| 183 | # Just in case.
|
---|
| 184 | exit 0;
|
---|
| 185 |
|
---|
| 186 |
|
---|
| 187 | ## load_userconfig()
|
---|
| 188 | # Loads user configuration (if any)
|
---|
| 189 | # Currently only handles .debmacros
|
---|
| 190 | # Needs to handle "other files"
|
---|
| 191 | sub load_userconfig {
|
---|
[5] | 192 | my (undef,undef,undef,undef,undef,undef,undef,$homedir,undef) = getpwuid($<);
|
---|
[4] | 193 | if (-e "$homedir/.debmacros") {
|
---|
| 194 | open USERMACROS,"<$homedir/.debmacros";
|
---|
| 195 | while (<USERMACROS>) {
|
---|
[7] | 196 | # And we also only handle a few macros at the moment.
|
---|
[4] | 197 | if (/^\%_topdir/) {
|
---|
[5] | 198 | my (undef,$tmp) = split /\s+/, $_;
|
---|
| 199 | $topdir = $tmp;
|
---|
[4] | 200 | }
|
---|
| 201 | }
|
---|
| 202 | }
|
---|
| 203 | } # end load_userconfig()
|
---|
| 204 |
|
---|
| 205 |
|
---|
[3] | 206 | ## parse_cmd()
|
---|
[4] | 207 | # Parses command line into global hash %cmdopts, other globals
|
---|
[3] | 208 | # Options based on rpmbuild's options
|
---|
| 209 | sub parse_cmd {
|
---|
| 210 | # Don't feel like coding my own option parser...
|
---|
| 211 | #use Getopt::Long;
|
---|
| 212 | # ... but I may have to: (OTOH, rpm uses popt, so maybe we can too.)
|
---|
| 213 | #use Getopt::Popt qw(:all);
|
---|
[4] | 214 | # Or not. >:( Stupid Debian lack of findable Perl module names in packages.
|
---|
[3] | 215 |
|
---|
| 216 | # Stuff it.
|
---|
[4] | 217 | my $prevopt = '';
|
---|
[3] | 218 | foreach (@ARGV) {
|
---|
| 219 | chomp;
|
---|
[7] | 220 |
|
---|
[3] | 221 | # Is it an option?
|
---|
| 222 | if (/^-/) {
|
---|
[7] | 223 |
|
---|
[3] | 224 | # Is it a long option?
|
---|
| 225 | if (/^--/) {
|
---|
[4] | 226 | if (/^--short-circuit/) {
|
---|
| 227 | $cmdopts{short} = 'y';
|
---|
[5] | 228 | } elsif (/^--rebuild/) {
|
---|
| 229 | $cmdopts{type} = 's';
|
---|
[4] | 230 | } else {
|
---|
| 231 | print "Long opt $_\n";
|
---|
| 232 | }
|
---|
[3] | 233 | } else {
|
---|
[14] | 234 | # Not a long option
|
---|
[5] | 235 | if (/^-[bt]/) {
|
---|
| 236 | if ($cmdopts{stage} eq 's') {
|
---|
| 237 | # Mutually exclusive options.
|
---|
| 238 | die "Can't use $_ with --rebuild\n";
|
---|
| 239 | } else {
|
---|
[14] | 240 | # Capture the type (from "bare" files or tarball) and the stage (prep, build, etc)
|
---|
[5] | 241 | ($cmdopts{stage}) = (/^-[bt]([pcilabs])/);
|
---|
| 242 | ($cmdopts{type}) = (/^-([bt])[pcilabs]/);
|
---|
| 243 | }
|
---|
[4] | 244 | } elsif (/^-v/) {
|
---|
| 245 | # bump verbosity. Not sure what I'll actually do here...
|
---|
[50] | 246 | } elsif (/^-i/) {
|
---|
| 247 | $cmdopts{install} = 1;
|
---|
| 248 | $prevopt = '-i';
|
---|
[4] | 249 | } else {
|
---|
| 250 | die "Bad option $_\n";
|
---|
| 251 | }
|
---|
[3] | 252 | }
|
---|
[14] | 253 |
|
---|
| 254 | } else { # Not an option argument
|
---|
| 255 |
|
---|
[5] | 256 | # --buildroot is the only option that takes an argument
|
---|
| 257 | # Therefore, any *other* bare arguments are the spec file,
|
---|
| 258 | # tarball, or source package we're operating on - depending
|
---|
| 259 | # on which one we meet.
|
---|
| 260 | if ($prevopt eq '--buildroot') {
|
---|
[7] | 261 | $cmdbuildroot = $_;
|
---|
[50] | 262 | } elsif ($prevopt eq '-i') {
|
---|
| 263 | $srcpkg = $_;
|
---|
[5] | 264 | } else {
|
---|
| 265 | if ($cmdopts{type} eq 's') {
|
---|
| 266 | # Source package
|
---|
[50] | 267 | if (!/(sdeb|\.src\.rpm)$/) {
|
---|
[5] | 268 | die "Can't --rebuild with $_\n";
|
---|
| 269 | }
|
---|
[50] | 270 | $srcpkg = $_;
|
---|
[5] | 271 | } elsif ($cmdopts{type} eq 'b') {
|
---|
| 272 | $specfile = $_;
|
---|
| 273 | # Spec file
|
---|
| 274 | } else {
|
---|
| 275 | # Tarball
|
---|
| 276 | }
|
---|
| 277 | }
|
---|
[3] | 278 | }
|
---|
[7] | 279 | $prevopt = $_;
|
---|
| 280 | } # foreach @ARGV
|
---|
[4] | 281 |
|
---|
| 282 | # Some cross-checks. rpmbuild limits --short-circuit to just
|
---|
| 283 | # the "compile" and "install" targets - with good reason IMO.
|
---|
[14] | 284 | # Note that --short-circuit with -.p is not really an error, just redundant.
|
---|
[4] | 285 | # NB - this is NOT fatal, just ignored!
|
---|
[10] | 286 | if ($cmdopts{short} eq 'y' && $cmdopts{stage} =~ /[labs]/) {
|
---|
[4] | 287 | warn "Can't use --short-circuit for $targets{$cmdopts{stage}} stage. Ignoring.\n";
|
---|
[28] | 288 | $cmdopts{short} = 'n';
|
---|
[4] | 289 | }
|
---|
[14] | 290 |
|
---|
[3] | 291 | # Valid options, with example arguments (if any):
|
---|
| 292 | # Build from .spec file; mutually exclusive:
|
---|
| 293 | # -bp
|
---|
| 294 | # -bc
|
---|
| 295 | # -bi
|
---|
| 296 | # -bl
|
---|
| 297 | # -ba
|
---|
| 298 | # -bb
|
---|
| 299 | # -bs
|
---|
| 300 | # Build from tarball; mutually exclusive:
|
---|
| 301 | # -tp
|
---|
| 302 | # -tc
|
---|
| 303 | # -ti
|
---|
| 304 | # -ta
|
---|
| 305 | # -tb
|
---|
| 306 | # -ts
|
---|
| 307 | # Build from .src.(deb|rpm)
|
---|
| 308 | # --rebuild
|
---|
| 309 | # --recompile
|
---|
| 310 |
|
---|
| 311 | # General options
|
---|
| 312 | # --buildroot=DIRECTORY
|
---|
| 313 | # --clean
|
---|
| 314 | # --nobuild
|
---|
| 315 | # --nodeps
|
---|
| 316 | # --nodirtokens
|
---|
| 317 | # --rmsource
|
---|
| 318 | # --rmspec
|
---|
| 319 | # --short-circuit
|
---|
| 320 | # --target=CPU-VENDOR-OS
|
---|
| 321 |
|
---|
| 322 | #my $popt = new Getopt::Popt(argv => \@ARGV, options => \@optionsTable);
|
---|
| 323 |
|
---|
| 324 | } # end parse_cmd()
|
---|
| 325 |
|
---|
[4] | 326 |
|
---|
[5] | 327 | ## parse_spec()
|
---|
[14] | 328 | # Parse the .spec file.
|
---|
[5] | 329 | sub parse_spec {
|
---|
| 330 | open SPECFILE,"<$specfile";
|
---|
| 331 |
|
---|
[6] | 332 | LINE: while (<SPECFILE>) {
|
---|
[14] | 333 | next if /^#/; # Ignore comments...
|
---|
| 334 | next if /^\s+$/; # ... and blank lines.
|
---|
| 335 |
|
---|
[5] | 336 | if (/^\%/) {
|
---|
| 337 | # A macro that needs further processing.
|
---|
[14] | 338 |
|
---|
[23] | 339 | if (/^\%define\s+([^\s]+)\s+([^\s]+)/) {
|
---|
| 340 | $specglobals{$1} = expandmacros($2,'g');
|
---|
| 341 | }
|
---|
| 342 |
|
---|
[27] | 343 | if (/^\%description(?:\s+(?:-n\s+)?([a-zA-Z0-9_.-]+))?/) {
|
---|
| 344 | my $subname = "main";
|
---|
| 345 | if ($1) {
|
---|
[49] | 346 | my $tmp = $1;
|
---|
| 347 | if (/-n/) { $subname = $tmp; } else { $subname = "$pkgdata{main}{name}-$tmp"; }
|
---|
[27] | 348 | }
|
---|
[8] | 349 | while (<SPECFILE>) {
|
---|
[39] | 350 | next if /^#/; # Messy. Should be possible to do better. :/
|
---|
[8] | 351 | redo LINE if /^\%/;
|
---|
[27] | 352 | $pkgdata{$subname}{desc} .= " $_";
|
---|
[8] | 353 | }
|
---|
[18] | 354 | }
|
---|
[27] | 355 | if (/^\%package\s+(?:-n\s+)?([a-zA-Z0-9_.-]+)/) {
|
---|
[49] | 356 | my $subname = $1;
|
---|
| 357 | if (! /-n/) { $subname = "$pkgdata{main}{name}-$1"; }
|
---|
[27] | 358 | push @pkglist, $subname;
|
---|
| 359 | $pkgdata{$subname}{name} = $subname;
|
---|
| 360 | $pkgdata{$subname}{version} = $pkgdata{main}{version};
|
---|
| 361 | while (<SPECFILE>) {
|
---|
| 362 | redo LINE if /^\%/;
|
---|
[38] | 363 | if (my ($dname,$dvalue) = (/^(Summary|Group|Version|Requires|Provides):\s+(.+)$/i)) {
|
---|
[27] | 364 | $dname =~ tr/[A-Z]/[a-z]/;
|
---|
| 365 | $pkgdata{$subname}{$dname} = $dvalue;
|
---|
| 366 | }
|
---|
| 367 | }
|
---|
| 368 | }
|
---|
[8] | 369 |
|
---|
[6] | 370 | if (/^\%prep/) {
|
---|
| 371 | # %prep section. May have %setup macro; may include %patch tags,
|
---|
| 372 | # may be just a bare shell script.
|
---|
| 373 |
|
---|
| 374 | # This really should be local-ish, but we need just the filename for the source
|
---|
| 375 | $pkgdata{main}{source} =~ s|.+/([^/]+)$|$1|;
|
---|
| 376 |
|
---|
| 377 | # Replace some core macros
|
---|
[14] | 378 | $pkgdata{main}{source} = expandmacros($pkgdata{main}{source},'gp');
|
---|
[6] | 379 |
|
---|
| 380 | PREPSCRIPT: while (<SPECFILE>) {
|
---|
| 381 | if (/^\%setup/) {
|
---|
| 382 | # Parse out the %setup macro. Note that we aren't supporting
|
---|
[14] | 383 | # many of RPM's %setup features.
|
---|
[7] | 384 | $prepscript .= "cd $topdir/BUILD\n";
|
---|
| 385 | if ( /\s+-n\s+([^\s]+)\s+/ ) {
|
---|
| 386 | $tarballdir = $1;
|
---|
| 387 | } else {
|
---|
| 388 | $tarballdir = "$pkgdata{main}{name}-$pkgdata{main}{version}";
|
---|
| 389 | }
|
---|
[21] | 390 | $prepscript .= "rm -rf $tarballdir\ntar -".
|
---|
[6] | 391 | ( $pkgdata{main}{source} =~ /\.tar\.gz$/ ? "z" : "" ).
|
---|
| 392 | ( $pkgdata{main}{source} =~ /\.tar\.bz2$/ ? "j" : "" ).
|
---|
[21] | 393 | ( /\s+-q\s+/ ? '' : 'vv' )."xf ".
|
---|
| 394 | "$topdir/SOURCES/$pkgdata{main}{source}\n".
|
---|
[6] | 395 | qq(STATUS=\$?\nif [ \$STATUS -ne 0 ]; then\n exit \$STATUS\nfi\n).
|
---|
| 396 | ( /\s+-n\s+([^\s]+)\s+/ ?
|
---|
| 397 | "cd $1\n" : "cd $pkgdata{main}{name}-$pkgdata{main}{version}\n" ).
|
---|
| 398 | qq([ `/usr/bin/id -u` = '0' ] && /bin/chown -Rhf root .\n).
|
---|
| 399 | qq([ `/usr/bin/id -u` = '0' ] && /bin/chgrp -Rhf root .\n).
|
---|
| 400 | qq(/bin/chmod -Rf a+rX,g-w,o-w .\n);
|
---|
[10] | 401 | } elsif (/^\%patch([^:]+)\s+(.+)$/) {
|
---|
| 402 | $prepscript .= "patch $2 <$topdir/SOURCES/".$pkgdata{main}{"patch$1"}."\n";
|
---|
[6] | 403 | } else {
|
---|
| 404 | last PREPSCRIPT if /^\%/;
|
---|
| 405 | $prepscript .= $_;
|
---|
| 406 | }
|
---|
| 407 | }
|
---|
| 408 | redo LINE;
|
---|
| 409 | }
|
---|
[12] | 410 | if (/^\%build/) {
|
---|
[6] | 411 | # %build. This is pretty much just a shell script. There
|
---|
| 412 | # *are* a few macros, but we're not going to deal with them yet.
|
---|
[7] | 413 | $buildscript .= "cd $tarballdir\n";
|
---|
[10] | 414 | BUILDSCRIPT: while (<SPECFILE>) {
|
---|
| 415 | if (/^\%configure/) {
|
---|
[12] | 416 | $buildscript .= expandmacros($_,'cgbp');
|
---|
[25] | 417 | } elsif (/^\%\{__make\}/) {
|
---|
[12] | 418 | $buildscript .= expandmacros($_,'mgbp');
|
---|
[10] | 419 | } else {
|
---|
[24] | 420 | last BUILDSCRIPT if /^\%[^{]/;
|
---|
[10] | 421 | $buildscript .= $_;
|
---|
| 422 | }
|
---|
[6] | 423 | }
|
---|
[10] | 424 | redo LINE;
|
---|
[5] | 425 | }
|
---|
[6] | 426 | if (/^\%install/) {
|
---|
[7] | 427 | $installscript .= "cd $tarballdir\n";
|
---|
[12] | 428 | INSTALLSCRIPT: while (<SPECFILE>) {
|
---|
| 429 | if (/^\%makeinstall/) {
|
---|
| 430 | $installscript .= expandmacros($_,'igbp');
|
---|
| 431 | } else {
|
---|
| 432 | last INSTALLSCRIPT if /^\%/;
|
---|
| 433 | $installscript .= $_;
|
---|
| 434 | }
|
---|
| 435 | }
|
---|
| 436 | redo LINE;
|
---|
[6] | 437 | }
|
---|
| 438 | if (/^\%clean/) {
|
---|
[7] | 439 | while (<SPECFILE>) {
|
---|
| 440 | redo LINE if /^\%/;
|
---|
| 441 | $cleanscript .= $_;
|
---|
| 442 | }
|
---|
[12] | 443 | $cleanscript = expandmacros($cleanscript,'gp');
|
---|
[6] | 444 | }
|
---|
[29] | 445 |
|
---|
[16] | 446 | # pre/post (un)install scripts
|
---|
| 447 | if (/^\%pre\b/) {
|
---|
| 448 | while (<SPECFILE>) {
|
---|
| 449 | redo LINE if /^\%/;
|
---|
| 450 | $preinstscript .= $_;
|
---|
| 451 | }
|
---|
[6] | 452 | }
|
---|
[16] | 453 | if (/^\%post\b/) {
|
---|
| 454 | while (<SPECFILE>) {
|
---|
| 455 | redo LINE if /^\%/;
|
---|
| 456 | $postinstscript .= $_;
|
---|
| 457 | }
|
---|
[6] | 458 | }
|
---|
[16] | 459 | if (/^\%preun\b/) {
|
---|
| 460 | while (<SPECFILE>) {
|
---|
| 461 | redo LINE if /^\%/;
|
---|
| 462 | $preuninstscript .= $_;
|
---|
| 463 | }
|
---|
| 464 | }
|
---|
| 465 | if (/^\%postun\b/) {
|
---|
| 466 | while (<SPECFILE>) {
|
---|
| 467 | redo LINE if /^\%/;
|
---|
| 468 | $postuninstscript .= $_;
|
---|
| 469 | }
|
---|
| 470 | }
|
---|
[29] | 471 | # done %pre/%post scripts
|
---|
| 472 |
|
---|
[23] | 473 | if (/^\%files(?:\s+(?:-n\s+)?([a-zA-z0-9]+))?/) {
|
---|
| 474 | my $pkgname = 'main';
|
---|
[29] | 475 | if ($1) { # Magic to add entries to the right list of files
|
---|
[49] | 476 | my $tmp = $1;
|
---|
| 477 | if (/-n/) { $pkgname = $tmp; } else { $pkgname = "$pkgdata{main}{name}-$tmp"; }
|
---|
[23] | 478 | }
|
---|
[37] | 479 |
|
---|
| 480 | # Set this now, so it can be flipped a bit later, and used much later.
|
---|
| 481 | #$pkgdata{$pkgname}{conffiles} = 0;
|
---|
| 482 |
|
---|
[27] | 483 | while (<SPECFILE>) {
|
---|
[29] | 484 | chomp;
|
---|
[45] | 485 | next if /^#/;
|
---|
[29] | 486 | # need to update this to deal (properly) with %dir, %attr, etc
|
---|
| 487 | next if /^\%dir/;
|
---|
| 488 | next if /^\%attr/;
|
---|
| 489 | next if /^\%defattr/;
|
---|
| 490 |
|
---|
[37] | 491 | # Debian dpkg doesn't speak "%docdir". Meh.
|
---|
| 492 | next if /^\%docdir/;
|
---|
| 493 |
|
---|
| 494 | # Conffiles. Note that Debian and RH have similar, but not
|
---|
| 495 | # *quite* identical ideas of what constitutes a conffile. Nrgh.
|
---|
| 496 | if (/^\%config\s+(.+)$/) {
|
---|
| 497 | $pkgdata{$pkgname}{conffiles} = 1; # Flag it for later
|
---|
| 498 | my $tmp = $1; # Now we can mangleificationate it. And we probably need to. :/
|
---|
[46] | 499 | $tmp = expandmacros($tmp, 'gp'); # Expand common macros
|
---|
[37] | 500 | if ($tmp !~ /\s+/) {
|
---|
| 501 | # Simplest case, just a file. Whew.
|
---|
| 502 | push @{$pkgdata{$pkgname}{conflist}}, $tmp;
|
---|
| 503 | $filelist{$pkgname} .= " $tmp";
|
---|
| 504 | } else {
|
---|
| 505 | # Wot? Spaces? That means extra %-macros. Which, for the most part, can be ignored.
|
---|
| 506 | ($tmp) = ($tmp =~ /.+\s([^\s]+)/); # Strip everything before the last space
|
---|
| 507 | push @{$pkgdata{$pkgname}{conflist}}, $tmp;
|
---|
| 508 | $filelist{$pkgname} .= " $tmp";
|
---|
| 509 | }
|
---|
| 510 | next;
|
---|
| 511 | }
|
---|
| 512 |
|
---|
[29] | 513 | # and finally we can fall through %{_<FHS>}-prefixed locations...
|
---|
[30] | 514 | if (/^\%\{_/) {
|
---|
| 515 | $filelist{$pkgname} .= " $_";
|
---|
| 516 | next;
|
---|
| 517 | }
|
---|
| 518 | # EW. Necessary to clear up %define expansions before we exit with redo.
|
---|
| 519 | $_ = expandmacros $_, 'g';
|
---|
[29] | 520 |
|
---|
| 521 | # ... unknown or "next section" % directives ...
|
---|
[27] | 522 | redo LINE if /^\%/;
|
---|
[29] | 523 |
|
---|
| 524 | # ... and "normal" files
|
---|
[27] | 525 | $filelist{$pkgname} .= " $_";
|
---|
| 526 | }
|
---|
[46] | 527 | $filelist{$pkgname} = expandmacros($filelist{$pkgname}, 'gp');
|
---|
[29] | 528 | } # done %file section
|
---|
| 529 |
|
---|
[18] | 530 | if (/^\%changelog/) {
|
---|
| 531 | $pkgdata{main}{changelog} = '';
|
---|
| 532 | while (<SPECFILE>) {
|
---|
| 533 | redo LINE if /^\%/;
|
---|
| 534 | $pkgdata{main}{changelog} .= $_;
|
---|
| 535 | }
|
---|
| 536 | }
|
---|
[14] | 537 |
|
---|
| 538 | } else { # Data from the spec file "header"
|
---|
| 539 |
|
---|
[5] | 540 | if (/^summary:\s+(.+)/i) {
|
---|
| 541 | $pkgdata{main}{summary} = $1;
|
---|
| 542 | } elsif (/^name:\s+(.+)/i) {
|
---|
[24] | 543 | $pkgdata{main}{name} = expandmacros($1,'g');
|
---|
[5] | 544 | } elsif (/^version:\s+(.+)/i) {
|
---|
[24] | 545 | $pkgdata{main}{version} = expandmacros($1,'g');
|
---|
[5] | 546 | } elsif (/^release:\s+(.+)/i) {
|
---|
[24] | 547 | $pkgdata{main}{release} = expandmacros($1,'g');
|
---|
[5] | 548 | } elsif (/^group:\s+(.+)/i) {
|
---|
| 549 | $pkgdata{main}{group} = $1;
|
---|
| 550 | } elsif (/^copyright:\s+(.+)/i) {
|
---|
| 551 | $pkgdata{main}{copyright} = $1;
|
---|
| 552 | } elsif (/^url:\s+(.+)/i) {
|
---|
| 553 | $pkgdata{main}{url} = $1;
|
---|
| 554 | } elsif (/^packager:\s+(.+)/i) {
|
---|
| 555 | $pkgdata{main}{packager} = $1;
|
---|
[7] | 556 | } elsif (/^buildroot:\s+(.+)/i) {
|
---|
| 557 | $buildroot = $1;
|
---|
[5] | 558 | } elsif (/^source:\s+(.+)/i) {
|
---|
| 559 | $pkgdata{main}{source} = $1;
|
---|
[6] | 560 | die "Unknown tarball format $1\n" if $1 !~ /\.tar\.(?:gz|bz2)$/;
|
---|
[15] | 561 | } elsif (/^source([0-9]+):\s+(.+)/i) {
|
---|
| 562 | $pkgdata{sources}{$1} = $2;
|
---|
[10] | 563 | } elsif (/^patch([^:]+):\s+(.+)$/i) {
|
---|
[26] | 564 | my $patchname = "patch$1";
|
---|
| 565 | $pkgdata{main}{$patchname} = $2;
|
---|
| 566 | if ($pkgdata{main}{$patchname} =~ /\//) {
|
---|
| 567 | # URL-style patch. Rare but not unheard-of.
|
---|
| 568 | my @patchbits = split '/', $pkgdata{main}{$patchname};
|
---|
| 569 | $pkgdata{main}{$patchname} = $patchbits[$#patchbits];
|
---|
| 570 | }
|
---|
[38] | 571 | } elsif (/^buildreq(?:uires)?:\s+(.+)/i) {
|
---|
| 572 | $buildreq .= ", $1";
|
---|
| 573 | } elsif (/^requires:\s+(.+)/i) {
|
---|
| 574 | $pkgdata{main}{requires} .= ", $1";
|
---|
| 575 | } elsif (/^provides:\s+(.+)/i) {
|
---|
| 576 | $pkgdata{main}{provides} .= ", $1";
|
---|
[51] | 577 | } elsif (/^conflicts:\s+(.+)/i) {
|
---|
| 578 | $pkgdata{main}{conflicts} .= ", $1";
|
---|
[5] | 579 | }
|
---|
| 580 | #Name: suwrap
|
---|
| 581 | #Version: 0.04
|
---|
| 582 | #Release: 3
|
---|
| 583 | #Group: Applications/System
|
---|
| 584 | #Copyright: WebHart internal ONLY. :(
|
---|
| 585 | #BuildArchitectures: i386
|
---|
| 586 | #BuildRoot: /tmp/%{name}-%{version}
|
---|
| 587 | #Url: http://virtual.webhart.net
|
---|
| 588 | #Packager: Kris Deugau <kdeugau@deepnet.cx>
|
---|
| 589 | #Source: ftp://virtual.webhart.net/%{name}-%{version}.tar.gz
|
---|
| 590 |
|
---|
| 591 | }
|
---|
| 592 | }
|
---|
[7] | 593 |
|
---|
[14] | 594 | # Parse and replace some more macros. More will be replaced even later.
|
---|
| 595 |
|
---|
[10] | 596 | # Expand macros as necessary.
|
---|
[12] | 597 | $scriptletbase = expandmacros($scriptletbase,'gp');
|
---|
[7] | 598 |
|
---|
| 599 | $buildroot = $cmdbuildroot if $cmdbuildroot;
|
---|
[12] | 600 | $buildroot = expandmacros($buildroot,'gp');
|
---|
[7] | 601 |
|
---|
[16] | 602 | close SPECFILE;
|
---|
[5] | 603 | } # end parse_spec()
|
---|
| 604 |
|
---|
| 605 |
|
---|
[7] | 606 | ## prep()
|
---|
[14] | 607 | # Writes and executes the %prep script (mostly) built while reading the spec file.
|
---|
[7] | 608 | sub prep {
|
---|
[10] | 609 | # Replace some things here just to make sure.
|
---|
[12] | 610 | $prepscript = expandmacros($prepscript,'gp');
|
---|
[10] | 611 |
|
---|
[24] | 612 | #print $prepscript; exit 0;
|
---|
[23] | 613 |
|
---|
[10] | 614 | # create script filename
|
---|
[13] | 615 | my $prepscriptfile = "$tmpdir/deb-tmp.prep.".int(rand(99998)+1);
|
---|
[10] | 616 | sysopen(PREPSCRIPT, $prepscriptfile, O_RDWR | O_CREAT | O_EXCL | O_NOFOLLOW)
|
---|
[7] | 617 | or die $!;
|
---|
[10] | 618 | print PREPSCRIPT $scriptletbase;
|
---|
| 619 | print PREPSCRIPT $prepscript;
|
---|
| 620 | close PREPSCRIPT;
|
---|
[7] | 621 |
|
---|
[10] | 622 | # execute
|
---|
| 623 | print "Calling \%prep script $prepscriptfile...\n";
|
---|
| 624 | system("/bin/sh -e $prepscriptfile") == 0
|
---|
[14] | 625 | or die "Can't exec: $!\n";
|
---|
[7] | 626 |
|
---|
[10] | 627 | # and clean up
|
---|
| 628 | unlink $prepscriptfile;
|
---|
[7] | 629 | } # end prep()
|
---|
| 630 |
|
---|
| 631 |
|
---|
[5] | 632 | ## build()
|
---|
[14] | 633 | # Writes and executes the %build script (mostly) built while reading the spec file.
|
---|
[5] | 634 | sub build {
|
---|
[12] | 635 | # Expand the macros
|
---|
| 636 | $buildscript = expandmacros($buildscript,'cgbp');
|
---|
| 637 |
|
---|
[7] | 638 | # create script filename
|
---|
[13] | 639 | my $buildscriptfile = "$tmpdir/deb-tmp.build.".int(rand(99998)+1);
|
---|
[7] | 640 | sysopen(BUILDSCRIPT, $buildscriptfile, O_RDWR | O_CREAT | O_EXCL | O_NOFOLLOW)
|
---|
| 641 | or die $!;
|
---|
| 642 | print BUILDSCRIPT $scriptletbase;
|
---|
| 643 | print BUILDSCRIPT $buildscript;
|
---|
| 644 | close BUILDSCRIPT;
|
---|
| 645 |
|
---|
| 646 | # execute
|
---|
| 647 | print "Calling \%build script $buildscriptfile...\n";
|
---|
| 648 | system("/bin/sh -e $buildscriptfile") == 0
|
---|
[14] | 649 | or die "Can't exec: $!\n";
|
---|
[7] | 650 |
|
---|
| 651 | # and clean up
|
---|
| 652 | unlink $buildscriptfile;
|
---|
[5] | 653 | } # end build()
|
---|
| 654 |
|
---|
| 655 |
|
---|
[7] | 656 | ## install()
|
---|
[14] | 657 | # Writes and executes the %install script (mostly) built while reading the spec file.
|
---|
[7] | 658 | sub install {
|
---|
[12] | 659 | # Expand the macros
|
---|
| 660 | $installscript = expandmacros($installscript,'igbp');
|
---|
| 661 |
|
---|
[7] | 662 | # create script filename
|
---|
[13] | 663 | my $installscriptfile = "$tmpdir/deb-tmp.inst.".int(rand(99998)+1);
|
---|
[7] | 664 | sysopen(INSTSCRIPT, $installscriptfile, O_RDWR | O_CREAT | O_EXCL | O_NOFOLLOW)
|
---|
| 665 | or die $!;
|
---|
| 666 | print INSTSCRIPT $scriptletbase;
|
---|
[23] | 667 | # print INSTSCRIPT $cleanscript; # Clean up our install target before installing into it.
|
---|
[7] | 668 | print INSTSCRIPT $installscript;
|
---|
| 669 | close INSTSCRIPT;
|
---|
| 670 |
|
---|
| 671 | # execute
|
---|
| 672 | print "Calling \%install script $installscriptfile...\n";
|
---|
| 673 | system("/bin/sh -e $installscriptfile") == 0
|
---|
[14] | 674 | or die "Can't exec: $!\n";
|
---|
[7] | 675 |
|
---|
| 676 | # and clean up
|
---|
| 677 | unlink $installscriptfile;
|
---|
| 678 | } # end install()
|
---|
| 679 |
|
---|
| 680 |
|
---|
[8] | 681 | ## binpackage()
|
---|
| 682 | # Creates the binary .deb package from the installed tree in $buildroot.
|
---|
[14] | 683 | # Writes and executes a shell script to do so.
|
---|
| 684 | # Creates miscellaneous files required by dpkg-deb to actually build the package file.
|
---|
[27] | 685 | # Should handle simple subpackages
|
---|
[8] | 686 | sub binpackage {
|
---|
[14] | 687 | # Make sure we have somewhere to write the .deb file
|
---|
[9] | 688 | if (!-e "$topdir/DEBS/i386") {
|
---|
| 689 | mkdir "$topdir/DEBS/i386";
|
---|
| 690 | }
|
---|
[14] | 691 |
|
---|
[27] | 692 | foreach my $pkg (@pkglist) {
|
---|
[8] | 693 |
|
---|
[27] | 694 | # Gotta do this first, otherwise we don't have a place to move files from %files
|
---|
| 695 | mkdir "$buildroot/$pkg";
|
---|
[28] | 696 |
|
---|
[30] | 697 | # Eliminate any lingering % macros
|
---|
| 698 | $filelist{$pkg} = expandmacros $filelist{$pkg}, 'g';
|
---|
| 699 |
|
---|
[27] | 700 | my @pkgfilelist = split ' ', $filelist{$pkg};
|
---|
| 701 | foreach my $pkgfile (@pkgfilelist) {
|
---|
[37] | 702 | $pkgfile = expandmacros($pkgfile, 'gp');
|
---|
[44] | 703 | my ($fpath,$fname) = ($pkgfile =~ m|(.+?/?)?([^/]+)$|); # We don't need $fname now, but we might.
|
---|
| 704 | qx { mkdir -p $buildroot/$pkg$fpath }
|
---|
| 705 | if $fpath && $fpath ne '';
|
---|
| 706 | qx { mv $buildroot$pkgfile $buildroot/$pkg$fpath };
|
---|
[27] | 707 | }
|
---|
[28] | 708 |
|
---|
[38] | 709 | # Get the "Depends" (Requires) a la RPM. Ish. We strip the leading
|
---|
| 710 | # comma and space here (if needed) in case there were "Requires" specified
|
---|
| 711 | # in the spec file - those would precede these.
|
---|
[47] | 712 | ($pkgdata{$pkg}{requires} .= getreqs("$buildroot/$pkg")) =~ s/^, //;
|
---|
[38] | 713 |
|
---|
| 714 | # Do this here since we're doing {depends}...
|
---|
[41] | 715 | if (defined($pkgdata{$pkg}{provides})) {
|
---|
| 716 | $pkgdata{$pkg}{provides} =~ s/^, //;
|
---|
| 717 | $pkgdata{$pkg}{provides} = expandmacros($pkgdata{$pkg}{provides},'gp');
|
---|
| 718 | }
|
---|
[51] | 719 | if (defined($pkgdata{$pkg}{conflicts})) {
|
---|
| 720 | $pkgdata{$pkg}{conflicts} =~ s/^, //;
|
---|
| 721 | $pkgdata{$pkg}{conflicts} = expandmacros($pkgdata{$pkg}{conflicts},'gp');
|
---|
| 722 | }
|
---|
[38] | 723 |
|
---|
[27] | 724 | # Gotta do this next, otherwise the control file has nowhere to go. >:(
|
---|
| 725 | mkdir "$buildroot/$pkg/DEBIAN";
|
---|
| 726 |
|
---|
[33] | 727 | # Hack the filename for the package into a Debian-tool-compatible format. GRRRRRR!!!!!
|
---|
| 728 | # Have I mentioned I hate Debian Policy?
|
---|
| 729 | $pkgdata{$pkg}{name} =~ tr/_/-/;
|
---|
| 730 |
|
---|
[27] | 731 | # create script filename
|
---|
| 732 | my $debscriptfile = "$tmpdir/deb-tmp.pkg.".int(rand(99998)+1);
|
---|
| 733 | sysopen(DEBSCRIPT, $debscriptfile, O_RDWR | O_CREAT | O_EXCL | O_NOFOLLOW)
|
---|
[8] | 734 | or die $!;
|
---|
[27] | 735 | print DEBSCRIPT $scriptletbase;
|
---|
| 736 | print DEBSCRIPT "fakeroot dpkg-deb -b $buildroot/$pkg $topdir/DEBS/i386/".
|
---|
| 737 | "$pkgdata{$pkg}{name}_$pkgdata{$pkg}{version}-$pkgdata{main}{release}_i386.deb\n";
|
---|
| 738 | # %$&$%@#@@#%@@@ Debian and their horrible ugly package names. >:(
|
---|
| 739 | close DEBSCRIPT;
|
---|
[8] | 740 |
|
---|
[27] | 741 | my $control = "Package: $pkgdata{$pkg}{name}\n".
|
---|
| 742 | "Version: $pkgdata{$pkg}{version}-$pkgdata{main}{release}\n".
|
---|
| 743 | "Section: $pkgdata{$pkg}{group}\n".
|
---|
[8] | 744 | "Priority: optional\n".
|
---|
| 745 | "Architecture: i386\n".
|
---|
| 746 | "Maintainer: $pkgdata{main}{packager}\n".
|
---|
[47] | 747 | ( $pkgdata{$pkg}{requires} ne '' ? "Depends: $pkgdata{$pkg}{requires}\n" : '' ).
|
---|
[39] | 748 | ( defined($pkgdata{$pkg}{provides}) ? "Provides: $pkgdata{$pkg}{provides}\n" : '' ).
|
---|
[51] | 749 | ( defined($pkgdata{$pkg}{conflicts}) ? "Conflicts: $pkgdata{$pkg}{conflicts}\n" : '' ).
|
---|
[27] | 750 | "Description: $pkgdata{$pkg}{summary}\n";
|
---|
| 751 | $control .= "$pkgdata{$pkg}{desc}\n";
|
---|
[8] | 752 |
|
---|
[27] | 753 | open CONTROL, ">$buildroot/$pkg/DEBIAN/control";
|
---|
| 754 | print CONTROL $control;
|
---|
| 755 | close CONTROL;
|
---|
[8] | 756 |
|
---|
[37] | 757 | # Iff there are conffiles (as specified in the %files list(s), add'em
|
---|
| 758 | # in so dpkg-deb can tag them.
|
---|
| 759 | if ($pkgdata{$pkg}{conffiles}) {
|
---|
| 760 | open CONFLIST, ">$buildroot/$pkg/DEBIAN/conffiles";
|
---|
| 761 | foreach my $conffile (@{$pkgdata{$pkg}{conflist}}) {
|
---|
| 762 | print CONFLIST "$conffile\n";
|
---|
| 763 | }
|
---|
| 764 | close CONFLIST;
|
---|
| 765 | }
|
---|
| 766 |
|
---|
[32] | 767 | # Can't see much point in scripts on subpackages... although since
|
---|
| 768 | # it's *possible* I should support it at some point.
|
---|
| 769 | if ($pkg eq 'main') {
|
---|
| 770 | if ($preinstscript ne '') {
|
---|
[34] | 771 | $preinstscript = expandmacros($preinstscript,'g');
|
---|
[32] | 772 | open PREINST, ">$buildroot/$pkg/DEBIAN/preinst";
|
---|
| 773 | print PREINST "#!/bin/sh\nset -e\n\n";
|
---|
| 774 | print PREINST $preinstscript;
|
---|
| 775 | close PREINST;
|
---|
| 776 | `chmod 0755 $buildroot/$pkg/DEBIAN/preinst`;
|
---|
| 777 | }
|
---|
| 778 | if ($postinstscript ne '') {
|
---|
[34] | 779 | $postinstscript = expandmacros($postinstscript,'g');
|
---|
[32] | 780 | open POSTINST, ">$buildroot/$pkg/DEBIAN/postinst";
|
---|
| 781 | print POSTINST "#!/bin/sh\nset -e\n\n";
|
---|
| 782 | print POSTINST $postinstscript;
|
---|
| 783 | close POSTINST;
|
---|
| 784 | `chmod 0755 $buildroot/$pkg/DEBIAN/postinst`;
|
---|
| 785 | }
|
---|
| 786 | if ($preuninstscript ne '') {
|
---|
[34] | 787 | $preuninstscript = expandmacros($preuninstscript,'g');
|
---|
[32] | 788 | open PREUNINST, ">$buildroot/$pkg/DEBIAN/prerm";
|
---|
| 789 | print PREUNINST "#!/bin/sh\nset -e\n\n";
|
---|
| 790 | print PREUNINST $preuninstscript;
|
---|
| 791 | close PREUNINST;
|
---|
| 792 | `chmod 0755 $buildroot/$pkg/DEBIAN/prerm`;
|
---|
| 793 | }
|
---|
| 794 | if ($postuninstscript ne '') {
|
---|
[34] | 795 | $postuninstscript = expandmacros($postuninstscript,'g');
|
---|
[32] | 796 | open POSTUNINST, ">$buildroot/$pkg/DEBIAN/postrm";
|
---|
| 797 | print POSTUNINST "#!/bin/sh\nset -e\n\n";
|
---|
| 798 | print POSTUNINST $postuninstscript;
|
---|
| 799 | close POSTUNINST;
|
---|
| 800 | `chmod 0755 $buildroot/$pkg/DEBIAN/postrm`;
|
---|
| 801 | }
|
---|
[27] | 802 | }
|
---|
[16] | 803 |
|
---|
[27] | 804 | # execute
|
---|
| 805 | print "Calling package creation script $debscriptfile for $pkgdata{$pkg}{name}...\n";
|
---|
| 806 | system("/bin/sh -e $debscriptfile") == 0
|
---|
[14] | 807 | or die "Can't exec: $!\n";
|
---|
[8] | 808 |
|
---|
[27] | 809 | # and clean up
|
---|
| 810 | unlink $debscriptfile;
|
---|
| 811 |
|
---|
| 812 | } # subpackage loop
|
---|
| 813 |
|
---|
[8] | 814 | } # end binpackage()
|
---|
| 815 |
|
---|
| 816 |
|
---|
[35] | 817 | ## srcpackage()
|
---|
| 818 | # Builds a .src.deb source package. Note that Debian's idea of
|
---|
| 819 | # a "source package" is seriously flawed IMO, because you can't
|
---|
| 820 | # easily copy it as-is.
|
---|
[36] | 821 | # Not quite identical to RPM, but Good Enough (TM).
|
---|
[35] | 822 | sub srcpackage {
|
---|
[36] | 823 | my $pkgsrcname = "$pkgdata{main}{name}-$pkgdata{main}{version}-$pkgdata{main}{release}.sdeb";
|
---|
| 824 |
|
---|
| 825 | my $paxcmd;
|
---|
| 826 |
|
---|
| 827 | # We'll definitely need this later, and *may* need it sooner.
|
---|
| 828 | (my $barespec = $specfile) =~ s|.+/([^/]+)$|$1|;
|
---|
| 829 |
|
---|
| 830 | # Copy the specfile to the build tree, but only if it's not there already.
|
---|
| 831 | ##buglet: need to deal with silly case where silly user has put the spec
|
---|
| 832 | # file in a subdir of %{_topdir}/SPECS. Ewww. Silly user!
|
---|
| 833 | if (abs_path($specfile) !~ /^$topdir\/SPECS/) {
|
---|
| 834 | $paxcmd .= "cp $specfile %{_topdir}/SPECS/; \n"
|
---|
| 835 | }
|
---|
| 836 |
|
---|
[35] | 837 | # use pax -w [file] [file] ... >outfile.sdeb
|
---|
[36] | 838 | $paxcmd = "cd $topdir; pax -w ";
|
---|
[10] | 839 |
|
---|
[35] | 840 | # tweak source entry into usable form. Need it locally somewhere along the line.
|
---|
| 841 | (my $pkgsrc = $pkgdata{main}{source}) =~ s|.+/([^/]+)$|$1|;
|
---|
[36] | 842 | $paxcmd .= "SOURCES/$pkgsrc ";
|
---|
[10] | 843 |
|
---|
[35] | 844 | # create file list: Source[nn], Patch[nn]
|
---|
| 845 | foreach my $specbit (keys %{$pkgdata{main}} ) {
|
---|
| 846 | next if $specbit eq 'source';
|
---|
[36] | 847 | $paxcmd .= "SOURCES/$pkgdata{main}{$specbit} " if $specbit =~ /^(source|patch)/;
|
---|
| 848 | ##buglet: need to deal with case where patches are listed as URLs?
|
---|
| 849 | # or other extended pathnames? Silly !@$%^&!%%!%!! user!
|
---|
[35] | 850 | }
|
---|
| 851 |
|
---|
[36] | 852 | # add the spec file, source package destination, and cd back where we came from.
|
---|
| 853 | $paxcmd .= "SPECS/$barespec > $topdir/SDEBS/$pkgsrcname; cd -";
|
---|
[35] | 854 |
|
---|
[36] | 855 | # In case of %-macros...
|
---|
[35] | 856 | $paxcmd = expandmacros($paxcmd,'gp');
|
---|
| 857 |
|
---|
[36] | 858 | system "$paxcmd";
|
---|
| 859 | print "Wrote source package $pkgsrcname in $topdir/SDEBS.\n";
|
---|
[35] | 860 | }
|
---|
| 861 |
|
---|
| 862 |
|
---|
[38] | 863 | ## checkbuildreq()
|
---|
| 864 | # Checks the build requirements (if any)
|
---|
| 865 | # Spits out a rude warning and returns a true-false error if any
|
---|
| 866 | # requirements are not met.
|
---|
| 867 | sub checkbuildreq {
|
---|
[40] | 868 | return 1 if $buildreq eq ''; # No use doing extra work.
|
---|
[38] | 869 |
|
---|
[52] | 870 | if ( ! -e "/usr/bin/dpkg-query" ) {
|
---|
| 871 | print "**WARNING** dpkg-query not found. Can't check build-deps.\n".
|
---|
| 872 | " Required for sucessful build:\n".$buildreq."\n".
|
---|
| 873 | " Continuing anyway.\n";
|
---|
| 874 | return 1;
|
---|
| 875 | }
|
---|
| 876 |
|
---|
[38] | 877 | my $reqflag = 1; # unset iff a buildreq is missing
|
---|
| 878 |
|
---|
| 879 | $buildreq =~ s/^, //; # Strip the leading comma and space
|
---|
| 880 | my @reqlist = split /,\s+/, $buildreq;
|
---|
| 881 |
|
---|
| 882 | foreach my $req (@reqlist) {
|
---|
| 883 | my ($pkg,$rel,$ver);
|
---|
| 884 |
|
---|
| 885 | # We have two classes of requirements - versioned and unversioned.
|
---|
| 886 | if ($req =~ /[><=]/) {
|
---|
| 887 | # Pick up the details of versioned buildreqs
|
---|
| 888 | ($pkg,$rel,$ver) = ($req =~ /([a-z0-9._-]+)\s+([><=]+)\s+([a-z0-9._-]+)/);
|
---|
| 889 | } else {
|
---|
| 890 | # And the unversioned ones.
|
---|
| 891 | $pkg = $req;
|
---|
| 892 | $rel = '>=';
|
---|
| 893 | $ver = 0;
|
---|
| 894 | }
|
---|
| 895 |
|
---|
| 896 | my @pkglist = qx { dpkg-query --showformat '\${status}\t\${version}\n' -W $pkg };
|
---|
| 897 | # need to check if no lines returned - means a bad buildreq
|
---|
| 898 | my ($reqstat,undef,undef,$reqver) = split /\s+/, $pkglist[0];
|
---|
| 899 | if ($reqstat !~ /install/) {
|
---|
| 900 | print " * Missing build-dependency $pkg!\n";
|
---|
| 901 | $reqflag = 0;
|
---|
| 902 | } else {
|
---|
| 903 | # gotta be a better way to do this... :/
|
---|
| 904 | if ($rel eq '>=' && !($reqver ge $ver)) {
|
---|
| 905 | print " * Buildreq $pkg is installed, but wrong version ($reqver): Need $ver\n";
|
---|
| 906 | $reqflag = 0;
|
---|
| 907 | }
|
---|
| 908 | if ($rel eq '>' && !($reqver gt $ver)) {
|
---|
| 909 | print " * Buildreq $pkg is installed, but wrong version ($reqver): Need $ver\n";
|
---|
| 910 | $reqflag = 0;
|
---|
| 911 | }
|
---|
| 912 | if ($rel eq '<=' && !($reqver le $ver)) {
|
---|
| 913 | print " * Buildreq $pkg is installed, but wrong version ($reqver): Need $ver\n";
|
---|
| 914 | $reqflag = 0;
|
---|
| 915 | }
|
---|
| 916 | if ($rel eq '<' && !($reqver lt $ver)) {
|
---|
| 917 | print " * Buildreq $pkg is installed, but wrong version ($reqver): Need $ver\n";
|
---|
| 918 | $reqflag = 0;
|
---|
| 919 | }
|
---|
| 920 | if ($rel eq '=' && !($reqver eq $ver)) {
|
---|
| 921 | print " * Buildreq $pkg is installed, but wrong version ($reqver): Need $ver\n";
|
---|
| 922 | $reqflag = 0;
|
---|
| 923 | }
|
---|
| 924 | } # end not installed/installed check
|
---|
| 925 | } # end req loop
|
---|
| 926 |
|
---|
| 927 | return $reqflag;
|
---|
| 928 | } # end checkbuildreq()
|
---|
| 929 |
|
---|
| 930 |
|
---|
| 931 | ## getreqs()
|
---|
| 932 | # Find out which libraries/packages are required for any
|
---|
| 933 | # executables and libs in a given file tree.
|
---|
| 934 | # (Debian doesn't have soname-level deps; just package-level)
|
---|
[41] | 935 | # Returns an empty string if the tree contains no binaries.
|
---|
| 936 | # Doesn't work well on shell scripts. but those *should* be
|
---|
| 937 | # fine anyway. (Yeah, right...)
|
---|
[38] | 938 | sub getreqs() {
|
---|
| 939 | my $pkgtree = $_[0];
|
---|
| 940 |
|
---|
[39] | 941 | print "Checking library requirements...\n";
|
---|
[43] | 942 | my @binlist = qx { find $pkgtree -type f -perm 755 };
|
---|
[38] | 943 |
|
---|
[41] | 944 | if (scalar(@binlist) == 0) {
|
---|
| 945 | return '';
|
---|
| 946 | }
|
---|
| 947 |
|
---|
| 948 | my @reqlist;
|
---|
| 949 | foreach (@binlist) {
|
---|
| 950 | push @reqlist, qx { ldd $_ };
|
---|
| 951 | }
|
---|
| 952 |
|
---|
| 953 | # Get the list of libs provided by this package. Still doesn't
|
---|
| 954 | # handle the case where the lib gets stuffed into a subpackage. :/
|
---|
| 955 | my @intprovlist = qx { find $pkgtree -type f -name "*.so*" };
|
---|
| 956 | my $provlist = '';
|
---|
| 957 | foreach (@intprovlist) {
|
---|
| 958 | s/$pkgtree//;
|
---|
| 959 | $provlist .= "$_";
|
---|
| 960 | }
|
---|
| 961 |
|
---|
[38] | 962 | my %reqs;
|
---|
[43] | 963 | my $reqlibs = '';
|
---|
[38] | 964 |
|
---|
| 965 | foreach (@reqlist) {
|
---|
| 966 | next if /^$pkgtree/;
|
---|
[42] | 967 | next if /not a dynamic executable/;
|
---|
[41] | 968 | next if m|/lib/ld-linux.so|; # Hack! Hack! PTHBTT! (libc suxx0rz)
|
---|
[38] | 969 |
|
---|
[41] | 970 | my ($req) = (/^\s+([a-z0-9._-]+)/); # dig out the actual library (so)name
|
---|
| 971 |
|
---|
| 972 | # Ignore libs provided by this package. Note that we don't match
|
---|
| 973 | # on word-boundary at the *end* of the lib we're looking for, as the
|
---|
| 974 | # looked-for lib may not have the full soname version. (ie, it may
|
---|
| 975 | # "just" point to one of the symlinks that get created somewhere.)
|
---|
| 976 | next if $provlist =~ /\b$req/;
|
---|
| 977 |
|
---|
[38] | 978 | $reqlibs .= " $req";
|
---|
| 979 | }
|
---|
| 980 |
|
---|
[43] | 981 | if ($reqlibs ne '') {
|
---|
| 982 | foreach (qx { dpkg -S $reqlibs }) {
|
---|
| 983 | my ($libpkg,undef) = split /:\s+/;
|
---|
| 984 | $reqs{$libpkg} = 1;
|
---|
| 985 | }
|
---|
[38] | 986 | }
|
---|
| 987 |
|
---|
[43] | 988 | my $deplist = '';
|
---|
[38] | 989 | foreach (keys %reqs) {
|
---|
| 990 | $deplist .= ", $_";
|
---|
| 991 | }
|
---|
| 992 |
|
---|
| 993 | # For now, we're done. We're not going to meddle with versions yet.
|
---|
| 994 | # Among other things, it's messier than handling "simple" yes/no "do
|
---|
| 995 | # we have this lib?" deps. >:(
|
---|
| 996 |
|
---|
| 997 | return $deplist;
|
---|
| 998 | } # end getreqs()
|
---|
| 999 |
|
---|
| 1000 |
|
---|
[50] | 1001 | ## install_sdeb()
|
---|
| 1002 | # Extracts .sdeb contents to %_topdir as appropriate
|
---|
| 1003 | sub install_sdeb {
|
---|
| 1004 | my $paxcmd = "cd $topdir; pax -r <$srcpkg; cd -";
|
---|
| 1005 |
|
---|
| 1006 | # In case of %-macros...
|
---|
| 1007 | $paxcmd = expandmacros($paxcmd,'gp');
|
---|
| 1008 |
|
---|
| 1009 | system "$paxcmd";
|
---|
| 1010 | print "Extracted source package $srcpkg to $topdir.\n";
|
---|
| 1011 | } # end install_sdeb()
|
---|
| 1012 |
|
---|
| 1013 |
|
---|
[10] | 1014 | ## expandmacros()
|
---|
| 1015 | # Expands all %{blah} macros in the passed string
|
---|
[14] | 1016 | # Split up a bit with some sections so we don't spend time trying to
|
---|
| 1017 | # expand macros that are only used in a few specific places.
|
---|
[10] | 1018 | sub expandmacros {
|
---|
| 1019 | my $macrostring = shift;
|
---|
[14] | 1020 | my $section = shift;
|
---|
[10] | 1021 |
|
---|
[25] | 1022 | # To allow the FHS-ish %configure and %makeinstall to work The Right Way.
|
---|
[12] | 1023 | # (Without clobbering the global $buildroot.)
|
---|
| 1024 | my $prefix = '';
|
---|
| 1025 |
|
---|
[11] | 1026 | if ($section =~ /c/) {
|
---|
[12] | 1027 | # %configure macro
|
---|
[17] | 1028 | # Don't know what it's for, don't have a useful default replacement
|
---|
| 1029 | # --program-prefix=%{_program_prefix} \
|
---|
| 1030 | $macrostring =~ s'%configure'./configure --host=$DEB_HOST_GNU_TYPE \
|
---|
| 1031 | --build=$DEB_BUILD_GNU_TYPE \
|
---|
| 1032 | --prefix=%{_prefix} \
|
---|
| 1033 | --exec-prefix=%{_exec_prefix} \
|
---|
| 1034 | --bindir=%{_bindir} \
|
---|
| 1035 | --sbindir=%{_sbindir} \
|
---|
| 1036 | --sysconfdir=%{_sysconfdir} \
|
---|
| 1037 | --datadir=%{_datadir} \
|
---|
| 1038 | --includedir=%{_includedir} \
|
---|
| 1039 | --libdir=%{_libdir} \
|
---|
| 1040 | --libexecdir=%{_libexecdir} \
|
---|
| 1041 | --localstatedir=%{_localstatedir} \
|
---|
| 1042 | --sharedstatedir=%{_sharedstatedir} \
|
---|
| 1043 | --mandir=%{_mandir} \
|
---|
| 1044 | --infodir=%{_infodir} ';
|
---|
[12] | 1045 | } # done %configure
|
---|
| 1046 |
|
---|
| 1047 | if ($section =~ /m/) {
|
---|
| 1048 | $macrostring =~ s'%{__make}'make ';
|
---|
[25] | 1049 | } # done make
|
---|
[12] | 1050 |
|
---|
| 1051 | if ($section =~ /i/) {
|
---|
| 1052 | # This is where we need to mangle $prefix.
|
---|
[24] | 1053 | $macrostring =~ s'%makeinstall'make %{fhs} install';
|
---|
[12] | 1054 | $prefix = $buildroot;
|
---|
| 1055 | } # done %install and/or %makeinstall
|
---|
| 1056 |
|
---|
| 1057 | # Build data
|
---|
| 1058 | # Note that these are processed in reverse order to get the substitution order right
|
---|
| 1059 | if ($section =~ /b/) {
|
---|
[24] | 1060 | # $macrostring =~ s'%{fhs}'host=$DEB_HOST_GNU_TYPE \
|
---|
| 1061 | # build=$DEB_BUILD_GNU_TYPE \
|
---|
| 1062 | $macrostring =~ s'%{fhs}'prefix=%{_prefix} \
|
---|
[17] | 1063 | exec-prefix=%{_exec_prefix} \
|
---|
| 1064 | bindir=%{_bindir} \
|
---|
| 1065 | sbindir=%{_sbindir} \
|
---|
| 1066 | sysconfdir=%{_sysconfdir} \
|
---|
| 1067 | datadir=%{_datadir} \
|
---|
| 1068 | includedir=%{_includedir} \
|
---|
| 1069 | libdir=%{_libdir} \
|
---|
| 1070 | libexecdir=%{_libexecdir} \
|
---|
| 1071 | localstatedir=%{_localstatedir} \
|
---|
| 1072 | sharedstatedir=%{_sharedstatedir} \
|
---|
| 1073 | mandir=%{_mandir} \
|
---|
| 1074 | infodir=%{_infodir} \
|
---|
| 1075 | ';
|
---|
[10] | 1076 |
|
---|
| 1077 | # Note that the above regex terminates with the extra space
|
---|
[12] | 1078 | # "Just In Case" of user additions, which will then get neatly
|
---|
| 1079 | # tagged on the end where they take precedence (supposedly)
|
---|
| 1080 | # over the "default" ones.
|
---|
[10] | 1081 |
|
---|
[14] | 1082 | # Now we cascade the macros introduced above. >_<
|
---|
| 1083 | # Wot ot to go theah:
|
---|
| 1084 | $macrostring =~ s|%{_mandir}|%{_datadir}/man|g; #/usr/share/man
|
---|
| 1085 | $macrostring =~ s|%{_infodir}|%{_datadir}/info|g; #/usr/share/info
|
---|
[25] | 1086 | $macrostring =~ s|%{_oldincludedir}|/usr/include|g; #/usr/include
|
---|
| 1087 | $macrostring =~ s|%{_includedir}|%{_prefix\}/include|g; #/usr/include
|
---|
| 1088 | $macrostring =~ s|%{_libdir}|%{_exec_prefix}/%{_lib}|g; #/usr/lib
|
---|
[14] | 1089 | $macrostring =~ s|%{_lib}|lib|g; #?
|
---|
[25] | 1090 | $macrostring =~ s|%{_localstatedir}|/var|g; #/var
|
---|
| 1091 | $macrostring =~ s|%{_sharedstatedir}|%{_prefix}/com|g; #/usr/com WTF?
|
---|
| 1092 | $macrostring =~ s|%{_sysconfdir}|/etc|g; #/etc
|
---|
| 1093 | $macrostring =~ s|%{_datadir}|%{_prefix}/share|g; #/usr/share
|
---|
| 1094 | $macrostring =~ s|%{_libexecdir}|%{_exec_prefix}/libexec|g; #/usr/libexec
|
---|
| 1095 | $macrostring =~ s|%{_sbindir}|%{_exec_prefix}/sbin|g; #/usr/sbin
|
---|
| 1096 | $macrostring =~ s|%{_bindir}|%{_exec_prefix}/bin|g; #/usr/bin
|
---|
| 1097 | $macrostring =~ s|%{_exec_prefix}|%{_prefix}|g; #/usr
|
---|
[14] | 1098 | $macrostring =~ s|%{_prefix}|/usr|g; #/usr
|
---|
[10] | 1099 | } # done with config section
|
---|
| 1100 |
|
---|
[12] | 1101 | # Package data
|
---|
| 1102 | if ($section =~ /p/) {
|
---|
[15] | 1103 | $macrostring =~ s/\%\{buildroot\}/$buildroot/gi;
|
---|
| 1104 | foreach my $source (keys %{$pkgdata{sources}}) {
|
---|
| 1105 | $macrostring =~ s/\%\{source$source\}/$topdir\/SOURCES\/$pkgdata{sources}{$source}/gi;
|
---|
| 1106 | }
|
---|
| 1107 | $macrostring =~ s/\%\{name\}/$pkgdata{main}{name}/gi;
|
---|
| 1108 | $macrostring =~ s/\%\{version\}/$pkgdata{main}{version}/gi;
|
---|
| 1109 | $macrostring =~ s/\%\{release\}/$pkgdata{main}{release}/gi;
|
---|
[12] | 1110 | }
|
---|
| 1111 |
|
---|
| 1112 | # Globals, and not-so-globals
|
---|
| 1113 | if ($section =~ /g/) {
|
---|
[29] | 1114 | $macrostring =~ s|%{_builddir}|%{_topdir}/BUILD|g;
|
---|
| 1115 | $macrostring =~ s|%{_topdir}|$topdir|g;
|
---|
[13] | 1116 | $macrostring =~ s|%{_tmppath}|$tmpdir|g;
|
---|
[12] | 1117 | $macrostring =~ s'%{_docdir}'/usr/share/doc'g;
|
---|
[23] | 1118 |
|
---|
[31] | 1119 | # Standard FHS locations. More or less.
|
---|
[30] | 1120 | $macrostring =~ s'%{_bindir}'/usr/bin'g;
|
---|
[31] | 1121 | $macrostring =~ s'%{_sbindir}'/usr/sbin'g;
|
---|
[30] | 1122 | $macrostring =~ s'%{_mandir}'/usr/share/man'g;
|
---|
| 1123 | $macrostring =~ s'%{_includedir}'/usr/include'g;
|
---|
[31] | 1124 | $macrostring =~ s'%{_libdir}'/usr/lib'g;
|
---|
| 1125 | $macrostring =~ s'%{_sysconfdir}'/etc'g;
|
---|
| 1126 | $macrostring =~ s'%{_localstatedir}'/var'g;
|
---|
[30] | 1127 |
|
---|
[23] | 1128 | # %define's
|
---|
| 1129 | foreach my $key (keys %specglobals) {
|
---|
| 1130 | $macrostring =~ s|%{$key}|$specglobals{$key}|g;
|
---|
| 1131 | }
|
---|
| 1132 |
|
---|
| 1133 | # system programs. RPM uses a global config file for these; we'll just
|
---|
| 1134 | # ASS-U-ME and make life a little simpler.
|
---|
| 1135 | if ($macrostring =~ /\%\{\_\_([a-z0-9_-]+)\}/) {
|
---|
| 1136 | $macrostring =~ s|%{__([a-z0-9_-]+)}|$1|g;
|
---|
| 1137 | }
|
---|
[10] | 1138 | } # done with globals section
|
---|
| 1139 |
|
---|
| 1140 | return $macrostring;
|
---|
| 1141 | } # end expandmacros()
|
---|
[22] | 1142 |
|
---|
| 1143 |
|
---|
| 1144 |
|
---|
[38] | 1145 | __END__
|
---|
| 1146 |
|
---|
| 1147 |
|
---|
| 1148 |
|
---|
[22] | 1149 | =head1 NAME
|
---|
| 1150 |
|
---|
| 1151 | debbuild - Build Debian-compatible packages from RPM spec files
|
---|
| 1152 |
|
---|
| 1153 | =head1 SYNOPSIS
|
---|
| 1154 |
|
---|
| 1155 | debbuild {-ba|-bb|-bp|-bc|-bi|-bl|-bs} [build-options] file.spec
|
---|
| 1156 |
|
---|
| 1157 | debbuild {-ta|-tb|-tp|-tc|-ti|-tl|-ts} [build-options] file.tar.{gz|bz2}
|
---|
| 1158 |
|
---|
| 1159 | debbuild --rebuild file.src.{rpm|deb}
|
---|
| 1160 |
|
---|
| 1161 | =head1 DESCRIPTION
|
---|
| 1162 |
|
---|
| 1163 | This script attempts to build Debian-friendly semi-native packages
|
---|
| 1164 | from RPM spec files, RPM-friendly tarballs, and RPM source packages
|
---|
| 1165 | (.src.rpm). It accepts I<most> of the options rpmbuild does, and
|
---|
| 1166 | should be able to interpret most spec files usefully. Perl modules
|
---|
| 1167 | should be handled via CPAN+dh-make-perl instead; Debian's conventions
|
---|
| 1168 | for such things do not lend themselves to automated conversion.
|
---|
| 1169 |
|
---|
| 1170 | As far as possible, the command-line options are identical to those
|
---|
| 1171 | from rpmbuild, although several rpmbuild options are not supported.
|
---|
| 1172 |
|
---|
| 1173 | =cut
|
---|