1
0
mirror of https://git.FreeBSD.org/ports.git synced 2025-01-16 07:58:04 +00:00

www/gitlab-ce: Autogenerate PLIST

Most of the work was done by bofh, I had only to fix some small issues.
This commit is contained in:
Matthias Fechner 2021-07-19 13:20:00 +02:00
parent 54bfb2a577
commit 111056fb15
3 changed files with 77 additions and 36877 deletions

View File

@ -296,6 +296,7 @@ do-install:
${FIND} ${WRKSRC} -name '*.gitkeep' -delete
${FIND} ${WRKSRC} -name '*.gitignore' -delete
${FIND} ${WRKSRC} -name "Gemfile.lock" -delete
${MV} ${WRKSRC}/config/initializers/relative_url.rb.sample ${WRKSRC}/config/initializers/relative_url.rb.example
# get files for workdir with: find . -name "*.example"
${MV} ${WRKSRC}/config/puma.rb.example ${WRKSRC}/config/puma.rb.sample
${MV} ${WRKSRC}/config/secrets.yml.example ${WRKSRC}/config/secrets.yml.sample
@ -320,11 +321,81 @@ do-install:
${MKDIR} ${STAGEDIR}${PREFIX}/www/${PORTNAME}/workhorse/changelogs/unreleased
(cd ${WRKSRC} && ${COPYTREE_SHARE} . ${STAGEDIR}${PREFIX}/www/${PORTNAME})
# Execute this target to automatically generate the correct pkg-plist
makeplist:
$(MAKE) clean patch
${RM} -R ${WRKSRC}/workhorse
php scripts/create-plist.php ${WRKSRC} > pkg-plist
$(MAKE) clean
post-install:
${FIND} -s ${STAGEDIR}${WWWDIR} -not -type d | ${SORT} | \
${SED} -e 's#^${STAGEDIR}${PREFIX}/##' | \
${SED} -E -e '/sample$$/ s#^#@sample #; \
/secrets.yml.sample$$/ s#^@sample #@sample(git,www,0600) #; \
s#${WWWDIR_REL}/bin#@(git,,544) ${WWWDIR_REL}/bin#; \
/db\/schema.rb$$|gitlab.po$$|gitlab.pot$$|gitlab.po.time_stamp$$|locale\/index.js$$/ s#^#@(git,,) #;' >> ${TMPPLIST}
@${ECHO_CMD} "@owner git" >> ${TMPPLIST}
@${ECHO_CMD} "@group www" >> ${TMPPLIST}
@${ECHO_CMD} "@dir(git,git) ${WWWDIR_REL}/" >> ${TMPPLIST}
@${ECHO_CMD} "@dir ${WWWDIR_REL}/app/assets/images/auth_buttons/" >> ${TMPPLIST}
@${ECHO_CMD} "@dir ${WWWDIR_REL}/app/assets/javascripts/locale/" >> ${TMPPLIST}
@${ECHO_CMD} "@dir(git,git,554) ${WWWDIR_REL}/bin" >> ${TMPPLIST}
@${ECHO_CMD} "@dir ${WWWDIR_REL}/config" >> ${TMPPLIST}
@${ECHO_CMD} "@dir(,,700) ${WWWDIR_REL}/builds" >> ${TMPPLIST}
@${ECHO_CMD} "@dir(,,744) ${WWWDIR_REL}/locale" >> ${TMPPLIST}
@${ECHO_CMD} "@dir ${WWWDIR_REL}/lib/assets" >> ${TMPPLIST}
@${ECHO_CMD} "@dir(,,744) ${WWWDIR_REL}/locale/bg" >> ${TMPPLIST}
@${ECHO_CMD} "@dir(,,744) ${WWWDIR_REL}/locale/de" >> ${TMPPLIST}
@${ECHO_CMD} "@dir(,,744) ${WWWDIR_REL}/locale/eo" >> ${TMPPLIST}
@${ECHO_CMD} "@dir(,,744) ${WWWDIR_REL}/locale/es" >> ${TMPPLIST}
@${ECHO_CMD} "@dir(,,744) ${WWWDIR_REL}/locale/fil_PH" >> ${TMPPLIST}
@${ECHO_CMD} "@dir(,,744) ${WWWDIR_REL}/locale/fr" >> ${TMPPLIST}
@${ECHO_CMD} "@dir(,,744) ${WWWDIR_REL}/locale/id_ID" >> ${TMPPLIST}
@${ECHO_CMD} "@dir(,,744) ${WWWDIR_REL}/locale/it" >> ${TMPPLIST}
@${ECHO_CMD} "@dir(,,744) ${WWWDIR_REL}/locale/ja" >> ${TMPPLIST}
@${ECHO_CMD} "@dir(,,744) ${WWWDIR_REL}/locale/ko" >> ${TMPPLIST}
@${ECHO_CMD} "@dir(,,744) ${WWWDIR_REL}/locale/nl_NL" >> ${TMPPLIST}
@${ECHO_CMD} "@dir(,,744) ${WWWDIR_REL}/locale/pl_PL" >> ${TMPPLIST}
@${ECHO_CMD} "@dir(,,744) ${WWWDIR_REL}/locale/pt_BR" >> ${TMPPLIST}
@${ECHO_CMD} "@dir(,,744) ${WWWDIR_REL}/locale/ru" >> ${TMPPLIST}
@${ECHO_CMD} "@dir(,,744) ${WWWDIR_REL}/locale/tr_TR" >> ${TMPPLIST}
@${ECHO_CMD} "@dir(,,744) ${WWWDIR_REL}/locale/uk" >> ${TMPPLIST}
@${ECHO_CMD} "@dir(,,744) ${WWWDIR_REL}/locale/zh_CN" >> ${TMPPLIST}
@${ECHO_CMD} "@dir(,,744) ${WWWDIR_REL}/locale/zh_HK" >> ${TMPPLIST}
@${ECHO_CMD} "@dir(,,744) ${WWWDIR_REL}/locale/zh_TW" >> ${TMPPLIST}
@${ECHO_CMD} "@dir(,,744) ${WWWDIR_REL}/log" >> ${TMPPLIST}
@${ECHO_CMD} "@dir ${WWWDIR_REL}/public" >> ${TMPPLIST}
@${ECHO_CMD} "@dir ${WWWDIR_REL}/public/assets" >> ${TMPPLIST}
@${ECHO_CMD} "@dir(,,700) ${WWWDIR_REL}/public/uploads" >> ${TMPPLIST}
@${ECHO_CMD} "@dir ${WWWDIR_REL}/qa/qa/specs/features/api/2_plan" >> ${TMPPLIST}
@${ECHO_CMD} "@dir ${WWWDIR_REL}/qa/qa/specs/features/api/4_verify" >> ${TMPPLIST}
@${ECHO_CMD} "@dir ${WWWDIR_REL}/qa/qa/specs/features/api/5_package" >> ${TMPPLIST}
@${ECHO_CMD} "@dir ${WWWDIR_REL}/qa/qa/specs/features/api/6_release" >> ${TMPPLIST}
@${ECHO_CMD} "@dir ${WWWDIR_REL}/qa/qa/specs/features/api/7_configure" >> ${TMPPLIST}
@${ECHO_CMD} "@dir ${WWWDIR_REL}/qa/qa/specs/features/api/8_monitor" >> ${TMPPLIST}
@${ECHO_CMD} "@dir ${WWWDIR_REL}/qa/qa/specs/features/browser_ui/5_package" >> ${TMPPLIST}
@${ECHO_CMD} "@dir ${WWWDIR_REL}/spec/support/gitlab-git-test.git/refs/heads" >> ${TMPPLIST}
@${ECHO_CMD} "@dir ${WWWDIR_REL}/spec/support/gitlab-git-test.git/refs/tags" >> ${TMPPLIST}
@${ECHO_CMD} "@dir(,,700) ${WWWDIR_REL}/shared" >> ${TMPPLIST}
@${ECHO_CMD} "@dir(,,700) ${WWWDIR_REL}/shared/artifacts" >> ${TMPPLIST}
@${ECHO_CMD} "@dir(,,700) ${WWWDIR_REL}/shared/artifacts/tmp" >> ${TMPPLIST}
@${ECHO_CMD} "@dir(,,700) ${WWWDIR_REL}/shared/artifacts/tmp/cache" >> ${TMPPLIST}
@${ECHO_CMD} "@dir(,,700) ${WWWDIR_REL}/shared/artifacts/tmp/uploads" >> ${TMPPLIST}
@${ECHO_CMD} "@dir(,,700) ${WWWDIR_REL}/shared/artifacts/tmp/work" >> ${TMPPLIST}
@${ECHO_CMD} "@dir(,,770) ${WWWDIR_REL}/shared/pages" >> ${TMPPLIST}
@${ECHO_CMD} "@dir(,,700) ${WWWDIR_REL}/shared/tmp" >> ${TMPPLIST}
@${ECHO_CMD} "@dir(,,700) ${WWWDIR_REL}/shared/lfs-objects" >> ${TMPPLIST}
@${ECHO_CMD} "@dir(,,700) ${WWWDIR_REL}/shared/registry" >> ${TMPPLIST}
@${ECHO_CMD} "@dir(,,700) ${WWWDIR_REL}/spec/javascripts/fixtures" >> ${TMPPLIST}
@${ECHO_CMD} "@dir(,,770) ${WWWDIR_REL}/tmp" >> ${TMPPLIST}
@${ECHO_CMD} "@dir(,,770) ${WWWDIR_REL}/tmp/backups" >> ${TMPPLIST}
@${ECHO_CMD} "@dir(,,770) ${WWWDIR_REL}/tmp/cache" >> ${TMPPLIST}
@${ECHO_CMD} "@dir(,,770) ${WWWDIR_REL}/tmp/feature_flags" >> ${TMPPLIST}
@${ECHO_CMD} "@dir(,,770) ${WWWDIR_REL}/tmp/pids" >> ${TMPPLIST}
@${ECHO_CMD} "@dir(,,770) ${WWWDIR_REL}/tmp/prometheus_multiproc_dir" >> ${TMPPLIST}
@${ECHO_CMD} "@dir(,,770) ${WWWDIR_REL}/tmp/prometheus_multiproc_dir/puma" >> ${TMPPLIST}
@${ECHO_CMD} "@dir(,,770) ${WWWDIR_REL}/tmp/prometheus_multiproc_dir/sidekiq" >> ${TMPPLIST}
@${ECHO_CMD} "@dir(,,770) ${WWWDIR_REL}/tmp/prometheus_multiproc_dir/unicorn" >> ${TMPPLIST}
@${ECHO_CMD} "@dir(,,770) ${WWWDIR_REL}/tmp/sessions" >> ${TMPPLIST}
@${ECHO_CMD} "@dir(,,770) ${WWWDIR_REL}/tmp/sockets" >> ${TMPPLIST}
@${ECHO_CMD} "@dir(,,770) ${WWWDIR_REL}/tmp/sockets/private" >> ${TMPPLIST}
@${ECHO_CMD} "@dir(,,770) ${WWWDIR_REL}/vendor" >> ${TMPPLIST}
@${ECHO_CMD} "@dir(,,770) ${WWWDIR_REL}/vendor/assets" >> ${TMPPLIST}
@${ECHO_CMD} "@dir(,,770) ${WWWDIR_REL}/vendor/assets/stylesheets" >> ${TMPPLIST}
@${ECHO_CMD} "@dir(,,770) ${WWWDIR_REL}/workhorse/changelogs/unreleased" >> ${TMPPLIST}
.include <bsd.port.mk>

