Fix: Packager errors
This commit is contained in:
parent
1c00dead1c
commit
731cb8d806
@ -13,6 +13,7 @@ $PROJECT="mymodule";
|
|||||||
@LISTETARGET=("TGZ"); # Possible packages
|
@LISTETARGET=("TGZ"); # Possible packages
|
||||||
%REQUIREMENTTARGET=( # Tool requirement for each package
|
%REQUIREMENTTARGET=( # Tool requirement for each package
|
||||||
"TGZ"=>"tar",
|
"TGZ"=>"tar",
|
||||||
|
"ZIP"=>"7z"
|
||||||
);
|
);
|
||||||
%ALTERNATEPATH=(
|
%ALTERNATEPATH=(
|
||||||
);
|
);
|
||||||
@ -68,6 +69,15 @@ $BUILDROOT="$TEMP/dolibarr-buildroot";
|
|||||||
my $copyalreadydone=0;
|
my $copyalreadydone=0;
|
||||||
my $batch=0;
|
my $batch=0;
|
||||||
|
|
||||||
|
for (0..@ARGV-1) {
|
||||||
|
if ($ARGV[$_] =~ /^-*target=(\w+)/i) { $target=$1; $batch=1; }
|
||||||
|
if ($ARGV[$_] =~ /^-*desti=(.+)/i) { $DESTI=$1; }
|
||||||
|
if ($ARGV[$_] =~ /^-*prefix=(.+)/i) {
|
||||||
|
$PREFIX=$1;
|
||||||
|
$FILENAMESNAPSHOT.="-".$PREFIX;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
print "Makepack module version $VERSION\n";
|
print "Makepack module version $VERSION\n";
|
||||||
print "Enter name for your module (mymodule, mywonderfulmondule, ...) : ";
|
print "Enter name for your module (mymodule, mywonderfulmondule, ...) : ";
|
||||||
$PROJECT=<STDIN>;
|
$PROJECT=<STDIN>;
|
||||||
@ -89,7 +99,7 @@ if (! -f "makepack-".$PROJECT.".conf")
|
|||||||
print "Enter value for version: ";
|
print "Enter value for version: ";
|
||||||
$PROJVERSION=<STDIN>;
|
$PROJVERSION=<STDIN>;
|
||||||
chomp($PROJVERSION);
|
chomp($PROJVERSION);
|
||||||
($MAJOR,$MINOR)=split(/\./,$PROJVERSION,2);
|
($MAJOR,$MINOR,$BUILD)=split(/\./,$PROJVERSION,3);
|
||||||
if ($MINOR eq '')
|
if ($MINOR eq '')
|
||||||
{
|
{
|
||||||
print "Enter value for minor version: ";
|
print "Enter value for minor version: ";
|
||||||
@ -99,6 +109,7 @@ if ($MINOR eq '')
|
|||||||
|
|
||||||
$FILENAME="$PROJECT";
|
$FILENAME="$PROJECT";
|
||||||
$FILENAMETGZ="module_$PROJECT-$MAJOR.$MINOR";
|
$FILENAMETGZ="module_$PROJECT-$MAJOR.$MINOR";
|
||||||
|
$FILENAMEZIP="module_$PROJECT-$MAJOR.$MINOR";
|
||||||
if (-d "/usr/src/redhat") {
|
if (-d "/usr/src/redhat") {
|
||||||
# redhat
|
# redhat
|
||||||
$RPMDIR="/usr/src/redhat";
|
$RPMDIR="/usr/src/redhat";
|
||||||
@ -111,10 +122,13 @@ if (-d "/usr/src/RPM") {
|
|||||||
$SOURCE="$DIR/..";
|
$SOURCE="$DIR/..";
|
||||||
$DESTI="$SOURCE/build";
|
$DESTI="$SOURCE/build";
|
||||||
|
|
||||||
|
print "Source directory: $SOURCE\n";
|
||||||
|
print "Target directory: $DESTI\n";
|
||||||
|
|
||||||
|
|
||||||
# Choose package targets
|
# Choose package targets
|
||||||
#-----------------------
|
#-----------------------
|
||||||
$target="TGZ"; # Dolibarr modules are tgz format
|
$target="ZIP"; # Dolibarr modules are this format
|
||||||
$CHOOSEDTARGET{uc($target)}=1;
|
$CHOOSEDTARGET{uc($target)}=1;
|
||||||
|
|
||||||
|
|
||||||
@ -150,46 +164,90 @@ print "\n";
|
|||||||
# Check if there is at least on target to build
|
# Check if there is at least on target to build
|
||||||
#----------------------------------------------
|
#----------------------------------------------
|
||||||
$nboftargetok=0;
|
$nboftargetok=0;
|
||||||
|
$nboftargetneedbuildroot=0;
|
||||||
|
$nboftargetneedcvs=0;
|
||||||
foreach my $target (keys %CHOOSEDTARGET) {
|
foreach my $target (keys %CHOOSEDTARGET) {
|
||||||
if ($CHOOSEDTARGET{$target} < 0) { next; }
|
if ($CHOOSEDTARGET{$target} < 0) { next; }
|
||||||
$nboftargetok++;
|
if ($target ne 'EXE' && $target ne 'EXEDOLIWAMP')
|
||||||
|
{
|
||||||
|
$nboftargetneedbuildroot++;
|
||||||
|
}
|
||||||
|
if ($target eq 'SNAPSHOT')
|
||||||
|
{
|
||||||
|
$nboftargetneedcvs++;
|
||||||
|
}
|
||||||
|
$nboftargetok++;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($nboftargetok) {
|
if ($nboftargetok) {
|
||||||
|
|
||||||
# Update buildroot
|
# Update CVS if required
|
||||||
#-----------------
|
#-----------------------
|
||||||
if (! $copyalreadydone) {
|
if ($nboftargetneedcvs)
|
||||||
print "Delete directory $BUILDROOT\n";
|
{
|
||||||
$ret=`rm -fr "$BUILDROOT"`;
|
print "Go to directory $SOURCE\n";
|
||||||
mkdir "$BUILDROOT";
|
$olddir=getcwd();
|
||||||
|
chdir("$SOURCE");
|
||||||
|
print "Run cvs update -P -d\n";
|
||||||
|
$ret=`cvs update -P -d 2>&1`;
|
||||||
|
chdir("$olddir");
|
||||||
|
}
|
||||||
|
|
||||||
$result=open(IN,"<makepack-".$PROJECT.".conf");
|
# Update buildroot if required
|
||||||
if (! $result) { die "Error: Can't open conf file makepack-".$PROJECT.".conf for reading.\n"; }
|
#-----------------------------
|
||||||
while(<IN>)
|
if ($nboftargetneedbuildroot)
|
||||||
{
|
{
|
||||||
if ($_ =~ /^#/) { next; } # Do not process comments
|
if (! $copyalreadydone) {
|
||||||
|
print "Delete directory $BUILDROOT\n";
|
||||||
|
$ret=`rm -fr "$BUILDROOT"`;
|
||||||
|
|
||||||
$_ =~ s/\n//;
|
mkdir "$BUILDROOT";
|
||||||
$_ =~ /^(.*)\/[^\/]+/;
|
mkdir "$BUILDROOT/$PROJECT";
|
||||||
print "Create directory $BUILDROOT/$1\n";
|
|
||||||
$ret=`mkdir -p "$BUILDROOT/$1"`;
|
|
||||||
print "Copy $SOURCE/$_ into $BUILDROOT/$_\n";
|
|
||||||
$ret=`cp -pr "$SOURCE/$_" "$BUILDROOT/$_"`;
|
|
||||||
}
|
|
||||||
close IN;
|
|
||||||
|
|
||||||
@timearray=localtime(time());
|
$result=open(IN,"<makepack-".$PROJECT.".conf");
|
||||||
$fulldate=($timearray[5]+1900).'-'.($timearray[4]+1).'-'.$timearray[3].' '.$timearray[2].':'.$timearray[1];
|
if (! $result) { die "Error: Can't open conf file makepack-".$PROJECT.".conf for reading.\n"; }
|
||||||
$versionfile=open(VF,">$BUILDROOT/build/version-".$PROJECT.".txt");
|
while(<IN>)
|
||||||
|
{
|
||||||
|
if ($_ =~ /^#/) { next; } # Do not process comments
|
||||||
|
|
||||||
print "Create version file $BUILDROOT/build/version-".$PROJECT.".txt with date ".$fulldate."\n";
|
$_ =~ s/\n//;
|
||||||
$ret=`mkdir -p "$BUILDROOT/build"`;
|
$_ =~ /^(.*)\/[^\/]+/;
|
||||||
print VF "Version: ".$MAJOR.".".$MINOR."\n";
|
print "Create directory $BUILDROOT/$PROJECT/$1\n";
|
||||||
print VF "Build : ".$fulldate."\n";
|
$ret=`mkdir -p "$BUILDROOT/$PROJECT/$1"`;
|
||||||
close VF;
|
print "Copy $SOURCE/$_ into $BUILDROOT/$PROJECT/$_\n";
|
||||||
}
|
$ret=`cp -pr "$SOURCE/$_" "$BUILDROOT/$PROJECT/$_"`;
|
||||||
|
}
|
||||||
|
close IN;
|
||||||
|
|
||||||
|
@timearray=localtime(time());
|
||||||
|
$fulldate=($timearray[5]+1900).'-'.($timearray[4]+1).'-'.$timearray[3].' '.$timearray[2].':'.$timearray[1];
|
||||||
|
open(VF,">$BUILDROOT/$PROJECT/build/version-".$PROJECT.".txt");
|
||||||
|
|
||||||
|
print "Create version file $BUILDROOT/$PROJECT/build/version-".$PROJECT.".txt with date ".$fulldate."\n";
|
||||||
|
$ret=`mkdir -p "$BUILDROOT/$PROJECT/build"`;
|
||||||
|
print VF "Version: ".$MAJOR.".".$MINOR."\n";
|
||||||
|
print VF "Build : ".$fulldate."\n";
|
||||||
|
close VF;
|
||||||
|
}
|
||||||
|
print "Clean $BUILDROOT\n";
|
||||||
|
$ret=`rm -fr $BUILDROOT/$PROJECT/.cache`;
|
||||||
|
$ret=`rm -fr $BUILDROOT/$PROJECT/.project`;
|
||||||
|
$ret=`rm -fr $BUILDROOT/$PROJECT/.settings`;
|
||||||
|
$ret=`rm -fr $BUILDROOT/$PROJECT/index.php`;
|
||||||
|
$ret=`rm -fr $BUILDROOT/$PROJECT/build/html`;
|
||||||
|
$ret=`rm -fr $BUILDROOT/$PROJECT/documents`;
|
||||||
|
$ret=`rm -fr $BUILDROOT/$PROJECT/document`;
|
||||||
|
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/conf/conf.php.mysql`;
|
||||||
|
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/conf/conf.php.old`;
|
||||||
|
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/conf/conf.php.postgres`;
|
||||||
|
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/conf/conf*sav*`;
|
||||||
|
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/custom`;
|
||||||
|
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/custom2`;
|
||||||
|
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/theme/bureau2crea`;
|
||||||
|
$ret=`rm -fr $BUILDROOT/$PROJECT/test`;
|
||||||
|
$ret=`rm -fr $BUILDROOT/$PROJECT/Thumbs.db $BUILDROOT/$PROJECT/*/Thumbs.db $BUILDROOT/$PROJECT/*/*/Thumbs.db $BUILDROOT/$PROJECT/*/*/*/Thumbs.db $BUILDROOT/$PROJECT/*/*/*/*/Thumbs.db`;
|
||||||
|
$ret=`rm -fr $BUILDROOT/$PROJECT/CVS* $BUILDROOT/$PROJECT/*/CVS* $BUILDROOT/$PROJECT/*/*/CVS* $BUILDROOT/$PROJECT/*/*/*/CVS* $BUILDROOT/$PROJECT/*/*/*/*/CVS* $BUILDROOT/$PROJECT/*/*/*/*/*/CVS*`;
|
||||||
|
}
|
||||||
|
|
||||||
# Build package for each target
|
# Build package for each target
|
||||||
#------------------------------
|
#------------------------------
|
||||||
@ -216,19 +274,26 @@ if ($nboftargetok) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ($target eq 'ZIP') {
|
if ($target eq 'ZIP') {
|
||||||
unlink "$FILENAMEZIP.zip";
|
print "Remove target $FILENAMEZIP.zip...\n";
|
||||||
print "Compress $FILENAMETGZ into $FILENAMEZIP.zip...\n";
|
unlink "$DESTI/$FILENAMEZIP.zip";
|
||||||
chdir("$BUILDROOT");
|
print "Compress $FILENAMEZIP into $FILENAMEZIP.zip...\n";
|
||||||
#print "cd $BUILDROOTNT & 7z a -r -tzip -mx $BUILDROOT/$FILENAMEZIP.zip $FILENAMETGZ\\*.*\n";
|
|
||||||
#$ret=`cd $BUILDROOTNT & 7z a -r -tzip -mx $BUILDROOT/$FILENAMEZIP.zip $FILENAMETGZ\\*.*`;
|
print "Go to directory $BUILDROOT/$PROJECT\n";
|
||||||
$ret=`7z a -r -tzip -mx $BUILDROOT/$FILENAMEZIP.zip $FILENAMETGZ\\*.*`;
|
$olddir=getcwd();
|
||||||
print "Move $FILENAMEZIP.zip to $DESTI\n";
|
chdir("$BUILDROOT/$PROJECT");
|
||||||
rename("$BUILDROOT/$FILENAMEZIP.zip","$DESTI/$FILENAMEZIP.zip");
|
$cmd= "7z a -r -tzip -mx $BUILDROOT/$FILENAMEZIP.zip *";
|
||||||
|
print $cmd."\n";
|
||||||
|
$ret= `$cmd`;
|
||||||
|
chdir("$olddir");
|
||||||
|
|
||||||
|
print "Move $FILENAMEZIP.zip to $DESTI/$FILENAMEZIP.zip\n";
|
||||||
|
$ret=`mv "$BUILDROOT/$FILENAMEZIP.zip" "$DESTI/$FILENAMEZIP.zip"`;
|
||||||
next;
|
next;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($target eq 'EXE') {
|
if ($target eq 'EXE') {
|
||||||
unlink "$FILENAMEEXE.exe";
|
print "Remove target $FILENAMEEXE.exe...\n";
|
||||||
|
unlink "$DESTI/$FILENAMEEXE.exe";
|
||||||
print "Compress into $FILENAMEEXE.exe by $FILENAMEEXE.nsi...\n";
|
print "Compress into $FILENAMEEXE.exe by $FILENAMEEXE.nsi...\n";
|
||||||
$command="\"$REQUIREMENTTARGET{$target}\" /DMUI_VERSION_DOT=$MAJOR.$MINOR.$BUILD /X\"SetCompressor bzip2\" \"$SOURCE\\build\\exe\\$FILENAME.nsi\"";
|
$command="\"$REQUIREMENTTARGET{$target}\" /DMUI_VERSION_DOT=$MAJOR.$MINOR.$BUILD /X\"SetCompressor bzip2\" \"$SOURCE\\build\\exe\\$FILENAME.nsi\"";
|
||||||
print "$command\n";
|
print "$command\n";
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user