{"id":1229,"date":"2012-03-18T12:26:15","date_gmt":"2012-03-18T10:26:15","guid":{"rendered":"http:\/\/raftaman.net\/?p=1229"},"modified":"2021-05-15T11:46:39","modified_gmt":"2021-05-15T09:46:39","slug":"changing-rpmbuild-working-directory","status":"publish","type":"post","link":"https:\/\/possiblelossofprecision.net\/?p=1229","title":{"rendered":"Changing rpmbuild working directory"},"content":{"rendered":"<p>Usually, rpmbuild related variables are set in <code>~\/.rpmmacros<\/code>. To change the current working directory, one could simply alter the default settings:<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\r\n%_topdir      %(echo $HOME)\/rpmbuild\r\n<\/pre>\n<p>This would change rpmbuild&#8217;s working directory on a <strong>per-user<\/strong> basis.<\/p>\n<p>Sometimes it&#8217;s quite convenient to keep the default setting and change the working directory on a <strong>per-project<\/strong> basis:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\n$ rpmbuild --define &quot;_topdir workingdir&quot; -ba project.spec\r\n<\/pre>\n<p>To use the <strong>current directory<\/strong> as working directory, one could invoke <code>rpmbuild<\/code> as follows:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\n$ rpmbuild --define &quot;_topdir `pwd`&quot; -ba SPECS\/project.spec\r\n<\/pre>\n<p>Careful: <strong>Double quotes<\/strong> are mandatory as well as having a proper subdirectory structure in the new working directory (BUILD, SRPM, RPM, SPECS and SOURCES).<\/p>\n<p>Resources:<br \/>\n<a href=\"http:\/\/www.rpm.org\/max-rpm\/s1-rpm-anywhere-different-build-area.html\">http:\/\/www.rpm.org\/max-rpm\/s1-rpm-anywhere-different-build-area.html<\/a><br \/>\n<a href=\"http:\/\/stackoverflow.com\/questions\/416983\/why-is-topdir-set-to-its-default-value-when-rpmbuild-called-from-tcl\">http:\/\/stackoverflow.com\/questions\/416983\/why-is-topdir-set-to-its-default-value-when-rpmbuild-called-from-tcl<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Usually, rpmbuild related variables are set in ~\/.rpmmacros. To change the current working directory, one could simply alter the default settings: %_topdir %(echo $HOME)\/rpmbuild This would change rpmbuild&#8217;s working directory on a per-user basis. Sometimes it&#8217;s quite convenient to keep the default setting and change the working directory on a per-project basis: $ rpmbuild &#8211;define &quot;_topdir workingdir&quot; -ba project.spec To&#8230; <a href=\"https:\/\/possiblelossofprecision.net\/?p=1229\">Read more &raquo;<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[7,48],"class_list":["post-1229","post","type-post","status-publish","format-standard","hentry","category-uncategorized","tag-fedora","tag-rpm"],"_links":{"self":[{"href":"https:\/\/possiblelossofprecision.net\/index.php?rest_route=\/wp\/v2\/posts\/1229","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/possiblelossofprecision.net\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/possiblelossofprecision.net\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/possiblelossofprecision.net\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/possiblelossofprecision.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1229"}],"version-history":[{"count":7,"href":"https:\/\/possiblelossofprecision.net\/index.php?rest_route=\/wp\/v2\/posts\/1229\/revisions"}],"predecessor-version":[{"id":1231,"href":"https:\/\/possiblelossofprecision.net\/index.php?rest_route=\/wp\/v2\/posts\/1229\/revisions\/1231"}],"wp:attachment":[{"href":"https:\/\/possiblelossofprecision.net\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1229"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/possiblelossofprecision.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1229"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/possiblelossofprecision.net\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1229"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}