I have log like that:
---------
Mycode_is-546-432
SomeStuff1
------
SomeStuff2
SomeStuff3
---------
Mycode_is-526-132
SomeStuff4
------
SomeStuff5
SomeStuff6
---------
Mycode_is-546-432
SomeStuff7
------
SomeStuff8
SomeStuff9
---------
I want parse this file and grep only part from --------- to --------- with code 546-432:
---------
Mycode_is-546-432
SomeStuff1
------
SomeStuff2
SomeStuff3
---------
and
---------
Mycode_is-546-432
SomeStuff7
------
SomeStuff8
SomeStuff9
---------
Tried used something like this:
grep -Pzo '\-{6}\n.+Mycode_is\-546\-432(\n|.)*\-{4}(\n|.)*\-{6}'
But this doesn't work
An gnu awk (gnu due to multiple characters in RS) soulution
awk -v RS="Mycode" '/546-432/{print RS $0}' file
Mycode_is-546-432
SomeStuff1
------
SomeStuff2
SomeStuff3
---------
Mycode_is-546-432
SomeStuff7
------
SomeStuff8
SomeStuff9
---------
By setting Record Selector to Mycode, it will make a bulk of data from Mycode to Mycode, then we search for data /546-432/
A shorter version, but not as good formatting:
awk -v RS="---------" '/546-432/' file
Mycode_is-546-432
SomeStuff1
------
SomeStuff2
SomeStuff3
Mycode_is-546-432
SomeStuff7
------
SomeStuff8
SomeStuff9
Another small variation:
awk -v RS="---------" '{ORS=RS}/546-432/' file
Mycode_is-546-432
SomeStuff1
------
SomeStuff2
SomeStuff3
---------
Mycode_is-546-432
SomeStuff7
------
SomeStuff8
SomeStuff9
---------
Could you please try following.
awk '/^Mycode/{flag=""} /^Mycode_is-546-432/{flag=1} flag' Input_file
Related
I have projects with a directory structure like that
---root
| |--src
| |--project1
| |--model
| | |--incude
| | | |--model
| | | |--modelA.hpp
| | | |--modelB.hpp
| | |--modelA.cpp
| | |--modelB.cpp
| | |--BUILD #1
| |...
| |--view
| |...
| |--common
| | |--include
| | |--common
| | |--data_type.hpp
| |--BUILD #2
|--WORKSPACE
As I have other package in this project and some of them use the same self-defined data type, I defined them in a package named common.
Now I include the data_type.hpp in file modelA.hpp
...
#include "common/data_type.hpp
...
Refering to the stage3 example in the tutorial, the BUID(#1) is like that
cc_library(
name = "modelA",
hdrs = "include/model/modelA.hpp",
deps = ["//src/project/common:data_type"],
copts = ["-Isrc/project/common/include"],
)
and the BUILD(#2) which defines the depedency module data_typeis like that
cc_library(
name = "data_type",
hdrs = ["include/common/data_type.hpp"],
visibility = ["//visibility:public"],
)
However, when I built the code, I got
src/project/model/include/model/modelA.hpp: fatal error: common/data_type.hpp: No such file or directory
Why I have defined copts = ["-Isrc/heimdallr/common/include"] but still got this error?
Please check the Header inclusion checking section of C/C++ Rules from the Bazel document. Relative to the workspace directory, all include paths should be created. Kindly refer to this issue for more information. Thank you!
I'm trying to setup fastlane for an iOS project which has one Git repo for the project and the project contains multiple targets for "different" apps based on the same source code.
I created a second git repo for the signing certificates which should be synced with match, but i don't know where to set the auth stuff for it, because my lane throws the error below.
I start the lane signing which contains sync_code_signing
% fastlane signing --env ENVIRONMENTNAME
and i get the following output
[⠙] 🚀 Ignoring ffi-1.12.2 because its extensions are not built. Try: gem pristine ffi --version 1.12.2
[✔] 🚀
[07:43:16]: Loading from './fastlane/.env.ENVIRONMENTNAME'
[07:43:16]: fastlane detected a Gemfile in the current directory
[07:43:16]: However, it seems like you didn't use `bundle exec`
[07:43:16]: To launch fastlane faster, please use
[07:43:16]:
[07:43:16]: $ bundle exec fastlane signing
[07:43:16]:
[07:43:16]: Get started using a Gemfile for fastlane https://docs.fastlane.tools/getting-started/ios/setup/#use-a-gemfile
[07:43:18]: ------------------------------
[07:43:18]: --- Step: default_platform ---
[07:43:18]: ------------------------------
[07:43:18]: Driving the lane 'signing' 🚀
[07:43:18]: -------------------------------
[07:43:18]: --- Step: sync_code_signing ---
[07:43:18]: -------------------------------
[07:43:18]: Successfully loaded 'PROJECTDIR/fastlane/Matchfile' 📄
+--------------+----------------------------------------------------+
| Detected Values from './fastlane/Matchfile' |
+--------------+----------------------------------------------------+
| git_url | https://gitlab.com/TEAMID/apple-certificates.git |
| storage_mode | git |
+--------------+----------------------------------------------------+
+--------------------------------+----------------------------------------------------+
| Summary for match 2.198.1 |
+--------------------------------+----------------------------------------------------+
| type | development |
| readonly | false |
| generate_apple_certs | true |
| skip_provisioning_profiles | false |
| app_identifier | ["APPID"] |
| username | USERID |
| team_id | TEAMID |
| team_name | TEAMNAME |
| storage_mode | git |
| git_url | https://gitlab.com/TEAMID/apple-certificates.git |
| git_branch | master |
| shallow_clone | false |
| clone_branch_directly | false |
| keychain_name | login.keychain |
| force | false |
| force_for_new_devices | false |
| include_all_certificates | false |
| force_for_new_certificates | false |
| skip_confirmation | false |
| skip_docs | false |
| platform | ios |
| derive_catalyst_app_identifier | false |
| fail_on_name_taken | false |
| skip_certificate_matching | false |
| skip_set_partition_list | false |
| verbose | false |
+--------------------------------+----------------------------------------------------+
[07:43:18]: Cloning remote git repo...
[07:43:18]: If cloning the repo takes too long, you can use the `clone_branch_directly` option in match.
Cloning into '/var/folders/wf/_fzyy4y52hq4ssl02xmwwkx80000gn/T/d20211118-79026-m9y5x8'...
remote: The project you were looking for could not be found or you don't have permission to view it.
fatal: repository 'https://gitlab.com/TEAMID/apple-certificates.git/' not found
[07:43:19]: Exit status: 128
[07:43:19]: Error cloning certificates repo, please make sure you have read access to the repository you want to use
[07:43:19]: Run the following command manually to make sure you're properly authenticated:
[07:43:19]: $ git clone https://gitlab.com/TEAMID/apple-certificates.git /var/folders/wf/_fzyy4y52hq4ssl02xmwwkx80000gn/T/d20211118-79026-m9y5x8
+------------------+---------+
| Lane Context |
+------------------+---------+
| ENVIRONMENT | ENVIRONMENTNAME |
| DEFAULT_PLATFORM | ios |
| PLATFORM_NAME | |
| LANE_NAME | signing |
+------------------+---------+
[07:43:19]: Error cloning certificates git repo, please make sure you have access to the repository - see instructions above
+------+-------------------+-------------+
| fastlane summary |
+------+-------------------+-------------+
| Step | Action | Time (in s) |
+------+-------------------+-------------+
| 1 | default_platform | 0 |
| 💥 | sync_code_signing | 0 |
+------+-------------------+-------------+
[07:43:19]: fastlane finished with errors
[!] Error cloning certificates git repo, please make sure you have access to the repository - see instructions above
Do I have to install gitlab-runner locally for that?
I do not need to automate the process with gitlab-ci file right now, i'm fine calling the fastlane commands via console.
Do I have to install gitlab-runner locally for that? I - of course not.
You obviously don't have access to the git repository that the match uses.
Try cloning match repository directly, you may simply not be in VPN.
I'm trying to setup a CI pipeline to build an application for iOS; specifically my goal, apart from building the app, is to also setup the automatic signing and push it to Testflight in the end. When I try to run the fastlane command to build the app locally it works as expected, however, every time I try to build it on circleci with fastlane I always get a "There are no local code signing identities found" error and then the certificates and provisioning profiles are installed from the repository, but in the end my build fails with an error: "error: There are no accounts registered with Xcode. Add your developer account to Xcode...".
I'm not sure exactly what's the issue with this and I've changed my fastfile many times to include or exclude various options that I've found while debugging this, but I'm still getting the same errors.
Here is how the pipeline looks on circleci:
/Users/distiller/project/********
[⠋] 🚀 [⠙] 🚀 [⠹] 🚀 [⠸] 🚀 [⠼] 🚀 [⠴] 🚀 [⠦] 🚀 [⠧] 🚀 [⠇] 🚀 [⠏] 🚀 [⠋] 🚀 [⠙] 🚀 [⠹] 🚀 [⠸] 🚀 [⠼] 🚀 [⠴] 🚀 [⠦] 🚀 [⠧] 🚀 [⠇] 🚀 [✔] 🚀
[09:00:06]: Sending anonymous analytics information
[09:00:06]: Learn more at https://docs.fastlane.tools/#metrics
[09:00:06]: No personal or sensitive data is sent.
[09:00:06]: You can disable this by adding `opt_out_usage` at the top of your Fastfile
tput: No value for $TERM and no -T specified
tput: No value for $TERM and no -T specified
[09:00:06]: ----------------------------------------
[09:00:06]: --- Step: Verifying fastlane version ---
[09:00:06]: ----------------------------------------
[09:00:06]: Your fastlane version 2.190.0 matches the minimum requirement of 2.171.0 ✅
[09:00:06]: Driving the lane 'ios beta' 🚀
tput: No value for $TERM and no -T specified
tput: No value for $TERM and no -T specified
[09:00:06]: --------------------------------------
[09:00:06]: --- Step: Switch to ios build lane ---
[09:00:06]: --------------------------------------
[09:00:06]: Cruising over to lane 'ios build' 🚖
tput: No value for $TERM and no -T specified
tput: No value for $TERM and no -T specified
[09:00:06]: -----------------------------
[09:00:06]: --- Step: setup_circle_ci ---
[09:00:06]: -----------------------------
[09:00:06]: Creating temporary keychain: "fastlane_tmp_keychain".
[09:00:06]: $ security list-keychains -d user
[09:00:06]: ▸ "/Users/distiller/Library/Keychains/fastlane_tmp_keychain-db"
[09:00:06]: Found keychain '/Users/distiller/Library/Keychains/fastlane_tmp_keychain-db' in list-keychains, adding to search list skipped
[09:00:06]: Enabling match readonly mode.
tput: No value for $TERM and no -T specified
tput: No value for $TERM and no -T specified
[09:00:06]: -------------------
[09:00:06]: --- Step: is_ci ---
[09:00:06]: -------------------
tput: No value for $TERM and no -T specified
tput: No value for $TERM and no -T specified
[09:00:06]: -------------------
[09:00:06]: --- Step: match ---
[09:00:06]: -------------------
[09:00:06]: Successfully loaded '/Users/distiller/project/********/fastlane/Matchfile' 📄
+----------------+-----------------------------------------------------------------+
| Detected Values from './fastlane/Matchfile' |
+----------------+-----------------------------------------------------------------+
| git_url | git#***********************.git |
| storage_mode | git |
| type | adhoc |
| app_identifier | com.********.app |
| username | ****#************.**** |
+----------------+-----------------------------------------------------------------+
+--------------------------------+-----------------------------------------------------------------+
| Summary for match 2.190.0 |
+--------------------------------+-----------------------------------------------------------------+
| type | adhoc |
| readonly | true |
| generate_apple_certs | true |
| skip_provisioning_profiles | false |
| app_identifier | ["com.********.app"] |
| username | ****#************.*** |
| team_id | ***********|
| storage_mode | git |
| git_url | git#***********************.git |
| git_branch | master |
| shallow_clone | false |
| clone_branch_directly | false |
| keychain_name | fastlane_tmp_keychain |
| force | false |
| force_for_new_devices | false |
| skip_confirmation | false |
| skip_docs | false |
| platform | ios |
| derive_catalyst_app_identifier | false |
| fail_on_name_taken | false |
| skip_certificate_matching | false |
| skip_set_partition_list | false |
| verbose | false |
+--------------------------------+-----------------------------------------------------------------+
[09:00:06]: Cloning remote git repo...
[09:00:06]: If cloning the repo takes too long, you can use the `clone_branch_directly` option in match.
[09:00:11]: Checking out branch master...
[09:00:11]: 🔓 Successfully decrypted certificates repo
[09:00:11]: Installing certificate...
[09:00:12]: There are no local code signing identities found.
You can run `security find-identity -v -p codesigning fastlane_tmp_keychain` to get this output.
This Stack Overflow thread has more information: https://stackoverflow.com/q/35390072/774.
(Check in Keychain Access for an expired WWDR certificate: https://stackoverflow.com/a/35409835/774 has more info.)
[09:00:12]: Setting key partition list... (this can take a minute if there are a lot of keys installed)
[09:00:12]: security: SecItemCopyMatching: The specified item could not be found in the keychain.
[09:00:12]: Setting key partition list... (this can take a minute if there are a lot of keys installed)
+-------------------+-----------------------------------------+
| Installed Certificate |
+-------------------+-----------------------------------------+
| User ID | ********** |
| Common Name | ********************* |
| Organisation Unit | ********** |
| Organisation | ***** |
| Country | ** |
| Start Datetime | 2021-07-13 10:57:41 UTC |
| End Datetime | 2022-07-13 10:57:40 UTC |
+-------------------+-----------------------------------------+
[09:00:12]: Installing provisioning profile...
+---------------------+----------------------------------------------+------------------------------------------------------------------------------------------------------------------+
| Installed Provisioning Profile |
+---------------------+----------------------------------------------+------------------------------------------------------------------------------------------------------------------+
| Parameter | Environment Variable | Value |
+---------------------+----------------------------------------------+------------------------------------------------------------------------------------------------------------------+
| App Identifier | | com.********.app |
| Type | | adhoc |
| Platform | | ios |
| Profile UUID | sigh_com.********.app_adhoc | g611aca9-****-*****-****-***** |
| Profile Name | sigh_com.********.app_adhoc_profile-name | match AdHoc com.********.app |
| Profile Path | sigh_com.********.app_adhoc_profile-path | /Users/distiller/Library/MobileDevice/Provisioning Profiles/g611aca9-****-*****-****-*****.mobileprovision |
| Development Team ID | sigh_com.********.app_adhoc_team-id | **************** |
+---------------------+----------------------------------------------+------------------------------------------------------------------------------------------------------------------+
[09:00:12]: All required keys, certificates and provisioning profiles are installed 🙌
[09:00:12]: Setting Provisioning Profile type to 'ad-hoc'
tput: No value for $TERM and no -T specified
tput: No value for $TERM and no -T specified
[09:00:12]: ----------------------------------------------------------
[09:00:12]: --- Step: ns prepare ios --clean --release --env.stage ---
[09:00:12]: ----------------------------------------------------------
[09:00:12]: $ ns prepare ios --clean --release --env.stage
[09:01:48]: ▸
[09:01:48]: ▸ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
[09:01:48]: ▸ * *
[09:01:48]: ▸ * Using material components 5.x the N tabs component *
[09:01:48]: ▸ * will not be fonctional anymore. *
[09:01:48]: ▸ * If you need it migrate to using #nativescript-community/ui-material-tabs *
[09:01:48]: ▸ * or go back the 4.x *
[09:01:48]: ▸ * *
[09:01:48]: ▸ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
[09:01:48]: ▸ Copying template files...
[09:01:53]: ▸ Platform ios successfully added. v8.0.0
[09:01:53]: ▸ Preparing project...
...................................................................
[09:14:59]: ▸ Project successfully prepared (ios)
[09:14:59]: ▸ Configure firebase
tput: No value for $TERM and no -T specified
tput: No value for $TERM and no -T specified
[09:15:00]: ------------------------------------------
[09:15:00]: --- Step: update_code_signing_settings ---
[09:15:00]: ------------------------------------------
+-----------------------+---------------------------------------+
| Summary for code signing settings |
+-----------------------+---------------------------------------+
| use_automatic_signing | true |
| team_id | ********** |
| path | ./platforms/ios/********.xcodeproj |
+-----------------------+---------------------------------------+
[09:15:00]: Updating the Automatic Codesigning flag to enabled for the given project '/Users/distiller/project/********/platforms/ios/********.xcodeproj/project.pbxproj'
[09:15:00]: Set Team id to: ********* for target: ******** for build configuration: Debug
[09:15:00]: Set Team id to: ********* for target: ******** for build configuration: Release
[09:15:00]: Successfully updated project settings to use Code Sign Style = 'Automatic'
[09:15:00]: Modified Targets:
[09:15:00]: * ********
[09:15:00]: Modified Build Configurations:
[09:15:00]: * Debug
[09:15:00]: * Release
tput: No value for $TERM and no -T specified
tput: No value for $TERM and no -T specified
[09:15:00]: -----------------------
[09:15:00]: --- Step: build_app ---
[09:15:00]: -----------------------
[09:15:00]: Resolving Swift Package Manager dependencies...
[09:15:00]: $ xcodebuild -resolvePackageDependencies -workspace ./platforms/ios/********.xcworkspace -scheme ********
[09:15:06]: ▸ resolved source packages:
[09:15:06]: $ xcodebuild -showBuildSettings -workspace ./platforms/ios/********.xcworkspace -scheme ********
[09:15:09]: Command timed out after 3 seconds on try 1 of 4, trying again with a 6 second timeout...
[09:15:12]: Detected provisioning profile mapping: {:"com.********.app"=>"match AdHoc com.********.app"}
+----------------------------------------------------------+--------------------------------------------------------------+
| Summary for gym 2.190.0 |
+----------------------------------------------------------+--------------------------------------------------------------+
| xcargs | -allowProvisioningUpdates |
| scheme | ******** |
| workspace | ./platforms/ios/********.xcworkspace |
| export_method | ad-hoc |
| export_options.provisioningProfiles.com.********.app | match AdHoc com.********.app |
| clean | false |
| output_directory | ~/project/output/gym |
| output_name | ******** |
| silent | false |
| skip_package_ipa | false |
| skip_package_pkg | false |
| build_path | /Users/distiller/Library/Developer/Xcode/Archives/2021-08-03 |
| result_bundle | false |
| buildlog_path | ~/project/output/buildlogs/gym |
| destination | generic/platform=iOS |
| skip_profile_detection | false |
| skip_package_dependencies_resolution | false |
| disable_package_automatic_updates | false |
| use_system_scm | false |
| xcode_path | /Applications/Xcode-11.GM.Seed.2.app |
+----------------------------------------------------------+--------------------------------------------------------------+
[09:15:12]: $ set -o pipefail && xcodebuild -workspace ./platforms/ios/********.xcworkspace -scheme ******** -destination 'generic/platform=iOS' -archivePath /Users/distiller/Library/Developer/Xcode/Archives/2021-08-03/********\ 2021-08-03\ 09.15.12.xcarchive -allowProvisioningUpdates archive | tee /Users/distiller/project/output/buildlogs/gym/********-********.log | xcpretty
[09:15:18]: ▸ ❌ error: There are no accounts registered with Xcode. Add your developer account to Xcode (in target '********' from project '********')
[09:15:18]: ▸ ❌ error: No profiles for 'com.********.app' were found: Xcode couldn't find any iOS App Development provisioning profiles matching 'com.********.app'. (in target '********' from project '********')
[09:15:18]: ▸ ** ARCHIVE FAILED **
❌ error: There are no accounts registered with Xcode. Add your developer account to Xcode (in target '********' from project '********')
❌ error: No profiles for 'com.********.app' were found: Xcode couldn't find any iOS App Development provisioning profiles matching 'com.********.app'. (in target '********' from project '********')
** ARCHIVE FAILED **
[09:15:18]: Exit status: 65
[09:15:18]:
[09:15:18]: Maybe the error shown is caused by using the wrong version of Xcode
[09:15:18]: Found multiple versions of Xcode in '/Applications/'
[09:15:18]: Make sure you selected the right version for your project
[09:15:18]: This build process was executed using '/Applications/Xcode-11.GM.Seed.2.app'
[09:15:18]: If you want to update your Xcode path, either
[09:15:18]:
[09:15:18]: - Specify the Xcode version in your Fastfile
[09:15:18]: ▸ xcversion(version: "8.1") # Selects Xcode 8.1.0
[09:15:18]:
[09:15:18]: - Specify an absolute path to your Xcode installation in your Fastfile
[09:15:18]: ▸ xcode_select "/Applications/Xcode8.app"
[09:15:18]:
[09:15:18]: - Manually update the path using
[09:15:18]: ▸ sudo xcode-select -s /Applications/Xcode.app
[09:15:18]:
+---------------+--------------------------------------+
| Build environment |
+---------------+--------------------------------------+
| xcode_path | /Applications/Xcode-11.GM.Seed.2.app |
| gym_version | 2.190.0 |
| export_method | ad-hoc |
| sdk | iPhoneOS13.0.sdk |
+---------------+--------------------------------------+
[09:15:18]: ▸ note: Using new build system
[09:15:18]: ▸ note: Planning build
[09:15:18]: ▸ note: Constructing build description
[09:15:18]: ▸ error: There are no accounts registered with Xcode. Add your developer account to Xcode (in target '********' from project '********')
[09:15:18]: ▸ error: No profiles for 'com.********.app' were found: Xcode couldn't find any iOS App Development provisioning profiles matching 'com.********.app'. (in target '********' from project '********')
[09:15:18]:
[09:15:18]: ⬆️ Check out the few lines of raw `xcodebuild` output above for potential hints on how to solve this error
[09:15:18]: 📋 For the complete and more detailed error log, check the full log at:
[09:15:18]: 📋 /Users/distiller/project/output/buildlogs/gym/********-********.log
[09:15:18]:
[09:15:18]: Looks like fastlane ran into a build/archive error with your project
[09:15:18]: It's hard to tell what's causing the error, so we wrote some guides on how
[09:15:18]: to troubleshoot build and signing issues: https://docs.fastlane.tools/codesigning/getting-started/
[09:15:18]: Before submitting an issue on GitHub, please follow the guide above and make
[09:15:18]: sure your project is set up correctly.
[09:15:18]: fastlane uses `xcodebuild` commands to generate your binary, you can see the
[09:15:18]: the full commands printed out in yellow in the above log.
[09:15:18]: Make sure to inspect the output above, as usually you'll find more error information there
[09:15:18]:
+------------------------------------+--------------------------------------------------------------+
| Lane Context |
+------------------------------------+--------------------------------------------------------------+
| PLATFORM_NAME | ios |
| LANE_NAME | ios beta |
| KEYCHAIN_PATH | ~/Library/Keychains/fastlane_tmp_keychain |
| ORIGINAL_DEFAULT_KEYCHAIN | "/Users/distiller/Library/Keychains/login.keychain-db" |
| SIGH_PROFILE_TYPE | ad-hoc |
| MATCH_PROVISIONING_PROFILE_MAPPING | {"com.********.app"=>"match AdHoc com.********.app"} |
+------------------------------------+--------------------------------------------------------------+
[09:15:18]: Error building the application - see the log above
+------+----------------------------------------------+-------------+
| fastlane summary |
+------+----------------------------------------------+-------------+
| Step | Action | Time (in s) |
+------+----------------------------------------------+-------------+
| 1 | Verifying fastlane version | 0 |
| 2 | Switch to ios build lane | 0 |
| 3 | setup_circle_ci | 0 |
| 4 | is_ci | 0 |
| 5 | match | 5 |
| 6 | ns prepare ios --clean --release --env.stage | 887 |
| 7 | update_code_signing_settings | 0 |
| 💥 | build_app | 18 |
+------+----------------------------------------------+-------------+
[09:15:18]: fastlane finished with errors
[!] Error building the application - see the log above
failed or skipped
cat: /Users/distiller/Library/Logs/gym/********-********.log: No such file or directory
log not found
Some things that I've tried on the fastfile is to:
create a temporary keychain and unlock it by using create_keychain(...) and unlock_keychain()
include keychain_name and keychain_password on match(...)
use setup_circle_ci which is an option for circleci to create a temporary keychain for you.
Lastly, this is what my fastfile looks like:
fastlane_version '2.171.0'
platform :ios do
before_all do
setup_circle_ci
end
desc 'Fetch certificates and provisioning profiles'
lane :certificates do
match(type: 'development')
match(type: "appstore")
end
desc 'Build the iOS application.'
lane :build do
# setup_circle_ci
# sh("security", "list-keychains", "-d", "user")
# create_keychain(
# name: "login.keychain",
# password: "test",
# default_keychain: true,
# unlock: true,
# timeout: 3600,
# lock_when_sleeps: false,
# add_to_search_list: true
# )
# unlock_keychain(
# path: "/Users/distiller/Library/Keychains/login.keychain",
# add_to_search_list: :replace,
# password: "test",
# )
# sh("security", "find-identity", "-v", "-p", "codesigning", "login.keychain")
match(
type: "appstore",
readonly: is_ci,
keychain_name: "fastlane_tmp_keychain",
keychain_password: "",
verbose: true
)
# sh("security", "find-identity", "-v", "-p", "codesigning", "login.keychain")
sh("ns", "prepare", "ios", "--clean", "--release", "--env.stage")
update_code_signing_settings(
use_automatic_signing: true,
team_id: "*****",
path: "./platforms/ios/*******.xcodeproj"
)
# update_project_provisioning(
# xcodeproj: "./platforms/ios/*******.xcodeproj",
# profile: ENV["sigh_com.*******.app_adhoc_profile-path"]
# # build_configuration: "Release"
# )
build_app(
xcargs: "-allowProvisioningUpdates",
scheme: "*******",
workspace: './platforms/ios/*******.xcworkspace',
export_method: "app-store"
# export_options: {
# provisioningProfiles: {
# "com.*******.app" => "match Appstore com.********.app"
# }
# }
)
end
desc 'Ship to Testflight.'
lane :beta do
build
changelog_from_git_commits
upload_to_testflight(
beta_app_feedback_email: "****#*******.****",
beta_app_description: "Test deployment",
demo_account_required: false,
distribute_external: false,
groups: [],
notify_external_testers: false,
skip_submission: true
)
end
end
If anyone can help me with this you'll be saving me! Thanks!
I have the following text file output.txt that I created (it has 15 colums including symbol | ):
[66] | alert:n | 3.0 | 10/22/2020-14:45:50.066928 | local_ip | 123.123.123.123 | United States of America | SURICATA STREAM ESTABLISHED SYNACK resend with different ACK
[67] | alert:n | 3.0 | 10/22/2020-14:45:51.096955 | local_ip | 12.12.12.11 | United States of America | SURICATA STREAM ESTABLISHED SYNACK resend with different ACK
[68] | alert:n | 3.0 | 10/22/2020-14:45:53.144942 | 123.123.123.123 | local_ip | United States of America | SURICATA STREAM ESTABLISHED SYNACK resend with different ACK
[69] | alert:n | 3.0 | 10/22/2020-14:45:57.176956 | local_ip | 68.73.203.109 | United States of America | SURICATA STREAM ESTABLISHED SYNACK resend with different ACK
[70] | alert:n | 3.0 | 10/22/2020-14:46:05.240953 | 123.123.123.123 | local_ip | United States of America | SURICATA STREAM ESTABLISHED SYNACK resend with different ACK
[71] | alert:n | 3.0 | 10/22/2020-14:46:21.624979 | local_ip | 68.73.203.109 | United States of America | SURICATA STREAM ESTABLISHED SYNACK resend with different ACK
I'm familiar with the bash script, let say if I want to count total specific ip of 123.123.123.123 that can be found in the 9th column, I can implement like this:
#!/bin/bash
ip = "123.123.123.123"
report = output.txt
src_ip_count=$(grep "${ip}" "${report}" | awk '{ print $9 }' | grep -v "local_ip" | uniq -c | awk '{ print $1 }')
and the output is:
[root#me lua-output]# ./test.sh
2
How do I implement the same code above in lua ? I know there is popen function can be used.. but is there a native way to do this in lua ? Also if I use popen, I also need to pass variable $ip and $report inside that command which I'm not sure if it's possible.
There's a bunch of ways to go about this, really. Assuming you read your data from stdin (though the same works for any file you manually open), you can do something like this:
local c = 0
for line in io.lines() do -- or or file:lines() if you have a different file
if line:find("123.123.123.123") -- Only lines containing the IP we care about
if (true) -- Whatever other conditions you want to apply
c = c + 1
end
end
end
print(c)
Lua doesn't have a concept of what a "column" is, so you have to build that yourself as well. Either use a pattern to count spaces, or split the string into a table and index it.
You mentioned that if it is possible to use variable inside popen in lua. It is possible, and you can use grep command in lua.
So in lua you can do this:
-- lua script using grep example
ip = "123.123.123.123"
report = output.txt
local cmd = "grep -F " .. ip .. " " .. report .. " | awk '{ print $9 }' | grep -v 'local_ip' | uniq -c | awk '{ print $1 }'"
local handle = io.popen(cmd)
local src_ip_count = handle:read("*a")
print(src_ip_count)
handle:close()
output:
2
It's been a while since I've done any Erlang and I wanted to get back into it and use rebar to do it. I have a simple module-test combo that I've verified compiles okay, but when I try and compile it through rebar, nothing happens:
PS C:\Users\Magnus\Programming\binlog_parser_demo> rebar co -vv
DEBUG: Consult config file "c:/Users/Magnus/Programming/binlog_parser_demo/rebar.config"
DEBUG: Rebar location: "c:/Users/Magnus/Programming/rebar/rebar"
DEBUG: is_rel_dir(C:/Users/Magnus/Programming/binlog_parser_demo) -> false
DEBUG: Available deps: []
DEBUG: Missing deps : []
DEBUG: Plugins requested while processing C:/Users/Magnus/Programming/binlog_parser_demo: []
DEBUG: Predirs: []
==> binlog_parser_demo (compile)
DEBUG: Matched required ERTS version: 7.0 -> .*
DEBUG: Matched required OTP release: 18 -> .*
DEBUG: Min OTP version unconfigured
DEBUG: Postdirs: []
PS C:\Users\Magnus\Programming\binlog_parser_demo> ls -r
Directory: C:\Users\Magnus\Programming\binlog_parser_demo
Mode LastWriteTime Length Name
---- ------------- ------ ----
d---- 3/9 15:42 src
d---- 3/9 14:42 test
Directory: C:\Users\Magnus\Programming\binlog_parser_demo\src
Mode LastWriteTime Length Name
---- ------------- ------ ----
-a--- 3/9 14:43 2293 binlog_parser_demo.erl
Directory: C:\Users\Magnus\Programming\binlog_parser_demo\test
Mode LastWriteTime Length Name
---- ------------- ------ ----
-a--- 3/9 14:51 2662 binlog_parser_demo_tests.erl
What am I doing wrong? The file structure is what I got when I ran the template rebar create template=simplemod modid=binlog_parser_demo (and replaced the generated files with my old prewritten ones). I've verified that erlc is in the path and available and that erlc can compile the files okay when run independently.
You need to add a .app.src file to your src directory to define your application. The contents might look something like the following, but you'll need to adjust it to make it work properly for your case.
{application, binlog_parser, [
{description, "Binlog Parser"},
{vsn, "0.1"},
{registered, []},
{applications, [kernel, stdlib]}
]}.
See the rebar "Getting Started" docs for more information.