Skip to contentSkip to conversation

s3.py: Remove hardcoded aws

PATCH Superseded Elizabeth 'pidge' Flanagan 2 participants 2 messages Mar 29, 2017

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 s3.py: Remove hardcoded aws

This commit looks to see if FETCHCMD_s3 is set and if not, sets it.

This is needed because I've use cases where I don't use aws, but s3cmd (due to license).

---
 lib/bb/fetch2/s3.py | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
lib/bb/fetch2/s3.py +4 -2
index 27993aa..9157c46 100644
@@ -53,6 +53,8 @@ class S3(FetchMethod):
         else:
             ud.basename = os.path.basename(ud.path)
 
+        ud.basecmd = d.getVar("FETCHCMD_s3", True) or "/usr/bin/env aws s3"
+
         ud.localfile = d.expand(urllib.parse.unquote(ud.basename))
 
     def download(self, ud, d):
@@ -61,7 +63,7 @@ class S3(FetchMethod):
         Assumes localpath was called first
         """
 
-        cmd = 'aws s3 cp s3://%s%s %s' % (ud.host, ud.path, ud.localpath)
+        cmd = '%s cp s3://%s%s %s' % (ud.basecmd, ud.host, ud.path, ud.localpath)
         bb.fetch2.check_network_access(d, cmd, ud.url)
         runfetchcmd(cmd, d)
 
@@ -83,7 +85,7 @@ class S3(FetchMethod):
         Check the status of a URL
         """
 
-        cmd = 'aws s3 ls s3://%s%s' % (ud.host, ud.path)
+        cmd = '%s ls s3://%s%s' % (ud.basecmd, ud.host, ud.path)
         bb.fetch2.check_network_access(d, cmd, ud.url)
         output = runfetchcmd(cmd, d)
 
Signature · 1 line
1.9.1
#1 lore raw
Quoted 16 lines · Elizabeth 'pidge' Flanagan

This commit looks to see if FETCHCMD_s3 is set and if not, sets it.

This is needed because I've use cases where I don't use aws, but s3cmd (due to license).

---
 lib/bb/fetch2/s3.py | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
lib/bb/fetch2/s3.py +0 -0
index 27993aa..9157c46 100644

lib/bb/fetch2/s3.py class S3(FetchMethod): · line 56

Quoted 4 lines
lib/bb/fetch2/s3.py +1 -0
@@ -53,6 +53,8 @@ class S3(FetchMethod):
         else:
             ud.basename = os.path.basename(ud.path)
 
+        ud.basecmd = d.getVar("FETCHCMD_s3", True) or "/usr/bin/env aws s3"

Maybe better to put this after the line below, rather than breaking the flow of setting ud.localfile. Also remove unnecessary True from d.getVar().

Quoted 29 lines
lib/bb/fetch2/s3.py +2 -3
         ud.localfile = d.expand(urllib.parse.unquote(ud.basename))
 
     def download(self, ud, d):
@@ -61,7 +63,7 @@ class S3(FetchMethod):
         Assumes localpath was called first
         """
 
-        cmd = 'aws s3 cp s3://%s%s %s' % (ud.host, ud.path, ud.localpath)
+        cmd = '%s cp s3://%s%s %s' % (ud.basecmd, ud.host, ud.path, ud.localpath)
         bb.fetch2.check_network_access(d, cmd, ud.url)
         runfetchcmd(cmd, d)
 
@@ -83,7 +85,7 @@ class S3(FetchMethod):
         Check the status of a URL
         """
 
-        cmd = 'aws s3 ls s3://%s%s' % (ud.host, ud.path)
+        cmd = '%s ls s3://%s%s' % (ud.basecmd, ud.host, ud.path)
         bb.fetch2.check_network_access(d, cmd, ud.url)
         output = runfetchcmd(cmd, d)
 
--

1.9.1

--
_______________________________________________
bitbake-devel mailing list
[email protected]
http://lists.openembedded.org/mailman/listinfo/bitbake-devel