public inbox for linux-rdma@vger.kernel.org
 help / color / mirror / Atom feed
From: Leon Romanovsky <leon-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
To: Doug Ledford <dledford-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>,
	Jason Gunthorpe
	<jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	Leon Romanovsky <leon-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>,
	Benjamin Drung
	<benjamin.drung-EIkl63zCoXaH+58JC4qpiA@public.gmane.org>,
	Nicolas Morey-Chaisemartin
	<nmoreychaisemartin-l3A5Bk7waGM@public.gmane.org>,
	Alaa Hleihel <alaa-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
Subject: [PATCH rdma-core 2/5] cbuild: Properly create tarball for SuSE
Date: Thu,  2 Nov 2017 18:55:53 +0200	[thread overview]
Message-ID: <20171102165556.22105-3-leon@kernel.org> (raw)
In-Reply-To: <20171102165556.22105-1-leon-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>

From: Alaa Hleihel <alaa-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>

The tarball was not created at the expected path by SUSE scripts,
causing rpmbuild to fail with the following error:
error: File /usr/src/packages/SOURCES/rdma-core-16.tar.gz: No such file or directory

This patch fixes the issue by adding ".rpmmacros" file to root's home
folder and sets "%_topdir" to the path where we place the source tarball.

Signed-off-by: Alaa Hleihel <alaa-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
Signed-off-by: Leon Romanovsky <leon-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
---
 buildlib/cbuild | 19 ++++++++++++-------
 1 file changed, 12 insertions(+), 7 deletions(-)

diff --git a/buildlib/cbuild b/buildlib/cbuild
index d1455b6f..098bec9a 100755
--- a/buildlib/cbuild
+++ b/buildlib/cbuild
@@ -415,13 +415,15 @@ def run_rpm_build(args,spec_file,env):

     image_id = get_image_id(args,env.image_name());
     with private_tmp(args) as tmpdir:
-        os.mkdir(os.path.join(tmpdir,"SOURCES"));
+        builddir = os.path.join(tmpdir,"builddir")
+        os.mkdir(builddir);
+        os.mkdir(os.path.join(builddir,"SOURCES"));
         os.mkdir(os.path.join(tmpdir,"tmp"));

         subprocess.check_call(["git","archive",
                                # This must match the prefix generated buildlib/github-release
                                "--prefix","%s-%s/"%(project,get_version()),
-                               "--output",os.path.join(tmpdir,"SOURCES",tarfn),
+                               "--output",os.path.join(builddir,"SOURCES",tarfn),
                                "HEAD"]);

         with open(spec_file,"r") as inF:
@@ -431,18 +433,21 @@ def run_rpm_build(args,spec_file,env):
             outF.write("".join(spec));

         home = os.path.join(os.path.sep,"home",os.getenv("LOGNAME"));
-        vdir = os.path.join(home,"rpmbuild");

         opts = [
             "run",
             "--rm=true",
-            "-v","%s:%s"%(tmpdir,vdir),
-            "-w",vdir,
+            "-v","%s:%s"%(tmpdir,home),
+            "-w",home,
             "-h","builder-%s"%(image_id[:12]),
             "-e","HOME=%s"%(home),
-            "-e","TMPDIR=%s"%(os.path.join(vdir,"tmp")),
+            "-e","TMPDIR=%s"%(os.path.join(home,"tmp")),
         ];

+        # set _topdir for rpmbuild under SUSE since it's different than RedHat
+        with open(os.path.join(tmpdir,".rpmmacros"),"w") as F:
+            print >> F,"%%_topdir %s"%os.path.join(home,"builddir")
+
         # rpmbuild complains if we do not have an entry in passwd and group
         # for the user we are going to use to do the build.
         with open(os.path.join(tmpdir,"go.py"),"w") as F:
@@ -459,7 +464,7 @@ os.setuid({uid:d});
 for ln in subprocess.check_output(["rpmspec","-P",{tspec_file!r}]).splitlines():
    if ln.startswith("Source:"):
       tarfn = ln.strip().partition(' ')[2].strip();
