Changeset 2631 in ProjectBuilder for devel/pb/bin/pb


Ignore:
Timestamp:
Aug 18, 2020, 12:57:30 PM (4 years ago)
Author:
Bruno Cornec
Message:
  • Start to add support for aur packages
  • Fix packages built with a non tar.gz file, by storing extensions in the intermediate yml file between svn2build and build2pkg
File:
1 edited

Legend:

Unmodified
Added
Removed
  • devel/pb/bin/pb

    r2601 r2631  
    11431143
    11441144    my %pkgs;
     1145    my %ext;
    11451146    my $pb;             # Structure to store conf info
    11461147
     
    15721573        # Prepare the dest directory for archive
    15731574        chdir "$ENV{'PBDESTDIR'}" || confess "Unable to change dir to $ENV{'PBDESTDIR'}";
     1575        my $ext = "";
    15741576        if (defined $preserve) {
    15751577            # In that case we want to preserve the original tar file for checksum purposes
     
    15771579            # Maybe check basename of both to be sure they are the same ?
    15781580            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");
    15801584        } else {
     1585                $ext = "tar.gz";
    15811586            # 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");
    15851590        pb_system("tar cfz $pbpkg-$pbver$pbextdir.pbconf.tar.gz $pbpkg-$pbver$pbextdir/pbconf","Creating pbconf tar files compressed");
    15861591        pb_log(0,"Under $ENV{'PBDESTDIR'}/$pbpkg-$pbver$pbextdir.pbconf.tar.gz\n");
     
    15881593        # Keep track of version-tag per pkg
    15891594        $pkgs{$pbpkg} = "$pbver-$pbtag";
     1595        # Keep track of extension
     1596        $ext{$pbpkg} = "$ext";
    15901597
    15911598        # Final cleanup
     
    16001607    foreach my $pbpkg (keys %pkgs) {
    16011608        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";
    16021613    }
    16031614    close(PKG);
     
    16941705        } elsif ($pbos->{'type'} eq "hpux") {
    16951706            # TODO: HP-UX
     1707        } elsif ($pbos->{'type'} eq "aur") {
     1708            $ftype = "\/PKGBUILD\$";
    16961709        } elsif ($pbos->{'type'} eq "apk") {
    16971710            $ftype = "\/APKBUILD\$";
     
    17301743    my ($pkg) = pb_conf_read("$ENV{'PBDESTDIR'}/$ENV{'PBPROJVER'}-$ENV{'PBPROJTAG'}.yml","pbpkg");
    17311744    $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);
    17321747    my $pbextdir = pb_get_extdir();
    17331748
     
    17631778        my $vertag = $pkg->{$pbpkg};
    17641779        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");
    17651784        # get the version of the current package - maybe different
    17661785        ($pbver,$pbtag) = split(/-/,$vertag);
    17671786
    1768         my $src="$ENV{'PBDESTDIR'}/$pbpkg-$pbver$pbextdir.tar.gz";
     1787        my $src="$ENV{'PBDESTDIR'}/$pbpkg-$pbver$pbextdir.$fext";
    17691788        my $src2="$ENV{'PBDESTDIR'}/$pbpkg-$pbver$pbextdir.pbconf.tar.gz";
    17701789        pb_log(2,"Source file: $src\n");
     
    17741793        if ($pbos->{'type'} eq "rpm") {
    17751794            # Remove in case a previous link/file was there
     1795            pb_mkdir_p("$ENV{'PBBUILDDIR'}/SOURCES");
     1796            pb_mkdir_p("$ENV{'PBBUILDDIR'}/SPECS");
    17761797            unlink "$ENV{'PBBUILDDIR'}/SOURCES/".basename($src);
    17771798            symlink "$src","$ENV{'PBBUILDDIR'}/SOURCES/".basename($src) || confess "Unable to symlink $src in $ENV{'PBBUILDDIR'}/SOURCES";
     
    18641885                }
    18651886                # ...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");
    18671888            }
    18681889
     
    19661987                }
    19671988            }
     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);
    19682016
    19692017        } elsif ($pbos->{'type'} eq "apk") {
     
    21262174        }
    21272175        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");
    21292178            pb_log(0,"ERROR: when checking packages validity\n") if ($ret ne 0);
    21302179        }
     
    22292278
    22302279        my $pkg = { };
     2280        my $ext = { };
    22312281        # Get content saved in cms2build
    22322282        if ((defined $ENV{'PBDESTDIR'}) && (defined $ENV{'PBPROJVER'}) && (defined $ENV{'PBPROJTAG'}) && (-f "$ENV{'PBDESTDIR'}/$ENV{'PBPROJVER'}-$ENV{'PBPROJTAG'}.yml")) {
    22332283            ($pkg) = pb_conf_read("$ENV{'PBDESTDIR'}/$ENV{'PBPROJVER'}-$ENV{'PBPROJTAG'}.yml","pbpkg");
    22342284            $pkg = { } if (not defined $pkg);
     2285            ($ext) = pb_conf_read("$ENV{'PBDESTDIR'}/$ENV{'PBPROJVER'}-$ENV{'PBPROJTAG'}.yml","ext");
     2286            $ext = { } if (not defined $ext);
    22352287        }
    22362288
     
    22392291        foreach my $pbpkg (@pkgs) {
    22402292            my $vertag = $pkg->{$pbpkg};
     2293            my $fext = $ext->{$pbpkg};
     2294            $fext = "tar.gz" if (not defined $fext);
    22412295            # get the version of the current package - maybe different
    22422296            pb_log(2,"Vertag: $vertag\n");
     2297            pb_log(2,"Extension $fext\n");
    22432298            ($pbver,$pbtag) = split(/-/,$vertag);
    22442299
    22452300            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";
    22482303                #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";
    22492304                if ($cmd eq "") {
     
    22532308                }
    22542309            } elsif ($cmt eq "Web") {
    2255                 $src = "$src $ENV{'PBDESTDIR'}/$pbpkg-$pbver$pbextdir.tar.gz"
     2310                $src = "$src $ENV{'PBDESTDIR'}/$pbpkg-$pbver$pbextdir.$fext"
    22562311            }
    22572312
     
    42204275    }
    42214276    print SCRIPT << 'EOF';
     4277# Call the programs in normal mode, not setupv mode
     4278delete($ENV{'PBSETUPV'});
    42224279pb_system("pbdistrocheck",undef,"verbose");
    42234280pb_system("pb --version",undef,"verbose");
     
    55495606my ($v2,$all2) = pb_get_allv($vtype);
    55505607pb_log(1,"INFO: velist is:\n");
    5551 pb_log(1,Dumper(@$v2));
     5608pb_log(1,Dumper($v2));
    55525609my $foundv = 0;
    55535610foreach my $v3 (@$v2) {
Note: See TracChangeset for help on using the changeset viewer.