Ticket #232: macros.diff

File macros.diff, 3.4 KB (added by dmik, 8 years ago)
  • C:\usr\lib\rpm\macros

    old new  
    13051305%{-S:%{expand:%__scm_setup_%{-S*} %{!-v:-q}}}\
    13061306%{!-N:%autopatch %{-v} %{-p:-p%{-p*}}}
    13071307
     1308#------------------------------------------------------------------------------
     1309# Macros to automatically take sources from SCM rather than from archives
     1310
     1311%__scm_pre_pack\
     1312[ -f RPMBUILD_SOURCE ] && mv RPMBUILD_SOURCE RPMBUILD_SOURCE.orig\
     1313echo "SCM: %{__source_scm}\
     1314URL: %{__source_url}\
     1315Rev: %{__source_rev}" >RPMBUILD_SOURCE\
     1316%{nil}
     1317
     1318# SVN
     1319
     1320%__scm_source_svn\
     1321Source: %{?main_name}%{!?main_name:%{name}}-svn%{?__source_rev:-r%{__source_rev}}.zip\
     1322BuildRequires: subversion zip\
     1323%{nil}
     1324
     1325%__scm_setup_svn\
     1326%if %{?__source_rev:%(sh -c 'if test -f "%SOURCE0" ; then echo 1 ; else echo 0 ; fi')}%{!?__source_rev:0}\
     1327%setup -q\
     1328%else\
     1329%setup -n "%__source_dir" -Tc\
     1330svn export %{?__source_rev:-r %{__source_rev}} %{__source_url} . --force\
     1331%__scm_pre_pack\
     1332%if %{defined __source_rev}\
     1333(rm -f "%SOURCE0" && cd .. && zip %{-A:%{-A*}}%{!-A:-rX9} "%SOURCE0" "%__source_dir")\
     1334%endif\
     1335%endif\
     1336%{nil}
     1337
     1338# Git
     1339
     1340%__scm_source_git\
     1341Source: %{?main_name}%{!?main_name:%{name}}-git%{?__source_rev:-%{__source_rev}}.zip\
     1342BuildRequires: git zip unzip\
     1343%{nil}
     1344
     1345%__scm_setup_git\
     1346%if %{?__source_rev:%(sh -c 'if test -f "%SOURCE0" ; then echo 1 ; else echo 0 ; fi')}%{!?__source_rev:0}\
     1347%setup -q\
     1348%else\
     1349%setup -n "%__source_dir" -Tc\
     1350rm -f "%SOURCE0"\
     1351git archive --format zip --output "%SOURCE0" --prefix "%__source_dir/" --remote "%{__source_url}" "%{?__source_rev}"\
     1352unzip -qq "%SOURCE0" "%__source_dir"/RPMBUILD_SOURCE -d .. 2>/dev/null || :\
     1353%__scm_pre_pack\
     1354(cd .. && zip -mX "%SOURCE0" "%__source_dir"/RPMBUILD_SOURCE*)\
     1355unzip -qq "%SOURCE0" -d ..\
     1356%if %{undefined __source_rev}\
     1357rm -f "%SOURCE0"\
     1358%endif\
     1359%endif
     1360
     1361# GitHub
     1362
     1363%__scm_source_github\
     1364Source: %{?main_name}%{!?main_name:%{name}}-github%{?__source_rev:-%{__source_rev}}.zip\
     1365BuildRequires: wget zip unzip\
     1366%{nil}
     1367
     1368%__scm_setup_github\
     1369%{!?__source_rev:%{error:%0: Revision is required for GitHub}}\
     1370%global __source_url_github_name %(sh -c 'URL="%{__source_url}" ; echo ${URL##*/}')\
     1371%global __source_dir_github %{__source_url_github_name}-%{__source_rev}\
     1372%if %{?__source_rev:%(sh -c 'if test -f "%SOURCE0" ; then echo 1 ; else echo 0 ; fi')}%{!?__source_rev:0}\
     1373%setup -n "%__source_dir_github" -q\
     1374%else\
     1375%setup -n "%__source_dir_github" -Tc\
     1376rm -f "%SOURCE0"\
     1377wget -nv "%{__source_url}/archive/%{__source_rev}.zip" -O "%SOURCE0"\
     1378unzip -qq "%SOURCE0" "%__source_dir_github"/RPMBUILD_SOURCE -d .. 2>/dev/null || :\
     1379%__scm_pre_pack\
     1380(cd .. && zip -mX "%SOURCE0" "%__source_dir_github"/RPMBUILD_SOURCE*)\
     1381unzip -qq "%SOURCE0" -d ..\
     1382%endif
     1383
     1384# User-level macros
     1385
     1386%scm_source()\
     1387%{?SOURCE0:%{error:%0: Source tag is already set to '%SOURCE0'}}\
     1388%{?1:%global __source_scm %1}\
     1389%{?2:%global __source_url %2}\
     1390%{?3:%global __source_rev %3}\
     1391%global __source_dir %{?main_name}%{!?main_name:%{name}}-%{?main_version}%{!?main_version:%{version}}\
     1392%{expand:%%{!?__scm_source_%1:%%{error:%0: SCM type '%{?1}' is invalid}}}\
     1393%{expand:%%{?__scm_source_%1}}\
     1394%{!?__source_url:%{error:%0: URL is required}}\
     1395%{nil}
     1396
     1397%scm_setup(A:)\
     1398%{!?__source_scm:%{error:%0: %%scm_source is required}}\
     1399%{expand:%%{?__scm_setup_%{__source_scm}}}\
     1400%{nil}
     1401
    13081402>>>>>>> .merge-right.r367
    13091403# \endverbatim
    13101404#*/