Changeset 36


Ignore:
Timestamp:
02/16/06 12:13:40 (18 years ago)
Author:
kdeugau
Message:

/trunk

Source package creation functional. May need tweaking and/or changes.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/debbuild

    r35 r36  
    1414use warnings;
    1515use Fcntl;      # for sysopen flags
     16use Cwd 'abs_path';     # for finding where files really are
    1617
    1718# regex debugger
     
    749750# a "source package" is seriously flawed IMO, because you can't
    750751# easily copy it as-is.
     752# Not quite identical to RPM, but Good Enough (TM).
    751753sub srcpackage {
     754  my $pkgsrcname = "$pkgdata{main}{name}-$pkgdata{main}{version}-$pkgdata{main}{release}.sdeb";
     755
     756  my $paxcmd;
     757
     758  # We'll definitely need this later, and *may* need it sooner.
     759  (my $barespec = $specfile) =~ s|.+/([^/]+)$|$1|;
     760
     761  # Copy the specfile to the build tree, but only if it's not there already.
     762##buglet: need to deal with silly case where silly user has put the spec
     763# file in a subdir of %{_topdir}/SPECS.  Ewww.  Silly user!
     764  if (abs_path($specfile) !~ /^$topdir\/SPECS/) {
     765    $paxcmd .= "cp $specfile %{_topdir}/SPECS/; \n"
     766  }
     767
    752768  # use pax -w [file] [file] ... >outfile.sdeb
    753   my $paxcmd = "cd %{_topdir}; pax -w ";
     769  $paxcmd = "cd $topdir; pax -w ";
    754770
    755771# tweak source entry into usable form.  Need it locally somewhere along the line.
    756772  (my $pkgsrc = $pkgdata{main}{source}) =~ s|.+/([^/]+)$|$1|;
    757   $paxcmd .= "$pkgsrc ";
     773  $paxcmd .= "SOURCES/$pkgsrc ";
    758774
    759775  # create file list:  Source[nn], Patch[nn]
    760776  foreach my $specbit (keys %{$pkgdata{main}} ) {
    761777    next if $specbit eq 'source';
    762     $paxcmd .= "$pkgdata{main}{$specbit} " if $specbit =~ /^(source|patch)/;
     778    $paxcmd .= "SOURCES/$pkgdata{main}{$specbit} " if $specbit =~ /^(source|patch)/;
     779##buglet: need to deal with case where patches are listed as URLs?
     780#  or other extended pathnames?  Silly !@$%^&!%%!%!! user!
    763781  }
    764782
    765   # add the spec file now
    766   $paxcmd .= "$specfile > SDEBS/$pkgdata{main}{name}.sdeb";
    767 
     783  # add the spec file, source package destination, and cd back where we came from.
     784  $paxcmd .= "SPECS/$barespec > $topdir/SDEBS/$pkgsrcname; cd -";
     785
     786  # In case of %-macros...
    768787  $paxcmd = expandmacros($paxcmd,'gp');
    769788 
    770   print "$paxcmd\n";
     789  system "$paxcmd";
     790  print "Wrote source package $pkgsrcname in $topdir/SDEBS.\n";
    771791}
    772792
Note: See TracChangeset for help on using the changeset viewer.