-os.symlink({tarfn!r},os.path.join("SOURCES",tarfn));
+os.symlink({tarfn!r},os.path.join("builddir","SOURCES",tarfn));
 """.format(passwd=":".join(str(I) for I in pwd.getpwuid(os.getuid())),
            group=":".join(str(I) for I in grp.getgrgid(os.getgid())),
            uid=os.getuid(),
--
2.14.2

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

  parent reply	other threads:[~2017-11-02 16:55 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-02 16:55 [PATCH rdma-core 0/5] Perform package tests in Travis CI Leon Romanovsky
     [not found] ` <20171102165556.22105-1-leon-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
2017-11-02 16:55   ` [PATCH rdma-core 1/5] cbuild: Add udev dependency to package list of SuSE Leap Leon Romanovsky
     [not found]     ` <20171102165556.22105-2-leon-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
2017-11-02 17:30       ` Nicolas Morey-Chaisemartin
2017-11-02 17:32       ` Nicolas Morey-Chaisemartin
     [not found]         ` <3a06c93f-aa0f-93fa-1b74-af6388051f89-l3A5Bk7waGM@public.gmane.org>
2017-11-02 17:42           ` Leon Romanovsky
     [not found]             ` <20171102174220.GD16127-U/DQcQFIOTAAJjI8aNfphQ@public.gmane.org>
2017-11-02 18:04               ` Nicolas Morey-Chaisemartin
     [not found]                 ` <b2493da4-396e-5d24-ffa5-2fcccb9ee85c-l3A5Bk7waGM@public.gmane.org>
2017-11-02 18:32                   ` Leon Romanovsky
     [not found]                     ` <20171102183257.GI16127-U/DQcQFIOTAAJjI8aNfphQ@public.gmane.org>
2017-11-05  8:13                       ` Alaa Hleihel
     [not found]                         ` <76d45899-f1ec-bbd1-e0dd-799e1fa4a400-LDSdmyG8hGV8YrgS2mwiifqBs+8SCbDb@public.gmane.org>
2017-11-06  2:05                           ` Jason Gunthorpe
     [not found]                             ` <20171106020518.GC12187-uk2M96/98Pc@public.gmane.org>
2017-11-06  7:58                               ` Alaa Hleihel
     [not found]                                 ` <aae35c17-8135-9e4b-8ff8-f92558316f95-LDSdmyG8hGV8YrgS2mwiifqBs+8SCbDb@public.gmane.org>
2017-11-06  9:15                                   ` Nicolas Morey-Chaisemartin
     [not found]                                     ` <c9ecd165-c670-c58b-6d7b-006140fc15af-l3A5Bk7waGM@public.gmane.org>
2017-11-06 16:57                                       ` Jason Gunthorpe
2017-11-02 16:55   ` Leon Romanovsky [this message]
     [not found]     ` <20171102165556.22105-3-leon-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
2017-11-02 17:17       ` [PATCH rdma-core 2/5] cbuild: Properly create tarball for SuSE Jason Gunthorpe
     [not found]         ` <20171102171738.GP18874-uk2M96/98Pc@public.gmane.org>
2017-11-02 17:32           ` Nicolas Morey-Chaisemartin
2017-11-02 17:57           ` Leon Romanovsky
     [not found]             ` <20171102175735.GE16127-U/DQcQFIOTAAJjI8aNfphQ@public.gmane.org>
2017-11-02 18:12               ` Jason Gunthorpe
     [not found]                 ` <20171102181217.GS18874-uk2M96/98Pc@public.gmane.org>
2017-11-02 18:25                   ` Leon Romanovsky
     [not found]                     ` <20171102182526.GG16127-U/DQcQFIOTAAJjI8aNfphQ@public.gmane.org>
2017-11-05  8:19                       ` Alaa Hleihel
2017-11-02 16:55   ` [PATCH rdma-core 3/5] travis: Add RedHat and SuSE rpmbuild support Leon Romanovsky
     [not found]     ` <20171102165556.22105-4-leon-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
2017-11-02 17:31       ` Jason Gunthorpe
     [not found]         ` <20171102173123.GQ18874-uk2M96/98Pc@public.gmane.org>
2017-11-02 17:34           ` Nicolas Morey-Chaisemartin
     [not found]             ` <8a65f42d-01d4-6c4a-1bed-b1989cdb9e70-l3A5Bk7waGM@public.gmane.org>
2017-11-02 19:44               ` Jason Gunthorpe
     [not found]                 ` <20171102194420.GT18874-uk2M96/98Pc@public.gmane.org>
2017-11-05  9:19                   ` Alaa Hleihel
2017-11-02 16:55   ` [PATCH rdma-core 4/5] buildlib/cbuild: Add Ubuntu artful Leon Romanovsky
2017-11-02 16:55   ` [PATCH rdma-core 5/5] travis: Test Debian packaging under Artful container Leon Romanovsky
     [not found]     ` <20171102165556.22105-6-leon-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
2017-11-02 17:05       ` Jason Gunthorpe
     [not found]         ` <20171102170554.GO18874-uk2M96/98Pc@public.gmane.org>
2017-11-02 17:18           ` Leon Romanovsky
2017-11-02 17:32           ` Leon Romanovsky
     [not found]             ` <20171102173255.GC16127-U/DQcQFIOTAAJjI8aNfphQ@public.gmane.org>
2017-11-02 17:55               ` Jason Gunthorpe
     [not found]                 ` <20171102175522.GR18874-uk2M96/98Pc@public.gmane.org>
2017-11-05 10:00                   ` Alaa Hleihel
     [not found]                     ` <2e2d65c2-845e-13ad-1022-a859b2fef6a7-LDSdmyG8hGV8YrgS2mwiifqBs+8SCbDb@public.gmane.org>
2017-11-05 13:30                       ` Alaa Hleihel
     [not found]                         ` <f6a250cd-dd4f-5dbe-4b1d-53f2b1f87b32-LDSdmyG8hGV8YrgS2mwiifqBs+8SCbDb@public.gmane.org>
2017-11-06  2:14                           ` Jason Gunthorpe
2017-11-02 21:18   ` [PATCH rdma-core 0/5] Perform package tests in Travis CI Jason Gunthorpe
     [not found]     ` <20171102211851.GV18874-uk2M96/98Pc@public.gmane.org>
2017-11-05  7:17       ` Leon Romanovsky

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=20171102165556.22105-3-leon@kernel.org \
    --to=leon-dgejt+ai2ygdnm+yrofe0a@public.gmane.org \
    --cc=alaa-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org \
    --cc=benjamin.drung-EIkl63zCoXaH+58JC4qpiA@public.gmane.org \
    --cc=dledford-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org \
    --cc=jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org \
    --cc=linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=nmoreychaisemartin-l3A5Bk7waGM@public.gmane.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