Changeset 2631 in ProjectBuilder
- Timestamp:
- Aug 18, 2020, 12:57:30 PM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
devel/pb/bin/pb
r2601 r2631 1143 1143 1144 1144 my %pkgs; 1145 my %ext; 1145 1146 my $pb; # Structure to store conf info 1146 1147 … … 1572 1573 # Prepare the dest directory for archive 1573 1574 chdir "$ENV{'PBDESTDIR'}" || confess "Unable to change dir to $ENV{'PBDESTDIR'}"; 1575 my $ext = ""; 1574 1576 if (defined $preserve) { 1575 1577 # In that case we want to preserve the original tar file for checksum purposes … … 1577 1579 # Maybe check basename of both to be sure they are the same ? 1578 1580 pb_log(0,"Preserving original tar file "); 1579 move("$preserve","$pbpkg-$pbver$pbextdir.tar.gz"); 1581 my ($x, $y); 1582 ($x,$y,$ext) = fileparse($preserve,("tar.gz","tar.bz2","tar.xz","tgz")); 1583 move("$preserve","$pbpkg-$pbver$pbextdir.$ext"); 1580 1584 } else { 1585 $ext = "tar.gz"; 1581 1586 # Possibility to look at PBSRC to guess more the filename 1582 pb_system("tar cfz $pbpkg-$pbver$pbextdir. tar.gz--exclude=$pbpkg-$pbver$pbextdir/pbconf $pbpkg-$pbver$pbextdir","Creating $pbpkg tar files compressed");1583 } 1584 pb_log(0,"Under $ENV{'PBDESTDIR'}/$pbpkg-$pbver$pbextdir. tar.gz\n");1587 pb_system("tar cfz $pbpkg-$pbver$pbextdir.$ext --exclude=$pbpkg-$pbver$pbextdir/pbconf $pbpkg-$pbver$pbextdir","Creating $pbpkg tar files compressed"); 1588 } 1589 pb_log(0,"Under $ENV{'PBDESTDIR'}/$pbpkg-$pbver$pbextdir.$ext\n"); 1585 1590 pb_system("tar cfz $pbpkg-$pbver$pbextdir.pbconf.tar.gz $pbpkg-$pbver$pbextdir/pbconf","Creating pbconf tar files compressed"); 1586 1591 pb_log(0,"Under $ENV{'PBDESTDIR'}/$pbpkg-$pbver$pbextdir.pbconf.tar.gz\n"); … … 1588 1593 # Keep track of version-tag per pkg 1589 1594 $pkgs{$pbpkg} = "$pbver-$pbtag"; 1595 # Keep track of extension 1596 $ext{$pbpkg} = "$ext"; 1590 1597 1591 1598 # Final cleanup … … 1600 1607 foreach my $pbpkg (keys %pkgs) { 1601 1608 print PKG " $pbpkg: $pkgs{$pbpkg}\n"; 1609 } 1610 print PKG "ext:\n"; 1611 foreach my $pbpkg (keys %ext) { 1612 print PKG " $pbpkg: $ext{$pbpkg}\n"; 1602 1613 } 1603 1614 close(PKG); … … 1694 1705 } elsif ($pbos->{'type'} eq "hpux") { 1695 1706 # TODO: HP-UX 1707 } elsif ($pbos->{'type'} eq "aur") { 1708 $ftype = "\/PKGBUILD\$"; 1696 1709 } elsif ($pbos->{'type'} eq "apk") { 1697 1710 $ftype = "\/APKBUILD\$"; … … 1730 1743 my ($pkg) = pb_conf_read("$ENV{'PBDESTDIR'}/$ENV{'PBPROJVER'}-$ENV{'PBPROJTAG'}.yml","pbpkg"); 1731 1744 $pkg = { } if (not defined $pkg); 1745 my ($ext) = pb_conf_read("$ENV{'PBDESTDIR'}/$ENV{'PBPROJVER'}-$ENV{'PBPROJTAG'}.yml","ext"); 1746 $ext = { } if (not defined $ext); 1732 1747 my $pbextdir = pb_get_extdir(); 1733 1748 … … 1763 1778 my $vertag = $pkg->{$pbpkg}; 1764 1779 pb_log(2,"Vertag: $vertag\n"); 1780 my $fext = $ext->{$pbpkg}; 1781 # Keep compatibility with previous generated files pre 0.14 1782 $fext = "tar.gz" if (not defined $fext); 1783 pb_log(2,"Extension: $fext\n"); 1765 1784 # get the version of the current package - maybe different 1766 1785 ($pbver,$pbtag) = split(/-/,$vertag); 1767 1786 1768 my $src="$ENV{'PBDESTDIR'}/$pbpkg-$pbver$pbextdir. tar.gz";1787 my $src="$ENV{'PBDESTDIR'}/$pbpkg-$pbver$pbextdir.$fext"; 1769 1788 my $src2="$ENV{'PBDESTDIR'}/$pbpkg-$pbver$pbextdir.pbconf.tar.gz"; 1770 1789 pb_log(2,"Source file: $src\n"); … … 1774 1793 if ($pbos->{'type'} eq "rpm") { 1775 1794 # Remove in case a previous link/file was there 1795 pb_mkdir_p("$ENV{'PBBUILDDIR'}/SOURCES"); 1796 pb_mkdir_p("$ENV{'PBBUILDDIR'}/SPECS"); 1776 1797 unlink "$ENV{'PBBUILDDIR'}/SOURCES/".basename($src); 1777 1798 symlink "$src","$ENV{'PBBUILDDIR'}/SOURCES/".basename($src) || confess "Unable to symlink $src in $ENV{'PBBUILDDIR'}/SOURCES"; … … 1864 1885 } 1865 1886 # ...so modify the name of files to be Debian compliant 1866 move("../$src","../$pbpkg-$pbver$pbextdir.orig. tar.gz");1887 move("../$src","../$pbpkg-$pbver$pbextdir.orig.$fext"); 1867 1888 } 1868 1889 … … 1966 1987 } 1967 1988 } 1989 1990 } elsif ($pbos->{'type'} eq "aur") { 1991 pb_system("tar xfz $src2","Extracting pbconf"); 1992 1993 pb_rm_rf("$ENV{'PBBUILDDIR'}/aur"); 1994 pb_mkdir_p("$ENV{'PBBUILDDIR'}/aur"); 1995 unlink "$ENV{'PBBUILDDIR'}/aur/".basename($src); 1996 symlink "$src","$ENV{'PBBUILDDIR'}/aur/".basename($src) || confess "Unable to symlink $src in $ENV{'PBBUILDDIR'}/aur"; 1997 # We need to first extract the PKGBUILD file 1998 chdir "$ENV{'PBBUILDDIR'}/aur" || confess "Unable to chdir to $ENV{'PBBUILDDIR'}/aur"; 1999 my @aurfile = pb_extract_build_files($src2,"$pbpkg-$pbver$pbextdir/pbconf/$pbos->{'name'}-$pbos->{'version'}-$pbos->{'arch'}/","$ENV{'PBBUILDDIR'}/aur","build"); 2000 2001 # Build 2002 foreach my $f (@aurfile) { 2003 if ($f =~ /PKGBUILD$/) { 2004 pb_system("makepkg","verbose"); 2005 } 2006 } 2007 # Get the name of the generated packages 2008 open(LOG,"$ENV{'PBTMP'}/system.$$.log") || confess "Unable to open $ENV{'PBTMP'}/system.$$.log"; 2009 while (<LOG>) { 2010 chomp($_); 2011 next if ($_ !~ /: Create /); 2012 s|.*: Create (.*.pkg)|$1|; 2013 $made .= " $_"; 2014 } 2015 close(LOG); 1968 2016 1969 2017 } elsif ($pbos->{'type'} eq "apk") { … … 2126 2174 } 2127 2175 if ((defined $chkcmd) && (-x $chkcmd)) { 2128 my $ret = pb_system("$chkcmd $chkopt $made2","Checking validity of debs with $chkcmd","mayfail"); 2176 $chkcmd .= " $chkopt" if (defined $chkopt); 2177 my $ret = pb_system("$chkcmd $made2","Checking validity of debs with $chkcmd","mayfail"); 2129 2178 pb_log(0,"ERROR: when checking packages validity\n") if ($ret ne 0); 2130 2179 } … … 2229 2278 2230 2279 my $pkg = { }; 2280 my $ext = { }; 2231 2281 # Get content saved in cms2build 2232 2282 if ((defined $ENV{'PBDESTDIR'}) && (defined $ENV{'PBPROJVER'}) && (defined $ENV{'PBPROJTAG'}) && (-f "$ENV{'PBDESTDIR'}/$ENV{'PBPROJVER'}-$ENV{'PBPROJTAG'}.yml")) { 2233 2283 ($pkg) = pb_conf_read("$ENV{'PBDESTDIR'}/$ENV{'PBPROJVER'}-$ENV{'PBPROJTAG'}.yml","pbpkg"); 2234 2284 $pkg = { } if (not defined $pkg); 2285 ($ext) = pb_conf_read("$ENV{'PBDESTDIR'}/$ENV{'PBPROJVER'}-$ENV{'PBPROJTAG'}.yml","ext"); 2286 $ext = { } if (not defined $ext); 2235 2287 } 2236 2288 … … 2239 2291 foreach my $pbpkg (@pkgs) { 2240 2292 my $vertag = $pkg->{$pbpkg}; 2293 my $fext = $ext->{$pbpkg}; 2294 $fext = "tar.gz" if (not defined $fext); 2241 2295 # get the version of the current package - maybe different 2242 2296 pb_log(2,"Vertag: $vertag\n"); 2297 pb_log(2,"Extension $fext\n"); 2243 2298 ($pbver,$pbtag) = split(/-/,$vertag); 2244 2299 2245 2300 if (($cmt eq "Sources") || ($cmt =~ /(V[EM]|RM)(build|prep)/)) { 2246 $src = "$src $ENV{'PBDESTDIR'}/$pbpkg-$pbver$pbextdir. tar.gz$ENV{'PBDESTDIR'}/$pbpkg-$pbver$pbextdir.pbconf.tar.gz";2247 my $cmd2 = "ln -sf $pbpkg-$pbver$pbextdir. tar.gz $pbpkg-latest.tar.gz";2301 $src = "$src $ENV{'PBDESTDIR'}/$pbpkg-$pbver$pbextdir.$fext $ENV{'PBDESTDIR'}/$pbpkg-$pbver$pbextdir.pbconf.tar.gz"; 2302 my $cmd2 = "ln -sf $pbpkg-$pbver$pbextdir.$fext $pbpkg-latest.$fext"; 2248 2303 #my $cmd2 = "ln $pbpkg-$pbver$pbextdir.tar.gz $pbpkg-latest.tar.gz 2> /dev/null ; if [ \$? -ne 0 ]; then ln -sf $pbpkg-$pbver$pbextdir.tar.gz $pbpkg-latest.tar.gz ; fi"; 2249 2304 if ($cmd eq "") { … … 2253 2308 } 2254 2309 } elsif ($cmt eq "Web") { 2255 $src = "$src $ENV{'PBDESTDIR'}/$pbpkg-$pbver$pbextdir. tar.gz"2310 $src = "$src $ENV{'PBDESTDIR'}/$pbpkg-$pbver$pbextdir.$fext" 2256 2311 } 2257 2312 … … 4220 4275 } 4221 4276 print SCRIPT << 'EOF'; 4277 # Call the programs in normal mode, not setupv mode 4278 delete($ENV{'PBSETUPV'}); 4222 4279 pb_system("pbdistrocheck",undef,"verbose"); 4223 4280 pb_system("pb --version",undef,"verbose"); … … 5549 5606 my ($v2,$all2) = pb_get_allv($vtype); 5550 5607 pb_log(1,"INFO: velist is:\n"); 5551 pb_log(1,Dumper( @$v2));5608 pb_log(1,Dumper($v2)); 5552 5609 my $foundv = 0; 5553 5610 foreach my $v3 (@$v2) {
Note:
See TracChangeset
for help on using the changeset viewer.