Skip to content

Commit

Permalink
Item8810: improve generated manifest Item9071: correct corruption of …
Browse files Browse the repository at this point in the history
…field values in target_upload. Plus some tidyups and a minor inprovement to the let-server-relax pause

git-svn-id: http://svn.foswiki.org/trunk@7572 0b4bb1d4-4e5a-0410-9cc4-b2b747904278
  • Loading branch information
CrawfordCurrie authored and CrawfordCurrie committed May 27, 2010
1 parent d146244 commit 6652d8b
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 36 deletions.
19 changes: 10 additions & 9 deletions BuildContrib/data/System/BuildContrib.txt
Expand Up @@ -577,15 +577,16 @@ Another great Foswiki extension from the <a style="text-decoration:none" href="h
| Release: | %$RELEASE% |
| Version: | %$VERSION% |
| Change&nbsp;History: | |
| 30 Mar 2010 | Foswiki::Task:Item8804: Improve support for alternate Extension repositories. Foswiki:Development/EasierMirroringOfExtensionRepositories |
| 11 Feb 2010 | Foswiki::Task:Item8468: Fixed incorrect link at the top of Extension topic - Foswiki:Main.AndrewJones |
| 9 Feb 2010 | Foswiki:Task:Item8490: Handle 200 or 400 from GET bin/login |
| 13 Sep 2009 | Foswiki:Task:Item8272: Improve handling of compression targets |
| 21 Jul 2009 | Foswiki:Task:Item1840: check result of login attempt during perl build.pl upload |
| 20 Mar 2009 | Foswiki:Task:Item1338: added SHA1 checksum generation; Foswiki:Task:Item1192 remove more T(m)Wiki cruft; added support for new Support structure to template - Foswiki:Main.WillNorris |
| 5 Mar 2009 | Foswiki:Task:Item1198: Improved support for %<nop>$VERSION% (made it much more accurate) and changed the generated date format to ISO. Also added support for %<nop>$RELEASE%, an optional release identifier taken from the master perl module. |
| 15 Feb 2009 | Foswiki:Task:Item1079: Added twiki target |
| 31 Jan 2009 | Macro expansion works even in non-english locales (Foswiki:Task:Item924) |
| 27 May 2010 | Foswiki:Tasks.Item8810: improve generated manifest Foswiki:Tasks.Item9071: correct corruption of field values in target_upload |
| 30 Mar 2010 | Foswiki:Tasks.Item8804: Improve support for alternate Extension repositories. Foswiki:Development/EasierMirroringOfExtensionRepositories |
| 11 Feb 2010 | Foswiki:Tasks.Item8468: Fixed incorrect link at the top of Extension topic - Foswiki:Main.AndrewJones |
| 9 Feb 2010 | Foswiki:Tasks.Item8490: Handle 200 or 400 from GET bin/login |
| 13 Sep 2009 | Foswiki:Tasks.Item8272: Improve handling of compression targets |
| 21 Jul 2009 | Foswiki:Tasks.Item1840: check result of login attempt during perl build.pl upload |
| 20 Mar 2009 | Foswiki:Tasks.Item1338: added SHA1 checksum generation; Foswiki:Tasks.Item1192 remove more T(m)Wiki cruft; added support for new Support structure to template - Foswiki:Main.WillNorris |
| 5 Mar 2009 | Foswiki:Tasks.Item1198: Improved support for %<nop>$VERSION% (made it much more accurate) and changed the generated date format to ISO. Also added support for %<nop>$RELEASE%, an optional release identifier taken from the master perl module. |
| 15 Feb 2009 | Foswiki:Tasks.Item1079: Added twiki target |
| 31 Jan 2009 | Macro expansion works even in non-english locales (Foswiki:Tasks.Item924) |
| 03 Dec 2008 | Re-release for Foswiki; copyright assigned to Foswiki Contributors |

%META:FILEATTACHMENT{name="logo.gif" comment="logo" attr="h" path="logo.gif"}%
Expand Down
62 changes: 35 additions & 27 deletions BuildContrib/lib/Foswiki/Contrib/Build.pm
Expand Up @@ -37,14 +37,15 @@ use File::Find ();
use File::Path ();
use File::Temp ();
use POSIX ();
use Data::Dumper ();
use warnings;
use Foswiki::Time;

our $basedir;
our $buildpldir;
our $libpath;

our $RELEASE = "30 Mar 2010";
our $RELEASE = "27 May 2010";
our $VERSION = '$Rev$';

our $SHORTDESCRIPTION = 'Automates build and packaging process, including installer generation, for extension modules.';
Expand All @@ -58,6 +59,7 @@ my $DEFAULTCUSTOMERDB = "$ENV{HOME}/customerDB";

my $GLACIERMELT = 10; # number of seconds to sleep between uploads,
# to reduce average load on server
my $lastUpload = 0; # time of last upload (0 means none yet)

my $targetProject; # Foswiki or TWiki

