From: Ian Jackson <ian.jackson@citrix.com>
To: Roger Pau Monne <roger.pau@citrix.com>
Cc: xen-devel@lists.xenproject.org
Subject: Re: [Xen-devel] [PATCH 2/6] osstest: introduce a helper to create a weblink to a directory
Date: Thu, 23 May 2019 10:57:08 +0100 [thread overview]
Message-ID: <23782.28276.943946.821244@mariner.uk.xensource.com> (raw)
Message-ID: <20190523095708.6yS_amZWLNRrevU72mjW9X02JpDTLNzexKtQBCmmSn4@z> (raw)
In-Reply-To: <20190220170001.32614-3-roger.pau@citrix.com>
Roger Pau Monne writes ("[Xen-devel] [PATCH 2/6] osstest: introduce a helper to create a weblink to a directory"):
> +sub create_weblink ($$$) {
> + my ($ho, $tail, $target) = @_;
> + my $wf_rhs= hostnamepath($ho)."_".$tail;
> + my $wf_common= $c{WebspaceCommon}.$wf_rhs;
> + my $wf_url= $c{WebspaceUrl}.$wf_common;
> + my $wf_file= $c{WebspaceFile}.$wf_common;
> +
> + unlink $wf_file;
> + symlink $target, $wf_file or die "$wf_file $!";
> + return $wf_url;
Most of this is the start of create_webfile. Can you factor that
out ?
I have three suggestions for the shape:
my ($wf_file, $wf_url) = prepare_create_webfile($ho, $tail);
symlink $target, $wf_file or die "$wf_file $!";
return $wf_url;
}
or split create_webfile into create_web_fsobject which takes a
subref, and the call to file_link_contents:
create_web_fsobject($ho, $tail, sub {
my ($wf_file) = @_;
symlink $target, $wf_file or die "$wf_file $!";
});
}
or the same but make passing a subref as $contents legal for
create_webfile,
sub create_webfile ($$$) {
my .... $contents_spec);
# $contents as for file_link_contents, or a subref
# which will be called as $contents_spec($wf_file,$wf_url);
...
if (ref($contents_spec) ne 'CODE') {
my $contents = $contents_spec;
$contents_spec = sub {
my ($wf_file) = @_;
file_link_contents($wf_file, $contents, "webspace-$wf_rhs");
};
}
Take your pick, or do something similar ?
Ian.
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel
next prev parent reply other threads:[~2019-05-23 9:58 UTC|newest]
Thread overview: 35+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-02-20 16:59 [PATCH 0/6] osstest: create a local binary FreeBSD package repository Roger Pau Monne
2019-02-20 16:59 ` [PATCH 1/6] osstest: introduce a helper to stash a whole directory Roger Pau Monne
2019-05-23 9:48 ` Ian Jackson
2019-05-23 9:48 ` [Xen-devel] " Ian Jackson
2019-05-24 9:42 ` Roger Pau Monné
2019-05-24 9:42 ` [Xen-devel] " Roger Pau Monné
2019-02-20 16:59 ` [PATCH 2/6] osstest: introduce a helper to create a weblink to a directory Roger Pau Monne
2019-05-23 9:57 ` Ian Jackson [this message]
2019-05-23 9:57 ` [Xen-devel] " Ian Jackson
2019-02-20 16:59 ` [PATCH 3/6] osstest: allow to perform multiple anoints in the same transaction Roger Pau Monne
2019-05-23 10:00 ` Ian Jackson
2019-05-23 10:00 ` [Xen-devel] " Ian Jackson
2019-02-20 16:59 ` [PATCH 4/6] osstest: introduce a helper to get the svn revision of a git commit Roger Pau Monne
2019-05-23 10:03 ` Ian Jackson
2019-05-23 10:03 ` [Xen-devel] " Ian Jackson
2019-05-24 9:57 ` Roger Pau Monné
2019-05-24 9:57 ` [Xen-devel] " Roger Pau Monné
2019-05-24 10:35 ` Ian Jackson
2019-05-24 10:35 ` [Xen-devel] " Ian Jackson
2019-02-20 17:00 ` [PATCH 5/6] osstest: introduce a script to build a FreeBSD package repository Roger Pau Monne
2019-05-23 10:19 ` Ian Jackson
2019-05-23 10:19 ` [Xen-devel] " Ian Jackson
2019-05-23 10:38 ` Ian Jackson
2019-05-23 10:38 ` [Xen-devel] " Ian Jackson
2019-05-24 10:13 ` Roger Pau Monné
2019-05-24 10:13 ` [Xen-devel] " Roger Pau Monné
2019-05-24 11:21 ` Ian Jackson
2019-05-24 11:21 ` [Xen-devel] " Ian Jackson
2019-02-20 17:00 ` [PATCH 6/6] osstest: use a locally built pkg repository for FreeBSD Roger Pau Monne
2019-05-23 11:06 ` Ian Jackson
2019-05-23 11:06 ` [Xen-devel] " Ian Jackson
2019-05-24 10:45 ` Roger Pau Monné
2019-05-24 10:45 ` [Xen-devel] " Roger Pau Monné
2019-05-24 17:26 ` Ian Jackson
2019-05-24 17:26 ` [Xen-devel] " Ian Jackson
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=23782.28276.943946.821244@mariner.uk.xensource.com \
--to=ian.jackson@citrix.com \
--cc=roger.pau@citrix.com \
--cc=xen-devel@lists.xenproject.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).