Changeset 163


Ignore:
Timestamp:
04/08/12 22:02:23 (12 years ago)
Author:
kdeugau
Message:

/trunk

Light tuneup of option handling, and add --help output
Bump copyright
Add version in debbuild executable for --help, along with tag for it

to be (re)set to match the Makefile on 'make dist'

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/debbuild

    r162 r163  
    1010# Last update by $Author$
    1111###
    12 # Copyright (C) 2005-2011 Kris Deugau <kdeugau@deepnet.cx>
     12# Copyright (C) 2005-2012 Kris Deugau <kdeugau@deepnet.cx>
    1313#
    1414#    This program is free software; you can redistribute it and/or modify
     
    3232use Config;
    3333
     34my $version = "0.9";    #VERSION#
     35
    3436# regex debugger
    3537#use re "debug";
    3638
     39# Behavioural compatibility FTW!  Yes, rpmbuild does this too.
    3740die "No .spec file to work with!  Exiting.\n" if scalar(@ARGV) == 0;
    3841
     
    124127# Hackery to try to bring some semblance of sanity to packages built for more
    125128# than one Debian version at the same time.  Whee.
    126 # /etc/debian-version
     129# /etc/debian-version and/or version of base-files package
    127130my %distmap = (
    128131        "3.1.9ubuntu7.1"        => "dapper",
     
    356359  # Or not.  >:(  Stupid Debian lack of findable Perl module names in packages.
    357360
     361  # ... also note, single-character options are mostly not flags, so they can't be
     362  # sanely combined the way most other programs' single-character flag options can.
     363
    358364  # Stuff it.
    359365  my $prevopt = '';
     
    372378        } elsif (/^--showpkgs/) {
    373379          $cmdopts{type} = 'd'; # d for 'diagnostic' or 'debug' or 'dump'
     380        } elsif (/^--help/) {
     381          print "debbuild v$version".q{
     382Copyright 2005-2012 Kris Deugau <kdeugau@deepnet.cx>
     383
     384Build .deb packages from RPM-style .spec files
     385debbuild supports most package-building options rpmbuild does.
     386
     387Build options with [ <specfile> | <tarball> | <source package> ]:
     388      -bp                        build through %prep (unpack sources and apply patches) from <specfile>
     389      -bc                        build through %build (%prep, then compile) from <specfile>
     390      -bi                        build through %install (%prep, %build, then install) from <specfile>
     391      -bl                        verify %files section from <specfile>
     392      -ba                        build source and binary packages from <specfile>
     393      -bb                        build binary package only from <specfile>
     394      -bs                        build source package only from <specfile>
     395      -tp                        build through %prep (unpack sources and apply patches) from <tarball>
     396      -tc                        build through %build (%prep, then compile) from <tarball>
     397      -ti                        build through %install (%prep, %build, then install) from <tarball>
     398      -ta                        build source and binary packages from <tarball>
     399      -tb                        build binary package only from <tarball>
     400      -ts                        build source package only from <tarball>
     401      --rebuild                  build binary package from <source package>
     402      --buildroot=DIRECTORY      override build root
     403      --short-circuit            skip straight to specified stage (only for c,i)
     404
     405Common options:
     406  -D, --define='MACRO EXPR'      define MACRO with value EXPR
     407
     408debbuild-specific options:
     409      -i                         Unpack a .sdeb in the %_topdir tree
     410      --showpkgs                 Show package names that would be built.  Only works with .spec files.
     411
     412};
     413          exit;
     414
    374415        } elsif (/^--define/) {
    375416          # nothing to do?  Can't see anything needed, we handle the actual definition later.
     
    396437          $cmdopts{install} = 1;
    397438          $prevopt = '-i';
     439        } elsif (/^-D/) {
     440          # --define.  nothing to do on this round;  actual work is done next time.
    398441        } else {
    399442          die "Bad option $_\n";
     
    409452      if ($prevopt eq '--buildroot') {
    410453        $cmdbuildroot = $_;
    411       } elsif ($prevopt eq '--define') {
     454      } elsif ($prevopt eq '--define' || $prevopt eq '-D') {
    412455        my ($macro,$value) = (/([a-z0-9_.-]+)(?:\s+(.+))?/i);
    413456        if ($value ne '') {
Note: See TracChangeset for help on using the changeset viewer.