File diff suppressed because it is too large Load Diff

View File

@ -1,184 +0,0 @@
<?php
if(empty($argv[1]))
die("please specify gitlab-worksrc\n");
$strGitLabDir = $argv[1];
if(!is_dir($strGitLabDir))
die("given path is not a dir: $strGitLabDir\n");
if(!is_readable($strGitLabDir))
die("given path is not readable: $strGitLabDir\n");
// remove last slash of path if given to easy
// path handling later
if(strrpos($strGitLabDir, '/') == (strlen($strGitLabDir) - 1))
$strGitLabDir = substr($strGitLabDir, 0, strlen($strGitLabDir) - 1);
$objDir = new RecursiveDirectoryIterator($strGitLabDir);
$objDir = new RecursiveIteratorIterator($objDir);
$arrFiles = array();
// iterate through complete given work-dir
foreach($objDir AS $objFile) {
// skip dirs, we only want files
if(!$objFile->isFile())
continue;
// skip unwanted files
if(in_array($objFile->getExtension(),
array('orig', 'bak', 'gitkeep', 'gitignore')))
continue;
// skip lock file, it shoud be generated when GitLab is started
if('Gemfile.lock' === $objFile->getFilename())
continue;
// strip given dir - we just want the aim-dir
$intEndPosOfDir = strpos($objFile->getRealPath(), $strGitLabDir) + strlen($strGitLabDir);
$strFilePath = substr($objFile->getRealPath(), $intEndPosOfDir);
// list of config files to ignore
$arrConfigFiles = array('/config/database.yml.example',
'/config/gitlab.yml.example',
'/config/puma.rb.example',
'/config/resque.yml.example',
'/config/secrets.yml.example',
'/config/initializers/rack_attack.rb.example',
'/config/cable.yml.example',
'/config/initializers/devise_password_length.rb.example',
'/config/redis.cache.yml.example',
'/config/redis.queues.yml.example',
'/config/redis.shared_state.yml.example',
'/config/sidekiq.yml.example',
'/lib/support/nginx/gitlab',
'/lib/support/nginx/gitlab-ssl',
'/config/secrets.yml' );
// skip config files
if(in_array($strFilePath, $arrConfigFiles))
continue;
$arrFiles[] = "%%WWWDIR%%$strFilePath";
}
sort($arrFiles);
// go through the files and print them
foreach($arrFiles AS $strFile) {
// if a file starts with /bin/ add executable rights
if(is_int(strpos($strFile, '%%WWWDIR%%/bin/'))) {
print "@(git,,544) $strFile\n";
// schema.rb needs git-owner, because its written on updates
} elseif ($strFile === '%%WWWDIR%%/db/schema.rb') {
print "@(git,,) $strFile\n";
// gitlab.po(t) files needs git-owner, because there were compiled on update/installation
} elseif (fnmatch('*/gitlab.pot', $strFile) ||
fnmatch('*/gitlab.po', $strFile) ||
fnmatch('*/gitlab.po.time_stamp', $strFile)) {
print "@(git,,) $strFile\n";
// also there is javascript compiled on update/install which is localiced
} elseif (fnmatch('*/locale/*/app.js', $strFile) ||
fnmatch('*/locale/index.js', $strFile)) {
print "@(git,,) $strFile\n";
// everything else is just fine
} else {
print "$strFile\n";
}
}
// at least print static block of dirs and config files
print "@owner git
@group www
@dir(git,git) %%WWWDIR%%/
@dir %%WWWDIR%%/app/assets/images/auth_buttons/
@dir %%WWWDIR%%/app/assets/javascripts/locale/
@dir(git,git,554) %%WWWDIR%%/bin
@dir %%WWWDIR%%/config
@dir(,,700) %%WWWDIR%%/builds
@dir(,,744) %%WWWDIR%%/locale
@dir %%WWWDIR%%/lib/assets
@dir(,,744) %%WWWDIR%%/locale/bg
@dir(,,744) %%WWWDIR%%/locale/de
@dir(,,744) %%WWWDIR%%/locale/eo
@dir(,,744) %%WWWDIR%%/locale/es
@dir(,,744) %%WWWDIR%%/locale/fil_PH
@dir(,,744) %%WWWDIR%%/locale/fr
@dir(,,744) %%WWWDIR%%/locale/id_ID
@dir(,,744) %%WWWDIR%%/locale/it
@dir(,,744) %%WWWDIR%%/locale/ja
@dir(,,744) %%WWWDIR%%/locale/ko
@dir(,,744) %%WWWDIR%%/locale/nl_NL
@dir(,,744) %%WWWDIR%%/locale/pl_PL
@dir(,,744) %%WWWDIR%%/locale/pt_BR
@dir(,,744) %%WWWDIR%%/locale/ru
@dir(,,744) %%WWWDIR%%/locale/tr_TR
@dir(,,744) %%WWWDIR%%/locale/uk
@dir(,,744) %%WWWDIR%%/locale/zh_CN
@dir(,,744) %%WWWDIR%%/locale/zh_HK
@dir(,,744) %%WWWDIR%%/locale/zh_TW
@dir(,,744) %%WWWDIR%%/log
@dir %%WWWDIR%%/public
@dir %%WWWDIR%%/public/assets
@dir(,,700) %%WWWDIR%%/public/uploads
@dir %%WWWDIR%%/qa/qa/specs/features/api/2_plan
@dir %%WWWDIR%%/qa/qa/specs/features/api/4_verify
@dir %%WWWDIR%%/qa/qa/specs/features/api/5_package
@dir %%WWWDIR%%/qa/qa/specs/features/api/6_release
@dir %%WWWDIR%%/qa/qa/specs/features/api/7_configure
@dir %%WWWDIR%%/qa/qa/specs/features/api/8_monitor
@dir %%WWWDIR%%/qa/qa/specs/features/browser_ui/5_package
@dir %%WWWDIR%%/spec/support/gitlab-git-test.git/refs/heads
@dir %%WWWDIR%%/spec/support/gitlab-git-test.git/refs/tags
@dir(,,700) %%WWWDIR%%/shared
@dir(,,700) %%WWWDIR%%/shared/artifacts
@dir(,,700) %%WWWDIR%%/shared/artifacts/tmp
@dir(,,700) %%WWWDIR%%/shared/artifacts/tmp/cache
@dir(,,700) %%WWWDIR%%/shared/artifacts/tmp/uploads
@dir(,,700) %%WWWDIR%%/shared/artifacts/tmp/work
@dir(,,770) %%WWWDIR%%/shared/pages
@dir(,,700) %%WWWDIR%%/shared/tmp
@dir(,,700) %%WWWDIR%%/shared/lfs-objects
@dir(,,700) %%WWWDIR%%/shared/registry
@dir(,,700) %%WWWDIR%%/spec/javascripts/fixtures
@dir(,,770) %%WWWDIR%%/tmp
@dir(,,770) %%WWWDIR%%/tmp/backups
@dir(,,770) %%WWWDIR%%/tmp/cache
@dir(,,770) %%WWWDIR%%/tmp/feature_flags
@dir(,,770) %%WWWDIR%%/tmp/pids
@dir(,,770) %%WWWDIR%%/tmp/prometheus_multiproc_dir
@dir(,,770) %%WWWDIR%%/tmp/prometheus_multiproc_dir/puma
@dir(,,770) %%WWWDIR%%/tmp/prometheus_multiproc_dir/sidekiq
@dir(,,770) %%WWWDIR%%/tmp/prometheus_multiproc_dir/unicorn
@dir(,,770) %%WWWDIR%%/tmp/sessions
@dir(,,770) %%WWWDIR%%/tmp/sockets
@dir(,,770) %%WWWDIR%%/tmp/sockets/private
@dir(,,770) %%WWWDIR%%/vendor
@dir(,,770) %%WWWDIR%%/vendor/assets
@dir(,,770) %%WWWDIR%%/vendor/assets/stylesheets
@dir(,,770) %%WWWDIR%%/workhorse/changelogs/unreleased
@sample %%WWWDIR%%/config/puma.rb.sample
@sample(git,www,0600) %%WWWDIR%%/config/secrets.yml.sample
@sample %%WWWDIR%%/config/redis.cache.yml.sample
@sample %%WWWDIR%%/config/sidekiq.yml.sample
@sample %%WWWDIR%%/config/cable.yml.sample
@sample %%WWWDIR%%/config/gitlab.yml.sample
@sample %%WWWDIR%%/config/redis.queues.yml.sample
@sample %%WWWDIR%%/config/initializers/devise_password_length.rb.sample
@sample %%WWWDIR%%/config/redis.shared_state.yml.sample
@sample %%WWWDIR%%/config/resque.yml.sample
@sample %%WWWDIR%%/config/database.yml.sample
@sample %%WWWDIR%%/lib/support/nginx/gitlab.sample
@sample %%WWWDIR%%/lib/support/nginx/gitlab-ssl.sample";
print "\n";