Expand Down Expand Up @@ -317,16 +319,16 @@ sub new {
CGI::td( { align => 'left' }, $dep->{name} )
. CGI::td( { align => 'left' }, $v )
. CGI::td( { align => 'left' }, $dep->{description} );
$deptable .= CGI::Tr($cells);
$deptable .= CGI::Tr({}, $cells);
}
$this->{RAW_DEPENDENCIES} = $rawdeps;
$this->{DEPENDENCIES} = 'None';
if ($deptable) {
my $cells =
CGI::th('Name') . CGI::th('Version') . CGI::th('Description');
CGI::th({}, 'Name') . CGI::th({}, 'Version') . CGI::th({}, 'Description');
$this->{DEPENDENCIES} =
CGI::table( { border => 1, class => 'foswikiTable' },
CGI::Tr($cells) . $deptable );
CGI::Tr({}, $cells) . $deptable );
}

$this->{VERSION} = $this->_get_svn_version() unless $this->{VERSION};
Expand Down Expand Up @@ -424,7 +426,6 @@ sub _loadConfig {
# Save the config
sub _saveConfig {
my $this = shift;
require Data::Dumper;
if ( open( F, '>', $this->{config}->{file} ) ) {
print F Data::Dumper->Dump( [ $this->{config} ] );
close(F);
Expand Down Expand Up @@ -1879,38 +1880,50 @@ END
my %newform;
my $formExists = 0;

# SMELL: There appears to be no way to determine if Foswiki didn't find the topic and returns
# the topic creator form, or if the get was successful. Foswiki always returns 200 for the status
# We need a better way of handling the not-found condition. For now, look to see if there is a
# newtopicform present. If found, it means that the get should be treated as a NOT FOUND.
# SMELL: There appears to be no way to distinguish if Foswiki didn't
# find the topic and returns the topic creator form, or if the GET
# was successful. Foswiki always returns 200 for the status
# We need a better way of handling the not-found condition.
# For now, look to see if there is a newtopicform present. If found,
# it means that the get should be treated as a NOT FOUND.

unless ( $response->is_success && ! ($response->content() =~ m/<form name="newtopicform"/s) ) {
unless ( $response->is_success()
&& ! ($response->content() =~ m/<form name="newtopicform"/s) ) {
if ( ! $response->is_success ) {
print 'Failed to GET old topic ', $response->request->uri,
' -- ', $response->status_line, "\n";
}

if (($this->{DOWNTARGETSCRIPT} ne $this->{UPLOADTARGETSCRIPT}) ||( $this->{DOWNTARGETWEB} ne $this->{UPLOADTARGETWEB})) {
if (($this->{DOWNTARGETSCRIPT} ne $this->{UPLOADTARGETSCRIPT})
||( $this->{DOWNTARGETWEB} ne $this->{UPLOADTARGETWEB})) {
print "Downloading $topic from $alturl to recover form\n";
$response = $userAgent->get("$alturl?raw=all");
unless ( $response->is_success ) {
print 'Failed to GET old topic from Alternate location', $response->request->uri,
print 'Failed to GET old topic from Alternate location',
$response->request->uri,
$newform{formtemplate} = 'PackageForm';
if ( $this->{project} =~ /(Plugin|Skin|Contrib|AddOn)$/ ) {
$newform{TopicClassification} = $1 . 'Package';
}
}
}
}
if ($response->is_success && ! ($response->content() =~ m/<form name="newtopicform"/s) ) {
if ($response->is_success()
&& ! ($response->content() =~ m/<form name="newtopicform"/s) ) {
print "Recovering form from $topic\n";
# SMELL: would be better to use Foswiki::Meta to do this
foreach my $line ( split( /\n/, $response->content() ) ) {

if ( $line =~ m/%META:FIELD{name="(.*?)".*?value="(.*?)"/ ) {
my $name = $1;
my $val = $2;

# URL-decode the value
$val =~ s/%([\da-f]{2})/chr(hex($1))/gei;

# Trim null values or we end up damaging the form
if ( defined $val && length($val) ) {
$newform{$1} = $val;
$newform{$name} = $val;
}
}
elsif ( $line =~ /META:FORM{name="PackageForm/ ) {
Expand Down Expand Up @@ -2108,6 +2121,11 @@ sub _uploadAttachment {
sub _postForm {
my ( $this, $userAgent, $user, $pass, $url, $form ) = @_;
while ($lastUpload && $lastUpload + $GLACIERMELT > time) {
print "Taking a deep breath after the last upload";
sleep(2);
}
my $response =
$userAgent->post( $url, $form, 'Content_Type' => 'form-data' );
Expand All @@ -2116,18 +2134,6 @@ sub _postForm {
$response->as_string
unless $response->is_redirect
&& $response->headers->header('Location') !~ m{/oops|/log.n/};
my $sleep = $GLACIERMELT;
if ( $sleep > 0 ) {
local $| = 1;
print "Taking a deep breath after the upload";
while ( $sleep > 0 ) {
print '.';
sleep(2);
$sleep -= 2;
}
print "\n";
}
}
sub _unhtml {
Expand Down Expand Up @@ -2380,7 +2386,9 @@ sub _manicollect {
elsif (!-d
&& /^\w.*\w$/
&& !/^(DEPENDENCIES|MANIFEST|(PRE|POST)INSTALL|build\.pl)$/
&& !/$collector->{project}\.(md5|zip|tgz|txt|sha1)/ )
&& !/\.bak$/
&& !/^$collector->{project}_installer(\.pl)?$/
&& !/^$collector->{project}\.(md5|zip|tgz|txt|sha1)$/ )
{
my $n = $File::Find::name;
my @a = stat($n);
Expand Down

0 comments on commit 6652d8b

Please sign in to comment.